com.sas.entities
Class RemoteEntity

com.sas.entities.RemoteEntity
All Implemented Interfaces:
RemoteBaseEntityInterface, RemoteBaseEntityValueInterface, RemoteEntityInterface, com.sas.RemoteObjectInterface, java.io.Serializable, java.lang.Cloneable, java.rmi.Remote

public class RemoteEntity
implements RemoteEntityInterface, java.lang.Cloneable

RemoteEntity represents a possibly-remote implementation of RemoteEntityInterface.

See Also:
Entity, RemoteEntityInterface, Serialized Form

Field Summary
protected static java.util.ArrayList classLoaders
          List of classloaders
protected  java.util.Map dynamicSupplementalProperties
          Map of supplemental properties for dynamic (instance-based properties).
static java.lang.Object NO_SUCH_OBJECT
          Used for internal getAttribute(name, NO_SUCH_OBJECT) calls to detect no such object
static java.lang.Object NULL_OBJECT_WRAPPER
          A replacement for null for internally used JDK collections (Map) which do not handle null.
protected  java.util.Map supplementalProperties
          Map of supplemental properties.
protected  java.beans.VetoableChangeSupport vcs
          Instance of VetoableChangeSupport
 
Constructor Summary
RemoteEntity()
          Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key.
RemoteEntity(AttributeTypeFactoryInterface atfi)
          Constructs an instance of Entity with a unique GUID (Globally Unique Identifier) or entity key.
RemoteEntity(AttributeTypeFactoryInterface atfi, java.util.Map supplementalProperties)
          Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key.
RemoteEntity(int port, java.rmi.server.RMIClientSocketFactory clientFactory, java.rmi.server.RMIServerSocketFactory serverFactory)
          Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key.
RemoteEntity(java.util.Map supplementalProperties)
          Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key.
RemoteEntity(java.rmi.server.RMIClientSocketFactory clientFactory, java.rmi.server.RMIServerSocketFactory serverFactory)
          Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key.
 
Method Summary
 void addAttributeValidator(java.lang.String attributeName, java.beans.VetoableChangeListener listener)
          Convenience method for calling addVetoableChangeListener(String propertyName, VetoableChangeListener listener).
 void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
          Add a VetoableChangeListener for the attribute.
protected  void checkSetEntityKey()
          This method is called from setEntityKey before assigning a key.
 void clear()
          Clear ("unset") all attribute values.
 void clearAttribute(java.lang.String attributeName)
          Clear ("unset") an individual attribute.
 java.lang.Object clone()
          Create a new RemoteEntity object using the RemoteEntity's attributes.
 boolean containsAttributeNamed(java.lang.String attributeName)
          Test if this entity contains an attribute of a specified name.
 boolean equals(java.lang.Object o)
          Returns a boolean indicating whether the Entities are "equal".
 boolean equals(RemoteEntity p)
          Returns a boolean indicating whether the Entities are "equal".
 void fireVetoableChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Report a bound property update to any registered listeners.
 java.lang.Object getAttribute(java.lang.String attributeName)
          Get an attribute value from a entity.
 java.lang.Object getAttribute(java.lang.String attributeName, java.lang.Object defaultValue)
          Get a value of an attribute from the entity, or return a default value if it does not exist.
protected  java.lang.Object getAttribute(java.lang.String attributeName, java.lang.Object defaultValue, java.util.Map propertyDescriptors)
          Get an attribute value from the RemoteEntity or return the default value if it does not exist.
 int getAttributeCount()
          Returns the number of attributes defined.
 AttributeDescriptorInterface getAttributeDescriptor(java.lang.String attributeName)
          Returns an AttributeDescriptor
 AttributeDescriptorInterface[] getAttributeDescriptors()
          Returns an array of AttributeDescriptors
 AttributeGroupInterface getAttributeGroup()
          Return a list of attributes and their descriptions.
 java.util.Map getAttributes(java.util.Map query)
          Perform a bulk value get on this entity.
protected  java.util.Map getAttributes(java.util.Map query, java.util.Set propertyNames)
          Perform a bulk value get on the Entity.
 AttributeTypeInterface getAttributeType(java.lang.String attributeName)
          Returns the type of an attribute.
 java.util.Map getAttributeValidators()
          Return a map of attribute validators.
 AttributeDescriptorInterface[] getBooleanSpecifiedAttributeDescriptors(java.util.Map map)
          Returns an array of AttributeDescriptors that meet specified boolean attribute criteria.
 java.lang.String getCustomizer(java.lang.String contextNotYetImplementedThusIGNORED)
          Return this object's customizer.
 java.util.List getCustomizerContexts()
          Not currently implemented
 java.lang.Object getDelegate()
          Returns the map that holds the values of the instance-based attributes.
 java.lang.String getEntityKey()
          Return the Entity's unique key.
 java.util.Map getPropertyDescriptors()
          Returns a map of PropertyDescriptors.
protected  java.util.Map getPropertyDescriptors(java.lang.Class aClass)
          Returns a map of PropertyDescriptors.
 RemoteEntityInterface getPrototype()
          Get the prototype object from which the Entity inherits dynamic attributes from.
 java.lang.String getStringAttribute(java.lang.String attributeName, java.lang.String defaultValue)
          Get a string value of an attribute from an entity.
protected  void initialize()
          Called by constructors.
 java.lang.Object invokeGetter(java.lang.reflect.Method getter)
          Invokes the java.beans.PropertyDescriptor read method (specified in input parameter).
 boolean isAllRequiredAttributesAssigned()
          Returns true if all attributes, designated as required, have had a value assigned or the attribute has a default value.
 boolean isAttributeAssigned(java.lang.String attributeName)
          Returns true if an attribute has had a value assigned or the attribute has a default value.
 java.util.List listAllRequiredAttributesNotAssigned()
          Returns a list of AttributeDescriptor names where the AttributeDescriptor has been designated as required, but has not had a value assigned (a value has not been set through the setAttribute method and the AttributeDescriptor does not have a default value assigned).
 java.lang.String[] listAttributeNames()
          Return an array of the attribute names on this entity.
 java.lang.String[] listAttributeNames(boolean includeDynamicAttributes, boolean includeStaticAttributes)
          Return an array of the AttributeDescriptor names.
protected static java.lang.Object map(java.lang.Object o)
          Substitute the NULL_OBJECT_WRAPPER for null object references.
 void removeAllAttributes()
          Remove all attributes from this entity.
 void removeAttribute(java.lang.String attributeName)
          Remove an attribute from this entity if the attribute is an instance-based attribute.
 void removeAttributeValidator(java.lang.String attributeName, java.beans.VetoableChangeListener listener)
          Convenience method for calling removeVetoableChangeListener(String propertyName, VetoableChangeListener listener).
 void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
          Remove a VetoableChangeListener for the attribute.
 boolean sameEntity(EntityKeyInterface entity)
          Test if this Entity's key equals the entity key of another Entity.
protected  boolean setAttribute(java.lang.String attributeName, java.util.Map propertyDescriptors, java.lang.Object[] args)
          Set an attribute and its value.
 void setAttribute(java.lang.String attributeName, java.lang.Object value)
          Set an attribute and its value in this entity.
 void setAttributes(java.util.Map update)
          Perform a bulk attribute set on this entity.
protected  void setAttributes(java.util.Map query, java.util.Set entries, java.util.Map propertyDescriptors, java.lang.Object[] args)
          Perform a bulk attribute set.
 void setCustomizer(java.lang.String contextNotYetImplementedThusIGNORED, java.lang.String customizer)
          Set the customizer for a specific context.
 void setDynamicSupplementalPropertiesDefaultMap(java.util.Map dynamicSupplementalProperties)
          Sets the properties defined in the input map, dynamicSupplementalProperties, on all AttributeDescriptors associated with dynamic (instanced-based) attributes.
 void setEntityKey(java.lang.String key)
          Assign this entity's key or GUID (Globally Unique Identifier).
 void setPrototype(RemoteEntityInterface prototype)
          Set the prototype object from which the Entity inherits dynamic attributes from.
 java.lang.String toString()
          Returns the string representation of the Entity.
protected static java.lang.Object unmap(java.lang.Object o)
          The inverse of the map(Object) call.
protected  boolean verifyAttributeType(java.lang.String attributeName, java.lang.Object[] args)
          Returns a boolean indicating whether the value is valid for the attribute based on the AttributeType of the attribute.
 

Field Detail

supplementalProperties

protected java.util.Map supplementalProperties
Map of supplemental properties. A supplemental property is a user-defined property that does not currently exist for the AttributeDescriptor.


dynamicSupplementalProperties

protected java.util.Map dynamicSupplementalProperties
Map of supplemental properties for dynamic (instance-based properties). A supplemental property is a user-defined property that does not currently exist for the AttributeDescriptor.


vcs

protected java.beans.VetoableChangeSupport vcs
Instance of VetoableChangeSupport


classLoaders

protected static java.util.ArrayList classLoaders
List of classloaders


NULL_OBJECT_WRAPPER

public static final java.lang.Object NULL_OBJECT_WRAPPER
A replacement for null for internally used JDK collections (Map) which do not handle null.

See Also:
map(Object), unmap(Object)

NO_SUCH_OBJECT

public static final java.lang.Object NO_SUCH_OBJECT
Used for internal getAttribute(name, NO_SUCH_OBJECT) calls to detect no such object

Constructor Detail

RemoteEntity

public RemoteEntity()
             throws java.rmi.RemoteException
Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true.

Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

RemoteEntity

public RemoteEntity(java.util.Map supplementalProperties)
             throws java.rmi.RemoteException
Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true. Sets the properties defined in the input map, supplementalProperties, on all AttributeDescriptors associated with static (type-based) attributes.

Parameters:
supplementalProperties - name/value pairs of supplemental properties
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

RemoteEntity

public RemoteEntity(AttributeTypeFactoryInterface atfi)
             throws java.rmi.RemoteException
Constructs an instance of Entity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true. Uses the input AttributeTypeFactory, atfi, for creating AttributeTypes for the AttributeDescriptors.

Parameters:
atfi - instance of AttributeTypeFactoryInterface
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

RemoteEntity

public RemoteEntity(AttributeTypeFactoryInterface atfi,
                    java.util.Map supplementalProperties)
             throws java.rmi.RemoteException
Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true. Sets the properties defined in the input map, supplementalProperties, on all AttributeDescriptors associated with static (type-based) attributes. Uses the input AttributeTypeFactory, atfi, for creating AttributeTypes for the AttributeDescriptors.

Parameters:
supplementalProperties - name/value pairs of supplemental properties
atfi - instance of AttributeTypeFactoryInterface
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

RemoteEntity

public RemoteEntity(java.rmi.server.RMIClientSocketFactory clientFactory,
                    java.rmi.server.RMIServerSocketFactory serverFactory)
             throws java.rmi.RemoteException
Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true. Exports the remote object on an anonymous port using the specified socket factories.

Parameters:
RMIClientSocketFactory - instance of RMIClientSocketFactory used by the RMI runtime in order to obtain client sockets for RMI calls
RMIServerSocketFactory - instance of RMIServerSocketFactory used by the RMI runtime in order to obtain server sockets for RMI calls
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

RemoteEntity

public RemoteEntity(int port,
                    java.rmi.server.RMIClientSocketFactory clientFactory,
                    java.rmi.server.RMIServerSocketFactory serverFactory)
             throws java.rmi.RemoteException
Constructs an instance of RemoteEntity with a unique GUID (Globally Unique Identifier) or entity key. Creates an AttributeGroup and sets the property parameter for all AttributeDescriptors associated with static (type-based) attributes to true. Exports the remote object on the specified port using the specified socket factories.

Parameters:
port - port number
RMIClientSocketFactory - instance of RMIClientSocketFactory used by the RMI runtime in order to obtain client sockets for RMI calls
RMIServerSocketFactory - instance of RMIServerSocketFactory RMI used used by the RMI runtime in order to obtain server sockets for RMI calls
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity
Method Detail

initialize

protected void initialize()
                   throws java.rmi.RemoteException
Called by constructors. Performs the actual work of creating the AttributeGroup, setting supplemental properties on AttributeDescriptors (if applicable), and assigning AttributeTypes using an instance of AttributeTypeFactory.

Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

getEntityKey

public java.lang.String getEntityKey()
                              throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Return the Entity's unique key.

Specified by:
getEntityKey in interface RemoteEntityInterface
Returns:
unique key.
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

setEntityKey

public void setEntityKey(java.lang.String key)
                  throws java.rmi.RemoteException,
                         java.lang.IllegalStateException
Assign this entity's key or GUID (Globally Unique Identifier).

Specified by:
setEntityKey in interface RemoteEntityInterface
Parameters:
guid - a unique entity key also known as a globally unique identifer (GUID)
Throws:
java.lang.IllegalStateException - subclasses may throw an IllegalStateException if this Entity already has a GUID although this base class method does not
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

checkSetEntityKey

protected void checkSetEntityKey()
                          throws java.rmi.RemoteException,
                                 java.lang.IllegalStateException
