Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_JVMFWK_FWKBASE_HXX
20 : #define INCLUDED_JVMFWK_FWKBASE_HXX
21 :
22 : #include "rtl/ustring.hxx"
23 : #include "libxmlutil.hxx"
24 :
25 : namespace jfw
26 : {
27 :
28 0 : class VendorSettings
29 : {
30 : ::rtl::OUString m_xmlDocVendorSettingsFileUrl;
31 : CXmlDocPtr m_xmlDocVendorSettings;
32 : CXPathContextPtr m_xmlPathContextVendorSettings;
33 :
34 : public:
35 : VendorSettings();
36 :
37 : /** Gets all plugin library URLs with the corresponding vendor name.
38 :
39 : It uses the /javaSelection/plugins/library element from the javavendors.xml
40 : to locate the library.
41 : Is is verified that the plug-in exist. If a plug-in does not exist then an
42 : exception is thrown containing the error JFW_E_CONFIGURATION
43 : */
44 : ::std::vector<PluginLibrary> getPluginData();
45 :
46 : /* returns the file URL to the plugin.
47 : */
48 : ::rtl::OUString getPluginLibrary(const ::rtl::OUString& sVendor);
49 :
50 : VersionInfo getVersionInformation(const ::rtl::OUString & sVendor);
51 :
52 : ::std::vector< ::rtl::OUString> getSupportedVendors();
53 : };
54 :
55 : /* The class offers functions to retrieve verified bootstrap parameters.
56 : */
57 : namespace BootParams
58 : {
59 :
60 : /* Gets the file URL to the JRE which has been determined by the
61 : bootstrap parameter UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME.
62 :
63 : In direct mode either of them must be set. If not an exception is thrown.
64 : */
65 : ::rtl::OUString getJREHome();
66 :
67 : ::std::vector< ::rtl::OString> getVMParameters();
68 :
69 : ::rtl::OUString getUserData();
70 :
71 : ::rtl::OUString getSharedData();
72 :
73 : /* returns the file URL to the vendor settings xml file.
74 : */
75 : ::rtl::OUString getVendorSettings();
76 :
77 : /* User the parameter UNO_JAVA_JFW_CLASSPATH and UNO_JAVA_JFW_ENV_CLASSPATH
78 : to compose a classpath
79 : */
80 : ::rtl::OString getClasspath();
81 :
82 : ::rtl::OUString getClasspathUrls();
83 :
84 : } //end namespace
85 :
86 :
87 :
88 : enum JFW_MODE
89 : {
90 : JFW_MODE_APPLICATION,
91 :
92 : JFW_MODE_DIRECT
93 : };
94 :
95 : JFW_MODE getMode();
96 :
97 : /** creates the -Djava.class.path option with the complete classpath, including
98 : the paths which are set by UNO_JAVA_JFW_CLASSPATH_URLS.
99 : */
100 : ::rtl::OString makeClassPathOption(::rtl::OUString const & sUserClassPath);
101 :
102 : ::rtl::OString getSettingsPath( const ::rtl::OUString & sURL);
103 :
104 : /** Get the system path to the javasettings.xml
105 : Converts the URL returned from getUserSettingsURL to a
106 : Systempath. An empty string is returned if the file
107 : does not exist.
108 : @throws FrameworkException
109 : */
110 : ::rtl::OString getUserSettingsPath();
111 :
112 : /** Returns the system path of the share settings file.
113 : Returns a valid string or throws an exception.
114 : @throws FrameworkException
115 : */
116 : ::rtl::OString getSharedSettingsPath();
117 :
118 : /* returns a valid string or throws an exception.
119 : @throws FrameworkException
120 : */
121 : ::rtl::OString getVendorSettingsPath();
122 :
123 : ::rtl::OUString buildClassPathFromDirectory(const ::rtl::OUString & relPath);
124 :
125 : /** Called from writeJavaInfoData. It sets the process identifier. When
126 : java is to be started, then the current id is compared to the one set by
127 : this function. If they are identical then the Java was selected in the
128 : same process. If that Java needs a prepared environment, such as a
129 : LD_LIBRARY_PATH, then it must not be started in this process.
130 : */
131 : void setJavaSelected();
132 :
133 : /** Determines if the currently selected Java was set in this process.
134 :
135 : @see setProcessId()
136 : */
137 : bool wasJavaSelectedInSameProcess();
138 : /* Only for application mode.
139 : */
140 : ::rtl::OUString getApplicationClassPath();
141 : }
142 :
143 : #endif
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|