org.scijava.service
Class AbstractService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
All Implemented Interfaces:
Comparable<Prioritized>, Contextual, Disposable, HasPluginInfo, RichPlugin, SciJavaPlugin, Prioritized, Service
Direct Known Subclasses:
AbstractLogService, AbstractPTService, DefaultAppEventService, DefaultDisplayService, DefaultEventHistory, DefaultEventService, DefaultMenuService, DefaultModuleService, DefaultObjectService, DefaultPluginService, DefaultRecentFileService, DefaultStatusService, DefaultThreadService, DefaultUIService

public abstract class AbstractService
extends AbstractRichPlugin
implements Service

Abstract superclass of Service implementations.

Author:
Curtis Rueden

Constructor Summary
AbstractService()
           
 
Method Summary
 void dispose()
          Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).
 Context getContext()
          Gets the application context to which the object belongs, or null if Contextual.setContext(Context) has not yet been called on this object.
 void initialize()
          Performs any needed initialization when the service is first loaded.
 void registerEventHandlers()
          Registers the service's event handler methods.
 void setContext(Context context)
          Sets the application context to which the object belongs.
 String toString()
           
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.Contextual
context
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 

Constructor Detail

AbstractService

public AbstractService()
Method Detail

initialize

public void initialize()
Description copied from interface: Service
Performs any needed initialization when the service is first loaded.

NB: This method is not intended to be called directly. It is called by the service framework itself (specifically by the ServiceHelper) when initializing the service. It should not be called a second time.

Specified by:
initialize in interface Service

registerEventHandlers

public void registerEventHandlers()
Description copied from interface: Service
Registers the service's event handler methods.

NB: This method is not intended to be called directly. It is called by the service framework itself (specifically by the ServiceHelper) when initializing the service. It should not be called a second time.

Specified by:
registerEventHandlers in interface Service

getContext

public Context getContext()
Description copied from interface: Contextual
Gets the application context to which the object belongs, or null if Contextual.setContext(Context) has not yet been called on this object.

Specified by:
getContext in interface Contextual
Overrides:
getContext in class AbstractContextual
See Also:
Contextual.context()

setContext

public void setContext(Context context)
Description copied from interface: Contextual
Sets the application context to which the object belongs.

Typically this method simply delegates to Context.inject(Object), and should be called only once to populate the context. Most contextual objects do not support later alteration of the context, and will throw IllegalStateException if this method is invoked again.

Specified by:
setContext in interface Contextual
Overrides:
setContext in class AbstractContextual
See Also:
Context.inject(Object), for an example of how to implement this interface

dispose

public void dispose()
Description copied from interface: Disposable
Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).

Specified by:
dispose in interface Disposable

toString

public String toString()
Overrides:
toString in class AbstractRichPlugin


Copyright © 2009–2014 SciJava. All rights reserved.