com.sun.enterprise.deployment
Class PersistenceDescriptor

java.lang.Object
  extended by java.util.Observable
      extended by com.sun.enterprise.deployment.DynamicAttributesDescriptor
          extended by com.sun.enterprise.deployment.Descriptor
              extended by com.sun.enterprise.deployment.PersistenceDescriptor
All Implemented Interfaces:
java.io.Serializable

public final class PersistenceDescriptor
extends Descriptor

This class contains information about the persistent state (abstract persistence schema) for EJB2.0 CMP EntityBeans and Join Objects.

Author:
Sanjeev Krishnan
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.enterprise.deployment.Descriptor
DESCRIPTION_CHANGED, DESCRIPTOR_CHANGED, docType, LARGE_ICON_CHANGED, NAME_CHANGED, SMALL_ICON_CHANGED
 
Constructor Summary
PersistenceDescriptor()
           
PersistenceDescriptor(PersistenceDescriptor pers)
          The copy constructor.
 
Method Summary
 void addCMPField(FieldDescriptor fieldDesc)
           
 void addCMPField(java.lang.String field)
           
static java.lang.String capitalize(java.lang.String name)
           
 boolean classesChanged()
          Called from EjbCMPEntityDescriptor when some classes in this object are updated.
 void clearCMPFields()
           
 java.util.Set getAllPossibleQueriedMethods()
          Get all HomeIntf.find* and EJBClass.ejbSelect* methods for which an EJB-QL query could possibly be set.
 java.util.Set getCMPFields()
          Return the Set of fields deemed persistent.
 CMRFieldInfo[] getCMRFieldInfo()
          Return array of CMRFieldInfo objects for all CMR fields.
 CMRFieldInfo getCMRFieldInfoByName(java.lang.String fieldName)
          Return the CMRFieldInfo object for the given CMR field
 java.lang.String getCMRFieldReturnType(java.lang.String field)
           
 EjbBundleDescriptor getEjbBundleDescriptor()
           
 PersistentFieldInfo[] getFkeyFields()
          Return the array of PersistentFieldInfo objects for the foreign key fields of this bean.
 PersistentFieldInfo[] getNonPkeyPersFieldInfo()
          Return the array of PersistentFieldInfo objects for the CMP fields which are not primary keys + foreign key fields.
 Descriptor getParentDescriptor()
           
 java.lang.Class getPersistentClass()
           
 PersistentFieldInfo[] getPersistentFieldInfo()
          Return the array of PersistentFieldInfo objects for the CMP + foreign key fields
 PersistentFieldInfo getPersistentFieldInfoByName(java.lang.String fieldName)
          Return the PersistentFieldInfo object for the given CMP/fkey field
 java.lang.reflect.Field[] getPkeyClassFields()
           
 PersistentFieldInfo[] getPkeyFieldInfo()
          Return the array of PersistentFieldInfo objects for the pkey fields.
 PersistentFieldInfo getPkeyFieldInfoByName(java.lang.String fieldName)
          Return PersistentFieldInfo object for the given pkey field.
 java.util.Set getPkeyFields()
          Return the Set of primary key fields.
 java.lang.Class getPrimaryKeyClass()
          Get this bean's primary key class.
 java.util.Set getQueriedMethods()
          Get all methods for which setQueryFor was done
 QueryDescriptor getQueryFor(java.lang.reflect.Method method)
           
 QueryDescriptor getQueryFor(MethodDescriptor method)
           
 java.util.Set getRelationships()
          Get all CMR fields of this bean.
 java.lang.Class getStateClass()
           
 java.lang.Class getTypeFor(java.lang.String field)
           
 void invalidate()
          Ensures that persistence descriptor will regenerate its derived information after changes have been made to persistent characteristics.
 boolean isCMPField(java.lang.String field)
          Has the supplied field object been deemed persistent.
 boolean isPkeyField(FieldDescriptor fieldDesc)
           
 boolean isPkeyField(java.lang.String field)
          Is the supplied field object one of the pkey fields.
 boolean primaryKeyFieldsAllPrimitive()
           
 boolean primaryKeyIsOneField()
           
 boolean primaryKeyIsSpecified()
           
 void print(java.lang.StringBuffer toStringBuffer)
          Return my formatted string representation.
 void removeCMPField(FieldDescriptor fieldDesc)
           
 void removeCMPField(java.lang.String field)
           
 void removeQueryFor(MethodDescriptor method)
           
 void setCMPFields(java.util.Set cmpFields)
          Set the FieldDescriptor objects that the EJB container will persist for this bean.
 void setFkeyFields(PersistentFieldInfo[] fkeyFields)
          Set the array of PersistentFieldInfo objects representing the foreign key fields of this bean.
 void setParentDescriptor(Descriptor parentDesc)
           
 void setPkeyFields(java.util.Set pkeyFields)
          Set the FieldDescriptor objects for primary key fields for this bean.
 void setQueryFor(MethodDescriptor method, QueryDescriptor query)
           
 void setQueryFor(java.lang.reflect.Method method, QueryDescriptor query)
           
 
