Skip to main content

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

Hi Robert,

On 11/5/2010 3:09 AM, Robert Onslow wrote:
<stuff deleted>

Thus I have got a SharedObject and a Remote Service off the same container.

That's great....I didn't get that there was a timing of notification issue.

Thanks, Scott. And hope this helps other ECF newbies.

I think it probably does...thanks much for discussing publicly. If you have any inclination and time, it might make sense to create a wiki page about this and make it available off of the ECF wiki:

Thanks for both using ECF and for contributing to it's ongoing development.



On Thu, Nov 4, 2010 at 9:48 PM, Scott Lewis<slewis@xxxxxxxxxxxxx>  wrote:
Hi Robert,

On 11/4/2010 2:35 PM, Robert Onslow wrote:
I have decided to go with the ECF method at the moment, because it
gives me more control over discovery etc. and I can also like to
retain responsibility for creating the container

So on the client side, I will wait for the container connection, then
pick up the shared object, then pick up the remote service:

container =
container.addListener(new IContainerListener() {

public void handleEvent(IContainerEvent event) {
        if (event instanceof IContainerConnectedEvent)
        try {
ID id = IDFactory.getDefault().createID(container.getConnectNamespace(),
//pick up the shared object

ISharedObjectContainer soc =
(ISharedObjectContainer) ((IAdaptable)

                              ISharedObjectManager manager =
EventAdmin admin = new DistributedEventAdmin(context);
ID id1 =
Properties props = new Properties();
props.put(EventConstants.EVENT_TOPIC, "uk_co_xlegal_xbundle3_remote");
manager.addSharedObject(id1, (ISharedObject) admin, props);
((DistributedEventAdmin) admin).start();

//now pick up the remote service

IRemoteServiceContainerAdapter rsc = (IRemoteServiceContainerAdapter)
((IAdaptable) container).getAdapter(IRemoteServiceContainerAdapter.class);

                                      IRemoteServiceReference[] refs =
event).getTargetID(), StateProvider.class.getName(), null);
StateProvider provider = (StateProvider) rsc.getRemoteService(refs[0]);
Map<String, Object>    state = provider.provideState();

} catch (Exception e) {

                                      Log.log(Log.ERROR, e.getMessage());
container.connect(id, null);

I'm finding that refs is null. Looking inside rsc, I see that the
remoteRegistry array is empty.
Have I missed a step in initialising the
IRemoteServiceContainerAdapter on the client side?
I don't think so...I think probably the issue is that you should use this
lookup method (note the ID[] first param, rather than ID):

IRemoteServiceReference[] refs =
rsc.getRemoteServiceReferences(new ID[] { ((IContainerConnectedEvent)
event).getTargetID() }, StateProvider.class.getName(), null);

I have other commitments right now so can't explain at the moment, but I
suspect that this will deal with this situation.


ecf-dev mailing list

Back to the top