© 2002 BEA Systems, Inc.


com.bea.p13n.property
Interface ConfigurableEntity

All Known Subinterfaces:
CatalogItem, Category, Content, Customer, Document, HierarchicalEntity, MutableCatalogItem, MutableCategory, MutableProductItem, ProductItem
All Known Implementing Classes:
AbstractConfigurableEntity, Event, HttpConfigurableEntity

public interface ConfigurableEntity

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

Field Summary
static java.lang.String RESERVED_PROPERTY_SET
          keyword for external property set
 
Method Summary
 java.lang.String getJndiName()
          Retrieve the jndi name for an entity.
 java.lang.String getPkString()
          Retrieve the pk string for an entity.
 java.lang.Object getProperty(java.lang.String propertySet, java.lang.String propertyName)
          Retrieve the value that was persisted for this entity for the given property, within the given property set.
 java.lang.String getPropertyAsString(java.lang.String propertySet, java.lang.String propertyName)
          Convenience method to return a property as a String.
 java.lang.Object getPropertyNoDefault(java.lang.String propertySet, java.lang.String propertyName)
          Retrieve the value associated with the named key in the specified property set, but does not return a default value from the property's PropertyDefinition if a value was not persisted for this entity.
 long getUniqueId()
          Retrieve the unique identifier generated for this ConfigurableEntity.
 java.lang.Object removeProperty(java.lang.String propertySet, java.lang.String propertyName)
          Remove the property associated with the named key in the specified property set.
 void setProperty(java.lang.String propertySet, java.lang.String propertyName, java.lang.Object value)
          Associate the specified value with the named key in the specified property set.
 

Field Detail

RESERVED_PROPERTY_SET

public static final java.lang.String RESERVED_PROPERTY_SET
keyword for external property set
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String propertySet,
                                    java.lang.String propertyName)
                             throws java.rmi.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.

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

getPropertyAsString

public java.lang.String getPropertyAsString(java.lang.String propertySet,
                                            java.lang.String propertyName)
                                     throws java.rmi.RemoteException
Convenience method to return a property as a String.

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 as a String, or null if all searches failed

getPropertyNoDefault

public java.lang.Object getPropertyNoDefault(java.lang.String propertySet,
                                             java.lang.String propertyName)
                                      throws java.rmi.RemoteException
Retrieve the value associated with the named key in the specified property set, but does not return a default value from the property's PropertyDefinition if a value was not persisted for this entity. This method is used by the implementation of the getProperty methods so that the search in the successor hierarchy does not return a default value from the Schema.

Parameters:
propertySet - The name of the property set
propertyName - The name of the property to retrieve.
Returns:
the value for this property, or null if all searches failed

setProperty

public void setProperty(java.lang.String propertySet,
                        java.lang.String propertyName,
                        java.lang.Object value)
                 throws PropertyValidationException,
                        java.rmi.RemoteException
Associate the specified value with the named key in the specified property set.

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 java.lang.Object removeProperty(java.lang.String propertySet,
                                       java.lang.String propertyName)
                                throws java.rmi.RemoteException
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.

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 java.rmi.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.

Returns:
this entity's unique id

getPkString

public java.lang.String getPkString()
                             throws java.rmi.RemoteException
Retrieve the pk string for an entity. A combination of pk string and jndi name is always unique between entities.

Returns:
the primary key string identifier for this entity

getJndiName

public java.lang.String getJndiName()
                             throws java.rmi.RemoteException
Retrieve the jndi name for an entity. A combination of pk string and jndi name is always unique between entities.

Returns:
the jndi name for this entity

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved