Package com.almende.eve.agent

Examples of com.almende.eve.agent.Agent


      resp.sendError(400, "Query parameter 'type' missing in url.");
      return;
    }

    try {
      Agent agent = agentFactory.createAgent(agentType, agentId);
      for (String url : agent.getUrls()) {
        resp.getWriter().println(url);
      }
      agent.destroy();
    } catch (Exception e) {
      throw new ServletException(e);
    }
  }
View Full Code Here


   * @throws InstantiationException
   * @throws JSONRPCException
   */
  public List<String> create(@Name("id") String id,
      @Name("type") String type) throws JSONRPCException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException {
    Agent agent = getAgentHost().createAgent(type, id);
    return (agent != null) ? agent.getUrls() : null;
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws JSONRPCException
   * @throws IOException
   */
  public List<String> get(@Name("id") String id) throws JSONRPCException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException {
    Agent agent = getAgentHost().getAgent(id);
    return (agent != null) ? agent.getUrls() : null;
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws JSONRPCException
   * @throws IOException
   */
  public boolean exists(@Name("id") String id) throws JSONRPCException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException {
    Agent agent = getAgentHost().getAgent(id);
    return (agent != null);
  }
View Full Code Here

      if (agentId == null || agentId.isEmpty()) {
        resp.sendError(HttpServletResponse.SC_BAD_REQUEST,
            "No agentId found in url.");
        return;
      }
      Agent agent = agentHost.getAgent(agentId);
      if (agent == null){
        resp.sendError(HttpServletResponse.SC_BAD_REQUEST,
            "Agent not found at this host.");
        return;
      }
     
      if (JSONRPC.hasPrivate(agent.getClass())
          && !handleSession(req, resp)) {
        if (!resp.isCommitted()) {
          resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
        }
        return;
View Full Code Here

          "Query parameter 'type' missing in url.");
      return;
    }
   
    try {
      Agent agent = agentHost.createAgent(agentType, agentId);
      for (String url : agent.getUrls()) {
        resp.getWriter().println(url);
      }
      agent.signalAgent(new AgentSignal<Void>("destroy", null));
    } catch (Exception e) {
      throw new ServletException(e);
    }
  }
View Full Code Here

      resp.sendError(HttpServletResponse.SC_BAD_REQUEST,
          "No agentId found in url.");
      resp.flushBuffer();
      return;
    }
    Agent agent = null;
    try {
      agent = host.getAgent(agentId);
    } catch (final Exception e) {
      LOG.log(Level.WARNING, "Couldn't get agent:" + agentId, e);
    }
    if (agent == null) {
      resp.sendError(HttpServletResponse.SC_NOT_FOUND,
          "Agent not found at this host.");
      resp.flushBuffer();
      return;
    }
   
    if (agent.hasPrivate() && !handleSession(req, resp)) {
      if (!resp.isCommitted()) {
        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
      }
      resp.flushBuffer();
      return;
View Full Code Here

          "Query parameter 'type' missing in url.");
      return;
    }
   
    try {
      final Agent agent = host.createAgent(agentType, agentId);
      for (final String url : agent.getUrls()) {
        resp.getWriter().println(url);
      }
      agent.signalAgent(new AgentSignal<Void>(AgentSignal.DESTROY, null));
    } catch (final Exception e) {
      throw new ServletException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.almende.eve.agent.Agent

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.