com.metamatrix.metadata.runtime.model
Class BasicMetadataObject

java.lang.Object
  extended by com.metamatrix.metadata.runtime.model.BasicMetadataObject
All Implemented Interfaces:
MetadataObject, java.io.Serializable
Direct Known Subclasses:
BasicElement, BasicGroup, BasicKey, BasicModel, BasicProcedure, BasicVirtualDatabase

public abstract class BasicMetadataObject
extends java.lang.Object
implements MetadataObject, java.io.Serializable

This class represents the basic implementation of MetadataObject, which is the foundation for all classes that are used to capture metadata. This abstract class is immutable, although it is intended that subclasses are mutable. Additionally, although this class is thread safe, subclasses do not have to be thread safe, since the framework for update and modifying these objects must guarantee proper concurrent access.

These classes are shipped between the client and Metadata Service, so this class is serializable.

Also, the hashCode, equals and compareTo methods are all consistent and optimized for fast performance. This is in part accomplished by caching the hash code value which identifies quickly that two objects are not equal.

This class and all of its subclasses are designed to be publicly immutable. That is, no component outside of the Configuration Service changes these objects once they are created.

See Also:
Serialized Form

Constructor Summary
protected BasicMetadataObject(BasicVirtualDatabaseID virtualDBID)
          Call constructor to instantiate a BasicVirtualDatabase runtime object by passing the BasicVirtualDatabaseID.
protected BasicMetadataObject(MetadataID metadataID, BasicVirtualDatabaseID virtualDBID)
          Call constructor to instantiate a runtime object by passing the BasicRuntimeID that identifies the entity and the BasicVirtualDatabaseID that identifes the Virtual Database the object will be contained.
 
Method Summary
 void addProperty(java.lang.String name, java.lang.String value)
           
 java.lang.Object clone()
          Return a deep cloned instance of this object.
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 java.lang.String getAlias()
           
 java.util.Properties getCurrentProperties()
           
 java.lang.String getFullName()
          Returns the full name for this instance of the object.
 MetadataID getID()
          Get the ID for this metadata object.
 java.lang.String getName()
          Returns the name for this instance of the object.
 java.lang.String getNameInSource()
           
 java.lang.String getPath()
           
 java.util.Properties getProperties()
           
 VirtualDatabaseID getVirtualDatabaseID()
          returns the id for the Virtual Database for which this runtime object is contained within.
 int hashCode()
          Overrides Object hashCode method.
 boolean hasNameInSource()
          Returns whether the name-in-soure is defined for this element.
protected  void setID(MetadataID newID)
          Sets the id for this objects
 void setProperties(java.util.Properties definedProperties)
           
 java.lang.String toString()
          Returns a string representing the current state of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicMetadataObject

protected BasicMetadataObject(BasicVirtualDatabaseID virtualDBID)
Call constructor to instantiate a BasicVirtualDatabase runtime object by passing the BasicVirtualDatabaseID.

Parameters:
virtualDBID - the VirtualDatabaseID for this object (may not be null).
Throws:
java.lang.IllegalArgumentException - if either the ID or data source ID is null.

BasicMetadataObject

protected BasicMetadataObject(MetadataID metadataID,
                              BasicVirtualDatabaseID virtualDBID)
Call constructor to instantiate a runtime object by passing the BasicRuntimeID that identifies the entity and the BasicVirtualDatabaseID that identifes the Virtual Database the object will be contained.

Parameters:
metadataID - the MetadataID for this object (may not be null).
virtualDBID - the VirtualDatabaseID for this object (may not be null).
Throws:
java.lang.IllegalArgumentException - if either the ID or data source ID is null.
Method Detail

getVirtualDatabaseID

public VirtualDatabaseID getVirtualDatabaseID()
returns the id for the Virtual Database for which this runtime object is contained within. This method will be overridden by BasicVirtualDatabase so that it calls the super method getID to return as its VirtualDatabaseID.

Specified by:
getVirtualDatabaseID in interface MetadataObject

getNameInSource

public java.lang.String getNameInSource()

hasNameInSource

public boolean hasNameInSource()
Returns whether the name-in-soure is defined for this element.

Returns:
true if this element has the name in source; false otherwise.

getAlias

public java.lang.String getAlias()

getPath

public java.lang.String getPath()

getProperties

public java.util.Properties getProperties()
                                   throws VirtualDatabaseException
Specified by:
getProperties in interface MetadataObject
Throws:
VirtualDatabaseException

getCurrentProperties

public java.util.Properties getCurrentProperties()

setProperties

public void setProperties(java.util.Properties definedProperties)

getID

public MetadataID getID()
Get the ID for this metadata object. The ID can never change in an object, so it is an immutable field.

Specified by:
getID in interface MetadataObject
Returns:
the identifier for this metadata object.

getName

public java.lang.String getName()
Returns the name for this instance of the object. If you are using the dot notation for a naming conventions, this will return the last node in name.

Specified by:
getName in interface MetadataObject
Returns:
the name
See Also:
getFullName

getFullName

public java.lang.String getFullName()
Returns the full name for this instance of the object.

Specified by:
getFullName in interface MetadataObject
Returns:
the name

setID

protected void setID(MetadataID newID)
Sets the id for this objects

Parameters:
newID - is of type MetadataID

hashCode

public int hashCode()
Overrides Object hashCode method. Note that the hash code is computed purely from the ID, so two distinct instances that have the same identifier (i.e., full name) will have the same hash code value.

This hash code must be consistent with the equals method. defined by subclasses.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this metadata object.

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Specified by:
equals in interface MetadataObject
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

compareTo

public int compareTo(java.lang.Object obj)
Compares this object to another. If the specified object is an instance of the same class, then this method compares the name; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class). Note: this method is consistent with equals().

Specified by:
compareTo in interface MetadataObject
Parameters:
obj - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
Throws:
java.lang.IllegalArgumentException - if the specified object reference is null
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this instance.

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Specified by:
toString in interface MetadataObject
Overrides:
toString in class java.lang.Object
Returns:
the string representation of this instance.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Return a deep cloned instance of this object. Subclasses must override this method.

Specified by:
clone in interface MetadataObject
Overrides:
clone in class java.lang.Object
Returns:
the object that is the clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if this object cannot be cloned (i.e., only objects in Defaults cannot be cloned.

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)


Copyright © 2009. All Rights Reserved.