BEA Systems, Inc.

com.beasys.commerce.foundation.property
Class EntityPropertyManagerImpl

java.lang.Object
  |
  +--com.beasys.commerce.foundation.SessionImpl
        |
        +--com.beasys.commerce.foundation.property.EntityPropertyManagerImpl
Direct Known Subclasses:
EntityPropertyAggregatorImpl, LDAPEntityPropertyManagerImpl

public class EntityPropertyManagerImpl
extends SessionImpl

This class is used to expedite access to EntityProperties and the mapping of their names. This stateful session bean will "cache" a set of Entity Properties

See Also:
EntityPropertyManager, EntityPropertyManagerHome, Serialized Form

Field Summary
protected static boolean enableCache
           
protected static java.lang.String ENTITY_ID_CACHE
           
protected static java.lang.String ENTITY_PROPERTY_CACHE
           
protected static java.lang.String PROPERTY_DEFAULT_CACHE
           
 
Fields inherited from class com.beasys.commerce.foundation.SessionImpl
_ctx, _environmentNamingContext, _environmentPropertyCache, _isDirty
 
Constructor Summary
EntityPropertyManagerImpl()
           
 
Method Summary
 void addPropertyValue(PropertyLocator locator, java.lang.String scopeName, java.lang.String key, java.lang.Object value)
          Implementation incomplete.
 void addPropertyValueMapped(PropertyLocator locator, java.lang.String scopeName, java.lang.String key, java.lang.String mapKey, java.lang.Object value)
          Implementation incomplete.
protected  void cacheAsNull(PropertyLocator locator, EntityPropertyCacheKey key)
          Mark a property as having a null value in an entity's property cache.
 void ejbActivate()
          N/A for stateless session bean.
 void ejbCreate()
          Initializes the sequencers and the DataSource used for obtaining database connections.
 void ejbPassivate()
          N/A for stateless session bean.
 void ejbRemove()
          Does nothing (no resources need to be released).
protected  long getCachedEntityId(PropertyLocator loc)
          Retrieve a cached entity id
protected  java.lang.Object getCachedPropertyDefault(PropertyDefaultCacheKey key)
          Get a value from the default value cache
protected  java.lang.Object getCachedValue(PropertyLocator locator, EntityPropertyCacheKey key)
          Get a value from an entity's property cache
 java.lang.String[] getDynamicProperties(PropertyLocator locator, java.lang.String scopeName)
          Returns a list of dynamically assigned properties for the given entity, that have been named with the given scope name.
 java.util.Map getProperties(PropertyLocator locator)
          Returns a map of PropertyMapKey to Objects for all properties set for the entity.
 java.util.Map getProperties(PropertyLocator locator, java.lang.String scopeName)
          Returns a map of PropertyMapKey to Objects for all properties set for the entity for the specified scope.
 java.lang.Object getProperty(PropertyLocator locator, java.lang.String scopeName, java.lang.String key)
          Returns the value of the property defined for the specified key and scopeName.
 java.lang.Object getPropertyDefault(PropertyLocator locator, java.lang.String scopeName, java.lang.String key)
           
 PropertyMetaData getPropertyMetaData(PropertyLocator locator, java.lang.String scopeName, java.lang.String key)
          Returns the PropertyMetaData associated with the property specified the schema group name defined in the property locator, the scope name, and the key.
 java.util.Enumeration getPropertyMetaDatum(PropertyLocator locator)
           
 java.util.Map getSchemaDefaults(java.lang.String schemaName, java.lang.String schemaGroupName)
          Returns a map of property name/default value pairs for the given property set.
 long getUniqueId(java.lang.String homeName, java.lang.String pkString)
          Returns the number that uniquely identifies the entity specified by the home name and the pk string.
protected  boolean isCachedAsNull(PropertyLocator locator, EntityPropertyCacheKey key)
          Determine if a property has been marked as having a null value in an entity's property cache.
protected  boolean isPropertyDefaultCached(PropertyDefaultCacheKey key)
          Determines if a property default value has been cached.
protected  void putCachedPropertyDefault(PropertyDefaultCacheKey key, java.lang.Object value)
          Put a property value in the default value cache
protected  void putCachedValue(PropertyLocator locator, EntityPropertyCacheKey key, java.lang.Object value)
          Put a property value in an entity's property cache
protected  void removeCachedEntityId(PropertyLocator loc)
           
protected  void removeCachedValue(PropertyLocator locator, EntityPropertyCacheKey key)
          Remove a value from an entity's property cache
