com.waveset.object
Class MetaView

java.lang.Object
  extended bycom.waveset.object.PersistentObject
      extended bycom.waveset.object.MetaView
All Implemented Interfaces:
java.lang.Comparable, javax.naming.Referenceable, XmlObject

public class MetaView
extends PersistentObject

A MetaView holds information about how information flows through a system. Currently, the MetaView is a common data model that can be used to map attributes and events from resource to resource.

Version:
$Revision: 1.17 $

Nested Class Summary
static class MetaView.ApplicationType
           
static class MetaView.ApplicationTypeComparator
           
static class MetaView.MetaViewApplications
           
 
Nested classes inherited from class com.waveset.object.PersistentObject
PersistentObject.Comparator, PersistentObject.InitialInstance
 
Field Summary
static java.lang.String APP_ACTIVE_SYNC
           
static java.lang.String APP_ADMIN_GUI
           
static java.lang.String APP_BULK_ACTIONS
           
static java.lang.String APP_END_USER_GUI
           
static java.lang.String APP_LOAD_FROM_FILE
           
static java.lang.String APP_LOAD_FROM_RESOURCE
           
static java.lang.String APP_RECONCILIATION
           
static java.lang.String APP_SPML
           
static java.lang.String ATT_ENABLED_APPLICATIONS
           
static java.lang.String ATT_LAST_SEEN_RESOURCE_LAST_MOD
           
static java.lang.String ATT_SERVICED_TYPE
           
static MetaView.MetaViewApplications AVAILABLE_APPLICATIONS
           
static java.lang.String code_id
           
static java.lang.String DEFAULT_META_VIEW
          The ID of the default Meta View for user objects.
static java.lang.String ELEMENT
           
 
Fields inherited from class com.waveset.object.PersistentObject
_trace, trace
 
Constructor Summary
MetaView()
          Default constructor.
MetaView(org.w3c.dom.Element e)
          Constructor from an XML element.
 
Method Summary
 void addMetaEvent(MetaEvent event)
          Add a MetaEvent to the MetaView.
 void addMetaViewAttribute(MetaViewAttribute attribute)
          Add a MetaViewAttribute to the MetaView.
protected  void addSubclassAttributes(java.lang.StringBuffer b)
          Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist).
protected  void addSubclassElements(java.lang.StringBuffer b)
          Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist).
 void clearMetaEvents()
          Clear all MetaEvents from the MetaView.
 void clearMetaViewAttributes()
          Clear all MetaViewAttributes from the MetaView.
 boolean equals(java.lang.Object o)
          Compares two objects for equality of identity.
 java.util.Set getAttributesWithSource(ObjectRef resourceRef, java.lang.String attrName)
          Return a Set of the MetaViewAttributes that have a source with the given Resource ObjectRef and attribute.
 java.util.Set getAttributesWithTarget(ObjectRef resourceRef, java.lang.String attrName)
          Return a Set of the MetaViewAttributes that have a target with the given Resource ObjectRef and attribute.
 java.lang.String getElementName()
          Return the XML element name of this object.
 java.util.List getEnabledApplications()
           
 long getLastSeenResourceLastMod()
          Get the lastMod of the most recently saved resource that has had its changes assimilated into the meta view.
 MetaEvent getMetaEvent(MetaEvent.Type type, Resource resource)
          Get a MetaEvent with the given Type that is detected on the given resource.
 java.util.List getMetaEvents()
          Return the List of MetaEvents, or an empty list if none have been set.
 java.util.List getMetaEvents(MetaEvent.Type type)
          Get a non-null List of MetaEvents on this MetaView of the given type.
 MetaViewAttribute getMetaViewAttribute(java.lang.String attributeName)
          Get a MetaViewAttribute by name.
 java.util.List getMetaViewAttributes()
          Return the List of MetaViewAttributes, or an empty list if none have been set.
 java.util.ArrayList getReferences()
          Returns the list of all references in this object.
 java.util.List getResponses(MetaEvent.Type type, Resource resource)
          Get a possibly-null list of MetaEventResponses configured when the given event type is detected on the given resource.
 Type getServicedType()
           
 Type getType()
          Return the type of this PersistentObject.
 int hashCode()
          Implement the hashCode for efficient map insertion
 boolean isApplicationEnabled(java.lang.String app)
          Determine whether the given application (one of the APP_ contants) is enabled for this MetaView.
 boolean isGlobalTargetAttribute(java.lang.String attrName)
          Return whether the given attribute is a global target.
 boolean isSourceAttribute(Resource resource, java.lang.String attrName)
          Return whether the attribute on the given resource is a source for this MetaView.
 boolean isTargetAttribute(Resource resource, java.lang.String attrName)
          Return whether the attribute on the given resource is a target for this MetaView - either explicitly or as a global target.
