diff options
-rw-r--r-- | cppuhelper/source/bootstrap.cxx | 163 | ||||
-rw-r--r-- | scp2/source/ooo/common_brand.scp | 4 | ||||
-rw-r--r-- | scp2/source/ooo/directory_ooo.scp | 10 | ||||
-rw-r--r-- | scp2/source/ooo/file_ooo.scp | 6 | ||||
-rw-r--r-- | ure/source/README | 5 |
5 files changed, 140 insertions, 48 deletions
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx index 90a16af1be41..7aefa0b26b59 100644 --- a/cppuhelper/source/bootstrap.cxx +++ b/cppuhelper/source/bootstrap.cxx @@ -75,6 +75,8 @@ using namespace ::osl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace css = com::sun::star; + namespace cppu { @@ -198,6 +200,105 @@ OUString findBootstrapArgument( return result; } +css::uno::Reference< css::registry::XSimpleRegistry > readRdbFile( + rtl::OUString const & url, bool fatalErrors, + css::uno::Reference< css::registry::XSimpleRegistry > const & lastRegistry, + css::uno::Reference< css::lang::XSingleServiceFactory > const & + simpleRegistryFactory, + css::uno::Reference< css::lang::XSingleServiceFactory > const & + nestedRegistryFactory) +{ + OSL_ASSERT(simpleRegistryFactory.is() && nestedRegistryFactory.is()); + try { + css::uno::Reference< css::registry::XSimpleRegistry > simple( + simpleRegistryFactory->createInstance(), css::uno::UNO_QUERY_THROW); + simple->open(url, true, false); + if (lastRegistry.is()) { + css::uno::Reference< css::registry::XSimpleRegistry > nested( + nestedRegistryFactory->createInstance(), + css::uno::UNO_QUERY_THROW); + css::uno::Sequence< css::uno::Any > args(2); + args[0] <<= lastRegistry; + args[1] <<= simple; + css::uno::Reference< css::lang::XInitialization >( + nested, css::uno::UNO_QUERY_THROW)-> + initialize(args); + return nested; + } else { + return simple; + } + } catch (css::registry::InvalidRegistryException & e) { + (void) e; // avoid warnings + OSL_TRACE( + OSL_LOG_PREFIX "warning, could not open \"%s\": \"%s\"", + rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr(), + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + if (fatalErrors) { + throw; + } + return lastRegistry; + } +} + +Reference< registry::XSimpleRegistry > readRdbDirectory( + rtl::OUString const & url, bool fatalErrors, + css::uno::Reference< css::registry::XSimpleRegistry > const & lastRegistry, + css::uno::Reference< css::lang::XSingleServiceFactory > const & + simpleRegistryFactory, + css::uno::Reference< css::lang::XSingleServiceFactory > const & + nestedRegistryFactory) +{ + OSL_ASSERT(simpleRegistryFactory.is() && nestedRegistryFactory.is()); + osl::Directory dir(url); + switch (dir.open()) { + case osl::FileBase::E_None: + break; + case osl::FileBase::E_NOENT: + if (!fatalErrors) { + return lastRegistry; + } + // fall through + default: + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("cannot open directory ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + for (css::uno::Reference< css::registry::XSimpleRegistry > last( + lastRegistry);;) + { + osl::DirectoryItem i; + switch (dir.getNextItem(i, SAL_MAX_UINT32)) { + case osl::FileBase::E_None: + break; + case osl::FileBase::E_NOENT: + return last; + default: + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("cannot iterate directory ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + osl::FileStatus stat( + osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName | + osl_FileStatus_Mask_FileURL); + if (i.getFileStatus(stat) != osl::FileBase::E_None) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("cannot stat in directory ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: symlinks + last = readRdbFile( + stat.getFileURL(), fatalErrors, last, simpleRegistryFactory, + nestedRegistryFactory); + } + } +} + Reference< registry::XSimpleRegistry > nestRegistries( const OUString &baseDir, const Reference< lang::XSingleServiceFactory > & xSimRegFac, @@ -238,54 +339,30 @@ Reference< registry::XSimpleRegistry > nestRegistries( OUString rdb_name = (index == -1) ? csl_rdbs : csl_rdbs.copy(0, index); csl_rdbs = (index == -1) ? OUString() : csl_rdbs.copy(index + 1); - if (! rdb_name.getLength()) + if (rdb_name.isEmpty()) { continue; + } - bool optional = ('?' == rdb_name[ 0 ]); - if (optional) - rdb_name = rdb_name.copy( 1 ); - - try - { - Reference<registry::XSimpleRegistry> simpleRegistry( - xSimRegFac->createInstance(), UNO_QUERY_THROW ); - - osl::FileBase::getAbsoluteFileURL(baseDir, rdb_name, rdb_name); - simpleRegistry->open(rdb_name, sal_True, sal_False); - - if(lastRegistry.is()) - { - Reference< registry::XSimpleRegistry > nestedRegistry( - xNesRegFac->createInstance(), UNO_QUERY ); - Reference< lang::XInitialization > nestedRegistry_xInit( - nestedRegistry, UNO_QUERY ); - - Sequence<Any> aArgs(2); - aArgs[0] <<= lastRegistry; - aArgs[1] <<= simpleRegistry; - - nestedRegistry_xInit->initialize(aArgs); - - lastRegistry = nestedRegistry; - } - else - lastRegistry = simpleRegistry; + bool fatalErrors = !bFallenBack; + if (rdb_name[0] == '?') { + rdb_name = rdb_name.copy(1); + fatalErrors = false; } - catch(registry::InvalidRegistryException & e) - { - (void) e; // avoid warnings - OSL_TRACE( - OSL_LOG_PREFIX "warning, could not open \"%s\": \"%s\"", - OUStringToOString(rdb_name, RTL_TEXTENCODING_UTF8).getStr(), - OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - if (! optional) - { - // if a registry was explicitly given, the exception shall fly - if( ! bFallenBack ) - throw; - } + bool directory = rdb_name.getLength() >= 3 && rdb_name[0] == '<' && + rdb_name[rdb_name.getLength() - 2] == '>' && + rdb_name[rdb_name.getLength() -1] == '*'; + if (directory) { + rdb_name = rdb_name.copy(1, rdb_name.getLength() - 3); } + + osl::FileBase::getAbsoluteFileURL(baseDir, rdb_name, rdb_name); + + lastRegistry = directory + ? readRdbDirectory( + rdb_name, fatalErrors, lastRegistry, xSimRegFac, xNesRegFac) + : readRdbFile( + rdb_name, fatalErrors, lastRegistry, xSimRegFac, xNesRegFac); } while(index != -1 && csl_rdbs.getLength()); // are there more rdbs in list? diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index 9b75f369d578..710cdb8863ad 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -1168,7 +1168,7 @@ ProfileItem gid_Brand_Profileitem_Fundamental_Ure_More_Types ProfileID = gid_Brand_Profile_Fundamental_Ini; Section = "Bootstrap"; Key = "URE_MORE_TYPES"; - Value = "$ORIGIN/offapi.rdb $ORIGIN/oovbaapi.rdb ${${$ORIGIN/" PROFILENAME(uno) ":PKG_UserUnoFile}:UNO_TYPES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_SharedUnoFile}:UNO_TYPES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_BundledUnoFile}:UNO_TYPES}"; + Value = "<$ORIGIN/types>* ${${$ORIGIN/" PROFILENAME(uno) ":PKG_UserUnoFile}:UNO_TYPES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_SharedUnoFile}:UNO_TYPES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_BundledUnoFile}:UNO_TYPES}"; End ProfileItem gid_Brand_Profileitem_Fundamental_Ure_More_Services @@ -1176,7 +1176,7 @@ ProfileItem gid_Brand_Profileitem_Fundamental_Ure_More_Services ProfileID = gid_Brand_Profile_Fundamental_Ini; Section = "Bootstrap"; Key = "URE_MORE_SERVICES"; - Value = "${${$ORIGIN/" PROFILENAME(uno) ":PKG_UserUnoFile}:UNO_SERVICES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_SharedUnoFile}:UNO_SERVICES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_BundledUnoFile}:UNO_SERVICES} $ORIGIN/services.rdb"; + Value = "${${$ORIGIN/" PROFILENAME(uno) ":PKG_UserUnoFile}:UNO_SERVICES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_SharedUnoFile}:UNO_SERVICES} ${${$ORIGIN/" PROFILENAME(uno) ":PKG_BundledUnoFile}:UNO_SERVICES} <$ORIGIN/services>*"; End ProfileItem gid_Brand_Profileitem_Fundamental_Ure_More_Java_Types diff --git a/scp2/source/ooo/directory_ooo.scp b/scp2/source/ooo/directory_ooo.scp index a25b2d7f67e4..afd11a98c910 100644 --- a/scp2/source/ooo/directory_ooo.scp +++ b/scp2/source/ooo/directory_ooo.scp @@ -1435,3 +1435,13 @@ Directory gid_Dir_Template_Common_Presnt ParentID = gid_Dir_Template_Common; DosName = "presnt"; End + +Directory gid_Brand_Dir_Program_Services + ParentID = gid_Brand_Dir_Program; + DosName = "services"; +End + +Directory gid_Brand_Dir_Program_Types + ParentID = gid_Brand_Dir_Program; + DosName = "types"; +End diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index 34ed8a90a9a1..a8e0d88ebc47 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -629,14 +629,14 @@ End File gid_File_Rdb_Offapi TXT_FILE_BODY; - Dir = gid_Brand_Dir_Program; + Dir = gid_Brand_Dir_Program_Types; Styles = (PACKED); Name = "offapi.rdb"; End File gid_File_Rdb_TypesVba TXT_FILE_BODY; - Dir = gid_Brand_Dir_Program; + Dir = gid_Brand_Dir_Program_Types; Styles = (PACKED, OVERWRITE); Name = "oovbaapi.rdb"; End @@ -1142,7 +1142,7 @@ End File gid_Starregistry_Services_Rdb TXT_FILE_BODY; Name = "services.rdb"; - Dir = gid_Brand_Dir_Program; + Dir = gid_Brand_Dir_Program_Services; Styles = (PACKED); End diff --git a/ure/source/README b/ure/source/README index 64fa40bdb169..1463e04fdbbb 100644 --- a/ure/source/README +++ b/ure/source/README @@ -273,6 +273,11 @@ types.rdb and services.rdb files. That is, you cannot store additional types.rdb and services.rdb files in a Documents and Settings\All Users\Application Data\URE directory. +URE_MORE_TYPES and URE_MORE_SERVICES each contain zero or more space-separated +URI descriptors. A URI descriptor is either a URI (denoting an individual file) +or a URI embeded in "<" and ">*" (denoting all the files contained non- +recursively within the directory denoted by the given URI). + The Java UNO environment needs type information in the form of Java class files instead of rdb files. Additional types are searched for in any URLs listed in the public deployment variable URE_MORE_JAVA_TYPES. |