[Jsmooth-cvs] jsmooth/skeletons/commonjava Makefile.win, 1.7, 1.8 SunJVMDLL.cpp, 1.1, 1.2 SunJVMDLL
Status: Beta
Brought to you by:
reyes
From: Rodrigo R. <re...@us...> - 2007-04-30 20:54:38
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10646/commonjava Modified Files: Makefile.win SunJVMDLL.cpp SunJVMDLL.h SunJVMLauncher.cpp SunJVMLauncher.h Log Message: Winservice DLL instanciation fix Index: SunJVMLauncher.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMLauncher.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** SunJVMLauncher.cpp 28 Apr 2007 08:43:43 -0000 1.26 --- SunJVMLauncher.cpp 30 Apr 2007 20:54:32 -0000 1.27 *************** *** 108,141 **** if (FileUtils::fileExists(this->RuntimeLibPath)) { ! SunJVMDLL runner(this->RuntimeLibPath, this->VmVersion); // set up the vm parameters... ! setupVM(resource, &runner); ! return runner.run(resource.getProperty(ResourceManager::KEY_MAINCLASSNAME)); ! // then call the main class... ! ! ! // vector<string> args = StringUtils::split(resource.getProperty(ResourceManager::KEY_ARGUMENTS), " \t\n\r", "\"\'"); ! // JClassProxy mainclass(&runner, resource.getProperty(string(ResourceManager::KEY_MAINCLASSNAME)) ); ! // jstring empty = runner.newUTFString(""); ! // jclass strclss = runner.findClass( resource.getProperty(string(ResourceManager::KEY_MAINCLASSNAME) )); ! // if (strclss) ! // { ! // jobjectArray jargumentsval = runner.newObjectArray(args.size(), strclss, empty); ! // mainclass.invokeStatic( "void main(java.lang.String[]args)", JArgs(jargumentsval)); ! // return true; ! ! // } ! // return false; ! // jclass strclss = runner.findClass( resource.getProperty(string(ResourceManager::KEY_MAINCLASSNAME) )); ! // JMethodCaller maincaller(resource.getProperty(string(ResourceManager::KEY_MAINCLASSNAME)), ! // "void static main(String[]args)"); ! // JArgs maa(jargumentsval); ! // jvalue* jarguments = maa.allocArray(); ! // maincaller.invokeStatic(runner, jarguments); ! // delete jarguments; } - return false; } --- 108,122 ---- if (FileUtils::fileExists(this->RuntimeLibPath)) { ! m_dllrunner = new SunJVMDLL(this->RuntimeLibPath, this->VmVersion); // set up the vm parameters... ! setupVM(resource, m_dllrunner); ! if (justInstanciate) ! return m_dllrunner->instanciate(); ! else ! return m_dllrunner->run(resource.getProperty(ResourceManager::KEY_MAINCLASSNAME), ! true); } return false; } *************** *** 213,216 **** --- 194,201 ---- } + SunJVMDLL* SunJVMLauncher::getDLL() + { + return m_dllrunner; + } bool operator < (const SunJVMLauncher& v1, const SunJVMLauncher& v2) Index: SunJVMLauncher.h =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMLauncher.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SunJVMLauncher.h 28 Apr 2007 08:43:43 -0000 1.12 --- SunJVMLauncher.h 30 Apr 2007 20:54:32 -0000 1.13 *************** *** 78,81 **** --- 78,84 ---- */ Version VmVersion; + + SunJVMExe* m_exerunner; + SunJVMDLL* m_dllrunner; /** *************** *** 112,115 **** --- 115,119 ---- virtual bool setupVM(ResourceManager& resource, JVMBase* vm); + SunJVMDLL* getDLL(); std::string toString() const; *************** *** 128,138 **** JavaVM* getJavaVM(); ! jclass findClass(const std::string& clazz); ! jmethodID findMethod(jclass& cls, const std::string& methodname, const std::string& signature, bool isStatic); ! void invokeVoidStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! // jvaluea invokeIntStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! jint invokeIntStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! jlong invokeLongStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); private: --- 132,142 ---- JavaVM* getJavaVM(); ! // jclass findClass(const std::string& clazz); ! // jmethodID findMethod(jclass& cls, const std::string& methodname, const std::string& signature, bool isStatic); ! // void invokeVoidStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! // // jvaluea invokeIntStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! // jint invokeIntStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); ! // jlong invokeLongStatic(jclass clazz, jmethodID& methodid, jvalue arguments[]); private: Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/Makefile.win,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.win 28 Apr 2007 08:43:43 -0000 1.7 --- Makefile.win 30 Apr 2007 20:54:32 -0000 1.8 *************** *** 12,16 **** LIBS = -L"$(MINGW)/lib" INCS = -I"../util-core" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -g -I"../util-core" -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" BIN = CommonJava.a CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" --- 12,16 ---- LIBS = -L"$(MINGW)/lib" INCS = -I"../util-core" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -Os -I"../util-core" -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" BIN = CommonJava.a CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" Index: SunJVMDLL.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMDLL.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SunJVMDLL.cpp 28 Apr 2007 08:43:43 -0000 1.1 --- SunJVMDLL.cpp 30 Apr 2007 20:54:32 -0000 1.2 *************** *** 40,44 **** } ! bool SunJVMDLL::run(const std::string& mainclass) { if (m_statusCode == SunJVMDLL::JVM_NOT_STARTED) --- 40,44 ---- } ! bool SunJVMDLL::run(const std::string& mainclass, bool waitDeath) { if (m_statusCode == SunJVMDLL::JVM_NOT_STARTED) *************** *** 58,63 **** ma[0].l = mainargs; disp.invokeStatic(std::string("void main(java.lang.String[] args)"), ma); return true; - } --- 58,64 ---- ma[0].l = mainargs; disp.invokeStatic(std::string("void main(java.lang.String[] args)"), ma); + if (waitDeath == true) + m_javavm->DestroyJavaVM(); return true; } *************** *** 65,68 **** --- 66,76 ---- } + void SunJVMDLL::join() + { + if (m_statusCode == SunJVMDLL::JVM_LOADED) + { + m_javavm->DestroyJavaVM(); + } + } bool SunJVMDLL::instanciate() *************** *** 100,103 **** --- 108,112 ---- } + m_statusCode = SunJVMDLL::JVM_CANT_USE_VM; return false; } Index: SunJVMDLL.h =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMDLL.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SunJVMDLL.h 28 Apr 2007 08:43:43 -0000 1.1 --- SunJVMDLL.h 30 Apr 2007 20:54:32 -0000 1.2 *************** *** 85,90 **** } ! bool run(const std::string& mainclass); ! jclass findClass(const std::string& clazz); jmethodID findMethod(jclass& cls, const std::string& methodname, const std::string& signature, bool isStatic); --- 85,91 ---- } ! bool run(const std::string& mainclass, bool waitDeath = true); ! void join(); ! jclass findClass(const std::string& clazz); jmethodID findMethod(jclass& cls, const std::string& methodname, const std::string& signature, bool isStatic); |