This method is called from setEntityKey before assigning a key. This implementation throws an IllegalStateException if getEntityKey() is not null. Subclasses can override this method to allow reassignment of an entity key.

Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity
java.lang.IllegalStateException - if the entity already has a non-null key. Not all entity implementations are required to throw this exception; some may allow replacing a non-null key.

sameEntity

public boolean sameEntity(EntityKeyInterface entity)
                   throws java.rmi.RemoteException
Test if this Entity's key equals the entity key of another Entity.

Specified by:
sameEntity in interface RemoteEntityInterface
Returns:
true if the other entity's key is the same as getEntityKey(). Return false if entity is null
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

removeAttribute

public void removeAttribute(java.lang.String attributeName)
                     throws java.rmi.RemoteException
Description copied from interface: RemoteBaseEntityInterface
Remove an attribute from this entity if the attribute is an instance-based attribute. You cannot remove type-based attributes from entities. After removing an instance-based attribute, containsAttributeNamed(String attributeName) will return false and getAttribute(String attributeName) will throw a NoSuchElementException

Specified by:
removeAttribute in interface RemoteBaseEntityInterface
Parameters:
attributeName - the name of the attribute
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

removeAllAttributes

public void removeAllAttributes()
                         throws java.rmi.RemoteException
Description copied from interface: RemoteBaseEntityInterface
Remove all attributes from this entity.

Specified by:
removeAllAttributes in interface RemoteBaseEntityInterface
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName)
                              throws java.rmi.RemoteException,
                                     java.util.NoSuchElementException
Description copied from interface: RemoteBaseEntityValueInterface
Get an attribute value from a entity.

Specified by:
getAttribute in interface RemoteBaseEntityValueInterface
Parameters:
attributeName - the name of the value.
Returns:
the object associated with the attributeName
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity
java.util.NoSuchElementException - if there is no such value in this entity. (this is necessary to distinguish between no such attributeName and a value of null.)

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName,
                                     java.lang.Object defaultValue)
Description copied from interface: RemoteBaseEntityInterface
Get a value of an attribute from the entity, or return a default value if it does not exist.

Specified by:
getAttribute in interface RemoteBaseEntityInterface
Parameters:
attributeName - the name of the value.
defaultValue - a default value to return if the named attribute does not exist in this entity.
Returns:
the object associated with the attributeName, or defaultValue if the entity does not contain an element for the specified attributeName.

getAttribute

protected java.lang.Object getAttribute(java.lang.String attributeName,
                                        java.lang.Object defaultValue,
                                        java.util.Map propertyDescriptors)
Get an attribute value from the RemoteEntity or return the default value if it does not exist.

Parameters:
attributeName - the name of the attribute
defaultValue - a default value to return if the named attribute does not exist in the RemoteEntity
propertyDescriptors - a map containing the Java properties associated with this RemoteEntity. This map is used to determine whether the attribute is associated with a java property. If so, then the read method associated with the property is actually invoked to obtain the value of the attribute.
Returns:
the object associated with the attributeName or the defaultValue if the RemoteEntity does not contain an element for the specified attributeName
Throws:
java.util.NoSuchElementException - if there is no such value in this RemoteEntity (this is necessary to distinguish between no such attributeName and a value of null)

invokeGetter

public java.lang.Object invokeGetter(java.lang.reflect.Method getter)
Invokes the java.beans.PropertyDescriptor read method (specified in input parameter). This method is not intended for public use.

Parameters:
getter - java.beans.PropertyDescriptor read method
Returns:
object obtained by invoking the read method

getAttributes

public java.util.Map getAttributes(java.util.Map query)
Description copied from interface: RemoteBaseEntityInterface
Perform a bulk value get on this entity. This gets each attribute named in the query map

Specified by:
getAttributes in interface RemoteBaseEntityInterface
Parameters:
query - a set of name/value pairs. This object is updated if the operation is performed locally.
Returns:
a map with names from the query and the values taken from this entity.

getAttributes

protected java.util.Map getAttributes(java.util.Map query,
                                      java.util.Set propertyNames)
Perform a bulk value get on the Entity. This gets each attribute named in the query map

Parameters:
query - a set of name/value pairs. This object is updated if the operation is performed locally.
propertyNames - set of propertyNames obtained by performing a keySet() operation
Returns:
a map with names from the query and the values taken from this entity

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String attributeName,
                                           java.lang.String defaultValue)
                                    throws java.rmi.RemoteException
Description copied from interface: RemoteBaseEntityInterface
Get a string value of an attribute from an entity. This method is an alias for (String) getAttribute(String attributeName).

Specified by:
getStringAttribute in interface RemoteBaseEntityInterface
Parameters:
attributeName - the name of the value.
defaultValue - a default value to return if the named value does not exist in this entity.
Returns:
the object associated with the attributeName, or the defaultValue if the entity does not contain an element for the specified attributeName.
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getCustomizer

public java.lang.String getCustomizer(java.lang.String contextNotYetImplementedThusIGNORED)
Description copied from interface: RemoteEntityInterface
Return this object's customizer. A customizer is a standalone editor used to customize or edit a value. It does not reside inside a UI (User Interface) element as an editor does, but defines its own window. If none exists on the Entity, the customizer of the AttributeType is returned. The context indicates how you would like the editor expressed, in the same form as the validator context.

Specified by:
getCustomizer in interface RemoteEntityInterface
Parameters:
contextNotYetImplementedThusIGNORED - the context, such as a Java, COM, or WEB context
Returns:
Entity customizer
See Also:
EntityContextInterface

getCustomizerContexts

public java.util.List getCustomizerContexts()
Not currently implemented

Specified by:
getCustomizerContexts in interface RemoteEntityInterface
Returns:
list of contexts

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.Object value)
                  throws AttributeSetException,
                         java.rmi.RemoteException
Description copied from interface: RemoteBaseEntityValueInterface
Set an attribute and its value in this entity.

Specified by:
setAttribute in interface RemoteBaseEntityValueInterface
Parameters:
attributeName - the name of the attribute.
value - the value to associate with the value name. Attribute values may be null.
Throws:
AttributeSetException - if the AttributeType of the parameter, value, is not compatible with a previous setting of the attribute OR the attribute corresponding to the parameter, attributeName, has been designated as non-modifiable
java.rmi.RemoteException - if there was an IO error communicating with the Entity

setAttribute

protected boolean setAttribute(java.lang.String attributeName,
                               java.util.Map propertyDescriptors,
                               java.lang.Object[] args)
                        throws AttributeSetException,
                               java.rmi.RemoteException
Set an attribute and its value.

Parameters:
attributeName - the name of the attribute
propertyDescriptors - a map containing the Java properties associated with the entity. This map is used to determine whether the attribute is associated with a java property. If so, then the write method associated with the property is used to set the attribute value.
args - the value to associate with the attribute. Attribute values may be null.
Throws:
AttributeSetException - if the attribute corresponding to the parameter, attributeName, has been designated as non-modifiable
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

setAttributes

public void setAttributes(java.util.Map update)
                   throws AttributeSetException,
                          java.rmi.RemoteException
Description copied from interface: RemoteBaseEntityInterface
Perform a bulk attribute set on this entity. This sets each attribute named in the update map

Specified by:
setAttributes in interface RemoteBaseEntityInterface
Parameters:
update - a set of name/value pairs to assign to the attributes of this entity
Throws:
AttributeSetException - if the AttributeType of a parameter is not compatible with a previous setting of the attribute OR an attribute has been designated as non-modifiable
java.rmi.RemoteException - if there was an IO error communicating with the Entity

setAttributes

protected void setAttributes(java.util.Map query,
                             java.util.Set entries,
                             java.util.Map propertyDescriptors,
                             java.lang.Object[] args)
                      throws AttributeSetException,
                             java.rmi.RemoteException
Perform a bulk attribute set. This sets each attribute named in the map.

Parameters:
query - a set of name/value pairs to assign to the attributes
entries - collection of name/value pairs (attribute name/value)
propertyDescriptors - a map containing the Java properties associated with the entity. This map is used to determine whether the attribute is associated with a java property. If so, then the write method associated with the property is used to set the attribute value.
args - the values to set for the attributes
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity
AttributeSetException - if any of the attributes have been designated as non-modifiable

setCustomizer

public void setCustomizer(java.lang.String contextNotYetImplementedThusIGNORED,
                          java.lang.String customizer)
Description copied from interface: RemoteEntityInterface
Set the customizer for a specific context.

Specified by:
setCustomizer in interface RemoteEntityInterface
Parameters:
contextNotYetImplementedThusIGNORED - the context, such as a Java, COM, or WEB context
customizer - the name of the customizer
See Also:
EntityContextInterface

getPropertyDescriptors

public java.util.Map getPropertyDescriptors()
Returns a map of PropertyDescriptors.

Returns:
map of PropertyDescriptors

getPropertyDescriptors

protected java.util.Map getPropertyDescriptors(java.lang.Class aClass)
Returns a map of PropertyDescriptors.

Parameters:
aClass - class to obtain PropertyDescriptors for
Returns:
map of PropertyDescriptors

containsAttributeNamed

public boolean containsAttributeNamed(java.lang.String attributeName)
Description copied from interface: RemoteBaseEntityInterface
Test if this entity contains an attribute of a specified name.

Specified by:
containsAttributeNamed in interface RemoteBaseEntityInterface
Parameters:
attributeName - the attribute name to test
Returns:
true if this entity contains an attribute named name

getAttributeCount

public int getAttributeCount()
Returns the number of attributes defined.

Returns:
number of attributes

listAttributeNames

public java.lang.String[] listAttributeNames()
Description copied from interface: RemoteBaseEntityInterface
Return an array of the attribute names on this entity.

Specified by:
listAttributeNames in interface RemoteBaseEntityInterface

listAttributeNames

public java.lang.String[] listAttributeNames(boolean includeDynamicAttributes,
                                             boolean includeStaticAttributes)
Return an array of the AttributeDescriptor names. The boolean parameter, includeDynamicAttributes, indicates whether to include only those dynamic (instance-based) attributes that have been explicitly created through the setAttribute(String attributeName, Object value) method. If set to true, this method will return the name of any AttributeDescriptor that meets either of the following:

If set to false, this method will return the names of only those attributes that have been explicitly created through the setAttribute(String attributeName, Object value) method.

The boolean parameter, includeStaticAttributes, indicates whether to include static (type-based) attributes. If set to true, this method will return the name of any AttributeDescriptor that corresponds to a type-based attribute. If set to false, this method will not return any type-based attribute names.

Parameters:
includeDynamicAttributes - indicates whether to include instance-based attributes that have not been explicitly created
includeStaticDescriptors - indicates whether to include type-based attributes
Returns:
array of attribute names
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a new RemoteEntity object using the RemoteEntity's attributes.

Overrides:
clone in class java.rmi.server.UnicastRemoteObject
Returns:
new RemoteEntity that will have the same attributes as the RemoteEntity
Throws:
java.lang.CloneNotSupportedException - if the Entity does not support the Cloneable interface

equals

public boolean equals(RemoteEntity p)
Returns a boolean indicating whether the Entities are "equal". The Entities are considered equal if they have the same number of attributes and all of the attribute values are the same.

Parameters:
p - the RemoteEntity to compare
Returns:
true if the Entities have the same attributes, false otherwise

equals

public boolean equals(java.lang.Object o)
Returns a boolean indicating whether the Entities are "equal". The Entities are considered equal if the input parameter is a RemoteEntity, they have the same number of attributes, and all of the attribute values are the same.

Overrides:
equals in class java.rmi.server.RemoteObject
Parameters:
o - the object to compare
Returns:
true if the Entities have the same attributes, false otherwise

toString

public java.lang.String toString()
Returns the string representation of the Entity. The string representation is a concatentation of the class name, identityHashCode, and the string representation of the map that holds the values of the instance-based attributes.

Overrides:
toString in class java.rmi.server.RemoteObject
Returns:
string representation of the Entity

getDelegate

public java.lang.Object getDelegate()
Returns the map that holds the values of the instance-based attributes.

Returns:
name-value pairs (attribute name/attribute value)

addAttributeValidator

public void addAttributeValidator(java.lang.String attributeName,
                                  java.beans.VetoableChangeListener listener)
Convenience method for calling addVetoableChangeListener(String propertyName, VetoableChangeListener listener).

Specified by:
addAttributeValidator in interface RemoteEntityInterface
Parameters:
attributeName - name of the attribute
listener - object that implements VetoableChangeListener

removeAttributeValidator

public void removeAttributeValidator(java.lang.String attributeName,
                                     java.beans.VetoableChangeListener listener)
Convenience method for calling removeVetoableChangeListener(String propertyName, VetoableChangeListener listener).

Specified by:
removeAttributeValidator in interface RemoteEntityInterface
See Also:
RemoteEntityInterface.addAttributeValidator(String, VetoableChangeListener)

getAttributeValidators

public java.util.Map getAttributeValidators()
                                     throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Return a map of attribute validators. The map keys are attribute names. The map values are either a single VetoableChangeListener or a List of VetoableChangeListener listeners.

Specified by:
getAttributeValidators in interface RemoteEntityInterface
Returns:
attribute validators
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getAttributeGroup

public AttributeGroupInterface getAttributeGroup()
                                          throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Return a list of attributes and their descriptions.

Specified by:
getAttributeGroup in interface RemoteEntityInterface
Returns:
an AttributeGroupInterface from which you can access each attribute by name or get them all as an array. AttributeGroupInterface provides a structured, hierarchical grouping of an Entity's attributes.
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getPrototype

public RemoteEntityInterface getPrototype()
Description copied from interface: RemoteEntityInterface
Get the prototype object from which the Entity inherits dynamic attributes from. Any attribute requests made to this object which do not exist on the Entity are delegated to the prototype.

Specified by:
getPrototype in interface RemoteEntityInterface
Returns:
prototype object

setPrototype

public void setPrototype(RemoteEntityInterface prototype)
Description copied from interface: RemoteEntityInterface
Set the prototype object from which the Entity inherits dynamic attributes from. If a prototype already exists, it is discarded. The new prototype may be null.

Specified by:
setPrototype in interface RemoteEntityInterface
Parameters:
prototype - object from which the Entity inherits dynamic attributes from

getAttributeType

public AttributeTypeInterface getAttributeType(java.lang.String attributeName)
                                        throws java.rmi.RemoteException,
                                               java.util.NoSuchElementException
Description copied from interface: RemoteEntityInterface
Returns the type of an attribute.

Specified by:
getAttributeType in interface RemoteEntityInterface
Parameters:
attributeName - attribute name
Returns:
type information for an attribute
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity
java.util.NoSuchElementException - if there is no such value in the Entity (this is necessary to distinguish between no such attributeName and a value of null)
See Also:
AttributeTypeInterface

getAttributeDescriptors

public AttributeDescriptorInterface[] getAttributeDescriptors()
                                                       throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Returns an array of AttributeDescriptors

Specified by:
getAttributeDescriptors in interface RemoteEntityInterface
Returns:
array of AttributeDescriptors
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getAttributeDescriptor

public AttributeDescriptorInterface getAttributeDescriptor(java.lang.String attributeName)
                                                    throws java.rmi.RemoteException,
                                                           java.util.NoSuchElementException
Description copied from interface: RemoteEntityInterface
Returns an AttributeDescriptor

Specified by:
getAttributeDescriptor in interface RemoteEntityInterface
Returns:
AttributeDescriptor
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity
java.util.NoSuchElementException - if there is no such value in this entity (this is necessary to distinguish between no such attributeName and a value of null)

isAttributeAssigned

public boolean isAttributeAssigned(java.lang.String attributeName)
                            throws java.rmi.RemoteException,
                                   java.util.NoSuchElementException
Description copied from interface: RemoteEntityInterface
Returns true if an attribute has had a value assigned or the attribute has a default value.

Specified by:
isAttributeAssigned in interface RemoteEntityInterface
Returns:
true if attribute has had value assigned or default value; false otherwise
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity
java.util.NoSuchElementException - if there is no such value in the Entity (this is necessary to distinguish between no such attributeName and a value of null)

isAllRequiredAttributesAssigned

public boolean isAllRequiredAttributesAssigned()
                                        throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Returns true if all attributes, designated as required, have had a value assigned or the attribute has a default value.

Specified by:
isAllRequiredAttributesAssigned in interface RemoteEntityInterface
Returns:
true if required attributes have had a value assigned or default value; false otherwise
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

listAllRequiredAttributesNotAssigned

public java.util.List listAllRequiredAttributesNotAssigned()
                                                    throws java.rmi.RemoteException
Returns a list of AttributeDescriptor names where the AttributeDescriptor has been designated as required, but has not had a value assigned (a value has not been set through the setAttribute method and the AttributeDescriptor does not have a default value assigned).

Returns:
list of AttributeDescriptor names that do not have values
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity

clear

public void clear()
           throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Clear ("unset") all attribute values. Attributes would inherit their default values.

Specified by:
clear in interface RemoteEntityInterface
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

clearAttribute

public void clearAttribute(java.lang.String attributeName)
                    throws java.rmi.RemoteException
Description copied from interface: RemoteEntityInterface
Clear ("unset") an individual attribute. The attribute would inherit its default value.

Specified by:
clearAttribute in interface RemoteEntityInterface
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity

getBooleanSpecifiedAttributeDescriptors

public AttributeDescriptorInterface[] getBooleanSpecifiedAttributeDescriptors(java.util.Map map)
                                                                       throws java.rmi.RemoteException,
                                                                              java.lang.NoSuchMethodException
Description copied from interface: RemoteEntityInterface
Returns an array of AttributeDescriptors that meet specified boolean attribute criteria. This method is intended to be used to retrieve only those AttributeDescriptors that have a specified value for a particular boolean attribute. The following example will retrieve only those AttributeDescriptors with isModifiable set to false and isVisible set to true:
 HashMap map = new HashMap();
 map.put(AttributeDescriptorInterface.MODIFIABLE,Boolean.FALSE);
 map.put(AttributeDescriptorInterface.VISIBLE,Boolean.TRUE);
 try {
     RemoteEntity rentity = new RemoteEntity();
     AttributeDescriptorInterface[] adi = rentity.getBooleanSpecifiedAttributeDescriptors(map);
 }
 catch(NoSuchMethodException e) {}
 

Specified by:
getBooleanSpecifiedAttributeDescriptors in interface RemoteEntityInterface
Parameters:
map - set of name/value pairs consisting of attribute/value
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the Entity
java.lang.NoSuchMethodException - if method does not exist on the AttributeDescriptorInterface
See Also:
AttributeDescriptorInterface

map

protected static java.lang.Object map(java.lang.Object o)
Substitute the NULL_OBJECT_WRAPPER for null object references. Implementation classes which use other objects that do not handle null references should use map(Object) to change null references to a fixed non-null reference (BaseCollection.NULL_OBJECT_WRAPPER) before storing items in the underlying object. For example, Dictionary uses a Hashtable which does not allow null keys, so Dictionary runs all keys through map(key). The mapped value can then be translated back to null via the unmap(Object) method.

Parameters:
o - an object.
Returns:
NULL_OBJECT_WRAPPER if o == null, else o
See Also:
unmap(java.lang.Object), NULL_OBJECT_WRAPPER

unmap

protected static java.lang.Object unmap(java.lang.Object o)
The inverse of the map(Object) call.

Parameters:
o - an object in a collection (possibly the NULL_OBJECT_WRAPPER )
Returns:
null if o is the NULL_OBJECT_WRAPPER, else the object o
See Also:
NULL_OBJECT_WRAPPER, map(Object)

addVetoableChangeListener

public void addVetoableChangeListener(java.lang.String propertyName,
                                      java.beans.VetoableChangeListener listener)
Add a VetoableChangeListener for the attribute.

Parameters:
propertyName - name of the attribute
listener - instance of VetoableChangeListener

removeVetoableChangeListener

public void removeVetoableChangeListener(java.lang.String propertyName,
                                         java.beans.VetoableChangeListener listener)
Remove a VetoableChangeListener for the attribute.

Parameters:
propertyName - name of the attribute
listener - instance of VetoableChangeListener

fireVetoableChange

public void fireVetoableChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.

Parameters:
propertyName - name of the attribute that was changed
oldValue - old value of the attribute
newValue - new value of the attribute

verifyAttributeType

protected boolean verifyAttributeType(java.lang.String attributeName,
                                      java.lang.Object[] args)
                               throws AttributeSetException,
                                      java.rmi.RemoteException
Returns a boolean indicating whether the value is valid for the attribute based on the AttributeType of the attribute.

Parameters:
attributeName - name of the attribute
args[0] - value to be validated
Returns:
true if value is valid, throws AttributeSetException otherwise
Throws:
java.rmi.RemoteException - if there was an IO error communicating with the RemoteEntity
AttributeSetException - thrown for the following conditions:
 
 
  • AttributeType is null
  • AttributeType does not have a valid sql type
  • value is not valid for the AttributeType

  • setDynamicSupplementalPropertiesDefaultMap

    public void setDynamicSupplementalPropertiesDefaultMap(java.util.Map dynamicSupplementalProperties)
    Sets the properties defined in the input map, dynamicSupplementalProperties, on all AttributeDescriptors associated with dynamic (instanced-based) attributes. NOTE: This method needs to be invoked before actually issuing the setAttribute method.

    Parameters:
    dynamicSupplementalProperties - name/value pairs of supplemental properties



    Copyright © 2009 SAS Institute Inc. All Rights Reserved.