Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


oracle.rules.sdk.browser
Class ClassBrowser

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byoracle.rules.sdk.browser.Browser
              extended byoracle.rules.sdk.browser.ClassBrowser

All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ClassBrowser
extends Browser

Provides browsing for collections of Java class files. Any class accessed by the ClassBrowser may be imported into the datamodel of a RuleDictionary. Once Java classes have been imported, the class may be used as a FactType for an Oracle Business Rule.

Classes may be in Jar files or inside a directory containing .class files. Any class file not in a jar must be in containing directory that is not part of the package hierarchy. For example, if the the class X is part of package javapkg.u.v, the ClassBrowser would expect the class file to be located in a directory structure like: containting-dir/javapkg/u/v/X.class .
The browsed classes need not be in the current RuleDictionary's DataModel.
Classes and jars are browsable after they have been made visible to ClassBrowser's classpath by use of the addClassPath method.
Each java class or package is represented by an instance of a JavaNode or JavaPackageNode.

Package Hierarchies

The JavaNode and JavaPackageNode instances are organized into a collection that is returned by the NodeTable property. NodeTable's contain the Nodes representing the immedidate children. The contents of the NodeTable is controlled by the contents of the ClassPath list. The addClassPath, removeClassPath, clearClassPath methods add, delete, and clear entries of the class path list. The class hierarchy is represented by nested NodeTable's. Each successive hierachy level is represented by a NodeTable. JavaPackageNode's have a NodeTable representing its children. The children of a JPackage are other JPackage's and JClassNode's. A JavaNode has no children and therefore does not have a node table.
For this package: a.b containg a class named C1 the structure will be, a owns b owns C1 The nodes are accessed a and b will be JPackage nodes. C1 will be a JClassNode. The child packages and classes are reached by accessing the NodeTable in each node (getNestedTable).
Class trees are traversed via the getNestedTable and getNode methods.
Loading of a particular class into the datamodel is the responsibility of JClassNode and JPackageNode classes.

See Also:
Serialized Form

Field Summary
static java.lang.String PROP_NODE_TABLE
           
static java.lang.String PROP_PATH_LIST
           

 

Fields inherited from class oracle.rules.sdk.browser.Browser
PROP_EDITOR_DATA_MODEL, PROP_RULE_DICTIONARY

 

Constructor Summary
ClassBrowser(RuleDictionary rd)
          create a ClassBrowser, with a RuleDictionary.

 

Method Summary
 void addClassPath(java.lang.String addedPath)
          Add the specified path to the set of paths that are searched for Java Classes to be browsed.
 void clearClassPath()
          Remove all user created entries from the class path list used to create the list of packages and classes.
 java.lang.String[] getClassPath()
          Return the list of class paths created by addClassPath.
 NodeTable getNodeTable()
          retrieves the NodeTable associated with the set of class paths that have been added to this browser instance
The NodeTable will always reflect the java runtime classes if no other java classes or jars have been added to the this instances class path.
 void removeClassPath(java.lang.String classpath)
          remove the specified class path from the the classpath list.

 

Methods inherited from class oracle.rules.sdk.browser.Browser
get, getDictionary, set

 

Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values

 

Methods inherited from class java.util.AbstractMap
equals, hashCode, toString

 

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface java.util.Map
equals, hashCode

 

Field Detail

PROP_PATH_LIST

public static java.lang.String PROP_PATH_LIST

PROP_NODE_TABLE

public static java.lang.String PROP_NODE_TABLE

Constructor Detail

ClassBrowser

public ClassBrowser(RuleDictionary rd)
             throws RulesSDKException
create a ClassBrowser, with a RuleDictionary.

Method Detail

addClassPath

public void addClassPath(java.lang.String addedPath)
                  throws RulesSDKException
Add the specified path to the set of paths that are searched for Java Classes to be browsed. The path may be a directory containing java classes or a jar file.
When specifying a Jar File, the entire absolute path of the jar file must be specified. For example, if the jar file my.jar exists and is in the directory /user/local/jars, then the path specified to addClassPath will be: /user/loca/jars/my.jar
When specifying a path for individual class files, the directory must be one level above the root of the package structure. For example, if a package exists named x.y.z and contains classes: Class1 and Class2, the ClassBrowser expects to x/y/z/Class1.class and x/y/z/Class2.class to exist and that the top level of the package will be contained in the directory specified in the path. Therefore, /some-dir/x/y/z/Class1.class and /some-dir/x/y/z/Class2.class must exist and the path /some-dir is the String that should be supplied to addClassPath.
Parameters:
addedPath - is a String containing the absolute path to class or jar files
Throws:
RulesSDKException - if the specified path does not contain valid Java Classes.

clearClassPath

public void clearClassPath()
                    throws RulesSDKException
Remove all user created entries from the class path list used to create the list of packages and classes.
This does NOT remove the java packages (java, javax, org) classes from the list of available classes.
Throws:
RulesSDKException

getClassPath

public java.lang.String[] getClassPath()
Return the list of class paths created by addClassPath.
The java, javax, org packages not listed in the class path list, but are always included by the ClassBrowser.
Returns:
String [] list of current paths

removeClassPath

public void removeClassPath(java.lang.String classpath)
                     throws RulesSDKException
remove the specified class path from the the classpath list. The classpath list controls the contents of the NodeTable.
Parameters:
classpath - String desribing the classpath
Throws:
RulesSDKException - when path is not in the instance list

getNodeTable

public NodeTable getNodeTable()
                       throws RulesSDKException
retrieves the NodeTable associated with the set of class paths that have been added to this browser instance
The NodeTable will always reflect the java runtime classes if no other java classes or jars have been added to the this instances class path.
The NodeTable contains the list of nodes visible (by inclusion in the classpath or by opening a node that has children) NodeTable
Throws:
RulesSDKException

Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


Copyright © 2006, Oracle. All rights reserved.