Core API 7.13

net.juniper.smgt.sae.scriptservice
Class NullScriptService

java.lang.Object
  extended by net.juniper.smgt.sae.scriptservice.NullScriptService
All Implemented Interfaces:
ScriptService

public class NullScriptService
extends java.lang.Object
implements ScriptService

No-op implementation of the ScriptService interface. This class can be used to implement a no-op service, i.e. a service that can be activated only for its side effects, e.g. for admission control purposes. Also, this class can be subclassed by simple script service implementations that do not need to implement all methods of the script service interface.


Constructor Summary
NullScriptService()
           
 
Method Summary
 void activateSession()
          Activate the script service session.
 AccountingData deactivateSession()
          Deactivate the script service session.
 void discarded()
          Notify that the service session has been discarded.
 AccountingData getAccountingData()
          Poll current accounting data.
 byte[] getState()
          Return opaque state data that will be stored persistently on the router.
 void initSessionInfo(ServiceSessionInfo ssi)
          Provide session information to the script service.
 void initState(ServiceSessionInfo ssi, byte[] state)
          Initialize a recovered script service session after synchronization of the state.
 AccountingData modifySession(ServiceSessionInfo ssi)
          Modify the script service session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullScriptService

public NullScriptService()
Method Detail

getState

public byte[] getState()
Description copied from interface: ScriptService
Return opaque state data that will be stored persistently on the router. The script service has to maintain versioning information itself. The opaque state can be null, if no state data needs to be stored.
   This method is called after the service session is activated, modified and when interim accounting detects a discontinuity in the accounting data.

Specified by:
getState in interface ScriptService
Returns:
The opaque state data that will be stored persistently on the router or null if no state data needs to be stored.

initSessionInfo

public void initSessionInfo(ServiceSessionInfo ssi)
Description copied from interface: ScriptService
Provide session information to the script service. This method will be called exactly once after the service is instantiated.

Specified by:
initSessionInfo in interface ScriptService
Parameters:
ssi - provide information of service session

activateSession

public void activateSession()
                     throws ScriptServiceException
Description copied from interface: ScriptService
Activate the script service session.

Specified by:
activateSession in interface ScriptService
Throws:
ScriptServiceException

deactivateSession

public AccountingData deactivateSession()
                                 throws ScriptServiceException
Description copied from interface: ScriptService
Deactivate the script service session.

Specified by:
deactivateSession in interface ScriptService
Returns:
The final accounting data for the script service session or null if accounting is not supported.
Throws:
ScriptServiceException

modifySession

public AccountingData modifySession(ServiceSessionInfo ssi)
                             throws ScriptServiceException
Description copied from interface: ScriptService
Modify the script service session.

Specified by:
modifySession in interface ScriptService
Returns:
The accounting data to store in an accounting baseline or null if the accounting data is continuing or not supported.
Throws:
ScriptServiceException

getAccountingData

public AccountingData getAccountingData()
                                 throws ScriptServiceException
Description copied from interface: ScriptService
Poll current accounting data.

Specified by:
getAccountingData in interface ScriptService
Returns:
The current accounting data for the script service session or null if accounting is not supported.
Throws:
ScriptServiceException

initState

public void initState(ServiceSessionInfo ssi,
                      byte[] state)
Description copied from interface: ScriptService
Initialize a recovered script service session after synchronization of the state.

Specified by:
initState in interface ScriptService
Parameters:
ssi - provide information of service session

discarded

public void discarded()
Description copied from interface: ScriptService
Notify that the service session has been discarded. Service sessions are discarded when SAE loses connection with a router. A discarded service session does still exist on the router and will be restored after the connection to the router is re-established by an SAE.
   The script service session should release any resource associated with this session, but must not take any action that would disrupt the service session itself.

Specified by:
discarded in interface ScriptService

Core API 7.13