org.globus.wsrf.impl.servicegroup.client
Class ServiceGroupRegistrationClient

java.lang.Object
  extended byorg.globus.wsrf.impl.servicegroup.client.ServiceGroupRegistrationClient

public class ServiceGroupRegistrationClient
extends java.lang.Object

This class is a client library to manage registrations to WS-ServiceGroups. The term 'managed registration' is used to refer to a registration managed by this client.
Managed registrations come into existence in two ways:

The list of managed registrations may be specified through a combination of the above two methods.
Once a managed registration has been created in the client, the client will attempt to ensure that a corresponding ServiceGroupEntry always exists, as follows:
The client will create a ServiceGroupEntry in the appropriate WS-ServiceGroup. It will then periodically attempt WS-ResourceLifetime lifetime extension on the ServiceGroupEntry. If the client detects that the ServiceGroupEntry is no longer available, it will create a new one.
When operating inside a container, there is a distinguished instance of this client that is configured to register to the default MDS index service running in that container. This is intended to allow easy registration of interesting (from an MDS perspective) resources into MDS hierarchies.


Nested Class Summary
private  class ServiceGroupRegistrationClient.RegTimer
          Internal class for registration timer event.
 
Field Summary
private  BaseClient baseClient
           
private  ServiceGroupRegistrationClientCallback clientCallback
           
private static ServiceGroupRegistrationClient containerClient
           
private  org.apache.axis.message.addressing.EndpointReferenceType defaultRegistrantEPR
           
private  java.lang.String defaultSecDescFile
           
private  org.apache.axis.message.addressing.EndpointReferenceType defaultServiceGroupEPR
           
(package private) static int INITIAL_DELAY_CONTAINER
           
private  int initialDelay
           
 boolean isDebug
           
private static int LIFETIMECONST
          When renewing the lifetime of an entry, the refresh frequency will be multiplied by this constant to give the duration (from now) of the new lifetime.
private static WSResourceLifetimeServiceAddressingLocator lifetimeloc
           
private static int LOG_D
           
private static int LOG_E
           
private static int LOG_I
           
private static int LOG_W
           
private static org.apache.commons.logging.Log logger
           
 boolean outputToConsole
           
private  boolean outputToLog
           
private  java.util.List registrations
           
private static ServiceGroupServiceAddressingLocator sgloc
           
static java.lang.String TAG_NS
           
static java.lang.String TAG_PARAMS
           
static java.lang.String TAG_REG_EPR
           
static java.lang.String TAG_SEC_DESC
           
static java.lang.String TAG_SG_EPR
           
private  TimerManagerImpl timerManager
           
 
Constructor Summary
ServiceGroupRegistrationClient()
          Creates a new instance of ServiceGroupRegistrationClient
ServiceGroupRegistrationClient(BaseClient baseClient)
          Creates an instance of the client library backed by an instance of a BaseClient derived command line class, inheriting its command line parameters and redirecting output to the console accordingly.
 
Method Summary
 ServiceGroupRegistrationClientCallback getClientCallback()
          Gets the instance of the ServiceGroupRegistrationClientCallback that is to receive registration status messages.
static ServiceGroupRegistrationClient getContainerClient()
          This should only be called when running within a container
 org.apache.axis.message.addressing.EndpointReferenceType getDefaultServiceGroupEPR()
           
static org.apache.axis.message.addressing.EndpointReferenceType getIndexEPR()
           
 org.apache.axis.message.addressing.EndpointReferenceType getRegistrantEPR()
           
 void processConfigFile(java.lang.String fileName)
          Parses the config file for registration entries to process.
static ServiceGroupRegistrationParameters readParams(java.lang.String filename)
          A helper method for reading a params block from a file.
static commonj.timers.Timer register(org.apache.axis.message.addressing.EndpointReferenceType epr, java.lang.String regFile)
           
