Package fr.dyade.aaa.agent

Examples of fr.dyade.aaa.agent.AgentId


  /**
   * Processes a <code>Monitor_GetStat</code> request by
   * forwarding it to its target destination, if local.
   */
  private void doProcess(GetStatsRequest request, AgentId replyTo, String msgId) {
    AgentId destId = AgentId.fromString(request.getDest());

    if (destId.isNullId()) {
      // Return the statistics of the server
      Hashtable stats = new Hashtable();
      stats.put("AverageLoad1", new Float(AgentServer.getEngineAverageLoad1()));
      stats.put("AverageLoad5", new Float(AgentServer.getEngineAverageLoad5()));
      stats.put("AverageLoad15", new Float(AgentServer.getEngineAverageLoad15()));
View Full Code Here


  /**
   * Processes a <code>DestinationRequest</code> request by
   * forwarding it to its target destination, if local.
   */
  private void doProcess(DestinationAdminRequest request, AgentId replyTo, String msgId) {
    AgentId destId = AgentId.fromString(request.getDestId());
    forward(destId, new FwdAdminRequestNot(request, replyTo, msgId, createMessageId()));
  }
View Full Code Here

   * @throws UnknownServerException
   */
  private void doProcess(UserAdminRequest request,
                         AgentId replyTo,
                         String requestMsgId) throws UnknownServerException {
    AgentId userId = AgentId.fromString(request.getUserId());
    if (checkServerId(userId.getTo())) {
      // Delegate to the proxy
      forward(userId, new FwdAdminRequestNot(request, replyTo, requestMsgId, createMessageId()));
    } else {
      // Forward the request to the right AdminTopic agent.
      forward(getDefault(userId.getTo()),
              new FwdAdminRequestNot(request, replyTo, requestMsgId, null));
    }
  }
View Full Code Here

   * @param requestMsgId The JMS message id needed to reply.
   * @throws UnknownServerException
   */
  private void doProcess(AdminCommandRequest request, AgentId replyTo, String requestMsgId)
      throws UnknownServerException {
    AgentId targetId = null;
    try {
      targetId = AgentId.fromString(request.getTargetId());
    } catch (Exception e) {
      throw new UnknownServerException(e.getMessage());
    }

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "AdminTopic.doProcess(" + request + ',' + replyTo + ',' + requestMsgId
          + ")   targetId = " + targetId);

    if (targetId == null) {
      if (logger.isLoggable(BasicLevel.WARN))
        logger.log(BasicLevel.WARN, "Request (AdminCommandRequest) to an undefined targetId (null).");
      distributeReply(replyTo, requestMsgId, new AdminReply(AdminReply.UNKNOWN_SERVER,
          "Request (AdminCommandRequest) to an undefined targetId (null)."));
      return;
    }
    if (targetId.isNullId()) {
      if (checkServerId(targetId.getTo())) {
        Properties replyProp = null;
        try {
          switch (request.getCommand()) {
          case AdminCommandConstant.CMD_NO:
            break;
          case AdminCommandConstant.CMD_INVOKE_STATIC:
            Object result = invokeStaticMethod(request.getProp());
            if (result != null) {
              replyProp = new Properties();
              if (result instanceof Object[]) {
                replyProp.setProperty(AdminCommandConstant.INVOKE_METHOD_RESULT,
                    Arrays.toString((Object[]) result));
              } else {
                replyProp.setProperty(AdminCommandConstant.INVOKE_METHOD_RESULT, result.toString());
              }
            }
            break;

          default:
            throw new Exception("Bad command : \"" + AdminCommandConstant.commandNames[request.getCommand()] + "\"");
          }
          distributeReply(replyTo, requestMsgId, new AdminCommandReply(true,
              AdminCommandConstant.commandNames[request.getCommand()] + " done.", replyProp));
        } catch (Exception exc) {
          if (logger.isLoggable(BasicLevel.WARN))
            logger.log(BasicLevel.WARN, "", exc);
          distributeReply(replyTo, requestMsgId, new AdminReply(false, exc.toString()));
        }
      } else {
        // Forward the request to the right AdminTopic agent.
        forward(getDefault(targetId.getTo()), new FwdAdminRequestNot(request, replyTo, requestMsgId));
      }
    } else {
      // Forward the request to the target.
      forward(targetId, new FwdAdminRequestNot(request, replyTo, requestMsgId, createMessageId()));
    }
View Full Code Here

TOP

Related Classes of fr.dyade.aaa.agent.AgentId

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.