protected  void parseSubclassAttributes(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).
protected  void parseSubclassElements(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).
 void removeMetaEvent(MetaEvent event)
          Remove a MetaEvent from the MetaView.
 void removeMetaViewAttribute(java.lang.String attributeName)
          Remove a MetaViewAttribute from the MetaView.
 void setEnabledApplications(java.util.List enabledApplications)
          Set the enabled applications.
 void setLastSeenResourceLastMod(long lastSeenResourceLastMod)
          Set the lastMod of the most recently saved resource that has had its changes assimilated into the meta view.
 void setMetaEvents(java.util.List events)
          Set the List of MetaEvents for the MetaView.
 void setMetaViewAttributes(java.util.List attributes)
          Clears out the existing MetaViewAttributes and adds the list of MetaViewAttributes.
 void setServicedType(Type servicedType)
          Set the service Type.
 void visit(Visitor v)
          Visitor interface.
 
Methods inherited from class com.waveset.object.PersistentObject
addCommonElements, addEndTag, addMemberObjectGroup, addMemberObjectGroup, addPersistentAttributes, addStartTag, addSummaryAttributes, addXmlHeader, attributesMatch, attributesMatch, attributesMatch, checkReference, checkReferences, clearId, cloneAs, cloneObject, compareTo, create, create, create, create, createLastModItem, createLastModItem, createLastModItemList, directObjectGroupMember, dump, dumpFile, fakeId, getAttribute, getAttributeValues, getAttributeValues, getAuthReferences, getAuthType, getBasicAttributes, getBasicAttributes, getBasicAttributes, getCache, getCounterValue, getCreateDate, getCreator, getDisplayableName, getDisplayName, getEncryptedValues, getId, getIdOrName, getInitialInstances, getLastMod, getLastModDate, getLastModifier, getLastModItemId, getLockInfo, getMemberObjectGroupRefs, getMemberObjectGroupRefsUpTo, getMemberObjectGroups, getName, getNameOrId, getProperties, getProperty, getPropertyAsString, getPropertyList, getQueryableAttributes, getReference, getRuleDrivenMemberObjectGroupRefs, getRuleDrivenMemberObjectGroupRefsUpTo, getRuleDrivenMemberObjectGroups, getSubtype, getSummaryAttributes, getSummaryString, hasEncryptedData, identityEquals, isAlias, isHidden, isId, isProtected, isProtectedFromDelete, isReferencedIn, listOperationalAttributes, listQueryableAttributes, listQueryableReferenceAttributes, listSummaryAttributes, objectGroupMember, objectGroupMemberRef, parseCommonElement, parseCommonElements, parsePersistentAttributes, parseXml, parseXml, prepareForSerialization, prepareToSerialize, println, reEncrypt, reEncryptSubclassAttributes, removeMemberObjectGroup, removeProperty, resolve, resolve, resolve, resolveArray, resolveArrayByFetching, resolveObjectReference, resolveObjectReferences, resolveReference, resolveSummaryAttributes, resolveSummaryAttributes, ruleDrivenObjectGroupMemberRef, setAuthType, setAuthType, setCache, setCreateDate, setCreator, setDisplayName, setDisplayName, setHidden, setIsAlias, setLastMod, setLastMod, setLastModDate, setLastModifier, setMemberObjectGroupRef, setMemberObjectGroupRefs, setMemberObjectGroups, setName, setProperties, setProperty, setPropertyList, setProtected, setProtectedFromDelete, setRuleDrivenMembersCache, setSubtype, setTrace, toString, toXml, toXml, toXml, toXmlFile
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

