atg.repository
Class ItemDescriptorImpl

java.lang.Object
  extended by atg.repository.ItemDescriptorImpl
All Implemented Interfaces:
DynamicBeanInfo, RepositoryItemDescriptor, java.io.Serializable
Direct Known Subclasses:
GSAItemDescriptor

public class ItemDescriptorImpl
extends java.lang.Object
implements RepositoryItemDescriptor

A simple implementation of RepositoryItemDescriptor which supports adding and removing DynamicPropertyDescriptors.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  DynamicPropertyDescriptor[] mPropertyDescriptors
          An Array of all the DynamicPropertyDescriptors
protected  java.util.Dictionary mPropertyDescriptorTable
          Table of all the DynamicPropertyDescriptors hashed by property name
protected  java.lang.String[] mPropertyNames
          An Array of all the property names
 
Constructor Summary
ItemDescriptorImpl()
          Constructs an instanceof ItemDescriptorImpl
ItemDescriptorImpl(Repository pRepository)
          Constructs an instanceof ItemDescriptorImpl for a given repository.
 
Method Summary
 void addPropertiesChangedListener(PropertiesChangedListener pListener)
          Adds a properties changed event listener from this item descriptor.
 void addPropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
          Adds the given property descriptor to the internal table of known descriptors
 boolean areInstances(DynamicBeanInfo pDynamicBeanInfo)
          Returns true if all objects described by some DynamicBeanInfo are also described by this one.
 java.lang.String encodeCompositeKey(java.lang.String[] pIdValues)
          Encode an array of ID values to be used as a Repository ID
 boolean equals(java.lang.Object pObj)
          Returns true if this RepositoryItemDescriptor and the supplied object (which should also be a RepositoryItemDescriptor) have the exact same set of properties (as defined by their name).
 DynamicBeanDescriptor getBeanDescriptor()
          Returns the DynamicBeanDescriptor for this DynamicBeanInfo.
 java.util.List getDependencies(Query pQuery)
          Generate query dependency list for this query used for query invalidation.
 java.lang.String getItemDescriptorName()
          Returns property ItemDescriptorName
 java.lang.String getItemDisplayNameProperty()
           
 java.util.List getPropertiesChangedListeners()
          Returns the list of properties changed listeners that are registered on this item descriptor.
 DynamicPropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
          Returns the DynamicPropertyDescriptor for the specified property
 DynamicPropertyDescriptor[] getPropertyDescriptors()
          Returns the all PropertyDescriptors
 java.lang.String[] getPropertyNames()
          Returns the list of the names of the known properties
 Repository getRepository()
          Returns the repository for this item descriptor.
 RepositoryImpl getRepositoryImpl()
           
 RepositoryPropertyDescriptor getRepositoryPropertyDescriptor(java.lang.String pPropertyName)
          Returns the RepositoryPropertyDescriptor for the specified property.
 RepositoryView getRepositoryView()
          Get property RepositoryView
 RepositoryView getRepositoryViewImpl()
          Get property RepositoryViewImpl
 java.lang.Object getValue(java.lang.String pName)
          Get the value associated with a named attribute.
 boolean hasCompositeKey()
          Determine if this item type has a composite ID.
 int hashCode()
           
 boolean hasProperty(java.lang.String pPropertyName)
          Returns true if the Repository supports the given property
 void invalidateCaches()
          Invalidates both the item and query caches for this item descriptor.
 void invalidateCaches(boolean pGlobal)
          Invalidates both the item and query caches for this item descriptor.
 void invalidateItemCache()
          Invalidates the item caches for this item descriptor.
 void invalidateItemCache(boolean pGlobal)
          Invalidates the item caches for this item descriptor.
 boolean isInstance(java.lang.Object pObj)
          Returns true if the given object belongs to the set of dynamic beans described by this DynamicBeanInfo.
 boolean isLoggingDebug()
           
 void removeItemFromCache(java.lang.String pId)
          Removes the specified item from any repository caches.
 void removeItemFromCache(java.lang.String pId, boolean pGlobal)
          Removes the specified item from any repository caches.
 void removeItemFromCache(java.lang.String pId, boolean pGlobal, boolean pRemoveTransientProperties)
          Removes the specified item from any repository caches.
 void removePropertiesChangedListener(PropertiesChangedListener pListener)
          Removes a properties changed event listener from this item descriptor.
 void removePropertyDescriptor(java.lang.String pPropertyName)
          Removes the given property descriptor from the internal table of known descriptors
 void sendPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem, int pType, java.util.Map pProperties)
          Sends a propertiesChangedEvent given the item itself that changed
 void sendPropertiesChangedEvent(java.lang.String pId, int pType, java.util.Map pProperties)
          Sends a propertiesChangedEvent given the id of the item that changed
 void setBeanDescriptor(DynamicBeanDescriptor pBeanDescriptor)
          Sets property BeanDescriptor
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
          Sets property ItemDescriptorName
 void setItemDisplayNameProperty(java.lang.String pItemDisplayNameProperty)
          Sets the property ItemDisplayNameProperty.
 void setLoggingDebug(boolean pLoggingDebug)
          Sets the property LoggingDebug.
 void setRepository(Repository pRepository)
          Sets the property Repository.
 void setRepositoryView(RepositoryView pRepositoryView)
          Set property RepositoryView
 void setValue(java.lang.String pName, java.lang.Object pValue)
          Associate an attribute value with a name for this descriptor.
