diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-10 15:52:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-08-10 16:03:28 +0200 |
commit | 6dcb3d4ef46312729bb6f16c473b433474863f68 (patch) | |
tree | 58f2f577d9883e32b886bbe4086f83d0bb16fc81 /jvmfwk | |
parent | f2f3703740f65b76e891ecc3591d7e60d5b7caef (diff) |
Related fdo#51252: No more prereg, no more unopkg sync
Now that 5c47e5f63a79a9e72ec4a100786b1bbf65137ed4 "fdo#51252 Disable copying
share/prereg/bundled to avoid startup crashes" removed the use of share/prereg,
there is no longer need to generate it in the first place (by calling "unopkg
sync" at build or installation time), and so no need for the "unopkg sync" sub-
command, either. This also allows to simplify some of the jvmfwk code that was
only there so that "unopkg sync" (which can require a JVM) can work in "hostile"
environments (during build and installation).
Change-Id: I52657384f4561bf27948ba4f0f88f4498e90987f
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/Package_rcfiles.mk | 2 | ||||
-rw-r--r-- | jvmfwk/inc/jvmfwk/framework.h | 24 | ||||
-rw-r--r-- | jvmfwk/source/elements.cxx | 131 | ||||
-rw-r--r-- | jvmfwk/source/elements.hxx | 55 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 14 | ||||
-rw-r--r-- | jvmfwk/source/fwkbase.cxx | 42 | ||||
-rw-r--r-- | jvmfwk/source/fwkbase.hxx | 9 | ||||
-rw-r--r-- | jvmfwk/source/javasettingsunopkginstall.xml | 3 | ||||
-rw-r--r-- | jvmfwk/source/readme.txt | 5 |
9 files changed, 23 insertions, 262 deletions
diff --git a/jvmfwk/Package_rcfiles.mk b/jvmfwk/Package_rcfiles.mk index fd5593287290..0d4c8ace65cf 100644 --- a/jvmfwk/Package_rcfiles.mk +++ b/jvmfwk/Package_rcfiles.mk @@ -27,8 +27,6 @@ $(eval $(call gb_Package_Package,jvmfwk_rcfiles,$(SRCDIR)/jvmfwk)) -$(eval $(call gb_Package_add_file,jvmfwk_rcfiles,bin/javasettingsunopkginstall.xml,source/javasettingsunopkginstall.xml)) - # The below files (intended to be also used during the build) need to go into # the same directory as dynamic libraries (either bin or lib): diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h index 17e4766add0f..98c49c3cb3b2 100644 --- a/jvmfwk/inc/jvmfwk/framework.h +++ b/jvmfwk/inc/jvmfwk/framework.h @@ -60,30 +60,6 @@ extern "C" { <dd>The file contains settings valid for all users. If a user changes a setting then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA. The content of this file is an implementation detail and may change in the future.</dd> - - <dt>UNO_JAVA_JFW_INSTALL_DATA</dt> - <dd><b>DEPRECATED. Support for this variable will soon be removed.</b><br> - The file contains settings for all users. A user cannot override these settings. - When this parameter is provided then UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA - are irrelevant. This parameter is intended for use during the setup. For example, to - install extensions which contain java components. If there is already a file at this - location then it will be overwritten if it is too old. The period of validatity is per - default one hour. This value can be overridden by the bootstrap parameter - UNO_JAVA_JFW_INSTALL_EXPIRE (<b>DEPRECATED</b>). Setting this variable to 1000 means - the settings file is only valid for 1000 seconds. - - <p>If one would not use UNO_JAVA_JFW_INSTALL_DATA during setup then most probably - a user installation directory would be created in the home directory of root. This is - because, java settings are determined and stored on behalf of the current user. In other - words UNO_JAVA_JFW_USER_DATA would be used which points into the user installation. - </p> - <p>UNO_JAVA_JFW_INSTALL_DATA could point into the shared installation, provided that - only people with root rights can install OOo. Then one has to take care that the - installer removes this file when uninstalling. - </p> - - - The content of this file is an implementation detail and may change in the future.</dd> </dl> <p>The values for these parameters must be file URLs and include the file name, for diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 454eaec88212..aab9b6752caa 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -20,7 +20,6 @@ #include "elements.hxx" #include "osl/mutex.hxx" #include "osl/file.hxx" -#include "osl/time.h" #include "fwkutil.hxx" #include "fwkbase.hxx" #include "framework.hxx" @@ -83,16 +82,6 @@ rtl::OString getElementUpdated() (xmlChar*)"/jf:javaSelection/jf:updated/text()", true); } -// Use only in INSTALL mode !!! -rtl::OString getElementModified() -{ - //The modified element is only written in INSTALL mode. - //That is NodeJava::m_layer = INSTALL - return getElement(jfw::getInstallSettingsPath(), - (xmlChar*)"/jf:java/jf:modified/text()", false); -} - - void createSettingsStructure(xmlDoc * document, bool * bNeedsSave) { rtl::OString sExcMsg("[Java framework] Error in function createSettingsStructure " @@ -222,18 +211,6 @@ NodeJava::NodeJava(Layer layer): throw FrameworkException( JFW_E_DIRECT_MODE, "[Java framework] Trying to access settings files in direct mode."); - - if (USER_OR_INSTALL == m_layer) - { - if (!BootParams::getInstallData().isEmpty()) - m_layer = INSTALL; - else - m_layer = USER; - } - else - { - m_layer = layer; - } } @@ -255,7 +232,7 @@ void NodeJava::load() //Writing shared data is not supported yet. return; } - else if (USER == m_layer || INSTALL == m_layer) + else if (USER == m_layer) { prepareSettingsDocument(); } @@ -386,7 +363,6 @@ void NodeJava::load() switch (m_layer) { case USER: ret = getUserSettingsPath(); break; - case INSTALL: ret = getInstallSettingsPath(); break; case SHARED: ret = getSharedSettingsPath(); break; default: OSL_FAIL("[Java framework] NodeJava::getSettingsPath()"); @@ -400,7 +376,6 @@ void NodeJava::load() switch (m_layer) { case USER: ret = BootParams::getUserData(); break; - case INSTALL: ret = BootParams::getInstallData(); break; case SHARED: ret = BootParams::getSharedData(); break; default: OSL_FAIL("[Java framework] NodeJava::getSettingsURL()"); @@ -589,20 +564,6 @@ void NodeJava::write() const } } - if (INSTALL == m_layer) - { - //now write the current system time - ::TimeValue curTime = {0,0}; - if (::osl_getSystemTime(& curTime)) - { - rtl::OUString sSeconds = - rtl::OUString::valueOf((sal_Int64) curTime.Seconds); - xmlNewTextChild( - root,NULL, (xmlChar*) "modified", CXmlCharPtr(sSeconds)); - xmlNode * nodeCrLf = xmlNewText((xmlChar*) "\n"); - xmlAddChild(root, nodeCrLf); - } - } if (xmlSaveFormatFile(sSettingsPath.getStr(), docUser, 1) == -1) throw FrameworkException(JFW_E_ERROR, sExcMsg); } @@ -738,66 +699,11 @@ jfw::FileStatus NodeJava::checkSettingsFileStatus() const File::RC rc = ::osl::DirectoryItem::get(sURL, item); if (File::E_None == rc) { - ::osl::FileStatus stat( - osl_FileStatus_Mask_Validate - | osl_FileStatus_Mask_CreationTime - | osl_FileStatus_Mask_ModifyTime); + ::osl::FileStatus stat(osl_FileStatus_Mask_Validate); File::RC rc_stat = item.getFileStatus(stat); if (File::E_None == rc_stat) { - // This - //function may be called multiple times when a java is started. - //If the expiretime is too small then we may loop because everytime - //the file is deleted and we need to search for a java again. - if (INSTALL == m_layer) - { - //file exists. Check if it is too old - //Do not use the creation time. On Windows 2003 server I noticed - //that after removing the file and shortly later creating it again - //did not change the creation time. That is the newly created file - //had the creation time of the former file. - ::TimeValue curTime = {0,0}; - ret = FILE_OK; - if (sal_True == ::osl_getSystemTime(& curTime)) - { - //get the modified time recorded in the <modified> element - sal_uInt32 modified = getModifiedTime(); - OSL_ASSERT(modified <= curTime.Seconds); - //Only if modified has a valued then NodeJava::write was called, - //then the xml structure was filled with data. - - if ( modified && curTime.Seconds - modified > - BootParams::getInstallDataExpiration()) - { -#if OSL_DEBUG_LEVEL >=2 - fprintf(stderr, "[Java framework] Settings file is %d seconds old. \n", - (int)( curTime.Seconds - modified)); - rtl::OString s = rtl::OUStringToOString(sURL, osl_getThreadTextEncoding()); - fprintf(stderr, "[Java framework] Settings file is exspired. Deleting settings file at \n%s\n", s.getStr()); -#endif - //delete file - File f(sURL); - if (File::E_None == f.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Read) - && File::E_None == f.setPos(0, 0) - && File::E_None == f.setSize(0)) - ret = FILE_DOES_NOT_EXIST; - else - ret = FILE_INVALID; - } - else - { - ret = FILE_OK; - } - } - else // osl_getSystemTime - { - ret = FILE_INVALID; - } - } - else // INSTALL == m_layer - { - ret = FILE_OK; - } + ret = FILE_OK; } else if (File::E_NOENT == rc_stat) { @@ -1123,17 +1029,6 @@ JavaInfo * CNodeJavaInfo::makeJavaInfo() const return pInfo; } -sal_uInt32 NodeJava::getModifiedTime() const -{ - if (m_layer != INSTALL) - { - OSL_ASSERT(0); - return 0; - } - rtl::OString modTimeSeconds = getElementModified(); - return (sal_uInt32) modTimeSeconds.toInt64(); -} - //================================================================================ MergedSettings::MergedSettings(): m_bEnabled(sal_False), @@ -1142,23 +1037,11 @@ MergedSettings::MergedSettings(): m_JRELocations(), m_javaInfo() { - NodeJava settings(NodeJava::USER_OR_INSTALL); + NodeJava settings(NodeJava::USER); settings.load(); - - //Check if UNO_JAVA_JFW_INSTALL_DATA is set. If so, then we need not use user and - //shared data. - const ::rtl::OUString sInstall = BootParams::getInstallData(); - - if (sInstall.isEmpty()) - { - NodeJava sharedSettings(NodeJava::SHARED); - sharedSettings.load(); - merge(sharedSettings, settings); - } - else - { - merge(NodeJava(), settings); - } + NodeJava sharedSettings(NodeJava::SHARED); + sharedSettings.load(); + merge(sharedSettings, settings); } MergedSettings::~MergedSettings() diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx index c35d624c900e..524efebece1b 100644 --- a/jvmfwk/source/elements.hxx +++ b/jvmfwk/source/elements.hxx @@ -105,12 +105,8 @@ public: settings file. Which settings file is used is determined by the value passed into the - constructo and the values of the bootstrap parameters UNO_JAVA_JFW_USER_DATA, - UNO_JAVA_JFW_SHARED_DATA,_JAVA_JFW_INSTALL_DATA. - - If the value is USER_OR_INSTALL then it depends of the bootstrap parameter - UNO_JAVA_JFW_INSTALL_DATA. If it has as value then it is used. Otherwise the - value from UNO_JAVA_JFW_USER_DATA is used. + constructor and the values of the bootstrap parameters + UNO_JAVA_JFW_USER_DATA and UNO_JAVA_JFW_SHARED_DATA. The method load reads the data from the settings file. The method write stores the data into the settings file. @@ -118,16 +114,15 @@ public: class NodeJava { public: - enum Layer { USER_OR_INSTALL, USER, SHARED, INSTALL }; + enum Layer { USER, SHARED }; private: /** creates settings file and fills it with default values. When this function is called then it creates the settings file at the possition determined by the bootstrap parameters - (UNO_JAVA_JFW_USER_DATA, UNO_JAVA_JFW_SHARED_DATA, - UNO_JAVA_JFW_INSTALL_DATA) and m_layer, unless the file already exists - (see createSettingsDocument). + (UNO_JAVA_JFW_USER_DATA, UNO_JAVA_JFW_SHARED_DATA) and m_layer, unless + the file already exists (see createSettingsDocument). @return JFW_E_CONFIG_READWRITE @@ -139,9 +134,8 @@ private: void createSettingsDocument() const; /** returns the system path to the data file which is to be used. The value - depends on - the the member m_layer and the bootstrap parameters UNO_JAVA_JFW_USER_DATA, - UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_INSTALL_DATA which this may be. + depends on the the member m_layer and the bootstrap parameters + UNO_JAVA_JFW_USER_DATA and UNO_JAVA_JFW_SHARED_DATA. */ ::rtl::OString getSettingsPath() const; @@ -149,9 +143,7 @@ private: */ ::rtl::OUString getSettingsURL() const; - /** Verifies if the respective settings file exist. In case UNO_JAVA_JFW_INSTALL_DATA - is used, the age is checked. If the file is too old then we assume that it does not - exist and wipe its contents. Then still FILE_DOES_NOT_EXIST is returned. + /** Verifies if the respective settings file exist. */ jfw::FileStatus checkSettingsFileStatus() const; @@ -187,37 +179,9 @@ private: */ boost::optional< ::std::vector< ::rtl::OUString> > m_JRELocations; - /** Only in INSTALL mode. Then NodeJava.write writes a <modified> element - which contains the seconds value of the TimeValue (osl/time.h), obtained - with osl_getSystemTime. - It returns 0 if the value cannot be obtained. - This is used to fix the problem that the modified time of the settings - file is incorrect because it resides on an NFS volume where the NFS - server and NFS client do not have the same system time. For example if - the server time is ahead of the client time then checkSettingsFileStatus - deleted the settings. So even if javaldx determined a Java - (jfw_findAndSelectJRE) then jfw_startVM returned a JFW_E_NO_SELECT. Then - it looked again for a java by calling jfw_findAndSelectJRE, which - returned a JFW_E_NONE. But the following jfw_startVM returned again - JFW_E_NO_SELECT. So it looped. (see issue i114509) - - NFS server and NFS client should have the same time. It is common - practise to enforce this in networks. We actually should not work - around a malconfigured network. We must however, make sure that we do - not loop. Maybe a better approach is, that: - - assume that mtime and system time are reliable - - checkSettingsFile uses system time and mtime of the settings file, - instset of using getModifiedTime. - - allow a small error margin - - jfw_startVM must return a JFW_E_EXPIRED_SETTINGS - - XJavaVM::startVM should prevent the loop by processing the new return+ value - - */ - sal_uInt32 getModifiedTime() const; - public: - NodeJava(Layer theLayer = USER_OR_INSTALL); + explicit NodeJava(Layer theLayer); /** sets m_enabled. /java/enabled@xsi:nil will be set to false when write is called. @@ -300,7 +264,6 @@ public: bootstrap variables: UNO_JAVA_JFW_USER_DATA UNO_JAVA_JFW_SHARED_DATA - UNO_JAVA_JFW_INSTALL_DATA The class also determines useful default values for settings which have not been made. */ diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 066645029136..28276b8bda5d 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -601,7 +601,7 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo) } if ((JavaInfo*) aCurrentInfo) { - jfw::NodeJava javaNode; + jfw::NodeJava javaNode(jfw::NodeJava::USER); javaNode.setJavaInfo(aCurrentInfo,true); javaNode.write(); @@ -862,7 +862,7 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo) if (jfw_areEqualJavaInfo(currentInfo, pInfo) == sal_False) { - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); node.setJavaInfo(pInfo, false); node.write(); //remember that the JRE was selected in this process @@ -898,7 +898,7 @@ javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled) if (settings.getEnabled() == sal_False) g_bEnabledSwitchedOn = true; } - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); node.setEnabled(bEnabled); node.write(); } @@ -943,7 +943,7 @@ javaFrameworkError SAL_CALL jfw_setVMParameters( osl::MutexGuard guard(jfw::FwkMutex::get()); if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); if (arOptions == NULL && nLen != 0) return JFW_E_INVALID_ARG; node.setVmParameters(arOptions, nLen); @@ -991,7 +991,7 @@ javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCp) osl::MutexGuard guard(jfw::FwkMutex::get()); if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); if (pCp == NULL) return JFW_E_INVALID_ARG; node.setUserClassPath(pCp); @@ -1037,7 +1037,7 @@ javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation) osl::MutexGuard guard(jfw::FwkMutex::get()); if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); if (sLocation == NULL) return JFW_E_INVALID_ARG; node.load(); @@ -1064,7 +1064,7 @@ javaFrameworkError SAL_CALL jfw_setJRELocations( osl::MutexGuard guard(jfw::FwkMutex::get()); if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; - jfw::NodeJava node; + jfw::NodeJava node(jfw::NodeJava::USER); if (arLocations == NULL && nLen != 0) return JFW_E_INVALID_ARG; node.setJRELocations(arLocations, nLen); diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index 4f1f44a630fd..c03e27fe80b5 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -51,9 +51,6 @@ using ::rtl::OStringToOUString; #define UNO_JAVA_JFW_VENDOR_SETTINGS "UNO_JAVA_JFW_VENDOR_SETTINGS" #define UNO_JAVA_JFW_USER_DATA "UNO_JAVA_JFW_USER_DATA" #define UNO_JAVA_JFW_SHARED_DATA "UNO_JAVA_JFW_SHARED_DATA" -#define UNO_JAVA_JFW_INSTALL_DATA "UNO_JAVA_JFW_INSTALL_DATA" -#define UNO_JAVA_JFW_INSTALL_EXPIRE "UNO_JAVA_JFW_INSTALL_EXPIRE" -#define DEFAULT_INSTALL_EXPIRATION 3600 namespace jfw { @@ -366,12 +363,6 @@ rtl::OUString BootParams::getSharedData() return getParamFirstUrl(UNO_JAVA_JFW_SHARED_DATA); } -rtl::OUString BootParams::getInstallData() -{ - return getParam(UNO_JAVA_JFW_INSTALL_DATA); -} - - rtl::OString BootParams::getClasspath() { rtl::OString sClassPath; @@ -525,34 +516,6 @@ rtl::OUString BootParams::getClasspathUrls() return sParams; } -::sal_uInt32 BootParams::getInstallDataExpiration() -{ - rtl::OUString sValue; - Bootstrap::get()->getFrom( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_INSTALL_EXPIRE)), - sValue); - -#if OSL_DEBUG_LEVEL >=2 - rtl::OString osValue = rtl::OUStringToOString(sValue, osl_getThreadTextEncoding()); - fprintf(stderr,"[Java framework] Using bootstrap parameter " - UNO_JAVA_JFW_INSTALL_EXPIRE " = %s.\n", osValue.getStr()); -#endif - - sal_Int64 nVal = sValue.toInt64(); - if (0 == nVal) - { -#if OSL_DEBUG_LEVEL >=2 - fprintf(stderr,"[Java framework] Using default value for " - "UNO_JAVA_JFW_INSTALL_EXPIRE: %d \n", DEFAULT_INSTALL_EXPIRATION); -#endif - return DEFAULT_INSTALL_EXPIRATION; - } - else - { - return static_cast<sal_uInt32>(nVal); - } -} - JFW_MODE getMode() { static bool g_bMode = false; @@ -673,11 +636,6 @@ rtl::OString getSharedSettingsPath() return getSettingsPath(BootParams::getSharedData()); } -rtl::OString getInstallSettingsPath() -{ - return getSettingsPath(BootParams::getInstallData()); -} - rtl::OString getSettingsPath( const rtl::OUString & sURL) { if (sURL.isEmpty()) diff --git a/jvmfwk/source/fwkbase.hxx b/jvmfwk/source/fwkbase.hxx index 51bd4bb0d5f5..9eb0f0648f47 100644 --- a/jvmfwk/source/fwkbase.hxx +++ b/jvmfwk/source/fwkbase.hxx @@ -70,7 +70,6 @@ namespace BootParams ::rtl::OUString getSharedData(); -::rtl::OUString getInstallData(); /* returns the file URL to the vendor settings xml file. */ ::rtl::OUString getVendorSettings(); @@ -82,12 +81,6 @@ namespace BootParams ::rtl::OUString getClasspathUrls(); -/** returns the content of UNO_JAVA_JFW_INSTALL_EXPIRE or a pretermined - value. If the bootstrap variable contains a string that cannot be - converted by OUString then it returns the predetermined value. -*/ -::sal_uInt32 getInstallDataExpiration(); - } //end namespace @@ -116,8 +109,6 @@ JFW_MODE getMode(); */ ::rtl::OString getUserSettingsPath(); -::rtl::OString getInstallSettingsPath(); - /** Returns the system path of the share settings file. Returns a valid string or throws an exception. @throws FrameworkException diff --git a/jvmfwk/source/javasettingsunopkginstall.xml b/jvmfwk/source/javasettingsunopkginstall.xml deleted file mode 100644 index 3efc8e87fc62..000000000000 --- a/jvmfwk/source/javasettingsunopkginstall.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> -</java> diff --git a/jvmfwk/source/readme.txt b/jvmfwk/source/readme.txt index f4e822513de5..b39576a7e863 100644 --- a/jvmfwk/source/readme.txt +++ b/jvmfwk/source/readme.txt @@ -2,8 +2,3 @@ The file jvfwk3rc is intended for providing bootstrap parameter for the java framework within the build environment. It is not part of a product. Tools which are started in the environment, such as regcomp.exe and uno.exe, use this rc file when Java is needed. - -The file javasettingsunopkginstall.xml only contains the root element of -a settings file (<java ...>). It is a dummy which will be installed into -office/share/config/. Bundled extensions will used this file to store its -java settings. See framework.h bootstrap variable UNO_JAVA_JFW_INSTALL_DATA |