org.sapia.soto
Class ServiceMetaData

java.lang.Object
  extended by org.sapia.soto.ServiceMetaData
All Implemented Interfaces:
ServiceConfiguration

public class ServiceMetaData
extends java.lang.Object
implements ServiceConfiguration

Holds meta information about a given service.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software . All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
Service

Constructor Summary
ServiceMetaData(SotoContainer container, java.lang.String id, java.lang.Object service)
           
ServiceMetaData(SotoContainer container, java.lang.String id, java.lang.Object service, java.util.List layers)
           
 
Method Summary
 void addAttribute(Attribute attr)
           
 Attribute getAttribute(java.lang.String name)
           
 java.util.Collection getAttributes()
           
 java.util.List getLayers()
           
 LifeCycleManager getLifeCycleManager()
           
 java.lang.Object getService()
          Returns this instance's associated service.
 java.lang.Class getServiceClass()
           
 java.lang.String getServiceID()
          Returns the identifier of the service to which this instance corresponds.
 void init()
          Calls the init() method of this instance's service.
 void invokeDisposeMethod()
          Invokes the "dispose" method on the service encapsulated by this instance (if such a dispose method was specified).
 void invokeInitMethod()
          Invokes the "init" method on the service encapsulated by this instance (if such an init method was specified).
 void invokeStartMethod()
          Invokes the "start" method on the service encapsulated by this instance (if such a start method was specified).
 boolean isInit()
           
 boolean isStarted()
           
 void setDisposeMethod(MethodConfig dispose)
           
 void setInitMethod(MethodConfig init)
           
 void setService(java.lang.Object obj)
          Sets this instance's service.
 void setStartMethod(MethodConfig start)
           
 void setType(java.lang.String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceMetaData

public ServiceMetaData(SotoContainer container,
                       java.lang.String id,
                       java.lang.Object service)

ServiceMetaData

public ServiceMetaData(SotoContainer container,
                       java.lang.String id,
                       java.lang.Object service,
                       java.util.List layers)
Method Detail

setType

public void setType(java.lang.String type)
Parameters:
type - the 'type' of service, in terms of its lifecycle.
See Also:
LifeCycleManager, SotoContainer.registerLifeCycleManager(String, LifeCycleManager)

getLifeCycleManager

public LifeCycleManager getLifeCycleManager()
Returns:
the LifeCycleManager corresponding to this instance.
See Also:
setType(String)

getServiceID

public java.lang.String getServiceID()
Returns the identifier of the service to which this instance corresponds.

Specified by:
getServiceID in interface ServiceConfiguration
Returns:
a service identifier, or null if the service to which this instance corresponds is an "anonymous" service (it has no ID).

setService

public void setService(java.lang.Object obj)
Sets this instance's service.

WARNING : in general, this method should not be called by client applications.

Specified by:
setService in interface ServiceConfiguration
Parameters:
obj - a service instance.
See Also:
Service

getService

public java.lang.Object getService()
Returns this instance's associated service.

Specified by:
getService in interface ServiceConfiguration
Returns:
a service.

getServiceClass

public java.lang.Class getServiceClass()
Specified by:
getServiceClass in interface ServiceConfiguration
Returns:
the Class corresponding to the type of service.

getAttributes

public java.util.Collection getAttributes()
Returns:
the Collection of Attribute of this instance.

getAttribute

public Attribute getAttribute(java.lang.String name)
Parameters:
name - the name of the desired attribute.
Returns:
the Attribute corresponding to the given name, or Null if no such attribute exists.

getLayers

public java.util.List getLayers()
Returns:
the List of Layers that this instance holds, or null if this instance has no layers specified.

addAttribute

public void addAttribute(Attribute attr)
Parameters:
attr - an Attribute.

isInit

public boolean isInit()
Returns:
true if the service corresponding to this instance has had its init() method called.

isStarted

public boolean isStarted()
Returns:
true if the service corresponding to this instance has had its start() method called.

init

public void init()
          throws java.lang.Exception
Calls the init() method of this instance's service.

Throws:
java.lang.Exception - if a problem occurs performing this instance's service initialization.

invokeInitMethod

public void invokeInitMethod()
                      throws java.lang.Exception
Description copied from interface: ServiceConfiguration
Invokes the "init" method on the service encapsulated by this instance (if such an init method was specified).

Specified by:
invokeInitMethod in interface ServiceConfiguration
Throws:
java.lang.Exception - if a problem occurs.

invokeStartMethod

public void invokeStartMethod()
                       throws java.lang.Exception
Description copied from interface: ServiceConfiguration
Invokes the "start" method on the service encapsulated by this instance (if such a start method was specified).

Specified by:
invokeStartMethod in interface ServiceConfiguration
Throws:
java.lang.Exception - if a problem occurs.

invokeDisposeMethod

public void invokeDisposeMethod()
Description copied from interface: ServiceConfiguration
Invokes the "dispose" method on the service encapsulated by this instance (if such a dispose method was specified).

Specified by:
invokeDisposeMethod in interface ServiceConfiguration

setInitMethod

public void setInitMethod(MethodConfig init)

setStartMethod

public void setStartMethod(MethodConfig start)

setDisposeMethod

public void setDisposeMethod(MethodConfig dispose)


Copyright © 2010 Sapia OSS. All Rights Reserved.