/** * Get the agent identifier. * @return The agent identifier. */ public IComponentIdentifier getComponentIdentifier() { return agent.getComponentIdentifier(); }
/** * Create a new required service fetcher. */ public DefaultServiceFetcher(IServiceProvider provider, IInternalAccess ia, boolean realtime) { this.ia = ia; this.access = ia.getExternalAccess(); this.provider = provider; this.realtime = realtime; }
/** * Create a settings service. * @param prefix The settings file prefix to be used (if any). * Uses name from service provider, if no prefix is given. */ public SettingsService(IInternalAccess access, boolean saveonexit) { super(access.getServiceContainer().getId(), ISettingsService.class, null); this.access = access; this.providers = new LinkedHashMap(); this.saveonexit = saveonexit; filename = access.getComponentIdentifier().getPlatformPrefix() + SETTINGS_EXTENSION; }
public void exceptionOccurred(Exception exception) { System.out.println(agent.getComponentFeature(IExecutionFeature.class).isComponentThread()+" "+agent.getComponentIdentifier()); agent.getComponentFeature(IArgumentsResultsFeature.class).getResults().put("testresults", tc); agent.killComponent(); } }));
public void resultAvailable(TestReport result) { // System.out.println("tests finished"); agent.getComponentFeature(IArgumentsResultsFeature.class).getResults().put("testresults", tc); agent.killComponent(); }
/** * Start the service. */ @ServiceStart public IFuture<Void> startService() { this.cid = component.getComponentIdentifier().getRoot(); this.logger = component.getLogger(); return IFuture.DONE; }
public IFuture<Void> execute(IInternalAccess ia) { agent.getComponentFeature(IProvidedServicesFeature.class).addService("dummyservice", IDummyService.class, new DummyService(agent.getComponentIdentifier()), BasicServiceInvocationHandler.PROXYTYPE_DIRECT); agent.getComponentFeature(IExecutionFeature.class).waitForDelay(3000, this); return IFuture.DONE; } };
/** * */ public IParsedExpression getParsedExpression() { return SJavaParser.parseExpression(uexp, agent.getModel().getAllImports(), agent.getClassLoader()); } }
/** * Create a new interceptor. */ public MethodCallListenerInterceptor(IInternalAccess component, IServiceIdentifier sid) { super(component); this.sid = sid; this.container = component.getServiceContainer(); }
/** * Factory method constructor for instance level. */ public BDIAgentFeature(IInternalAccess component, ComponentCreationInfo cinfo) { super(component, cinfo); Object pojo = getComponent().getComponentFeature(IPojoComponentFeature.class).getPojoAgent(); ASMBDIClassGenerator.checkEnhanced(pojo.getClass()); this.bdimodel = (BDIModel)getComponent().getModel().getRawModel(); this.capa = new RCapability(bdimodel.getCapability(), component); this.rulesystem = new RuleSystem(pojo, component.getLogger(), true); }
public IFuture<IServiceCallService> execute(Void args) { // return agent.getComponentFeature(IRequiredServicesFeature.class).getRequiredService(servicename); return agent.getComponentFeature(IRequiredServicesFeature.class).getRequiredService(servicename, true, new TagFilter<IServiceCallService>(agent.getExternalAccess(), tag)); } }, 7, 1500);
/** * Test if current thread is the component thread. * @return True if the current thread is the component thread. */ public boolean isComponentThread() { return Thread.currentThread()==componentthread || IComponentDescription.STATE_TERMINATED.equals(getComponent().getComponentDescription().getState()) && Starter.isRescueThread(getComponent().getComponentIdentifier()); }
/** * Get the logger. * @return The logger. */ public Logger getLogger() { return access.getLogger(); }
/** * Get the agent model. * @return The agent model. */ public IModelInfo getAgentModel() { return agent.getModel(); }
/** * Get the classloader. * @return The classloader. */ public ClassLoader getClassLoader() { return agent.getClassLoader(); }
/** * Create belief events from a belief name. * For normal beliefs * beliefchanged.belname and factchanged.belname * and for multi beliefs additionally * factadded.belname and factremoved * are created. */ public static void addBeliefEvents(IInternalAccess ia, List<EventType> events, String belname) { addBeliefEvents((MCapability)ia.getComponentFeature(IInternalBDIAgentFeature.class) .getCapability().getModelElement(), events, belname, ia.getClassLoader()); }
public void customResultAvailable(IPublishService ps) { ps.publishService(instance.getClassLoader(), service, pi) .addResultListener(instance.createResultListener(new DelegationResultListener<Void>(ret))); } public void exceptionOccurred(Exception exception)
/** * Create result listener that tolerates when agent is null at shutdown. */ protected IResultListener createResultListener(IResultListener listener) { return agent==null? listener: agent.createResultListener(listener); }
/** * Kill the component. * @param e The failure reason, if any. */ public IFuture<Map<String, Object>> killComponent(Exception e) { return access.killComponent(e); }
public void exceptionOccurred(Exception exception) { System.out.println(agent.getComponentFeature(IExecutionFeature.class).isComponentThread()+" "+agent.getComponentIdentifier()); agent.getComponentFeature(IArgumentsResultsFeature.class).getResults().put("testresults", tc); agent.killComponent(); } }));