|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.metadata.DescriptorBase org.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 | |
---|---|
private int |
defaultIsolationLevel
the default isolation level used for this repository |
private HashMap |
descriptorTable
This table holds all known Mapping descriptions. |
private Map |
extentTable
We need a lot the extent, to which a class belongs (@see DescriptorRepository#getExtentClass). |
private Logger |
log
|
private Map |
m_allConcreteSubClass
|
private Map |
m_firstConcreteClassMap
|
private Map |
m_multiMappedTableMap
|
private Map |
m_topLevelClassTable
|
(package private) static long |
serialVersionUID
|
private Map |
superClassMultipleJoinedTablesMap
|
private static String |
VERSION
The version identifier of the Repository. |
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 | |
---|---|
(package private) void |
addExtent(String classname,
ClassDescriptor cld)
Add a pair of extent/classdescriptor to the extentTable to gain speed while retrieval of extents. |
private void |
changeDescriptorEvent()
|
private void |
createResultSubClassesMultipleJoinedTables(List result,
ClassDescriptor cld,
boolean wholeTree)
Add all sub-classes using multiple joined tables feature for specified class. |
protected void |
deregisterSuperClassMultipleJoinedTables(ClassDescriptor cld)
Internal used! Deregister sub-classes of specified class when mapping to multiple joined tables is used. |
private ClassDescriptor |
discoverDescriptor(Class clazz)
Internal method for recursivly searching for a class descriptor that avoids class loading when we already have a class object. |
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. |
private FieldDescriptor[] |
getAllMappedColumns(List classDescriptors)
|
private List |
getClassesMappedToSameTable(ClassDescriptor targetCld)
|
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)
|
(package private) void |
removeExtent(String classname)
Remove a pair of extent/classdescriptor from the extentTable. |
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 org.apache.ojb.broker.metadata.DescriptorBase |
---|
addAttribute, getAttribute, getAttribute, getAttributeNames, getAttributes |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
private Logger log
private static final String VERSION
private int defaultIsolationLevel
private final HashMap descriptorTable
private Map extentTable
private Map superClassMultipleJoinedTablesMap
private transient Map m_multiMappedTableMap
private transient Map m_topLevelClassTable
private transient Map m_firstConcreteClassMap
private transient Map m_allConcreteSubClass
Constructor Detail |
---|
public DescriptorRepository() throws PersistenceBrokerException
PersistenceBrokerException
Method Detail |
---|
public static String getVersion()
void addExtent(String classname, ClassDescriptor cld)
classname
- the name of the extent itselfcld
- the class descriptor, where it belongs tovoid removeExtent(String classname)
classname
- the name of the extent itselfpublic 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)
private FieldDescriptor[] getAllMappedColumns(List classDescriptors)
private List getClassesMappedToSameTable(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
ClassNotPersistenceCapableException
public 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)
private void changeDescriptorEvent()
public Iterator iterator()
ClassDescriptor
.
public int getDefaultIsolationLevel()
public void setDefaultIsolationLevel(int defaultIsolationLevel)
defaultIsolationLevel
- The defaultIsolationLevel to setpublic String toString()
toString
in class DescriptorBase
public String toXML()
XmlCapable
toXML
in interface XmlCapable
protected 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.private ClassDescriptor discoverDescriptor(Class clazz)
clazz
- The class whose descriptor we need to find
clazz
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.
private void createResultSubClassesMultipleJoinedTables(List result, ClassDescriptor cld, boolean wholeTree)
result
- The list to add results.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 Object
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |