org.cougaar.core.node
Class AddServiceComponent
java.lang.Object
org.cougaar.util.GenericStateModelAdapter
org.cougaar.core.node.AddServiceComponent
- All Implemented Interfaces:
- org.cougaar.core.component.Component, org.cougaar.util.GenericStateModel
public class AddServiceComponent
- extends org.cougaar.util.GenericStateModelAdapter
- implements org.cougaar.core.component.Component
This component can be used to import an external service into the node agent.
For example, the NodeApplet uses this component to advertise the
AppletService.
Two parameters are required:
1) The Service class or classname.
2) The Service class, classname, or instance, or the
ServiceProvider class, classname, or instance.
A third parameter is optional:
3) "true" to use the root ServiceBroker, defaults to false.
Reflection is used wrap the 2nd parameter as the correct API, even if it
doesn't implement the correct interface. For example, an external client
can specify an implementation for:
public interface FooService extends Service {
void foo();
}
as:
public class MyFoo {
public void foo() { .. }
}
even though "MyFoo instanceof FooService" is false. This is supported to
avoid awkward compile and classloader dependencies.
| Fields inherited from interface org.cougaar.util.GenericStateModel |
ACTIVE, IDLE, LOADED, UNINITIALIZED, UNLOADED |
| Methods inherited from class org.cougaar.util.GenericStateModelAdapter |
getModelState, halt, initialize, resume, start, stop, suspend, transitState |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.cougaar.util.GenericStateModel |
getModelState, halt, initialize, resume, start, stop, suspend |
AddServiceComponent
public AddServiceComponent()
setServiceBroker
public void setServiceBroker(org.cougaar.core.component.ServiceBroker sb)
setParameter
public void setParameter(java.lang.Object o)
load
public void load()
- Specified by:
load in interface org.cougaar.util.GenericStateModel- Overrides:
load in class org.cougaar.util.GenericStateModelAdapter
unload
public void unload()
- Specified by:
unload in interface org.cougaar.util.GenericStateModel- Overrides:
unload in class org.cougaar.util.GenericStateModelAdapter