/** * Get the local CMS. * @return The local CMS. */ public IFuture<IComponentManagementService> getLocalCMS() { IFuture<IComponentManagementService> ret = SServiceProvider.getService(access.getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM); return ret; }
/** * Create a new invocation handler. */ public DelegationInterceptor(IInternalAccess ia, RequiredServiceInfo info, RequiredServiceBinding binding, IRequiredServiceFetcher fetcher, IServiceIdentifier sid, boolean realtime) { this.ea = ia.getExternalAccess(); this.info = info; this.binding = binding; this.fetcher = fetcher!=null? fetcher: new DefaultServiceFetcher(ea.getServiceProvider(), ia, realtime); this.sid = sid; }
public void actionPerformed(ActionEvent e) { SServiceProvider.getService(agent.getServiceProvider(), IDaemonService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingDefaultResultListener<IDaemonService>() { public void customResultAvailable(IDaemonService result) { IDaemonService ds = (IDaemonService)result; int[] rows = (int[])platformt.getSelectedRows(); for(int i=0; i<rows.length; i++) { IComponentIdentifier cid = (IComponentIdentifier)ptm.getObjectForRow(rows[i]); ds.shutdownPlatform(cid); } } }); } });
public void actionPerformed(java.awt.event.ActionEvent e) { final List bps = new ArrayList(Arrays.asList(description.getBreakpoints())); if(but.isSelected()) { bps.add(breakpoints.get(sorter.modelIndex(rowIndex))); } else { bps.remove(breakpoints.get(sorter.modelIndex(rowIndex))); } SServiceProvider.getService(access.getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingDefaultResultListener(BreakpointPanel.this) { public void customResultAvailable(Object result) { ((IComponentManagementService)result).setComponentBreakpoints( description.getName(), (String[])bps.toArray(new String[bps.size()])); } }); } });
public void actionPerformed(ActionEvent e) { SServiceProvider.getService(agent.getServiceProvider(), IDaemonService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingDefaultResultListener<IDaemonService>() { public void customResultAvailable(IDaemonService result) { IDaemonService ds = (IDaemonService)result; StartOptions so = new StartOptions(); so.setJavaCommand(stop.getTextField("Java command").getText()); so.setVMArguments(stop.getTextField("VM arguments").getText()); so.setClassPath(stop.getTextField("Classpath").getText()); so.setMain(stop.getTextField("Main class").getText()); so.setProgramArguments(stop.getTextField("Program arguments").getText()); so.setStartDirectory(stop.getTextField("Start directory").getText()); ds.startPlatform(so); } }); } });
public void exceptionOccurred(Exception exception) { // System.out.println("factory ex: "+exception); IFuture<Collection<IComponentFactory>> fut = SServiceProvider.getServices(exta.getServiceProvider(), IComponentFactory.class, RequiredServiceInfo.SCOPE_PLATFORM); fut.addResultListener(new ExceptionDelegationResultListener<Collection<IComponentFactory>, IComponentFactory>(ret) { public void customResultAvailable(Collection<IComponentFactory> facts) { factories = facts; selectComponentFactory((IComponentFactory[])factories.toArray(new IComponentFactory[factories.size()]), model, cinfo, rid, 0) .addResultListener(new DelegationResultListener<IComponentFactory>(ret)); } }); } });
/** * Get the remote component management system for a specific component id. */ protected IFuture<IComponentManagementService> getRemoteCMS(final IComponentIdentifier cid) { final Future<IComponentManagementService> ret = new Future<IComponentManagementService>(); SServiceProvider.getService(exta.getServiceProvider(), IRemoteServiceManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new ExceptionDelegationResultListener<IRemoteServiceManagementService, IComponentManagementService>(ret) { public void customResultAvailable(IRemoteServiceManagementService rms) { rms.getServiceProxy(cid, IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new DelegationResultListener(ret)); } }); return ret; }
/** * Create a new remote service management service. */ public RemoteServiceManagementService(IExternalAccess component, ILibraryService libservice, final IMarshalService marshal, final IMessageService msgservice)//, boolean binarymode) { super(component.getServiceProvider().getId(), IRemoteServiceManagementService.class, null); // System.out.println("binary: "+binarymode); this.component = component; this.rrm = new RemoteReferenceModule(this, libservice, marshal); this.waitingcalls = new HashMap<String, WaitingCallInfo>(); this.processingcalls = new HashMap<String, Object>(); this.terminationcommands = new LRU<String, Runnable>(100); this.timer = new Timer(true); this.marshal = marshal; this.msgservice = msgservice; ((MessageService)msgservice).setContentCodecInfo(component.getComponentIdentifier(), getCodecInfo()); }
/** * Create a new remote service management service. */ public RemoteServiceManagementService(IExternalAccess component, ILibraryService libservice, final IMarshalService marshal, final IMessageService msgservice)//, boolean binarymode) { super(component.getServiceProvider().getId(), IRemoteServiceManagementService.class, null); // System.out.println("binary: "+binarymode); this.component = component; this.rrm = new RemoteReferenceModule(this, libservice, marshal); this.waitingcalls = new HashMap<String, WaitingCallInfo>(); this.processingcalls = new HashMap<String, Object>(); this.terminationcommands = new LRU<String, List<Runnable>>(1000); this.timer = new Timer(true); this.marshal = marshal; this.msgservice = msgservice; ((MessageService)msgservice).setContentCodecInfo(component.getComponentIdentifier(), getCodecInfo()); }
/** * Method to get an external access for the platform component (i.e. root component). * @param access Any component on the platform. */ public static IFuture<IExternalAccess> getRootAccess(final IExternalAccess access) { final Future<IExternalAccess> ret = new Future<IExternalAccess>(); SServiceProvider.getService(access.getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingExceptionDelegationResultListener<IComponentManagementService, IExternalAccess>(ret) { public void customResultAvailable(IComponentManagementService cms) { cms.getExternalAccess((IComponentIdentifier)access.getComponentIdentifier().getRoot()) .addResultListener(new SwingDelegationResultListener<IExternalAccess>(ret)); } }); return ret; } }
/** * Install a local listener. * @param listener The local listener. */ protected IFuture<Void> installLocalCMSListener(final ICMSComponentListener listener) { final Future<Void> ret = new Future<Void>(); SServiceProvider.getService(access.getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingExceptionDelegationResultListener<IComponentManagementService, Void>(ret) { public void customResultAvailable(IComponentManagementService cms) { // IComponentManagementService cms = (IComponentManagementService)result; cms.addComponentListener(null, listener); ret.setResult(null); } }); return ret; }
/** * Remove a local listener. * @param listener The local listener. */ protected IFuture<Void> removeLocalCMSListener(final ICMSComponentListener listener) { final Future<Void> ret = new Future<Void>(); SServiceProvider.getService(access.getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingExceptionDelegationResultListener<IComponentManagementService, Void>(ret) { public void customResultAvailable(IComponentManagementService cms) { // IComponentManagementService cms = (IComponentManagementService)result; cms.removeComponentListener(null, listener); ret.setResult(null); } }); return ret; }
/** * Informs the panel that it should stop all its computation */ public IFuture<Void> shutdown() { final Future<Void> ret = new Future<Void>(); SServiceProvider.getService(agent.getServiceProvider(), IDaemonService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new ExceptionDelegationResultListener<IDaemonService, Void>(ret) { public void customResultAvailable(IDaemonService ds) { // IDaemonService ds = (IDaemonService)result; ds.removeChangeListener(listener); ret.setResult(null); } public void exceptionOccurred(Exception exception) { ret.setException(exception); } }); return ret; }
public void customResultAvailable(Void result) { // Todo: use remote access for clock !? SServiceProvider.getService(getJCC().getJCCAccess().getServiceProvider(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingExceptionDelegationResultListener<IClockService, Void>(ret) { public void customResultAvailable(IClockService result) { clockservice = result; ret.setResult(null); } }); } });
public void actionPerformed(ActionEvent e) { TreePath[] paths = comptree.getTree().getSelectionPaths(); for(int i=0; paths!=null && i<paths.length; i++) { if(paths[i].getLastPathComponent() instanceof IActiveComponentTreeNode && BDIAgentFactory.FILETYPE_BDIAGENT.equals(((IActiveComponentTreeNode)paths[i].getLastPathComponent()).getDescription().getType())) { IActiveComponentTreeNode node = (IActiveComponentTreeNode)paths[i].getLastPathComponent(); IComponentDescription desc = node.getDescription(); RuleProfilerPanel panel = new RuleProfilerPanel(getJCC().getPlatformAccess().getServiceProvider(), desc.getName()); // SHelp.setupHelp(panel, getHelpID()); detail.add(panel, desc); comptree.getModel().fireNodeChanged(node); } } } };
public void customResultAvailable(Void result) { // System.out.println("Pushed platform settings"); SServiceProvider.getService(getPlatformAccess().getServiceProvider(), ISettingsService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new SwingExceptionDelegationResultListener<ISettingsService, Void>(ret) { public void customResultAvailable(ISettingsService settings) { // System.out.println("Fetched settings service"); // ISettingsService settings = (ISettingsService)result; settings.saveProperties().addResultListener(new SwingDelegationResultListener<Void>(ret)); } public void customExceptionOccurred(Exception exception) { // No settings service: ignore. ret.setResult(null); } }); } });
/** * Get the external access of the component providing the service. * Might refer to a different platform than jcc access abnd platform access! */ public IFuture<IExternalAccess> getServiceAccess() { final Future<IExternalAccess> ret = new Future<IExternalAccess>(); SServiceProvider.getService(getJCC().getJCCAccess().getServiceProvider(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, IExternalAccess>(ret) { public void customResultAvailable(IComponentManagementService cms) { cms.getExternalAccess(((IService)getService()).getServiceIdentifier().getProviderId()) .addResultListener(new DelegationResultListener<IExternalAccess>(ret)); } }); return ret; }
public void stateChanged(ChangeEvent e) { final boolean sel = soe.isSelected(); controlcenter.setSaveOnExit(sel); SServiceProvider.getService(controlcenter.getPCC().getPlatformAccess().getServiceProvider(),ISettingsService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(new IResultListener<ISettingsService>() { public void resultAvailable(ISettingsService setser) { setser.setSaveOnExit(sel); } public void exceptionOccurred(Exception exception) { // no problem if settings service is not available } }); } });
/** * Get the parent service container. * @return The parent container. */ public IFuture<IServiceProvider> getParent() { if(shutdowned) { return new Future<IServiceProvider>(new ComponentTerminatedException(id)); } final Future<IServiceProvider> ret = new Future<IServiceProvider>(); ret.setResult(adapter!=null && adapter.getParent()!=null ? adapter.getParent().getServiceProvider() : null); return ret; }
/** * */ public static void main(String[] args) { String[] pargs = new String[] { "-gui", "false" }; IExternalAccess rootcomp = (IExternalAccess)Starter.createPlatform(pargs).get(new ThreadSuspendable()); IComponentManagementService cms = (IComponentManagementService)SServiceProvider.getServiceUpwards(rootcomp.getServiceProvider(), IComponentManagementService.class).get(new ThreadSuspendable()); dorun(cms, "jadex/micro/testcases/blocking/ShutdownAgent.class"); // dorun(cms, "jadex/micro/benchmarks/MessagePerformanceAgent.class"); // dorun(cms, "jadex/micro/examples/ping/PingScenario.application.xml"); } }