[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[ecf-dev] Remote OSGI services over XMPP
|
Hi,
I am trying to set up a network with lots of automatic bots that basically need to expose their OSGI services to an administrator. I am using XMPP as the protocol, and sending IM's and files work without a problem. I would like to try remote services as well, but can't get it working.
This is what the bots do when admin comes online:
/**
* Register remote services with the admin
* This is called when admin comes online
*/
private void initializeRemoteServices() {
try {
// Get ECF adapter for remote services
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container
.getAdapter(IRemoteServiceContainerAdapter.class);
// This is the ID of the administrator
ID[] targetIDs = new ID[] { getID("admin") };
Dictionary props = new Hashtable();
props.put(Constants.SERVICE_REGISTRATION_TARGETS, targetIDs);
props.put(Constants.AUTOREGISTER_REMOTE_PROXY, "true");
// Create service instance
PlatformAdmin service = Platform.getPlatformAdmin();
IRemoteServiceRegistration reg = adapter.registerRemoteService(new String[] { PlatformAdmin.class
.getName() }, service, props);
System.out.println("Registered remote service server: "+reg);
} catch (Exception e) {
e.printStackTrace();
}
}
The admin uses the normal contacts view, and has an action to use this services when right-clicking on a bot. This is the code that tries to connect to the PlatformAdmin service oof the selected bot:
ID[] ids = new ID[] { entry.getUser().getID() };
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences(ids, PlatformAdmin.class.getName(), null);
But this always gives an empty array.
Is there something else I need to do to enable remote services on the "client" side?
Regards,
Leen Toelen