|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.model.jdo.JDOElementImpl
org.apache.jdo.impl.model.jdo.JDOModelImplDynamic
A JDOModel instance bundles a number of JDOClass instances used by an application. It provides factory methods to create and retrieve JDOClass instances. A fully qualified class name must be unique within a JDOModel instance. The model supports multiple classes having the same fully qualified name by different JDOModel instances.
The dynamic JDOModel implementation does not store any internally
calculated values. It is intended to be used in an environment
where JDO metatdata are likely to be changed (e.g. at development
time).
There are two exceptions:
TBD:
Nested Class Summary | |
private static class |
JDOModelImplDynamic.MetadataResourceNameIterator
This Iterator implementation iterates resource names of possible JDO metadata files for the specified class name. |
Field Summary | |
private JavaModel |
javaModel
The JavaModel used to get type info. |
private java.util.Map |
jdoClasses
Map of JDOClass objects managed by this JDOModel instance, key is the fully qualified class name. |
private java.util.Map |
jdoPackages
Map of JDOPackage managed by this JDOModel instance, key is the package name. |
private boolean |
loadXMLMetadataDefault
The default for loadXMLMetadata. |
protected static org.apache.commons.logging.Log |
logger
Logger |
protected static I18NHelper |
msg
I18N support |
private java.util.Set |
processedResources
Set of names of XML resources that are processed already (see {link #lookupXMLMetadata(String className)}. |
private UnresolvedRelationshipHelper |
unresolvedRelationshipHelper
|
protected static org.apache.commons.logging.Log |
xmlLogger
XML Logger |
Fields inherited from class org.apache.jdo.impl.model.jdo.JDOElementImpl |
|
Constructor Summary | |
protected |
JDOModelImplDynamic(JavaModel javaModel,
boolean loadXMLMetadataDefault)
Constructor. |
Method Summary | |
private void |
checkSuperclass(JDOClass jdoClass)
Updates the pcSuperclass property of the specified JDOClass and all its superclasses. |
JDOClass |
createJDOClass(java.lang.String className)
The method returns a JDOClass instance for the specified fully qualified class name. |
JDOClass |
createJDOClass(java.lang.String className,
boolean loadXMLMetadata)
The method returns a JDOClass instance for the specified fully qualified class name. |
JDOPackage |
createJDOPackage(java.lang.String packageName)
The method returns a JDOClass instance for the specified package name. |
JDOClass[] |
getDeclaredClasses()
Returns the collection of JDOClass instances declared by this JDOModel in the format of an array. |
JDOPackage[] |
getDeclaredPackages()
Returns the collection of JDOPackage instances declared by this JDOModel in the format of an array. |
JavaModel |
getJavaModel()
Returns the JavaModel bound to this JDOModel instance. |
JDOClass |
getJDOClass(java.lang.String className)
The method returns the JDOClass instance for the specified fully qualified class name if present. |
JDOClass |
getJDOClass(java.lang.String className,
boolean loadXMLMetadata)
The method returns the JDOClass instance for the specified fully qualified class name if present. |
JDOClass |
getJDOClassForObjectIdClass(JavaType objectIdClass)
This method returns the JDOClass instance that defines the specified type as its objectId class. |
JDOClass |
getJDOClassForShortName(java.lang.String shortName)
The method returns the JDOClass instance for the specified short name (see JDOClass.getShortName() ) or null if it cannot
find a JDOClass instance with the specified short name. |
JDOPackage |
getJDOPackage(java.lang.String packageName)
The method returns the JDOPackage instance for the specified package name, if present. |
private java.lang.String |
getPackageName(java.lang.String className)
Returns the package name of a class name |
JDOModel |
getParent()
Returns the parent JDOModel instance of this JDOModel. |
(package private) UnresolvedRelationshipHelper |
getUnresolvedRelationshipHelper()
Returns the UnresolvedRelationshipHelper instance for this JDOModel instance. |
protected boolean |
isKnownNonPC(java.lang.String typeName)
Checks whether the type with the specified name does NOT denote a persistence-capable class. |
protected void |
knownNonPC(java.lang.String className)
Hook called when a class is known to be non persistence capable. |
private JDOClass |
loadXMLResource(java.lang.String resource,
java.lang.String className)
Load the specified resource assuming it contains JDO metadata for one or more persistence capable classes. |
private JDOClass |
lookupXMLMetadata(JDOClass jdoClass)
The method seaches JDO metadata for the class with the specified class name. |
private JDOClass |
lookupXMLMetadata(java.lang.String className)
The method seaches JDO metadata for the class with the specified class name. |
protected JDOClass |
newJDOClassInstance(java.lang.String name)
Returns a new instance of the JDOClass implementation class. |
void |
setJavaModel(JavaModel javaModel)
Sets the JavaModel for this JDOModel instance. |
Methods inherited from class org.apache.jdo.impl.model.jdo.JDOElementImpl |
addPropertyChangeListener, addVetoableChangeListener, createJDOExtension, firePropertyChange, fireVetoableChange, getJDOExtensions, removeJDOExtension, removePropertyChangeListener, removeVetoableChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.jdo.model.jdo.JDOElement |
addPropertyChangeListener, addVetoableChangeListener, createJDOExtension, getJDOExtensions, removeJDOExtension, removePropertyChangeListener, removeVetoableChangeListener |
Field Detail |
private java.util.Map jdoPackages
private java.util.Map jdoClasses
private java.util.Set processedResources
private JavaModel javaModel
private final boolean loadXMLMetadataDefault
private final UnresolvedRelationshipHelper unresolvedRelationshipHelper
protected static final I18NHelper msg
protected static org.apache.commons.logging.Log xmlLogger
protected static org.apache.commons.logging.Log logger
Constructor Detail |
protected JDOModelImplDynamic(JavaModel javaModel, boolean loadXMLMetadataDefault)
Method Detail |
public JDOPackage createJDOPackage(java.lang.String packageName) throws ModelException
createJDOPackage
in interface JDOModel
packageName
- the name of the JDOPackage instance
to be returned
ModelException
- if impossiblepublic JDOPackage getJDOPackage(java.lang.String packageName)
null
if it cannot
find a JDOPackage instance for the specified name.
getJDOPackage
in interface JDOModel
packageName
- the name of the JDOPackage instance
to be returned
null
if not presentpublic JDOPackage[] getDeclaredPackages()
getDeclaredPackages
in interface JDOModel
public JDOClass createJDOClass(java.lang.String className) throws ModelException
Whether this method reads XML metatdata or not is determined at
JDOModel creation time (see flag loadXMLMetadataDefault
in JDOModelFactory.getJDOModel(JavaModel javaModel, boolean
loadXMLMetadataDefault)
). Invoking this method is method is equivalent
to createJDOClass(className, loadXMLMetadataDefault)
.
createJDOClass
in interface JDOModel
className
- the fully qualified class name of the JDOClass
instance to be returned
ModelException
- if impossiblepublic JDOClass createJDOClass(java.lang.String className, boolean loadXMLMetadata) throws ModelException
true
the method tries to find the JDOClass
instance by reading the XML metadata. If it could not be found the method
creates a new JDOClass instance, sets its declaringModel and returns the
instance.
createJDOClass
in interface JDOModel
className
- the fully qualified class name of the JDOClass instance
to be returnedloadXMLMetadata
- indicated whether to read XML metadata or not
ModelException
- if impossiblepublic JDOClass getJDOClass(java.lang.String className)
null
if it cannot find a JDOClass instance for the specified name.
Whether this method reads XML metatdata or not is determined at
JDOModel creation time (see flag loadXMLMetadataDefault
in JDOModelFactory.getJDOModel(JavaModel javaModel, boolean
loadXMLMetadataDefault)
). Invoking this method is method is equivalent
to createJDOClass(className, loadXMLMetadataDefault)
.
getJDOClass
in interface JDOModel
className
- the fully qualified class name of the JDOClass
instance to be returned
null
if not presentpublic JDOClass getJDOClass(java.lang.String className, boolean loadXMLMetadata)
true
the method tries to find the JDOClass instance by
reading the XML metadata. The method returns null if it cannot find a
JDOClass instance for the specified name.
getJDOClass
in interface JDOModel
className
- the fully qualified class name of the JDOClass instance
to be returnedloadXMLMetadata
- indicate whether to read XML metatdata or not
null
if not present
ModelException
- if impossiblepublic JDOClass getJDOClassForShortName(java.lang.String shortName)
JDOClass.getShortName()
) or null
if it cannot
find a JDOClass instance with the specified short name.
The method searches the list of JDOClasses currently managed by this
JDOModel instance. It does not attempt to load any metadata if it
cannot find a JDOClass instance with the specified short name. The
metadata for a JDOClass returned by this method must have been loaded
before by any of the methods
createJDOClass(String className)
,
createJDOClass(String className, boolean loadXMLMetadataDefault)
,
getJDOClass(String className)
, or
getJDOClass(String className, boolean loadXMLMetadataDefault)
.
getJDOClassForShortName
in interface JDOModel
shortName
- the short name of the JDOClass instance to be returned
null
if not presentpublic JDOClass[] getDeclaredClasses()
getDeclaredClasses
in interface JDOModel
public JavaModel getJavaModel()
getJavaModel
in interface JDOModel
public void setJavaModel(JavaModel javaModel)
setJavaModel
in interface JDOModel
javaModel
- the JavaModelpublic JDOModel getParent()
public JDOClass getJDOClassForObjectIdClass(JavaType objectIdClass)
JDOClass.getPersistenceCapableSuperclass()
).
getJDOClassForObjectIdClass
in interface JDOModel
objectIdClass
- the type representation of the ObjectId class
protected JDOClass newJDOClassInstance(java.lang.String name)
protected boolean isKnownNonPC(java.lang.String typeName)
typeName
- name of the type to be checked
true
if types is a name of a primitive type;
false
otherwiseprotected void knownNonPC(java.lang.String className)
className
- the name of the non-pc classprivate JDOClass lookupXMLMetadata(JDOClass jdoClass) throws ModelFatalException, java.lang.NullPointerException
null
.
The purpose of this method is to populate an existing JDOClass
instance with the JDO metadata. It throws an exception if there is
no jdo file for this class. The specified jdoClass must not be
null
; otherwise a NullPointerException is thrown.
jdoClass
- the non-activated JDOClass instance.
null
if there is no XML metadata.
ModelFatalException
- indicates a problem while parsing the
XML file or a missing XML file.
java.lang.NullPointerException
- the specified jdoClass is
null
.private JDOClass lookupXMLMetadata(java.lang.String className)
null
.
className
- the name of the class to check for XML metadata.
null
if there is no XML metadata.private JDOClass loadXMLResource(java.lang.String resource, java.lang.String className)
null
.
resource
- resource to loadclassName
- the name of the class to check for XML metadata.
null
if the specified resource has no XML metadata.private void checkSuperclass(JDOClass jdoClass)
jdoClass
- the class to be checkedprivate java.lang.String getPackageName(java.lang.String className)
UnresolvedRelationshipHelper getUnresolvedRelationshipHelper()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |