Package com.caucho.quercus.program

Examples of com.caucho.quercus.program.JavaClassDef$JavaEntry


    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


  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);
    }

    env.setGlobalValue("_quercus_bam_error", errorValue);
  }
View Full Code Here

  {
    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

  /**
   * Adds a java class
   */
  public JavaClassDef getJavaClassDefinition(Class<?> type, String className)
  {
    JavaClassDef def;

    if (_classNotFoundCache.get(className) != null)
      return null;

    def = _javaClassWrappers.get(className);

    if (def == null) {
      try {
        def = getModuleContext().getJavaClassDefinition(type, className);

        int id = getClassId(className);
        _classDefMap[id] = def;

        _javaClassWrappers.put(className, def);
      } catch (RuntimeException e) {
        throw e;
      } catch (Exception e) {
        throw new QuercusRuntimeException(e);
      }
    }

    def.init();

    return def;
  }
View Full Code Here

  /**
   * Adds a java class
   */
  public JavaClassDef getJavaClassDefinition(String className)
  {
    JavaClassDef def;

    if (_classNotFoundCache.get(className) != null)
      return null;

    def = _javaClassWrappers.get(className);

    if (def == null) {
      try {
        def = getModuleContext().getJavaClassDefinition(className);

        _javaClassWrappers.put(className, def);
      } catch (RuntimeException e) {
        _classNotFoundCache.put(className, className);

        throw e;
      } catch (Exception e) {
        throw new QuercusRuntimeException(e);
      }
    }

    def.init();

    return def;
  }
View Full Code Here

  private void initClasses()
  {
    for (Map.Entry<String,JavaClassDef> entry
           : _moduleContext.getWrapperMap().entrySet()) {
      String name = entry.getKey();
      JavaClassDef def = entry.getValue();

      _javaClassWrappers.put(name, def);
      _lowerJavaClassWrappers.put(name.toLowerCase(Locale.ENGLISH), def);
    }
View Full Code Here

           InvocationTargetException,
           IllegalAccessException,
           InstantiationException
  {
    synchronized (_javaClassWrappers) {
      JavaClassDef def = _javaClassWrappers.get(name);

      if (def == null) {
        if (log.isLoggable(Level.FINEST)) {
          if (extension == null)
            log.finest(L.l("PHP loading class {0} with type {1}",
                           name,
                           type.getName()));
          else
            log.finest(L.l(
              "PHP loading class {0} with type {1} providing extension {2}",
              name,
              type.getName(),
              extension));
      }

      if (javaClassDefClass != null) {
        Constructor<?> constructor
          = javaClassDefClass.getConstructor(ModuleContext.class,
                                             String.class,
                                             Class.class);

        def = (JavaClassDef) constructor.newInstance(this, name, type);
      }
      else {
        def = JavaClassDef.create(this, name, type);

        if (def == null)
          def = createDefaultJavaClassDef(name, type, extension);
      }

      def.setPhpClass(true);

      _javaClassWrappers.put(name, def);
      // _lowerJavaClassWrappers.put(name.toLowerCase(Locale.ENGLISH), def);

      _staticClasses.put(name, def);
View Full Code Here

  /**
   * Gets or creates a JavaClassDef for the given class name.
   */
  public JavaClassDef getJavaClassDefinition(Class<?> type, String className)
  {
    JavaClassDef def;
   
    synchronized (_javaClassWrappers) {
      def = _javaClassWrappers.get(className);
  
      if (def != null && def.getType() == type)
        return def;
     
      def = JavaClassDef.create(this, className, type);

      if (def == null)
View Full Code Here

    // Note, this method must not trigger an introspection to avoid
    // any race conditions.  It is only responsible for creating the
    // wrapper around the class, i.e. it's a leaf node, not a recursive not

    synchronized (_javaClassWrappers) {
      JavaClassDef def = _javaClassWrappers.get(className);

//      boolean isClassActive = true;
//      ClassLoader cl = def.getType().getClassLoader();
//      if ( cl instanceof OSGiJarClassLoader ) {
//        isClassActive = ((OSGiJarClassLoader) cl).isEnabled();
View Full Code Here

                                                   Class type)
  {
    if (type.isArray())
      return new JavaArrayClassDef(this, className, type);
    else
      return new JavaClassDef(this, className, type);
  }
View Full Code Here

TOP

Related Classes of com.caucho.quercus.program.JavaClassDef$JavaEntry

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.