xref: /aoo42x/main/jvmfwk/source/fwkbase.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_FWKBASE_HXX
24cdf0e10cSrcweir #define INCLUDED_JVMFWK_FWKBASE_HXX
25cdf0e10cSrcweir #include "rtl/ustring.hxx"
26cdf0e10cSrcweir #include "libxmlutil.hxx"
27cdf0e10cSrcweir namespace jfw
28cdf0e10cSrcweir {
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class VendorSettings
31cdf0e10cSrcweir {
32cdf0e10cSrcweir     ::rtl::OUString m_xmlDocVendorSettingsFileUrl;
33cdf0e10cSrcweir     CXmlDocPtr m_xmlDocVendorSettings;
34cdf0e10cSrcweir     CXPathContextPtr m_xmlPathContextVendorSettings;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir public:
37cdf0e10cSrcweir     VendorSettings();
38cdf0e10cSrcweir 
39cdf0e10cSrcweir     /** Gets all plugin library URLs with the corresponding vendor name.
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     It uses the /javaSelection/plugins/library element from the javavendors.xml
42cdf0e10cSrcweir     to locate the library.
43cdf0e10cSrcweir     Is is verified that the plug-in exist. If a plug-in does not exist then an
44cdf0e10cSrcweir     exception is thrown containing the error JFW_E_CONFIGURATION
45cdf0e10cSrcweir     */
46cdf0e10cSrcweir     ::std::vector<PluginLibrary> getPluginData();
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     /* returns the file URL to the plugin.
49cdf0e10cSrcweir      */
50cdf0e10cSrcweir     ::rtl::OUString getPluginLibrary(const ::rtl::OUString& sVendor);
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     VersionInfo getVersionInformation(const ::rtl::OUString & sVendor);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     ::std::vector< ::rtl::OUString> getSupportedVendors();
55cdf0e10cSrcweir };
56cdf0e10cSrcweir 
57cdf0e10cSrcweir /* The class offers functions to retrieve verified bootstrap parameters.
58cdf0e10cSrcweir  */
59cdf0e10cSrcweir namespace  BootParams
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /* Gets the file URL to the JRE which has been determined by the
63cdf0e10cSrcweir    bootstrap parameter UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME.
64cdf0e10cSrcweir 
65cdf0e10cSrcweir    In direct mode either of them must be set. If not an exception is thrown.
66cdf0e10cSrcweir */
67cdf0e10cSrcweir ::rtl::OUString getJREHome();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir ::std::vector< ::rtl::OString> getVMParameters();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir ::rtl::OUString getUserData();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir ::rtl::OUString getSharedData();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir ::rtl::OUString getInstallData();
76cdf0e10cSrcweir /* returns the file URL to the vendor settings xml file.
77cdf0e10cSrcweir  */
78cdf0e10cSrcweir ::rtl::OUString getVendorSettings();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir /* User the parameter UNO_JAVA_JFW_CLASSPATH and UNO_JAVA_JFW_ENV_CLASSPATH
81cdf0e10cSrcweir    to compose a classpath
82cdf0e10cSrcweir  */
83cdf0e10cSrcweir ::rtl::OString getClasspath();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir ::rtl::OUString getClasspathUrls();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir /** returns the content of UNO_JAVA_JFW_INSTALL_EXPIRE or a pretermined
88cdf0e10cSrcweir     value. If the bootstrap variable contains a string that cannot be
89cdf0e10cSrcweir     converted by OUString then it returns the predetermined value.
90cdf0e10cSrcweir */
91cdf0e10cSrcweir ::sal_uInt32 getInstallDataExpiration();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir } //end namespace
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
97cdf0e10cSrcweir enum JFW_MODE
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     JFW_MODE_APPLICATION,
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     JFW_MODE_DIRECT
102cdf0e10cSrcweir };
103cdf0e10cSrcweir 
104cdf0e10cSrcweir JFW_MODE getMode();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir /** creates the -Djava.class.path option with the complete classpath, including
107cdf0e10cSrcweir     the paths which are set by UNO_JAVA_JFW_CLASSPATH_URLS.
108cdf0e10cSrcweir  */
109cdf0e10cSrcweir ::rtl::OString makeClassPathOption(::rtl::OUString const & sUserClassPath);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir ::rtl::OString getSettingsPath( const ::rtl::OUString & sURL);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir /** Get the system path to the javasettings.xml
114cdf0e10cSrcweir     Converts the URL returned from getUserSettingsURL to a
115cdf0e10cSrcweir     Systempath. An empty string is returned if the file
116cdf0e10cSrcweir     does not exist.
117cdf0e10cSrcweir    @throws FrameworkException
118cdf0e10cSrcweir  */
119cdf0e10cSrcweir ::rtl::OString getUserSettingsPath();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir ::rtl::OString getInstallSettingsPath();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir /** Returns the system path of the share settings file.
124cdf0e10cSrcweir     Returns a valid string or throws an exception.
125cdf0e10cSrcweir    @throws FrameworkException
126cdf0e10cSrcweir  */
127cdf0e10cSrcweir ::rtl::OString getSharedSettingsPath();
128cdf0e10cSrcweir 
129cdf0e10cSrcweir /* returns a valid string or throws an exception.
130cdf0e10cSrcweir    @throws FrameworkException
131cdf0e10cSrcweir  */
132cdf0e10cSrcweir ::rtl::OString getVendorSettingsPath();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir ::rtl::OUString buildClassPathFromDirectory(const ::rtl::OUString & relPath);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir /** Called from writeJavaInfoData. It sets the process identifier. When
137cdf0e10cSrcweir java is to be started, then the current id is compared to the one set by
138cdf0e10cSrcweir this function. If they are identical then the Java was selected in the
139cdf0e10cSrcweir same process. If that Java needs a prepared environment, such as a
140cdf0e10cSrcweir LD_LIBRARY_PATH, then it must not be started in this process.
141cdf0e10cSrcweir */
142cdf0e10cSrcweir void setJavaSelected();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir /** Determines if the currently selected Java was set in this process.
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     @see setProcessId()
147cdf0e10cSrcweir  */
148cdf0e10cSrcweir bool wasJavaSelectedInSameProcess();
149cdf0e10cSrcweir /* Only for application mode.
150cdf0e10cSrcweir  */
151cdf0e10cSrcweir ::rtl::OUString getApplicationClassPath();
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir #endif
155