Package org.objectweb.joram.shared.admin

Examples of org.objectweb.joram.shared.admin.AdminReply


        helper.addService(request.getServerId(),
                          serviceNames[i],
                          serviceArgs[i]);
      }
      helper.commit();
      distributeReply(replyTo, msgId, new AdminReply(true, "Server added"));
      if (from == null) {
        broadcastRequest(request, request.getServerId(), replyTo, msgId);
      }
    } catch (ServerConfigHelper.ServerIdAlreadyUsedException exc) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "", exc);
      distributeReply(replyTo, msgId,
                      new AdminReply(AdminReply.SERVER_ID_ALREADY_USED, exc.getMessage()));
    } catch (Exception exc) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "", exc);
      distributeReply(replyTo, msgId,
                      new AdminReply(false, exc.toString()));
    }
  }
View Full Code Here


                         AgentId from) {
    try {
      ServerConfigHelper helper = new ServerConfigHelper(true);
      helper.removeServer(request.getServerId());
      distributeReply(replyTo, msgId,
                      new AdminReply(true, "Server removed"));
      if (from == null) {
        broadcastRequest(request, request.getServerId(), replyTo, msgId);
      }
    } catch (UnknownServerException exc) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "", exc);
      distributeReply(replyTo, msgId,
                      new AdminReply(AdminReply.UNKNOWN_SERVER, exc.getMessage()));
    } catch (Exception exc) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "", exc);
      distributeReply(replyTo, msgId,
                      new AdminReply(false, exc.toString()));
    }
  }
View Full Code Here

      PrintWriter out = new PrintWriter(baos);
      A3CML.toXML(a3cmlConfig, out);
      out.flush();
      baos.flush();
      baos.close();
      distributeReply(replyTo, msgId, new AdminReply(true, baos.toString()));
    } catch (Exception exc) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "", exc);
      distributeReply(replyTo, msgId, new AdminReply(false, exc.toString()));
    }
  }
View Full Code Here

          + ")   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));
      }
View Full Code Here

TOP

Related Classes of org.objectweb.joram.shared.admin.AdminReply

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.