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

java.lang.Object
  extended byorg.apache.jdo.impl.model.java.runtime.RegisterClassListener
All Implemented Interfaces:
java.util.EventListener, javax.jdo.spi.RegisterClassListener

public class RegisterClassListener
extends java.lang.Object
implements javax.jdo.spi.RegisterClassListener

The Model listener gets notified whenever a persistence-capable class gets registered with the JDOImplHelper at runtime.

Author:
Michael Bouschen

Field Summary
(package private)  javax.jdo.spi.JDOImplHelper helper
          The corresponding JDOImplHelper instance.
(package private)  RuntimeJavaModelFactory javaModelFactory
          The JavaModel factory.
private static org.apache.commons.logging.Log logger
          Logger.
 
Constructor Summary
RegisterClassListener(javax.jdo.spi.JDOImplHelper helper, RuntimeJavaModelFactory javaModelFactory)
          Constructor.
 
Method Summary
private  JDOClass createJDOClass(java.lang.Class pcClass)
          Internal method to update the corresponding JDOClass instance with the runtime meta data.
 void registerClass(javax.jdo.spi.RegisterClassEvent event)
          This method gets called when a persistence-capable class is registered.
private  void updateJDOClass(JDOClass jdoClass, java.lang.String[] fieldNames, java.lang.Class[] fieldTypes, byte[] fieldFlags, java.lang.Class pcSuperclass)
          Internal method to update the specified JDOClass instance with the runtime meta data.
private  void updateJDOField(JDOField jdoField, java.lang.Class fieldType, byte fieldFlags, RuntimeJavaType declaringClass)
          Internal method to update the specified JDOField instance with the runtime meta data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

helper

javax.jdo.spi.JDOImplHelper helper
The corresponding JDOImplHelper instance.


javaModelFactory

RuntimeJavaModelFactory javaModelFactory
The JavaModel factory.


logger

private static org.apache.commons.logging.Log logger
Logger.

Constructor Detail

RegisterClassListener

public RegisterClassListener(javax.jdo.spi.JDOImplHelper helper,
                             RuntimeJavaModelFactory javaModelFactory)
Constructor.

Parameters:
helper - the JDOImplHelper instance.
javaModelFactory - the JavaModel factory.
Method Detail

registerClass

public void registerClass(javax.jdo.spi.RegisterClassEvent event)
This method gets called when a persistence-capable class is registered.

Specified by:
registerClass in interface javax.jdo.spi.RegisterClassListener
Parameters:
event - a RegisterClassEvent instance describing the registered class plus metatdata.

createJDOClass

private JDOClass createJDOClass(java.lang.Class pcClass)
                         throws ModelException
Internal method to update the corresponding JDOClass instance with the runtime meta data.

Parameters:
pcClass - the class object of the persistence-capable class
Throws:
ModelException

updateJDOClass

private void updateJDOClass(JDOClass jdoClass,
                            java.lang.String[] fieldNames,
                            java.lang.Class[] fieldTypes,
                            byte[] fieldFlags,
                            java.lang.Class pcSuperclass)
                     throws ModelException
Internal method to update the specified JDOClass instance with the runtime meta data.

Parameters:
jdoClass - the jdoClass instance to be updated
fieldNames - the names of the managed fields
fieldTypes - the types of the managed fields
fieldFlags - the jdo field flags of the managed fields
pcSuperclass - the class object of the persistence-capable superclass
Throws:
ModelException

updateJDOField

private void updateJDOField(JDOField jdoField,
                            java.lang.Class fieldType,
                            byte fieldFlags,
                            RuntimeJavaType declaringClass)
                     throws ModelException
Internal method to update the specified JDOField instance with the runtime meta data.

Parameters:
jdoField - the jdoField instance to be updated
fieldType - the type of the field
fieldFlags - the jdo field flags
Throws:
ModelException