Methods inherited from class com.sun.enterprise.deployment.Descriptor
addDeploymentExtension, addPrefixMapping, createUniqueFilenameAmongst, createUniqueNameAmongst, createUniqueNameAmongstNamedDescriptors, fillDocType, getDeploymentExtensions, getDescription, getDisplayName, getDocType, getLargeIconUri, getLocalizedDescription, getLocalizedDescriptions, getLocalizedDisplayName, getLocalizedDisplayNames, getLocalizedLargeIconUri, getLocalizedLargeIconUris, getLocalizedSmallIconUri, getLocalizedSmallIconUris, getName, getPrefixMapping, getSmallIconUri, isBoundsChecking, setBoundsChecking, setDescription, setDisplayName, setLargeIconUri, setLocalizedDescription, setLocalizedDisplayName, setLocalizedLargeIconUri, setLocalizedSmallIconUri, setName, setSmallIconUri, visit
 
Methods inherited from class com.sun.enterprise.deployment.DynamicAttributesDescriptor
addExtraAttribute, getExtraAttribute, getExtraAttributes, removeExtraAttribute, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistenceDescriptor

public PersistenceDescriptor()

PersistenceDescriptor

public PersistenceDescriptor(PersistenceDescriptor pers)
The copy constructor.

Method Detail

getCMRFieldReturnType

public java.lang.String getCMRFieldReturnType(java.lang.String field)

classesChanged

public boolean classesChanged()
Called from EjbCMPEntityDescriptor when some classes in this object are updated.


setParentDescriptor

public void setParentDescriptor(Descriptor parentDesc)

getParentDescriptor

public Descriptor getParentDescriptor()

getEjbBundleDescriptor

public EjbBundleDescriptor getEjbBundleDescriptor()

getRelationships

public java.util.Set getRelationships()
Get all CMR fields of this bean. All relationships are stored in EjbBundleDescriptor to avoid the complexity of keeping the two sets consistent. NOTE : To add or remove a relationship use EjbBundleDescriptor.


getCMRFieldInfo

public CMRFieldInfo[] getCMRFieldInfo()
Return array of CMRFieldInfo objects for all CMR fields.


getCMRFieldInfoByName

public CMRFieldInfo getCMRFieldInfoByName(java.lang.String fieldName)
Return the CMRFieldInfo object for the given CMR field


invalidate

public void invalidate()
Ensures that persistence descriptor will regenerate its derived information after changes have been made to persistent characteristics.


clearCMPFields

public void clearCMPFields()

addCMPField

public void addCMPField(java.lang.String field)

addCMPField

public void addCMPField(FieldDescriptor fieldDesc)

removeCMPField

public void removeCMPField(java.lang.String field)

removeCMPField

public void removeCMPField(FieldDescriptor fieldDesc)

setCMPFields

public void setCMPFields(java.util.Set cmpFields)
Set the FieldDescriptor objects that the EJB container will persist for this bean.


isCMPField

public boolean isCMPField(java.lang.String field)
Has the supplied field object been deemed persistent.


getCMPFields

public java.util.Set getCMPFields()
Return the Set of fields deemed persistent. The elements of this Set are FieldDescriptor objects. This Set should be modified by calling addCMPField, removeCMPField