DEFAULT_META_VIEW

public static final java.lang.String DEFAULT_META_VIEW
The ID of the default Meta View for user objects.

See Also:
Constant Field Values

APP_ADMIN_GUI

public static final java.lang.String APP_ADMIN_GUI
See Also:
Constant Field Values

APP_END_USER_GUI

public static final java.lang.String APP_END_USER_GUI
See Also:
Constant Field Values

APP_ACTIVE_SYNC

public static final java.lang.String APP_ACTIVE_SYNC
See Also:
Constant Field Values

APP_SPML

public static final java.lang.String APP_SPML
See Also:
Constant Field Values

APP_BULK_ACTIONS

public static final java.lang.String APP_BULK_ACTIONS
See Also:
Constant Field Values

APP_RECONCILIATION

public static final java.lang.String APP_RECONCILIATION
See Also:
Constant Field Values

APP_LOAD_FROM_RESOURCE

public static final java.lang.String APP_LOAD_FROM_RESOURCE
See Also:
Constant Field Values

APP_LOAD_FROM_FILE

public static final java.lang.String APP_LOAD_FROM_FILE
See Also:
Constant Field Values

AVAILABLE_APPLICATIONS

public static final MetaView.MetaViewApplications AVAILABLE_APPLICATIONS

ELEMENT

public static final java.lang.String ELEMENT
See Also:
Constant Field Values

ATT_SERVICED_TYPE

public static final java.lang.String ATT_SERVICED_TYPE
See Also:
Constant Field Values

ATT_ENABLED_APPLICATIONS

public static final java.lang.String ATT_ENABLED_APPLICATIONS
See Also:
Constant Field Values

ATT_LAST_SEEN_RESOURCE_LAST_MOD

public static final java.lang.String ATT_LAST_SEEN_RESOURCE_LAST_MOD
See Also:
Constant Field Values
Constructor Detail

MetaView

public MetaView()
Default constructor.


MetaView

public MetaView(org.w3c.dom.Element e)
         throws WavesetException
Constructor from an XML element.

Method Detail

getType

public Type getType()
Return the type of this PersistentObject.

Specified by:
getType in class PersistentObject

visit

public void visit(Visitor v)
           throws WavesetException
Visitor interface.

Overrides:
visit in class PersistentObject
Throws:
WavesetException

getReferences

public java.util.ArrayList getReferences()
Description copied from class: PersistentObject
Returns the list of all references in this object. This is intended to be overloaded by subclasses to add references specific to that class.

Overrides:
getReferences in class PersistentObject

getMetaViewAttributes

public java.util.List getMetaViewAttributes()
Return the List of MetaViewAttributes, or an empty list if none have been set.

Returns:
Returns the List of MetaViewAttributes, or an empty list if none have been set.

setMetaViewAttributes

public void setMetaViewAttributes(java.util.List attributes)
                           throws WavesetException
Clears out the existing MetaViewAttributes and adds the list of MetaViewAttributes.

Parameters:
attributes - List of MetaViewAttributes to set.
Throws:
WavesetException - If the list contains multiple attributes with the same name.

getMetaViewAttribute

public MetaViewAttribute getMetaViewAttribute(java.lang.String attributeName)
Get a MetaViewAttribute by name.

Parameters:
attributeName - The attribute to get.
Returns:
Returns the MetaViewAttribute or null if one does not exists.

addMetaViewAttribute

public void addMetaViewAttribute(MetaViewAttribute attribute)
                          throws WavesetException
Add a MetaViewAttribute to the MetaView.

