BEA Systems, Inc.

com.beasys.commerce.foundation
Interface ConfigurableEntity

All Known Subinterfaces:
ConfigurableEntityRemote, Content, ContentRemote, Document, DocumentRemote, Group, GroupRemote, UnifiedUser, User, UserRemote
All Known Implementing Classes:
HttpConfigurableEntity

public interface ConfigurableEntity
extends BusinessPolicyManager

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 scope name and a key. The scope name defines a namespace for keys. Duplicates keys are allowed in different scopes and not specifying the scope name means the default scope.

The Configurable also describes an interface by which Entities can be included in a hierachy of successors. The resulting hierarchy is searched upward when getting Properties and BusinessPolicies. This design pattern models the Chain of Responsibility Pattern (Gamma et al).

Entities that derive from ConfigurableEntity will require that the EntitPropertyManager and SchemaGroupName environment variables be set. 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:
EntityPropertyManager, ConfigurableEntityImpl, BusinessPolicy

Field Summary
static java.lang.String RESERVED_SCOPE_NAME
          keyword for external scope
 
Method Summary
 void addPropertyValue(java.lang.String scopeName, java.lang.String key, java.lang.Object propertyValue)
          Add the specified property value to the collection of values associated with the named key for the specified scope.
 void addPropertyValueMapped(java.lang.String scopeName, java.lang.String propertyKey, java.lang.String mappedKey, java.lang.Object propertyValue)
          Add the specified property value to the map object associated with the named key for the specified scope.
 PersistableHandle getPersistableHandle()
          This method is used to create a long lived handle to an EJB object that can be persisted into a database.
 java.lang.Object getProperty(java.lang.String key, java.lang.Object defaultValue)
          Retrieve the value associated with the named key in the default scope.
 java.lang.Object getProperty(java.lang.String scopeName, java.lang.String key, ConfigurableEntity successor, java.lang.Object defaultValue)
          Retrieve the value associated with the named key in the specified scope.
 java.lang.String getPropertyAsString(java.lang.String key, java.lang.String defaultValue)
          Retrieve the String value of the property associated the named key in the default scope.
 java.lang.String getPropertyAsString(java.lang.String scopeName, java.lang.String key, ConfigurableEntity successor, java.lang.String defaultValue)
          Retrieve the String value of the property associated the named key in the specified scope.
 java.lang.Object getPropertyDefault(java.lang.String scopeName, java.lang.String key, ConfigurableEntity successor)
          Retrieve the default value from the Schema for the named key and the specified scope.
 java.lang.Object getPropertyNoDefault(java.lang.String scopeName, java.lang.String key, ConfigurableEntity successor)
          Retrieve the value associated with the named key in the specified scope but does not return a default value if the property does not exist for the entity of in the hierarchy of successors.
 ConfigurableEntity getSuccessor(java.lang.String scopeName)
          Retrieve the successor associated with this ConfigurableEntity for the specified scope.
 long getUniqueId()
          Retrieve the unique identifier generated for this ConfigurableEntity.
 java.lang.Object removeProperty(java.lang.String key)
          Remove the property associated with the named key in the default scope.
 java.lang.Object removeProperty(java.lang.String scopeName, java.lang.String key)
          Remove the property associated with the named key in the specified scope.
 void removePropertyValue(java.lang.String scopeName, java.lang.String key, java.lang.Object propertyValue)
          Remove the property value object from the collection associated with the named key in the specified scope.
 java.lang.Object removePropertyValueMapped(java.lang.String scopeName, java.lang.String propertyKey, java.lang.String mappedKey)
          Remove the property value object from the map associated with the named key in the specified scope.
 ConfigurableEntity removeSuccessor(java.lang.String scopeName)
          Remove the successor for the specified scope.
 void setProperty(java.lang.String key, java.lang.Object value)
          Associate the specified value with the named key in the default scope.
 void setProperty(java.lang.String scopeName, java.lang.String key, java.lang.Object property)
          Associate the specified value with the named key in the specified scope.
 void setSuccessor(java.lang.String scopeName, ConfigurableEntity successor)
          Set the successor for the specified scope.
 
