xref: /aoo41x/main/jvmfwk/source/fwkbase.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #if !defined INCLUDED_JVMFWK_FWKBASE_HXX
28 #define INCLUDED_JVMFWK_FWKBASE_HXX
29 #include "rtl/ustring.hxx"
30 #include "libxmlutil.hxx"
31 namespace jfw
32 {
33 
34 class VendorSettings
35 {
36     ::rtl::OUString m_xmlDocVendorSettingsFileUrl;
37     CXmlDocPtr m_xmlDocVendorSettings;
38     CXPathContextPtr m_xmlPathContextVendorSettings;
39 
40 public:
41     VendorSettings();
42 
43     /** Gets all plugin library URLs with the corresponding vendor name.
44 
45     It uses the /javaSelection/plugins/library element from the javavendors.xml
46     to locate the library.
47     Is is verified that the plug-in exist. If a plug-in does not exist then an
48     exception is thrown containing the error JFW_E_CONFIGURATION
49     */
50     ::std::vector<PluginLibrary> getPluginData();
51 
52     /* returns the file URL to the plugin.
53      */
54     ::rtl::OUString getPluginLibrary(const ::rtl::OUString& sVendor);
55 
56     VersionInfo getVersionInformation(const ::rtl::OUString & sVendor);
57 
58     ::std::vector< ::rtl::OUString> getSupportedVendors();
59 };
60 
61 /* The class offers functions to retrieve verified bootstrap parameters.
62  */
63 namespace  BootParams
64 {
65 
66 /* Gets the file URL to the JRE which has been determined by the
67    bootstrap parameter UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME.
68 
69    In direct mode either of them must be set. If not an exception is thrown.
70 */
71 ::rtl::OUString getJREHome();
72 
73 ::std::vector< ::rtl::OString> getVMParameters();
74 
75 ::rtl::OUString getUserData();
76 
77 ::rtl::OUString getSharedData();
78 
79 ::rtl::OUString getInstallData();
80 /* returns the file URL to the vendor settings xml file.
81  */
82 ::rtl::OUString getVendorSettings();
83 
84 /* User the parameter UNO_JAVA_JFW_CLASSPATH and UNO_JAVA_JFW_ENV_CLASSPATH
85    to compose a classpath
86  */
87 ::rtl::OString getClasspath();
88 
89 ::rtl::OUString getClasspathUrls();
90 
91 /** returns the content of UNO_JAVA_JFW_INSTALL_EXPIRE or a pretermined
92     value. If the bootstrap variable contains a string that cannot be
93     converted by OUString then it returns the predetermined value.
94 */
95 ::sal_uInt32 getInstallDataExpiration();
96 
97 } //end namespace
98 
99 
100 
101 enum JFW_MODE
102 {
103     JFW_MODE_APPLICATION,
104 
105     JFW_MODE_DIRECT
106 };
107 
108 JFW_MODE getMode();
109 
110 /** creates the -Djava.class.path option with the complete classpath, including
111     the paths which are set by UNO_JAVA_JFW_CLASSPATH_URLS.
112  */
113 ::rtl::OString makeClassPathOption(::rtl::OUString const & sUserClassPath);
114 
115 ::rtl::OString getSettingsPath( const ::rtl::OUString & sURL);
116 
117 /** Get the system path to the javasettings.xml
118     Converts the URL returned from getUserSettingsURL to a
119     Systempath. An empty string is returned if the file
120     does not exist.
121    @throws FrameworkException
122  */
123 ::rtl::OString getUserSettingsPath();
124 
125 ::rtl::OString getInstallSettingsPath();
126 
127 /** Returns the system path of the share settings file.
128     Returns a valid string or throws an exception.
129    @throws FrameworkException
130  */
131 ::rtl::OString getSharedSettingsPath();
132 
133 /* returns a valid string or throws an exception.
134    @throws FrameworkException
135  */
136 ::rtl::OString getVendorSettingsPath();
137 
138 ::rtl::OUString buildClassPathFromDirectory(const ::rtl::OUString & relPath);
139 
140 /** Called from writeJavaInfoData. It sets the process identifier. When
141 java is to be started, then the current id is compared to the one set by
142 this function. If they are identical then the Java was selected in the
143 same process. If that Java needs a prepared environment, such as a
144 LD_LIBRARY_PATH, then it must not be started in this process.
145 */
146 void setJavaSelected();
147 
148 /** Determines if the currently selected Java was set in this process.
149 
150     @see setProcessId()
151  */
152 bool wasJavaSelectedInSameProcess();
153 /* Only for application mode.
154  */
155 ::rtl::OUString getApplicationClassPath();
156 }
157 
158 #endif
159