|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.cpl.model.IlpDefaultClassManager
public class IlpDefaultClassManager
Defines a default implementation for the class manager.
This default implementation stores dynamic classes and makes it possible
to load classes from XML files. It supports predefined business classes,
that is, Java classes with a static IlpClass getIlpClass() method.
This class manager also creates dynamic classes to represent
JavaBean classes using introspection. It automatically creates
IlpClass instances to wrap Java classes when the
getClass method is called.
It also provides a default class manager reference, which is verified when a dynamic class cannot be found locally.
| Constructor Summary | |
|---|---|
IlpDefaultClassManager()
Creates a new class manager for the default application context. |
|
IlpDefaultClassManager(IlpContext c)
Creates a new class manager for the given context. |
|
| Method Summary | |
|---|---|
void |
addClass(IlpClass aClass)
Adds a class to this manager. |
protected void |
fetchPredefinedClasses()
Fetches the predefined classes. |
protected void |
fetchPredefinedClassesOnce()
This method must be called at the beginning of each get or add method. |
IlpClass |
getClass(Class aClass)
Retrieves the dynamic class corresponding to the specified Java class. |
IlpClass |
getClass(String name)
Returns the class specified by name. |
Collection |
getClasses()
Returns the classes of the model as a Collection. |
IlpClassManager |
getDefaultClassManager()
Retrieves the default class manager. |
Collection |
getRootClasses()
Returns the root classes of the model in a collection of IlpClass instances. |
boolean |
hasClass(IlpClass aClass)
Returns true if the given class belongs to this model. |
boolean |
hasClass(String name)
Returns whether a class with the given name is registered or not
in the manager. |
void |
parse(String uri,
IlpTypeConverter typeConverter,
IlpURLAccessService urlAccessService)
Parses an XML document containing a model from a system identifier (URI). |
void |
parse(String uri,
IlpTypeConverter typeConverter,
IlpURLAccessService urlAccessService,
boolean validate)
Parses an XML document containing a model from a system identifier (URI). |
void |
removeClass(IlpClass aClass)
Removes a class from this manager. |
void |
removeClass(String name)
Remove the class with the given name from this manager. |
void |
setDefaultClassManager(IlpClassManager defaultManager)
Sets the default class manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlpDefaultClassManager()
public IlpDefaultClassManager(IlpContext c)
c - Application context| Method Detail |
|---|
public IlpClassManager getDefaultClassManager()
public void setDefaultClassManager(IlpClassManager defaultManager)
public Collection getRootClasses()
IlpClass instances.
Root classes are classes that do not inherit from another class.
getRootClasses in interface IlpClassManagerCollection containing the root classes of the model.IlpClasspublic Collection getClasses()
Collection.
getClasses in interface IlpClassManagerCollection.IlpClasspublic IlpClass getClass(String name)
name.
If there is no class called name, this method will try to
load the corresponding Java class using the Class Loader Service
(see (@link ilog.cpl.service.IlpClassLoaderService}).
If there is such a Java class: if this Java class has a
static IlpClass GetIlpClass() method, the returned IlpClass
is added to the current class manager. Otherwise, the class is considered
to be a JavaBean and is wrapped in an IlpBeansClass.
getClass in interface IlpClassManagername - The name of the class to be retrieved.
name or null if this
class does not exist.IlpBeansClasspublic boolean hasClass(IlpClass aClass)
true if the given class belongs to this model.
hasClass in interface IlpClassManageraClass - The class being checked.
true if the class belongs to the model.
IllegalArgumentException - if the given class is null.public void addClass(IlpClass aClass)
addClass in interface IlpMutableClassManageraClass - The class being added.public void removeClass(IlpClass aClass)
removeClass in interface IlpMutableClassManageraClass - The class being removed.public IlpClass getClass(Class aClass)
getClass(aClass).
IlpClass or null.getClass(String)public void removeClass(String name)
name - Name of the class that will be removed
IllegalArgumentException - if the given class name is invalid.public boolean hasClass(String name)
name is registered or not
in the manager.
Note that calling this method is not equivalent to
getClass(name) != null, as it will not look for
a Java class with the given name.
hasClass in interface IlpClassManagername - The name of the class.
true if a class with the given name is registered, or
false otherwise.getClass(String)protected void fetchPredefinedClassesOnce()
get or add method.
It calls fetchPredefinedClasses() the first time it is invoked.
If you redefine a method of this class, or write new methods that access the
classes in your own class manager implementation, call this method before
your methods.
protected void fetchPredefinedClasses()
This method is called once before any other method returns.
You may want to redefine this method to register, as soon as possible, your own predefined classes. This method is useful if you need to display a list of whole classes, for example.
To register a Java class as an IlpClass, call the
getClass(your class.class.getName()); method.
Note that, if you redefine this method, do not forget to call the super class method.
Note also that usually classes do not need to be registered as soon as possible for the class manager to behave well, except if you need to display a list of them.
getClass(String)
public void parse(String uri,
IlpTypeConverter typeConverter,
IlpURLAccessService urlAccessService)
throws IOException,
SAXException
If the system identifier is a URL, it does not have to be fully resolved by the application before it is passed to the parser.
uri - The URI.typeConverter - The type converter used to load the XML document.urlAccessService - The URL access service used to resolve the URI.
SAXException - which is any SAX exception, possibly wrapping another exception.
IOException - which is an IO exception from the parser,
possibly from a byte stream or character stream supplied by the application.IlpURLAccessService
public void parse(String uri,
IlpTypeConverter typeConverter,
IlpURLAccessService urlAccessService,
boolean validate)
throws IOException,
SAXException
If the system identifier is a URL, it does not have to be fully resolved by the application before it is passed to the parser.
uri - The URI.typeConverter - The type converter used to load the XML document.urlAccessService - The URL access service used to resolve the URI.validate - Validates or not the XML document.
SAXException - which is any SAX exception, possibly wrapping another exception.
IOException - which is an IO exception from the parser,
possibly from a byte stream or character stream supplied by the application.IlpURLAccessService
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||