org.jdtaus.core.container
Class Specification

java.lang.Object
  extended by org.jdtaus.core.container.ModelObject
      extended by org.jdtaus.core.container.Specification
All Implemented Interfaces:
Serializable, Cloneable

public class Specification
extends ModelObject
implements Cloneable, Serializable

Specification meta-data.

A specification consists of the properties identifier, vendor, description and version. Property identifier holds an identifier uniquely identifying the specification in a set of specifications. Property vendor holds vendor information for the vendor providing the specification. Property description holds a textual description and property version holds a textual version of the specification. The stateless flag indicates that state does not need to be retained across operations for instances to operate as specified. Property multiplicity specifies the number of implementations allowed to exist among a set of modules. A specification with MULTIPLICITY_ONE specifies that exactly one implementation of the specification must exist among a set of modules. A specification with MULTIPLICITY_MANY specifies that multiple implementations of the specification are allowed to exist among a set of modules (including none). Property scope specifies the scope the specification applies to. In multiton scope, a new instance is created whenever requested. In context scope, instances are bound to a system's context. An instance is only created if not already available in context. In singleton scope, instances are bound to a system's single instance store. An instance is only created if not already available in that single instance store.

Version:
$Id: Specification.java 8044 2009-07-02 01:29:05Z schulte2005 $
Author:
Christian Schulte
See Also:
Serialized Form

Field Summary
static int MULTIPLICITY_MANY
          Constant for property multiplicity.
static int MULTIPLICITY_ONE
          Constant for property multiplicity.
static int SCOPE_CONTEXT
          Constant for property scope.
static int SCOPE_MULTITON
          Constant for property scope.
static int SCOPE_SINGLETON
          Constant for property scope.
 
Constructor Summary
Specification()
           
 
Method Summary
 Object clone()
          Creates and returns a copy of this object.
 boolean equals(Object o)
          Indicates whether some other object is equal to this one by comparing properties identifier and version.
 String getIdentifier()
          Gets the identifier of the specification.
 Implementation getImplementation(String name)
          Gets an implementation for a name.
 Implementations getImplementations()
          Gets all available implementations of the specification.
 String getModuleName()
          Gets the name of the module holding the specification.
 int getMultiplicity()
          Gets the implementation multiplicity of the specification.
 Properties getProperties()
          Gets the properties of the specification.
 int getScope()
          Gets the scope the specification applies to.
 String getVendor()
          Gets the vendor of the specification.
 String getVersion()
          Gets the version of the specification.
 int hashCode()
          Returns a hash code value for this object.
 boolean isStateless()
          Gets the flag indicating if state need not be retained across method invocations for implementations to operate as specified.
 void setIdentifier(String value)
          Setter for property identifier.
 void setImplementations(Implementations value)
          Setter for property implementations.
 void setModuleName(String value)
          Setter for property moduleName.
 void setMultiplicity(int value)
          Setter for property multiplicity.
 void setProperties(Properties value)
          Setter for property properties.
 void setScope(int value)
          Setter for property scope.
 void setStateless(boolean value)
          Setter for property stateless.
 void setVendor(String value)
          Setter for property vendor.
 void setVersion(String value)
          Setter for property version.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class org.jdtaus.core.container.ModelObject
getDocumentation, getModelVersion, setDocumentation, setModelVersion
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MULTIPLICITY_MANY

public static final int MULTIPLICITY_MANY
Constant for property multiplicity.

A specification with MULTIPLICITY_MANY specifies that multiple implementations of the specification are allowed to exist among a set of modules (including none).

See Also:
Constant Field Values

MULTIPLICITY_ONE

public static final int MULTIPLICITY_ONE
Constant for property multiplicity.

A specification with MULTIPLICITY_ONE specifies that exactly one implementation of the specification must exist among a set of modules.

See Also:
Constant Field Values

SCOPE_CONTEXT

public static final int SCOPE_CONTEXT
Constant for property scope.

In context scope, instances are bound to a system's context. An instance is only created if not already available in context.

See Also:
Constant Field Values

SCOPE_MULTITON

public static final int SCOPE_MULTITON
Constant for property scope.

In multiton scope, a new instance is created whenever requested.

See Also:
Constant Field Values

SCOPE_SINGLETON

public static final int SCOPE_SINGLETON
Constant for property scope.

In singleton scope, instances are bound to a system's single instance store. An instance is only created if not already available in that single instance store.

See Also:
Constant Field Values
Constructor Detail

Specification

public Specification()
Method Detail

clone

public Object clone()
Creates and returns a copy of this object. This method performs a "shallow copy" of this object, not a "deep copy" operation.

Overrides:
clone in class Object
Returns:
a clone of this instance.

equals

public final boolean equals(Object o)
Indicates whether some other object is equal to this one by comparing properties identifier and version.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as o; false otherwise.

getIdentifier

public String getIdentifier()
Gets the identifier of the specification.

Returns:
the unique identifier of the specification.

getImplementation

public Implementation getImplementation(String name)
Gets an implementation for a name.

Parameters:
name - the name of the implementation to return.
Returns:
a reference to the implementation named name.
Throws:
NullPointerException - if name is null.
MissingImplementationException - if no implementation matching name exists.

getImplementations

public Implementations getImplementations()
Gets all available implementations of the specification.

Returns:
all available implementations of the specification.

getModuleName

public String getModuleName()
Gets the name of the module holding the specification.

Returns:
the name of the module holding the specification.

getMultiplicity

public int getMultiplicity()
Gets the implementation multiplicity of the specification.

Returns:
one of the constants MULTIPLICITY_ONE or MULTIPLICITY_MANY.
See Also:
MULTIPLICITY_ONE, MULTIPLICITY_MANY, MultiplicityConstraintException

getProperties

public Properties getProperties()
Gets the properties of the specification.

Returns:
the properties of the specification.

getScope

public int getScope()
Gets the scope the specification applies to.

Returns:
scope the specification applies to.
See Also:
SCOPE_MULTITON, SCOPE_CONTEXT, SCOPE_SINGLETON, PropertyOverwriteConstraintException

getVendor

public String getVendor()
Gets the vendor of the specification.

Returns:
the vendor of the specification.

getVersion

public String getVersion()
Gets the version of the specification.

Returns:
the version of the specification or null.

hashCode

public final int hashCode()
Returns a hash code value for this object.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

isStateless

public boolean isStateless()
Gets the flag indicating if state need not be retained across method invocations for implementations to operate as specified.

Returns:
true if state need not be retained across method invocations for implementations to operate as specified; false if state must be retained across method invocations for implementations to operate as specified.

setIdentifier

public void setIdentifier(String value)
Setter for property identifier.

Parameters:
value - the new identifier of the specification.

setImplementations

public void setImplementations(Implementations value)
Setter for property implementations.

Parameters:
value - the new implementations of the specification.
Throws:
DuplicateImplementationException - if value contains duplicate implementations.
MultiplicityConstraintException - if the specification's multiplicity equals MULTIPLICITY_ONE and value contains no or more than one implementation.

setModuleName

public void setModuleName(String value)
Setter for property moduleName.

Parameters:
value - the new name of the module holding the specification.

setMultiplicity

public void setMultiplicity(int value)
Setter for property multiplicity.

Parameters:
value - the new implementation multiplicity of the specification.
Throws:
IllegalArgumentException - if value is not equal to one of the constants MULTIPLICITY_ONE or MULTIPLICITY_MANY.
MultiplicityConstraintException - if value equals MULTIPLICITY_ONE and the specification currently has more than one implementation defined.
See Also:
MULTIPLICITY_ONE, MULTIPLICITY_MANY

setProperties

public void setProperties(Properties value)
Setter for property properties.

Parameters:
value - new properties of the specification.

setScope

public void setScope(int value)
Setter for property scope.

Parameters:
value - new scope the specification applies to.
Throws:
IllegalArgumentException - if value is not equal to one of the constants SCOPE_MULTITON, SCOPE_CONTEXT or SCOPE_SINGLETON.
See Also:
SCOPE_MULTITON, SCOPE_CONTEXT, SCOPE_SINGLETON, PropertyOverwriteConstraintException

setStateless

public void setStateless(boolean value)
Setter for property stateless.

Parameters:
value - true if state need not be retained across method invocations for implementations to operate as specified; false if state must be retained across method invocations for implementations to operate as specified.

setVendor

public void setVendor(String value)
Setter for property vendor.

Parameters:
value - the new vendor of the specification.

setVersion

public void setVersion(String value)
Setter for property version.

Parameters:
value - the new version of the specification.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.


Copyright © 2005-2009 jDTAUS. All Rights Reserved.