org.apache.jdo.impl.model.java.runtime
Class RuntimeJavaModelFactory

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

public class RuntimeJavaModelFactory
extends org.apache.jdo.impl.model.java.reflection.ReflectionJavaModelFactory

A reflection based JavaModelFactory implementation used at runtime. 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 instance sper ClassLoader.

RuntimeJavaModelFactory 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:
1.0.1
Version:
2.0

Constructor Summary
protected RuntimeJavaModelFactory()
          Creates a new RuntimeJavaModelFactory.
 
Method Summary
protected static void checkPermission()
          This method checks that the caller is authorized for JDOPermission("getMetadata"), and if not, throws ModelFatalException wrapping the SecurityException.
static RuntimeJavaModelFactory getInstance()
          Returns the singleton instance of RuntimeJavaModelFactory.
protected  org.apache.jdo.model.java.JavaModel newJavaModelInstance(java.lang.ClassLoader classLoader)
          Creates a new instance of the JavaModel implementation class.
protected  void registerFactory()
          Registers this JavaModelFactory instance at the JDOImplHelper.
 
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

RuntimeJavaModelFactory

protected RuntimeJavaModelFactory()
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 RuntimeJavaModelFactory getInstance()
                                           throws org.apache.jdo.model.ModelFatalException
Returns the singleton instance of RuntimeJavaModelFactory. 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.

checkPermission

protected static void checkPermission()
                               throws org.apache.jdo.model.ModelFatalException
This method checks that the caller is authorized for JDOPermission("getMetadata"), and if not, throws ModelFatalException wrapping the SecurityException.

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

registerFactory

protected void registerFactory()
Registers this JavaModelFactory instance at the JDOImplHelper.


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 RuntimeJavaModel instance.

Returns:
a new JavaModel instance.


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