protected  void updateDataStructures()
          Updates the internal data structures which perform property name-<property descriptor mapping, building the arrays of property names and DynamicPropertyDescriptors.
 void updatePropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
          Throws RepositoryException because this is an unsupported feature in this implementation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mPropertyDescriptorTable

protected java.util.Dictionary mPropertyDescriptorTable
Table of all the DynamicPropertyDescriptors hashed by property name


mPropertyNames

protected java.lang.String[] mPropertyNames
An Array of all the property names


mPropertyDescriptors

protected DynamicPropertyDescriptor[] mPropertyDescriptors
An Array of all the DynamicPropertyDescriptors

Constructor Detail

ItemDescriptorImpl

public ItemDescriptorImpl()
Constructs an instanceof ItemDescriptorImpl


ItemDescriptorImpl

public ItemDescriptorImpl(Repository pRepository)
Constructs an instanceof ItemDescriptorImpl for a given repository.

Method Detail

setBeanDescriptor

public void setBeanDescriptor(DynamicBeanDescriptor pBeanDescriptor)
Sets property BeanDescriptor


getBeanDescriptor

public DynamicBeanDescriptor getBeanDescriptor()
Returns the DynamicBeanDescriptor for this DynamicBeanInfo.

Specified by:
getBeanDescriptor in interface DynamicBeanInfo

getPropertyDescriptors

public DynamicPropertyDescriptor[] getPropertyDescriptors()
Returns the all PropertyDescriptors

Specified by:
getPropertyDescriptors in interface DynamicBeanInfo

hasProperty

public boolean hasProperty(java.lang.String pPropertyName)
Returns true if the Repository supports the given property

Specified by:
hasProperty in interface DynamicBeanInfo
Parameters:
pPropertyName - the name of the property

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns the list of the names of the known properties

Specified by:
getPropertyNames in interface DynamicBeanInfo

getPropertyDescriptor

public DynamicPropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
Returns the DynamicPropertyDescriptor for the specified property

Specified by:
getPropertyDescriptor in interface DynamicBeanInfo
Parameters:
pPropertyName - the name of the property
Returns:
null if the Repository has no such property.

getRepositoryPropertyDescriptor

public RepositoryPropertyDescriptor getRepositoryPropertyDescriptor(java.lang.String pPropertyName)
Returns the RepositoryPropertyDescriptor for the specified property. Use this version if you know you have an ItemDescriptorImpl and you need fast access to the property descriptor (i.e. to avoid a cast).

