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