org.apache.muse.ws.resource.lifetime.impl
Class SimpleScheduledTermination

java.lang.Object
  extended byorg.apache.muse.core.AbstractCapability
      extended byorg.apache.muse.ws.resource.impl.AbstractWsResourceCapability
          extended byorg.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination
All Implemented Interfaces:
Capability, Initialization, InitializationParameters, ScheduledTermination, Shutdown, WsResourceCapability, org.apache.muse.ws.resource.WsResourceCapabilityProperties

public class SimpleScheduledTermination
extends AbstractWsResourceCapability
implements ScheduledTermination

SimpleScheduledTermination is Muse's default implementation of the WS-RL ScheduledResourceTermination capability. It uses Java's built in timer mechanism to manage scheduled terminations. This class does not provide any actual resource shutdown operations - it only removes the resource's visibility to internal and external clients at a specified time.

Author:
Dan Jemiolo (danj)

Field Summary
protected static Messages _MESSAGES
           
 
Fields inherited from interface org.apache.muse.ws.resource.lifetime.ScheduledTermination
PROPERTIES
 
Constructor Summary
SimpleScheduledTermination()
           
 
Method Summary
protected  MessageHandler createSetTerminationTimeHandler()
           
 java.util.Date getCurrentTime()
           
 QName[] getPropertyNames()
          Concrete capability classes that define properties MUST override this method and provide the names of the properties.
 java.util.Date getTerminationTime()
           
 void initialize()
          

AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it.

AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties.
 java.util.Date setTerminationTime(java.util.Date time)
           
 void shutdown()
           
 
Methods inherited from class org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
createGettersAndSetters, deleteProperty, getGetter, getProperty, getPropertyElements, getSetter, getWsResource, insertProperty, invokeMethod, setResource, updateProperty
 
Methods inherited from class org.apache.muse.core.AbstractCapability
getActions, getCapabilityURI, getEnvironment, getInitializationParameter, getInitializationParameters, getLog, getMessageHandler, getPersistence, getResource, hasBeenInitialized, hasBeenShutdown, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setInitializationParameters, setLog, setMessageHandler, setMessageHandlers, setPersistence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.muse.ws.resource.WsResourceCapability
deleteProperty, getProperty, getWsResource, insertProperty, updateProperty
 
Methods inherited from interface org.apache.muse.core.Capability
getActions, getCapabilityURI, getEnvironment, getLog, getMessageHandler, getPersistence, getResource, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setLog, setMessageHandlers, setPersistence, setResource
 
Methods inherited from interface org.apache.muse.core.Initialization
hasBeenInitialized
 
Methods inherited from interface org.apache.muse.core.InitializationParameters
getInitializationParameter, getInitializationParameters, setInitializationParameters
 
Methods inherited from interface org.apache.muse.core.Shutdown
hasBeenShutdown
 

Field Detail

_MESSAGES

protected static Messages _MESSAGES
Constructor Detail

SimpleScheduledTermination

public SimpleScheduledTermination()
Method Detail

createSetTerminationTimeHandler

protected MessageHandler createSetTerminationTimeHandler()

getCurrentTime

public java.util.Date getCurrentTime()
Specified by:
getCurrentTime in interface ScheduledTermination
Returns:
The current time, according to the system the resource is on.

getPropertyNames

public QName[] getPropertyNames()
Description copied from interface: org.apache.muse.ws.resource.WsResourceCapabilityProperties
Concrete capability classes that define properties MUST override this method and provide the names of the properties.

Specified by:
getPropertyNames in interface org.apache.muse.ws.resource.WsResourceCapabilityProperties
Overrides:
getPropertyNames in class AbstractWsResourceCapability

getTerminationTime

public java.util.Date getTerminationTime()
Specified by:
getTerminationTime in interface ScheduledTermination
Returns:
The termination time for this resource, or null if the resource is not scheduled for termination.

initialize

public void initialize()
                throws SoapFault
Description copied from class: AbstractWsResourceCapability


AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it.

Specified by:
initialize in interface Initialization
Overrides:
initialize in class AbstractWsResourceCapability
Throws:
SoapFault

setTerminationTime

public java.util.Date setTerminationTime(java.util.Date time)
Specified by:
setTerminationTime in interface ScheduledTermination
Parameters:
time - The new termination time. If the time is null, the resource will not be scheduled for destruction. If the time is in the past, it will be destroyed immediately.
Returns:
The previous termination time value (or null, if none existed).

shutdown

public void shutdown()
              throws SoapFault
Specified by:
shutdown in interface Shutdown
Overrides:
shutdown in class AbstractCapability
Throws:
SoapFault