/** * Get the pojo agent (or null if it has none). * @return The pojo agent object. */ public Object getPojoAgent() { Object ret = null; MicroAgent ma = getAgent(); if(ma instanceof IPojoMicroAgent) ret = ((IPojoMicroAgent)ma).getPojoAgent(); return ret; }
/** * Can be called concurrently (also during executeAction()). * * Inform the agent that a message has arrived. * Can be called concurrently (also during executeAction()). * @param message The message that arrived. */ public void messageArrived(final IMessageAdapter message) { // System.out.println("msgrec: "+getAgentAdapter().getComponentIdentifier()+" "+message); // IFuture ret = scheduleStep(new ICommand() scheduleStep(new HandleMessageStep(message)); }
/** * Get the discovery agent. */ protected DiscoveryAgent getDiscoveryAgent() { return (DiscoveryAgent)((IPojoMicroAgent)agent).getPojoAgent(); } }
/** * Load a component model. * @param name The filename or logical name (resolved via imports and extensions). * @param imports The imports, if any. */ public MicroModel loadComponentModel(String name, String[] imports, IResourceIdentifier clkey, ClassLoader classloader, Object context) throws Exception { return (MicroModel)loadModel(name, FILE_EXTENSION_MICRO, imports, clkey, classloader, context); }
/** * Create a new BPMN model loader. */ public MicroModelLoader() { super(new String[]{FILE_EXTENSION_MICRO}); this.reader = new MicroClassReader(); }
/** * Send a message. * @param me The message content (name value pairs). * @param mt The message type describing the content. */ public IFuture<Void> sendMessage(Map<String, Object> me, MessageType mt) { return sendMessage(me, mt, null); }
public IFuture<Void> resourceIdentifierAdded(IResourceIdentifier parid, IResourceIdentifier rid, boolean rem) { loader.clearModelCache(); return IFuture.DONE; } };
/** * Wait for an specified amount of time. * @param time The time. * @param run The runnable. */ public IFuture waitFor(long time, IComponentStep run) { return agent.waitFor(time, run); }
/** * Init the micro agent with the interpreter. * @param interpreter The interpreter. */ public void init(MicroAgentInterpreter interpreter, Object agent) { super.init(interpreter); this.agent = agent; }
/** * Get the service provider. * @return The service provider. */ public IServiceProvider getServiceProvider() { return interpreter.getServiceProvider(); }
/** * Get the component results. * @return The results. */ public Map<String, Object> getResults() { return interpreter.getResults(); }
/** * Get a raw reference to a provided service implementation. */ public Object getRawService(String name) { return interpreter.getRawService(name); }
/** * Check if event targets exist. */ public boolean hasEventTargets(PublishTarget pt, PublishEventLevel pi) { return interpreter.hasEventTargets(pt, pi); }
/** * Wait for the next tick. * @param time The time. */ public IFuture waitForTick(IComponentStep run) { return agent.waitForTick(run); }
/** * Set a result value. * @param name The result name. * @param value The result value. */ public void setResultValue(String name, Object value) { interpreter.setResultValue(name, value); }
/** * Add a message handler. * @param The handler. */ public void addMessageHandler(IMessageHandler handler) { interpreter.addMessageHandler(handler); }
/** * Get the model of the component. * @return The model. */ public IModelInfo getModel() { return interpreter.getModel(); }
/** * Returns the current value of a non-functional property of this service, performs unit conversion. * @param name Name of the property. * @param type Type of the property value. * @param unit Unit of the property value. * @return The current value of a non-functional property of this service. */ public <T, U> IFuture<T> getNonFunctionalPropertyValue(String name, Class<U> unit) { return interpreter.getNFPropertyValue(name, unit); }
/** * Get the discovery agent. */ protected DiscoveryAgent getDiscoveryAgent() { return (DiscoveryAgent)((IPojoMicroAgent)agent).getPojoAgent(); } }
/** * Load a component model. * @param name The filename or logical name (resolved via imports and extensions). * @param imports The imports, if any. */ public MicroModel loadComponentModel(String name, String[] imports, ClassLoader classloader, Object context) throws Exception { return (MicroModel)loadModel(name, FILE_EXTENSION_MICRO, imports, classloader, context); }