org.apache.jdo.impl.model.jdo.caching
Class JDOModelImplCaching

java.lang.Object
  extended by org.apache.jdo.impl.model.jdo.JDOElementImpl
      extended by org.apache.jdo.impl.model.jdo.JDOModelImplDynamic
          extended by org.apache.jdo.impl.model.jdo.caching.JDOModelImplCaching
All Implemented Interfaces:
JDOElement, JDOModel

public class JDOModelImplCaching
extends 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 caching JDOModel implementation caches any caclulated value to avoid re-calculating it if it is requested again. It is intended to be used in an environment where JDO metadata does NOT change (e.g. at runtime).

Since:
1.1
Version:
2.0
Author:
Michael Bouschen

Field Summary
 
Fields inherited from class org.apache.jdo.impl.model.jdo.JDOModelImplDynamic
logger, msg, xmlLogger
 
Constructor Summary
protected JDOModelImplCaching(JavaModel javaModel, boolean loadXMLMetadataDefault)
          Constructor.
 
Method Summary
 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.
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.
protected  JDOClass newJDOClassInstance(java.lang.String name)
          Returns a new instance of the JDOClass implementation class.
 
Methods inherited from class org.apache.jdo.impl.model.jdo.JDOModelImplDynamic
createJDOClass, createJDOClass, createJDOPackage, getDeclaredClasses, getDeclaredPackages, getJavaModel, getJDOClass, getJDOClass, getJDOPackage, getParent, setJavaModel
 
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
 

Constructor Detail

JDOModelImplCaching

protected JDOModelImplCaching(JavaModel javaModel,
                              boolean loadXMLMetadataDefault)
Constructor. JDOModel instances are created using the JDOModelFactory only.

Method Detail

getJDOClassForShortName

public 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.

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 JDOModelImplDynamic.createJDOClass(String className), JDOModelImplDynamic.createJDOClass(String className, boolean loadXMLMetadataDefault), JDOModelImplDynamic.getJDOClass(String className), or JDOModelImplDynamic.getJDOClass(String className, boolean loadXMLMetadataDefault).

Specified by:
getJDOClassForShortName in interface JDOModel
Overrides:
getJDOClassForShortName in class JDOModelImplDynamic
Parameters:
shortName - the short name of the JDOClass instance to be returned
Returns:
a JDOClass instance for the specified short name or null if not present

getJDOClassForObjectIdClass

public JDOClass getJDOClassForObjectIdClass(JavaType objectIdClass)
This method returns the JDOClass instance that defines the specified type as its objectId class. In the case of an inheritance hierarchy it returns the top most persistence-capable class of the hierarchy (see JDOClass.getPersistenceCapableSuperclass()).

Specified by:
getJDOClassForObjectIdClass in interface JDOModel
Overrides:
getJDOClassForObjectIdClass in class JDOModelImplDynamic
Parameters:
objectIdClass - the type representation of the ObjectId class
Returns:
the JDOClass defining the specified class as ObjectId class

newJDOClassInstance

protected JDOClass newJDOClassInstance(java.lang.String name)
Returns a new instance of the JDOClass implementation class.

Overrides:
newJDOClassInstance in class JDOModelImplDynamic

isKnownNonPC

protected boolean isKnownNonPC(java.lang.String typeName)
Checks whether the type with the specified name does NOT denote a persistence-capable class.

Overrides:
isKnownNonPC in class JDOModelImplDynamic
Parameters:
typeName - name of the type to be checked
Returns:
true if types is a name of a primitive type; false otherwise

knownNonPC

protected void knownNonPC(java.lang.String className)
Hook called when a class is known to be non persistence capable.

Overrides:
knownNonPC in class JDOModelImplDynamic
Parameters:
className - the name of the non-pc class


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.