Parameters:
attribute - The attribute to add.
Throws:
WavesetException - If the MetaView already contains an attribute with the same name.

removeMetaViewAttribute

public void removeMetaViewAttribute(java.lang.String attributeName)
Remove a MetaViewAttribute from the MetaView.

Returns:
attributeName The name of the attribute to remove from the MetaView.

clearMetaViewAttributes

public void clearMetaViewAttributes()
Clear all MetaViewAttributes from the MetaView.


getMetaEvents

public java.util.List getMetaEvents()
Return the List of MetaEvents, or an empty list if none have been set.

Returns:
Returns the List of MetaEvents, or an empty list if none have been set.

getMetaEvents

public java.util.List getMetaEvents(MetaEvent.Type type)
Get a non-null List of MetaEvents on this MetaView of the given type.

Parameters:
type - The type of the MetaEvents to get.
Returns:
A non-null List of MetaEvents on this MetaView of the given type.

getMetaEvent

public MetaEvent getMetaEvent(MetaEvent.Type type,
                              Resource resource)
Get a MetaEvent with the given Type that is detected on the given resource.

Parameters:
type - The type of the MetaEvent to get.
resource - The resource on which the event is detected
Returns:
The MetaEvent that detects the given type on the given resource, or null if one does not exist in this MetaView.

addMetaEvent

public void addMetaEvent(MetaEvent event)
                  throws WavesetException
Add a MetaEvent to the MetaView.

Parameters:
event - The MetaEvent to add.
Throws:
WavesetException - If an event of the given type with one of the sources already exists in the MetaView.

removeMetaEvent

public void removeMetaEvent(MetaEvent event)
Remove a MetaEvent from the MetaView.

Parameters:
event - The MetaEvent to remove.

setMetaEvents

public void setMetaEvents(java.util.List events)
Set the List of MetaEvents for the MetaView.

Parameters:
events - The List of MetaEvents to set.

clearMetaEvents

public void clearMetaEvents()
Clear all MetaEvents from the MetaView.


getServicedType

public Type getServicedType()
Returns:
Returns the servicedType.

setServicedType

public void setServicedType(Type servicedType)
Set the service Type.

Parameters:
servicedType - The servicedType to set.
Throws:
java.lang.IllegalArgumentException - If servicedType is null.

getEnabledApplications

public java.util.List getEnabledApplications()
Returns:
Returns the enabledApplications.

setEnabledApplications

public void setEnabledApplications(java.util.List enabledApplications)
Set the enabled applications.

Parameters:
enabledApplications - The enabledApplications to set.

isApplicationEnabled

public boolean isApplicationEnabled(java.lang.String app)
Determine whether the given application (one of the APP_ contants) is enabled for this MetaView.

Parameters:
app - The name of the application to check for enablement.
Returns:
Whether the given application (one of the APP_ contants) is enabled for this MetaView.

getLastSeenResourceLastMod

public long getLastSeenResourceLastMod()
Get the lastMod of the most recently saved resource that has had its changes assimilated into the meta view. If the meta view has not been configured by resource changes, this is set to Long.MIN_VALUE.

Returns:
The lastMod of the most recently saved resource that has had its changes assimilated into the meta view, or Long.MIN_VALUE if the meta view has not been configured by resource changes.

setLastSeenResourceLastMod

public void setLastSeenResourceLastMod(long lastSeenResourceLastMod)
Set the lastMod of the most recently saved resource that has had its changes assimilated into the meta view.

Parameters:
lastSeenResourceLastMod - The lastMod of the most recently saved resource that has had its changes assimilated into the meta view

getAttributesWithSource

public java.util.Set getAttributesWithSource(ObjectRef resourceRef,
                                             java.lang.String attrName)
Return a Set of the MetaViewAttributes that have a source with the given Resource ObjectRef and attribute.

Parameters:
resourceRef - The ObjectRef of the source resource.
attrName - The name of the source attribute.
Returns:
A non-null Set of the MetaViewAttributes that have a source with the given Resource ObjectRef and attribute.

