org.apache.jdo.impl.model.java.runtime.jdk5
Class JDK5RuntimeJavaModelFactory

java.lang.Object
  extended by org.apache.jdo.impl.model.java.AbstractJavaModelFactory
      extended by org.apache.jdo.impl.model.java.reflection.ReflectionJavaModelFactory
          extended by org.apache.jdo.impl.model.java.runtime.RuntimeJavaModelFactory
              extended by org.apache.jdo.impl.model.java.runtime.jdk5.JDK5RuntimeJavaModelFactory
All Implemented Interfaces:
org.apache.jdo.model.java.JavaModelFactory

public class JDK5RuntimeJavaModelFactory
extends RuntimeJavaModelFactory

A reflection based JavaModelFactory implementation used at runtime in a J2SE5.0 environment. The implementation takes java.lang.Class and java.lang.reflect.Field instances to get Java related metadata about types and fields. This implementation caches JavaModel instances per ClassLoader.

JDK5RuntimeJavaModelFactory implements the singleton pattern; method getInstance() provides access to the singleton factory instance. This method also registers a model listener at the JDOImplHelper to handle the runtime metadata as generated by the enhancer.

Since:
JDO 2.0
Author:
Michael Bouschen

Constructor Summary
protected JDK5RuntimeJavaModelFactory()
          Creates a new RuntimeJavaModelFactory.
 
Method Summary
static JDK5RuntimeJavaModelFactory getInstance()
          Returns the singleton instance of JDK5RuntimeJavaModelFactory.
protected  org.apache.jdo.model.java.JavaModel newJavaModelInstance(java.lang.ClassLoader classLoader)
          Creates a new instance of the JavaModel implementation class.
 
Methods inherited from class org.apache.jdo.impl.model.java.runtime.RuntimeJavaModelFactory
checkPermission, registerFactory
 
Methods inherited from class org.apache.jdo.impl.model.java.reflection.ReflectionJavaModelFactory
createJavaModel, forNamePrivileged, getClassLoaderPrivileged, getJavaClass, getJavaType
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaModelFactory
getJavaModel, removeJavaModel, removeJavaModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDK5RuntimeJavaModelFactory

protected JDK5RuntimeJavaModelFactory()
Creates a new RuntimeJavaModelFactory. This constructor should not be called directly; instead, the singleton access method getInstance() should be used.

Method Detail

getInstance

public static JDK5RuntimeJavaModelFactory getInstance()
                                               throws org.apache.jdo.model.ModelFatalException
Returns the singleton instance of JDK5RuntimeJavaModelFactory. On first call it registers a model listener at the JDOImplHelper. This method checks that the caller is authorized for JDOPermission("getMetadata"), and if not, throws ModelFatalException wrapping the SecurityException.

Returns:
RuntimeJavaModelFactory instance
Throws:
org.apache.jdo.model.ModelFatalException - if the caller does not have the getMetadata permission.

newJavaModelInstance

protected org.apache.jdo.model.java.JavaModel newJavaModelInstance(java.lang.ClassLoader classLoader)
Creates a new instance of the JavaModel implementation class.

This implementation returns a JDK5RuntimeJavaModel instance.

Overrides:
newJavaModelInstance in class RuntimeJavaModelFactory
Returns:
a new JavaModel instance.


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