This component can be used to import an external service into the node agent.
For example, the
NodeApplet uses this component to advertise the
org.cougaar.core.service.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.
|