Package net.sf.agentopia.platform

Examples of net.sf.agentopia.platform.IAgentopiaAgent


            cmd = cmd.substring("agent ".length());
        }
        final String agentId = cmd;

        // Create and start agent.
        IAgentopiaAgent agent = controller.createAgent(agentId);
        if (null == agent) {
            logger.info("Start agent options: " + controller.loadAgentIds());
        }
        else {
            logger.info("Starting agent: " + agent);
View Full Code Here


        controller.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
                final int eventId = evt.getID();
                final DefaultListModel listModel = (DefaultListModel) getAgentList().getModel();
                IAgentopiaAgent agent;

                // Decide on event id.
                synchronized (listModel) {
                    switch (eventId) {
                        case AgentopiaConstants.ACTION_AGENT_ADDED :
View Full Code Here

     *
     * @param agentId The agent id.
     */
    private void processAgentStarted(String agentId) {
        // Create agent and identify it in list.
        final IAgentopiaAgent agent = controller.createAgent(agentId);
        final String agentUid = agent.getUID();
        startedAgentIdList.add(agentUid);

        // Try to start per GUI.
        final IAgentopiaAgentGUI agentGui = controller.createAgentGui(agent);
        if (null != agentGui) {
View Full Code Here

    /**
     * Takes all action if the thread is an agent executor.
     */
    private void processAgent() {
        setName("Connection (Agent)");
        IAgentopiaAgent agent = null;

        // Check flag and read agent.
        int intFlag = AgentopiaConstants.NEUTRAL;
        try {
            dataOut.writeInt(AgentopiaConstants.HEADER_AGENT);
View Full Code Here

                    // Agent to send? Yes.
                    else {
                        if (AgentopiaConstants.SUSTAINER_DEBUG) {
                            Logger.getLogger().info("Sustainer sending agent to \"" + getTargetId() + "\".");
                        }
                        final IAgentopiaAgent agent = transferQueue.get(0);
                        final ClassedObjectTransmitter transmitter = marketPlace.getClassedObjectTransmitter();
                        try {
                            transferQueue.remove(0);
                            writeInt(AgentopiaConstants.MESSAGE_AGENT_COMING);
                            transmitter.transferAgentToStream(agent, dataOut);
                            Logger.getLogger().info("Agent \"" + agent + "\" left the system (" + marketPlace.getHomeId() + ") per Sustainer.");
                            agent.shutDown();
                        }
                        catch (IOException exc) {
                            // Agent sending failed... But no problem here.
                            Logger.getLogger().info("Agent \"" + agent + "\" failed to leave to \"" + targetId + "\"... and died.");
                        }
                    }
                    break;

                // Incoming agent? Yes.
                case AgentopiaConstants.MESSAGE_AGENT_COMING :
                    if (AgentopiaConstants.SUSTAINER_DEBUG) {
                        Logger.getLogger().info("Sustainer receiving agent from \"" + getTargetId() + "\".");
                    }
                    final ClassedObjectTransmitter transmitter = marketPlace.getClassedObjectTransmitter();
                    try {
                        final IAgentopiaAgent agent = (IAgentopiaAgent) transmitter.transferAgentFromStream(dataIn);
                        Logger.getLogger().info("Agent \"" + agent + "\" entered the system (" + marketPlace.getHomeId() + ") per Sustainer.");
                        // Indicate to market place that agent is here.
                        // Run method will be called in next market tick.
                        marketPlace.agentArrived(agent);
                    }
View Full Code Here

TOP

Related Classes of net.sf.agentopia.platform.IAgentopiaAgent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.