#i20052#
This commit is contained in:
parent
b21347f0dc
commit
5def523f04
6 changed files with 77 additions and 19 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: framework.h,v $
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-05-04 08:43:41 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:40 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -105,7 +105,8 @@ typedef enum
|
|||
JFW_E_NO_PLUGIN,
|
||||
JFW_E_NOT_RECOGNIZED,
|
||||
JFW_E_FAILED_VERSION,
|
||||
JFW_E_NO_JAVA_FOUND
|
||||
JFW_E_NO_JAVA_FOUND,
|
||||
JFW_E_VM_CREATION_FAILED
|
||||
} javaFrameworkError;
|
||||
|
||||
/** an instance of this struct represents an installation of a Java
|
||||
|
@ -413,6 +414,11 @@ javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
|
|||
JFW_E_NEED_RESTART in the current process a different JRE has been selected
|
||||
which needs a prepared environment, which has to be done before the office
|
||||
process. Therefore the new JRE may not be used until the office was restarted.<br/>
|
||||
JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
|
||||
then the user enabled it. If then the selected JRE has the requirement
|
||||
JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
|
||||
JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
|
||||
by a plug-in library and not by this API.
|
||||
*/
|
||||
javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions,
|
||||
sal_Int32 nSize, JavaVM **ppVM,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: vendorplugin.h,v $
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-05-05 14:11:17 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:40 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -84,7 +84,8 @@ typedef enum
|
|||
JFW_PLUGIN_E_WRONG_VERSION_FORMAT,
|
||||
JFW_PLUGIN_E_FAILED_VERSION,
|
||||
JFW_PLUGIN_E_NO_JRE,
|
||||
JFW_PLUGIN_E_WRONG_VENDOR
|
||||
JFW_PLUGIN_E_WRONG_VENDOR,
|
||||
JFW_PLUGIN_E_VM_CREATION_FAILED
|
||||
} javaPluginError;
|
||||
|
||||
|
||||
|
@ -135,6 +136,7 @@ javaPluginError getJavaInfoByPath(
|
|||
JFW_PLUGIN_E_ERROR,
|
||||
JFW_PLUGIN_E_WRONG_VENDOR
|
||||
JFW_PLUGIN_E_INVALID_ARG,
|
||||
JFW_PLUGIN_E_VM_CREATION_FAILED
|
||||
|
||||
*/
|
||||
javaPluginError startJavaVirtualMachine(
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: javaldx.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-05-04 10:44:06 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -99,7 +99,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (bEnabled == sal_False)
|
||||
{
|
||||
//Do not do any preparation because that may only slow startup time.
|
||||
return 0;
|
||||
}
|
||||
|
||||
JavaInfo * pInfo = NULL;
|
||||
javaFrameworkError errcode = JFW_E_NONE;
|
||||
|
@ -130,6 +133,12 @@ int main(int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//Only do something if the sunjavaplugin created this JavaInfo
|
||||
rtl::OUString sSunVendor(RTL_CONSTASCII_USTRINGPARAM("Sun Microsystems Inc."));
|
||||
if (sSunVendor.equals(pInfo->sVendor) == sal_False)
|
||||
return 0;
|
||||
|
||||
rtl::OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData);
|
||||
fprintf(stdout, "%s\n", sPaths.getStr());
|
||||
jfw_freeJavaInfo(pInfo);
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: sunjavaplugin.cxx,v $
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-05-06 11:44:47 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -398,7 +398,7 @@ javaPluginError startJavaVirtualMachine(
|
|||
sSymbolCreateJava, osl_getThreadTextEncoding());
|
||||
fprintf(stderr,"Java runtime library: %s does not export symbol %s !",
|
||||
sLib.getStr(), sSymbol.getStr());
|
||||
return JFW_PLUGIN_E_ERROR;
|
||||
return JFW_PLUGIN_E_VM_CREATION_FAILED;
|
||||
}
|
||||
|
||||
// The office sets a signal handler at startup. That causes a crash
|
||||
|
@ -496,12 +496,12 @@ javaPluginError startJavaVirtualMachine(
|
|||
if( err < 0)
|
||||
{
|
||||
fprintf(stderr,"Can not create Java Virtual Machine");
|
||||
errcode = JFW_PLUGIN_E_ERROR;
|
||||
errcode = JFW_PLUGIN_E_VM_CREATION_FAILED;
|
||||
}
|
||||
else if( err > 0)
|
||||
{
|
||||
fprintf(stderr,"Can not create JavaVirtualMachine, abort handler was called");
|
||||
errcode = JFW_PLUGIN_E_ERROR;
|
||||
errcode = JFW_PLUGIN_E_VM_CREATION_FAILED;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: framework.cxx,v $
|
||||
*
|
||||
* $Revision: 1.12 $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-05-04 08:43:42 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -91,6 +91,8 @@
|
|||
namespace {
|
||||
JavaVM * g_pJavaVM = NULL;
|
||||
|
||||
bool g_bEnabledSwitchedOn = false;
|
||||
|
||||
sal_Bool areEqualJavaInfo(
|
||||
JavaInfo const * pInfoA,JavaInfo const * pInfoB)
|
||||
{
|
||||
|
@ -316,6 +318,16 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
|
|||
if (sVendorUpdate != javaSettings.getJavaInfoAttrVendorUpdate())
|
||||
return JFW_E_INVALID_SETTINGS;
|
||||
|
||||
//check if JAVA is disabled
|
||||
//If Java is enabled, but it was disabled when this process was started
|
||||
// then no preparational work, such as setting the LD_LIBRARY_PATH, was
|
||||
//done. Therefore if a JRE needs it it must not be started.
|
||||
if (javaSettings.getEnabled() == sal_False)
|
||||
return JFW_E_JAVA_DISABLED;
|
||||
else if (g_bEnabledSwitchedOn &&
|
||||
(aInfo->nRequirements & JFW_REQUIRE_NEEDRESTART))
|
||||
return JFW_E_NEED_RESTART;
|
||||
|
||||
//Check if the selected Java was set in this process. If so it
|
||||
//must not have the requirments flag JFW_REQUIRE_NEEDRESTART
|
||||
if ((aInfo->nRequirements & JFW_REQUIRE_NEEDRESTART)
|
||||
|
@ -411,7 +423,11 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
|
|||
//start Java
|
||||
JavaVM *pVm = NULL;
|
||||
javaPluginError plerr = (*pFunc)(aInfo, arOpt, index, & pVm, ppEnv);
|
||||
if (plerr != JFW_PLUGIN_E_NONE)
|
||||
if (plerr == JFW_PLUGIN_E_VM_CREATION_FAILED)
|
||||
{
|
||||
errcode = JFW_E_VM_CREATION_FAILED;
|
||||
}
|
||||
else if (plerr != JFW_PLUGIN_E_NONE )
|
||||
{
|
||||
errcode = JFW_E_ERROR;
|
||||
}
|
||||
|
@ -420,7 +436,8 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
|
|||
g_pJavaVM = pVm;
|
||||
*ppVM = pVm;
|
||||
}
|
||||
return JFW_E_NONE;
|
||||
OSL_ASSERT(plerr != JFW_PLUGIN_E_WRONG_VENDOR);
|
||||
return errcode;
|
||||
}
|
||||
|
||||
/** We do not use here jfw_findAllJREs and then check if a JavaInfo
|
||||
|
@ -621,6 +638,8 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
|
|||
{
|
||||
//copy to out param
|
||||
*pInfo = aCurrentInfo.cloneJavaInfo();
|
||||
//remember that this JRE was selected in this process
|
||||
jfw::setJavaSelected();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -800,6 +819,8 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
|
|||
errcode = node.writeSettings();
|
||||
if (errcode != JFW_E_NONE)
|
||||
return errcode;
|
||||
//remember that the JRE was selected in this process
|
||||
jfw::setJavaSelected();
|
||||
return errcode;
|
||||
}
|
||||
javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled)
|
||||
|
@ -807,10 +828,27 @@ javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled)
|
|||
osl::MutexGuard guard(jfw::getFwkMutex());
|
||||
javaFrameworkError errcode = JFW_E_NONE;
|
||||
jfw::CNodeJava node;
|
||||
|
||||
if (g_bEnabledSwitchedOn == false && bEnabled == sal_True)
|
||||
{
|
||||
//When the process started then Enabled was false.
|
||||
//This is first time enabled is set to true.
|
||||
//That means, no preparational work has been done, such as setting the
|
||||
//LD_LIBRARY_PATH, etc.
|
||||
|
||||
//check if Enabled is false;
|
||||
errcode = node.loadFromSettings();
|
||||
if (errcode != JFW_E_NONE)
|
||||
return errcode;
|
||||
if (node.getEnabled() == sal_False)
|
||||
g_bEnabledSwitchedOn = true;
|
||||
}
|
||||
node.setEnabled(bEnabled);
|
||||
errcode = node.writeSettings();
|
||||
if (errcode != JFW_E_NONE)
|
||||
return errcode;
|
||||
//remember if the enabled was false at the beginning and has
|
||||
//been changed to true.
|
||||
return errcode;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: fwkutil.cxx,v $
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* last change: $Author: jl $ $Date: 2004-04-28 09:11:38 $
|
||||
* last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -89,6 +89,7 @@ namespace jfw
|
|||
{
|
||||
|
||||
bool g_bJavaSet = false;
|
||||
|
||||
struct Init
|
||||
{
|
||||
osl::Mutex * operator()()
|
||||
|
@ -733,6 +734,8 @@ void setJavaSelected()
|
|||
g_bJavaSet = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Determines if the currently selected Java was set in this process.
|
||||
|
||||
@see setProcessId()
|
||||
|
|
Loading…
Reference in a new issue