Examples of ServerControl


Examples of org.rhq.modules.plugins.jbossas7.ServerControl

        return AvailabilityType.UP;
    }

    @Override
    public BundleDeployResult deployBundle(BundleDeployRequest request) {
        ServerControl control = onServer(request);

        Result<Void> check = sanityCheck(control, request.getReferencedConfiguration(),
            request.getBundleManagerProvider(), request.getResourceDeployment(),
            !isTakeOver(request.getResourceDeployment().getBundleDeployment().getConfiguration()));

        if (check.failed()) {
            BundleDeployResult result = new BundleDeployResult();
            result.setErrorMessage(check.errorMessage);

            return result;
        }

        if (request.isRevert()) {
            return handleRevert(request);
        }

        BundleDeployResult result = new BundleDeployResult();

        ASConnection connection = new ASConnection(
            ASConnectionParams.createFrom(new ServerPluginConfiguration(request.getReferencedConfiguration())));

        ProcessExecutionResults results;
        BundleManagerProvider bmp = request.getBundleManagerProvider();
        BundleResourceDeployment rd = request.getResourceDeployment();

        Result<Boolean> stop = stopIfNeeded(connection, control,
            request.getResourceDeployment().getBundleDeployment().getConfiguration(), bmp, rd);
        if (stop.failed()) {
            result.setErrorMessage(stop.errorMessage);
            return result;
        }

        boolean startUp = stop.result;

        try {
            StringBuilder command = new StringBuilder("patch apply --path=").append(
                request.getPackageVersionFiles().values().iterator().next().getAbsolutePath());

            Configuration bundleConfig = request.getResourceDeployment().getBundleDeployment().getConfiguration();
            String override = bundleConfig.getSimpleValue("override");
            String overrideAll = bundleConfig.getSimpleValue("override-all");
            String preserve = bundleConfig.getSimpleValue("preserve");
            String overrideModules = bundleConfig.getSimpleValue("override-modules");

            if (override != null) {
                command.append(" --override=").append(override);
            }

            if (overrideAll != null) {
                command.append(" --override-all=").append(Boolean.valueOf(overrideAll));
            }

            if (preserve != null) {
                command.append(" --preserve=").append(preserve);
            }

            if (overrideModules != null) {
                command.append(" --override-modules=").append(overrideModules);
            }

            // as a last thing before the deployment, check the patch history
            Result<List<PatchDetails>> historyBeforeDeployment = getPatchHistory(control, "deploy");
            if (historyBeforeDeployment.failed()) {
                result.setErrorMessage(historyBeforeDeployment.errorMessage);
                return result;
            }

            results = control.cli().disconnected(true).executeCliCommand(command.toString());

            switch (handleExecutionResults(results, bmp, rd, true)) {
            case EXECUTION_ERROR:
                result
                    .setErrorMessage("Error while trying to execute patch command: " + results.getError().getMessage());
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ServerControl

    @Override
    public BundlePurgeResult purgeBundle(BundlePurgeRequest request) {
        BundlePurgeResult result = new BundlePurgeResult();

        ServerControl control = ServerControl.onServer(request.getReferencedConfiguration(),
            AS7Mode.valueOf(request.getDestinationTarget().getPath()), context.getSystemInformation());

        Result<Void> check = sanityCheck(control, request.getReferencedConfiguration(),
            request.getBundleManagerProvider(), request.getLiveResourceDeployment(), false);
        if (check.failed()) {
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ServerControl

        }

        ASConnection connection = new ASConnection(
            ASConnectionParams.createFrom(new ServerPluginConfiguration(request.getReferencedConfiguration())));

        ServerControl control = onServer(request);

        String errorMessage = rollbackPatches(control, request.getBundleManagerProvider(),
            request.getResourceDeployment(), connection, "revert", new ArrayList<String>(pidsToRollback));

        if (errorMessage != null) {
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

      System.out.println(details.getResult()==0?details.toString():i.toString());
    }
  }

  static void lookup(String did) throws IOException, InterruptedException, ServalDInterfaceException {
    MdpDnaLookup lookup = new ServerControl().getMdpDnaLookup(new ChannelSelector()new AsyncResult<ServalDCommand.LookupResult>() {
      @Override
      public void result(ServalDCommand.LookupResult nextResult) {
        System.out.println(nextResult.toString());
      }
    });
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

    Thread.sleep(3000);
    lookup.close();
  }

  static void service(String pattern) throws IOException, InterruptedException, ServalDInterfaceException {
    MdpServiceLookup lookup = new ServerControl().getMdpServiceLookup(new ChannelSelector(), new AsyncResult<MdpServiceLookup.ServiceResult>() {
      @Override
      public void result(MdpServiceLookup.ServiceResult nextResult) {
        System.out.println(nextResult.toString());
      }
    });
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

public class Meshms {

  static void meshms_list_conversations(SubscriberId sid) throws ServalDInterfaceException, IOException, InterruptedException
  {
    ServalDClient client = new ServerControl().getRestfulClient();
    MeshMSConversationList list = null;
    try {
      list = client.meshmsListConversations(sid);
      MeshMSConversation conv;
      while ((conv = list.nextConversation()) != null) {
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

    System.exit(0);
  }

  static void meshms_list_messages(SubscriberId sid1, SubscriberId sid2) throws ServalDInterfaceException, IOException, InterruptedException
  {
    ServalDClient client = new ServerControl().getRestfulClient();
    MeshMSMessageList list = null;
    try {
      list = client.meshmsListMessages(sid1, sid2);
      System.out.println("read_offset=" + list.getReadOffset());
      System.out.println("latest_ack_offset=" + list.getLatestAckOffset());
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

    System.exit(0);
  }

  static void meshms_list_messages_since(SubscriberId sid1, SubscriberId sid2, String token) throws ServalDInterfaceException, IOException, InterruptedException
  {
    ServalDClient client = new ServerControl().getRestfulClient();
    MeshMSMessageList list = null;
    try {
      list = client.meshmsListMessagesSince(sid1, sid2, token);
      MeshMSMessage msg;
      while ((msg = list.nextMessage()) != null) {
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

    System.exit(0);
  }

  static void meshms_send_message(SubscriberId sid1, SubscriberId sid2, String text) throws ServalDInterfaceException, IOException, InterruptedException
  {
    ServalDClient client = new ServerControl().getRestfulClient();
    try {
      MeshMSStatus status = client.meshmsSendMessage(sid1, sid2, text);
      System.out.println("" + status);
    }
    catch (MeshMSException e) {
View Full Code Here

Examples of org.servalproject.servaldna.ServerControl

    System.exit(0);
  }

  static void meshms_mark_all_conversations_read(SubscriberId sid1) throws ServalDInterfaceException, IOException, InterruptedException
  {
    ServalDClient client = new ServerControl().getRestfulClient();
    try {
      MeshMSStatus status = client.meshmsMarkAllConversationsRead(sid1);
      System.out.println("" + status);
    }
    catch (MeshMSException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.