|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.metadata.DescriptorRepository
public final class DescriptorRepository
The repository containing all object mapping and manipulation information of
all used persistent objects.
Note: Be careful when use references of this class or caching instances of this class,
because instances could become invalid (see MetadataManager).
| Field Summary |
|---|
| Fields inherited from interface org.apache.ojb.broker.locking.IsolationLevels |
|---|
IL_DEFAULT, IL_NONE, IL_OPTIMISTIC, IL_READ_COMMITTED, IL_READ_UNCOMMITTED, IL_REPEATABLE_READ, IL_SERIALIZABLE, LITERAL_IL_NONE, LITERAL_IL_OPTIMISTIC, LITERAL_IL_READ_COMMITTED, LITERAL_IL_READ_UNCOMMITTED, LITERAL_IL_REPEATABLE_READ, LITERAL_IL_SERIALIZABLE |
| Constructor Summary | |
|---|---|
DescriptorRepository()
Constructor declaration |
|
| Method Summary | |
|---|---|
void |
addAttribute(String attributeName,
String attributeValue)
Store the specified attribute and it's value. |
protected void |
deregisterSuperClassMultipleJoinedTables(ClassDescriptor cld)
Internal used! Deregister sub-classes of specified class when mapping to multiple joined tables is used. |
protected ClassDescriptor |
discoverDescriptor(String className)
Starts by looking to see if the className is
already mapped specifically to the descritpor repository. |
protected void |
finalize()
|
ClassDescriptor |
findFirstConcreteClass(ClassDescriptor cld)
Return the first found concrete class ClassDescriptor. |
Collection |
getAllConcreteSubclassDescriptors(ClassDescriptor aCld)
Utility method to discover all concrete subclasses of a given super class. |
String |
getAttribute(String attributeName)
Get the value of an attribute |
String |
getAttribute(String attributeName,
String defaultValue)
Get the value of an attribute |
String[] |
getAttributeNames()
Returns an array of the names of all atributes of this descriptor. |
Map |
getAttributes()
Returns the attribute map (name, value) of this descriptor. |
int |
getDefaultIsolationLevel()
Returns the defaultIsolationLevel. |
ClassDescriptor |
getDescriptorFor(Class c)
lookup a ClassDescriptor in the internal Hashtable |
ClassDescriptor |
getDescriptorFor(String strClassName)
lookup a ClassDescriptor in the internal Hashtable |
Map |
getDescriptorTable()
|
FieldDescriptor[] |
getFieldDescriptorsForMultiMappedTable(ClassDescriptor targetCld)
|
protected String |
getIsolationLevelAsString()
returns IsolationLevel literal as matching to the corresponding id |
Class[] |
getSubClassesMultipleJoinedTables(ClassDescriptor cld,
boolean wholeTree)
Return sub-classes of the specified class using the "super"-Reference concept. |
Class |
getTopLevelClass(Class clazz)
Returns the top level (extent) class to which the given class belongs. |
static String |
getVersion()
|
boolean |
hasDescriptorFor(Class c)
Checks if repository contains given class. |
Iterator |
iterator()
Returns an iterator over all managed ClassDescriptor. |
void |
put(Class c,
ClassDescriptor cld)
Add a ClassDescriptor to the internal Hashtable Set the Repository for ClassDescriptor |
void |
put(String classname,
ClassDescriptor cld)
Add a ClassDescriptor to the internal Hashtable Set the Repository for ClassDescriptor |
protected void |
registerSuperClassMultipleJoinedTables(ClassDescriptor cld)
Internal used! Register sub-classes of specified class when mapping class to multiple joined tables is used. |
void |
remove(Class clazz)
|
void |
remove(String className)
|
void |
setClassDescriptor(ClassDescriptor cld)
Convenience for put(Class c, ClassDescriptor cld) |
void |
setDefaultIsolationLevel(int defaultIsolationLevel)
Sets the defaultIsolationLevel. |
String |
toString()
returns a string representation |
String |
toXML()
returns the XML marshalled version of this instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DescriptorRepository()
throws PersistenceBrokerException
PersistenceBrokerException| Method Detail |
|---|
public static String getVersion()
public Class getTopLevelClass(Class clazz)
throws ClassNotPersistenceCapableException
ClassNotPersistenceCapableException - if clazz is not persistence capable,
i.e. if clazz is not defined in the DescriptorRepository.public FieldDescriptor[] getFieldDescriptorsForMultiMappedTable(ClassDescriptor targetCld)
public Map getDescriptorTable()
public ClassDescriptor findFirstConcreteClass(ClassDescriptor cld)
ClassDescriptor.
This means a class which is not an interface or an abstract class.
If given class descriptor is a concrete class, given class descriptor
was returned. If no concrete class can be found null will be
returned.
public Collection getAllConcreteSubclassDescriptors(ClassDescriptor aCld)
public boolean hasDescriptorFor(Class c)
public ClassDescriptor getDescriptorFor(String strClassName)
throws ClassNotPersistenceCapableException
strClassName - a fully qualified class name as it is returned by Class.getName().
ClassNotPersistenceCapableException
public ClassDescriptor getDescriptorFor(Class c)
throws ClassNotPersistenceCapableException
ClassNotPersistenceCapableExceptionpublic void setClassDescriptor(ClassDescriptor cld)
put(Class c, ClassDescriptor cld)
public void put(Class c,
ClassDescriptor cld)
public void put(String classname,
ClassDescriptor cld)
public void remove(String className)
public void remove(Class clazz)
public Iterator iterator()
ClassDescriptor.
public int getDefaultIsolationLevel()
public void setDefaultIsolationLevel(int defaultIsolationLevel)
defaultIsolationLevel - The defaultIsolationLevel to setpublic String toString()
public String toXML()
XmlCapable
toXML in interface XmlCapableprotected String getIsolationLevelAsString()
protected ClassDescriptor discoverDescriptor(String className)
className is
already mapped specifically to the descritpor repository.
If the className is not specifically mapped we
look at the className's parent class for a mapping.
We do this until the parent class is of the type
java.lang.Object. If no mapping was found,
null is returned. Mappings successfuly discovered
through inheritence are added to the internal table of
class descriptors to improve performance on subsequent requests
for those classes.
className - name of class whose descriptor we need to find.
className or null
if no ClassDescriptor could be located.protected void registerSuperClassMultipleJoinedTables(ClassDescriptor cld)
ClassDescriptor
itself.
cld - The ClassDescriptor of the class to register.protected void deregisterSuperClassMultipleJoinedTables(ClassDescriptor cld)
remove(Class) a class.
cld - The ClassDescriptor of the class to register.
public Class[] getSubClassesMultipleJoinedTables(ClassDescriptor cld,
boolean wholeTree)
cld - The ClassDescriptor of the class to search for sub-classes.wholeTree - If set true, the whole sub-class tree of the specified
class will be returned. If false only the direct sub-classes of the specified class
will be returned.
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
public void addAttribute(String attributeName,
String attributeValue)
AttributeContainer
addAttribute in interface AttributeContainerattributeName - the name of the attribute to retrieveattributeValue - the attribute's valueAttributeContainer.addAttribute(String, String)
public String getAttribute(String attributeName,
String defaultValue)
AttributeContainer
getAttribute in interface AttributeContainerattributeName - the attribute to retrievedefaultValue - the value to return if the attribute is not present
AttributeContainer.getAttribute(String, String)public String getAttribute(String attributeName)
AttributeContainer
getAttribute in interface AttributeContainerattributeName - the attribute to retrieve
AttributeContainer.getAttribute(String)public Map getAttributes()
public String[] getAttributeNames()
null)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||