2004-04-19 13:09:00 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: framework.h,v $
|
|
|
|
*
|
2004-05-04 07:43:42 +00:00
|
|
|
* $Revision: 1.7 $
|
2004-04-19 13:09:00 +00:00
|
|
|
*
|
2004-05-04 07:43:42 +00:00
|
|
|
* last change: $Author: jl $ $Date: 2004-05-04 08:43:41 $
|
2004-04-19 13:09:00 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
2004-04-22 11:52:40 +00:00
|
|
|
* * Copyright 2000 by Sun Microsystems, Inc.
|
2004-04-19 13:09:00 +00:00
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
2004-04-22 11:52:40 +00:00
|
|
|
* * The contents of this file are subject to the Sun Industry Standards
|
2004-04-19 13:09:00 +00:00
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** @HTML */
|
|
|
|
|
2004-04-19 13:09:00 +00:00
|
|
|
#if !defined INCLUDED_JVMFWK_FRAMEWORK_H
|
|
|
|
#define INCLUDED_JVMFWK_FRAMEWORK_H
|
|
|
|
|
|
|
|
#include "rtl/ustring.h"
|
|
|
|
#include "osl/mutex.h"
|
|
|
|
#include "jni.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** @file
|
|
|
|
All settings made by this API are done for the current user if not
|
|
|
|
mentioned differently.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** indicates that a JRE has an accessibility bridge installed.
|
|
|
|
<p>
|
|
|
|
The flag is used with JavaInfo::nFeatures.</p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
#define JFW_FEATURE_ACCESSBRIDGE 0x1l
|
2004-04-22 11:52:40 +00:00
|
|
|
/** indicates that there must be an environment set up before the Java process
|
|
|
|
runs.
|
|
|
|
<p>Therefore, when a Java is selected in OO then the office must be
|
|
|
|
restarted, so that the changes can take effect.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
#define JFW_REQUIRE_NEEDRESTART 0x1l
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** error codes which are returned by functions of this API.
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
JFW_E_NONE,
|
|
|
|
JFW_E_ERROR,
|
|
|
|
JFW_E_INVALID_ARG,
|
|
|
|
JFW_E_NO_SELECT,
|
|
|
|
JFW_E_INVALID_SETTINGS,
|
|
|
|
JFW_E_NEED_RESTART,
|
|
|
|
JFW_E_RUNNING_JVM,
|
|
|
|
JFW_E_JAVA_DISABLED,
|
|
|
|
JFW_E_CONFIG_READWRITE,
|
|
|
|
JFW_E_FORMAT_STORE,
|
|
|
|
JFW_E_NO_PLUGIN,
|
|
|
|
JFW_E_NOT_RECOGNIZED,
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_FAILED_VERSION,
|
2004-04-19 13:09:00 +00:00
|
|
|
JFW_E_NO_JAVA_FOUND
|
|
|
|
} javaFrameworkError;
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** an instance of this struct represents an installation of a Java
|
|
|
|
Runtime Environment (JRE).
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
<p>
|
|
|
|
Instances of this struct are created by the plug-in libraries which are used by
|
|
|
|
this framework (jvmfwk/vendorplugin.h). The memory of the instances is created
|
|
|
|
by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must
|
|
|
|
be freed by <code>rtl_freeMemory</code>. Also the contained members must be
|
|
|
|
freed particularly.
|
|
|
|
For convenience this API provides the function <code>jfw_freeJavaInfo</code>
|
|
|
|
which frees the objects properly. </p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
struct _JavaInfo
|
|
|
|
{
|
2004-04-22 11:52:40 +00:00
|
|
|
/** contains the vendor.
|
|
|
|
|
|
|
|
<p>string must be the same as the one obtained from the
|
|
|
|
Java system property <code>java.vendor</code>.
|
|
|
|
</p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
rtl_uString *sVendor;
|
2004-04-22 11:52:40 +00:00
|
|
|
/** contains the file URL to the installation directory.
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
rtl_uString *sLocation;
|
2004-04-22 11:52:40 +00:00
|
|
|
/** contains the version of this Java distribution.
|
|
|
|
|
|
|
|
<p>The version string must adhere to the rules
|
|
|
|
about how a version string has to be formed. These rules may
|
|
|
|
be vendor-dependent. Essentially the strings must syntactically
|
|
|
|
equal the Java system property <code>java.version</code>.
|
|
|
|
</p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
rtl_uString *sVersion;
|
2004-04-22 11:52:40 +00:00
|
|
|
/** indicates supported special features.
|
|
|
|
|
|
|
|
<p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
|
|
|
|
assistive technology tools are supported.</p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
sal_uInt64 nFeatures;
|
2004-04-22 11:52:40 +00:00
|
|
|
/** indicates requirments for running the java runtime.
|
|
|
|
|
|
|
|
<p>For example, it may be necessary to prepare the environment before
|
|
|
|
the runtime is created. That could mean, setting the
|
|
|
|
<code>LD_LIBRARY_PATH</code>
|
|
|
|
when <code>nRequirements</code> contains the flag
|
|
|
|
<code>JFW_REQUIRE_NEEDRESTART</code></p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
sal_uInt64 nRequirements;
|
2004-04-22 11:52:40 +00:00
|
|
|
/** contains data needed for the creation of the java runtime.
|
|
|
|
|
|
|
|
<p>There is no rule about the format and content of the sequence's
|
|
|
|
values. The plug-in libraries can put all data, necessary for
|
|
|
|
starting the java runtime into this sequence. </p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
sal_Sequence * arVendorData;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _JavaInfo JavaInfo;
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** frees the memory of a <code>JavaInfo</code> object.
|
2004-04-19 13:09:00 +00:00
|
|
|
@param pInfo
|
|
|
|
The object which is to be freed. It can be NULL;
|
|
|
|
*/
|
|
|
|
void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
/** compares two <code>JavaInfo</code> objects for equality.
|
|
|
|
|
|
|
|
<p>Two <code>JavaInfo</code> objects are said to be equal if the contained
|
|
|
|
members of the first <code>JavaInfo</code> are equal to their counterparts
|
|
|
|
in the second <code>JavaInfo</code> object. The equality of the
|
|
|
|
<code>rtl_uString</code> members is determined
|
|
|
|
by the respective comparison function (see
|
|
|
|
<code>rtl::OUString::equals</code>).
|
|
|
|
Similiarly the equality of the <code>sal_Sequence</code> is
|
|
|
|
also determined by a comparison
|
|
|
|
function (see <code>rtl::ByteSequence::operator ==</code>). </p>
|
|
|
|
<p>
|
|
|
|
Both argument pointers must be valid.</p>
|
|
|
|
@param pInfoA
|
|
|
|
the first argument.
|
|
|
|
@param pInfoB
|
|
|
|
the second argument which is compared with the first.
|
|
|
|
@return
|
|
|
|
sal_True - both object represent the same JRE.</br>
|
|
|
|
sal_False - the objects represend different JREs
|
2004-04-21 11:16:19 +00:00
|
|
|
*/
|
|
|
|
sal_Bool SAL_CALL jfw_areEqualJavaInfo(
|
|
|
|
JavaInfo const * pInfoA,JavaInfo const * pInfoB);
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
/** determines if a Java Virtual Machine is already running.
|
|
|
|
|
|
|
|
<p>As long as the the office and the JREs only support one
|
|
|
|
Virtual Machine per process the Java settings, particulary the
|
|
|
|
selected Java, are not effective immediatly after changing when
|
|
|
|
a VM has already been running. That is, if a JRE A was used to start
|
|
|
|
a VM and then a JRE B is selected, then JRE B will only be used
|
|
|
|
after a restart of the office.</p>
|
|
|
|
<p>
|
|
|
|
By determining if a VM is running, the user can be presented a message,
|
|
|
|
that the changed setting may not be effective immediately.</p>
|
|
|
|
|
|
|
|
@param bRunning
|
|
|
|
[out] sal_True - a VM is running. <br/>
|
|
|
|
sal_False - no VM is running.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
2004-04-22 11:52:40 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning);
|
|
|
|
|
|
|
|
/** detects a suitable JRE and configures the framework to use it.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
<p>Which JREs can be used is determined by the file javavendors.xml,
|
|
|
|
which contains version requirements, as well as information about available
|
|
|
|
plug-in libraries. Only these libraries are responsible for locating JRE
|
|
|
|
installations.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
JREs can be provided by different vendors. In order to find the JREs of
|
|
|
|
a certain vendor a plug-in library must be provided. There must be only one
|
|
|
|
library for one vendor. The names of locations of those libraries have to
|
2004-04-23 07:40:39 +00:00
|
|
|
be put into the javavendors.xml file.<br/>
|
|
|
|
The function uses the plug-in libraries to obtain information about JRE
|
|
|
|
installation and checks if they there is one among them that supports
|
|
|
|
a set of features (currently only accessibilty is possible). If none was
|
|
|
|
found then it also uses a list of paths, which have been registered
|
|
|
|
by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>
|
|
|
|
to find JREs. Found JREs are examined in the same way.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
A JRE installation is only selected if it meets the version requirements.
|
|
|
|
Information about the selected JRE are made persistent so that
|
|
|
|
subsequent calls to <code>jfw_getSelectedJRE</code> returns this
|
|
|
|
information.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
While determining a proper JRE this function takes into account if a
|
|
|
|
user requires support for assistive technology tools. If user
|
|
|
|
need that support they have to set up their system accordingly. When support
|
|
|
|
for assistive technology is required, then the lists of
|
|
|
|
<code>JavaInfo</code> objects,
|
|
|
|
which are provided by the <code>getJavaInfo</code> functions of the plug-ins, are
|
|
|
|
examined for a suitable JRE. That is, the <code>JavaInfo</code> objects
|
|
|
|
from the list
|
|
|
|
obtained from the first plug-in, are examined. If no <code>JavaInfo</code>
|
|
|
|
object has the flag
|
|
|
|
<code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>
|
|
|
|
then the
|
|
|
|
next plug-in is used to obtain a list of <code>JavaInfo</code> objects.
|
|
|
|
This goes on until a <code>JavaInfo</code> object was found which
|
|
|
|
represents a suitable JRE. Or neither plug-in provided such a
|
|
|
|
<code>JavaInfo</code> object. In that case the first
|
|
|
|
<code>JavaInfo</code> object from the first plug-in is used to determine
|
|
|
|
the JRE which is to be used.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
If there is no need for the support of assistive technology tools then
|
|
|
|
the first <code>JavaInfo</code> object from the list obtained by the
|
|
|
|
first plug-in is used. If this plug-in does not find any JREs then the
|
|
|
|
next plug-in is used, and so on.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@param ppInfo
|
2004-04-22 11:52:40 +00:00
|
|
|
[out] a <code>JavaInfo</code> pointer, representing the selected JRE.
|
|
|
|
The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
|
|
|
|
<code>JavaInfo</code> is for informational purposes only. It is not
|
|
|
|
necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
|
|
|
|
<code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
|
|
|
|
overwritten, without attempting to free <code>*ppInfo</code>.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_ERROR an error occurred. <br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
|
|
|
|
JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
2004-04-22 11:52:40 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo);
|
|
|
|
|
|
|
|
/** provides information about all availabe JRE installations.
|
|
|
|
|
|
|
|
<p>The function determines dynamically what JREs are available. It uses
|
|
|
|
the plug-in libraries to provide lists of available <code>JavaInfo</code>
|
|
|
|
objects where each object represents a JRE (see vendorplugin.h,
|
|
|
|
getAllJavaInfos). It also uses a list of paths, which have been registered
|
|
|
|
by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>.
|
|
|
|
It is checked if the path still contains a valid JRE and if so the respective
|
|
|
|
<code>JavaInfo</code> object will be appended to the array unless there is
|
|
|
|
already an equal object.</p>
|
|
|
|
|
|
|
|
@param parInfo
|
|
|
|
[out] on returns it contains a pointer to an array of <code>JavaInfo</code>
|
|
|
|
pointers.
|
|
|
|
The caller must free the array with <code>rtl_freeMemory</code> and each
|
|
|
|
element of the array must be freed with <code>jfw_freeJavaInfo</code>.
|
|
|
|
@param pSize
|
|
|
|
[out] on return contains the size of array returned in <code>parInfo</code>.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
|
|
|
|
JFW_E_ERROR an error occurred. <br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
|
|
|
|
*/
|
2004-04-21 08:30:36 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_findAllJREs(
|
2004-04-22 11:52:40 +00:00
|
|
|
JavaInfo ***parInfo, sal_Int32 *pSize);
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** determines if a path points to a Java installation.
|
|
|
|
|
|
|
|
<p>If the path belongs to a JRE installation then it returns the
|
|
|
|
respective <code>JavaInfo</code> object. The function uses the
|
|
|
|
<code>getJavaInfoByPath</code> function of the plug-ins to obtain the
|
|
|
|
<code>JavaInfo</code> object. Only if the JRE found at the specified location
|
|
|
|
meets the version requirements as specified in the javavendors.xml file a
|
|
|
|
<code>JavaInfo</code> object is returned.<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
The functions only checks if a JRE exists but does not modify any settings.
|
|
|
|
To make the found JRE the "selected JRE" one has
|
|
|
|
to call <code>jfw_setSelectedJRE</code>.</p>
|
|
|
|
|
2004-04-19 13:09:00 +00:00
|
|
|
@param pPath
|
2004-04-22 11:52:40 +00:00
|
|
|
[in] a file URL to a directory.
|
2004-04-19 13:09:00 +00:00
|
|
|
@param pInfo
|
2004-04-22 11:52:40 +00:00
|
|
|
[out] the <code>JavaInfo</code> object which represents a JRE found at the
|
|
|
|
location specified by <code>pPath</code>
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
|
|
|
|
JFW_E_ERROR an error occurred. <br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
|
|
|
|
JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
|
|
|
|
JFW_E_FAILED_VERSION a JRE was detected but if failed the version
|
|
|
|
requirements as determined by the javavendors.xml
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
|
|
|
|
rtl_uString *pPath, JavaInfo **ppInfo);
|
|
|
|
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** starts a Java Virtual Machine (JVM).
|
|
|
|
|
|
|
|
<p>The function uses the current settings to start a JVM. The actual
|
|
|
|
start-up code, however, is provided by the plug-in libraries. The setting
|
|
|
|
of the "selected Java" contains the information as to what vendor
|
|
|
|
the respective JRE comes from. In the javavendors.xml there is a mapping of
|
|
|
|
vendor names to the respective plug-in libraries.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
The function ultimately calls <code>startJavaVirtualMachine</code> from
|
|
|
|
the plug-in library.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
The <code>arOptions</code>
|
|
|
|
argument contains start arguments which are passed in JavaVMOption structures
|
|
|
|
to the VM during its creation. These
|
|
|
|
could be things, such as language settings, proxy settings or any other
|
|
|
|
properties which shall be obtainable by
|
|
|
|
<code>java.lang.System.getProperties</code>. One can also pass options which
|
|
|
|
have a certain meaning to the runtime behaviour such as -ea or -X... However,
|
|
|
|
one must be sure that these options can be interpreted by the VM.<br/>
|
|
|
|
The class path cannot be set this way. The class path is internally composed by
|
|
|
|
the paths to archives in a certain directory, which is preconfigured in
|
|
|
|
the internal data store and the respective user setting (see
|
|
|
|
<code>jfw_setUserClassPath</code>.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
If a JRE was selected at runtime which was different from the previous
|
|
|
|
setting and that JRE needs a prepared environment, for example an adapted
|
|
|
|
<code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
|
|
|
|
created and JFW_E_NEED_RESTART error is returned. If a VM is already running
|
|
|
|
then a JFW_E_RUNNING_JVM is returned.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@param arOptions
|
2004-04-22 11:52:40 +00:00
|
|
|
[in] the array containing additional start arguments or NULL.
|
|
|
|
@param nSize
|
|
|
|
[in] the size of the array <code>arOptions</code>.
|
|
|
|
@param ppVM
|
|
|
|
[out] the <code>JavaVM</code> pointer.
|
|
|
|
@param ppEnv
|
|
|
|
[out] the <code>JNIenv</code> pointer.
|
|
|
|
|
2004-04-19 13:09:00 +00:00
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or
|
|
|
|
<code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/>
|
|
|
|
JFW_E_ERROR an error occurred. <br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
JFW_E_NO_PLUGIN the plug-in library responsible for creating the VM
|
|
|
|
could not be found.<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NO_SELECT there is no JRE selected yet. <br/>
|
|
|
|
JFW_E_RUNNIN_JVM there is already a VM running.<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
|
2004-04-22 11:52:40 +00:00
|
|
|
JRE has been selected afterwards. <br/>
|
|
|
|
JFW_E_NEED_RESTART in the current process a different JRE has been selected
|
2004-04-19 13:09:00 +00:00
|
|
|
which needs a prepared environment, which has to be done before the office
|
2004-04-22 11:52:40 +00:00
|
|
|
process. Therefore the new JRE may not be used until the office was restarted.<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
2004-04-22 11:52:40 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions,
|
|
|
|
sal_Int32 nSize, JavaVM **ppVM,
|
2004-04-19 13:09:00 +00:00
|
|
|
JNIEnv **ppEnv);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** determines the JRE that is to be used.
|
|
|
|
|
|
|
|
<p>When calling <code>jfw_startVM</code> then a VM is startet from
|
|
|
|
the JRE that is determined by this function.<br/>
|
|
|
|
It is not verified if the JRE represented by the <code>JavaInfo</code>
|
|
|
|
argument meets the requirements as specified by the javavendors.xml file.
|
|
|
|
However, usually one obtains the <code>JavaInfo</code> object from the
|
|
|
|
functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
|
|
|
|
which do verify the JREs and pass out only <code>JavaInfo</code> objects
|
|
|
|
which comply with the version requirements.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
If <code>pInfo</code> is NULL then the meaning is that no JRE will be
|
|
|
|
selected. <code>jfw_startVM</code> will then return
|
|
|
|
<code>JFW_E_NO_SELECT</code>.</p>
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@param pInfo
|
2004-04-22 11:52:40 +00:00
|
|
|
[in] pointer to <code>JavaInfo</code> structure, containing data about a
|
|
|
|
JRE. The caller must still free <code>pInfo</code>.
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
2004-04-22 11:52:40 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo);
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** provides information about the JRE that is to be used.
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-05-04 07:43:42 +00:00
|
|
|
If no JRE is currently selected then <code>ppInfo</code> will contain
|
|
|
|
NULL on return.</br>
|
2004-04-19 13:09:00 +00:00
|
|
|
If the value of the element <updated> in the javavendors.xml file was
|
|
|
|
changed since the time when the last Java was selected then this
|
2004-04-22 11:52:40 +00:00
|
|
|
function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
|
|
|
|
a product patch. Then new version requirements may be introduces, so that
|
|
|
|
the currently selected JRE may not meet these requirements anymore.
|
2004-04-19 13:09:00 +00:00
|
|
|
</p>
|
2004-04-22 11:52:40 +00:00
|
|
|
@param ppInfo
|
|
|
|
[out] on return it contains a pointer to a <code>JavaInfo</code> object
|
|
|
|
that represents the currently selected JRE. When <code>*ppInfo</code> is not
|
|
|
|
NULL then the function overwrites the pointer. It is not attempted to free
|
|
|
|
the pointer.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
|
|
|
|
JRE has been selected afterwards. <br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
2004-04-22 11:52:40 +00:00
|
|
|
javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo);
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** determines if Java can be used.
|
|
|
|
|
|
|
|
<p>If <code>bEnabled</code> is <code>sal_False</code> then a call
|
|
|
|
to jfw_startVM will result in an error with the errorcode
|
|
|
|
<code>JFW_E_JAVA_DISABLED</code></p>
|
|
|
|
|
|
|
|
@param bEnabled
|
|
|
|
[in] use of Java enabled/disabled.
|
|
|
|
|
2004-04-19 13:09:00 +00:00
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** provides the information if Java can be used.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG pbEnabled is NULL<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** determines parameters which are passed to VM during its creation.
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
<p>The strings must be exactly as they are passed on the command line.
|
|
|
|
For example, one could pass<br/>
|
|
|
|
-Xdebug <br/>
|
|
|
|
-Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
|
|
|
|
in order to enable debugging support.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
@param arParameters
|
|
|
|
[in] contains the arguments. It can be NULL if nSize is 0.
|
|
|
|
@param nSize
|
|
|
|
[i] the size of <code>arArgs</code>
|
2004-04-19 13:09:00 +00:00
|
|
|
|
|
|
|
@return
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG arArgs is NULL and nSize is not 0
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_setVMParameters(
|
2004-04-22 11:52:40 +00:00
|
|
|
rtl_uString ** arArgs, sal_Int32 nSize);
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** obtains the currently used start parameters.
|
|
|
|
|
|
|
|
<p>The caller needs to free the returned array with
|
|
|
|
<code>rtl_freeMemory</code>. The contained strings must be released with
|
|
|
|
<code>rtl_uString_release</code>.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
@param parParameters
|
|
|
|
[out] on returns contains a pointer to the array of the start arguments.
|
|
|
|
If *parParameters is not NULL then the value is overwritten.
|
|
|
|
@param pSize
|
|
|
|
[out] on return contains the size of array returned in
|
|
|
|
<code>parParameters</code>
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG parParameters or pSize are NULL<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
2004-04-22 11:52:40 +00:00
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_getVMParameters(
|
|
|
|
rtl_uString *** parParameters,
|
2004-04-21 08:30:36 +00:00
|
|
|
sal_Int32 * pSize);
|
2004-04-19 13:09:00 +00:00
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** sets the user class path.
|
|
|
|
|
|
|
|
<p>When the VM is started then it is passed the class path. The
|
2004-04-26 10:20:34 +00:00
|
|
|
class path also contains the user class path set by this function.
|
|
|
|
The paths contained in <code>pCP</code> must be separated with a
|
|
|
|
system dependent path separator.</p>
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
@param pCP
|
|
|
|
[in] the user class path.
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG pCP is NULL.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCP);
|
2004-04-22 11:52:40 +00:00
|
|
|
/** provides the value of the current user class path.
|
|
|
|
|
|
|
|
<p>The function returns an empty string if no user class path is set.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
@param ppCP
|
|
|
|
[out] contains the user class path on return. If <code>*ppCP</code> was
|
|
|
|
not NULL then the value is overwritten. No attempt at freeing that string
|
|
|
|
is made.
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG ppCP is NULL.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP);
|
|
|
|
|
|
|
|
/** saves the location of a JRE.
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
<p>When <code>jfw_findAllJREs</code> is called then the paths added by this
|
2004-04-19 13:09:00 +00:00
|
|
|
function are evaluated. If the location still represents a
|
2004-04-22 11:52:40 +00:00
|
|
|
JRE then a <code>JavaInfo</code> object is created which is returned along
|
|
|
|
with all other <code>JavaInfo</code> objects by
|
|
|
|
<code>jfw_findAllJREs</code>. If the location
|
|
|
|
cannot be recognized then the location string is ignored. </p>
|
2004-04-19 13:09:00 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
A validation if <code>sLocation</code> points to a JRE is not
|
|
|
|
performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
|
2004-04-19 13:09:00 +00:00
|
|
|
</p>
|
2004-04-21 08:30:36 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
Adding a path that is already stored causes no error.</p>
|
|
|
|
|
2004-04-19 13:09:00 +00:00
|
|
|
@param sLocation
|
2004-04-22 11:52:40 +00:00
|
|
|
[in] file URL to a directory which contains a JRE.
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG sLocation is NULL.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
|
|
|
|
@see jfw_setJRELocations
|
2004-04-19 13:09:00 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** saves the locations of a number of JREs.
|
|
|
|
|
2004-04-21 08:30:36 +00:00
|
|
|
<p>
|
|
|
|
The function does not verify if the paths points to JRE. However,
|
|
|
|
it makes sure that every path is unique. That is, if the array
|
2004-04-22 11:52:40 +00:00
|
|
|
contains strings which are the same then only one is stored.</p>
|
2004-04-21 08:30:36 +00:00
|
|
|
<p>
|
2004-04-22 11:52:40 +00:00
|
|
|
If <code>arLocations</code> is NULL or it has the length null (nSize = 0)
|
2004-04-21 08:30:36 +00:00
|
|
|
then all previously stored paths are deleted. Otherwise,
|
|
|
|
the old values are overwritten.</p>
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
@param arLocations
|
|
|
|
[in] array of paths to locations of JREs.
|
|
|
|
|
|
|
|
@param nSize
|
|
|
|
[in] the size of the array <code>arLocations</code>
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG arLocation is NULL and nSize is not null.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
|
|
|
|
|
|
|
@see jfw_addJRELocations
|
2004-04-21 08:30:36 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_setJRELocations(
|
|
|
|
rtl_uString ** arLocations, sal_Int32 nSize);
|
|
|
|
/** obtains an array containing paths to JRE installations.
|
2004-04-22 11:52:40 +00:00
|
|
|
|
2004-04-21 08:30:36 +00:00
|
|
|
<p>
|
|
|
|
It is not guaranteed that the returned paths represent
|
2004-04-22 11:52:40 +00:00
|
|
|
a valid JRE. One can use <code>jfw_getJavaInfoByPath</code> to check this.
|
2004-04-21 08:30:36 +00:00
|
|
|
</p>
|
2004-04-22 11:52:40 +00:00
|
|
|
|
|
|
|
@param parLocations
|
|
|
|
[out] on return it contains the array of paths.
|
|
|
|
@param pSize
|
|
|
|
[out] on return it contains the size of the array <code>parLocations</code>.
|
|
|
|
|
|
|
|
@return
|
|
|
|
JFW_E_NONE function ran successfully.<br/>
|
|
|
|
JFW_E_INVALIDARG parLocation is NULL or pSize is NULL.<br/>
|
|
|
|
JFW_E_ERROR An error occurred.<br/>
|
|
|
|
JFW_E_CONFIG_READWRITE an error occurred while reading or writing to
|
|
|
|
the internally used data store. <br/>
|
|
|
|
JFW_E_FORMAT_STORE the internally used data store has not the
|
|
|
|
expected format<br/>
|
2004-04-21 08:30:36 +00:00
|
|
|
*/
|
|
|
|
javaFrameworkError SAL_CALL jfw_getJRELocations(
|
|
|
|
rtl_uString *** parLocations, sal_Int32 * pSize);
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** locks this API so that it cannot be used by other threads.
|
|
|
|
|
|
|
|
<p>If a different thread called this function before then the
|
|
|
|
current call is blocked until the other thread has called
|
|
|
|
<code>jfw_unlock()</code>. The function should be called if one
|
|
|
|
needs an exact snapshot of the current settings. Then the settings
|
|
|
|
are retrieved one by one without risk that the settings may be changed
|
|
|
|
by a different thread. Similiary if one needs to make settings which
|
|
|
|
should become effective at the same time then <code>jfw_lock</code>
|
|
|
|
should be called. That is, <code>jfw_startVM</code> which uses the
|
|
|
|
settings cannot be called before all settings have be made.</p>
|
|
|
|
<p>
|
|
|
|
The only functions which are not effected by <code>jfw_lock</code> are
|
|
|
|
<code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
void SAL_CALL jfw_lock();
|
|
|
|
|
2004-04-22 11:52:40 +00:00
|
|
|
/** unlocks this API.
|
|
|
|
|
|
|
|
<p>This function is called after <code>jfw_lock</code>. It allows other
|
|
|
|
threads to use this API concurrently.</p>
|
|
|
|
*/
|
2004-04-19 13:09:00 +00:00
|
|
|
void SAL_CALL jfw_unlock();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|