diff options
author | sb <sb@openoffice.org> | 2010-03-04 23:05:27 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-03-04 23:05:27 +0100 |
commit | c79b576a3dbbbce2a67c6215a4180ac060131790 (patch) | |
tree | 32e1b51bf16b501fd7eea6d23f0610eee339fa5f /desktop | |
parent | ff783db420cdb801613ca46ffec6dc6812d9ad0d (diff) | |
parent | 0d0b4e1cdd842808707e570b1dea125f312f2a50 (diff) |
merged in re/DEV300_next towards DEV300_m74
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/prj/build.lst | 2 | ||||
-rw-r--r-- | desktop/source/app/userinstall.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 18 | ||||
-rw-r--r-- | desktop/source/deployment/makefile.mk | 3 | ||||
-rw-r--r-- | desktop/source/deployment/manager/dp_manager.cxx | 12 | ||||
-rw-r--r-- | desktop/source/deployment/registry/component/dp_component.cxx | 170 | ||||
-rw-r--r-- | desktop/source/deployment/registry/configuration/dp_configuration.cxx | 583 | ||||
-rw-r--r-- | desktop/source/deployment/registry/dp_backend.cxx | 6 | ||||
-rw-r--r-- | desktop/source/deployment/registry/inc/dp_backend.h | 14 | ||||
-rw-r--r-- | desktop/source/deployment/registry/package/dp_package.cxx | 8 | ||||
-rw-r--r-- | desktop/source/pagein/makefile.mk | 2 |
11 files changed, 498 insertions, 322 deletions
diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index d9213aed12d6..9253b4e82bc7 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -1,4 +1,4 @@ -dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg NULL +dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg configmgr NULL dt desktop usr1 - all dt_mkout NULL dt desktop\inc nmake - all dt_inc NULL dt desktop\prj get - all dt_prj NULL diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index 0d985d61e1c5..546a6f0ad13c 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -243,7 +243,7 @@ namespace desktop { return UserInstall::E_InvalidBaseinstall; // create the user directory - FileBase::RC rc = Directory::create(aUserPath); + FileBase::RC rc = Directory::createPath(aUserPath); if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) return UserInstall::E_Creation; // copy data from shared data directory of base installation diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 70fede4cd2f1..796918202a52 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -67,14 +67,6 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_pExtMgrDialog( NULL ), m_pUpdReqDialog( NULL ) { - if ( dp_misc::office_is_running() ) - { - m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener( this ); - } - m_sPackageManagers.realloc(2); m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") ); m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );; @@ -110,6 +102,16 @@ TheExtensionManager::TheExtensionManager( Window *pParent, } catch ( uno::Exception& ) {} + + if ( dp_misc::office_is_running() ) + { + // the registration should be done after the construction has been ended + // otherwise an exception prevents object creation, but it is registered as a listener + m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); + if ( m_xDesktop.is() ) + m_xDesktop->addTerminateListener( this ); + } } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index 173ff35bec1d..7eda0f582e15 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -80,7 +80,8 @@ SHL1STDLIBS = \ $(SVLLIB) \ $(UNOTOOLSLIB) \ $(DEPLOYMENTMISCLIB) \ - $(HELPLINKERLIB) + $(HELPLINKERLIB) \ + $(CONFIGMGRLIB) SHL1DEPN = SHL1IMPLIB = i$(TARGET) diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 06afd14e4581..165efbaeca5a 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -311,18 +311,6 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( } } - //Workaround. See issue http://www.openoffice.org/issues/show_bug.cgi?id=99257 - //This prevents the copying of the common.rdbf and native rdbs. It disables the - //feature to add shared extensions in a running office. - if (!that->m_readOnly && context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) - { - OUString sNoRdb; - ::rtl::Bootstrap::get(OUSTR("NORDBCOPY"), sNoRdb); - if (sNoRdb.equalsIgnoreAsciiCase(OUSTR("true")) - && dp_misc::office_is_running()) - that->m_readOnly = true; - } - if (!that->m_readOnly && logFile.getLength() > 0) { const Any any_logFile(logFile); diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index f84e71bca0a9..e6781e2a1746 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -122,7 +122,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XComponentContext> m_xRemoteContext; enum reg { - REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED + REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED, REG_MAYBE_REGISTERED } m_registered; Reference<loader::XImplementationLoader> getComponentInfo( @@ -144,6 +144,10 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend const Reference<registry::XSimpleRegistry> getRDB() const; + //Provides the read-only registry (e.g. not the one based on the duplicated + //rdb files + const Reference<registry::XSimpleRegistry> getRDB_RO() const; + public: inline ComponentPackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -221,9 +225,22 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString m_commonRDB; OUString m_nativeRDB; + + //URLs of the read-only rdbs (e.g. not the ones of the duplicated files) + OUString m_commonRDB_RO; + OUString m_nativeRDB_RO; + + //These rdbs are for writing new service entries. The rdb files are copies + //which are created when services are added or removed. Reference<registry::XSimpleRegistry> m_xCommonRDB; Reference<registry::XSimpleRegistry> m_xNativeRDB; + //These rdbs are created on the read-only rdbs which are already used + //by UNO since the startup of the current session. + Reference<registry::XSimpleRegistry> m_xCommonRDB_RO; + Reference<registry::XSimpleRegistry> m_xNativeRDB_RO; + + void unorc_verify_init( Reference<XCommandEnvironment> const & xCmdEnv ); void unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ); @@ -252,6 +269,9 @@ public: //Will be called from ComponentPackageImpl void initServiceRdbFiles(); + + //Creates the READ ONLY registries (m_xCommonRDB_RO,m_xNativeRDB_RO) + void initServiceRdbFiles_RO(); }; //______________________________________________________________________________ @@ -259,12 +279,12 @@ const Reference<registry::XSimpleRegistry> BackendImpl::ComponentPackageImpl::getRDB() const { BackendImpl * that = getMyBackend(); + //Late "initialization" of the services rdb files //This is to prevent problems when running several //instances of OOo with root rights in parallel. This //would otherwise cause problems when copying the rdbs. - //Now this code is only performed if isRegistered or processPackage - //is called. + //See http://qa.openoffice.org/issues/show_bug.cgi?id=99257 { const ::osl::MutexGuard guard( getMutex() ); if (!that->bSwitchedRdbFiles) @@ -273,7 +293,6 @@ BackendImpl::ComponentPackageImpl::getRDB() const that->initServiceRdbFiles(); } } - if (m_loader.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.SharedLibrary") )) return that->m_xNativeRDB; @@ -281,6 +300,19 @@ BackendImpl::ComponentPackageImpl::getRDB() const return that->m_xCommonRDB; } +//Returns the read only RDB. +const Reference<registry::XSimpleRegistry> +BackendImpl::ComponentPackageImpl::getRDB_RO() const +{ + BackendImpl * that = getMyBackend(); + + if (m_loader.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.SharedLibrary") )) + return that->m_xNativeRDB_RO; + else + return that->m_xCommonRDB_RO; +} + BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const { BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); @@ -342,20 +374,22 @@ void BackendImpl::disposing() void BackendImpl::initServiceRdbFiles() { const Reference<XCommandEnvironment> xCmdEnv; - if (! m_readOnly) { + if (! m_readOnly) + { ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv ); ::ucbhelper::Content oldRDB; // switch common rdb: - if (m_commonRDB.getLength() > 0) + if (m_commonRDB_RO.getLength() > 0) + { create_ucb_content( - &oldRDB, makeURL( getCachePath(), m_commonRDB ), - xCmdEnv, false /* no throw */ ); - m_commonRDB = m_commonRDB.equalsAsciiL( + &oldRDB, makeURL( getCachePath(), m_commonRDB_RO), + xCmdEnv, false /* no throw */ ); + } + m_commonRDB = m_commonRDB_RO.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("common.rdb") ) - ? OUSTR("common_.rdb") : OUSTR("common.rdb"); + ? OUSTR("common_.rdb") : OUSTR("common.rdb"); if (oldRDB.get().is()) { - if (! cacheDir.transferContent( oldRDB, ::ucbhelper::InsertOperation_COPY, m_commonRDB, NameClash::OVERWRITE )) @@ -367,13 +401,15 @@ void BackendImpl::initServiceRdbFiles() oldRDB = ::ucbhelper::Content(); } // switch native rdb: - if (m_nativeRDB.getLength() > 0) + if (m_nativeRDB_RO.getLength() > 0) + { create_ucb_content( - &oldRDB, makeURL( getCachePath(), m_nativeRDB ), - xCmdEnv, false /* no throw */ ); + &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO), + xCmdEnv, false /* no throw */ ); + } const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") ); const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") ); - m_nativeRDB = m_nativeRDB.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; + m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; if (oldRDB.get().is()) { if (! cacheDir.transferContent( @@ -411,6 +447,37 @@ void BackendImpl::initServiceRdbFiles() } } +void BackendImpl::initServiceRdbFiles_RO() +{ + const Reference<XCommandEnvironment> xCmdEnv; + + // common rdb for java, native rdb for shared lib components + if (m_commonRDB_RO.getLength() > 0) + { + m_xCommonRDB_RO.set( + m_xComponentContext->getServiceManager() + ->createInstanceWithContext( + OUSTR("com.sun.star.registry.SimpleRegistry"), + m_xComponentContext), UNO_QUERY_THROW); + m_xCommonRDB_RO->open( + makeURL(expandUnoRcUrl(getCachePath()), m_commonRDB_RO), + sal_True, //read-only + sal_True); // create data source if necessary + } + if (m_nativeRDB_RO.getLength() > 0) + { + m_xNativeRDB_RO.set( + m_xComponentContext->getServiceManager() + ->createInstanceWithContext( + OUSTR("com.sun.star.registry.SimpleRegistry"), + m_xComponentContext), UNO_QUERY_THROW); + m_xNativeRDB_RO->open( + makeURL(expandUnoRcUrl(getCachePath()), m_nativeRDB_RO), + sal_True, //read-only + sal_True); // create data source if necessary + } +} + //______________________________________________________________________________ BackendImpl::BackendImpl( Sequence<Any> const & args, @@ -489,7 +556,12 @@ BackendImpl::BackendImpl( } else { + //do this before initServiceRdbFiles_RO, because it determines + //m_commonRDB and m_nativeRDB unorc_verify_init( xCmdEnv ); + + initServiceRdbFiles_RO(); + } } @@ -684,7 +756,7 @@ void BackendImpl::unorc_verify_init( sal_Int32 start = sizeof ("UNO_SERVICES=?$ORIGIN/") - 1; sal_Int32 sep = line.indexOf( ' ', start ); OSL_ASSERT( sep > 0 ); - m_commonRDB = line.copy( start, sep - start ); + m_commonRDB_RO = line.copy( start, sep - start ); } // native rc: @@ -694,7 +766,7 @@ void BackendImpl::unorc_verify_init( xCmdEnv, false /* no throw */ )) { if (readLine( &line, OUSTR("UNO_SERVICES="), ucb_content, RTL_TEXTENCODING_UTF8 )) { - m_nativeRDB = line.copy( + m_nativeRDB_RO = line.copy( sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 ); } } @@ -760,12 +832,19 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) } buf.append(LF); } - if (m_commonRDB.getLength() > 0 || m_nativeRDB.getLength() > 0) + + // If we duplicated the common or native rdb then we must use those urls + //otherwise we use those of the original files. That is, m_commonRDB_RO and + //m_nativeRDB_RO; + OUString sCommonRDB(m_commonRDB.getLength() > 0 ? m_commonRDB : m_commonRDB_RO); + OUString sNativeRDB(m_nativeRDB.getLength() > 0 ? m_nativeRDB : m_nativeRDB_RO); + + if (sCommonRDB.getLength() > 0 || sNativeRDB.getLength() > 0) { buf.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); buf.append( ::rtl::OUStringToOString( - m_commonRDB, RTL_TEXTENCODING_ASCII_US ) ); - if (m_nativeRDB.getLength() > 0) + sCommonRDB, RTL_TEXTENCODING_ASCII_US ) ); + if (sNativeRDB.getLength() > 0) { buf.append( RTL_CONSTASCII_STRINGPARAM( " ${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}") ); @@ -775,7 +854,7 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) ::rtl::OStringBuffer buf2; buf2.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); buf2.append( ::rtl::OUStringToOString( - m_nativeRDB, RTL_TEXTENCODING_ASCII_US ) ); + sNativeRDB, RTL_TEXTENCODING_ASCII_US ) ); buf2.append(LF); const Reference<io::XInputStream> xData( @@ -1023,7 +1102,8 @@ BackendImpl::ComponentPackageImpl::isRegistered_( if (m_registered == REG_UNINIT) { m_registered = REG_NOT_REGISTERED; - const Reference<registry::XSimpleRegistry> xRDB( getRDB() ); + bool bAmbiguousComponentName = false; + const Reference<registry::XSimpleRegistry> xRDB( getRDB_RO() ); if (xRDB.is()) { // lookup rdb for location URL: @@ -1043,21 +1123,51 @@ BackendImpl::ComponentPackageImpl::isRegistered_( pImplNames[ pos ] + OUSTR("/UNO/LOCATION") ); const Reference<registry::XRegistryKey> xKey( xRootKey->openKey(key) ); - if (xKey.is() && xKey->isValid()) { + if (xKey.is() && xKey->isValid()) + { const OUString location( xKey->getAsciiValue() ); if (location.equalsIgnoreAsciiCase( getURL() )) + { break; + } + else + { + //try to match only the file name + OUString thisUrl(getURL()); + OUString thisFileName(thisUrl.copy(thisUrl.lastIndexOf('/'))); + + OUString locationFileName(location.copy(location.lastIndexOf('/'))); + if (locationFileName.equalsIgnoreAsciiCase(thisFileName)) + bAmbiguousComponentName = true; + } } } if (pos >= 0) m_registered = REG_REGISTERED; + else if (bAmbiguousComponentName) + m_registered = REG_MAYBE_REGISTERED; } } + + //Different extensions can use the same service implementations. Then the extensions + //which was installed last will overwrite the one from the other extension. That is + //the registry will contain the path (the location) of the library or jar of the + //second extension. In this case isRegistered called for the lib of the first extension + //would return "not registered". That would mean that during uninstallation + //XPackage::registerPackage is not called, because it just was not registered. This is, + //however, necessary for jar files. Registering and unregistering update + //uno_packages/cache/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc + //Therefore, we will return always "is ambiguous" if the path of this component cannot + //be found in the registry and if there is another path and both have the same file name (but + //the rest of the path is different). + //If the caller cannot precisely determine that this package was registered, then it must + //call registerPackage. + sal_Bool bAmbiguous = m_registered == REG_VOID // REG_VOID == we are in the progress of unregistration + || m_registered == REG_MAYBE_REGISTERED; return beans::Optional< beans::Ambiguous<sal_Bool> >( true /* IsPresent */, beans::Ambiguous<sal_Bool>( - m_registered == REG_REGISTERED, - m_registered == REG_VOID /* IsAmbiguous */ ) ); + m_registered == REG_REGISTERED, bAmbiguous) ); } //______________________________________________________________________________ @@ -1068,6 +1178,8 @@ void BackendImpl::ComponentPackageImpl::processPackage_( Reference<XCommandEnvironment> const & xCmdEnv ) { BackendImpl * that = getMyBackend(); + + const bool java = m_loader.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2") ); const OUString url( getURL() ); @@ -1076,9 +1188,6 @@ void BackendImpl::ComponentPackageImpl::processPackage_( if (doRegisterPackage) { - if (isJavaTypelib) - that->addToUnoRc( java, url, xCmdEnv ); - if (! m_xRemoteContext.is()) { m_xRemoteContext.set( that->getObject( url ), UNO_QUERY ); @@ -1096,7 +1205,12 @@ void BackendImpl::ComponentPackageImpl::processPackage_( m_xRemoteContext->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.registry.ImplementationRegistration"), m_xRemoteContext ), UNO_QUERY_THROW ); + xImplReg->registerImplementation( m_loader, url, xServicesRDB ); + //only write to unorc if registration was successful. + //It may fail if there is no suitable java. + if (isJavaTypelib) + that->addToUnoRc( java, url, xCmdEnv ); t_stringlist implNames; t_stringpairvec singletons; diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index df64402f5192..460ba5e9fed0 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" +//TODO: Large parts of this file were copied from dp_component.cxx; those parts +// should be consolidated. + #include "dp_configuration.hrc" #include "dp_backend.h" #include "dp_persmap.h" @@ -38,16 +41,18 @@ #include "rtl/uri.hxx" #include "rtl/memory.h" #include "osl/file.hxx" +#include "cppuhelper/exc_hlp.hxx" #include "ucbhelper/content.hxx" #include "comphelper/anytostring.hxx" #include "comphelper/servicedecl.hxx" +#include "configmgr/update.hxx" #include "xmlscript/xml_helper.hxx" #include "svl/inettype.hxx" #include "com/sun/star/ucb/NameClash.hpp" #include "com/sun/star/io/XActiveDataSink.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/util/XRefreshable.hpp" -#include "com/sun/star/configuration/backend/XLayerImporter.hpp" +#include <list> #include <memory> @@ -62,6 +67,8 @@ namespace backend { namespace configuration { namespace { +typedef ::std::list<OUString> t_stringlist; + //============================================================================== class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend { @@ -95,27 +102,39 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend }; friend class PackageImpl; - Reference< ::com::sun::star::configuration::backend::XLayerImporter > - m_xMergeImporter; - OUString m_configLayer; + t_stringlist m_xcs_files; + t_stringlist m_xcu_files; + t_stringlist & getFiles( bool xcs ) { + return xcs ? m_xcs_files : m_xcu_files; + } + + bool m_configmgrini_inited; + bool m_configmgrini_modified; // PackageRegistryBackend virtual Reference<deployment::XPackage> bindPackage_( OUString const & url, OUString const & mediaType, Reference<XCommandEnvironment> const & xCmdEnv ); - void xcu_merge_in( OUString const & url, - Reference< XCommandEnvironment > const & xCmdEnv ); - void xcs_merge_in( OUString const & url, - Reference< XCommandEnvironment > const & xCmdEnv ); ::std::auto_ptr<PersistentMap> m_registeredPackages; - OUString const & getConfigLayer(); - Reference<util::XRefreshable> m_defaultProvider; + // for backwards compatibility + + virtual void SAL_CALL disposing(); const Reference<deployment::XPackageTypeInfo> m_xConfDataTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xConfSchemaTypeInfo; Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos; + void configmgrini_verify_init( + Reference<XCommandEnvironment> const & xCmdEnv ); + void configmgrini_flush( Reference<XCommandEnvironment> const & xCmdEnv ); + + bool addToConfigmgrIni( bool isSchema, OUString const & url, + Reference<XCommandEnvironment> const & xCmdEnv ); + bool removeFromConfigmgrIni( bool isSchema, OUString const & url, + Reference<XCommandEnvironment> const & xCmdEnv ); + bool hasInConfigmgrIni( bool isSchema, OUString const & url ); + public: BackendImpl( Sequence<Any> const & args, Reference<XComponentContext> const & xComponentContext ); @@ -123,17 +142,36 @@ public: // XPackageRegistry virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL getSupportedPackageTypes() throw (RuntimeException); + + using PackageRegistryBackend::disposing; }; //______________________________________________________________________________ +void BackendImpl::disposing() +{ + try { + configmgrini_flush( Reference<XCommandEnvironment>() ); + + PackageRegistryBackend::disposing(); + } + catch (RuntimeException &) { + throw; + } + catch (Exception &) { + Any exc( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( + OUSTR("caught unexpected exception while disposing..."), + static_cast<OWeakObject *>(this), exc ); + } +} + +//______________________________________________________________________________ BackendImpl::BackendImpl( Sequence<Any> const & args, Reference<XComponentContext> const & xComponentContext ) : PackageRegistryBackend( args, xComponentContext ), - m_defaultProvider( xComponentContext->getValueByName( - OUSTR("/singletons/com.sun.star." - "configuration.theDefaultProvider") ), - UNO_QUERY ), + m_configmgrini_inited( false ), + m_configmgrini_modified( false ), m_xConfDataTypeInfo( new Package::TypeInfo( OUSTR("application/" "vnd.sun.star.configuration-data"), @@ -151,19 +189,17 @@ BackendImpl::BackendImpl( m_typeInfos[ 0 ] = m_xConfDataTypeInfo; m_typeInfos[ 1 ] = m_xConfSchemaTypeInfo; - OSL_ASSERT( m_defaultProvider.is() ); + const Reference<XCommandEnvironment> xCmdEnv; if (transientMode()) { - m_registeredPackages.reset( new PersistentMap ); + //TODO } else { + configmgrini_verify_init( xCmdEnv ); m_registeredPackages.reset( new PersistentMap( makeURL( getCachePath(), OUSTR("registered_packages.db") ), m_readOnly ) ); - if (! m_readOnly) - create_folder( 0, getConfigLayer(), - Reference<XCommandEnvironment>() ); } } @@ -236,103 +272,253 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( static_cast<sal_Int16>(-1) ); } +//############################################################################## + //______________________________________________________________________________ -OUString const & BackendImpl::getConfigLayer() +void BackendImpl::configmgrini_verify_init( + Reference<XCommandEnvironment> const & xCmdEnv ) { - if (m_configLayer.getLength() == 0) + if (transientMode()) + return; + const ::osl::MutexGuard guard( getMutex() ); + if (! m_configmgrini_inited) { - OUString path( - makeURL( expandUnoRcUrl( getCachePath() ), OUSTR("registry") ) ); - ::osl::FileBase::RC rc = ::osl::File::getAbsoluteFileURL( - OUString(), path, m_configLayer ); - if (rc != ::osl::FileBase::E_None) - throw RuntimeException( - OUSTR("making file URL absolute failed: ") + path, - static_cast<OWeakObject *>(this) ); + // common rc: + ::ucbhelper::Content ucb_content; + if (create_ucb_content( + &ucb_content, + makeURL( getCachePath(), OUSTR("configmgr.ini") ), + xCmdEnv, false /* no throw */ )) + { + OUString line; + if (readLine( &line, OUSTR("SCHEMA="), ucb_content, + RTL_TEXTENCODING_UTF8 )) + { + sal_Int32 index = sizeof ("SCHEMA=") - 1; + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (token.getLength() > 0) { + // cleanup, check if existing: + if (create_ucb_content( + 0, expandUnoRcTerm(token), xCmdEnv, + false /* no throw */ )) { + m_xcs_files.push_back( token ); + } + else + OSL_ENSURE( + 0, "### invalid SCHEMA entry!" ); + } + } + while (index >= 0); + } + if (readLine( &line, OUSTR("DATA="), ucb_content, + RTL_TEXTENCODING_UTF8 )) { + sal_Int32 index = sizeof ("DATA=") - 1; + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (token.getLength() > 0) { + if (token[ 0 ] == '?') + token = token.copy( 1 ); + // cleanup, check if existing: + if (create_ucb_content( + 0, expandUnoRcTerm(token), + xCmdEnv, false /* no throw */ )) { + m_xcu_files.push_back( token ); + } + else + OSL_ENSURE( 0, "### invalid DATA entry!" ); + } + } + while (index >= 0); + } + } + m_configmgrini_modified = false; + m_configmgrini_inited = true; } - return m_configLayer; } -//============================================================================== -class SchemaFileRoot : public ::dp_misc::XmlRootElement +//______________________________________________________________________________ +void BackendImpl::configmgrini_flush( + Reference<XCommandEnvironment> const & xCmdEnv ) { -public: - OUString m_name; - OUString m_package; - - inline SchemaFileRoot() - : XmlRootElement( OUSTR("http://openoffice.org/2001/registry"), - OUSTR("component-schema") ) - {} - - // XRoot - virtual Reference< xml::input::XElement > SAL_CALL startRootElement( - sal_Int32 uid, OUString const & localname, - Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException); -}; + if (transientMode()) + return; + if (!m_configmgrini_inited || !m_configmgrini_modified) + return; + + ::rtl::OStringBuffer buf; + // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved + // locally: + if (m_eContext == CONTEXT_USER) { + buf.append( RTL_CONSTASCII_STRINGPARAM( + "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") ); + } + else if (m_eContext == CONTEXT_SHARED) { + buf.append( RTL_CONSTASCII_STRINGPARAM( + "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") ); + } + else + OSL_ASSERT(0); + buf.append(LF); + + if (! m_xcs_files.empty()) + { + t_stringlist::const_iterator iPos( m_xcs_files.begin() ); + t_stringlist::const_iterator const iEnd( m_xcs_files.end() ); + buf.append( RTL_CONSTASCII_STRINGPARAM("SCHEMA=") ); + while (iPos != iEnd) { + // encoded ASCII file-urls: + const ::rtl::OString item( + ::rtl::OUStringToOString( *iPos, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( item ); + ++iPos; + if (iPos != iEnd) + buf.append( ' ' ); + } + buf.append(LF); + } + if (! m_xcu_files.empty()) + { + t_stringlist::const_iterator iPos( m_xcu_files.begin() ); + t_stringlist::const_iterator const iEnd( m_xcu_files.end() ); + buf.append( RTL_CONSTASCII_STRINGPARAM("DATA=") ); + while (iPos != iEnd) { + // encoded ASCII file-urls: + const ::rtl::OString item( + ::rtl::OUStringToOString( *iPos, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( item ); + ++iPos; + if (iPos != iEnd) + buf.append( ' ' ); + } + buf.append(LF); + } + + // write configmgr.ini: + const Reference<io::XInputStream> xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast<sal_Int8 const *>(buf.getStr()), + buf.getLength() ) ) ); + ::ucbhelper::Content ucb_content( + makeURL( getCachePath(), OUSTR("configmgr.ini") ), xCmdEnv ); + ucb_content.writeStream( xData, true /* replace existing */ ); + + m_configmgrini_modified = false; +} + +//------------------------------------------------------------------------------ +inline OUString makeRcTerm( OUString const & url ) +{ + OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( + "vnd.sun.star.expand:") ) ); + if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { + // cut protocol: + OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); + // decode uric class chars: + rcterm = ::rtl::Uri::decode( + rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + return rcterm; + } + else + return url; +} //______________________________________________________________________________ -Reference< xml::input::XElement > SchemaFileRoot::startRootElement( - sal_Int32 uid, OUString const & localname, - Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException) +bool BackendImpl::addToConfigmgrIni( bool isSchema, OUString const & url_, + Reference<XCommandEnvironment> const & xCmdEnv ) { - // check root element: - XmlRootElement::startRootElement( uid, localname, xAttributes ); - - // "name" attribute - m_name = xAttributes->getValueByUidName( getUid(), OUSTR("name") ); - if (m_name.getLength() == 0) - throw xml::sax::SAXException( - OUSTR("missing schema name attribute!"), - static_cast< OWeakObject * >(this), Any() ); - - // "package" attribute - m_package = xAttributes->getValueByUidName( getUid(), OUSTR("package") ); - if (m_package.getLength() == 0) - throw xml::sax::SAXException( - OUSTR("missing schema package attribute!"), - static_cast<OWeakObject *>(this), Any() ); - - // don't go deeper... - return Reference<xml::input::XElement>(); + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + configmgrini_verify_init( xCmdEnv ); + t_stringlist & rSet = getFiles(isSchema); + if (::std::find( rSet.begin(), rSet.end(), rcterm ) == rSet.end()) { + rSet.push_front( rcterm ); // prepend to list, thus overriding + // write immediately: + m_configmgrini_modified = true; + configmgrini_flush( xCmdEnv ); + return true; + } + else + return false; } //______________________________________________________________________________ -void BackendImpl::xcs_merge_in( - OUString const & url, +bool BackendImpl::removeFromConfigmgrIni( + bool isSchema, OUString const & url_, Reference<XCommandEnvironment> const & xCmdEnv ) { - // parse out schema package: - SchemaFileRoot * root = new SchemaFileRoot; - Reference<xml::input::XRoot> xRoot( root ); - ::ucbhelper::Content ucb_content( url, xCmdEnv ); - xml_parse( xRoot, ucb_content, getComponentContext() ); - - OUString dest_folder( - makeURL( getConfigLayer(), OUSTR("schema/") + ::rtl::Uri::encode( - root->m_package, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ).replace( '.', '/' ) ) ); - OUString title( root->m_name + OUSTR(".xcs") ); - OUString dest_url( makeURL( dest_folder, ::rtl::Uri::encode( - title, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ) ); - // assure dest folder is existing: - ::ucbhelper::Content ucb_dest_folder; - create_folder( &ucb_dest_folder, dest_folder, xCmdEnv ); - if (! ucb_dest_folder.transferContent( - ::ucbhelper::Content( url, xCmdEnv ), - ::ucbhelper::InsertOperation_COPY, - title, NameClash::OVERWRITE )) - throw RuntimeException( - OUSTR("::ucb::Content::transferContent() failed!"), 0 ); + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + configmgrini_verify_init( xCmdEnv ); + t_stringlist & rSet = getFiles(isSchema); + t_stringlist::iterator i(std::find(rSet.begin(), rSet.end(), rcterm)); + if (i == rSet.end() && !isSchema) { //TODO: see replaceOrigin() + i = std::find( + rSet.begin(), rSet.end(), + rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); + } + if (i == rSet.end()) { + return false; + } + rSet.erase(i); + // write immediately: + m_configmgrini_modified = true; + configmgrini_flush( xCmdEnv ); + return true; +} + +//______________________________________________________________________________ +bool BackendImpl::hasInConfigmgrIni( + bool isSchema, OUString const & url_ ) +{ + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + t_stringlist const & rSet = getFiles(isSchema); + return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end() + || (!isSchema && //TODO: see replaceOrigin() + ::std::find( + rSet.begin(), rSet.end(), + rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))) != + rSet.end()); } //############################################################################## +// Package +//______________________________________________________________________________ +BackendImpl * BackendImpl::PackageImpl::getMyBackend() const +{ + BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); + if (NULL == pBackend) + { + //May throw a DisposedException + check(); + //We should never get here... + throw RuntimeException( + OUSTR("Failed to get the BackendImpl"), + static_cast<OWeakObject*>(const_cast<PackageImpl *>(this))); + } + return pBackend; +} + +beans::Optional< beans::Ambiguous<sal_Bool> > +BackendImpl::PackageImpl::isRegistered_( + ::osl::ResettableMutexGuard &, + ::rtl::Reference<AbortChannel> const &, + Reference<XCommandEnvironment> const & ) +{ + BackendImpl * that = getMyBackend(); + rtl::OUString url(getURL()); + return beans::Optional< beans::Ambiguous<sal_Bool> >( + true /* IsPresent */, + beans::Ambiguous<sal_Bool>( + that->hasInConfigmgrIni( m_isSchema, url ) || + that->m_registeredPackages->has( + rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ) ), + false /* IsAmbiguous */ ) ); +} + //------------------------------------------------------------------------------ OUString encodeForXml( OUString const & text ) { @@ -367,7 +553,7 @@ OUString encodeForXml( OUString const & text ) } //______________________________________________________________________________ -void BackendImpl::xcu_merge_in( +OUString replaceOrigin( OUString const & url, Reference< XCommandEnvironment > const & xCmdEnv ) { // looking for %origin%: @@ -434,199 +620,70 @@ void BackendImpl::xcu_merge_in( rtl_copyMemory( filtered.getArray() + write_pos, pAdd, nAdd ); write_pos += nAdd; } - if (use_filtered && write_pos < filtered.getLength()) + if (!use_filtered) + return url; + if (write_pos < filtered.getLength()) filtered.realloc( write_pos ); - - Reference<XComponentContext> const & xContext = getComponentContext(); - if (! m_xMergeImporter.is()) { - m_xMergeImporter.set( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.configuration.backend.MergeImporter"), - xContext ), UNO_QUERY_THROW ); - } - - Reference< ::com::sun::star::configuration::backend::XLayer > xLayer( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.configuration.backend.xml.LayerParser"), - xContext ), UNO_QUERY_THROW ); - - Reference< io::XActiveDataSink > xActiveDataSink( xLayer, UNO_QUERY_THROW ); - if (use_filtered) - xActiveDataSink->setInputStream( ::xmlscript::createInputStream( - filtered ) ); - else - ucb_content.openStream( xActiveDataSink ); - - if (transientMode()) - m_xMergeImporter->importLayer( xLayer ); - else - m_xMergeImporter->importLayerForEntity( xLayer, getConfigLayer() ); -} - -//############################################################################## - -// Package -//______________________________________________________________________________ -BackendImpl * BackendImpl::PackageImpl::getMyBackend() const -{ - BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); - if (NULL == pBackend) - { - //May throw a DisposedException - check(); - //We should never get here... - throw RuntimeException( - OUSTR("Failed to get the BackendImpl"), - static_cast<OWeakObject*>(const_cast<PackageImpl *>(this))); - } - return pBackend; -} - -beans::Optional< beans::Ambiguous<sal_Bool> > -BackendImpl::PackageImpl::isRegistered_( - ::osl::ResettableMutexGuard &, - ::rtl::Reference<AbortChannel> const &, - Reference<XCommandEnvironment> const & ) -{ - BackendImpl * that = getMyBackend(); - return beans::Optional< beans::Ambiguous<sal_Bool> >( - true /* IsPresent */, - beans::Ambiguous<sal_Bool>( - that->m_registeredPackages->has( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ), - false /* IsAmbiguous */ ) ); + rtl::OUString newUrl(url + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); + //TODO: unique name + ucbhelper::Content(newUrl, xCmdEnv).writeStream( + xmlscript::createInputStream(filtered), true); + return newUrl; } //______________________________________________________________________________ void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, - ::rtl::Reference<AbortChannel> const & abortChannel, + ::rtl::Reference<AbortChannel> const &, Reference<XCommandEnvironment> const & xCmdEnv ) { BackendImpl * that = getMyBackend(); + OUString url( getURL() ); + if (doRegisterPackage) { if (m_isSchema) { - OSL_ENSURE( ! that->transientMode(), - "### schema cannot be deployed transiently!" ); - if (! that->transientMode()) { - that->xcs_merge_in( m_url, xCmdEnv ); - that->m_registeredPackages->put( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8), - rtl::OString( - RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.configuration-schema" ) ) ); - } + configmgr::update::insertExtensionXcsFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); } else { - that->xcu_merge_in( m_url, xCmdEnv ); - that->m_registeredPackages->put( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ), - rtl::OString( - RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.configuration-data" ) ) ); + url = replaceOrigin(url, xCmdEnv); + configmgr::update::insertExtensionXcuFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); } + + that->addToConfigmgrIni( m_isSchema, url, xCmdEnv ); } else // revoke { - OSL_ASSERT( - that->m_registeredPackages->has( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ) ); - t_string2string_map entries( that->m_registeredPackages->getEntries() ); - t_string2string_map::const_iterator iPos( entries.begin() ); - t_string2string_map::const_iterator const iEnd( entries.end() ); - - if (m_isSchema) - { - if (! that->transientMode()) + if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv)) { + t_string2string_map entries( + that->m_registeredPackages->getEntries()); + for (t_string2string_map::iterator i(entries.begin()); + i != entries.end(); ++i) { - ::ucbhelper::Content ucbSaveLayer( - makeURL( that->getConfigLayer(), OUSTR("schema") ), - xCmdEnv ); - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("schema.bak") ) ); - try { - for ( ; iPos != iEnd; ++iPos ) - { - checkAborted( abortChannel ); - if (iPos->second == "vnd.sun.star.configuration-schema") - { - OUString url( - rtl::OStringToOUString( - iPos->first, RTL_TEXTENCODING_UTF8 ) ); - if (!url.equals( m_url )) { - that->xcs_merge_in( url, xCmdEnv ); - } - } + rtl::OUString url2( + rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); + if (url2 != url) { + bool schema = i->second.equalsIgnoreAsciiCase( + "vnd.sun.star.configuration-schema"); + if (!schema) { + url2 = replaceOrigin(url2, xCmdEnv); } + that->addToConfigmgrIni(schema, url2, xCmdEnv); } - catch (RuntimeException &) { - throw; - } - catch (Exception &) { - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("schema") ) ); - throw; - } - that->m_registeredPackages->erase( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ); - ucbSaveLayer.executeCommand( - OUSTR("delete"), Any( true /* delete physically */ ) ); + that->m_registeredPackages->erase(i->first); } - } - else // data - { - if (! that->transientMode()) - { - ::ucbhelper::Content ucbSaveLayer( - makeURL( that->getConfigLayer(), OUSTR("data") ), - xCmdEnv ); - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("data.bak") ) ); - try { - for ( ; iPos != iEnd; ++iPos ) - { - checkAborted( abortChannel ); - if (iPos->second == "vnd.sun.star.configuration-data") { - OUString url( - rtl::OStringToOUString( - iPos->first, RTL_TEXTENCODING_UTF8 ) ); - if (!url.equals( m_url )) { - that->xcu_merge_in( url, xCmdEnv ); - } - } - } - } - catch (RuntimeException &) { - throw; - } - catch (Exception &) { - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("data") ) ); - throw; - } - that->m_registeredPackages->erase( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ); - ucbSaveLayer.executeCommand( + ::ucbhelper::Content( + makeURL( that->getCachePath(), OUSTR("registry") ), + xCmdEnv ).executeCommand( OUSTR("delete"), Any( true /* delete physically */ ) ); - } } - } - if (!m_isSchema && getMyBackend()->m_defaultProvider.is()) { - // temp workaround for config bug: - try { - getMyBackend()->m_defaultProvider->refresh(); - } - catch (lang::WrappedTargetRuntimeException & exc) { - (void) exc; - OSL_ENSURE( 0, ::rtl::OUStringToOString( - ::comphelper::anyToString(exc.TargetException), - RTL_TEXTENCODING_UTF8 ).getStr() ); - } + //TODO: revoking at runtime, possible, sensible? } } diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 0c5e8117b07d..c06b30be1669 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -134,7 +134,7 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage( { ::osl::ResettableMutexGuard guard( getMutex() ); check(); - t_string2weakref::const_iterator const iFind( m_bound.find( url ) ); + t_string2ref::const_iterator const iFind( m_bound.find( url ) ); if (iFind != m_bound.end()) { Reference<deployment::XPackage> xPackage( iFind->second ); if (xPackage.is()) @@ -166,8 +166,8 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage( } guard.reset(); - ::std::pair< t_string2weakref::iterator, bool > insertion( - m_bound.insert( t_string2weakref::value_type( url, xNewPackage ) ) ); + ::std::pair< t_string2ref::iterator, bool > insertion( + m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); if (insertion.second) { // first insertion OSL_ASSERT( Reference<XInterface>(insertion.first->second) diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index c3bf83505ee2..fe52c8ffc7e3 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -244,11 +244,17 @@ class PackageRegistryBackend : protected ::dp_misc::MutexHolder, public t_BackendBase { ::rtl::OUString m_cachePath; - + //The map held originally WeakReferences. The map entries are removed in the disposing + //function, which is called when the XPackages are destructed or they are + //explicitely disposed. The latter happens, for example, when a extension is + //removed (see dp_manager.cxx). However, because of how the help systems work, now + // XPackageManager::getDeployedPackages is called often. This results in a lot + //of bindPackage calls which are costly. Therefore we keep hard references in + //the map now. typedef ::std::hash_map< - ::rtl::OUString, css::uno::WeakReference<css::deployment::XPackage>, - ::rtl::OUStringHash > t_string2weakref; - t_string2weakref m_bound; + ::rtl::OUString, css::uno::Reference<css::deployment::XPackage>, + ::rtl::OUStringHash > t_string2ref; + t_string2ref m_bound; protected: css::uno::Reference<css::uno::XComponentContext> m_xComponentContext; diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 70a7ed72304a..cfe5be59dad0 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -443,12 +443,19 @@ BackendImpl::PackageImpl::isRegistered_( AbortChannel::Chain chain( abortChannel, xSubAbortChannel ); beans::Optional< beans::Ambiguous<sal_Bool> > option( xPackage->isRegistered( xSubAbortChannel, xCmdEnv ) ); + + //present = true if at least one bundle item has this value. + //reg = true if all bundle items have an option value (option.IsPresent == 1) + //and all have value of true (option.Value.Value == true) + //If not, then the bundle has the status of not registered and ambiguous. if (option.IsPresent) { beans::Ambiguous<sal_Bool> const & status = option.Value; if (present) { + //we never come here in the first iteration if (reg != (status.Value != sal_False)) { + ambig = true; reg = false; break; @@ -456,6 +463,7 @@ BackendImpl::PackageImpl::isRegistered_( } else { + //we always come here in the first iteration reg = status.Value; present = true; } diff --git a/desktop/source/pagein/makefile.mk b/desktop/source/pagein/makefile.mk index c50dc43fe55b..01452a858e66 100644 --- a/desktop/source/pagein/makefile.mk +++ b/desktop/source/pagein/makefile.mk @@ -119,7 +119,7 @@ $(MISC)$/$(TARGET)-common : makefile.mk @-echo $(DLLPRE)package2$(DLLPOST) >> $@ @-echo $(DLLPRE)ucpfile1$(DLLPOST) >> $@ @-echo $(DLLPRE)ucb1$(DLLPOST) >> $@ - @-echo configmgr2$(UNODLLPOST) >> $@ + @-echo $(DLLPRE)configmgr$(DLLPOST) >> $@ # @-echo $(DLLPRE)dtrans$(DLLPOST) >> $@ @-echo $(DLLPRE)vclplug_gen$(DFTDLLPOST) >> $@ |