Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.Value


    env.setGlobalValue("_quercus_bam_id", LongValue.create(id));
  }

  private void setError(Env env, BamError error)
  {
    Value errorValue = NullValue.NULL;
    if (error != null) {
      JavaClassDef errorClassDef = env.getJavaClassDefinition(BamError.class);
      errorValue = errorClassDef.wrap(env, error);
    }
View Full Code Here


      _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);
        */
 
View Full Code Here

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

  private static final StringValue SERVER_NAME
    = new ConstStringValue("SERVER_NAME");

  private static BamPhpActor getActor(Env env)
  {
    Value actorValue = env.getGlobalValue("_quercus_bam_actor");

    if (actorValue != null && ! actorValue.isNull())
      return (BamPhpActor) actorValue.toJavaObject();

    return null;
  }
View Full Code Here

    return connection;
  }

  private static BamPhpServiceManager getServiceManager(Env env)
  {
    Value managerValue = env.getGlobalValue("_quercus_bam_service_manager");

    if (managerValue != null && ! managerValue.isNull())
      return (BamPhpServiceManager) managerValue.toJavaObject();

    return null;
  }
View Full Code Here

        int i = 0;
        Iterator<Value> iterator = subject.getValueIterator(env);

        while (iterator.hasNext()) {
          Value subjectValue = iterator.next();

          if (! subjectValue.isString())
            return env.error("subject values must be strings");

          subjects[i++] = new Text(subjectValue.toString());
        }
      }
      else if (subject.isString()) {
        if (! subject.isString())
          return env.error("subject values must be strings");

        subjects = new Text[] { new Text(subject.toString()) };
      }
    }

    // extract body text
    Text[] bodies = null;

    if (body.isArray()) {
      bodies = new Text[body.getSize()];

      int i = 0;
      Iterator<Value> iterator = body.getValueIterator(env);

      while (iterator.hasNext()) {
        Value bodyValue = iterator.next();

        if (! bodyValue.isString())
          return env.error("body values must be strings");

        bodies[i++] = new Text(bodyValue.toString());
      }
    }
    else if (body.isString()) {
      if (! body.isString())
        return env.error("body values must be strings");
View Full Code Here

        env.setGlobalValue("_quercus_bam_function_return", BooleanValue.FALSE);

        return BooleanValue.FALSE;
      }

      Value address = env.getGlobalValue("_quercus_bam_service_address");
      Value ret = function.call(env, address);

      env.setGlobalValue("_quercus_bam_function_return", ret);

      return BooleanValue.TRUE;
    }

    // actor script dispatch

    Value eventTypeValue = env.getGlobalValue("_quercus_bam_event_type");

    if (eventTypeValue == null)
      return BooleanValue.FALSE;

    BamEventType eventType = (BamEventType) eventTypeValue.toJavaObject();

    Value to = env.getGlobalValue("_quercus_bam_to");
    Value from = env.getGlobalValue("_quercus_bam_from");
    Value value = env.getGlobalValue("_quercus_bam_value");

    AbstractFunction function = findFunction(env, eventType.getPrefix(), value);

    if (function == null) {
      log.fine(L.l("bam handler function not found for {0}", eventType));

      return BooleanValue.FALSE;
    }

    Value functionReturn = BooleanValue.FALSE;

    if (eventType.hasId() && eventType.hasError()) {
      Value id = env.getGlobalValue("_quercus_bam_id");
      Value error = env.getGlobalValue("_quercus_bam_error");

      functionReturn = function.call(env, id, to, from, value, error);
    }
    else if (! eventType.hasId() && eventType.hasError()) {
      Value error = env.getGlobalValue("_quercus_bam_error");

      functionReturn = function.call(env, to, from, value, error);
    }
    else if (eventType.hasId() && ! eventType.hasError()) {
      Value id = env.getGlobalValue("_quercus_bam_id");

      functionReturn = function.call(env, id, to, from, value);
    }
    else {
      functionReturn = function.call(env, to, from, value);
View Full Code Here

          int closeBracketIndex = key.indexOf(']');
          if (openBracketIndex > 0) {
            String arrayName = key.substring(0, openBracketIndex);
            arrayName = arrayName.replaceAll("\\.", "_");
           
            Value v = env.getVar(arrayName).getRawValue();
            if (v instanceof ArrayValue) {
              //Check to make sure valid string (ie: foo[...])
              if (closeBracketIndex < 0) {
                env.warning(L.l("invalid array {0}", key));
                return NullValue.NULL;
              }

              if (closeBracketIndex > openBracketIndex + 1) {
                String index = key
                    .substring(key.indexOf('[') + 1, key.indexOf(']'));
                v.put(env.createString(index), env.createString(value));
              } else {
                v.put(env.createString(value));
              }
            } else {
              Post.addFormValue(env, result, key,
                                new String[] { value }, isMagicQuotes);
            }
View Full Code Here

    if (valueStr == null)
      valueStr = "";
   
    int p;

    Value value = env.createString(valueStr);

    if ((p = key.indexOf('[')) > 0 && key.endsWith("]")) {
      String index = key.substring(p + 1, key.length() - 1);
      key = key.substring(0, p);

      Value keyValue = env.createString(key);

      Value part;

      if (array != null)
        part = array.get(keyValue);
      else
        part = env.getVar(key);

      if (! part.isArray())
        part = new ArrayValueImpl();

      if (index.equals(""))
        part.put(value);
      else
        part.put(env.createString(index), value);

      if (array != null)
        array.put(keyValue, part);
      else
        env.setVar(key, part);
View Full Code Here

  public static Value fprintf(Env env,
                              @NotNull BinaryOutput os,
                              StringValue format,
                              Value []args)
  {
    Value value = sprintf(env, format, args);

    return FileModule.fwrite(env, os, value.toInputStream(),
                             Integer.MAX_VALUE);
  }
View Full Code Here

TOP

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

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.