Class PersistenceDescriptor
- java.lang.Object
-
- java.util.Observable
-
- org.glassfish.deployment.common.DynamicAttributesDescriptor
-
- org.glassfish.deployment.common.Descriptor
-
- org.glassfish.ejb.deployment.descriptor.PersistenceDescriptor
-
- All Implemented Interfaces:
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 org.glassfish.deployment.common.Descriptor
DESCRIPTION_CHANGED, DESCRIPTOR_CHANGED, docType, LARGE_ICON_CHANGED, NAME_CHANGED, SMALL_ICON_CHANGED
-
-
Constructor Summary
Constructors Constructor Description PersistenceDescriptor()
PersistenceDescriptor(PersistenceDescriptor pers)
The copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCMPField(String field)
void
addCMPField(FieldDescriptor fieldDesc)
static String
capitalize(String name)
boolean
classesChanged()
Called from EjbCMPEntityDescriptor when some classes in this object are updated.void
clearCMPFields()
Set
getAllPossibleQueriedMethods()
Get all HomeIntf.find* and EJBClass.ejbSelect* methods for which an EJB-QL query could possibly be set.Set<FieldDescriptor>
getCMPFields()
Return the Set of fields deemed persistent.CMRFieldInfo[]
getCMRFieldInfo()
Return array of CMRFieldInfo objects for all CMR fields.CMRFieldInfo
getCMRFieldInfoByName(String fieldName)
Return the CMRFieldInfo object for the given CMR fieldString
getCMRFieldReturnType(String field)
EjbBundleDescriptorImpl
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()
Class
getPersistentClass()
PersistentFieldInfo[]
getPersistentFieldInfo()
Return the array of PersistentFieldInfo objects for the CMP + foreign key fieldsPersistentFieldInfo
getPersistentFieldInfoByName(String fieldName)
Return the PersistentFieldInfo object for the given CMP/fkey fieldField[]
getPkeyClassFields()
PersistentFieldInfo[]
getPkeyFieldInfo()
Return the array of PersistentFieldInfo objects for the pkey fields.PersistentFieldInfo
getPkeyFieldInfoByName(String fieldName)
Return PersistentFieldInfo object for the given pkey field.Set
getPkeyFields()
Return the Set of primary key fields.Class
getPrimaryKeyClass()
Get this bean's primary key class.Set
getQueriedMethods()
Get all methods for which setQueryFor was doneQueryDescriptor
getQueryFor(MethodDescriptor method)
QueryDescriptor
getQueryFor(Method method)
Set
getRelationships()
Get all CMR fields of this bean.Class
getStateClass()
Class
getTypeFor(String field)
void
invalidate()
Ensures that persistence descriptor will regenerate its derived information after changes have been made to persistent characteristics.boolean
isCMPField(String field)
Has the supplied field object been deemed persistent.boolean
isPkeyField(String field)
Is the supplied field object one of the pkey fields.boolean
isPkeyField(FieldDescriptor fieldDesc)
boolean
primaryKeyFieldsAllPrimitive()
boolean
primaryKeyIsOneField()
boolean
primaryKeyIsSpecified()
void
print(StringBuilder toStringBuilder)
Return my formatted string representation.void
removeCMPField(String field)
void
removeCMPField(FieldDescriptor fieldDesc)
void
removeQueryFor(MethodDescriptor method)
void
setCMPFields(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(EjbCMPEntityDescriptor parentDesc)
void
setPkeyFields(Set pkeyFields)
Set the FieldDescriptor objects for primary key fields for this bean.void
setQueryFor(MethodDescriptor method, QueryDescriptor query)
void
setQueryFor(Method method, QueryDescriptor query)
-
Methods inherited from class org.glassfish.deployment.common.Descriptor
addDescriptorExtension, addPrefixMapping, createUniqueFilenameAmongst, createUniqueNameAmongst, createUniqueNameAmongstNamedDescriptors, fillDocType, getDeploymentExtensions, getDescription, getDescriptorExtension, getDescriptorExtensions, 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 org.glassfish.deployment.common.DynamicAttributesDescriptor
addExtraAttribute, getExtraAttribute, getExtraAttributes, removeExtraAttribute, toString
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Constructor Detail
-
PersistenceDescriptor
public PersistenceDescriptor()
-
PersistenceDescriptor
public PersistenceDescriptor(PersistenceDescriptor pers)
The copy constructor.
-
-
Method Detail
-
classesChanged
public boolean classesChanged()
Called from EjbCMPEntityDescriptor when some classes in this object are updated.
-
setParentDescriptor
public void setParentDescriptor(EjbCMPEntityDescriptor parentDesc)
-
getParentDescriptor
public Descriptor getParentDescriptor()
-
getEjbBundleDescriptor
public EjbBundleDescriptorImpl getEjbBundleDescriptor()
-
getRelationships
public 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(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(String field)
-
addCMPField
public void addCMPField(FieldDescriptor fieldDesc)
-
removeCMPField
public void removeCMPField(String field)
-
removeCMPField
public void removeCMPField(FieldDescriptor fieldDesc)
-
setCMPFields
public void setCMPFields(Set cmpFields)
Set the FieldDescriptor objects that the EJB container will persist for this bean.
-
isCMPField
public boolean isCMPField(String field)
Has the supplied field object been deemed persistent.
-
getCMPFields
public Set<FieldDescriptor> 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(Set pkeyFields)
Set the FieldDescriptor objects for primary key fields for this bean.
-
getPkeyFields
public 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(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 Class getPrimaryKeyClass()
Get this bean's primary key class. For EJBs, this is EjbEntityDescriptor.getPrimaryKeyClassName(),
-
getPersistentClass
public Class getPersistentClass()
-
getStateClass
public 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(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(String fieldName)
Return PersistentFieldInfo object for the given pkey field.
-
getPkeyClassFields
public Field[] getPkeyClassFields()
- Returns:
- an array of all Field objects in the primary key class. Returns null if primaryKeyIsOneField() == true.
-
getTypeFor
public Class getTypeFor(String field)
- Returns:
- the Class object corresponding to the type of the given CMP field.
-
setQueryFor
public void setQueryFor(MethodDescriptor method, QueryDescriptor query)
-
getQueryFor
public QueryDescriptor getQueryFor(MethodDescriptor method)
-
removeQueryFor
public void removeQueryFor(MethodDescriptor method)
-
setQueryFor
public void setQueryFor(Method method, QueryDescriptor query)
-
getQueryFor
public QueryDescriptor getQueryFor(Method method)
-
getQueriedMethods
public Set getQueriedMethods()
Get all methods for which setQueryFor was done- Returns:
- a Set of Methods
-
getAllPossibleQueriedMethods
public 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(StringBuilder toStringBuilder)
Return my formatted string representation.- Overrides:
print
in classDescriptor
-
-