[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] Using a container multiple times

Dear All

On the server side, I have create a container and registered a shared
object on it.

I would like to publish a remote service over it as well. I tried:

final IContainer container =
manager.getContainerFactory().createContainer("ecf.generic.server");
final ISharedObjectContainer sharedObjectContainer =
(ISharedObjectContainer)
container.getAdapter(ISharedObjectContainer.class)
ISharedObjectManager manager1 = sharedObjectContainer.getSharedObjectManager();
Properties props = new Properties();
props.put(EventConstants.EVENT_TOPIC, "uk_co_xlegal_xbundle3_remote");
manager1.addSharedObject(IDFactory.getDefault().createStringID("uk.co.xlegal.xbundle3.remote"),
(ISharedObject) admin, props);

//now share the StateProvider service

IRemoteServiceContainerAdapter rsc = (IRemoteServiceContainerAdapter)
((IAdaptable) container).getAdapter(IRemoteServiceContainerAdapter.class);
StateProvider provider = (StateProvider) localStateServiceTracker.getService();
					

rsc.registerRemoteService(new String[]{StateProvider.class.getName()},
provider, null);

...

I am not seeing the service on the client side. I have connected, and
am successfully synchronizing the EventAdmin.
But if I register a tracker for the remote service, the remote service
is never found.

remoteStateProviderTracker = new ServiceTracker(context,
StateProvider.class.getName(), new ServiceTrackerCustomizer() {

			@Override
			public Object addingService(ServiceReference reference) {
//never reaching here

				StateProvider provider = (StateProvider) context.getService(reference);
				Map<String, Object> state = provider.provideState();
				List<String> openBundleURIs = (List<String>) state.get("openBundleURIs");
				
				for (String uri : openBundleURIs)
					syncWithBundleURI(uri);
				return provider;
			

			}

			@Override
			public void modifiedService(ServiceReference reference,
					Object service) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void removedService(ServiceReference reference,
					Object service) {
				
			}
			
		});

remoteStateProviderTracker.open();
							
Is it possible to use a server container in this way?

Robert
-- 
Robert Onslow
XLegal Limited