Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.Env


    }
  }

  public boolean stopActor(String address)
  {
    Env env = null;
    boolean stoped = false;

    try {
      QuercusPage page = _quercus.parse(_script);
      env = createEnv(page, "_quercus_bam_stop_service", address);
      page.executeTop(env);

      stoped = env.getGlobalValue("_quercus_bam_function_return").toBoolean();
    }
    finally {
      if (env != null)
        env.close();

      return stoped;
    }
  }
View Full Code Here


  private Env createEnv(QuercusPage page, String type, String address)
  {
    WriteStream out = new NullWriteStream();

    Env env = new Env(_quercus, page, out, null, null);
    env.start();

    JavaClassDef actorClassDef =
      env.getJavaClassDefinition(BamPhpServiceManager.class);

    env.setGlobalValue("_quercus_bam_service_manager",
                       actorClassDef.wrap(env, this));
    env.setGlobalValue(type, BooleanValue.TRUE);
    env.setGlobalValue("_quercus_bam_service_address", StringValue.create(address));

    return env;
  }
View Full Code Here

  }

  @Override
  public void message(String to, String from, Serializable value)
  {
    Env env = createEnv(_page, BamEventType.MESSAGE, to, from, value);

    try {
      _page.executeTop(env);
    }
    finally {
      env.close();
    }
  }
View Full Code Here

  @Override
  public void messageError(String to, String from, Serializable value,
                           BamError error)
  {
    Env env = createEnv(_page, BamEventType.MESSAGE_ERROR, to, from, value);

    try {
      setError(env, error);

      _page.executeTop(env);
    }
    finally {
      env.close();
    }
  }
View Full Code Here

    // XXX move to override of introspected method
    if (value instanceof DiscoInfoQuery)
      eventType = BamEventType.GET_DISCO_FEATURES;

    Env env = createEnv(_page, eventType, to, from, value);
    boolean understood = false;

    try {
      setId(env, id);

      _page.executeTop(env);

      if (eventType == BamEventType.GET_DISCO_FEATURES) {
        _featureNames.clear();

        Value returnValue = env.getGlobalValue("_quercus_bam_function_return");

        if (returnValue.isArray()) {
          _featureNames =
            (ArrayList) returnValue.toJavaList(env, ArrayList.class);
        }

        /*
        understood = handleDiscoInfoQuery(id, to, from, (DiscoInfoQuery) value);
        */
      }
      else {
        understood =
          env.getGlobalValue("_quercus_bam_function_return").toBoolean();
      }
    }
    finally {
      env.close();
    }
  }
View Full Code Here

  */

  @Override
  public void queryResult(long id, String to, String from, Serializable value)
  {
    Env env = createEnv(_page, BamEventType.QUERY_RESULT, to, from, value);

    try {
      setId(env, id);

      _page.executeTop(env);
    }
    finally {
      env.close();
    }
  }
View Full Code Here

  @Override
  public void queryError(long id, String to, String from,
                         Serializable value, BamError error)
  {
    Env env = createEnv(_page, BamEventType.QUERY_ERROR, to, from, value);

    try {
      setId(env, id);
      setError(env, error);

      _page.executeTop(env);
    }
    finally {
      env.close();
    }
  }
View Full Code Here

  private Env createEnv(QuercusPage page, BamEventType type,
                        String to, String from, Serializable value)
  {
    WriteStream out = new NullWriteStream();

    Env env = new Env(_quercus, page, out, null, null);

    JavaClassDef actorClassDef = env.getJavaClassDefinition(BamPhpActor.class);
    env.setGlobalValue("_quercus_bam_actor", actorClassDef.wrap(env, this));

    env.start();

    JavaClassDef eventClassDef = env.getJavaClassDefinition(BamEventType.class);
    Value typeValue = eventClassDef.wrap(env, type);

    env.setGlobalValue("_quercus_bam_event_type", typeValue);

    env.setGlobalValue("_quercus_bam_to", StringValue.create(to));
    env.setGlobalValue("_quercus_bam_from", StringValue.create(from));

    Value javaValue = NullValue.NULL;

    if (value != null) {
      JavaClassDef classDef = env.getJavaClassDefinition(value.getClass());
      javaValue = classDef.wrap(env, value);
    }

    env.setGlobalValue("_quercus_bam_value", javaValue);

    return env;
  }
View Full Code Here

    // _broker.addBrokerListener(this);
  }

  public boolean startActor(String address)
  {
    Env env = null;
    boolean started = false;

    try {
      QuercusPage page = _quercus.parse(_script);
      env = createEnv(page, "_quercus_bam_start_service", address);
      page.executeTop(env);

      started = env.getGlobalValue("_quercus_bam_function_return").toBoolean();
    }
    finally {
      if (env != null)
        env.close();

      return started;
    }
  }
View Full Code Here

  {
    // XXX: Not sure why this dependency would be useful
    // Environment.addDependency(new Depend(path));

    if (path.canRead()) {
      Env env = new Env(this);

      Value result = FileModule.parse_ini_file(env, path, false);

      if (result instanceof ArrayValue) {
        ArrayValue array = (ArrayValue) result;
View Full Code Here

TOP

Related Classes of com.caucho.quercus.env.Env

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.