protected  void removeCachedValues(PropertyLocator locator)
          Remove all values from an entity's property cache
 void removeProperties(PropertyLocator locator)
          Removes all properties for all scopes associated with the entity specified by the property locator.
 java.lang.Object removeProperty(PropertyLocator locator, java.lang.String scopeName, java.lang.String key)
          Removes the property for the entity identified by the locator for the specified scope and key.
 java.lang.Object removePropertyValue(PropertyLocator locator, java.lang.String scopeName, java.lang.String key, java.lang.Object value)
           
 java.lang.Object removePropertyValueMapped(PropertyLocator locator, java.lang.String scopeName, java.lang.String key, java.lang.String mapKey)
           
protected  void setCachedEntityId(PropertyLocator loc, long entityId)
          Cache an entity id
 void setProperties(PropertyLocator locator, java.util.Map propertyValues)
           
 void setProperty(PropertyLocator locator, java.lang.String scopeName, java.lang.String key, java.lang.Object value)
          Associates the property value to the entity identified by the locator for the specified scope and key.
 void setSessionContext(javax.ejb.SessionContext ctx)
          Delegate the setting of the SessionContext to the parent class.
 
Methods inherited from class com.beasys.commerce.foundation.SessionImpl
clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, doRelationalBinding, doRelationalBinding, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, ejbPostCreate, enumerateRelationalBinding, enumerateRelationalBinding, getEnvironmentNamingContext, getEnvironmentProperty, getEnvironmentProperty, getEnvironmentPropertyCache, getPersistenceHelperPlugin, getSessionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_PROPERTY_CACHE

protected static java.lang.String ENTITY_PROPERTY_CACHE

ENTITY_ID_CACHE

protected static java.lang.String ENTITY_ID_CACHE

PROPERTY_DEFAULT_CACHE

protected static java.lang.String PROPERTY_DEFAULT_CACHE

enableCache

protected static boolean enableCache
Constructor Detail

EntityPropertyManagerImpl

public EntityPropertyManagerImpl()
                          throws javax.ejb.CreateException
Method Detail

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Initializes the sequencers and the DataSource used for obtaining database connections. Two sequencers are used to generate unique ids for ENTITY_ID and PROPERTY_ID values.
Overrides:
ejbCreate in class SessionImpl

ejbActivate

public void ejbActivate()
                 throws javax.ejb.EJBException
N/A for stateless session bean.
Overrides:
ejbActivate in class SessionImpl

ejbPassivate

public void ejbPassivate()
                  throws javax.ejb.EJBException
N/A for stateless session bean.
Overrides:
ejbPassivate in class SessionImpl

ejbRemove

public void ejbRemove()
               throws javax.ejb.EJBException
Does nothing (no resources need to be released).
Overrides:
ejbRemove in class SessionImpl

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
                       throws javax.ejb.EJBException
Delegate the setting of the SessionContext to the parent class.
Overrides:
setSessionContext in class SessionImpl

addPropertyValue

public void addPropertyValue(PropertyLocator locator,
                             java.lang.String scopeName,
                             java.lang.String key,
                             java.lang.Object value)
                      throws java.rmi.RemoteException
Implementation incomplete.

addPropertyValueMapped

public void addPropertyValueMapped(PropertyLocator locator,
                                   java.lang.String scopeName,
                                   java.lang.String key,
                                   java.lang.String mapKey,
                                   java.lang.Object value)
                            throws java.rmi.RemoteException
Implementation incomplete.

getProperties

public java.util.Map getProperties(PropertyLocator locator)
                            throws java.rmi.RemoteException
Returns a map of PropertyMapKey to Objects for all properties set for the entity.
Parameters:
locator - specifies the JNDIHomeName and Pk string needed to retrieve the entityId. Also specifies the schemaGroupName that is used to retrieved the type of the property.

getProperties

public java.util.Map getProperties(PropertyLocator locator,
                                   java.lang.String scopeName)
                            throws java.rmi.RemoteException
Returns a map of PropertyMapKey to Objects for all properties set for the entity for the specified scope.
Parameters:
locator - specifies the JNDIHomeName and Pk string needed to retrieve the entityId. Also specifies the schemaGroupName that is used to retrieved the type of the property.
scopeName - specifies the scopeName in which the properties are defined.

getProperty

public java.lang.Object getProperty(PropertyLocator locator,
                                    java.lang.String scopeName,
                                    java.lang.String key)
                             throws java.rmi.RemoteException
Returns the value of the property defined for the specified key and scopeName. If the property is not defined then null is returned.

getPropertyMetaData

public PropertyMetaData getPropertyMetaData(PropertyLocator locator,
                                            java.lang.String scopeName,
                                            java.lang.String key)
                                     throws java.rmi.RemoteException
Returns the PropertyMetaData associated with the property specified the schema group name defined in the property locator, the scope name, and the key.

getPropertyMetaDatum

public java.util.Enumeration getPropertyMetaDatum(PropertyLocator locator)
                                           throws java.rmi.RemoteException

getUniqueId

public long getUniqueId(java.lang.String homeName,
                        java.lang.String pkString)
                 throws java.rmi.RemoteException
