use of aQute.remote.util.Link in project bnd by bndtools.
the class AgentDispatcher method toAgent.
/**
* Create a new agent on an existing framework.
*/
public static void toAgent(final Descriptor descriptor, DataInputStream in, DataOutputStream out) {
// Check if the framework is active
if (descriptor.framework.getState() != Bundle.ACTIVE) {
throw new IllegalStateException("Framework " + descriptor.name + " is not active. (Stopped?)");
}
//
// Get the bundle context
//
BundleContext context = descriptor.framework.getBundleContext();
AgentServer as = new AgentServer(descriptor.name, context, descriptor.shaCache) {
//
// Override the close se we can remote it from the list
//
public void close() throws IOException {
descriptor.servers.remove(this);
super.close();
}
};
//
// Link up
//
Link<Agent, Supervisor> link = new Link<Agent, Supervisor>(Supervisor.class, as, in, out);
as.setLink(link);
link.open();
}
Aggregations