diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-11-09 13:12:29 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-11-09 13:12:29 +0000 |
commit | 208f073318c74ecff58aa8fd1266cf2851d70a2f (patch) | |
tree | 321a77fac1883528c5e794fa00abb3aa65b67f2b /desktop/source/deployment/registry/script | |
parent | 0621f49fe41bafe03a93397db54d9e427fb14e3e (diff) |
INTEGRATION: CWS jl13 (1.4.12); FILE MERGED
2004/10/21 13:26:44 jl 1.4.12.3: RESYNC: (1.4-1.5); FILE MERGED
2004/10/15 12:49:00 dbo 1.4.12.2: #i35536##i34555##i34149#
- rc files without vnd.sun.star.expand urls
- export file picker filter
- reinstall cleans xlc files
- minor improvements
Issue number:
Submitted by:
Reviewed by:
2004/09/30 16:53:59 dbo 1.4.12.1: #i34555# correct double checked locking, misc cleanup
Diffstat (limited to 'desktop/source/deployment/registry/script')
-rw-r--r-- | desktop/source/deployment/registry/script/dp_lib_container.cxx | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/desktop/source/deployment/registry/script/dp_lib_container.cxx b/desktop/source/deployment/registry/script/dp_lib_container.cxx index 67c8f866170a..df25d70c6021 100644 --- a/desktop/source/deployment/registry/script/dp_lib_container.cxx +++ b/desktop/source/deployment/registry/script/dp_lib_container.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dp_lib_container.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: rt $ $Date: 2004-09-08 16:50:03 $ + * last change: $Author: hr $ $Date: 2004-11-09 14:12:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,13 @@ namespace dp_registry { namespace backend { namespace script { +namespace { +struct StrCannotDetermineLibName : public StaticResourceString< + StrCannotDetermineLibName, RID_STR_CANNOT_DETERMINE_LIBNAME> {}; +struct StrLibNameAlreadyExists : public StaticResourceString< + StrLibNameAlreadyExists, RID_STR_LIBNAME_ALREADY_EXISTS> {}; +} + //______________________________________________________________________________ OUString LibraryContainer::get_libname( OUString const & url, @@ -96,9 +103,10 @@ OUString LibraryContainer::get_libname( ::ucb::Content ucb_content( url, xCmdEnv ); xml_parse( ::xmlscript::importLibrary( import ), ucb_content, xContext ); - if (import.aName.getLength() == 0) - throw Exception( getResourceString(RID_STR_CANNOT_DETERMINE_LIBNAME), + if (import.aName.getLength() == 0) { + throw Exception( StrCannotDetermineLibName::get(), Reference<XInterface>() ); + } return import.aName; } @@ -142,12 +150,13 @@ void LibraryContainer::flush( } //______________________________________________________________________________ -void LibraryContainer::verify_init( +void LibraryContainer::init( Reference<XCommandEnvironment> const & xCmdEnv ) const { ::osl::MutexGuard guard( m_mutex ); if (! m_inited) { + m_modified = false; ::ucb::Content ucb_content; if (create_ucb_content( &ucb_content, m_container_url, xCmdEnv, false /* no throw */ )) @@ -159,13 +168,25 @@ void LibraryContainer::verify_init( { ::xmlscript::LibDescriptor const & descr = import_array.mpLibs[ nPos ]; - ::std::pair< t_libs_map::iterator, bool > insertion( + // filter dead package entries in xlc file: + if (descr.aStorageURL.matchAsciiL( + RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") ) && + !create_ucb_content( 0, descr.aStorageURL, xCmdEnv, + false /* no throw */ )) + { + OSL_ENSURE( 0, ::rtl::OUStringToOString( + descr.aStorageURL, + RTL_TEXTENCODING_UTF8 ).getStr() ); + m_modified = true; // force write back + continue; + } + ::std::pair<t_libs_map::iterator, bool> insertion( m_map.insert( t_libs_map::value_type( descr.aName, descr ) ) ); OSL_ASSERT( insertion.second ); + (void) insertion; } } - m_modified = false; m_inited = true; } } @@ -190,7 +211,7 @@ bool LibraryContainer::insert( descr.bPasswordProtected = false; descr.bPreload = false; // all other fields are ignored by xmlscript lib export - verify_init( xCmdEnv ); + init( xCmdEnv ); ::osl::MutexGuard guard( m_mutex ); t_libs_map::iterator const iFind( m_map.find( descr.aName ) ); @@ -208,10 +229,11 @@ bool LibraryContainer::insert( { // found one: OUString const & storage_url = iFind->second.aStorageURL; - if (! insert_url.equals( storage_url )) + if (! insert_url.equals( storage_url )) { throw container::ElementExistException( - getResourceString(RID_STR_LIBNAME_ALREADY_EXISTS) + descr.aName, + StrLibNameAlreadyExists::get() + descr.aName, Reference<XInterface>() ); + } return true; } } @@ -219,12 +241,12 @@ bool LibraryContainer::insert( //______________________________________________________________________________ bool LibraryContainer::remove( OUString const & libname, OUString const & url, - Reference< XCommandEnvironment > const & xCmdEnv, + Reference<XCommandEnvironment> const & xCmdEnv, bool exact ) { bool succ = false; ::osl::MutexGuard guard( m_mutex ); - verify_init( xCmdEnv ); + init( xCmdEnv ); if (exact) { if (libname.getLength() != 0) @@ -271,16 +293,16 @@ bool LibraryContainer::has( Reference< XCommandEnvironment > const & xCmdEnv ) const { ::osl::MutexGuard guard( m_mutex ); - verify_init( xCmdEnv ); + init( xCmdEnv ); return m_map.find( libname ) != m_map.end(); } //______________________________________________________________________________ t_descr_list LibraryContainer::getLibs( - Reference< XCommandEnvironment > const & xCmdEnv ) const + Reference<XCommandEnvironment> const & xCmdEnv ) const { ::osl::MutexGuard guard( m_mutex ); - verify_init( xCmdEnv ); + init( xCmdEnv ); t_descr_list ret; t_libs_map::iterator iPos( m_map.begin() ); t_libs_map::iterator const iEnd( m_map.end() ); |