xref: /aoo41x/main/jvmfwk/source/fwkbase.hxx (revision 5ac42e1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #if !defined INCLUDED_JVMFWK_FWKBASE_HXX
24 #define INCLUDED_JVMFWK_FWKBASE_HXX
25 #include "rtl/ustring.hxx"
26 #include "libxmlutil.hxx"
27 namespace jfw
28 {
29 
30 class VendorSettings
31 {
32     ::rtl::OUString m_xmlDocVendorSettingsFileUrl;
33     CXmlDocPtr m_xmlDocVendorSettings;
34     CXPathContextPtr m_xmlPathContextVendorSettings;
35 
36 public:
37     VendorSettings();
38 
39     /** Gets all plugin library URLs with the corresponding vendor name.
40 
41     It uses the /javaSelection/plugins/library element from the javavendors.xml
42     to locate the library.
43     Is is verified that the plug-in exist. If a plug-in does not exist then an
44     exception is thrown containing the error JFW_E_CONFIGURATION
45     */
46     ::std::vector<PluginLibrary> getPluginData();
47 
48     /* returns the file URL to the plugin.
49      */
50     ::rtl::OUString getPluginLibrary(const ::rtl::OUString& sVendor);
51 
52     VersionInfo getVersionInformation(const ::rtl::OUString & sVendor);
53 
54     ::std::vector< ::rtl::OUString> getSupportedVendors();
55 };
56 
57 /* The class offers functions to retrieve verified bootstrap parameters.
58  */
59 namespace  BootParams
60 {
61 
62 /* Gets the file URL to the JRE which has been determined by the
63    bootstrap parameter UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME.
64 
65    In direct mode either of them must be set. If not an exception is thrown.
66 */
67 ::rtl::OUString getJREHome();
68 
69 ::std::vector< ::rtl::OString> getVMParameters();
70 
71 ::rtl::OUString getUserData();
72 
73 ::rtl::OUString getSharedData();
74 
75 ::rtl::OUString getInstallData();
76 /* returns the file URL to the vendor settings xml file.
77  */
78 ::rtl::OUString getVendorSettings();
79 
80 /* User the parameter UNO_JAVA_JFW_CLASSPATH and UNO_JAVA_JFW_ENV_CLASSPATH
81    to compose a classpath
82  */
83 ::rtl::OString getClasspath();
84 
85 ::rtl::OUString getClasspathUrls();
86 
87 /** returns the content of UNO_JAVA_JFW_INSTALL_EXPIRE or a pretermined
88     value. If the bootstrap variable contains a string that cannot be
89     converted by OUString then it returns the predetermined value.
90 */
91 ::sal_uInt32 getInstallDataExpiration();
92 
93 } //end namespace
94 
95 
96 
97 enum JFW_MODE
98 {
99     JFW_MODE_APPLICATION,
100 
101     JFW_MODE_DIRECT
102 };
103 
104 JFW_MODE getMode();
105 
106 /** creates the -Djava.class.path option with the complete classpath, including
107     the paths which are set by UNO_JAVA_JFW_CLASSPATH_URLS.
108  */
109 ::rtl::OString makeClassPathOption(::rtl::OUString const & sUserClassPath);
110 
111 ::rtl::OString getSettingsPath( const ::rtl::OUString & sURL);
112 
113 /** Get the system path to the javasettings.xml
114     Converts the URL returned from getUserSettingsURL to a
115     Systempath. An empty string is returned if the file
116     does not exist.
117    @throws FrameworkException
118  */
119 ::rtl::OString getUserSettingsPath();
120 
121 ::rtl::OString getInstallSettingsPath();
122 
123 /** Returns the system path of the share settings file.
124     Returns a valid string or throws an exception.
125    @throws FrameworkException
126  */
127 ::rtl::OString getSharedSettingsPath();
128 
129 /* returns a valid string or throws an exception.
130    @throws FrameworkException
131  */
132 ::rtl::OString getVendorSettingsPath();
133 
134 ::rtl::OUString buildClassPathFromDirectory(const ::rtl::OUString & relPath);
135 
136 /** Called from writeJavaInfoData. It sets the process identifier. When
137 java is to be started, then the current id is compared to the one set by
138 this function. If they are identical then the Java was selected in the
139 same process. If that Java needs a prepared environment, such as a
140 LD_LIBRARY_PATH, then it must not be started in this process.
141 */
142 void setJavaSelected();
143 
144 /** Determines if the currently selected Java was set in this process.
145 
146     @see setProcessId()
147  */
148 bool wasJavaSelectedInSameProcess();
149 /* Only for application mode.
150  */
151 ::rtl::OUString getApplicationClassPath();
152 }
153 
154 #endif
155