Openwings API Documentation (v1.1)

net.openwings.context
Interface Context


public interface Context

This interface provides the key abstraction for Context Services. A Context describes a service interface that can be accessed in a distributed environment. Contexts are used to set system boundaries, system properties, system policies, and manage essential system services. Note that this interface contains a removeContext, but no addContext. Adding a context is actually achieved by starting a new context service process.


Method Summary
 boolean addPlatform(UniqueID platform, java.lang.String name, boolean clusterHint)
          This method is used to add a platform to the context.
 void addPlatformListener(PlatformListener platformListener)
          This method is used to add a listener that is notified when platforms are added to the context or deleted from the Context.
 void addPolicyListener(PolicyListener policyListener)
          This method is used to add a listener that is notified when policies are added, changed, or deleted in a context.
 void addPropertyListener(PropertyListener propertyListener)
          This method is used to add a listener that is notified when properties are added, changed, or deleted in a Context.
 void addRelationship(UniqueID context, java.lang.String name)
          This method is used to add relationships between this context and another.
 void addRelationshipListener(RelationshipListener relationshipListener)
          This method is used to add a listener that is notified when context relationships are added or removed.
 net.openwings.cluster.ClusterDescriptor getCluster()
          This method returns the cluster descriptor of the context cluster.
 UniqueID getID()
          This method is returns the unique identifier for the context.
 java.lang.String getName()
          This method is returns the name of the context.
 PlatformDescriptor[] getPlatforms()
          This method is used to get all of the platforms for the context.
 Policy[] getPolicies()
          This method is used to get all of the policies for the context
 Policy getPolicy(java.lang.String key)
          This method is used to get a policy from the context.
 java.lang.String[] getPolicyKeys()
          This method is used to get all of the policy keys for the context.
 java.util.Properties getProperties()
          This method is used to get all of the properties for this context.
 java.lang.String getProperty(java.lang.String key)
          This method is used to get a property from the context.
 ContextDescriptor[] getRelationships()
          This method returns the relationships this context currently has.
 void removeContext()
          This method is used to remove / destroy this context.
 void removePlatform(UniqueID platform, java.lang.String name)
          This method is used to remove a platform from a context.
 void removePlatformListener(PlatformListener platformListener)
          This method is used to remove a listener that is notified when platforms are added to the context or deleted from the Context.
 Policy removePolicy(java.lang.String key)
          This method is used to remove a policy from the context.
 void removePolicyListener(PolicyListener policyListener)
          This method is used to remove a listener that is notified when policies are added, changed, or deleted in a context.
 java.lang.String removeProperty(java.lang.String key)
          This method is used to remove a property from the context.
 void removePropertyListener(PropertyListener propertyListener)
          This method is used to remove a listener that is notified when properties are added, changed, or deleted in a Context.
 void removeRelationship(UniqueID context, java.lang.String name)
          This method is used to remove a relationship between this context and another.
 void removeRelationshipListener(RelationshipListener relationshipListener)
          This method is used to remove a listener that is notified when context relationships are added or removed.
 Policy setPolicy(java.lang.String key, Policy policy)
          This method is used to set a policy for the context.
 java.lang.String setProperty(java.lang.String key, java.lang.String value)
          This method is used to set a property for the context.
 

Method Detail

getID

public UniqueID getID()
               throws java.rmi.RemoteException
This method is returns the unique identifier for the context. The identifier for the context is created when the context is first executed and persists across runs of the context until it is removed.

Returns:
unique identifier for of this context
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getName

public java.lang.String getName()
                         throws java.rmi.RemoteException
This method is returns the name of the context. The name is provided for readability. The UniqueID is really the primary identifier of the context.

Returns:
The name of the context.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getCluster

public net.openwings.cluster.ClusterDescriptor getCluster()
                                                   throws java.rmi.RemoteException
This method returns the cluster descriptor of the context cluster.

Returns:
the ClusterDescriptor or null if clustering is not supported by this context.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getProperties

public java.util.Properties getProperties()
                                   throws java.rmi.RemoteException
This method is used to get all of the properties for this context.

Returns:
all the properties for this context.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getProperty

public java.lang.String getProperty(java.lang.String key)
                             throws java.rmi.RemoteException
This method is used to get a property from the context.

Parameters:
key - This is the key for this property.
Returns:
the property value.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

setProperty

public java.lang.String setProperty(java.lang.String key,
                                    java.lang.String value)
                             throws java.rmi.RemoteException
This method is used to set a property for the context.

Parameters:
key - The key of the property to set.
value - The value of the property to set.
Returns:
The original property value or null if it did not exist.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removeProperty

public java.lang.String removeProperty(java.lang.String key)
                                throws java.rmi.RemoteException
This method is used to remove a property from the context.

Parameters:
key - This is the key for the property to remove.
Returns:
The original property value or null if it did not exist.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getPolicies

public Policy[] getPolicies()
                     throws java.rmi.RemoteException
This method is used to get all of the policies for the context

Returns:
Array of policy objects.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getPolicy

public Policy getPolicy(java.lang.String key)
                 throws java.rmi.RemoteException
This method is used to get a policy from the context.

Parameters:
key - The name of the policy.
Returns:
The policy object.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getPolicyKeys

public java.lang.String[] getPolicyKeys()
                                 throws java.rmi.RemoteException
This method is used to get all of the policy keys for the context.

Returns:
Array of keys.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

setPolicy

public Policy setPolicy(java.lang.String key,
                        Policy policy)
                 throws java.rmi.RemoteException
This method is used to set a policy for the context.

Parameters:
key - The name of the policy.
policy - The policy object.
Returns:
The original policy object or null if it did not exist.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removePolicy

public Policy removePolicy(java.lang.String key)
                    throws java.rmi.RemoteException
This method is used to remove a policy from the context.

Parameters:
key - This is the name of the policy to remove.
Returns:
The original policy object or null if it did not exist.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getPlatforms

public PlatformDescriptor[] getPlatforms()
                                  throws java.rmi.RemoteException
This method is used to get all of the platforms for the context.

Returns:
Array of PlatformDescriptor objects.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addPlatform

public boolean addPlatform(UniqueID platform,
                           java.lang.String name,
                           boolean clusterHint)
                    throws java.rmi.RemoteException
This method is used to add a platform to the context.

Parameters:
platform - unique identifier for the ContainerManager representing the platform.
name - Host name of the platform being added.
clusterHint - If true it implies that this platform is a candidate to be part of the context cluster. If the context implementation does support clustering this hint is ignored.
Returns:
true if the platform was added to the context cluster.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removePlatform

public void removePlatform(UniqueID platform,
                           java.lang.String name)
                    throws java.rmi.RemoteException
This method is used to remove a platform from a context.

Parameters:
platform - unique identifier for the ContainerManager representing the platform.
name - Host name of the platform being removed.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

getRelationships

public ContextDescriptor[] getRelationships()
                                     throws java.rmi.RemoteException
This method returns the relationships this context currently has.

Returns:
An array of relationships, or null if there are no current relationships.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addRelationship

public void addRelationship(UniqueID context,
                            java.lang.String name)
                     throws java.rmi.RemoteException
This method is used to add relationships between this context and another. This implies that a trust relationship is formed.

Parameters:
context - The unique identifier for the context.
name - Name of the context being added.
Returns:
The original policy object or null if it did not exist.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removeRelationship

public void removeRelationship(UniqueID context,
                               java.lang.String name)
                        throws java.rmi.RemoteException
This method is used to remove a relationship between this context and another.

Parameters:
context - The UniqueId of the context to remove the relationship with.
name - Name of the context being removed.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removeContext

public void removeContext()
                   throws java.rmi.RemoteException
This method is used to remove / destroy this context. This method will destroy all context state and will stop all context services.

Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addPlatformListener

public void addPlatformListener(PlatformListener platformListener)
                         throws java.rmi.RemoteException
This method is used to add a listener that is notified when platforms are added to the context or deleted from the Context. Object equality is used to keep track of listeners, hence multiple registrations of the same listener will act as a single registration.

Parameters:
platformListener - Listener to add.
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removePlatformListener

public void removePlatformListener(PlatformListener platformListener)
                            throws java.rmi.RemoteException
This method is used to remove a listener that is notified when platforms are added to the context or deleted from the Context. Object equality is used to keep track of listeners, hence multiple removals will act as a single removal.

Parameters:
platformListener - Listener to remove
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addRelationshipListener

public void addRelationshipListener(RelationshipListener relationshipListener)
                             throws java.rmi.RemoteException
This method is used to add a listener that is notified when context relationships are added or removed. Object equality is used to keep track of listeners, hence multiple registrations of the same listener will act as a single registration.

Parameters:
relationshipListener - Listener to add
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removeRelationshipListener

public void removeRelationshipListener(RelationshipListener relationshipListener)
                                throws java.rmi.RemoteException
This method is used to remove a listener that is notified when context relationships are added or removed. Object equality is used to keep track of listeners, hence multiple removals of the same listener will act as a single removal.

Parameters:
relationshipListener - Listener to remove
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addPropertyListener

public void addPropertyListener(PropertyListener propertyListener)
                         throws java.rmi.RemoteException
This method is used to add a listener that is notified when properties are added, changed, or deleted in a Context. Object equality is used to keep track of listeners, hence multiple registrations of the same listener will act as a single registration.

Parameters:
propertyListener - Listener to add
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removePropertyListener

public void removePropertyListener(PropertyListener propertyListener)
                            throws java.rmi.RemoteException
This method is used to remove a listener that is notified when properties are added, changed, or deleted in a Context. Object equality is used to keep track of listeners, hence multiple removals will act as a single removal.

Parameters:
propertyListener - Listener to remove
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

addPolicyListener

public void addPolicyListener(PolicyListener policyListener)
                       throws java.rmi.RemoteException
This method is used to add a listener that is notified when policies are added, changed, or deleted in a context. Object equality is used to keep track of listeners, hence multiple registrations of the same listener will act as a single registration.

Parameters:
policyListener - Listener to add
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

removePolicyListener

public void removePolicyListener(PolicyListener policyListener)
                          throws java.rmi.RemoteException
This method is used to remove a listener that is notified when policies are added, changed, or deleted in a context. Object equality is used to keep track of listeners, hence multiple removals will act as a single removal.

Parameters:
policyListener - Listener to remove
Throws:
java.rmi.RemoteException - if there is an error communicating with the context.

Openwings API Documentation (v1.1)