es.iac.ing.codeso.status.client
Class StatusItemProxyConnectionPolicy

java.lang.Object
  extended by es.iac.ing.codeso.status.client.StatusItemProxyConnectionPolicy

public class StatusItemProxyConnectionPolicy
extends java.lang.Object

Specifies the connection policies available for a StatusItemProxy.

Communication between proxies and their remote status items is also affected by the StatusItemPublicationPolicy.

This class is thread-safe.


Field Summary
private  ConnectionPolicy connectionPolicy
          Holds a reference to the equivalent publisher connection policy.
static int DEFAULT_LINK_VERIFICATION_INTERVAL
          The link verification interval for a status item proxy in milliseconds.
static int DEFAULT_POLLING_INTERVAL
          The default polling interval for a status item proxy in milliseconds.
 
Constructor Summary
StatusItemProxyConnectionPolicy()
           
 
Method Summary
static StatusItemProxyConnectionPolicy getAutoPollingInstance()
          Returns a connection policy suitable for a status item proxy which will periodically poll its associated remote status item for value updates.
static StatusItemProxyConnectionPolicy getAutoPollingInstance(int pollingInterval)
          Returns a connection policy suitable for a status item proxy which will poll its associated remote status item for value updates.
(package private)  ConnectionPolicy getConnectionPolicy()
          Returns the publisher proxy connection policy that is equivalent to this one.
static StatusItemProxyConnectionPolicy getDefaultInstance()
          Returns the default connection policy which will be adopted for a status item proxy if not explictly specified.
static StatusItemProxyConnectionPolicy getPollOnDemandInstance()
          Returns a connection policy suitable for a status item proxy which will poll its associated remote status item every time the user asks it for its current value.
static StatusItemProxyConnectionPolicy getSubscribingInstance()
          Returns a connection policy suitable for a status item proxy which will subscribe to its associated remote status item for notification of value updates.
static StatusItemProxyConnectionPolicy getSubscribingInstance(int linkVerificationInterval)
          Returns a connection policy suitable for a status item proxy which will subscribe to its associated remote status item for notification of value updates.
private  void setConnectionPolicy(ConnectionPolicy connectionPolicy)
          Sets the publisher connection policy that is equivalent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POLLING_INTERVAL

public static final int DEFAULT_POLLING_INTERVAL
The default polling interval for a status item proxy in milliseconds. The current value is: 15000.

See Also:
Constant Field Values

DEFAULT_LINK_VERIFICATION_INTERVAL

public static final int DEFAULT_LINK_VERIFICATION_INTERVAL
The link verification interval for a status item proxy in milliseconds. The current value is: 15000.

See Also:
Constant Field Values

connectionPolicy

private ConnectionPolicy connectionPolicy
Holds a reference to the equivalent publisher connection policy.

Constructor Detail

StatusItemProxyConnectionPolicy

public StatusItemProxyConnectionPolicy()
Method Detail

getDefaultInstance

public static StatusItemProxyConnectionPolicy getDefaultInstance()
Returns the default connection policy which will be adopted for a status item proxy if not explictly specified.

Currently the default behaviour is to subscribe for notification of value updates so a call to this method is equivalent to a call to getSubscribingInstance.

Returns:
the new policy.

getAutoPollingInstance

public static StatusItemProxyConnectionPolicy getAutoPollingInstance()
Returns a connection policy suitable for a status item proxy which will periodically poll its associated remote status item for value updates.

The polling interval will be fixed to the default value set up in this class (currently 15000 milliseconds).

Returns:
the new policy.

getAutoPollingInstance

public static StatusItemProxyConnectionPolicy getAutoPollingInstance(int pollingInterval)
Returns a connection policy suitable for a status item proxy which will poll its associated remote status item for value updates.

The polling interval will be determined by the pollingInterval parameter passed to this method.

Parameters:
pollingInterval - positive integer specifying the delay in milliseconds between each successive poll operation.
Returns:
the new policy.
Throws:
java.lang.IllegalArgumentException - if the specified pollingInterval parameter was zero or negative.

getPollOnDemandInstance

public static StatusItemProxyConnectionPolicy getPollOnDemandInstance()
Returns a connection policy suitable for a status item proxy which will poll its associated remote status item every time the user asks it for its current value.

Returns:
the new policy.

getSubscribingInstance

public static StatusItemProxyConnectionPolicy getSubscribingInstance()
Returns a connection policy suitable for a status item proxy which will subscribe to its associated remote status item for notification of value updates.

The link verification interval will be fixed to the default value set up in this class (currently 15000 milliseconds).

Returns:
the new policy.

getSubscribingInstance

public static StatusItemProxyConnectionPolicy getSubscribingInstance(int linkVerificationInterval)
Returns a connection policy suitable for a status item proxy which will subscribe to its associated remote status item for notification of value updates.

The link verification interval will be determined by the linkVerificationInterval parameter passed to this method.

Parameters:
linkVerificationInterval - positive integer specifying the delay in milliseconds between each successive verification of the link.
Returns:
the new policy.
Throws:
java.lang.IllegalArgumentException - if the specified linkVerificationInterval parameter was zero or negative.

setConnectionPolicy

private void setConnectionPolicy(ConnectionPolicy connectionPolicy)
Sets the publisher connection policy that is equivalent

Parameters:
connectionPolicy - reference to the equivalent publisher proxy connection policy.

getConnectionPolicy

ConnectionPolicy getConnectionPolicy()
Returns the publisher proxy connection policy that is equivalent to this one.

Returns:
reference to the publisher proxy ConnectionPolicy