Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / include / jvmfwk / framework.hxx
blob8b2e36e935fc8e1ab02ed81ca5df4132ebeb25db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 /** @HTML */
22 #ifndef INCLUDED_JVMFWK_FRAMEWORK_HXX
23 #define INCLUDED_JVMFWK_FRAMEWORK_HXX
25 #include <sal/config.h>
27 #include <memory>
28 #include <vector>
30 #include <jvmfwk/jvmfwkdllapi.hxx>
31 #include <rtl/byteseq.hxx>
32 #include <rtl/ustring.hxx>
33 #include <jni.h>
35 /** @file
36 <p>This library can operate in two modes, application mode and direct mode.</p>
39 <h2>Application Mode</h2>
40 In application mode the Java related settings are stored in files.
41 There are currently three files which need to be accessed. They are determined
42 by bootstrap parameters:</p>
43 <dl>
44 <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
45 <dd>contains vendor and version information about JREs as well as the
46 location of plugin-libraries which are responsible for providing information
47 about these JREs as well as starting the VMs.</dd>
48 <dt>UNO_JAVA_JFW_USER_DATA</dt>
49 <dd>The file contains settings for a particular user. One can use the macro
50 $SYSUSERCONFIG in the URL which expands to a directory where the user's data are
51 kept. On UNIX this would be the home directory and on Windows some sub-directory
52 of the &quot;Documents and Settings&quot; folder.The content of this file is an
53 implementation detail and may change in the future.</dd>
54 <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
55 <dd>The file contains settings valid for all users. If a user changes a setting
56 then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
57 The content of this file is an implementation detail and may change in the future.</dd>
58 </dl>
60 <p>The values for these parameters must be file URLs and include the file name, for
61 example:<br>
62 file:///d:/MyApp/javavendors.xml<br>
63 All files are XML files and must have the extension .xml.</p>
64 <p>
65 Modifying the shared settings is currently not supported by the framework. To provide
66 Java settings for all users one can run OOo and change the settings in the
67 options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
68 The file can then be copied into the base installation.
69 Other users will use automatically these data but can override the settings in
70 the options dialog. This mechanism may change in the future.
71 </p>
72 <p>If shared Java settings are not supported by an application then it is not
73 necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
74 </p>
76 <p>Setting the class path used by a Java VM should not be necessary. The locations
77 of Jar files should be known by a class loader. If a jar file depends on another
78 jar file then it can be referenced in the manifest file of the first jar. However,
79 a user may add jars to the class path by using this API. If it becomes necessary
80 to add files to the class path which is to be used by all users then one can use
81 the bootstrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
82 which must be separated by spaces.</p>
85 <h2>Direct Mode</h2>
87 <p>The direct mode is intended for a scenario where no configuration files
88 are available and a Java VM shall be run. That is,
89 the files containing the user and shared settings are not specified by the
90 bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
91 For example, tools, such as regcomp, may use this framework in a build
92 environment. Then one would want to use settings which have been specified
93 by the build environment. The framework would automatically use the
94 current settings when they change in the environment.
95 </p>
97 <p> Here are examples how regcomp could be invoked using bootstrap parameters:
98 </p>
99 <p>
100 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
101 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
102 -register...
103 </p>
104 <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
106 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
107 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
108 -register...
109 </p>
110 <p>Additional parameters for the Java VM can be provided. For every parameter
111 a separate bootstrap parameter must be specified. The names are
112 <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
114 regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
115 -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
116 -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
117 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
118 -register...</p>
120 Here is a complete list of the bootstrap parameter for the direct mode:
121 </p>
122 <dl>
123 <dt>UNO_JAVA_JFW_JREHOME</dt>
124 <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
125 in direct mode</dd>
126 <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
127 <dd>Setting this parameter, for example to &quot;1&quot; or &quot;true&quot;,
128 causes the framework to use the environment variable JAVA_HOME. It is expected
129 that JAVA_HOME contains a system path rather than a file URL. This parameter
130 and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
131 <dt>UNO_JAVA_JFW_CLASSPATH</dt>
132 <dd>Contains the class path which is to be used by the VM. Special character,
133 such as '\','{','}','$' must be preceded with '\'. See documentation about the
134 bootstrap parameter.</dd>
135 <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
136 <dd>Setting this parameter,for example to &quot;1&quot; or &quot;true&quot;,
137 causes the framework to use the
138 environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
139 set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
140 variable CLASSPATH.</dd>
141 <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
142 <dd>Specifies a parameter for the Java VM. The X is replaced by
143 non-negative natural numbers starting with 1.</dd>
144 </dl>
146 <p>A note about bootstrap parameters. The implementation of the bootstrap
147 parameter mechanism interprets the characters '\', '$', '{', '}' as
148 escape characters. That's why the Windows path contain double back-slashes.
149 One should also take into account that a console may have also special
150 escape characters.</p>
152 <h2>What mode is used</h2>
154 The default mode is application mode. If at least one bootstrap parameter
155 for the direct mode is provided then direct mode is used. </p>
158 All settings made by this API are done for the current user if not
159 mentioned differently.</p>
162 /** indicates that there must be an environment set up before the Java process
163 runs.
164 <p>Therefore, when a Java is selected in OO then the office must be
165 restarted, so that the changes can take effect.</p>
167 #define JFW_REQUIRE_NEEDRESTART 0x1l
169 /** error codes which are returned by functions of this API.
171 enum javaFrameworkError
173 JFW_E_NONE,
174 JFW_E_ERROR,
175 JFW_E_NO_SELECT,
176 JFW_E_INVALID_SETTINGS,
177 JFW_E_NEED_RESTART,
178 JFW_E_RUNNING_JVM,
179 JFW_E_JAVA_DISABLED,
180 JFW_E_NOT_RECOGNIZED,
181 JFW_E_FAILED_VERSION,
182 JFW_E_NO_JAVA_FOUND,
183 JFW_E_VM_CREATION_FAILED,
184 JFW_E_CONFIGURATION,
185 JFW_E_DIRECT_MODE
188 /** an instance of this struct represents an installation of a Java
189 Runtime Environment (JRE).
192 Instances of this struct are created by the plug-in libraries which are used by
193 this framework (jvmfwk/vendorplugin.h).</p>
195 struct JavaInfo
197 /** contains the vendor.
199 <p>string must be the same as the one obtained from the
200 Java system property <code>java.vendor</code>.
201 </p>
203 OUString sVendor;
204 /** contains the file URL to the installation directory.
206 OUString sLocation;
207 /** contains the version of this Java distribution.
209 <p>The version string must adhere to the rules
210 about how a version string has to be formed. These rules may
211 be vendor-dependent. Essentially the strings must syntactically
212 equal the Java system property <code>java.version</code>.
213 </p>
215 OUString sVersion;
216 /** indicates requirements for running the java runtime.
218 <p>For example, it may be necessary to prepare the environment before
219 the runtime is created. That could mean, setting the
220 <code>LD_LIBRARY_PATH</code>
221 when <code>nRequirements</code> contains the flag
222 <code>JFW_REQUIRE_NEEDRESTART</code></p>
224 sal_uInt64 nRequirements;
225 /** contains data needed for the creation of the java runtime.
227 <p>There is no rule about the format and content of the sequence's
228 values. The plug-in libraries can put all data, necessary for
229 starting the java runtime into this sequence. </p>
231 rtl::ByteSequence arVendorData;
234 /** compares two <code>JavaInfo</code> objects for equality.
236 <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
237 members of the first <code>JavaInfo</code> are equal to their counterparts
238 in the second <code>JavaInfo</code> object. The equality of the
239 <code>OUString</code> members is determined
240 by <code>operator ==</code>.
241 Similarly the equality of the <code>rtl::ByteSequence</code> is
242 also determined by a comparison
243 function (see <code>rtl::ByteSequence::operator ==</code>). </p>
245 Both argument pointers must be valid.</p>
246 @param pInfoA
247 the first argument.
248 @param pInfoB
249 the second argument which is compared with the first.
250 @return
251 true - both object represent the same JRE.</br>
252 false - the objects represent different JREs
254 JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo(JavaInfo const* pInfoA, JavaInfo const* pInfoB);
256 /** determines if a Java Virtual Machine is already running.
258 <p>As long as the office and the JREs only support one
259 Virtual Machine per process the Java settings, particularly the
260 selected Java, are not effective immediately after changing when
261 a VM has already been running. That is, if a JRE A was used to start
262 a VM and then a JRE B is selected, then JRE B will only be used
263 after a restart of the office.</p>
265 By determining if a VM is running, the user can be presented a message,
266 that the changed setting may not be effective immediately.</p>
268 @return
269 true iff a VM is running.
271 JVMFWK_DLLPUBLIC bool jfw_isVMRunning();
273 /** detects a suitable JRE and configures the framework to use it.
275 <p>Which JREs can be used is determined by the file javavendors.xml,
276 which contains version requirements.</p>
278 JREs can be provided by different vendors.
279 The function obtains information about JRE installations. If none was
280 found then it also uses a list of paths, which have been registered
281 by <code>jfw_addJRELocation</code>
282 to find JREs. Found JREs are examined in the same way.</p>
284 A JRE installation is only selected if it meets the version requirements.
285 Information about the selected JRE are made persistent so that
286 subsequent calls to <code>jfw_getSelectedJRE</code> returns this
287 information.</p>
289 While determining a proper JRE this function takes into account if a
290 user requires support for assistive technology tools. If user
291 need that support they have to set up their system accordingly.</p>
293 If the JAVA_HOME environment variable is set, this function prefers
294 the JRE which the variable refers to over other JREs.
295 If JAVA_HOME is not set or does not refer to a suitable JRE,
296 the PATH environment variable is inspected and the respective JREs
297 are checked for their suitability next.</p>
299 The first <code>JavaInfo</code> object that is detected by the algorithm
300 as described above is used.</p>
302 @param pInfo
303 [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
304 The <code>JavaInfo</code> is for informational purposes only. It is not
305 necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
306 <code>pInfo</code>can be NULL.
308 @return
309 JFW_E_NONE function ran successfully.<br/>
310 JFW_E_ERROR an error occurred. <br/>
311 JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
312 JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
313 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
314 were not met.
316 JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo>* pInfo);
318 /** provides information about all available JRE installations.
320 <p>The function determines dynamically what JREs are available. It uses
321 the plug-in libraries to provide lists of available <code>JavaInfo</code>
322 objects where each object represents a JRE (see vendorplugin.h,
323 getAllJavaInfos). It also uses a list of paths, which have been registered
324 by <code>jfw_addJRELocation</code>.
325 It is checked if the path still contains a valid JRE and if so the respective
326 <code>JavaInfo</code> object will be appended to the array unless there is
327 already an equal object.</p>
329 @param parInfo
330 [out] on returns it contains a vector of <code>JavaInfo</code> pointers.
332 @return
333 JFW_E_NONE function ran successfully.<br/>
334 JFW_E_ERROR an error occurred. <br/>
335 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
336 were not met.
338 JVMFWK_DLLPUBLIC javaFrameworkError
339 jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>>* parInfo);
341 /** determines if a path points to a Java installation.
343 <p>If the path belongs to a JRE installation then it returns the
344 respective <code>JavaInfo</code> object. The function uses the
345 <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
346 <code>JavaInfo</code> object. Only if the JRE found at the specified location
347 meets the version requirements as specified in the javavendors.xml file a
348 <code>JavaInfo</code> object is returned.<br/>
350 The functions only checks if a JRE exists but does not modify any settings.
351 To make the found JRE the &quot;selected JRE&quot; one has
352 to call <code>jfw_setSelectedJRE</code>.</p>
354 @param pPath
355 [in] a file URL to a directory.
356 @param ppInfo
357 [out] the <code>JavaInfo</code> object which represents a JRE found at the
358 location specified by <code>pPath</code>
360 @return
361 JFW_E_NONE function ran successfully.<br/>
362 JFW_E_ERROR an error occurred. <br/>
363 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
364 were not met.</br>
365 JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
366 JFW_E_FAILED_VERSION a JRE was detected but if failed the version
367 requirements as determined by the javavendors.xml
369 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath(OUString const& pPath,
370 std::unique_ptr<JavaInfo>* ppInfo);
372 /** starts a Java Virtual Machine (JVM).
374 <p>The function uses the current settings to start a JVM. The actual
375 start-up code, however, is provided by the plug-in libraries. The setting
376 of the &quot;selected Java&quot; contains the information as to what vendor
377 the respective JRE comes from. In the javavendors.xml there is a mapping of
378 vendor names to the respective plug-in libraries.</p>
380 The function ultimately calls <code>startJavaVirtualMachine</code> from
381 the plug-in library.</p>
383 The <code>arOptions</code>
384 argument contains start arguments which are passed in JavaVMOption structures
385 to the VM during its creation. These
386 could be things, such as language settings, proxy settings or any other
387 properties which shall be obtainable by
388 <code>java.lang.System.getProperties</code>. One can also pass options which
389 have a certain meaning to the runtime behaviour such as -ea or -X... However,
390 one must be sure that these options can be interpreted by the VM.<br/>
391 The class path cannot be set this way. The class path is internally composed by
392 the paths to archives in a certain directory, which is preconfigured in
393 the internal data store and the respective user setting (see
394 <code>jfw_setUserClassPath</code>.</p>
396 If a JRE was selected at runtime which was different from the previous
397 setting and that JRE needs a prepared environment, for example an adapted
398 <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
399 created and JFW_E_NEED_RESTART error is returned. If a VM is already running
400 then a JFW_E_RUNNING_JVM is returned.</p>
402 @param pInfo
403 [in] optional pointer to a specific JRE; must be caller-freed if not NULL
404 @param arOptions
405 [in] the vector containing additional start arguments.
406 @param ppVM
407 [out] the <code>JavaVM</code> pointer.
408 @param ppEnv
409 [out] the <code>JNIenv</code> pointer.
411 @return
412 JFW_E_NONE function ran successfully.<br/>
413 JFW_E_ERROR an error occurred. <br/>
414 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
415 were not met.</br>
416 JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
417 JFW_E_NO_SELECT there is no JRE selected yet. <br/>
418 JFW_E_RUNNING_JVM there is already a VM running.<br/>
419 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
420 JRE has been selected afterwards. <br/>
421 JFW_E_NEED_RESTART in the current process a different JRE has been selected
422 which needs a prepared environment, which has to be done before the office
423 process. Therefore the new JRE may not be used until the office was restarted.<br/>
424 JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
425 then the user enabled it. If then the selected JRE has the requirement
426 JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
427 JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
428 by a plug-in library and not by this API.
429 JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
430 <code>JAVA_HOME</code>does not meet the version requirements.
432 JVMFWK_DLLPUBLIC javaFrameworkError jfw_startVM(JavaInfo const* pInfo,
433 std::vector<OUString> const& arOptions,
434 JavaVM** ppVM, JNIEnv** ppEnv);
436 /** determines the JRE that is to be used.
438 <p>When calling <code>jfw_startVM</code> then a VM is started from
439 the JRE that is determined by this function.<br/>
440 It is not verified if the JRE represented by the <code>JavaInfo</code>
441 argument meets the requirements as specified by the javavendors.xml file.
442 However, usually one obtains the <code>JavaInfo</code> object from the
443 functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
444 which do verify the JREs and pass out only <code>JavaInfo</code> objects
445 which comply with the version requirements.</p>
447 If <code>pInfo</code> is NULL then the meaning is that no JRE will be
448 selected. <code>jfw_startVM</code> will then return
449 <code>JFW_E_NO_SELECT</code>.</p>
451 @param pInfo
452 [in] pointer to <code>JavaInfo</code> structure, containing data about a
453 JRE. The caller must still free <code>pInfo</code>.
455 @return
456 JFW_E_NONE function ran successfully.<br/>
457 JFW_E_ERROR An error occurred.<br/>
458 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
459 were not met.<br/>
460 JFW_E_DIRECT_MODE the function cannot be used in this mode.
462 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setSelectedJRE(JavaInfo const* pInfo);
464 /** provides information about the JRE that is to be used.
466 <p>If no JRE is currently selected then <code>ppInfo</code> will contain
467 NULL on return.</br>
468 If the value of the element <updated> in the javavendors.xml file was
469 changed since the time when the last Java was selected then this
470 function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
471 a product patch. Then new version requirements may be introduced, so that
472 the currently selected JRE may not meet these requirements anymore.
473 </p>
474 <p>In direct mode the function returns information about a JRE that was
475 set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
476 </p>
477 @param ppInfo
478 [out] on return it contains a pointer to a <code>JavaInfo</code> object
479 that represents the currently selected JRE. When <code>*ppInfo</code> is not
480 NULL then the function sets the pointer.
482 @return
483 JFW_E_NONE function ran successfully.<br/>
484 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
485 were not met.<br/>
486 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
487 JRE has been selected afterwards. <br/>
489 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo>* ppInfo);
491 /** determines if Java can be used.
493 <p>If <code>bEnabled</code> is <code>false</code> then a call
494 to jfw_startVM will result in an error with the errorcode
495 <code>JFW_E_JAVA_DISABLED</code></p>
497 @param bEnabled
498 [in] use of Java enabled/disabled.
500 @return
501 JFW_E_NONE function ran successfully.<br/>
502 JFW_E_ERROR An error occurred.<br/>
503 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
504 were not met.<br/>
505 JFW_E_DIRECT_MODE the function cannot be used in this mode.
507 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setEnabled(bool bEnabled);
509 /** provides the information if Java can be used.
511 <p>That is if the user enabled or disabled the use of Java.
512 </p>
514 @return
515 JFW_E_NONE function ran successfully.<br/>
516 JFW_E_ERROR An error occurred.<br/>
517 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
518 were not met.<br/>
519 JFW_E_DIRECT_MODE the function cannot be used in this mode.
521 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(bool* pbEnabled);
523 /** determines parameters which are passed to VM during its creation.
525 <p>The strings must be exactly as they are passed on the command line.
526 For example, one could pass<br/>
527 -Xdebug <br/>
528 -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
529 in order to enable debugging support.
530 </p>
532 @param arParameters
533 [in] contains the arguments.
535 @return
536 JFW_E_NONE function ran successfully.<br/>
537 JFW_E_ERROR An error occurred.<br/>
538 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
539 were not met.<br/>
540 JFW_E_DIRECT_MODE the function cannot be used in this mode.
542 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(std::vector<OUString> const& arArgs);
544 /** obtains the currently used start parameters.
546 @param parParameters
547 [out] on returns contains a pointer to the array of the start arguments.
549 @return
550 JFW_E_NONE function ran successfully.<br/>
551 JFW_E_ERROR An error occurred.<br/>
552 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
553 were not met.<br/>
554 JFW_E_DIRECT_MODE the function cannot be used in this mode.
556 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(std::vector<OUString>* parParameters);
558 /** sets the user class path.
560 <p>When the VM is started then it is passed the class path. The
561 class path also contains the user class path set by this function.
562 The paths contained in <code>pCP</code> must be separated with a
563 system dependent path separator.</p>
565 @param pCP
566 [in] the user class path.
568 @return
569 JFW_E_NONE function ran successfully.<br/>
570 JFW_E_ERROR An error occurred.<br/>
571 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
572 were not met.<br/>
573 JFW_E_DIRECT_MODE the function cannot be used in this mode.
575 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(OUString const& pCP);
576 /** provides the value of the current user class path.
578 <p>The function returns an empty string if no user class path is set.
579 </p>
581 @param ppCP
582 [out] contains the user class path on return.
584 @return
585 JFW_E_NONE function ran successfully.<br/>
586 JFW_E_ERROR An error occurred.<br/>
587 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
588 were not met.<br/>
589 JFW_E_DIRECT_MODE the function cannot be used in this mode.
591 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(OUString* ppCP);
593 /** saves the location of a JRE.
595 <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
596 function are evaluated. If the location still represents a
597 JRE then a <code>JavaInfo</code> object is created which is returned along
598 with all other <code>JavaInfo</code> objects by
599 <code>jfw_findAllJREs</code>. If the location
600 cannot be recognized then the location string is ignored. </p>
602 A validation if <code>sLocation</code> points to a JRE is not
603 performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
604 </p>
606 Adding a path that is already stored causes no error.</p>
608 @param sLocation
609 [in] file URL to a directory which contains a JRE.
611 @return
612 JFW_E_NONE function ran successfully.<br/>
613 JFW_E_ERROR An error occurred.<br/>
614 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
615 were not met.<br/>
616 JFW_E_DIRECT_MODE the function cannot be used in this mode.
618 JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(OUString const& sLocation);
620 /** checks if the installation of the jre still exists.
622 This function checks if the JRE described by pInfo still
623 exists. The check must be very quick because it is called by javaldx
624 (Linux, Solaris) at start up.
626 @param pInfo
627 [in] the JavaInfo object with information about the JRE.
628 @param pp_exist
629 [out] the parameter is set to either true or false. The value is
630 only valid if the function returns JFW_E_NONE.
632 @return
633 JFW_E_NONE the function ran successfully.</br>
634 JFW_E_ERROR an error occurred during execution.</br>
636 JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo* pInfo, bool* exist);
638 /** locks this API so that it cannot be used by other threads.
640 <p>If a different thread called this function before then the
641 current call is blocked until the other thread has called
642 <code>jfw_unlock()</code>. The function should be called if one
643 needs an exact snapshot of the current settings. Then the settings
644 are retrieved one by one without risk that the settings may be changed
645 by a different thread. Similarity if one needs to make settings which
646 should become effective at the same time then <code>jfw_lock</code>
647 should be called. That is, <code>jfw_startVM</code> which uses the
648 settings cannot be called before all settings have be made.</p>
650 The only functions which is not effected by <code>jfw_lock</code> is
651 <code>jfw_areEqualJavaInfo</code>.
653 JVMFWK_DLLPUBLIC void jfw_lock();
655 /** unlocks this API.
657 <p>This function is called after <code>jfw_lock</code>. It allows other
658 threads to use this API concurrently.</p>
660 JVMFWK_DLLPUBLIC void jfw_unlock();
662 #endif
664 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */