12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef JAVAVIRTUALMACHINE_H
27 #define JAVAVIRTUALMACHINE_H
28
29
30 #include "jni.h"
31 #include "Platform.h"
32
33 struct JavaOptionItem {
34 TString name;
35 TString value;
36 void* extraInfo;
37 };
38
39 class JavaOptions {
40 private:
41 std::list<JavaOptionItem> FItems;
42 JavaVMOption* FOptions;
43
44 public:
45 JavaOptions();
46 ~JavaOptions();
47
48 void AppendValue(const TString Key, TString Value, void* Extra);
49 void AppendValue(const TString Key, TString Value);
50 void AppendValue(const TString Key);
51 void AppendValues(OrderedMap<TString, TString> Values);
52 void ReplaceValue(const TString Key, TString Value);
53 std::list<TString> ToList();
54 size_t GetCount();
55 };
56
57 // Private typedef for function pointer casting
58 #define LAUNCH_FUNC "JLI_Launch"
59
60 typedef int (JNICALL *JVM_CREATE)(int argc, char ** argv,
61 int jargc, const char** jargv,
62 int appclassc, const char** appclassv,
63 const char* fullversion,
64 const char* dotversion,
65 const char* pname,
66 const char* lname,
67 jboolean javaargs,
68 jboolean cpwildcard,
69 jboolean javaw,
70 jint ergo);
71
72 class JavaLibrary : public Library {
73 JVM_CREATE FCreateProc;
74 JavaLibrary(const TString &FileName);
75 public:
76 JavaLibrary();
77 bool JavaVMCreate(size_t argc, char *argv[]);
78 };
79
80 class JavaVirtualMachine {
81 private:
82 JavaLibrary javaLibrary;
83
84 void configureLibrary();
85 bool launchVM(JavaOptions& options, std::list<TString>& vmargs);
86 public:
87 JavaVirtualMachine();
88 ~JavaVirtualMachine(void);
89
90 bool StartJVM();
91 };
92
93 bool RunVM();
94
95 #endif // JAVAVIRTUALMACHINE_H
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef JAVAVIRTUALMACHINE_H
27 #define JAVAVIRTUALMACHINE_H
28
29
30 #include "jni.h"
31 #include "Platform.h"
32 #include "Library.h"
33
34 struct JavaOptionItem {
35 TString name;
36 TString value;
37 void* extraInfo;
38 };
39
40 class JavaOptions {
41 private:
42 std::list<JavaOptionItem> FItems;
43 JavaVMOption* FOptions;
44
45 public:
46 JavaOptions();
47 ~JavaOptions();
48
49 void AppendValue(const TString Key, TString Value, void* Extra);
50 void AppendValue(const TString Key, TString Value);
51 void AppendValue(const TString Key);
52 void AppendValues(OrderedMap<TString, TString> Values);
53 void ReplaceValue(const TString Key, TString Value);
54 std::list<TString> ToList();
55 size_t GetCount();
56 };
57
58 class JavaVirtualMachine {
59 private:
60 JavaLibrary javaLibrary;
61
62 void configureLibrary();
63 bool launchVM(JavaOptions& options, std::list<TString>& vmargs);
64 public:
65 JavaVirtualMachine();
66 ~JavaVirtualMachine(void);
67
68 bool StartJVM();
69 };
70
71 bool RunVM();
72
73 #endif // JAVAVIRTUALMACHINE_H
|