setPkeyFields

public void setPkeyFields(java.util.Set pkeyFields)
Set the FieldDescriptor objects for primary key fields for this bean.


getPkeyFields

public java.util.Set getPkeyFields()
Return the Set of primary key fields. The elements of this Set are FieldDescriptor objects. This Set can be modified by calling addPkeyField, removePkeyField


isPkeyField

public boolean isPkeyField(java.lang.String field)
Is the supplied field object one of the pkey fields.


isPkeyField

public boolean isPkeyField(FieldDescriptor fieldDesc)

primaryKeyIsOneField

public boolean primaryKeyIsOneField()
Returns:
true if the primary key of this object is one field in its class and the type of the field is not a primitive type. True for EJBs if the primkey-field deployment descriptor element is specified, or if a container-inserted pk field is used.

primaryKeyIsSpecified

public boolean primaryKeyIsSpecified()
Returns:
false if the primkey-field is not specified and pk class = Object

primaryKeyFieldsAllPrimitive

public boolean primaryKeyFieldsAllPrimitive()
Returns:
true if the primkey-field is not specified all fields of pkey class are Java primitive types.

getPrimaryKeyClass

public java.lang.Class getPrimaryKeyClass()
Get this bean's primary key class. For EJBs, this is EjbEntityDescriptor.getPrimaryKeyClassName(),


getPersistentClass

public java.lang.Class getPersistentClass()

getStateClass

public java.lang.Class getStateClass()

setFkeyFields

public void setFkeyFields(PersistentFieldInfo[] fkeyFields)
Set the array of PersistentFieldInfo objects representing the foreign key fields of this bean.


getFkeyFields

public PersistentFieldInfo[] getFkeyFields()
Return the array of PersistentFieldInfo objects for the foreign key fields of this bean.


getPersistentFieldInfo

public PersistentFieldInfo[] getPersistentFieldInfo()
Return the array of PersistentFieldInfo objects for the CMP + foreign key fields


getPersistentFieldInfoByName

public PersistentFieldInfo getPersistentFieldInfoByName(java.lang.String fieldName)
Return the PersistentFieldInfo object for the given CMP/fkey field


getNonPkeyPersFieldInfo

public PersistentFieldInfo[] getNonPkeyPersFieldInfo()
Return the array of PersistentFieldInfo objects for the CMP fields which are not primary keys + foreign key fields.


getPkeyFieldInfo

public PersistentFieldInfo[] getPkeyFieldInfo()
Return the array of PersistentFieldInfo objects for the pkey fields.


getPkeyFieldInfoByName

public PersistentFieldInfo getPkeyFieldInfoByName(java.lang.String fieldName)
Return PersistentFieldInfo object for the given pkey field.


getPkeyClassFields

public java.lang.reflect.Field[] getPkeyClassFields()
Returns:
an array of all Field objects in the primary key class. Returns null if primaryKeyIsOneField() == true.

getTypeFor

public java.lang.Class getTypeFor(java.lang.String field)
Returns:
the Class object corresponding to the type of the given CMP field.

capitalize

public static java.lang.String capitalize(java.lang.String name)

setQueryFor

public void setQueryFor(MethodDescriptor method,
                        QueryDescriptor query)

getQueryFor

public QueryDescriptor getQueryFor(MethodDescriptor method)

removeQueryFor

public void removeQueryFor(MethodDescriptor method)

setQueryFor

public void setQueryFor(java.lang.reflect.Method method,
                        QueryDescriptor query)

getQueryFor

public QueryDescriptor getQueryFor(java.lang.reflect.Method method)

getQueriedMethods

public java.util.Set getQueriedMethods()
Get all methods for which setQueryFor was done

Returns:
a Set of Methods

getAllPossibleQueriedMethods

public java.util.Set getAllPossibleQueriedMethods()
Get all HomeIntf.find* and EJBClass.ejbSelect* methods for which an EJB-QL query could possibly be set.

Returns:
a Set of Methods

print

public void print(java.lang.StringBuffer toStringBuffer)
Return my formatted string representation.

Overrides:
print in class Descriptor


Copyright © 2012 GlassFish Community. All Rights Reserved.