static commonj.timers.Timer register(ResourceContext ctx, org.apache.axis.message.addressing.EndpointReferenceType epr, java.lang.String regFile)
           
 commonj.timers.Timer register(ServiceGroupRegistrationParameters params)
          Create new managed registration using the supplied registration parameters.
 commonj.timers.Timer register(ServiceGroupRegistrationParameters params, long delayMillis)
          Create new managed registration using the supplied registration parameters.
private  void reset()
           
 void setClientCallback(ServiceGroupRegistrationClientCallback callback)
          Sets the instance of a ServiceGroupRegistrationClientCallback that is to receive registration status messages.
 void setDefaultEPR(org.apache.axis.message.addressing.EndpointReferenceType defaultEPR)
          Deprecated. use setDefaultServiceGroupEPR instead
 void setDefaultSecDescFile(java.lang.String f)
          Sets the default security descriptor filename for registrations that have a null security descriptor filename.
 void setDefaultServiceGroupEPR(org.apache.axis.message.addressing.EndpointReferenceType epr)
          Sets the service group EPR for registrations that have a null servicegroup field.
 void setInitialDelay(int d)
           
 void setRegistrantEPR(org.apache.axis.message.addressing.EndpointReferenceType epr)
          Sets the default registrant EPR for registrations that have a null registrant field.
private  void status(int msgType, java.lang.Object obj)
          Internal method for handling console or log4j based output.
private  void status(java.lang.Object obj)
          status output at default level of Info
 void terminate()
          Use caution when calling the terminate method, as this method will cause ALL registration timer events to be canceled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_DELAY_CONTAINER

static final int INITIAL_DELAY_CONTAINER
See Also:
Constant Field Values

initialDelay

private int initialDelay

containerClient

private static ServiceGroupRegistrationClient containerClient

registrations

private java.util.List registrations

timerManager

private TimerManagerImpl timerManager

baseClient

private BaseClient baseClient

defaultServiceGroupEPR

private org.apache.axis.message.addressing.EndpointReferenceType defaultServiceGroupEPR

defaultRegistrantEPR

private org.apache.axis.message.addressing.EndpointReferenceType defaultRegistrantEPR

defaultSecDescFile

private java.lang.String defaultSecDescFile

clientCallback

private ServiceGroupRegistrationClientCallback clientCallback

logger

private static org.apache.commons.logging.Log logger

sgloc

private static final ServiceGroupServiceAddressingLocator sgloc

lifetimeloc

private static final WSResourceLifetimeServiceAddressingLocator lifetimeloc

LIFETIMECONST

private static final int LIFETIMECONST
When renewing the lifetime of an entry, the refresh frequency will be multiplied by this constant to give the duration (from now) of the new lifetime. This should be greater than 1 to cope with the fact that renewals do not happen exactly on the refresh period.

See Also:
Constant Field Values

isDebug

public boolean isDebug

outputToConsole

public boolean outputToConsole

outputToLog

private boolean outputToLog

TAG_SG_EPR

public static final java.lang.String TAG_SG_EPR
See Also:
Constant Field Values

TAG_REG_EPR

public static final java.lang.String TAG_REG_EPR
See Also:
Constant Field Values

TAG_SEC_DESC

public static final java.lang.String TAG_SEC_DESC
See Also:
Constant Field Values

TAG_PARAMS

public static final java.lang.String TAG_PARAMS
See Also:
Constant Field Values

TAG_NS

public static final java.lang.String TAG_NS
See Also:
Constant Field Values

LOG_I

private static final int LOG_I
See Also:
Constant Field Values

LOG_E

private static final int LOG_E
See Also:
Constant Field Values

LOG_W

private static final int LOG_W
See Also:
Constant Field Values

LOG_D

private static final int LOG_D
See Also:
Constant Field Values
Constructor Detail

ServiceGroupRegistrationClient

public ServiceGroupRegistrationClient()
Creates a new instance of ServiceGroupRegistrationClient


ServiceGroupRegistrationClient

public ServiceGroupRegistrationClient(BaseClient baseClient)
Creates an instance of the client library backed by an instance of a BaseClient derived command line class, inheriting its command line parameters and redirecting output to the console accordingly.

Method Detail

setClientCallback

public void setClientCallback(ServiceGroupRegistrationClientCallback callback)
Sets the instance of a ServiceGroupRegistrationClientCallback that is to receive registration status messages.

Since:
GT4.0.0

getClientCallback

public ServiceGroupRegistrationClientCallback getClientCallback()
Gets the instance of the ServiceGroupRegistrationClientCallback that is to receive registration status messages.

Since:
GT4.0.0

setDefaultEPR

public void setDefaultEPR(org.apache.axis.message.addressing.EndpointReferenceType defaultEPR)
Deprecated. use setDefaultServiceGroupEPR instead


setDefaultServiceGroupEPR

public void setDefaultServiceGroupEPR(org.apache.axis.message.addressing.EndpointReferenceType epr)
Sets the service group EPR for registrations that have a null servicegroup field.

Since:
GT3.9.4

getDefaultServiceGroupEPR

public org.apache.axis.message.addressing.EndpointReferenceType getDefaultServiceGroupEPR()
Since:
GT3.9.5

setRegistrantEPR

public void setRegistrantEPR(org.apache.axis.message.addressing.EndpointReferenceType epr)
Sets the default registrant EPR for registrations that have a null registrant field.

Since:
GT3.9.4

getRegistrantEPR

public org.apache.axis.message.addressing.EndpointReferenceType getRegistrantEPR()
Since:
GT3.9.5

setDefaultSecDescFile

public void setDefaultSecDescFile(java.lang.String f)
Sets the default security descriptor filename for registrations that have a null security descriptor filename.

Since:
GT3.9.4

setInitialDelay

public void setInitialDelay(int d)

processConfigFile

public void processConfigFile(java.lang.String fileName)
                       throws java.lang.Exception
Parses the config file for registration entries to process. The config file entry format is a series of configuration elements:
TODO: Define this config file format completely in XSD rather than performing the deserialisation partly ourselves.
TODO: shorter name for ServiceGroupRegistrationParameters, eg registration

Parameters:
fileName - the name of the configuration file to process
Throws:
java.lang.Exception - if there is an error during processing of the file

register

public commonj.timers.Timer register(ServiceGroupRegistrationParameters params,
                                     long delayMillis)
Create new managed registration using the supplied registration parameters.

Parameters:
params - registration parameters
delayMillis - the delay in milliseconds before executing the request.

register

public commonj.timers.Timer register(ServiceGroupRegistrationParameters params)
Create new managed registration using the supplied registration parameters. The registration will be made immediately (but asynchronously.

Parameters:
params - registration parameters

terminate

public void terminate()
Use caution when calling the terminate method, as this method will cause ALL registration timer events to be canceled. In particular, excercise caution when calling terminate on the ServiceGroupRegistrationClient instance returned from the static getContainerClient method.


reset

private void reset()

status

private void status(java.lang.Object obj)
status output at default level of Info


status

private void status(int msgType,
                    java.lang.Object obj)
Internal method for handling console or log4j based output.


getContainerClient

public static ServiceGroupRegistrationClient getContainerClient()
This should only be called when running within a container


getIndexEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getIndexEPR()
                                                                            throws java.net.MalformedURLException,
                                                                                   java.io.IOException,
                                                                                   org.apache.axis.types.URI.MalformedURIException
Throws:
java.net.MalformedURLException
java.io.IOException
org.apache.axis.types.URI.MalformedURIException

readParams

public static ServiceGroupRegistrationParameters readParams(java.lang.String filename)
                                                     throws java.lang.Exception
A helper method for reading a params block from a file. This is intended to be used to pull in a skeleton registration block by a service prior to populating any run-time defined fields.

Throws:
java.lang.Exception
Since:
GT3.9.5

register

public static commonj.timers.Timer register(org.apache.axis.message.addressing.EndpointReferenceType epr,
                                            java.lang.String regFile)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

register

public static commonj.timers.Timer register(ResourceContext ctx,
                                            org.apache.axis.message.addressing.EndpointReferenceType epr,
                                            java.lang.String regFile)
                                     throws java.lang.Exception
Throws:
java.lang.Exception