Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.property
Class ConfigurableEntityImpl

    java.lang.Object
      com.bea.p13n.property.AbstractConfigurableEntity
          com.bea.p13n.property.ConfigurableEntityImpl

All Implemented Interfaces
  ConfigurableEntity, Serializable, javax.ejb.EnterpriseBean, javax.ejb.EntityBean

Direct Known Subclasses:
  HierarchicalEntityImpl

    public abstract class ConfigurableEntityImpl

extends AbstractConfigurableEntity
implements javax.ejb.EntityBean

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.

See Also
  `PropertySet`, `EntityPropertyManager`, Serialized Form

Field Summary
`protected javax.ejb.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.
`javax.ejb.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(javax.ejb.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

### _ctx

    protected javax.ejb.EntityContext _ctx

  cached entity context

### _environmentNamingContext

    protected transient Context _environmentNamingContext

  cached environment context

### uid

    public long uid

  The unique numeric id of this entity

### ENTITY_PROPERTY_MANAGER

    protected static final String ENTITY_PROPERTY_MANAGER

  names used to lookup ejb-refs

  See Also
    Constants Summary

### PROPERTY_SET_MANAGER

    protected static final String PROPERTY_SET_MANAGER

See Also
  Constants Summary

### PROPERTY_SET_TYPE

    protected static final String PROPERTY_SET_TYPE

  variable name for property set type

  See Also
    Constants Summary

### JNDI_NAME

    protected static final String JNDI_NAME

  variable name for JNDI lookup name

  See Also
    Constants Summary

### COMMERCE_POOL

    protected static final String COMMERCE_POOL

  the name of the jdbc pool resource

  See Also
    Constants Summary

### entityPropertyManager

    protected transient EntityPropertyManager entityPropertyManager

  Cached reference to this entity's entityPropertyManager

### psManager

    protected transient PropertySetManager psManager

  Cached reference to the PropertySetManager

### propertyLocator

    protected transient PropertyLocator propertyLocator

  Cached propertyLocator for this entity; used when requesting properties from the EntityPropertyManager

### textFormatter

    protected static final com.bea.p13n.i18n.PropertyExceptionTextFormatter textFormatter

  Exception class

Constructor Detail

### ConfigurableEntityImpl

    public ConfigurableEntityImpl()

  Default constructor

Method Detail

### ejbCreate

    public ConfigurableEntityPk ejbCreate(ConfigurableEntityPk aPK)
                                   throws javax.ejb.CreateException

  Creates a record for a new ConfigurableEntity using the given primary key

  Parameters
    `aPK` - the primary key to create
  Returns
    the new primary key
  Throws
    `javax.ejb.CreateException`

### ejbPostCreate

    public void ejbPostCreate(ConfigurableEntityPk aPK)
                       throws javax.ejb.CreateException

  Post-creation method; not implemented.

  Throws
    `javax.ejb.CreateException`

### ejbPassivate

    public void ejbPassivate()
                      throws javax.ejb.EJBException

  Prepare to passivate this entity by closing the cached naming context.

  Specified by:
    `ejbPassivate` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.EJBException`

### ejbActivate

    public void ejbActivate()
                     throws javax.ejb.EJBException

  Prepare to activate this entity by resetting its naming context and EntityPropertyManager reference.

  Specified by:
    `ejbActivate` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.EJBException`

### ejbLoad

    public void ejbLoad()
                 throws javax.ejb.EJBException

  Resets this entity's attributes so that it will reload from the EntityPropertyManager.

  Specified by:
    `ejbLoad` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.EJBException`

### ejbStore

    public void ejbStore()
                  throws javax.ejb.EJBException

  ConfigurableEntity sets properties on the fly, so there is nothing to store at the end of a transaction

  Specified by:
    `ejbStore` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.EJBException`

### ejbRemove

    public void ejbRemove()
                   throws javax.ejb.RemoveException

  Remove the record for this entity, and all of its associated properties.

  Specified by:
    `ejbRemove` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.RemoveException`

### ejbFindByPrimaryKey

    public ConfigurableEntityPk ejbFindByPrimaryKey(ConfigurableEntityPk pk)
                                             throws javax.ejb.FinderException

  Look for the entity in the main entity table, keyed by the pk's identifier, and the jndi name (fully scoped with application name).

  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.

  Parameters
    `pk` - the primary key to look for
  Returns
    the same primary key, if the entity is found
  Throws
    `javax.ejb.FinderException` - if the entity is not found

### setEntityContext

    public void setEntityContext(javax.ejb.EntityContext ctx)
                          throws javax.ejb.EJBException

  Sets the entity context.

  Specified by:
    `setEntityContext` in interface `javax.ejb.EntityBean`
  Parameters
    `ctx` - SessionContext Context for session
  Throws
    `javax.ejb.EJBException`

### unsetEntityContext

    public void unsetEntityContext()
                            throws javax.ejb.EJBException

  Resets the entity context.

  Specified by:
    `unsetEntityContext` in interface `javax.ejb.EntityBean`
  Throws
    `javax.ejb.EJBException`

### getEntityContext

    public javax.ejb.EntityContext getEntityContext()

  Retrieve the cached entity context

### getProperty

    public Object getProperty(String propertySet,
                              String propertyName)
                       throws RemoteException

  Retrieve the value that was persisted for this entity for the given property, within the given property set. If the entity does not have a value persisted for this property, the default value from the property set will be returned.

  Specified by:
    `getProperty` in interface `ConfigurableEntity`
  Overrides:
    `getProperty` in class `AbstractConfigurableEntity`
  Parameters
    `propertySet` - The name of the property set to look in
    `propertyName` - The name of the property to retrieve.
  Returns
    the value for this property, or null if all searches failed
  Throws
    `RemoteException`

### setProperty

    public void setProperty(String propertySet,
                            String propertyName,
                            Object value)
                     throws PropertyValidationException

  Associate the specified value with the named key in the specified property set.

  Specified by:
    `setProperty` in interface `ConfigurableEntity`
  Overrides:
    `setProperty` in class `AbstractConfigurableEntity`
  Parameters
    `propertySet` - The name of the property set.
    `propertyName` - The name of the property to assign
    `value` - The value to associate with the property name
  Throws
    `PropertyValidationException` - If the property value does not match the PropertyDefinition for this property set

### removeProperty

    public Object removeProperty(String propertySet,
                                 String propertyName)

  Remove the property associated with the named key in the specified property set.

  NOTE: if an explicit setter method is found for this property, this method will set the value to null.

  Specified by:
    `removeProperty` in interface `ConfigurableEntity`
  Overrides:
    `removeProperty` in class `AbstractConfigurableEntity`
  Parameters
    `propertySet` - The name of the property set.
    `propertyName` - The name of the property to remove.
  Returns
    the old value of the property, or null if there was none.

### getUniqueId

    public long getUniqueId()
                     throws RemoteException

  Retrieve the unique identifier generated for this ConfigurableEntity. The unique identifier is used by the EntityPropertyManager to optimize the foreign keys in the persistent storage. This method may not be implemented in a lightweight implementation of ConfigurableEntity.

  Specified by:
    `getUniqueId` in interface `ConfigurableEntity`
  Overrides:
    `getUniqueId` in class `AbstractConfigurableEntity`
  Returns
    this entity's unique id
  Throws
    `RemoteException`

### getPkString

    public String getPkString()
                       throws RemoteException

  Retrieve the pk string for an entity. A combination of pk string and jndi name is always unique between entities.

  Specified by:
    `getPkString` in interface `ConfigurableEntity`
  Overrides:
    `getPkString` in class `AbstractConfigurableEntity`
  Returns
    the primary key string identifier for this entity
  Throws
    `RemoteException`

### getPropertyDefault

    protected Object getPropertyDefault(String propertySet,
                                        String propertyName)
                                 throws RemoteException

  Retrieve the default value from the Schema for the named key and the specified scope.

  Parameters
    `propertySet` - the property set to look in
    `propertyName` - the name of the property
  Returns
    the default value of the property, or null if it was not defined
  Throws
    `RemoteException`

### createUniqueId

    protected long createUniqueId(Object aPK)
                           throws ConfigurableEntityCreateException,
                                  RemoteException

  Use the EntityPropertyManager to create a new unique id for the entity represented by the given primary key.

  Parameters
    `aPK` - the primary key to create
  Returns
    the new entity's unique id
  Throws
    `ConfigurableEntityCreateException` - if there is an error
    `RemoteException` - if there is an error from the EntityPropertyManager

### useEntityPropertyManager

    protected boolean useEntityPropertyManager()

  Determine if this class should try to use the EntityPropertyManager. Subclasses can override to control this.

  Returns
    true if the EntityPropertyManager defined in the entity's deployment descriptor should be used, false otherwise

### getPropertyCache

    public EntityPropertyCache getPropertyCache()
                                         throws RemoteException

  Allocate the property map and load it using the EntityPropertyManager.

  Overrides:
    `getPropertyCache` in class `AbstractConfigurableEntity`
  Returns
    a full container of properties for this entity
  Throws
    `RemoteException`

### getPropertyLocator

    protected PropertyLocator getPropertyLocator()
                                          throws RemoteException

  Create and return a PropertyLocator to represent this entity.

  Throws
    `RemoteException`

### getPropertyLocator

    protected PropertyLocator getPropertyLocator(Object aPk)
                                          throws RemoteException

  Create and return a PropertyLocator to represent the entity identified by the primary key

  Parameters
    `aPk` - the primary key of the entity
  Returns
    a PropertyLocator object for that entity
  Throws
    `RemoteException`

### getJndiName

    public String getJndiName()

  Retrieve the jndi name for an entity. A combination of pk string and jndi name is always unique between entities.

  Specified by:
    `getJndiName` in interface `ConfigurableEntity`
  Overrides:
    `getJndiName` in class `AbstractConfigurableEntity`
  Returns
    the jndi name for this entity

### getEntityPropertyManager

    protected EntityPropertyManager getEntityPropertyManager()
                                                      throws RemoteException

  Find the entity property manager assigned to this ConfigurableEntity

  Returns
    a reference to this entity's EntityPropertyManager
  Throws
    `RemoteException`

### getPropertySetManager

    protected PropertySetManager getPropertySetManager()
                                                throws RemoteException

  Get a reference to the PropertySetManager session bean.

  Throws
    `RemoteException`

### getEnvironmentProperty

    public Object getEnvironmentProperty(String propertyName)
                                  throws NamingException

  This method returns the value of the specified environment property.

  Throws
    `NamingException` - - if a naming exception is encountered

### getEnvironmentProperty

    public Object getEnvironmentProperty(String propertyName,
                                         Object defaultValue)
                                  throws NamingException

  This method returns the value of the specified environment property or the specified default value if the environment property is not found.

  Throws
    `NamingException` - - if a naming exception is encountered

### getEnvironmentNamingContext

    protected Context getEnvironmentNamingContext()
                                           throws NamingException

  Returns the bean's environment naming context.

  Throws
    `NamingException` - - if a naming exception is encountered

### getConnection

    protected Connection getConnection()

  Get a connection from the "jdbc/commercePool" DataSource environment entry for the EJB.

  Returns
    a database connection
  Throws
    `ConfigurableEntitySystemException` - if there is a problem

### getStatement

    protected PreparedStatement getStatement(Connection conn,
                                             String key)
                                      throws SQLException

  Use the provided connection to prepare the SQL statement named by the provided key.

  Parameters
    `conn` - a valid database connection
    `key` - the key to lookup a SQL statement with
  Returns
    a PreparedStatement created with the sql
  Throws
    `SQLException` - if an error occurs creating the statement

### getDefaultSqlBundleName

    protected String getDefaultSqlBundleName()

  Return the name of the ResourceBundle which stores externalized sql strings. This will be used to initialize the SqlBundle used in the getStatement method. Any subclass that uses externalized sql should override this. The default impl returns null.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.