xref: /aoo42x/main/jvmfwk/source/framework.hxx (revision 5ac42e1f)
1*5ac42e1fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5ac42e1fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5ac42e1fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5ac42e1fSAndrew Rist  * distributed with this work for additional information
6*5ac42e1fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5ac42e1fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5ac42e1fSAndrew Rist  * "License"); you may not use this file except in compliance
9*5ac42e1fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5ac42e1fSAndrew Rist  *
11*5ac42e1fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5ac42e1fSAndrew Rist  *
13*5ac42e1fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5ac42e1fSAndrew Rist  * software distributed under the License is distributed on an
15*5ac42e1fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5ac42e1fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5ac42e1fSAndrew Rist  * specific language governing permissions and limitations
18*5ac42e1fSAndrew Rist  * under the License.
19*5ac42e1fSAndrew Rist  *
20*5ac42e1fSAndrew Rist  *************************************************************/
21*5ac42e1fSAndrew Rist 
22*5ac42e1fSAndrew Rist 
23cdf0e10cSrcweir #if !defined INCLUDED_JVMFWK_LOCAL_FRAMEWORK_HXX
24cdf0e10cSrcweir #define INCLUDED_JVMFWK_LOCAL_FRAMEWORK_HXX
25cdf0e10cSrcweir #include "rtl/ustring.hxx"
26cdf0e10cSrcweir #include "rtl/byteseq.hxx"
27cdf0e10cSrcweir #include "jvmfwk/framework.h"
28cdf0e10cSrcweir #include "jvmfwk/vendorplugin.h"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /** typedefs for functions from vendorplugin.h
31cdf0e10cSrcweir  */
32cdf0e10cSrcweir typedef javaPluginError (*jfw_plugin_getAllJavaInfos_ptr)(
33cdf0e10cSrcweir 	rtl_uString * sVendor,
34cdf0e10cSrcweir     rtl_uString * sMinVersion,
35cdf0e10cSrcweir     rtl_uString * sMaxVersion,
36cdf0e10cSrcweir     rtl_uString * * arExcludeList,
37cdf0e10cSrcweir     sal_Int32  nLenList,
38cdf0e10cSrcweir     JavaInfo*** parJavaInfo,
39cdf0e10cSrcweir     sal_Int32 *nLenInfoList);
40cdf0e10cSrcweir 
41cdf0e10cSrcweir typedef javaPluginError (*jfw_plugin_getJavaInfoByPath_ptr)(
42cdf0e10cSrcweir     rtl_uString * sPath,
43cdf0e10cSrcweir     rtl_uString * sVendor,
44cdf0e10cSrcweir     rtl_uString * sMinVersion,
45cdf0e10cSrcweir     rtl_uString * sMaxVersion,
46cdf0e10cSrcweir     rtl_uString * * arExcludeList,
47cdf0e10cSrcweir     sal_Int32  nLenList,
48cdf0e10cSrcweir     JavaInfo** ppInfo);
49cdf0e10cSrcweir 
50cdf0e10cSrcweir /** starts a Java Virtual Machine.
51cdf0e10cSrcweir     <p>
52cdf0e10cSrcweir     The function shall ensure, that the VM does not abort the process
53cdf0e10cSrcweir     during instantiation.
54cdf0e10cSrcweir     </p>
55cdf0e10cSrcweir  */
56cdf0e10cSrcweir typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)(
57cdf0e10cSrcweir     const JavaInfo *info,
58cdf0e10cSrcweir     const JavaVMOption* options,
59cdf0e10cSrcweir     sal_Int32 cOptions,
60cdf0e10cSrcweir     JavaVM ** ppVM,
61cdf0e10cSrcweir     JNIEnv ** ppEnv);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir typedef javaPluginError (*jfw_plugin_existJRE_ptr)(
64cdf0e10cSrcweir     const JavaInfo *info,
65cdf0e10cSrcweir     sal_Bool *exist);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir namespace jfw
69cdf0e10cSrcweir {
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class CJavaInfo
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     static JavaInfo * copyJavaInfo(const JavaInfo * pInfo);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     enum _transfer_ownership {TRANSFER};
76cdf0e10cSrcweir     /*Attaching the pointer to this class. The argument pInfo must not
77cdf0e10cSrcweir     be freed afterwards.
78cdf0e10cSrcweir     */
79cdf0e10cSrcweir     CJavaInfo(::JavaInfo * info, _transfer_ownership);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir public:
82cdf0e10cSrcweir     ::JavaInfo * pInfo;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     CJavaInfo();
87cdf0e10cSrcweir     CJavaInfo(const CJavaInfo &);
88cdf0e10cSrcweir     ~CJavaInfo();
89cdf0e10cSrcweir     CJavaInfo& operator =(const ::JavaInfo* info);
90cdf0e10cSrcweir     CJavaInfo & operator = (const CJavaInfo& info);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /* The returned class takes ownership of the argument info. info
93cdf0e10cSrcweir     must not been freed afterwards.
94cdf0e10cSrcweir     */
95cdf0e10cSrcweir     static CJavaInfo createWrapper(::JavaInfo* info);
96cdf0e10cSrcweir     /*Attaching the pointer to this class. The argument pInfo must not
97cdf0e10cSrcweir     be freed afterwards.
98cdf0e10cSrcweir     */
99cdf0e10cSrcweir     void attach(::JavaInfo* pInfo);
100cdf0e10cSrcweir     ::JavaInfo * detach();
101cdf0e10cSrcweir     const ::JavaInfo* operator ->() const;
102cdf0e10cSrcweir //    ::JavaInfo** operator & ();
103cdf0e10cSrcweir     operator ::JavaInfo* ();
104cdf0e10cSrcweir     operator ::JavaInfo const * () const;
105cdf0e10cSrcweir     ::JavaInfo* cloneJavaInfo() const;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     rtl::OUString getVendor() const;
108cdf0e10cSrcweir     rtl::OUString getLocation() const;
109cdf0e10cSrcweir     sal_uInt64 getFeatures() const;
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir class FrameworkException
113cdf0e10cSrcweir {
114cdf0e10cSrcweir public:
115cdf0e10cSrcweir 
FrameworkException(javaFrameworkError err,const rtl::OString & msg)116cdf0e10cSrcweir     FrameworkException(javaFrameworkError err, const rtl::OString& msg):
117cdf0e10cSrcweir         errorCode(err), message(msg)
118cdf0e10cSrcweir         {
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir     javaFrameworkError errorCode;
121cdf0e10cSrcweir     rtl::OString message;
122cdf0e10cSrcweir };
123cdf0e10cSrcweir }
124cdf0e10cSrcweir #endif
125