cms.getComponentDescriptions().addResultListener(new SwingDefaultResultListener()
public void resultAvailable(final IComponentManagementService cms) { cms.getComponentDescriptions().addResultListener( new DefaultResultListener<IComponentDescription[]>() { public void resultAvailable(IComponentDescription[] descs) { for(int i=0; i<descs.length; i++) { System.out.println("Found: "+descs[i]); } } }); } });
public void customResultAvailable(Object result) { IComponentManagementService cms = (IComponentManagementService)result; cms.addComponentListener(null, RuleProfilerPlugin.this); cms.getComponentDescriptions().addResultListener(new SwingDefaultResultListener(comptree) { public void customResultAvailable(Object result) { IComponentDescription[] res = (IComponentDescription[])result; for(int i=0; i<res.length; i++) { if(BDIAgentFactory.FILETYPE_BDIAGENT.equals(res[i].getType())) componentAdded(res[i]); } } }); } });
/** * Execute the agent */ @AgentBody public void execute(final IInternalAccess agent) { IComponentManagementService cms = SServiceProvider.getService(agent, IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); cms.getComponentDescriptions().get(); agent.getComponentFeature(IArgumentsResultsFeature.class).getResults().put("testresults", new Testcase(1, new TestReport[]{new TestReport("#1", "Test blocking wait.", true, null)})); } }
protected IFuture<Void> performTests(Testcase tc) { // timeout none due to remote call and simulation mode IExternalAccess exta = createPlatform(null).get(Timeout.NONE); IComponentManagementService cms = SServiceProvider.getService(exta, IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM).get(Timeout.NONE); cms.getComponentDescriptions().get(Timeout.NONE); tc.addReport(new TestReport("#1", "Test blocking wait.", true, null)); return IFuture.DONE; } }
IFuture fut = ces.getComponentDescriptions(); IComponentDescription[] descs = (IComponentDescription[])fut.get(this); getBeliefbase().getBeliefSet("components").addFacts(descs);