Methods inherited from interface com.beasys.commerce.foundation.BusinessPolicyManager
addBusinessPolicy, getBusinessPolicy, removeBusinessPolicy
 

Field Detail

RESERVED_SCOPE_NAME

public static final java.lang.String RESERVED_SCOPE_NAME
keyword for external scope
Method Detail

addPropertyValue

public void addPropertyValue(java.lang.String scopeName,
                             java.lang.String key,
                             java.lang.Object propertyValue)
                      throws java.rmi.RemoteException
Add the specified property value to the collection of values associated with the named key for the specified scope.
Parameters:
scopeName - The name of the scope.
key - The name to associate the collection of values with.
propertyValue - The value to associate with the key and scope.

addPropertyValueMapped

public void addPropertyValueMapped(java.lang.String scopeName,
                                   java.lang.String propertyKey,
                                   java.lang.String mappedKey,
                                   java.lang.Object propertyValue)
                            throws java.rmi.RemoteException
Add the specified property value to the map object associated with the named key for the specified scope.
Parameters:
scopeName - The name of the scope.
propertykey - The name to associate the map object with.
mappedkey - The map key to associate the value in the map.
propertyValue - The value put in the map for the map key.

getProperty

public java.lang.Object getProperty(java.lang.String key,
                                    java.lang.Object defaultValue)
                             throws java.rmi.RemoteException
Retrieve the value associated with the named key in the default scope. If the entity does not have the property defined, the property will be searched in the successor hiearchy for the default scope. If the property could not be found in the successor chain, a lookup for the default value defined for the PropertyMetaData in the Schema is returned. The Schema is retrieved using the SchemaGroupName environment property defined for the bean. If the property meta data is not available (or there is no Schema defined) then the specified default value is returned.
Parameters:
key - The name of the property to retrieve.
defaultValue - The value to return if that property is not set and there is not default value found in the Schema.

getProperty

public java.lang.Object getProperty(java.lang.String scopeName,
                                    java.lang.String key,
                                    ConfigurableEntity successor,
                                    java.lang.Object defaultValue)
                             throws java.rmi.RemoteException
Retrieve the value associated with the named key in the specified scope. If the entity does not have the property defined for the specified scope, the property will be searched in the successor hiearchy using the explicit successor first and then the successor for the specified scope. If the could not be found in the successors hiearchy, a lookup for default value defined for the PropertyMetaData in the Schema is returned. The Schema is retrieved using the SchemaGroupName environment property defined for the bean. If the property meta data is not available (or there is no Schema defined) then the specified default value is returned.
Parameters:
scopeName - The name of the scope.
key - The name of the property to retrieve.
successor - The explicit successor to use for sucessor hiearchy search if the entity does not have the property defined.
defaultValue - The value to return if that property is not set.

getPropertyAsString

public java.lang.String getPropertyAsString(java.lang.String key,
                                            java.lang.String defaultValue)
                                     throws java.rmi.RemoteException
Retrieve the String value of the property associated the named key in the default scope.
Parameters:
key - The name of the property to retrieve.
defaultValue - The String to return if that property is not set.
See Also:
getProperty(String key, Object defaultValue)

getPropertyAsString

public java.lang.String getPropertyAsString(java.lang.String scopeName,
                                            java.lang.String key,
                                            ConfigurableEntity successor,
                                            java.lang.String defaultValue)
                                     throws java.rmi.RemoteException
Retrieve the String value of the property associated the named key in the specified scope.
Parameters:
scopeName - The name of the scope.
key - The name of the property to retrieve.
successor - The explicit successor to use for sucessor hiearchy search if the entity does not have the property defined.
defaultValue - The String to return if that property is not set.
See Also:
getProperty(String scopeName, String key, ConfigurableEntity successor, Object defaultValue)

