Package org.rzo.yajsw.script

Examples of org.rzo.yajsw.script.Script


  {
    if (clusterScript != null && !"".equals(clusterScript))
    {
      List args = _config.getList("wrapper.windows.cluster.script.args", new ArrayList());
      int timeout = _config.getInt("wrapper.windows.cluster.script.timeout", 0);
      final Script script = ScriptFactory.createScript(clusterScript, "", this, args, getWrapperLogger(), timeout);
      if (script == null)
        return;
      try
      {
        Class clazz = this.getClass().getClassLoader().loadClass("org.rzo.yajsw.os.ms.win.w32.Cluster");
        _cluster = clazz.newInstance();
        _clusterListener = new ClusterNodeChangeListener()
        {
          public void nodeChanged()
          {
            script.execute();
          }
        };
        Method m = clazz.getMethod("addNodeChangeListener", ClusterNodeChangeListener.class);
        m.invoke(_cluster, _clusterListener);
      }
View Full Code Here


        String value = _config.getString(key);
        List args = _config.getList(key + ".args", new ArrayList());
        int timeout = _config.getInt(key + ".timeout", 0);

        String state = key.substring(key.lastIndexOf(".") + 1);
        final Script script = ScriptFactory.createScript(value, state, this, args, getWrapperLogger(), timeout);
        int iState = toIntState(state);
        if (iState >= 0 && script != null)
          addStateChangeListener(iState, new StateChangeListener()
          {

            public void stateChange(int newState, int oldState)
            {
              script.executeWithTimeout();
            }

          });
      }
    }
View Full Code Here

   *
   * @return the trigger script
   */
  private Object getTriggerScript(String script, String key, String[] args, int timeout)
  {
    final Script s = ScriptFactory.createScript(script, key, this, args, getWrapperLogger(), timeout);
    if (s == null)
    {
      this.getWrapperLogger().info("error initializing script " + script);
      return null;
    }
    this.getWrapperLogger().info("found script " + s.getScript());
    // final String id = key;

    return new TriggerAction()
    {
      public Object execute(final String line)
      {
        scriptExecutor.execute(new Runnable()
        {

          public void run()
          {
            AbstractWrappedProcess.this.getWrapperLogger().info("start script " + s.getScript());
            s.executeWithTimeout(new String(line));
            AbstractWrappedProcess.this.getWrapperLogger().info("end script " + s.getScript());
          }
        });
        return null;
      }
    };
View Full Code Here

    }
  }

  private long getRestartDelay()
  {
    Script script = getRestartDelayScript();
    if (script != null)
    {
      Object time = script.execute();
      if (time instanceof Number)
        return ((Number) time).longValue() * 1000;
    }
    return _config.getLong("wrapper.restart.delay", DEFAULT_RESTART_DELAY) * 1000;
  }
 
View Full Code Here

      try
      {
        Logger logger = new MyLogger();
        logger.addHandler(new ConsoleHandler());
        System.out.println("wrapped process: executing pre script " + preScript);
        Script script = ScriptFactory.createScript(preScript, "", null, new String[0], null, 0);
        if (script != null)
          script.execute();
        else
          System.out.println("wrapped process: executing pre script error: could not open script");
      }
      catch (Throwable ex)
      {
View Full Code Here

  private void executeShutdownScript()
  {
    if (shutdownScript != null & !"".equals(shutdownScript))
    {
      Script script = ScriptFactory.createScript(shutdownScript, "", null, new String[0], null, 0);
      if (script != null)
        script.execute();
    }

  }
View Full Code Here

    System.out.println("initializing wrapped process");
    ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(wrapperClassLoader);
    try
    {
      Script script = ScriptFactory.createScript(scriptFileName, "", null, (String[]) getMainMethodArgs(), null, 0);
      if (script != null)
        script.execute();
      else
        System.err.println("error opening script script: " + scriptFileName);
    }
    catch (Throwable ex)
    {
View Full Code Here

TOP

Related Classes of org.rzo.yajsw.script.Script

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.