Menu

Proxy classes don't have any of my methods?!

Help
Ken Melms
2008-11-14
2013-04-29
  • Ken Melms

    Ken Melms - 2008-11-14

    Hi again -

    I've gotten JACE building and linking, which is nice.  It also grinds out all the .h and .cpp files, which is nice.

    Maybe I'm being dense, but...

    These proxies being generated have exactly zero (0) of my Java methods in them.

    Their method lists are all exactly the same:

    public:

    /**
    * The following methods are required to integrate this class
    * with the Jace framework.
    *
    */
    TransporterClient( jvalue value );
    TransporterClient( jobject object );
    TransporterClient( const TransporterClient& object );
    TransporterClient( const NoOp& noOp );
    virtual const JClass* getJavaJniClass() const throw ( JNIException );
    static const JClass* staticGetJavaJniClass() throw ( JNIException );
    static JEnlister< TransporterClient> enlister;
    };

    The only change is the JEnlister<> call.

    My question then is.. How, oh HOW do I create a C++ TransporterClient proxy object and actually call the java methods?  There are no C++ -> Java proxy examples, nor do I seem to be able to find any luck on Google about this.

    When I point ProxyGenerator at my class file and debug step through the run, every one of my 26 methods is ignored through the test:

        if (!isPartOfDependencies(method))
          return;

    Which, in ProxyGenerator.main() is ALWAYS empty!!!

        ProxyGenerator generator = new ProxyGenerator(new ClassFile(args[0]), accessibility,
          Collections.<MetaClass>emptySet(), false);

    (Empty Set!!)

    So I'm lost.. How do I create a C++ proxy to my Java class?

    More importantly, what's the magic I need to provide to get these methods to appear for me?

    If the class uses  java <T> templates, will that throw JACE for a loop?

    K

     
    • Gili Tzabari

      Gili Tzabari - 2008-11-14

      I remember seeing a note about needing to add Generics support to Jace but I haven't gotten around to investigating it. I'll be busy in the next couple of days working on my actual job ;) but then I'll take a look for you.

      In the meantime, please investigate whether Jace is generating any proxy methods for non-Generics classes. If not, please tell me what command-line you're passing into AutoProxy.

      Thanks,
      Gili

       
    • Ken Melms

      Ken Melms - 2008-11-14

      Ok ..

      Figured that one out..

      It's a little weird.. But it works..

      I have to use AutoProxy, setting "-mindep" on, because otherwise "-deplist" is ignored..

      Then I added my classes that don't seem to get AutoProxied to the -deplist and POOF..

      So, if I read the code right, ProxyGenerator will NEVER add methods to the produced .h files, AutoProxy is required to finish the job off.

      Is this correct?

      What seems like magic to me is that some of my classes do work, yet some need this deplist shove in the right direction.

      K

       
      • Gili Tzabari

        Gili Tzabari - 2008-11-14

        You should never need to use -deplist.

        -mindep tells Jace to only generate proxies that your application depends on.
        -deplist is for when you don't know what your application depends on ahead of time (i.e. you're building proxies for a library)

        You code should work without -mindep or with -mindep but without -deplist. If not please let me know and we'll debug it further.

         
        • Ken Melms

          Ken Melms - 2008-11-18

          I see.

          But a library is exactly what I'm creating.

          I'm not trying to wrap up a Java application and allow interactions with C++ from it.

          I'm trying to make a "library" of Java object functionality that I can then allow C++ to use.

          So, every class I give to BatchGenerator must be proxied, as well as the dependent classes.

          No main() class.
          No threads (other than what dependent objects may create).
          No ClassLoaders.

          Just a C++ wrapper around my Java objects.

          Am I far off base?

          K

           
          • Gili Tzabari

            Gili Tzabari - 2008-11-18

            If you use -mindep it should be smart enough to pick up on your dependencies by examining the #include statements. For example, if you:

            #include "jace/java/lang/Class.h"
            #include "jace/java/lang/ClassLoader.h"

            then Jace will be smart enough to expose Class.getClassLoader() which returns type ClassLoader. You should only need to use -depList if user code will be interacting with the proxies directly as opposed to invoking your C++ code and your C++ code, in turn, talks to the proxies. In the latter case -mindep alone should be enough.

             
            • Ken Melms

              Ken Melms - 2008-11-18

              User code will indeed be accessing these proxies directly.

              My output is intended to be a Shared Library, linked dynamically to JACE, which others can then link dynamically to and use the Proxied java classes freely.

              Does this usage mean I should put all the classes in the API Jar on the -deplist line?

              K

               
              • Gili Tzabari

                Gili Tzabari - 2008-11-18

                Will users access the proxies for JDK classes directly or just your custom proxies? If the former, then yes you must specify all the relevant JDK classes on -depList.

                 
                • Ken Melms

                  Ken Melms - 2008-11-18

                  I'm trying another approach.

                  In my build script, I'm creating a "libsh.h" / "libsh.cpp" file on the fly, which contains nothing more than a simple main() and includes ALL the proxy .h files created by ProxyGenerator.

                  It looks like this tricks AutoProxy into generating all the methods and dependencies properly, I'll let you know how it works out.

                   
    • Ken Melms

      Ken Melms - 2008-11-14

      It certainly breaks without -mindep and -deplist

      But it breaks anyhow for other reasons I can't figure out......

      I've got my simple application ("Hello World").

      I've got a list of jar files I pass into the CreateVm method, Unixy colon separated (though I've tried  colon, comma, space, etc).  jace-runtime.jar is ONE of those jars, but not the first in the list.

      I can't find any of my classes.  I'm using Class::forName(), and it works if I ask for anything inside of "rt.jar", but any classes that should be in MY jars are lost.

      I am now passing "-verbose" to the VM to see when/where it loads from, and not a single one of my jar files are referenced in the run.  Only "rt.jar" classes are available to me.

      When I createVm - the VM properly finds "jace.util.ShutdownHook" in the jar, as evidenced by the line:

      [Loaded jace.util.ShutdownHook from file:/jace/jace-snap/release/lib/jace-runtime.jar]

      But immediately thereafter, if I call 'Class::forName("jace.util.ShutdownHook")' -- it bombs out with a "ClassNotFound" exception.

      So I guess what I'm angling at here is -- what magic do I need to actually use Class::forName() properly?  Failing that.. If I need a "ObjectThing.class" reference to pass into a proxied class -- what do I do to get that class?

      I feel like there's something wrong with my VM initialization, since Jace can find its class, register the hook, and return - but I can't.

      here it is:
      <... snipped includes ...>

      // Read all jars from the /home/kens/ClientLib and append them to the classpath, then run it.
      int main(int argc, char *argv[])
      {
          vector <string> files;
          string s;
          DIR *dp;
          struct dirent *dirp;
          char *dir = "/home/kens/ClientLib/";
          if((dp  = opendir(dir)) == NULL) {
              cout << "Error(" << errno << ") opening " << dir << endl;
              return errno;
          }

          s.append(":.");
          while ((dirp = readdir(dp)) != NULL) {
              files.push_back(string(dirp->d_name));
              s.append(":");
              s.append(dir);
              s.append(dirp->d_name);
          }
          closedir(dp);

        
       
        try
        {
          UnixVmLoader loader("/opt/java/current/jre/lib/amd64/server/libjvm.so", JNI_VERSION_1_6 );
          OptionList list;
        
          // Putting jace-runtime second to see if it only recognizes first jar.
          string classpath = string("/home/kens/ClientLib/Core_client.jar:/home/jace/jace-snap/release/lib/jace-runtime.jar");
          classpath += s;
          cerr << classpath;
          list.push_back( jace::ClassPath(classpath));
          list.push_back( jace::CustomOption("-Djava.library.path=/jace/jace-snap/release/lib/linux/gcc" ) );
      //     list.push_back( jace::CustomOption( "-Xcheck:jni" ) );
           list.push_back( jace::CustomOption( "-verbose" ) );
          jace::helper::createVm( loader, list, false );
        } catch ( IOException& ioe ) {
          cerr << ioe << endl;
          cerr << "\n";
          return -1;
        }
        
        Class c = Class::forName("java.lang.String");
        Class f = Class::forName("jace.util.ShutdownHook"); // CRASH - ClassNotFound -- see below
        Class g = Class::forName("com.kens.class.Client"); // CRASH - ClassNotFound

      }

      terminate called after throwing an instance of 'jace::proxy::java::lang::ClassNotFoundException'
        what():  java.lang.ClassNotFoundException: jace/util/ShutdownHook

      Me brain hurts...

      What am I missing oh zen cow?

      K

       
    • Ken Melms

      Ken Melms - 2008-11-14

      Ow my brain...

      If I do this:
        TransporterClient tc = jace::java_cast<TransporterClient>(TransporterClient::createTransporterClient(host, MediaDirectoryRemote().getClass()));

      I see this:

      [Loaded com.espn.marcus.media.ejb.MediaDirectoryRemote from file:/home/kens/ClientLib/Core_client.jar]

      Followed immediately by a:

      terminate called after throwing an instance of 'jace::proxy::java::lang::NullPointerException'
        what():  java.lang.NullPointerException

      But if I do this:

      Class g = Class::forName("kens.client.TransporterClient");

      I get this:

      terminate called after throwing an instance of 'jace::proxy::java::lang::ClassNotFoundException'
      what(): java.lang.ClassNotFoundException: kens/client/TransporterClient

      I've verified the class is indeed in the jar file, and the class is indeed loadable -- I use it in my Java apps all the time..

      It's like Class::forName() doesn't use the appropriate Classloader, and I don't know what to do about that.  It can SOMETIMES find my classes, but usually not.  It's never even shown that it's tried to load TransporterClient at all.

      I'm dangerously close to abandoning JACE, as my project is slipping..

      :(

      K

       
      • Gili Tzabari

        Gili Tzabari - 2008-11-14

        I was going to suggest this earlier but wasn't sure until your last post... I was under the impression you were running a normal Java application (i.e. no funky ClassLoaders).

        You should take a look at JNIHelper::setClassLoader(). The documentation reads:

        /**
        * Sets the ClassLoader to be used by the current thread.
        *
        * By default, Jace uses the JNIEnv->FindClass() to load classes,
        * but if a thread ClassLoader is defined then it is used to load
        * classes instead. A thread ClassLoader must be defined under
        * Java Webstart, Applets or any other framework that makes use
        * of custom ClassLoaders to load classes.
        *
        * NOTE: You must setClassLoader( 0 ) to release the ClassLoader
        *       reference or detach() will do it for you on thread shutdown.
        */

         
        • Ken Melms

          Ken Melms - 2008-11-18

          I don't actually define any ClassLoader.
          I was just saying that it acts like JACE was since it can find some classes sometimes..

          I am not actually running a Java Application.  I am trying to use JACE Proxies to integrate C++ such that I can use my Java objects, which then make remote calls to my J2EE server.  That's the big thing I need to get working.

          What is burning my noodle is that:

          Class foo = Class::forName("jace.util.ShutdownHook");

          fails with NoClassDef -

          But tracing JACE, I see it calling "JNIEnv->findClass("jace/util/ShutdownHook") and it succeeds.

          while:

          Class foo = Class::forName("java.lang.String");

          Succeeds.

          The difference? 
          One uses the JNIEnv*->FindClass(), the other uses JNI To invoke the static "Class.forName()"

          If I do this:
            jclass jc = env->FindClass("jace/util/ShutdownHook");

          It succeeds as well.

          So ... What can be getting in the way of :

          Class foo = Class::forName("jace.util.ShutdownHook");

          Any ideas?

          K

           
          • Gili Tzabari

            Gili Tzabari - 2008-11-18

            FindClass() uses the System ClassLoader. Class::forName() uses the thread-context ClassLoader. Try this instead:

            Class::forName("jace.util.ShutdownHook", true, ClassLoader::getSystemClassLoader());

             
            • Ken Melms

              Ken Melms - 2008-11-18

              Hmm...

              As with most of these proxied classes, This class, as read from "jace/proxy/java/lang/ClassLoader.h" has no proxied methods.

              It looks just like the classes I was trying to proxy, but I had to add them to the "-deplist" to get true methods out of them.

              Could it be that JACE is just tragically broken on Linux x64 such that it can't even properly parse and create proxies?  I walked through debugging the proxygen program, and it seems to aggressively trim out methods it doesn't like here:

              ProxyGenerator.java:1239
                   if (!isPartOfDependencies(method))
                       return;

              You say I shouldn't need -deplist, yet I can't seem to get my classes to get their proxies fleshed out unless I do.  Maybe this is the error, and all the rest of this is a red herring?

              I'll paste below the ClassLoader.h file, which you'll notice is simply the bare bones ProxyGen output -- which is what SEEMS to be the case on 9/10 of the classes I need to proxy unless I explicitly add them to -deplist.

              ---------- ClassLoader.h ----------

              #ifndef JACE_PROXY_JAVA_LANG_CLASSLOADER_H
              #define JACE_PROXY_JAVA_LANG_CLASSLOADER_H

              #ifndef JACE_OS_DEP_H
              #include "jace/os_dep.h"
              #endif

              #ifndef JACE_NAMESPACE_H
              #include "jace/namespace.h"
              #endif

              #ifndef JACE_JOBJECT_H
              #include "jace/proxy/JObject.h"
              #endif

              #ifndef JACE_JENLISTER_H
              #include "jace/JEnlister.h"
              #endif

              #ifndef JACE_JARRAY_H
              #include "jace/JArray.h"
              #endif

              #ifndef JACE_JFIELD_PROXY_H
              #include "jace/JFieldProxy.h"
              #endif

              /**
              * The super class for this class.
              *
              */
              #ifndef JACE_PROXY_JAVA_LANG_OBJECT_H
              #include "jace/proxy/java/lang/Object.h"
              #endif

              /**
              * Forward declarations for the classes that this class uses.
              *
              */
              BEGIN_NAMESPACE_4( jace, proxy, java, lang )

              /**
              * The Jace C++ proxy class for java/lang/ClassLoader.
              * Please do not edit this class, as any changes you make will be overwritten.
              * For more information, please refer to the Jace Developer's Guide.
              *
              */
              class ClassLoader : public virtual ::jace::proxy::java::lang::Object {

              public:

              /**
              * The following methods are required to integrate this class
              * with the Jace framework.
              *
              */
              ClassLoader( jvalue value );
              ClassLoader( jobject object );
              ClassLoader( const ClassLoader& object );
              ClassLoader( const NoOp& noOp );
              virtual const JClass* getJavaJniClass() const throw ( JNIException );
              static const JClass* staticGetJavaJniClass() throw ( JNIException );
              static JEnlister< ClassLoader> enlister;
              };

              END_NAMESPACE_4( jace, proxy, java, lang )

              BEGIN_NAMESPACE( jace )

              #ifndef PUT_TSDS_IN_HEADER
                template <> ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( jarray array, jvalue element, int in
              dex );
                template <> ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( const jace::ElementProxy< ::jace::pr
              oxy::java::lang::ClassLoader>& proxy );
              #else
                template <> inline ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( jarray array, jvalue element,
              int index ) :
                  ::jace::proxy::java::lang::ClassLoader( element ), Object( NO_OP ), mIndex( index ) {
                  JNIEnv* env = ::jace::helper::attach();
                  parent = static_cast<jarray>( ::jace::helper::newGlobalRef( env, array ) );
                }
                template <> inline ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( const jace::ElementProxy< ::j
              ace::proxy::java::lang::ClassLoader>& proxy ) :
                  ::jace::proxy::java::lang::ClassLoader( proxy.getJavaJniObject() ), Object( NO_OP ), mIndex( proxy.mIndex ) {
                  JNIEnv* env = ::jace::helper::attach();
                  parent = static_cast<jarray>( ::jace::helper::newGlobalRef( env, proxy.parent ) );
                }
              #endif

              #ifndef PUT_TSDS_IN_HEADER
                template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value, jobje
              ct parent_ );
                template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value, jclas
              s parentClass_ );
                template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( const ::jace::JFieldProxy< ::jace::pro
              xy::java::lang::ClassLoader>& object );
              #else
                template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value
              , jobject parent_ ) :
                  ::jace::proxy::java::lang::ClassLoader( value ), Object( NO_OP ), fieldID( fieldID_ ) {
                  JNIEnv* env = ::jace::helper::attach();

                  if ( parent_ ) {
                    parent = ::jace::helper::newGlobalRef( env, parent_ );
                  }
                  else {
                    parent = parent_;
                  }

                  parentClass = 0;
                }
                template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value
              , jclass parentClass_ ) :
                  ::jace::proxy::java::lang::ClassLoader( value ), Object( NO_OP ), fieldID( fieldID_ ) {
                  JNIEnv* env = ::jace::helper::attach();

                  parent = 0;
                  parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, parentClass_ ) );
                }
                template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( const ::jace::JFieldProxy< ::ja
              ce::proxy::java::lang::ClassLoader>& object ) :
                  ::jace::proxy::java::lang::ClassLoader( object.getJavaJniValue() ), Object( NO_OP ) {

                  fieldID = object.fieldID;

                  if ( object.parent ) {
                    JNIEnv* env = ::jace::helper::attach();
                    parent = ::jace::helper::newGlobalRef( env, object.parent );
                  }
                  else {
                    parent = 0;
                  }

                  if ( object.parentClass ) {
                    JNIEnv* env = ::jace::helper::attach();
                    parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, object.parentClass ) );
                  }
                  else {
                    parentClass = 0;
                  }
                }
              #endif

              END_NAMESPACE( jace )

              #endif // #ifndef JACE_PROXY_JAVA_LANG_CLASSLOADER_H

               
            • Ken Melms

              Ken Melms - 2008-11-18

              Ok !

              Now that ClassLoader is being proxied properly, this method actually works.

              It was a red herring I guess - because I still can not get my head around why FindClass() uses a AppClassLoader -- with ALL the jar files I added to my VM at startup, yet Class.forName() uses the ExtClassLoader (AppClassLoader's parent) - which has only the Ext classes and rt.jar..

              Regardless, I can now properly call Class::forName() which is nice!  Thanks!!

              I'm also now properly generating proxy classes for ALL of my library API classes.. Awesome!

              Now on to figuring out why making a static call to one of those class' factory methods is causing a NullPointerException.  NPE is better than CNF!!

              K

               
            • Ken Melms

              Ken Melms - 2008-11-18

              As I said -- this works.

              What I'm working through right now is -- how do we make this "sticky" ??
              I was trying this:

                ClassLoader cl = jace::proxy::java::lang::ClassLoader::getSystemClassLoader();
                jace::helper::setClassLoader(cl.getJavaJniObject());
                Class f = Class::forName("jace.util.ShutdownHook");

              Thinking it would set a default ClassLoader, which would be able to find all the classes.. But it doesn't.  It bombs out with a ClassNotFound.

              This works:

              Class::forName("jace.util.ShutdownHook", true, ClassLoader::getSystemClassLoader());

              But when I initiate a new Object to be created, and it needs to load.. And those objects being loaded may use "Class.forName()" internally.. How can I be assured the ClassLoader knows about all of my jar files I added to the Classpath?

              Every complex object I attempt to use explodes.  I can create the object, but I can't seem to use them.

              Any thoughts?

               
              • Gili Tzabari

                Gili Tzabari - 2008-11-18

                jace::helper::setClassLoader() indicates what ClassLoader Jace should use when looking up classes. It says nothing about what Java will use on its own end. In other words, you will need to use Class::forName(String, boolean, ClassLoader) if you want to use a specific ClassLoader. As the JDK documentation states, Class::forName() will simply use getClass().getClassLoader() as the 3rd argument. So once you load ShutdownHook with ClassLoader Foo, any time ShutdownHook invokes Class.forName() itself it will end up using the Foo ClassLoader again.

                In general you should be aware of the various kinds of ClassLoaders: http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load.html

                Try setting the thread context ClassLoader. Maybe the code that is breaking depends on it :)

                 
                • Ken Melms

                  Ken Melms - 2008-11-19

                  Actually...

                  Oddly...

                  I refuse to believe it to be true, but it must because I can't deny it ....

                  IT WORKS..

                  My proxy classes are FINALLY able to reach through JACE and manipulate the Java VM..

                  Thanks a TON, Gili.

                  I do have 1 more problem maybe you can help with:  when I exit my main(), the application never exits with me.  I have to kill -9 every time.  I've tried shutting down the VM - but it seems some other thread is holding me alive in memory.  I don't create any threads, so any ideas there?  I do jace::helper::detach() before I exit.

                  In return, as promised, I will get the Examples working on Linux and feed you any changes I make to do it.  Do you have any interest in the Ant scripts, the automatic (Shared Library) Makefile creator, or the script that I use to gather up all the .h's into a single .h for JACE to AutoProxy on?  I'll gladly make them available.

                  I also think I might be able to beef up some of the documentation a little here and there for Proxy users.

                  Now that I got this working in Linux, I will be around JACE for a while as  I'll be tasked  with making my project/JACE cleverly create either .DLL/.SO or .LIBS depending on the build environment  and flags.

                  We need to deploy on both M$, and UN*X, but 64bit Un*x was more of an unknown, so until I could prove it can be done there, I couldn't move to another platform.

                   
    • Ken Melms

      Ken Melms - 2008-11-18

      And for further info, if I add java.lang.ClassLoader to the -deplist, I get this, far more substantial, header:

      -------- ClassLoader.h : as part of -deplist -------

      #ifndef JACE_PROXY_JAVA_LANG_CLASSLOADER_H
      #define JACE_PROXY_JAVA_LANG_CLASSLOADER_H

      #ifndef JACE_OS_DEP_H
      #include "jace/os_dep.h"
      #endif

      #ifndef JACE_NAMESPACE_H
      #include "jace/namespace.h"
      #endif

      #ifndef JACE_JOBJECT_H
      #include "jace/proxy/JObject.h"
      #endif

      #ifndef JACE_JENLISTER_H
      #include "jace/JEnlister.h"
      #endif

      #ifndef JACE_JARRAY_H
      #include "jace/JArray.h"
      #endif

      #ifndef JACE_JFIELD_PROXY_H
      #include "jace/JFieldProxy.h"
      #endif

      /**
      * The super class for this class.
      *
      */
      #ifndef JACE_PROXY_JAVA_LANG_OBJECT_H
      #include "jace/proxy/java/lang/Object.h"
      #endif

      /**
      * Forward declarations for the classes that this class uses.
      *
      */
      BEGIN_NAMESPACE_4( jace, proxy, java, lang )
      class Class;
      END_NAMESPACE_4( jace, proxy, java, lang )

      BEGIN_NAMESPACE_4( jace, proxy, java, lang )
      class String;
      END_NAMESPACE_4( jace, proxy, java, lang )

      BEGIN_NAMESPACE_4( jace, proxy, java, util )
      class Enumeration;
      END_NAMESPACE_4( jace, proxy, java, util )

      BEGIN_NAMESPACE_4( jace, proxy, java, io )
      class IOException;
      END_NAMESPACE_4( jace, proxy, java, io )

      BEGIN_NAMESPACE_4( jace, proxy, java, io )
      class InputStream;
      END_NAMESPACE_4( jace, proxy, java, io )

      BEGIN_NAMESPACE_3( jace, proxy, types )
      class JVoid;
      END_NAMESPACE_3( jace, proxy, types )

      BEGIN_NAMESPACE_3( jace, proxy, types )
      class JBoolean;
      END_NAMESPACE_3( jace, proxy, types )

      BEGIN_NAMESPACE_4( jace, proxy, java, lang )

      /**
      * The Jace C++ proxy class for java/lang/ClassLoader.
      * Please do not edit this class, as any changes you make will be overwritten.
      * For more information, please refer to the Jace Developer's Guide.
      *
      */
      class ClassLoader : public virtual ::jace::proxy::java::lang::Object {
      public:

      /**
      * loadClass
      *
      */
      ::jace::proxy::java::lang::Class loadClass( ::jace::proxy::java::lang::String p0 );

      /**
      * getResources
      *
      */
      ::jace::proxy::java::util::Enumeration getResources( ::jace::proxy::java::lang::String p0 );

      /**
      * getSystemResources
      *
      */
      static ::jace::proxy::java::util::Enumeration getSystemResources( ::jace::proxy::java::lang::String p0 );

      /**
      * getResourceAsStream
      *
      */
      ::jace::proxy::java::io::InputStream getResourceAsStream( ::jace::proxy::java::lang::String p0 );

      /**
      * getSystemResourceAsStream
      *
      */
      static ::jace::proxy::java::io::InputStream getSystemResourceAsStream( ::jace::proxy::java::lang::String p0 );

      /**
      * getParent
      *
      */
      ::jace::proxy::java::lang::ClassLoader getParent();

      /**
      * getSystemClassLoader
      *
      */
      static ::jace::proxy::java::lang::ClassLoader getSystemClassLoader();

      /**
      * setDefaultAssertionStatus
      *
      */
      void setDefaultAssertionStatus( ::jace::proxy::types::JBoolean p0 );

      /**
      * setPackageAssertionStatus
      *
      */
      void setPackageAssertionStatus( ::jace::proxy::java::lang::String p0, ::jace::proxy::types::JBoolean p1 );

      /**
      * setClassAssertionStatus
      *
      */
      void setClassAssertionStatus( ::jace::proxy::java::lang::String p0, ::jace::proxy::types::JBoolean p1 );

      /**
      * clearAssertionStatus
      *
      */
      void clearAssertionStatus();

      /**
      * The following methods are required to integrate this class
      * with the Jace framework.
      *
      */
      ClassLoader( jvalue value );
      ClassLoader( jobject object );
      ClassLoader( const ClassLoader& object );
      ClassLoader( const NoOp& noOp );
      virtual const JClass* getJavaJniClass() const throw ( JNIException );
      static const JClass* staticGetJavaJniClass() throw ( JNIException );
      static JEnlister< ClassLoader> enlister;
      };

      END_NAMESPACE_4( jace, proxy, java, lang )

      BEGIN_NAMESPACE( jace )

      #ifndef PUT_TSDS_IN_HEADER
        template <> ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( jarray array, jvalue element, int in
      dex );
        template <> ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( const jace::ElementProxy< ::jace::pr
      oxy::java::lang::ClassLoader>& proxy );
      #else
        template <> inline ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( jarray array, jvalue element,
      int index ) :
          ::jace::proxy::java::lang::ClassLoader( element ), Object( NO_OP ), mIndex( index ) {
          JNIEnv* env = ::jace::helper::attach();
          parent = static_cast<jarray>( ::jace::helper::newGlobalRef( env, array ) );
        }
        template <> inline ElementProxy< ::jace::proxy::java::lang::ClassLoader>::ElementProxy( const jace::ElementProxy< ::j
      ace::proxy::java::lang::ClassLoader>& proxy ) :
          ::jace::proxy::java::lang::ClassLoader( proxy.getJavaJniObject() ), Object( NO_OP ), mIndex( proxy.mIndex ) {
          JNIEnv* env = ::jace::helper::attach();
          parent = static_cast<jarray>( ::jace::helper::newGlobalRef( env, proxy.parent ) );
        }
      #endif

      #ifndef PUT_TSDS_IN_HEADER
        template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value, jobje
      ct parent_ );
        template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value, jclas
      s parentClass_ );
        template <> JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( const ::jace::JFieldProxy< ::jace::pro
      xy::java::lang::ClassLoader>& object );
      #else
        template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value
      , jobject parent_ ) :
          ::jace::proxy::java::lang::ClassLoader( value ), Object( NO_OP ), fieldID( fieldID_ ) {
          JNIEnv* env = ::jace::helper::attach();

          if ( parent_ ) {
            parent = ::jace::helper::newGlobalRef( env, parent_ );
          }
          else {
            parent = parent_;
          }

          parentClass = 0;
        }
        template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value
      , jclass parentClass_ ) :
          ::jace::proxy::java::lang::ClassLoader( value ), Object( NO_OP ), fieldID( fieldID_ ) {
          JNIEnv* env = ::jace::helper::attach();

          parent = 0;
          parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, parentClass_ ) );
        }
        template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( const ::jace::JFieldProxy< ::ja
      ce::proxy::java::lang::ClassLoader>& object ) :
          ::jace::proxy::java::lang::ClassLoader( object.getJavaJniValue() ), Object( NO_OP ) {

          fieldID = object.fieldID;

          if ( object.parent ) {
            JNIEnv* env = ::jace::helper::attach();
            parent = ::jace::helper::newGlobalRef( env, object.parent );
          }
          else {
            parent = 0;
          }

          if ( object.parentClass ) {
            JNIEnv* env = ::jace::helper::attach();
            parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, object.parentClass ) );
          }
          else {
            parentClass = 0;
        }
        template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( jfieldID fieldID_, jvalue value
      , jclass parentClass_ ) :
          ::jace::proxy::java::lang::ClassLoader( value ), Object( NO_OP ), fieldID( fieldID_ ) {
          JNIEnv* env = ::jace::helper::attach();

          parent = 0;
          parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, parentClass_ ) );
        }
        template <> inline JFieldProxy< ::jace::proxy::java::lang::ClassLoader>::JFieldProxy( const ::jace::JFieldProxy< ::ja
      ce::proxy::java::lang::ClassLoader>& object ) :
          ::jace::proxy::java::lang::ClassLoader( object.getJavaJniValue() ), Object( NO_OP ) {

          fieldID = object.fieldID;

          if ( object.parent ) {
            JNIEnv* env = ::jace::helper::attach();
            parent = ::jace::helper::newGlobalRef( env, object.parent );
          }
          else {
            parent = 0;
          }

          if ( object.parentClass ) {
            JNIEnv* env = ::jace::helper::attach();
            parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, object.parentClass ) );
          }
          else {
            parentClass = 0;
          }
        }
      #endif

      END_NAMESPACE( jace )

      #endif // #ifndef JACE_PROXY_JAVA_LANG_CLASSLOADER_H

       

Log in to post a comment.

MongoDB Logo MongoDB