Returns the number that uniquely identifies the entity specified by the home name and the pk string. If the entity does not have a unique id assigned, a new one will be created.

removeProperties

public void removeProperties(PropertyLocator locator)
                      throws java.rmi.RemoteException
Removes all properties for all scopes associated with the entity specified by the property locator.

removeProperty

public java.lang.Object removeProperty(PropertyLocator locator,
                                       java.lang.String scopeName,
                                       java.lang.String key)
                                throws java.rmi.RemoteException
Removes the property for the entity identified by the locator for the specified scope and key.

removePropertyValue

public java.lang.Object removePropertyValue(PropertyLocator locator,
                                            java.lang.String scopeName,
                                            java.lang.String key,
                                            java.lang.Object value)
                                     throws java.rmi.RemoteException

removePropertyValueMapped

public java.lang.Object removePropertyValueMapped(PropertyLocator locator,
                                                  java.lang.String scopeName,
                                                  java.lang.String key,
                                                  java.lang.String mapKey)
                                           throws java.rmi.RemoteException

setProperty

public void setProperty(PropertyLocator locator,
                        java.lang.String scopeName,
                        java.lang.String key,
                        java.lang.Object value)
                 throws java.rmi.RemoteException
Associates the property value to the entity identified by the locator for the specified scope and key.

setProperties

public void setProperties(PropertyLocator locator,
                          java.util.Map propertyValues)
                   throws java.rmi.RemoteException

getPropertyDefault

public java.lang.Object getPropertyDefault(PropertyLocator locator,
                                           java.lang.String scopeName,
                                           java.lang.String key)
                                    throws java.rmi.RemoteException

getSchemaDefaults

public java.util.Map getSchemaDefaults(java.lang.String schemaName,
                                       java.lang.String schemaGroupName)
                                throws java.rmi.RemoteException
Returns a map of property name/default value pairs for the given property set.

getDynamicProperties

public java.lang.String[] getDynamicProperties(PropertyLocator locator,
                                               java.lang.String scopeName)
                                        throws java.rmi.RemoteException
Returns a list of dynamically assigned properties for the given entity, that have been named with the given scope name.

getCachedValue

protected java.lang.Object getCachedValue(PropertyLocator locator,
                                          EntityPropertyCacheKey key)
Get a value from an entity's property cache
Parameters:
locator - the key for the entity
key - the key to lookup the property value
Returns:
the value of the property, or null if it was not in the cache

removeCachedValue

protected void removeCachedValue(PropertyLocator locator,
                                 EntityPropertyCacheKey key)
Remove a value from an entity's property cache
Parameters:
locator - the key for the entity
key - the key of the property to remove

putCachedValue

protected void putCachedValue(PropertyLocator locator,
                              EntityPropertyCacheKey key,
                              java.lang.Object value)
Put a property value in an entity's property cache
Parameters:
locator - the key for the entity
key - the property's key
value - the value to cache for that property

removeCachedValues

protected void removeCachedValues(PropertyLocator locator)
Remove all values from an entity's property cache
Parameters:
locator - the key for the entity

putCachedPropertyDefault

protected void putCachedPropertyDefault(PropertyDefaultCacheKey key,
                                        java.lang.Object value)
Put a property value in the default value cache
Parameters:
key - the property's key
value - the value to cache for that property

getCachedPropertyDefault

protected java.lang.Object getCachedPropertyDefault(PropertyDefaultCacheKey key)
Get a value from the default value cache
Parameters:
key - the property's key
Returns:
the cached value

isPropertyDefaultCached

protected boolean isPropertyDefaultCached(PropertyDefaultCacheKey key)
Determines if a property default value has been cached.

cacheAsNull

protected void cacheAsNull(PropertyLocator locator,
                           EntityPropertyCacheKey key)
Mark a property as having a null value in an entity's property cache. This is to differentiate it from a property that has not been cached yet.
Parameters:
locator - the key for the entity
key - the key of the property

isCachedAsNull

protected boolean isCachedAsNull(PropertyLocator locator,
                                 EntityPropertyCacheKey key)
Determine if a property has been marked as having a null value in an entity's property cache.
Parameters:
locator - the key for the entity
key - the key of the property
Returns:
true if the property has been marked as null

getCachedEntityId

protected long getCachedEntityId(PropertyLocator loc)
Retrieve a cached entity id
Parameters:
locator - the key of an entity (leave propertySet as null)
Returns:
the entity's cached id, or 0 if none was found

setCachedEntityId

protected void setCachedEntityId(PropertyLocator loc,
                                 long entityId)
Cache an entity id
Parameters:
locator - the key of an entity (leave propertySet as null)
entityId - the id to cache for that entity

removeCachedEntityId

protected void removeCachedEntityId(PropertyLocator loc)

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved