Rio Project 4.2 API Documentation



org.rioproject.opstring
Class OpString

java.lang.Object
  extended by org.rioproject.opstring.OpString
All Implemented Interfaces:
Serializable, OperationalString

public class OpString
extends Object
implements OperationalString, Serializable

An implementation of an OperationalString

Author:
Dennis Reedy
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.rioproject.core.OperationalString
BROKEN, COMPROMISED, DEPLOYED, INTACT, SCHEDULED, UNDEPLOYED
 
Constructor Summary
OpString(String name, URL loadedFrom)
          Create an OpString
 
Method Summary
 void addOperationalString(OperationalString opString)
          Add included OperationalString to the OperationalString
 void addOperationalString(OperationalString[] opStrings)
          Add included OperationalString objects to the OperationalString
 void addService(ServiceElement sElem)
          Add a ServiceElement to the OperationalString.
 boolean containsNamedService(String serviceName)
          Check if a service with the provided name is included in the OperationalString
 boolean containsOperationalString(String opStringName)
          Check if an OperationalString with the provided name is included in the OperationalString
 boolean equals(Object obj)
          An OperationalString is equal to another OperationalString if their names are the same and they have they same ServiceElements
 String getName()
          All OperationalString instances have a descriptive name.
 ServiceElement getNamedService(String serviceName)
          Get the service with the provided name
 OperationalString getNestedOperationalString(String opStringName)
          Get the nested OperationalString with the provided name
 OperationalString[] getNestedOperationalStrings()
          An OperationalString may contain other OperationalString instances.
 Schedule getSchedule()
          Get the Schedule for the OperationalString Scheduling of an OperationalString is part of the OperationalString itself, the schedule is an optional declarative attribute, and if not declared the OperationalString will be deployed immediately.
 ServiceElement[] getServices()
          Get all services contained by this OperationalString as an array of ServiceElement objects
 int getStatus()
          Get the status of the OperationalString
 int hashCode()
          Override hashCode to return the hashCode of the name attribute
 URL loadedFrom()
          Get the location the OperationalString was loaded from.
 void removeService(ServiceElement sElem)
          Remove a ServiceElement from the OperationalString.
 void setDeployed(int deployed)
          Set the OperationalString as being scheduled, deployed or undeployed
 void setLoadedFrom(URL loadedFrom)
          Set the loaded from property
 void setName(String name)
          Set the name of the OperationalString
 void setSchedule(Schedule schedule)
          Sets the Schedule for this OperationalString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpString

public OpString(String name,
                URL loadedFrom)
Create an OpString

Parameters:
name - The name of the OperationalString, must not be null
loadedFrom - The URL where the OperationalString was loaded from. May be null
Method Detail

setDeployed

public void setDeployed(int deployed)
Description copied from interface: OperationalString
Set the OperationalString as being scheduled, deployed or undeployed

Specified by:
setDeployed in interface OperationalString
Parameters:
deployed - Either OperationalString.SCHEDULED, OperationalString.DEPLOYED or OperationalString.UNDEPLOYED
See Also:
OperationalString.setDeployed(int)

getStatus

public int getStatus()
Description copied from interface: OperationalString
Get the status of the OperationalString

Specified by:
getStatus in interface OperationalString
Returns:
The status of the OperationalString. If the OperationalString has not been scheduled or deployed the OperationalString status must always return OperationalString.UNDEPLOYED. If the OperationalString is OperationalString.DEPLOYED, then the status will represent the 'weakest link in the chain', that is if this OperationalString has nested OperationalString instances whose state is of lesser fidelity (lesser fidelity reflecting a OperationalString.BROKEN status, highest fidelity representing an OperationalString.INTACT state) then the status of this OperationalString must reflect the weakest status. If no nested OperationalString instances are found, or the OperationalString itself has a lesser fidelity then it's nested OperationalString instances, the status is determined by the inspecting ServiceElement instance availability
See Also:
OperationalString.getStatus()

setName

public void setName(String name)
Set the name of the OperationalString

Parameters:
name - The name of the OperationalString, must not be null. This will additionally set all ServiceElement instance OperationalString names as well

getName

public String getName()
Description copied from interface: OperationalString
All OperationalString instances have a descriptive name. This method is used to get the name of this OperationalString

Specified by:
getName in interface OperationalString
Returns:
The name of the OperationalString
See Also:
OperationalString.getName()

getServices

public ServiceElement[] getServices()
Description copied from interface: OperationalString
Get all services contained by this OperationalString as an array of ServiceElement objects

Specified by:
getServices in interface OperationalString
Returns:
An array of ServiceElement objects. If this OperationalString contains no services, this method will return a zero-length array
See Also:
OperationalString.getServices()

addService

public void addService(ServiceElement sElem)
Description copied from interface: OperationalString
Add a ServiceElement to the OperationalString.

Specified by:
addService in interface OperationalString
Parameters:
sElem - The ServiceElement to add
See Also:
OperationalString.addService(org.rioproject.core.ServiceElement)

removeService

public void removeService(ServiceElement sElem)
Description copied from interface: OperationalString
Remove a ServiceElement from the OperationalString.

Specified by:
removeService in interface OperationalString
Parameters:
sElem - The ServiceElement to remove
See Also:
OperationalString.removeService(org.rioproject.core.ServiceElement)

addOperationalString

public void addOperationalString(OperationalString[] opStrings)
Add included OperationalString objects to the OperationalString

Parameters:
opStrings - Array of OperationalString objects to add

addOperationalString

public void addOperationalString(OperationalString opString)
Add included OperationalString to the OperationalString

Parameters:
opString - OperationalString to add

getNestedOperationalStrings

public OperationalString[] getNestedOperationalStrings()
Description copied from interface: OperationalString
An OperationalString may contain other OperationalString instances. In this fashion OperationalString instances may be nested. This method returns an array of OperationalString objects that this OperationalString contains

Specified by:
getNestedOperationalStrings in interface OperationalString
Returns:
An array of OperationalString objects. If this OperationalString does not contain any other OperationalStrings, this method will return a zero-length array
See Also:
OperationalString.getNestedOperationalStrings()

hashCode

public int hashCode()
Override hashCode to return the hashCode of the name attribute

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
An OperationalString is equal to another OperationalString if their names are the same and they have they same ServiceElements

Overrides:
equals in class Object

containsNamedService

public boolean containsNamedService(String serviceName)
Check if a service with the provided name is included in the OperationalString

Parameters:
serviceName - The name of the service to check
Returns:
Return true if the serviceName is part of this OperationalString, false otherwise

getNamedService

public ServiceElement getNamedService(String serviceName)
Get the service with the provided name

Parameters:
serviceName - The name of the service to check
Returns:
Return the ServiceElement for the serviceName or null if not found

containsOperationalString

public boolean containsOperationalString(String opStringName)
Check if an OperationalString with the provided name is included in the OperationalString

Parameters:
opStringName - The name of the OperationalString to check
Returns:
Return true if the OperationalString is part of this OperationalString, false otherwise

getNestedOperationalString

public OperationalString getNestedOperationalString(String opStringName)
Get the nested OperationalString with the provided name

Parameters:
opStringName - The name of the OperationalString to check
Returns:
Return the OperationalString if found, otherwise return null

loadedFrom

public URL loadedFrom()
Description copied from interface: OperationalString
Get the location the OperationalString was loaded from.

Specified by:
loadedFrom in interface OperationalString
Returns:
The URL OperationalString was loaded from. The value may be null if the OperationalString was not loaded from a file or repository based mechanism
See Also:
OperationalString.loadedFrom()

setSchedule

public void setSchedule(Schedule schedule)
Sets the Schedule for this OperationalString

Parameters:
schedule - the Schedule for this OperationalString

getSchedule

public Schedule getSchedule()
Description copied from interface: OperationalString
Get the Schedule for the OperationalString

Scheduling of an OperationalString is part of the OperationalString itself, the schedule is an optional declarative attribute, and if not declared the OperationalString will be deployed immediately. The following properties describe the Schedule :

Declaring a Schedule
A Schedule can be declared in an OperationalString XML document as follows :

<DeploymentSchedule>
     <DeployDate DayOfWeek="Thursday" Hour="8" Minute="30" Format="PM"/>
     <Duration Minutes="30"/>
     <Repeats Count="10">
         <Interval Days="1" Hours="1" Minutes="1"/>
     </Repeats>
 </DeploymentSchedule>

This DeploymentSchedule produces the following:

Once the DeploymentSchedule element is parsed, a Schedule object is created and set to the enclosing OperationalString object.

Specified by:
getSchedule in interface OperationalString
Returns:
The Schedule for the OperationalString, providing context on declared start date, duration, repeat count and repeat interval
See Also:
OperationalString.getSchedule()

setLoadedFrom

public void setLoadedFrom(URL loadedFrom)
Set the loaded from property

Parameters:
loadedFrom - The URL the OperationalString was loaded from

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.