getAttributesWithTarget

public java.util.Set getAttributesWithTarget(ObjectRef resourceRef,
                                             java.lang.String attrName)
Return a Set of the MetaViewAttributes that have a target with the given Resource ObjectRef and attribute.

Parameters:
resourceRef - The ObjectRef of the target resource.
attrName - The name of the target attribute.
Returns:
A non-null Set of the MetaViewAttributes that have a target with the given Resource ObjectRef and attribute.

isSourceAttribute

public boolean isSourceAttribute(Resource resource,
                                 java.lang.String attrName)
Return whether the attribute on the given resource is a source for this MetaView.

Parameters:
resource - The Resource on which the source lives.
attrName - The name of the source attribute.
Returns:
True if the attribute on the given resource is a source for this MetaView; false otherwise.

isTargetAttribute

public boolean isTargetAttribute(Resource resource,
                                 java.lang.String attrName)
Return whether the attribute on the given resource is a target for this MetaView - either explicitly or as a global target.

Parameters:
resource - The Resource on which the target lives.
attrName - The name of the target attribute.
Returns:
True if the attribute on the given resource is a target for this MetaView - either explicitly or as a global target; false otherwise.

isGlobalTargetAttribute

public boolean isGlobalTargetAttribute(java.lang.String attrName)
Return whether the given attribute is a global target.

Parameters:
attrName - The name of the target attribute.
Returns:
True if the given attribute is a global target; false otherwise.

getResponses

public java.util.List getResponses(MetaEvent.Type type,
                                   Resource resource)
Get a possibly-null list of MetaEventResponses configured when the given event type is detected on the given resource.

Parameters:
type - The type of event for which to retrieve the responses.
resource - The resource on which the event is detected and responded to.
Returns:
A list of MetaEventResponses configured when the given event type is detected on the given resource, or null if the given event type is not detected on the given resource or has no responses.

equals

public boolean equals(java.lang.Object o)
Description copied from class: PersistentObject
Compares two objects for equality of identity.

This method overrides the java.lang.Object equals method. It determines equality based on whether the two identities of the current object and the object argument are equal, where equal is defined as:

  1. The object argument is either an instance of a PersistentObject or an ObjectRef
  2. The types must match
  3. If both ids are not null, they must be the same
  4. If either or both ids are null, then the names must be the same

Note that this will makes it impossible to use the equals() method to do content comparison of two object copies. I'm not sure I really like this, its an unusual way to have equals() behave, but it is convenient for searching collections for references.

Overrides:
equals in class PersistentObject
Parameters:
o - - a PersistentObject or an ObjectRef

hashCode

public int hashCode()
Description copied from class: PersistentObject
Implement the hashCode for efficient map insertion

Overrides:
hashCode in class PersistentObject

getElementName

public java.lang.String getElementName()
Description copied from class: PersistentObject
Return the XML element name of this object. This is normally the same as the type name, but may be different for classes that support subtyping.

Specified by:
getElementName in interface XmlObject
Overrides:
getElementName in class PersistentObject

addSubclassAttributes

protected void addSubclassAttributes(java.lang.StringBuffer b)
Description copied from class: PersistentObject
Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist). PersistentObject's default implementation is a no-op.

NOTE: Any subclass that overrides this method must similarly override parseSubclassAttributes() so that the subclass attributes are restored.

Overrides:
addSubclassAttributes in class PersistentObject
See Also:


addSubclassElements

protected void addSubclassElements(java.lang.StringBuffer b)
Description copied from class: PersistentObject
Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist). PersistentObject's default implementation is a no-op.

NOTE: Any subclass that overrides this method must similarly override parseSubclassElements() so that the subclass elements are restored.

Overrides:
addSubclassElements in class PersistentObject
See Also:


parseSubclassAttributes

protected void parseSubclassAttributes(org.w3c.dom.Element e)
                                throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassAttributes in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)

parseSubclassElements

protected void parseSubclassElements(org.w3c.dom.Element e)
                              throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassElements in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)