summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configmgr/source/inc/confapifactory.hxx33
-rw-r--r--configmgr/source/misc/configunoreg.cxx16
-rw-r--r--configmgr/source/xml/parsersvc.cxx425
-rw-r--r--configmgr/source/xml/parsersvc.hxx166
4 files changed, 627 insertions, 13 deletions
diff --git a/configmgr/source/inc/confapifactory.hxx b/configmgr/source/inc/confapifactory.hxx
index 956f0d820f93..25c899326e84 100644
--- a/configmgr/source/inc/confapifactory.hxx
+++ b/configmgr/source/inc/confapifactory.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: confapifactory.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: jb $ $Date: 2001-05-28 14:49:47 $
+ * last change: $Author: jb $ $Date: 2002-05-16 10:59:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,40 +84,42 @@ namespace configmgr
struct ServiceInfo;
class ConnectionSettings;
+ typedef uno::Reference< lang::XMultiServiceFactory > CreationContext;
+
typedef uno::Reference< uno::XInterface > (SAL_CALL * ProviderInstantiation)
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
// provider instantiation
uno::Reference< uno::XInterface > SAL_CALL instantiateConfigProvider
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
uno::Reference< uno::XInterface > SAL_CALL instantiateAdminProvider
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
uno::Reference< uno::XInterface > SAL_CALL instantiateUserAdminProvider
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
uno::Reference< uno::XInterface > SAL_CALL instantiateLocalAdminProvider
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
uno::Reference< uno::XInterface > SAL_CALL instantiateRemoteAdminProvider
(
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager,
+ CreationContext const& rServiceManager,
ConnectionSettings const& _rConnectionSettings
);
@@ -135,11 +137,20 @@ namespace configmgr
// other services - instantiation and info
uno::Reference< uno::XInterface > SAL_CALL instantiateConfigRegistry
- (
- uno::Reference< lang::XMultiServiceFactory > const& rServiceManager
- );
+ ( CreationContext const& rServiceManager );
+
const ServiceInfo* getConfigurationRegistryServiceInfo();
+ namespace xml
+ {
+ uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser
+ ( CreationContext const& rServiceManager );
+ uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser
+ ( CreationContext const& rServiceManager );
+
+ const ServiceInfo* getSchemaParserServiceInfo();
+ const ServiceInfo* getLayerParserServiceInfo();
+ }
} // namespace configmgr
#endif // CONFIGMGR_API_FACTORY_HXX_
diff --git a/configmgr/source/misc/configunoreg.cxx b/configmgr/source/misc/configunoreg.cxx
index 4960eef8a012..9eb2e1239f2d 100644
--- a/configmgr/source/misc/configunoreg.cxx
+++ b/configmgr/source/misc/configunoreg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: configunoreg.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: jb $ $Date: 2001-05-28 14:49:47 $
+ * last change: $Author: jb $ $Date: 2002-05-16 10:59:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -251,6 +251,8 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(
RegisterService(configmgr::getConfigurationRegistryServiceInfo(), xKey);
+ RegisterService(configmgr::xml::getSchemaParserServiceInfo(), xKey);
+ RegisterService(configmgr::xml::getLayerParserServiceInfo(), xKey);
// im/export
#if 0
RegisterService(configmgr::getDataExportServiceInfo(), xKey);
@@ -297,6 +299,16 @@ extern "C" void* SAL_CALL component_getFactory(
&configmgr::instantiateConfigRegistry,
::cppu::createSingleFactory)
||
+ aReq.CreateService(
+ configmgr::xml::getSchemaParserServiceInfo(),
+ &configmgr::xml::instantiateSchemaParser,
+ ::cppu::createSingleFactory)
+ ||
+ aReq.CreateService(
+ configmgr::xml::getLayerParserServiceInfo(),
+ &configmgr::xml::instantiateLayerParser,
+ ::cppu::createSingleFactory)
+ ||
false;
pRet = aReq.getProvider();
diff --git a/configmgr/source/xml/parsersvc.cxx b/configmgr/source/xml/parsersvc.cxx
new file mode 100644
index 000000000000..ae44e3f2ad2d
--- /dev/null
+++ b/configmgr/source/xml/parsersvc.cxx
@@ -0,0 +1,425 @@
+/*************************************************************************
+ *
+ * $RCSfile: parsersvc.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jb $ $Date: 2002-05-16 10:59:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "parsersvc.hxx"
+
+#ifndef CONFIGMGR_API_FACTORY_HXX_
+#include "confapifactory.hxx"
+#endif
+#ifndef CONFIGMGR_XML_SCHEMAPARSER_HXX
+#include "schemaparser.hxx"
+#endif
+#ifndef CONFIGMGR_XML_LAYERPARSER_HXX
+#include "layerparser.hxx"
+#endif
+
+#include <drafts/com/sun/star/configuration/backend/XSchema.hpp>
+#include <drafts/com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+
+#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_
+#include <com/sun/star/xml/sax/XParser.hpp>
+#endif
+// -----------------------------------------------------------------------------
+
+namespace configmgr
+{
+// -----------------------------------------------------------------------------
+ namespace ServiceInfoHelper
+ {
+ sal_Int32 countServices(ServiceInfo const* m_info)
+ {
+ AsciiServiceName const* p= m_info ? m_info->serviceNames : 0;
+ if (p == 0)
+ return 0;
+
+ sal_Int32 nCount = 0;
+ while (*p != 0)
+ {
+ ++nCount;
+ ++p;
+ }
+
+ return nCount;
+ }
+
+ OUString getImplementationName( ServiceInfo const * m_info )
+ throw(uno::RuntimeException)
+ {
+ AsciiServiceName p= m_info ? m_info->implementationName : 0;
+
+ return p ? OUString::createFromAscii(p) : OUString();
+ }
+
+ sal_Bool supportsService( ServiceInfo const * m_info, OUString const & ServiceName )
+ throw(uno::RuntimeException)
+ {
+ AsciiServiceName const* p= m_info ? m_info->serviceNames : 0;
+ if (p == 0)
+ return false;
+
+ while (*p != 0)
+ {
+ if (0 == ServiceName.compareToAscii(*p))
+ return true;
+ ++p;
+ }
+
+ return false;
+ }
+
+ uno::Sequence< OUString > getSupportedServiceNames(ServiceInfo const* m_info )
+ throw(uno::RuntimeException)
+ {
+ sal_Int32 const nCount = countServices(m_info);
+
+ uno::Sequence< OUString > aServices( nCount );
+
+ for(sal_Int32 i= 0; i < nCount; ++i)
+ aServices[i] = OUString::createFromAscii(m_info->serviceNames[i]);
+
+ return aServices;
+ }
+ }
+// -----------------------------------------------------------------------------
+ namespace xml
+ {
+// -----------------------------------------------------------------------------
+ namespace uno = ::com::sun::star::uno;
+ namespace lang = ::com::sun::star::lang;
+ namespace io = ::com::sun::star::io;
+ namespace sax = ::com::sun::star::xml::sax;
+ namespace backenduno = drafts::com::sun::star::configuration::backend;
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+struct ParserServiceTraits;
+// -----------------------------------------------------------------------------
+static inline void clear(OUString & _rs) { _rs = OUString(); }
+
+// -----------------------------------------------------------------------------
+template <class BackendInterface>
+ParserService<BackendInterface>::ParserService(CreationArg _xServiceFactory)
+: m_xServiceFactory(_xServiceFactory)
+, m_aInputSource()
+, m_pServiceInfo( ParserServiceTraits<BackendInterface>::getServiceInfo() )
+{
+ if (!m_xServiceFactory.is())
+ {
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: Unexpected NULL context"));
+ throw uno::RuntimeException(sMessage,*this);
+ }
+}
+// -----------------------------------------------------------------------------
+
+// XInitialization
+template <class BackendInterface>
+void SAL_CALL
+ ParserService<BackendInterface>::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ switch(aArguments.getLength())
+ {
+ case 0:
+ break;
+
+ case 1:
+ if (aArguments[0] >>= m_aInputSource)
+ break;
+
+ if (aArguments[0] >>= m_aInputSource.aInputStream)
+ break;
+
+ {
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Parser"
+ "- InputSource or XInputStream expected"));
+ throw lang::IllegalArgumentException(sMessage,*this,1);
+ }
+ default:
+ {
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Parser"));
+ throw lang::IllegalArgumentException(sMessage,*this,0);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+// XServiceInfo
+template <class BackendInterface>
+::rtl::OUString SAL_CALL
+ ParserService<BackendInterface>::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ServiceInfoHelper::getImplementationName( m_pServiceInfo );
+}
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+sal_Bool SAL_CALL
+ ParserService<BackendInterface>::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceInfoHelper::supportsService( m_pServiceInfo, ServiceName );
+}
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+uno::Sequence< ::rtl::OUString > SAL_CALL
+ ParserService<BackendInterface>::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ return ServiceInfoHelper::getSupportedServiceNames( m_pServiceInfo );
+}
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+void SAL_CALL
+ ParserService<BackendInterface>::setInputStream( const uno::Reference< io::XInputStream >& aStream )
+ throw (uno::RuntimeException)
+{
+ clear( m_aInputSource.sEncoding );
+ clear( m_aInputSource.sSystemId );
+ // clear( m_aInputSource.sPublicId );
+ m_aInputSource.aInputStream = aStream;
+}
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+uno::Reference< io::XInputStream > SAL_CALL
+ ParserService<BackendInterface>::getInputStream( )
+ throw (uno::RuntimeException)
+{
+ return m_aInputSource.aInputStream;
+}
+// -----------------------------------------------------------------------------
+
+template <class BackendInterface>
+void ParserService<BackendInterface>::parse(uno::Reference< sax::XDocumentHandler > const & _xHandler)
+ throw (uno::Exception)
+{
+ typedef uno::Reference< sax::XParser > SaxParser;
+
+ rtl::OUString const k_sSaxParserService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"));
+
+ SaxParser xParser = SaxParser::query( m_xServiceFactory->createInstance(k_sSaxParserService) );
+
+ if (!xParser.is())
+ {
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: Cannot create SAX Parser"));
+ throw uno::RuntimeException(sMessage,*this);
+ }
+
+ try
+ {
+ xParser->setDocumentHandler(_xHandler);
+ xParser->parseStream( m_aInputSource );
+ }
+ catch (sax::SAXException & e)
+ {
+ uno::Any aWrapped = e.WrappedException.hasValue() ? e.WrappedException : uno::makeAny( e );
+
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: a ") );
+ sMessage += aWrapped.getValueTypeName();
+ sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" occurred while parsing:"));
+ sMessage += e.Message;
+ throw lang::WrappedTargetRuntimeException(sMessage,*this,aWrapped);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+AsciiServiceName const aSchemaParserServices[] =
+{
+ "com.sun.star.configuration.backend.xml.SchemaParser",
+ 0
+};
+const ServiceInfo aSchemaParserSI =
+{
+ "com.sun.star.comp.configuration.backend.xml.SchemaParser",
+ aSchemaParserServices
+};
+// -----------------------------------------------------------------------------
+AsciiServiceName const aLayerParserServices[] =
+{
+ "com.sun.star.configuration.backend.xml.LayerParser",
+ 0
+};
+const ServiceInfo aLayerParserSI =
+{
+ "com.sun.star.comp.configuration.backend.xml.LayerParser",
+ aLayerParserServices
+};
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+template <>
+struct ParserServiceTraits< backenduno::XSchema >
+{
+ typedef backenduno::XSchemaHandler Handler;
+
+ static ServiceInfo const * getServiceInfo()
+ { return & aSchemaParserSI; }
+};
+// -----------------------------------------------------------------------------
+template <>
+struct ParserServiceTraits< backenduno::XLayer >
+{
+ typedef backenduno::XLayerHandler Handler;
+
+ static ServiceInfo const * getServiceInfo()
+ { return & aLayerParserSI; }
+};
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+typedef ParserService< backenduno::XSchema > SchemaParserService_Base;
+
+class SchemaParserService : public SchemaParserService_Base
+{
+public:
+ typedef SchemaParser::HandlerRef HandlerArg;
+
+ SchemaParserService(CreationArg _xServiceFactory)
+ : SchemaParserService_Base(_xServiceFactory)
+ {
+ }
+
+ virtual void SAL_CALL readSchema( HandlerArg const & aHandler )
+ throw (uno::RuntimeException);
+
+ virtual void SAL_CALL readComponent( HandlerArg const & aHandler )
+ throw (uno::RuntimeException);
+
+ virtual void SAL_CALL readTemplates( HandlerArg const & aHandler )
+ throw (uno::RuntimeException);
+};
+// -----------------------------------------------------------------------------
+
+typedef ParserService< backenduno::XLayer > LayerParserService_Base;
+
+class LayerParserService : public LayerParserService_Base
+{
+public:
+ typedef LayerParser::HandlerRef HandlerArg;
+
+ LayerParserService(CreationArg _xServiceFactory)
+ : LayerParserService_Base(_xServiceFactory)
+ {
+ }
+
+ virtual void SAL_CALL readData( HandlerArg const & aHandler )
+ throw (uno::RuntimeException);
+};
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser( CreationContext const& rServiceManager )
+{
+ return * new SchemaParserService(rServiceManager);
+}
+uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser( CreationContext const& rServiceManager )
+{
+ return * new LayerParserService(rServiceManager);
+}
+// -----------------------------------------------------------------------------
+const ServiceInfo* getSchemaParserServiceInfo()
+{ return & aSchemaParserSI; }
+const ServiceInfo* getLayerParserServiceInfo()
+{ return & aLayerParserSI; }
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+void SAL_CALL SchemaParserService::readSchema( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
+ throw (uno::RuntimeException)
+{
+ // todo: check for NULL handler
+ SaxHandler xHandler = new SchemaParser(this->getServiceFactory(),aHandler, SchemaParser::selectAll);
+ this->parse( xHandler );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SchemaParserService::readComponent( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
+ throw (uno::RuntimeException)
+{
+ // todo: check for NULL handler
+ SaxHandler xHandler = new SchemaParser(this->getServiceFactory(),aHandler, SchemaParser::selectComponent);
+ this->parse( xHandler );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SchemaParserService::readTemplates( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
+ throw (uno::RuntimeException)
+{
+ // todo: check for NULL handler
+ SaxHandler xHandler = new SchemaParser(this->getServiceFactory(),aHandler, SchemaParser::selectTemplates);
+ this->parse( xHandler );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL LayerParserService::readData( uno::Reference< backenduno::XLayerHandler > const & aHandler )
+ throw (uno::RuntimeException)
+{
+ // todo: check for NULL handler
+ SaxHandler xHandler = new LayerParser(this->getServiceFactory(),aHandler);
+ this->parse( xHandler );
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+ } // namespace
+
+// -----------------------------------------------------------------------------
+} // namespace
+
diff --git a/configmgr/source/xml/parsersvc.hxx b/configmgr/source/xml/parsersvc.hxx
new file mode 100644
index 000000000000..ca312ccdfbac
--- /dev/null
+++ b/configmgr/source/xml/parsersvc.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: parsersvc.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jb $ $Date: 2002-05-16 10:59:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CONFIGMGR_XML_PARSERSVC_HXX
+#define CONFIGMGR_XML_PARSERSVC_HXX
+
+#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_
+#include "confsvccomponent.hxx"
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_INPUTSOURCE_HPP_
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumenthandler.hpp>
+#endif
+
+namespace configmgr
+{
+// -----------------------------------------------------------------------------
+ namespace xml
+ {
+// -----------------------------------------------------------------------------
+ using rtl::OUString;
+ namespace uno = ::com::sun::star::uno;
+ namespace lang = ::com::sun::star::lang;
+ namespace io = ::com::sun::star::io;
+ namespace sax = ::com::sun::star::xml::sax;
+// -----------------------------------------------------------------------------
+
+ template <class BackendInterface>
+ class ParserService : public ::cppu::WeakImplHelper4<
+ lang::XInitialization,
+ lang::XServiceInfo,
+ io::XActiveDataSink,
+ BackendInterface
+ >
+ {
+ public:
+ typedef uno::Reference< lang::XMultiServiceFactory > const & CreationArg;
+
+ explicit
+ ParserService(CreationArg _xServiceFactory);
+
+ // XInitialization
+ virtual void SAL_CALL
+ initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw (uno::Exception, uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName( )
+ throw (uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException);
+
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames( )
+ throw (uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setInputStream( const uno::Reference< io::XInputStream >& aStream )
+ throw (uno::RuntimeException);
+
+ virtual uno::Reference< io::XInputStream > SAL_CALL
+ getInputStream( )
+ throw (uno::RuntimeException);
+
+ protected:
+ typedef uno::Reference< sax::XDocumentHandler > SaxHandler;
+ typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
+
+ ServiceFactory getServiceFactory() const
+ { return m_xServiceFactory; }
+
+ void parse(SaxHandler const & _xHandler)
+ throw (uno::Exception);
+ private:
+ ServiceFactory m_xServiceFactory;
+ sax::InputSource m_aInputSource;
+ ServiceInfo const * const m_pServiceInfo;
+ };
+
+// -----------------------------------------------------------------------------
+ } // namespace xml
+// -----------------------------------------------------------------------------
+
+} // namespace configmgr
+#endif
+
+
+
+