|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.p13n.property.AbstractConfigurableEntity
com.bea.p13n.property.ConfigurableEntityImpl
Abstract base class for ConfigurableEntity EJB's.
The ConfigurableEntity provides the interface to an Entity that can be configured at runtime by associating properties via name-value pairs. The values are permanently associated with the entity by use of the EntityPropertyManager.
The name to associate the value with is made of an optional property set name and a key. Property sets define namespaces for keys. Duplicate keys are allowed in different property sets, and not specifying a property set means the "default" property set.
Entities that derive from ConfigurableEntity will require that the EntityPropertyManager and PropertySetType environment variables be set in their EJB deployment descriptors.
The EntityPropertyManager is a stateless session bean that is used to persist the runtime properties. That bean in turn can be configured to persist its properties in a separate set of tables.
PropertySet
,
EntityPropertyManager
,
Serialized FormField Summary | |
protected EntityContext |
_ctx
cached entity context |
protected Context |
_environmentNamingContext
cached environment context |
protected static String |
COMMERCE_POOL
the name of the jdbc pool resource |
protected static String |
ENTITY_PROPERTY_MANAGER
names used to lookup ejb-refs |
protected EntityPropertyManager |
entityPropertyManager
Cached reference to this entity's entityPropertyManager |
protected static String |
JNDI_NAME
variable name for JNDI lookup name |
protected static String |
PROPERTY_SET_MANAGER
|
protected static String |
PROPERTY_SET_TYPE
variable name for property set type |
protected PropertyLocator |
propertyLocator
Cached propertyLocator for this entity; used when requesting properties from the EntityPropertyManager |
protected PropertySetManager |
psManager
Cached reference to the PropertySetManager |
protected static com.bea.p13n.i18n.PropertyExceptionTextFormatter |
textFormatter
Exception class |
long |
uid
The unique numeric id of this entity |
Fields inherited from class com.bea.p13n.property.AbstractConfigurableEntity |
CE_METHOD_CACHE, instanceClass, PREFIX_GET, PREFIX_SET, propertyCache |
Fields inherited from interface com.bea.p13n.property.ConfigurableEntity |
RESERVED_PROPERTY_SET |
Constructor Summary | |
ConfigurableEntityImpl()
Default constructor |
Method Summary | |
protected long |
createUniqueId(Object aPK)
Use the EntityPropertyManager to create a new unique id for the entity represented by the given primary key. |
void |
ejbActivate()
Prepare to activate this entity by resetting its naming context and EntityPropertyManager reference. |
ConfigurableEntityPk |
ejbCreate(ConfigurableEntityPk aPK)
Creates a record for a new ConfigurableEntity using the given primary key |
ConfigurableEntityPk |
ejbFindByPrimaryKey(ConfigurableEntityPk pk)
Look for the entity in the main entity table, keyed by the pk's identifier, and the jndi name (fully scoped with application name). |
void |
ejbLoad()
Resets this entity's attributes so that it will reload from the EntityPropertyManager. |
void |
ejbPassivate()
Prepare to passivate this entity by closing the cached naming context. |
void |
ejbPostCreate(ConfigurableEntityPk aPK)
Post-creation method; not implemented. |
void |
ejbRemove()
Remove the record for this entity, and all of its associated properties. |
void |
ejbStore()
ConfigurableEntity sets properties on the fly, so there is nothing to store at the end of a transaction |
protected Connection |
getConnection()
Get a connection from the "jdbc/commercePool" DataSource environment entry for the EJB. |
protected String |
getDefaultSqlBundleName()
Return the name of the ResourceBundle which stores externalized sql strings. |
EntityContext |
getEntityContext()
Retrieve the cached entity context |
protected EntityPropertyManager |
getEntityPropertyManager()
Find the entity property manager assigned to this ConfigurableEntity |
protected Context |
getEnvironmentNamingContext()
Returns the bean's environment naming context. |
Object |
getEnvironmentProperty(String propertyName)
This method returns the value of the specified environment property. |
Object |
getEnvironmentProperty(String propertyName,
Object defaultValue)
This method returns the value of the specified environment property or the specified default value if the environment property is not found. |
String |
getJndiName()
Retrieve the jndi name for an entity. |
String |
getPkString()
Retrieve the pk string for an entity. |
Object |
getProperty(String propertySet,
String propertyName)
Retrieve the value that was persisted for this entity for the given property, within the given property set. |
EntityPropertyCache |
getPropertyCache()
Allocate the property map and load it using the EntityPropertyManager. |
protected Object |
getPropertyDefault(String propertySet,
String propertyName)
Retrieve the default value from the Schema for the named key and the specified scope. |
protected PropertyLocator |
getPropertyLocator()
Create and return a PropertyLocator to represent this entity. |
protected PropertyLocator |
getPropertyLocator(Object aPk)
Create and return a PropertyLocator to represent the entity identified by the primary key |
protected PropertySetManager |
getPropertySetManager()
Get a reference to the PropertySetManager session bean. |
protected PreparedStatement |
getStatement(Connection conn,
String key)
Use the provided connection to prepare the SQL statement named by the provided key. |
long |
getUniqueId()
Retrieve the unique identifier generated for this ConfigurableEntity. |
Object |
removeProperty(String propertySet,
String propertyName)
Remove the property associated with the named key in the specified property set. |
void |
setEntityContext(EntityContext ctx)
Sets the entity context. |
void |
setProperty(String propertySet,
String propertyName,
Object value)
Associate the specified value with the named key in the specified property set. |
void |
unsetEntityContext()
Resets the entity context. |
protected boolean |
useEntityPropertyManager()
Determine if this class should try to use the EntityPropertyManager. |
Methods inherited from class com.bea.p13n.property.AbstractConfigurableEntity |
createMapKey, getCachedProperty, getExplicitProperty, getExplicitSetter, getImplicitProperty, getPropertyAsString, getPropertyNoDefault, hasExplicitGetter, hasExplicitSetter, removeExplicitProperty, setExplicitProperty, upcaseFirst |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected EntityContext _ctx
protected transient Context _environmentNamingContext
protected static final String COMMERCE_POOL
protected static final String ENTITY_PROPERTY_MANAGER
protected transient EntityPropertyManager entityPropertyManager
protected static final String JNDI_NAME
protected static final String PROPERTY_SET_MANAGER
protected static final String PROPERTY_SET_TYPE
protected transient PropertyLocator propertyLocator
protected transient PropertySetManager psManager
protected static final com.bea.p13n.i18n.PropertyExceptionTextFormatter textFormatter
public long uid
Constructor Detail |
public ConfigurableEntityImpl()
Method Detail |
protected long createUniqueId(Object aPK) throws ConfigurableEntityCreateException, RemoteException
aPK
- the primary key to create
ConfigurableEntityCreateException
- if there is an error
RemoteException
- if there is an error from the EntityPropertyManagerpublic void ejbActivate() throws EJBException
ejbActivate
in interface EntityBean
EJBException
public ConfigurableEntityPk ejbCreate(ConfigurableEntityPk aPK) throws CreateException
aPK
- the primary key to create
CreateException
public ConfigurableEntityPk ejbFindByPrimaryKey(ConfigurableEntityPk pk) throws FinderException
Subclasses can override this method to search for the entity in a different table, if they extend the entity and it makes more sense to do that.
pk
- the primary key to look for
FinderException
- if the entity is not foundpublic void ejbLoad() throws EJBException
ejbLoad
in interface EntityBean
EJBException
public void ejbPassivate() throws EJBException
ejbPassivate
in interface EntityBean
EJBException
public void ejbPostCreate(ConfigurableEntityPk aPK) throws CreateException
CreateException
public void ejbRemove() throws RemoveException
ejbRemove
in interface EntityBean
RemoveException
public void ejbStore() throws EJBException
ejbStore
in interface EntityBean
EJBException
protected Connection getConnection()
ConfigurableEntitySystemException
- if there is a problemprotected String getDefaultSqlBundleName()
public EntityContext getEntityContext()
protected EntityPropertyManager getEntityPropertyManager() throws RemoteException
RemoteException
protected Context getEnvironmentNamingContext() throws NamingException
NamingException
- - if a naming exception is encounteredpublic Object getEnvironmentProperty(String propertyName) throws NamingException
NamingException
- - if a naming exception is encounteredpublic Object getEnvironmentProperty(String propertyName, Object defaultValue) throws NamingException
NamingException
- - if a naming exception is encounteredpublic String getJndiName()
getJndiName
in interface ConfigurableEntity
getJndiName
in class AbstractConfigurableEntity
public String getPkString() throws RemoteException
getPkString
in interface ConfigurableEntity
getPkString
in class AbstractConfigurableEntity
RemoteException
public Object getProperty(String propertySet, String propertyName) throws RemoteException
getProperty
in interface ConfigurableEntity
getProperty
in class AbstractConfigurableEntity
propertySet
- The name of the property set to look inpropertyName
- The name of the property to retrieve.
RemoteException
public EntityPropertyCache getPropertyCache() throws RemoteException
getPropertyCache
in class AbstractConfigurableEntity
RemoteException
protected Object getPropertyDefault(String propertySet, String propertyName) throws RemoteException
propertySet
- the property set to look inpropertyName
- the name of the property
RemoteException
protected PropertyLocator getPropertyLocator() throws RemoteException
RemoteException
protected PropertyLocator getPropertyLocator(Object aPk) throws RemoteException
RemoteException
protected PropertySetManager getPropertySetManager() throws RemoteException
RemoteException
protected PreparedStatement getStatement(Connection conn, String key) throws SQLException
conn
- a valid database connectionkey
- the key to lookup a SQL statement with
SQLException
- if an error occurs creating the statementpublic long getUniqueId() throws RemoteException
getUniqueId
in interface ConfigurableEntity
getUniqueId
in class AbstractConfigurableEntity
RemoteException
public Object removeProperty(String propertySet, String propertyName)
NOTE: if an explicit setter method is found for this property, this method will set the value to null.
removeProperty
in interface ConfigurableEntity
removeProperty
in class AbstractConfigurableEntity
propertySet
- The name of the property set.propertyName
- The name of the property to remove.
public void setEntityContext(EntityContext ctx) throws EJBException
setEntityContext
in interface EntityBean
ctx
- SessionContext Context for session
EJBException
public void setProperty(String propertySet, String propertyName, Object value) throws PropertyValidationException
setProperty
in interface ConfigurableEntity
setProperty
in class AbstractConfigurableEntity
propertySet
- The name of the property set.propertyName
- The name of the property to assignvalue
- The value to associate with the property name
PropertyValidationException
- If the property value does not match the PropertyDefinition for this property setpublic void unsetEntityContext() throws EJBException
unsetEntityContext
in interface EntityBean
EJBException
protected boolean useEntityPropertyManager()
|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |