org.gcube.data.tmf.impl
Class LifecycleAdapter

java.lang.Object
  extended by org.gcube.data.tmf.impl.LifecycleAdapter
All Implemented Interfaces:
Serializable, SourceLifecycle

public class LifecycleAdapter
extends Object
implements SourceLifecycle

No-op implementation of SourceLifecycle for selective overriding in subclasses.

Author:
Fabio Simeoni
See Also:
SourceLifecycle, Serialized Form

Constructor Summary
LifecycleAdapter()
           
 
Method Summary
 void init()
          Tells the plugin to start managing the data source.
 void reconfigure(Element request)
          Gives the plugin a client request with which it can refine its management of the data source.
 void resume()
          Tells the plugin to resume its management of the data source.
 void stop()
          Tells the plugin to stop its management of the data source until further notice.
 void terminate()
          Tells the plugin to stop its management of the data source for good.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifecycleAdapter

public LifecycleAdapter()
Method Detail

init

public void init()
          throws Exception
Tells the plugin to start managing the data source.

This occurs during the binding the data source, immediately after the SourceBinder has returned the corresponding Source to the service.

Plugins may implement this method to initialise the state of the Source and schedule any operation that relates to the management of the data source.

If this method fails, the binding between the plugin and the data source also fails.

Specified by:
init in interface SourceLifecycle
Throws:
Exception - if the operation cannot be completed
See Also:
SourceBinder.bind(Element)

resume

public void resume()
            throws Exception
Tells the plugin to resume its management of the data source.

This occurs when the service is restoring its state from persistent storage after a restart of the container.

Plugins may implement this method to restart scheduled operations which relate to the management of the data source.

If this method fails, all subsequent client requests about the data source fail.

Specified by:
resume in interface SourceLifecycle
Throws:
Exception - if the operation cannot be completed

reconfigure

public void reconfigure(Element request)
                 throws InvalidRequestException,
                        Exception
Gives the plugin a client request with which it can refine its management of the data source.

This occurs during the binding of a data source, when the SourceBinder returns to the service a Source with the same identifier as the Source associated with this instance. This indicates that the plugin is already managing the corresponding data source and that the client request should be used to re-configure the existing Source rather than initialise the new one.

Plugins may implement this method to refine the state of a Source or to change otherwise its management of the corresponding data source.

If this method fails, the client request fails and the plugin retains its current management regime for the data source.

Specified by:
reconfigure in interface SourceLifecycle
Throws:
InvalidRequestException - if the client request is incompatible with the current management regime of the data source.
Exception - if the operation cannot be completed for any other reason
See Also:
SourceBinder.bind(Element)

terminate

public void terminate()
Tells the plugin to stop its management of the data source for good.

This occurs when clients indicate that access to the data source is no longer needed.

Plugins may implement this method to terminate any scheduled operation that relates to the management of the data source, or to perform any other relevant form of state cleanup.

Specified by:
terminate in interface SourceLifecycle

stop

public void stop()
Tells the plugin to stop its management of the data source until further notice.

This may occur when the container is shutting down, or when the service is serialising its state to persistence storage so as to conserve memory resources.

Plugins may implement this method to gracefully stop any operation that relates to the management of the data source.

Specified by:
stop in interface SourceLifecycle


Copyright © 2013. All Rights Reserved.