1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir /** @HTML */ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #if !defined INCLUDED_JVMFWK_FRAMEWORK_H 31*cdf0e10cSrcweir #define INCLUDED_JVMFWK_FRAMEWORK_H 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "rtl/ustring.h" 34*cdf0e10cSrcweir #include "osl/mutex.h" 35*cdf0e10cSrcweir #ifdef SOLAR_JAVA 36*cdf0e10cSrcweir #include "jni.h" 37*cdf0e10cSrcweir #else 38*cdf0e10cSrcweir struct JavaVMOption; 39*cdf0e10cSrcweir struct JavaVM; 40*cdf0e10cSrcweir struct JNIEnv; 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #ifdef __cplusplus 44*cdf0e10cSrcweir extern "C" { 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir /** @file 48*cdf0e10cSrcweir <p>This library can operate in two modes, application mode and direct mode.</p> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir <h2>Application Mode</h2> 52*cdf0e10cSrcweir In application mode the Java related settings are stored in files. 53*cdf0e10cSrcweir There are currently three files which need to be accessed. They are determined 54*cdf0e10cSrcweir by bootstrap parameters:</p> 55*cdf0e10cSrcweir <dl> 56*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt> 57*cdf0e10cSrcweir <dd>contains vendor and version information about JREs as well as the 58*cdf0e10cSrcweir location of plugin-libraries which are responsible for providing information 59*cdf0e10cSrcweir about these JREs as well as starting the VMs.</dd> 60*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_USER_DATA</dt> 61*cdf0e10cSrcweir <dd>The file contains settings for a particular user. One can use the macro 62*cdf0e10cSrcweir $SYSUSERCONFIG in the URL which expands to a directory whery the user's data are 63*cdf0e10cSrcweir kept. On UNIX this would be the home directory and on Windows some sub-directory 64*cdf0e10cSrcweir of the "Documents and Settings" folder.The content of this file is an 65*cdf0e10cSrcweir implementation detail and may change in the future.</dd> 66*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_SHARED_DATA</dt> 67*cdf0e10cSrcweir <dd>The file contains settings valid for all users. If a user changes a setting 68*cdf0e10cSrcweir then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA. 69*cdf0e10cSrcweir The content of this file is an implementation detail and may change in the future.</dd> 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_INSTALL_DATA</dt> 72*cdf0e10cSrcweir <dd><b>DEPRECATED. Support for this variable will soon be removed.</b><br> 73*cdf0e10cSrcweir The file contains settings for all users. A user cannot override these settings. 74*cdf0e10cSrcweir When this parameter is provided then UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA 75*cdf0e10cSrcweir are irrelevant. This parameter is intended for use during the setup. For example, to 76*cdf0e10cSrcweir install extensions which contain java components. If there is already a file at this 77*cdf0e10cSrcweir location then it will be overwritten if it is too old. The period of validatity is per 78*cdf0e10cSrcweir default one hour. This value can be overridden by the bootstrap parameter 79*cdf0e10cSrcweir UNO_JAVA_JFW_INSTALL_EXPIRE (<b>DEPRECATED</b>). Setting this variable to 1000 means 80*cdf0e10cSrcweir the settings file is only valid for 1000 seconds. 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir <p>If one would not use UNO_JAVA_JFW_INSTALL_DATA during setup then most probably 83*cdf0e10cSrcweir a user installation directory would be created in the home directory of root. This is 84*cdf0e10cSrcweir because, java settings are determined and stored on behalf of the current user. In other 85*cdf0e10cSrcweir words UNO_JAVA_JFW_USER_DATA would be used which points into the user installation. 86*cdf0e10cSrcweir </p> 87*cdf0e10cSrcweir <p>UNO_JAVA_JFW_INSTALL_DATA could point into the shared installation, provided that 88*cdf0e10cSrcweir only people with root rights can install OOo. Then one has to take care that the 89*cdf0e10cSrcweir installer removes this file when uninstalling. 90*cdf0e10cSrcweir </p> 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir The content of this file is an implementation detail and may change in the future.</dd> 94*cdf0e10cSrcweir </dl> 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir <p>The values for these parameters must be file URLs and include the file name, for 97*cdf0e10cSrcweir example:<br> 98*cdf0e10cSrcweir file:///d:/MyApp/javavendors.xml<br> 99*cdf0e10cSrcweir All files are XML files and must have the extension .xml.</p> 100*cdf0e10cSrcweir <p> 101*cdf0e10cSrcweir Modifying the shared settings is currently not supported by the framework. To provide 102*cdf0e10cSrcweir Java settings for all users one can run OOo and change the settings in the 103*cdf0e10cSrcweir options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA. 104*cdf0e10cSrcweir The file can then be copied into the base installation. 105*cdf0e10cSrcweir Other users will use automatically these data but can override the settings in 106*cdf0e10cSrcweir the options dialog. This mechanism may change in the future. 107*cdf0e10cSrcweir </p> 108*cdf0e10cSrcweir <p>If shared Java settings are not supported by an application then it is not 109*cdf0e10cSrcweir necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>. 110*cdf0e10cSrcweir </p> 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir <p>Setting the class path used by a Java VM should not be necesarry. The locations 113*cdf0e10cSrcweir of Jar files should be knows by a class loader. If a jar file depends on another 114*cdf0e10cSrcweir jar file then it can be referenced in the manifest file of the first jar. However, 115*cdf0e10cSrcweir a user may add jars to the class path by using this API. If it becomes necessary 116*cdf0e10cSrcweir to add files to the class path which is to be used by all users then one can use 117*cdf0e10cSrcweir the bootrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs 118*cdf0e10cSrcweir which must be separated by spaces.</p> 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir <h2>Direct Mode</h2> 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir <p>The direct mode is intended for a scenario where no configuration files 124*cdf0e10cSrcweir are available and a Java VM shall be run. That is, 125*cdf0e10cSrcweir the files containing the user and shared settings are not specified by the 126*cdf0e10cSrcweir bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA. 127*cdf0e10cSrcweir For example, tools, such as regcomp, may use this framework in a build 128*cdf0e10cSrcweir environment. Then one would want to use settings which have been specified 129*cdf0e10cSrcweir by the build environment. The framework would automatically use the 130*cdf0e10cSrcweir current settings when they change in the environment. 131*cdf0e10cSrcweir </p> 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir <p> Here are examples how regcomp could be invoked using bootstrap parameters: 134*cdf0e10cSrcweir </p> 135*cdf0e10cSrcweir <p> 136*cdf0e10cSrcweir regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 137*cdf0e10cSrcweir -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar" 138*cdf0e10cSrcweir -register .... 139*cdf0e10cSrcweir </p> 140*cdf0e10cSrcweir <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p> 141*cdf0e10cSrcweir <p> 142*cdf0e10cSrcweir regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 143*cdf0e10cSrcweir -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar" 144*cdf0e10cSrcweir -env:UNO_JAVA_JFW_PLUGIN=file:\\solver\\bin\\sunjavaplugin.dll -register .... 145*cdf0e10cSrcweir </p> 146*cdf0e10cSrcweir <p>Additionall parameters for the Java VM can be provided. For every parameter 147*cdf0e10cSrcweir a seperate bootstrap parameter must be specified. The names are 148*cdf0e10cSrcweir <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p> 149*cdf0e10cSrcweir <p> 150*cdf0e10cSrcweir regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug 151*cdf0e10cSrcweir -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100 152*cdf0e10cSrcweir -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 153*cdf0e10cSrcweir -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar" 154*cdf0e10cSrcweir -register ....</p> 155*cdf0e10cSrcweir <p> 156*cdf0e10cSrcweir Here is a complete list of the bootstrap parameter for the direct mode: 157*cdf0e10cSrcweir </p> 158*cdf0e10cSrcweir <dl> 159*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_JREHOME</dt> 160*cdf0e10cSrcweir <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified 161*cdf0e10cSrcweir in direct mode</dd> 162*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_ENV_JREHOME</dt> 163*cdf0e10cSrcweir <dd>Setting this parameter, for example to "1" or "true", 164*cdf0e10cSrcweir causes the framework to use the environment variable JAVA_HOME. It is expected 165*cdf0e10cSrcweir that JAVA_HOME contains a system path rather than a file URL. This parameter 166*cdf0e10cSrcweir and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd> 167*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_CLASSPATH</dt> 168*cdf0e10cSrcweir <dd>Contains the class path which is to be used by the VM. Special character, 169*cdf0e10cSrcweir such as '\','{','}','$' must be preceded with '\'. See documentation about the 170*cdf0e10cSrcweir bootstrap parameter.</dd> 171*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt> 172*cdf0e10cSrcweir <dd>Setting this parameter,for example to "1" or "true", 173*cdf0e10cSrcweir causes the framework to use the 174*cdf0e10cSrcweir environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are 175*cdf0e10cSrcweir set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment 176*cdf0e10cSrcweir variable CLASSPATH.</dd> 177*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_PLUGIN</dt> 178*cdf0e10cSrcweir <dd>Specified a file URL to a plugin library. If this variable is provided 179*cdf0e10cSrcweir then a javavendors.xml is ignored. It must be provided if no 180*cdf0e10cSrcweir javavendors.xml is available.</dd> 181*cdf0e10cSrcweir <dt>UNO_JAVA_JFW_PARAMETER_X</dt> 182*cdf0e10cSrcweir <dd>Specifies a parameter for the Java VM. The X is replaced by 183*cdf0e10cSrcweir non-negative natural numbers starting with 1.</dd> 184*cdf0e10cSrcweir </dl> 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir <p>A note about bootstrap parameters. The implementation of the bootstrap 187*cdf0e10cSrcweir parameter mechanism interprets the characters '\', '$', '{', '}' as 188*cdf0e10cSrcweir escape characters. Thats why the Windows path contain double back-slashes. 189*cdf0e10cSrcweir One should also take into account that a console may have also special 190*cdf0e10cSrcweir escape characters.</p> 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir <h2>What mode is used</h2> 193*cdf0e10cSrcweir <p> 194*cdf0e10cSrcweir The default mode is application mode. If at least one bootstrap parameter 195*cdf0e10cSrcweir for the direct mode is provided then direct mode is used. </p> 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir <p> 198*cdf0e10cSrcweir All settings made by this API are done for the current user if not 199*cdf0e10cSrcweir mentioned differently.</p> 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir <h2>Other bootstrap variables</h2> 202*cdf0e10cSrcweir <dl> 203*cdf0e10cSrcweir <dt>JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY</dt> 204*cdf0e10cSrcweir <dd>This is a unofficial variable which was introduced to workaround external issues. 205*cdf0e10cSrcweir It may be removed in the future. By setting it to 1, the framework will not try to 206*cdf0e10cSrcweir find out if the system is configured to use accessibility tools or if a JRE has an 207*cdf0e10cSrcweir accessibiliy bridge installed</dd> 208*cdf0e10cSrcweir </dl> 209*cdf0e10cSrcweir */ 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir /** indicates that a JRE has an accessibility bridge installed. 212*cdf0e10cSrcweir <p> 213*cdf0e10cSrcweir The flag is used with JavaInfo::nFeatures.</p> 214*cdf0e10cSrcweir */ 215*cdf0e10cSrcweir #define JFW_FEATURE_ACCESSBRIDGE 0x1l 216*cdf0e10cSrcweir /** indicates that there must be an environment set up before the Java process 217*cdf0e10cSrcweir runs. 218*cdf0e10cSrcweir <p>Therefore, when a Java is selected in OO then the office must be 219*cdf0e10cSrcweir restarted, so that the changes can take effect.</p> 220*cdf0e10cSrcweir */ 221*cdf0e10cSrcweir #define JFW_REQUIRE_NEEDRESTART 0x1l 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir /** error codes which are returned by functions of this API. 224*cdf0e10cSrcweir */ 225*cdf0e10cSrcweir typedef enum _javaFrameworkError 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir JFW_E_NONE, 228*cdf0e10cSrcweir JFW_E_ERROR, 229*cdf0e10cSrcweir JFW_E_INVALID_ARG, 230*cdf0e10cSrcweir JFW_E_NO_SELECT, 231*cdf0e10cSrcweir JFW_E_INVALID_SETTINGS, 232*cdf0e10cSrcweir JFW_E_NEED_RESTART, 233*cdf0e10cSrcweir JFW_E_RUNNING_JVM, 234*cdf0e10cSrcweir JFW_E_JAVA_DISABLED, 235*cdf0e10cSrcweir JFW_E_NO_PLUGIN, 236*cdf0e10cSrcweir JFW_E_NOT_RECOGNIZED, 237*cdf0e10cSrcweir JFW_E_FAILED_VERSION, 238*cdf0e10cSrcweir JFW_E_NO_JAVA_FOUND, 239*cdf0e10cSrcweir JFW_E_VM_CREATION_FAILED, 240*cdf0e10cSrcweir JFW_E_CONFIGURATION, 241*cdf0e10cSrcweir JFW_E_DIRECT_MODE 242*cdf0e10cSrcweir } javaFrameworkError; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir /** an instance of this struct represents an installation of a Java 245*cdf0e10cSrcweir Runtime Environment (JRE). 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir <p> 248*cdf0e10cSrcweir Instances of this struct are created by the plug-in libraries which are used by 249*cdf0e10cSrcweir this framework (jvmfwk/vendorplugin.h). The memory of the instances is created 250*cdf0e10cSrcweir by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must 251*cdf0e10cSrcweir be freed by <code>rtl_freeMemory</code>. Also the contained members must be 252*cdf0e10cSrcweir freed particularly. 253*cdf0e10cSrcweir For convenience this API provides the function <code>jfw_freeJavaInfo</code> 254*cdf0e10cSrcweir which frees the objects properly. </p> 255*cdf0e10cSrcweir */ 256*cdf0e10cSrcweir struct _JavaInfo 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir /** contains the vendor. 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir <p>string must be the same as the one obtained from the 261*cdf0e10cSrcweir Java system property <code>java.vendor</code>. 262*cdf0e10cSrcweir </p> 263*cdf0e10cSrcweir */ 264*cdf0e10cSrcweir rtl_uString *sVendor; 265*cdf0e10cSrcweir /** contains the file URL to the installation directory. 266*cdf0e10cSrcweir */ 267*cdf0e10cSrcweir rtl_uString *sLocation; 268*cdf0e10cSrcweir /** contains the version of this Java distribution. 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir <p>The version string must adhere to the rules 271*cdf0e10cSrcweir about how a version string has to be formed. These rules may 272*cdf0e10cSrcweir be vendor-dependent. Essentially the strings must syntactically 273*cdf0e10cSrcweir equal the Java system property <code>java.version</code>. 274*cdf0e10cSrcweir </p> 275*cdf0e10cSrcweir */ 276*cdf0e10cSrcweir rtl_uString *sVersion; 277*cdf0e10cSrcweir /** indicates supported special features. 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that 280*cdf0e10cSrcweir assistive technology tools are supported.</p> 281*cdf0e10cSrcweir */ 282*cdf0e10cSrcweir sal_uInt64 nFeatures; 283*cdf0e10cSrcweir /** indicates requirments for running the java runtime. 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir <p>For example, it may be necessary to prepare the environment before 286*cdf0e10cSrcweir the runtime is created. That could mean, setting the 287*cdf0e10cSrcweir <code>LD_LIBRARY_PATH</code> 288*cdf0e10cSrcweir when <code>nRequirements</code> contains the flag 289*cdf0e10cSrcweir <code>JFW_REQUIRE_NEEDRESTART</code></p> 290*cdf0e10cSrcweir */ 291*cdf0e10cSrcweir sal_uInt64 nRequirements; 292*cdf0e10cSrcweir /** contains data needed for the creation of the java runtime. 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir <p>There is no rule about the format and content of the sequence's 295*cdf0e10cSrcweir values. The plug-in libraries can put all data, necessary for 296*cdf0e10cSrcweir starting the java runtime into this sequence. </p> 297*cdf0e10cSrcweir */ 298*cdf0e10cSrcweir sal_Sequence * arVendorData; 299*cdf0e10cSrcweir }; 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir typedef struct _JavaInfo JavaInfo; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir /** frees the memory of a <code>JavaInfo</code> object. 304*cdf0e10cSrcweir @param pInfo 305*cdf0e10cSrcweir The object which is to be freed. It can be NULL; 306*cdf0e10cSrcweir */ 307*cdf0e10cSrcweir void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir /** compares two <code>JavaInfo</code> objects for equality. 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir <p>Two <code>JavaInfo</code> objects are said to be equal if the contained 313*cdf0e10cSrcweir members of the first <code>JavaInfo</code> are equal to their counterparts 314*cdf0e10cSrcweir in the second <code>JavaInfo</code> object. The equality of the 315*cdf0e10cSrcweir <code>rtl_uString</code> members is determined 316*cdf0e10cSrcweir by the respective comparison function (see 317*cdf0e10cSrcweir <code>rtl::OUString::equals</code>). 318*cdf0e10cSrcweir Similiarly the equality of the <code>sal_Sequence</code> is 319*cdf0e10cSrcweir also determined by a comparison 320*cdf0e10cSrcweir function (see <code>rtl::ByteSequence::operator ==</code>). </p> 321*cdf0e10cSrcweir <p> 322*cdf0e10cSrcweir Both argument pointers must be valid.</p> 323*cdf0e10cSrcweir @param pInfoA 324*cdf0e10cSrcweir the first argument. 325*cdf0e10cSrcweir @param pInfoB 326*cdf0e10cSrcweir the second argument which is compared with the first. 327*cdf0e10cSrcweir @return 328*cdf0e10cSrcweir sal_True - both object represent the same JRE.</br> 329*cdf0e10cSrcweir sal_False - the objects represend different JREs 330*cdf0e10cSrcweir */ 331*cdf0e10cSrcweir sal_Bool SAL_CALL jfw_areEqualJavaInfo( 332*cdf0e10cSrcweir JavaInfo const * pInfoA,JavaInfo const * pInfoB); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir /** determines if a Java Virtual Machine is already running. 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir <p>As long as the the office and the JREs only support one 337*cdf0e10cSrcweir Virtual Machine per process the Java settings, particulary the 338*cdf0e10cSrcweir selected Java, are not effective immediatly after changing when 339*cdf0e10cSrcweir a VM has already been running. That is, if a JRE A was used to start 340*cdf0e10cSrcweir a VM and then a JRE B is selected, then JRE B will only be used 341*cdf0e10cSrcweir after a restart of the office.</p> 342*cdf0e10cSrcweir <p> 343*cdf0e10cSrcweir By determining if a VM is running, the user can be presented a message, 344*cdf0e10cSrcweir that the changed setting may not be effective immediately.</p> 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir @param bRunning 347*cdf0e10cSrcweir [out] sal_True - a VM is running. <br/> 348*cdf0e10cSrcweir sal_False - no VM is running. 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir @return 351*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 352*cdf0e10cSrcweir JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL. 353*cdf0e10cSrcweir */ 354*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir /** detects a suitable JRE and configures the framework to use it. 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir <p>Which JREs can be used is determined by the file javavendors.xml, 359*cdf0e10cSrcweir which contains version requirements, as well as information about available 360*cdf0e10cSrcweir plug-in libraries. Only these libraries are responsible for locating JRE 361*cdf0e10cSrcweir installations.</p> 362*cdf0e10cSrcweir <p> 363*cdf0e10cSrcweir JREs can be provided by different vendors. In order to find the JREs of 364*cdf0e10cSrcweir a certain vendor a plug-in library must be provided. There must be only one 365*cdf0e10cSrcweir library for one vendor. The names of locations of those libraries have to 366*cdf0e10cSrcweir be put into the javavendors.xml file.<br/> 367*cdf0e10cSrcweir The function uses the plug-in libraries to obtain information about JRE 368*cdf0e10cSrcweir installation and checks if they there is one among them that supports 369*cdf0e10cSrcweir a set of features (currently only accessibilty is possible). If none was 370*cdf0e10cSrcweir found then it also uses a list of paths, which have been registered 371*cdf0e10cSrcweir by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code> 372*cdf0e10cSrcweir to find JREs. Found JREs are examined in the same way.</p> 373*cdf0e10cSrcweir <p> 374*cdf0e10cSrcweir A JRE installation is only selected if it meets the version requirements. 375*cdf0e10cSrcweir Information about the selected JRE are made persistent so that 376*cdf0e10cSrcweir subsequent calls to <code>jfw_getSelectedJRE</code> returns this 377*cdf0e10cSrcweir information.</p> 378*cdf0e10cSrcweir <p> 379*cdf0e10cSrcweir While determining a proper JRE this function takes into account if a 380*cdf0e10cSrcweir user requires support for assistive technology tools. If user 381*cdf0e10cSrcweir need that support they have to set up their system accordingly. When support 382*cdf0e10cSrcweir for assistive technology is required, then the lists of 383*cdf0e10cSrcweir <code>JavaInfo</code> objects, 384*cdf0e10cSrcweir which are provided by the <code>getJavaInfo</code> functions of the plug-ins, are 385*cdf0e10cSrcweir examined for a suitable JRE. That is, the <code>JavaInfo</code> objects 386*cdf0e10cSrcweir from the list 387*cdf0e10cSrcweir obtained from the first plug-in, are examined. If no <code>JavaInfo</code> 388*cdf0e10cSrcweir object has the flag 389*cdf0e10cSrcweir <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code> 390*cdf0e10cSrcweir then the 391*cdf0e10cSrcweir next plug-in is used to obtain a list of <code>JavaInfo</code> objects. 392*cdf0e10cSrcweir This goes on until a <code>JavaInfo</code> object was found which 393*cdf0e10cSrcweir represents a suitable JRE. Or neither plug-in provided such a 394*cdf0e10cSrcweir <code>JavaInfo</code> object. In that case the first 395*cdf0e10cSrcweir <code>JavaInfo</code> object from the first plug-in is used to determine 396*cdf0e10cSrcweir the JRE which is to be used.</p> 397*cdf0e10cSrcweir <p> 398*cdf0e10cSrcweir If there is no need for the support of assistive technology tools then 399*cdf0e10cSrcweir the first <code>JavaInfo</code> object from the list obtained by the 400*cdf0e10cSrcweir first plug-in is used. If this plug-in does not find any JREs then the 401*cdf0e10cSrcweir next plug-in is used, and so on.</p> 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir @param ppInfo 404*cdf0e10cSrcweir [out] a <code>JavaInfo</code> pointer, representing the selected JRE. 405*cdf0e10cSrcweir The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The 406*cdf0e10cSrcweir <code>JavaInfo</code> is for informational purposes only. It is not 407*cdf0e10cSrcweir necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/> 408*cdf0e10cSrcweir <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is 409*cdf0e10cSrcweir overwritten, without attempting to free <code>*ppInfo</code>. 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir @return 412*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 413*cdf0e10cSrcweir JFW_E_ERROR an error occurred. <br/> 414*cdf0e10cSrcweir JFW_E_NO_PLUGIN a plug-in library could not be found.<br/> 415*cdf0e10cSrcweir JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br> 416*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. </br> 417*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 418*cdf0e10cSrcweir were not met. 419*cdf0e10cSrcweir */ 420*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir /** provides information about all availabe JRE installations. 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir <p>The function determines dynamically what JREs are available. It uses 425*cdf0e10cSrcweir the plug-in libraries to provide lists of available <code>JavaInfo</code> 426*cdf0e10cSrcweir objects where each object represents a JRE (see vendorplugin.h, 427*cdf0e10cSrcweir getAllJavaInfos). It also uses a list of paths, which have been registered 428*cdf0e10cSrcweir by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>. 429*cdf0e10cSrcweir It is checked if the path still contains a valid JRE and if so the respective 430*cdf0e10cSrcweir <code>JavaInfo</code> object will be appended to the array unless there is 431*cdf0e10cSrcweir already an equal object.</p> 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir @param parInfo 434*cdf0e10cSrcweir [out] on returns it contains a pointer to an array of <code>JavaInfo</code> 435*cdf0e10cSrcweir pointers. 436*cdf0e10cSrcweir The caller must free the array with <code>rtl_freeMemory</code> and each 437*cdf0e10cSrcweir element of the array must be freed with <code>jfw_freeJavaInfo</code>. 438*cdf0e10cSrcweir @param pSize 439*cdf0e10cSrcweir [out] on return contains the size of array returned in <code>parInfo</code>. 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir @return 442*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 443*cdf0e10cSrcweir JFW_E_INVALID_ARG at least on of the parameters was NULL<br/> 444*cdf0e10cSrcweir JFW_E_ERROR an error occurred. <br/> 445*cdf0e10cSrcweir JFW_E_NO_PLUGIN a plug-in library could not be found.<br/> 446*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 447*cdf0e10cSrcweir were not met. 448*cdf0e10cSrcweir */ 449*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_findAllJREs( 450*cdf0e10cSrcweir JavaInfo ***parInfo, sal_Int32 *pSize); 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir /** determines if a path points to a Java installation. 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir <p>If the path belongs to a JRE installation then it returns the 455*cdf0e10cSrcweir respective <code>JavaInfo</code> object. The function uses the 456*cdf0e10cSrcweir <code>getJavaInfoByPath</code> function of the plug-ins to obtain the 457*cdf0e10cSrcweir <code>JavaInfo</code> object. Only if the JRE found at the specified location 458*cdf0e10cSrcweir meets the version requirements as specified in the javavendors.xml file a 459*cdf0e10cSrcweir <code>JavaInfo</code> object is returned.<br/> 460*cdf0e10cSrcweir <p> 461*cdf0e10cSrcweir The functions only checks if a JRE exists but does not modify any settings. 462*cdf0e10cSrcweir To make the found JRE the "selected JRE" one has 463*cdf0e10cSrcweir to call <code>jfw_setSelectedJRE</code>.</p> 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir @param pPath 466*cdf0e10cSrcweir [in] a file URL to a directory. 467*cdf0e10cSrcweir @param pInfo 468*cdf0e10cSrcweir [out] the <code>JavaInfo</code> object which represents a JRE found at the 469*cdf0e10cSrcweir location specified by <code>pPath</code> 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir @return 472*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 473*cdf0e10cSrcweir JFW_E_INVALID_ARG at least on of the parameters was NULL<br/> 474*cdf0e10cSrcweir JFW_E_ERROR an error occurred. <br/> 475*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 476*cdf0e10cSrcweir were not met.</br> 477*cdf0e10cSrcweir JFW_E_NO_PLUGIN a plug-in library could not be found.<br/> 478*cdf0e10cSrcweir JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/> 479*cdf0e10cSrcweir JFW_E_FAILED_VERSION a JRE was detected but if failed the version 480*cdf0e10cSrcweir requirements as determined by the javavendors.xml 481*cdf0e10cSrcweir */ 482*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getJavaInfoByPath( 483*cdf0e10cSrcweir rtl_uString *pPath, JavaInfo **ppInfo); 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir /** starts a Java Virtual Machine (JVM). 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir <p>The function uses the current settings to start a JVM. The actual 489*cdf0e10cSrcweir start-up code, however, is provided by the plug-in libraries. The setting 490*cdf0e10cSrcweir of the "selected Java" contains the information as to what vendor 491*cdf0e10cSrcweir the respective JRE comes from. In the javavendors.xml there is a mapping of 492*cdf0e10cSrcweir vendor names to the respective plug-in libraries.</p> 493*cdf0e10cSrcweir <p> 494*cdf0e10cSrcweir The function ultimately calls <code>startJavaVirtualMachine</code> from 495*cdf0e10cSrcweir the plug-in library.</p> 496*cdf0e10cSrcweir <p> 497*cdf0e10cSrcweir The <code>arOptions</code> 498*cdf0e10cSrcweir argument contains start arguments which are passed in JavaVMOption structures 499*cdf0e10cSrcweir to the VM during its creation. These 500*cdf0e10cSrcweir could be things, such as language settings, proxy settings or any other 501*cdf0e10cSrcweir properties which shall be obtainable by 502*cdf0e10cSrcweir <code>java.lang.System.getProperties</code>. One can also pass options which 503*cdf0e10cSrcweir have a certain meaning to the runtime behaviour such as -ea or -X... However, 504*cdf0e10cSrcweir one must be sure that these options can be interpreted by the VM.<br/> 505*cdf0e10cSrcweir The class path cannot be set this way. The class path is internally composed by 506*cdf0e10cSrcweir the paths to archives in a certain directory, which is preconfigured in 507*cdf0e10cSrcweir the internal data store and the respective user setting (see 508*cdf0e10cSrcweir <code>jfw_setUserClassPath</code>.</p> 509*cdf0e10cSrcweir <p> 510*cdf0e10cSrcweir If a JRE was selected at runtime which was different from the previous 511*cdf0e10cSrcweir setting and that JRE needs a prepared environment, for example an adapted 512*cdf0e10cSrcweir <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be 513*cdf0e10cSrcweir created and JFW_E_NEED_RESTART error is returned. If a VM is already running 514*cdf0e10cSrcweir then a JFW_E_RUNNING_JVM is returned.</p> 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir @param arOptions 517*cdf0e10cSrcweir [in] the array containing additional start arguments or NULL. 518*cdf0e10cSrcweir @param nSize 519*cdf0e10cSrcweir [in] the size of the array <code>arOptions</code>. 520*cdf0e10cSrcweir @param ppVM 521*cdf0e10cSrcweir [out] the <code>JavaVM</code> pointer. 522*cdf0e10cSrcweir @param ppEnv 523*cdf0e10cSrcweir [out] the <code>JNIenv</code> pointer. 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir @return 526*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 527*cdf0e10cSrcweir JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or 528*cdf0e10cSrcweir <code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/> 529*cdf0e10cSrcweir JFW_E_ERROR an error occurred. <br/> 530*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 531*cdf0e10cSrcweir were not met.</br> 532*cdf0e10cSrcweir JFW_E_NO_PLUGIN the plug-in library responsible for creating the VM 533*cdf0e10cSrcweir could not be found.<br/> 534*cdf0e10cSrcweir JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/> 535*cdf0e10cSrcweir JFW_E_NO_SELECT there is no JRE selected yet. <br/> 536*cdf0e10cSrcweir JFW_E_RUNNIN_JVM there is already a VM running.<br/> 537*cdf0e10cSrcweir JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no 538*cdf0e10cSrcweir JRE has been selected afterwards. <br/> 539*cdf0e10cSrcweir JFW_E_NEED_RESTART in the current process a different JRE has been selected 540*cdf0e10cSrcweir which needs a prepared environment, which has to be done before the office 541*cdf0e10cSrcweir process. Therefore the new JRE may not be used until the office was restarted.<br/> 542*cdf0e10cSrcweir JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and 543*cdf0e10cSrcweir then the user enabled it. If then the selected JRE has the requirement 544*cdf0e10cSrcweir JFW_REQUIRE_NEEDRESTART then this error is returned. </br> 545*cdf0e10cSrcweir JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed 546*cdf0e10cSrcweir by a plug-in library and not by this API. 547*cdf0e10cSrcweir JFW_E_FAILED_VERSION the "Default Mode" is active. The JRE determined by 548*cdf0e10cSrcweir <code>JAVA_HOME</code>does not meet the version requirements. 549*cdf0e10cSrcweir */ 550*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, 551*cdf0e10cSrcweir sal_Int32 nSize, JavaVM **ppVM, 552*cdf0e10cSrcweir JNIEnv **ppEnv); 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir /** determines the JRE that is to be used. 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir <p>When calling <code>jfw_startVM</code> then a VM is startet from 557*cdf0e10cSrcweir the JRE that is determined by this function.<br/> 558*cdf0e10cSrcweir It is not verified if the JRE represented by the <code>JavaInfo</code> 559*cdf0e10cSrcweir argument meets the requirements as specified by the javavendors.xml file. 560*cdf0e10cSrcweir However, usually one obtains the <code>JavaInfo</code> object from the 561*cdf0e10cSrcweir functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>, 562*cdf0e10cSrcweir which do verify the JREs and pass out only <code>JavaInfo</code> objects 563*cdf0e10cSrcweir which comply with the version requirements.</p> 564*cdf0e10cSrcweir <p> 565*cdf0e10cSrcweir If <code>pInfo</code> is NULL then the meaning is that no JRE will be 566*cdf0e10cSrcweir selected. <code>jfw_startVM</code> will then return 567*cdf0e10cSrcweir <code>JFW_E_NO_SELECT</code>.</p> 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir @param pInfo 570*cdf0e10cSrcweir [in] pointer to <code>JavaInfo</code> structure, containing data about a 571*cdf0e10cSrcweir JRE. The caller must still free <code>pInfo</code>. 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir @return 574*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 575*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 576*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 577*cdf0e10cSrcweir were not met.<br/> 578*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 579*cdf0e10cSrcweir */ 580*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo); 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir /** provides information about the JRE that is to be used. 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir <p>If no JRE is currently selected then <code>ppInfo</code> will contain 586*cdf0e10cSrcweir NULL on return.</br> 587*cdf0e10cSrcweir If the value of the element <updated> in the javavendors.xml file was 588*cdf0e10cSrcweir changed since the time when the last Java was selected then this 589*cdf0e10cSrcweir function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during 590*cdf0e10cSrcweir a product patch. Then new version requirements may be introduced, so that 591*cdf0e10cSrcweir the currently selected JRE may not meet these requirements anymore. 592*cdf0e10cSrcweir </p> 593*cdf0e10cSrcweir <p>In direct mode the function returns information about a JRE that was 594*cdf0e10cSrcweir set by the bootstrap parameter UNO_JAVA_JFW_JREHOME. 595*cdf0e10cSrcweir </p> 596*cdf0e10cSrcweir @param ppInfo 597*cdf0e10cSrcweir [out] on return it contains a pointer to a <code>JavaInfo</code> object 598*cdf0e10cSrcweir that represents the currently selected JRE. When <code>*ppInfo</code> is not 599*cdf0e10cSrcweir NULL then the function overwrites the pointer. It is not attempted to free 600*cdf0e10cSrcweir the pointer. 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir @return 603*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 604*cdf0e10cSrcweir JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/> 605*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 606*cdf0e10cSrcweir were not met.<br/> 607*cdf0e10cSrcweir JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no 608*cdf0e10cSrcweir JRE has been selected afterwards. <br/> 609*cdf0e10cSrcweir */ 610*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo); 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir /** determines if Java can be used. 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir <p>If <code>bEnabled</code> is <code>sal_False</code> then a call 616*cdf0e10cSrcweir to jfw_startVM will result in an error with the errorcode 617*cdf0e10cSrcweir <code>JFW_E_JAVA_DISABLED</code></p> 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir @param bEnabled 620*cdf0e10cSrcweir [in] use of Java enabled/disabled. 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir @return 623*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 624*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 625*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 626*cdf0e10cSrcweir were not met.<br/> 627*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 628*cdf0e10cSrcweir */ 629*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled); 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir /** provides the information if Java can be used. 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir <p>That is if the user enabled or disabled the use of Java. 634*cdf0e10cSrcweir </p> 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir @return 637*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 638*cdf0e10cSrcweir JFW_E_INVALIDARG pbEnabled is NULL<br/> 639*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 640*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 641*cdf0e10cSrcweir were not met.<br/> 642*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 643*cdf0e10cSrcweir */ 644*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled); 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir /** determines parameters which are passed to VM during its creation. 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir <p>The strings must be exactly as they are passed on the command line. 649*cdf0e10cSrcweir For example, one could pass<br/> 650*cdf0e10cSrcweir -Xdebug <br/> 651*cdf0e10cSrcweir -Xrunjdw:transport=dt_socket,server=y,address=8000<br/> 652*cdf0e10cSrcweir in order to enable debugging support. 653*cdf0e10cSrcweir </p> 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir @param arParameters 656*cdf0e10cSrcweir [in] contains the arguments. It can be NULL if nSize is 0. 657*cdf0e10cSrcweir @param nSize 658*cdf0e10cSrcweir [i] the size of <code>arArgs</code> 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir @return 661*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 662*cdf0e10cSrcweir JFW_E_INVALIDARG arArgs is NULL and nSize is not 0 663*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 664*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 665*cdf0e10cSrcweir were not met.<br/> 666*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 667*cdf0e10cSrcweir */ 668*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_setVMParameters( 669*cdf0e10cSrcweir rtl_uString ** arArgs, sal_Int32 nSize); 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir /** obtains the currently used start parameters. 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir <p>The caller needs to free the returned array with 674*cdf0e10cSrcweir <code>rtl_freeMemory</code>. The contained strings must be released with 675*cdf0e10cSrcweir <code>rtl_uString_release</code>. 676*cdf0e10cSrcweir </p> 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir @param parParameters 679*cdf0e10cSrcweir [out] on returns contains a pointer to the array of the start arguments. 680*cdf0e10cSrcweir If *parParameters is not NULL then the value is overwritten. 681*cdf0e10cSrcweir @param pSize 682*cdf0e10cSrcweir [out] on return contains the size of array returned in 683*cdf0e10cSrcweir <code>parParameters</code> 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir @return 686*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 687*cdf0e10cSrcweir JFW_E_INVALIDARG parParameters or pSize are NULL<br/> 688*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 689*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 690*cdf0e10cSrcweir were not met.<br/> 691*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 692*cdf0e10cSrcweir */ 693*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getVMParameters( 694*cdf0e10cSrcweir rtl_uString *** parParameters, 695*cdf0e10cSrcweir sal_Int32 * pSize); 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir /** sets the user class path. 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir <p>When the VM is started then it is passed the class path. The 700*cdf0e10cSrcweir class path also contains the user class path set by this function. 701*cdf0e10cSrcweir The paths contained in <code>pCP</code> must be separated with a 702*cdf0e10cSrcweir system dependent path separator.</p> 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir @param pCP 705*cdf0e10cSrcweir [in] the user class path. 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir @return 708*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 709*cdf0e10cSrcweir JFW_E_INVALIDARG pCP is NULL.<br/> 710*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 711*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 712*cdf0e10cSrcweir were not met.<br/> 713*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 714*cdf0e10cSrcweir */ 715*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCP); 716*cdf0e10cSrcweir /** provides the value of the current user class path. 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir <p>The function returns an empty string if no user class path is set. 719*cdf0e10cSrcweir </p> 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir @param ppCP 722*cdf0e10cSrcweir [out] contains the user class path on return. If <code>*ppCP</code> was 723*cdf0e10cSrcweir not NULL then the value is overwritten. No attempt at freeing that string 724*cdf0e10cSrcweir is made. 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir @return 727*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 728*cdf0e10cSrcweir JFW_E_INVALIDARG ppCP is NULL.<br/> 729*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 730*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 731*cdf0e10cSrcweir were not met.<br/> 732*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 733*cdf0e10cSrcweir */ 734*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP); 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir /** saves the location of a JRE. 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir <p>When <code>jfw_findAllJREs</code> is called then the paths added by this 739*cdf0e10cSrcweir function are evaluated. If the location still represents a 740*cdf0e10cSrcweir JRE then a <code>JavaInfo</code> object is created which is returned along 741*cdf0e10cSrcweir with all other <code>JavaInfo</code> objects by 742*cdf0e10cSrcweir <code>jfw_findAllJREs</code>. If the location 743*cdf0e10cSrcweir cannot be recognized then the location string is ignored. </p> 744*cdf0e10cSrcweir <p> 745*cdf0e10cSrcweir A validation if <code>sLocation</code> points to a JRE is not 746*cdf0e10cSrcweir performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>. 747*cdf0e10cSrcweir </p> 748*cdf0e10cSrcweir <p> 749*cdf0e10cSrcweir Adding a path that is already stored causes no error.</p> 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir @param sLocation 752*cdf0e10cSrcweir [in] file URL to a directory which contains a JRE. 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir @return 755*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 756*cdf0e10cSrcweir JFW_E_INVALIDARG sLocation is NULL.<br/> 757*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 758*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 759*cdf0e10cSrcweir were not met.<br/> 760*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 761*cdf0e10cSrcweir @see jfw_setJRELocations 762*cdf0e10cSrcweir */ 763*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation); 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir /** saves the locations of a number of JREs. 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir <p> 768*cdf0e10cSrcweir The function does not verify if the paths points to JRE. However, 769*cdf0e10cSrcweir it makes sure that every path is unique. That is, if the array 770*cdf0e10cSrcweir contains strings which are the same then only one is stored.</p> 771*cdf0e10cSrcweir <p> 772*cdf0e10cSrcweir If <code>arLocations</code> is NULL or it has the length null (nSize = 0) 773*cdf0e10cSrcweir then all previously stored paths are deleted. Otherwise, 774*cdf0e10cSrcweir the old values are overwritten.</p> 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir @param arLocations 777*cdf0e10cSrcweir [in] array of paths to locations of JREs. 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir @param nSize 780*cdf0e10cSrcweir [in] the size of the array <code>arLocations</code> 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir @return 783*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 784*cdf0e10cSrcweir JFW_E_INVALIDARG arLocation is NULL and nSize is not null.<br/> 785*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 786*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 787*cdf0e10cSrcweir were not met.<br/> 788*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 789*cdf0e10cSrcweir @see jfw_addJRELocations 790*cdf0e10cSrcweir */ 791*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_setJRELocations( 792*cdf0e10cSrcweir rtl_uString ** arLocations, sal_Int32 nSize); 793*cdf0e10cSrcweir /** obtains an array containing paths to JRE installations. 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir <p> 796*cdf0e10cSrcweir It is not guaranteed that the returned paths represent 797*cdf0e10cSrcweir a valid JRE. One can use <code>jfw_getJavaInfoByPath</code> to check this. 798*cdf0e10cSrcweir </p> 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir @param parLocations 801*cdf0e10cSrcweir [out] on return it contains the array of paths. 802*cdf0e10cSrcweir @param pSize 803*cdf0e10cSrcweir [out] on return it contains the size of the array <code>parLocations</code>. 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir @return 806*cdf0e10cSrcweir JFW_E_NONE function ran successfully.<br/> 807*cdf0e10cSrcweir JFW_E_INVALIDARG parLocation is NULL or pSize is NULL.<br/> 808*cdf0e10cSrcweir JFW_E_ERROR An error occurred.<br/> 809*cdf0e10cSrcweir JFW_E_CONFIGURATION mode was not properly set or their prerequisites 810*cdf0e10cSrcweir were not met.<br/> 811*cdf0e10cSrcweir JFW_E_DIRECT_MODE the function cannot be used in this mode. 812*cdf0e10cSrcweir */ 813*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_getJRELocations( 814*cdf0e10cSrcweir rtl_uString *** parLocations, sal_Int32 * pSize); 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir /** checks if the installation of the jre still exists. 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir This function checks if the JRE described by pInfo still 820*cdf0e10cSrcweir exists. The check must be very quick because it is called by javaldx 821*cdf0e10cSrcweir (Linux, Solaris) at start up. 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir @param pInfo 824*cdf0e10cSrcweir [in] the JavaInfo object with information about the JRE. 825*cdf0e10cSrcweir @param pp_exist 826*cdf0e10cSrcweir [out] the parameter is set to either sal_True or sal_False. The value is 827*cdf0e10cSrcweir only valid if the function returns JFW_E_NONE. 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir @return 830*cdf0e10cSrcweir JFW_E_NONE the function ran successfully.</br> 831*cdf0e10cSrcweir JFW_E_ERROR an error occurred during execution.</br> 832*cdf0e10cSrcweir JFW_E_INVALID_ARG pInfo contains invalid data</br> 833*cdf0e10cSrcweir JFW_E_NO_PLUGIN a plug-in library could not be found.<br/> 834*cdf0e10cSrcweir */ 835*cdf0e10cSrcweir javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist); 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir /** locks this API so that it cannot be used by other threads. 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir <p>If a different thread called this function before then the 841*cdf0e10cSrcweir current call is blocked until the other thread has called 842*cdf0e10cSrcweir <code>jfw_unlock()</code>. The function should be called if one 843*cdf0e10cSrcweir needs an exact snapshot of the current settings. Then the settings 844*cdf0e10cSrcweir are retrieved one by one without risk that the settings may be changed 845*cdf0e10cSrcweir by a different thread. Similiary if one needs to make settings which 846*cdf0e10cSrcweir should become effective at the same time then <code>jfw_lock</code> 847*cdf0e10cSrcweir should be called. That is, <code>jfw_startVM</code> which uses the 848*cdf0e10cSrcweir settings cannot be called before all settings have be made.</p> 849*cdf0e10cSrcweir <p> 850*cdf0e10cSrcweir The only functions which are not effected by <code>jfw_lock</code> are 851*cdf0e10cSrcweir <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>. 852*cdf0e10cSrcweir */ 853*cdf0e10cSrcweir void SAL_CALL jfw_lock(); 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir /** unlocks this API. 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir <p>This function is called after <code>jfw_lock</code>. It allows other 858*cdf0e10cSrcweir threads to use this API concurrently.</p> 859*cdf0e10cSrcweir */ 860*cdf0e10cSrcweir void SAL_CALL jfw_unlock(); 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir #ifdef __cplusplus 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir #endif 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir #endif 869