Returns:
null if the Repository has no such property.

isInstance

public boolean isInstance(java.lang.Object pObj)
Returns true if the given object belongs to the set of dynamic beans described by this DynamicBeanInfo. The definition of this set is variable and is determined by the DynamicBeanInfo; however, all objects described by the same DynamicBeanInfo will generally have the same set of dynamic properties with the same behavior and semantics, and the same meta-behavior such as readability, writability, etc.

Specified by:
isInstance in interface DynamicBeanInfo

areInstances

public boolean areInstances(DynamicBeanInfo pDynamicBeanInfo)
Returns true if all objects described by some DynamicBeanInfo are also described by this one.

Specified by:
areInstances in interface DynamicBeanInfo

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Sets property ItemDescriptorName


getItemDescriptorName

public java.lang.String getItemDescriptorName()
Returns property ItemDescriptorName

Specified by:
getItemDescriptorName in interface RepositoryItemDescriptor

addPropertyDescriptor

public void addPropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
                           throws RepositoryException
Adds the given property descriptor to the internal table of known descriptors

Specified by:
addPropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyDescriptor - the descriptor for the new property to add to the Repository
Throws:
RepositoryException - if there was an error

updatePropertyDescriptor

public void updatePropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
                              throws RepositoryException
Throws RepositoryException because this is an unsupported feature in this implementation

Specified by:
updatePropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyDescriptor - the descriptor for the property to update
Throws:
RepositoryException - unsupported feature

removePropertyDescriptor

public void removePropertyDescriptor(java.lang.String pPropertyName)
                              throws RepositoryException
Removes the given property descriptor from the internal table of known descriptors

Specified by:
removePropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyName - the name of the property
Throws:
RepositoryException - if there was an error

setItemDisplayNameProperty

public void setItemDisplayNameProperty(java.lang.String pItemDisplayNameProperty)
Sets the property ItemDisplayNameProperty. If this is set to a non-null value, the getItemDisplayName() method on the RepositoryItem will return the value of this property for its display name. If it is not set, then just the repository id is returned.

Parameters:
pItemDisplayNameProperty - new value to set

getItemDisplayNameProperty

public java.lang.String getItemDisplayNameProperty()
Returns:
The value of the property ItemDisplayNameProperty.

equals

public boolean equals(java.lang.Object pObj)
Returns true if this RepositoryItemDescriptor and the supplied object (which should also be a RepositoryItemDescriptor) have the exact same set of properties (as defined by their name).

Overrides:
equals in class java.lang.Object

setRepositoryView

public void setRepositoryView(RepositoryView pRepositoryView)
Set property RepositoryView

Parameters:
pRepositoryView - new value to set

getRepositoryView

public RepositoryView getRepositoryView()
Get property RepositoryView

Specified by:
getRepositoryView in interface RepositoryItemDescriptor
Returns:
RepositoryView

getRepositoryViewImpl

public RepositoryView getRepositoryViewImpl()
Get property RepositoryViewImpl

Returns:
RepositoryView

updateDataStructures

protected void updateDataStructures()
Updates the internal data structures which perform property name-<property descriptor mapping, building the arrays of property names and DynamicPropertyDescriptors.


setRepository

public void setRepository(Repository pRepository)
Sets the property Repository.

Parameters:
pRepository - new value to set

getRepository

public final Repository getRepository()
Description copied from interface: RepositoryItemDescriptor
Returns the repository for this item descriptor.

Specified by:
getRepository in interface RepositoryItemDescriptor
Returns:
The value of the property Repository.

getRepositoryImpl

public final RepositoryImpl getRepositoryImpl()
Returns:
The value of the property Repository.

addPropertiesChangedListener

public void addPropertiesChangedListener(PropertiesChangedListener pListener)
Adds a properties changed event listener from this item descriptor.


removePropertiesChangedListener

public void removePropertiesChangedListener(PropertiesChangedListener pListener)
Removes a properties changed event listener from this item descriptor.


getPropertiesChangedListeners

public java.util.List getPropertiesChangedListeners()
Returns the list of properties changed listeners that are registered on this item descriptor.


sendPropertiesChangedEvent

public void sendPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem,
                                       int pType,
                                       java.util.Map pProperties)
Sends a propertiesChangedEvent given the item itself that changed


sendPropertiesChangedEvent

public void sendPropertiesChangedEvent(java.lang.String pId,
                                       int pType,
                                       java.util.Map pProperties)
Sends a propertiesChangedEvent given the id of the item that changed


invalidateItemCache

public void invalidateItemCache()
Invalidates the item caches for this item descriptor.


invalidateItemCache

public void invalidateItemCache(boolean pGlobal)
Invalidates the item caches for this item descriptor.

Parameters:
pGlobal - if true, the item caches are invalidated in all servers in the cluster. Use of this option may require additional configuration in which case, the local cache is invalidated and a warning is issued.

invalidateCaches

public void invalidateCaches()
Invalidates both the item and query caches for this item descriptor.


invalidateCaches

public void invalidateCaches(boolean pGlobal)
Invalidates both the item and query caches for this item descriptor.

Parameters:
pGlobal - if true, the caches are invalidated in all servers in the cluster. Use of this option may require additional configuration in which case, the local cache is invalidated and a warning is issued.

removeItemFromCache

public void removeItemFromCache(java.lang.String pId)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

removeItemFromCache

public void removeItemFromCache(java.lang.String pId,
                                boolean pGlobal)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
pGlobal - if true, the item is removed from all servers in the cluster. This option may require additional configuration so that the cluster members can find each other. A warning is logged if this is not option is not supported and a true value is given.
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

removeItemFromCache

public void removeItemFromCache(java.lang.String pId,
                                boolean pGlobal,
                                boolean pRemoveTransientProperties)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
pGlobal - if true, the item is removed from all servers in the cluster. This option may require additional configuration so that the cluster members can find each other. A warning is logged if this is not option is not supported and a true value is given.
pRemoveTransientProperties - if true, transient properties for the item will also be remove from the cache.
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

getDependencies

public java.util.List getDependencies(Query pQuery)
Generate query dependency list for this query used for query invalidation.

Parameters:
pQuery - Query to generate dependency list for.
Returns:
List of dependencies.

setValue

public void setValue(java.lang.String pName,
                     java.lang.Object pValue)
Associate an attribute value with a name for this descriptor. This is just a convenience method for accessing the "feature descriptor values" in the item-descriptors bean descriptor.

Parameters:
pName - name of attribute
pValue - value of attribute

getValue

public java.lang.Object getValue(java.lang.String pName)
Get the value associated with a named attribute.

Parameters:
pName - name of attribute
Returns:
the value, may be null of the attribute is unknown

hasCompositeKey

public boolean hasCompositeKey()
Determine if this item type has a composite ID.

Specified by:
hasCompositeKey in interface RepositoryItemDescriptor
Returns:
default is false, implementations may override

encodeCompositeKey

public java.lang.String encodeCompositeKey(java.lang.String[] pIdValues)
                                    throws RepositoryException
Encode an array of ID values to be used as a Repository ID

Specified by:
encodeCompositeKey in interface RepositoryItemDescriptor
Parameters:
pIdValues - Array of ID values
Returns:
the encoded String value of the composite key
Throws:
RepositoryException - unsupported feature

setLoggingDebug

public void setLoggingDebug(boolean pLoggingDebug)
Sets the property LoggingDebug.

Parameters:
pLoggingDebug - new value to set

isLoggingDebug

public boolean isLoggingDebug()
Returns:
The value of the property LoggingDebug.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()