Package org.rzo.yajsw.wrapper

Examples of org.rzo.yajsw.wrapper.WrappedService


      {
        if (_process == null)
        {
          try
          {
            WrappedService w = new WrappedService();
            w.init();
            w.start();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }
View Full Code Here


  }

  public boolean yajswInstall(String configuration)
  {
      WrappedService w = new WrappedService();
      Configuration c = w.getLocalConfiguration();
      c.setProperty("wrapper.config", configuration);
      w.init();
      return w.install();
  }
View Full Code Here

  private static WrappedService getService()
  {
    if (_service != null)
      return _service;
    prepareProperties();
    _service = new WrappedService();
    if (confFileList != null && confFileList.size() > 1)
      _service.setConfFilesList(confFileList);
    _service.setLocalConfiguration(new MapConfiguration(_properties));
    _service.init();
    return _service;
View Full Code Here

   * Do remove.
   */
  private static void doRemove()
  {
    prepareProperties();
    WrappedService w = getService();
    System.out.println("************* REMOVING " + w.getServiceName() + " ***********************");
    System.out.println();
    if (w.uninstall())
      System.out.println("Service " + w.getServiceName() + " removed");
    else
      System.out.println("Service " + w.getServiceName() + " NOT removed");

  }
View Full Code Here

  /**
   * Do install.
   */
  private static void doInstall()
  {
    WrappedService w = getService();
    System.out.println("************* INSTALLING " + w.getServiceName() + " ***********************");
    System.out.println();
    if (w.install())
      System.out.println("Service " + w.getServiceName() + " installed");
    else
      System.out.println("Service " + w.getServiceName() + " NOT installed");

  }
View Full Code Here

  /**
   * Do stop.
   */
  private static void doStop()
  {
    WrappedService w = getService();

    System.out.println("************* STOPPING " + w.getServiceName() + " ***********************");
    System.out.println();

    try
    {
      w.stop();
      if (w.isRunning())
        System.out.println("Service " + w.getServiceName() + " NOT stopped");
      else
        System.out.println("Service " + w.getServiceName() + " stopped");
    }
    catch (Exception e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

    }
  }

  private static void doStopPosix()
  {
    WrappedService w = getService();

    System.out.println("************* STOPPING " + w.getServiceName() + " ***********************");
    System.out.println();

    try
    {
      w.stopProcess();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    if (!w.isRunning())
    {
      System.out.println("Service " + w.getServiceName() + " stopped");
      _exitCode = 0;
      _exitOnTerminate = true;
    }
    else
    {
      System.out.println("Service" + w.getServiceName() + " NOT stopped");
      _exitCode = 1;
      _exitOnTerminate = true;
    }

  }
View Full Code Here

  /**
   * Do start.
   */
  private static void doStart()
  {
    WrappedService w = getService();
    // w.setDebug(true);
    w.init();

    System.out.println("************* STARTING " + w.getServiceName() + " ***********************");
    System.out.println();

    w.start();
    int i = 0;
    while (!w.isRunning() && i++ < 30)
    {
      try
      {
        Thread.sleep(1000);
      }
      catch (InterruptedException e)
      {
        e.printStackTrace();
        return;
      }
      if (!w.isStarting())
        break;
    }

    if (w.isRunning())
    {
      System.out.println("Service " + w.getServiceName() + " started");
      _exitCode = 0;
      _exitOnTerminate = true;
    }
    else
    {
      System.out.println("Service " + w.getServiceName() + " NOT started");
      _exitCode = 1;
      _exitOnTerminate = true;
    }

  }
View Full Code Here

  }

  private static void doStartPosix()
  {
    WrappedService w = getService();
    System.out.println("************* STARTING " + w.getServiceName() + " ***********************");
    System.out.println();

    w.startProcess();
    int i = 0;
    while (!w.isRunning() && i < 10)
    {
      i++;
      try
      {
        Thread.sleep(2000);
      }
      catch (InterruptedException e)
      {
        e.printStackTrace();
      }
    }
    if (w.isRunning())
      System.out.println("Service " + w.getServiceName() + " started");
    else
      System.out.println("Service " + w.getServiceName() + " NOT started");
    _exitOnTerminate = true;

  }
View Full Code Here

  }

  private static void doState()
  {
    prepareProperties();
    WrappedService w = getService();
    int state = w.state();
    System.out.print("Name        : ");
    System.out.println(w.getServiceName());
    System.out.print("Installed   : ");
    System.out.println(w.isInstalled(state));
    System.out.print("Running     : ");
    System.out.println(w.isRunning(state));
    System.out.print("Interactive : ");
    System.out.println(w.isInteractive(state));
    System.out.print("Automatic   : ");
    System.out.println(w.isAutomatic(state));
    System.out.print("Manual      : ");
    System.out.println(w.isManual(state));
    System.out.print("Disabled    : ");
    System.out.println(w.isDisabled(state));
    System.out.print("Paused      : ");
    System.out.println(w.isPaused(state));
    System.out.print("Unkown      : ");
    System.out.println(w.isStateUnknown(state));
  }
View Full Code Here

TOP

Related Classes of org.rzo.yajsw.wrapper.WrappedService

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.