getPropertyDefault

public java.lang.Object getPropertyDefault(java.lang.String scopeName,
                                           java.lang.String key,
                                           ConfigurableEntity successor)
                                    throws java.rmi.RemoteException
Retrieve the default value from the Schema for the named key and the specified scope. This method is used by the implementation of the getProperty methods for retrieving the default value for a property from the successor hierarchy.
Parameters:
scopeName - The name of the scope.
key - The name of the property to retrieve.
successor - The explicit successor to use for sucessor hiearchy search if the entity does not have the property defined.

getPropertyNoDefault

public java.lang.Object getPropertyNoDefault(java.lang.String scopeName,
                                             java.lang.String key,
                                             ConfigurableEntity successor)
                                      throws java.rmi.RemoteException
Retrieve the value associated with the named key in the specified scope but does not return a default value if the property does not exist for the entity of in the hierarchy of successors. 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:
scopeName - The name of the scope.
key - The name of the property to retrieve.
successor - The explicit successor to use for sucessor hiearchy search if the entity does not have the property defined.

getSuccessor

public ConfigurableEntity getSuccessor(java.lang.String scopeName)
                                throws java.rmi.RemoteException
Retrieve the successor associated with this ConfigurableEntity for the specified scope.
Parameters:
scopeName - The name of the scope.

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.

removeProperty

public java.lang.Object removeProperty(java.lang.String key)
                                throws java.rmi.RemoteException
Remove the property associated with the named key in the default scope.
Parameters:
key - The name of the property to remove.

removeProperty

public java.lang.Object removeProperty(java.lang.String scopeName,
                                       java.lang.String key)
                                throws java.rmi.RemoteException
Remove the property associated with the named key in the specified scope.
Parameters:
scopeName - The name of the scope.
key - The name of the property to remove.

removePropertyValue

public void removePropertyValue(java.lang.String scopeName,
                                java.lang.String key,
                                java.lang.Object propertyValue)
                         throws java.rmi.RemoteException
Remove the property value object from the collection associated with the named key in the specified scope.
Parameters:
scopeName - The name of the scope.
key - The name of the property that is associated with the collection of values.
propertyValue - The object to remove from the collection.

removePropertyValueMapped

public java.lang.Object removePropertyValueMapped(java.lang.String scopeName,
                                                  java.lang.String propertyKey,
                                                  java.lang.String mappedKey)
                                           throws java.rmi.RemoteException
Remove the property value object from the map associated with the named key in the specified scope.
Parameters:
scopeName - The name of the scope.
propertykey - The name of the property that is associated with the map.
propertyValue - The map key of the object to remove from the map.

removeSuccessor

public ConfigurableEntity removeSuccessor(java.lang.String scopeName)
                                   throws java.rmi.RemoteException
Remove the successor for the specified scope.
Parameters:
scopeName - The name of the scope.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
                 throws java.rmi.RemoteException
Associate the specified value with the named key in the default scope.
Parameters:
name - The name to associate the value with.
value - The value to associate with the name.

setProperty

public void setProperty(java.lang.String scopeName,
                        java.lang.String key,
                        java.lang.Object property)
                 throws java.rmi.RemoteException
Associate the specified value with the named key in the specified scope.
Parameters:
scopeName - The name of the scope.
name - The name to associate the value with.
value - The value to associate with the name.

setSuccessor

public void setSuccessor(java.lang.String scopeName,
                         ConfigurableEntity successor)
                  throws java.rmi.RemoteException
Set the successor for the specified scope.
Parameters:
scopeName - The name of the scope.
successor - The scope-level successor used during the search of a property.

getPersistableHandle

public PersistableHandle getPersistableHandle()
                                       throws java.rmi.RemoteException
This method is used to create a long lived handle to an EJB object that can be persisted into a database. It is used mainly to establish successorship relationships. It is a method on the EJB because information such as the JNDI home name is not known outside the EJB.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved