public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, AwarenessInfo.STATE_ONLINE, getDelay(), getIncludes(), getExcludes(), null); ret.setResult(info); } })); } }));
public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, state, getDelay(), getIncludes(), getExcludes(), masterid); ret.setResult(info); } })); } }));
public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, AwarenessInfo.STATE_ONLINE, getDelay(), getIncludes(), getExcludes(), null, awa); ret.setResult(info); } })); } }));
public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, state, getDelay(), getIncludes(), getExcludes(), masterid, awa); ret.setResult(info); } })); } }));
microagent.agentKilled().addResultListener(microagent.createResultListener(new DelegationResultListener<Void>(ret)
/** * Add a service to the platform. * If under the same name and type a service was contained, * the old one is removed and shutdowned. * @param type The public service interface. * @param service The service. */ public IFuture<Void> addService(String name, Class<?> type, Object service) { final Future<Void> ret = new Future<Void>(); IFuture<IInternalService> fut = interpreter.addService(name, type, BasicServiceInvocationHandler.PROXYTYPE_DECOUPLED, null, service, null, interpreter.getComponentFetcher()); fut.addResultListener(createResultListener(new ExceptionDelegationResultListener<IInternalService, Void>(ret) { public void customResultAvailable(IInternalService result) { ret.setResult(null); } })); return ret; }
/** * Create awareness info of myself. */ public IFuture<AwarenessInfo> createAwarenessInfo() { final Future<AwarenessInfo> ret = new Future<AwarenessInfo>(); final String awa = SReflect.getInnerClassName(this.getClass()); // System.out.println("awa: "+awa); IFuture<IMessageService> fut = agent.getServiceContainer().getRequiredService("ms"); fut.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, AwarenessInfo>(ret) { public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, AwarenessInfo.STATE_ONLINE, getDelay(), getIncludes(), getExcludes(), null, awa); ret.setResult(info); } })); } })); return ret; }
/** * Add a service to the platform. * If under the same name and type a service was contained, * the old one is removed and shutdowned. * @param type The public service interface. * @param service The service. * @param type The proxy type (@see{BasicServiceInvocationHandler}). */ public IFuture<Void> addService(String name, Class<?> type, Object service, String proxytype) { final Future<Void> ret = new Future<Void>(); IFuture<IInternalService> fut = interpreter.addService(name, type, proxytype, null, service, null, interpreter.getComponentFetcher()); fut.addResultListener(createResultListener(new ExceptionDelegationResultListener<IInternalService, Void>(ret) { public void customResultAvailable(IInternalService result) { ret.setResult(null); } })); return ret; }
/** * Create awareness info of myself. */ public IFuture<AwarenessInfo> createAwarenessInfo(final String state, final String masterid) { final Future<AwarenessInfo> ret = new Future<AwarenessInfo>(); IFuture<IMessageService> fut = agent.getServiceContainer().getRequiredService("ms"); fut.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, AwarenessInfo>(ret) { public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, state, getDelay(), getIncludes(), getExcludes(), masterid); ret.setResult(info); } })); } })); return ret; }
/** * Create awareness info of myself. */ public IFuture<AwarenessInfo> createAwarenessInfo(final String state, final String masterid) { final Future<AwarenessInfo> ret = new Future<AwarenessInfo>(); final String awa = SReflect.getInnerClassName(this.getClass()); IFuture<IMessageService> fut = agent.getServiceContainer().getRequiredService("ms"); fut.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, AwarenessInfo>(ret) { public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, state, getDelay(), getIncludes(), getExcludes(), masterid, awa); ret.setResult(info); } })); } })); return ret; }
/** * Create awareness info of myself. */ public IFuture<AwarenessInfo> createAwarenessInfo() { final Future<AwarenessInfo> ret = new Future<AwarenessInfo>(); IFuture<IMessageService> fut = agent.getServiceContainer().getRequiredService("ms"); fut.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, AwarenessInfo>(ret) { public void customResultAvailable(IMessageService cms) { cms.updateComponentIdentifier(getRoot()).addResultListener(agent.createResultListener( new ExceptionDelegationResultListener<IComponentIdentifier, AwarenessInfo>(ret) { public void customResultAvailable(IComponentIdentifier root) { AwarenessInfo info = new AwarenessInfo(root, AwarenessInfo.STATE_ONLINE, getDelay(), getIncludes(), getExcludes(), null); ret.setResult(info); } })); } })); return ret; }
public void customResultAvailable(final IMessageService msgser) { msgser.getDefaultCodecs().addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<ICodec[], Void>(ret) { public void customResultAvailable(ICodec[] result) { defaultcodecs = result; msgser.getAllCodecs().addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<Map<Byte, ICodec>, Void>(ret) { public void customResultAvailable(Map<Byte, ICodec> result) { allcodecs = result; } })); } })); ret.setResult(null); } }));
public void customResultAvailable(final IMessageService msgser) { msgser.getDefaultCodecs().addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<ICodec[], Void>(ret) { public void customResultAvailable(ICodec[] result) { defaultcodecs = result; msgser.getAllCodecs().addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<Map<Byte, ICodec>, Void>(ret) { public void customResultAvailable(Map<Byte, ICodec> result) { allcodecs = result; } })); } })); ret.setResult(null); } }));
public void customResultAvailable(IMessageService ms) { // System.err.println("send msg1: "+getComponentIdentifier()+" "+me.get(SFipa.CONTENT)); ms.sendMessage(me, mt, interpreter.getAgentAdapter().getComponentIdentifier(), interpreter.getModel().getResourceIdentifier(), null, codecids) .addResultListener(createResultListener(new DelegationResultListener<Void>(ret))); } });
@Classname("send") public IFuture<Void> execute(IInternalAccess ia) { final IComponentStep<Void> step = this; final Future<Void> ret = new Future<Void>(); if(!agent.isKilled() && sendid.equals(getSendId())) { createAwarenessInfo().addResultListener(agent.getMicroAgent() .createResultListener(new ExceptionDelegationResultListener<AwarenessInfo, Void>(ret) { public void customResultAvailable(AwarenessInfo info) { send(info); if(agent.getDelay()>0) agent.doWaitFor(agent.getDelay(), step); ret.setResult(null); } })); } return ret; } });
/** * Add a service to the platform. * If under the same name and type a service was contained, * the old one is removed and shutdowned. * @param type The public service interface. * @param service The service. */ public IFuture<Void> addService(String name, Class<?> type, Object service, PublishInfo pi) { final Future<Void> ret = new Future<Void>(); ProvidedServiceInfo psi = pi!=null? new ProvidedServiceInfo(null, type, null, pi): null; IFuture<IInternalService> fut = interpreter.addService(name, type, BasicServiceInvocationHandler.PROXYTYPE_DECOUPLED, null, service, psi, interpreter.getComponentFetcher()); fut.addResultListener(createResultListener(new ExceptionDelegationResultListener<IInternalService, Void>(ret) { public void customResultAvailable(IInternalService result) { ret.setResult(null); } })); return ret; }
@Classname("send") public IFuture<Void> execute(IInternalAccess ia) { final IComponentStep<Void> step = this; final Future<Void> ret = new Future<Void>(); if(!agent.isKilled() && sendid.equals(getSendId())) { createAwarenessInfo().addResultListener(agent.getMicroAgent() .createResultListener(new ExceptionDelegationResultListener<AwarenessInfo, Void>(ret) { public void customResultAvailable(AwarenessInfo info) { send(info); if(agent.getDelay()>0) agent.doWaitFor(agent.getDelay(), step); ret.setResult(null); } })); } return ret; } });
.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, Void>(ret)
.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<AwarenessInfo, Void>(ret)
.addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<AwarenessInfo, Void>(ret)