summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 15:02:24 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 15:02:24 +0000
commitfa784add83dcbd2f9c48e347585dfd2a12258b97 (patch)
tree401762a39fe71d2e31ea2e56be7848ceba5a7360 /framework
parent88ea5dc8c446b7312d7966e8748bd60f8f999ff7 (diff)
INTEGRATION: CWS xmlfilter01 (1.1.2); FILE ADDED
2003/03/11 10:28:10 as 1.1.2.2: #107711# small bug fixes, cosmetic changes 2003/03/06 13:57:14 as 1.1.2.1: #107711# full read/write access for types, filters, detect service
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services/detectorfactory.hxx554
1 files changed, 554 insertions, 0 deletions
diff --git a/framework/inc/services/detectorfactory.hxx b/framework/inc/services/detectorfactory.hxx
new file mode 100644
index 000000000000..998eab32bae8
--- /dev/null
+++ b/framework/inc/services/detectorfactory.hxx
@@ -0,0 +1,554 @@
+/*************************************************************************
+ *
+ * $RCSfile: detectorfactory.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-04-04 16:02:24 $
+ *
+ * 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: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_
+#define __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_
+
+//_______________________________________________
+// includes of own project
+
+#ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_
+#include <classes/filtercache.hxx>
+#endif
+
+#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
+#include <threadhelp/threadhelpbase.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
+#include <macros/xinterface.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_
+#include <macros/xtypeprovider.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_
+#include <macros/xserviceinfo.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
+#include <macros/generic.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
+#include <macros/debug.hxx>
+#endif
+
+#ifndef __FRAMEWORK_GENERAL_H_
+#include <general.h>
+#endif
+
+//_______________________________________________
+// includes of interfaces
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_WRAPPEDTARGETEXCEPTION_HPP_
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HPP_
+#include <com/sun/star/container/ElementExistException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_NOSUCHELEMENTEXCEPTION_HPP_
+#include <com/sun/star/container/NoSuchElementException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_NOSUCHELEMENTEXCEPTION_HPP_
+#include <com/sun/star/container/NoSuchElementException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
+#include <com/sun/star/util/XFlushable.hpp>
+#endif
+
+//_______________________________________________
+// includes of other projects
+
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+//_______________________________________________
+// exported const
+
+//_______________________________________________
+// exported definitions
+
+/// @HTML
+/** @short factory to create detect service objects and initialize it in the right way.
+
+ @descr This class can be used to create new detect services for specified contents.
+ It uses cached values of the configuration to lay down, which detector match
+ a given name. Further this class provides full access to the configuration data
+ of such detect services and following implementations will support some special
+ query modes.
+
+ @author as96863
+
+ @docdate 07.03.2003 by as96863
+
+ @todo <ul>
+ <li>implementation of query mode</li>
+ <li>simple restore mechanism of last consistent cache state,
+ if flush failed</li>
+ </ul>
+ */
+/// @NOHTML
+
+class DetectorFactory : // interfaces
+ public css::lang::XTypeProvider ,
+ public css::lang::XServiceInfo ,
+ public css::lang::XMultiServiceFactory ,
+ public css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess
+ public css::util::XFlushable ,
+ // base classes
+ // Order is neccessary for right initialization of it!
+ private ThreadHelpBase ,
+ public ::cppu::OWeakObject
+{
+ //-------------------------------------------
+ // member
+
+ private:
+
+ /** reference to the global uno service manager.
+ It will be used to create own needed services on demand. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** singleton, which contains all needed configuration data and provides
+ read/write access on it. */
+ FilterCache m_aCache;
+
+ /** contains all registered listener. */
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer;
+
+ //-------------------------------------------
+ // interface
+
+ public:
+
+ //---------------------------------------
+ // XInterface, XTypeProvider, XServiceInfo
+
+ DECLARE_XINTERFACE
+ DECLARE_XTYPEPROVIDER
+ DECLARE_XSERVICEINFO
+
+ #ifdef ENABLE_AUTODOC_FIX
+ ;
+ #endif
+
+ //---------------------------------------
+
+ /** @short initialize new instance of this class.
+
+ @param xSMGR
+ reference to the global uno service manager, which created this new factory instance.
+ It must be used during runtime to create own needed services.
+ */
+
+ DetectorFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
+
+ //---------------------------------------
+
+ /** @short release internal structures.
+ */
+
+ virtual ~DetectorFactory();
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ /** @short create a new detect service and initialize it with it's own configuration data.
+
+ @param sName
+ means the uno implementation name of a detect service.
+
+ @exception com::sun::star::uno::Exception
+ if the requested service could not be created or initialized.
+ */
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& sName )
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ /** @short does the same as createInstance() method, but initialize created detect service with some
+ additional data.
+
+ @param sName
+ means the uno implementation name of a detect service.
+
+ @param lArguments
+ the optional arguments, which are passed to the created detect service against
+ it's own configuration data.
+
+ @exception com::sun::star::uno::Exception
+ if the requested service could not be created or initialized.
+ */
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sName ,
+ const css::uno::Sequence< css::uno::Any >& lArguments )
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ /** @short return list of all well know detect services, which can be created by this factory.
+
+ @attention Because this service implements read/write access to the configuration too,
+ this list is dynamic. Means: in multithreaded environments some items of this
+ return list could be invalid next time!
+
+ @return A list of all registered detect services.
+ */
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XNameContainer
+
+ /** @short add new detect service entry to this container.
+
+ @descr This will change all internal structures only!
+ Updating of the configuration layer and notify of all registered
+ listener will be done inside API call XFlushable::flush() on this
+ container.
+
+ @param sName
+ means the uno implementation name of this new detect service entry.
+
+ @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!]
+ describe this new entry. For a list of all supported properties
+ have a look on method >>getByName()<<.
+ Note: Missing values will be created with defaults!
+
+ @exception com::sun::star::lang::IllegalArgumentException
+ if one of the incoming parameters seams to be invalid.
+ That doesn't include the check, if this item already exist!
+
+ @exception com::sun::star::container::ElementExistException
+ if this item already exist inside this container.
+
+ @exception com::sun::star::lang::WrappedTargetException
+ f creation of the internal structures failed.
+ */
+
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& sName ,
+ const css::uno::Any& aPropertySet )
+ throw(css::lang::IllegalArgumentException ,
+ css::container::ElementExistException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XNameContainer
+
+ /** @short remove a detect service entry from this container.
+
+ @descr This will change all internal structures only!
+ Updating of the configuration layer and notify of all registered
+ listener will be done inside API call XFlushable::flush() on this
+ container.
+
+ @param sName
+ means the uno implementation name of a detect service entry.
+
+ @exception com::sun::star::container::NoSuchElementException
+ if the requested item does not exist inside this container.
+
+ @exception com::sun::star::lang::WrappedTargetException
+ if creation of the internal structures failed.
+ */
+
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& sName )
+ throw(css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XNameReplace
+
+ /** @short change a detect service entry inside this container.
+
+ @descr This will change all internal structures only!
+ Updating of the configuration layer and notify of all registered
+ listener will be done inside API call XFlushable::flush() on this
+ container.
+
+ @param sName
+ means the uno implementation name of a detect service entry.
+
+ @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!]
+ describe the changes on this entry. For a list of all supported properties
+ have a look on method getByName().
+ Note: Missing properties will be untouched.
+
+ @exception com::sun::star::lang::IllegalArgumentException
+ if one of the incoming parameters seams to be invalid.
+ That doesn't include the check, if this item exist!
+
+ @exception com::sun::star::container::NoSuchElementException
+ if the requested item does not exist inside this container.
+
+ @exception com::sun::star::lang::WrappedTargetException
+ if updating of the internal structures failed.
+ */
+
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& sName ,
+ const css::uno::Any& aPropertySet )
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XNameAccess
+
+ /// @HTML
+ /** @short return properties of queried detector item.
+
+ @descr Use this method to get all informations about a detector item of this cache.
+ A sequence< com::sun::star::beans::PropertyValue > packed inside an Any will be returned.
+ Following properties are defined:
+ <table border=1>
+ <tr>
+ <td><b>Property</b></td>
+ <td><b>Value<b></td>
+ <td><b>Description<b></td>
+ </tr>
+ <tr>
+ <td>Name</td>
+ <td>[string]</td>
+ <td>the uno implementation name for this detect service</td>
+ </tr>
+ <tr>
+ <td>Types</td>
+ <td>[sequence< string >]</td>
+ <td>a list of all internbal type names, which this detect service is registered for</td>
+ </tr>
+ </table>
+
+ @param sName
+ the uno implementation name the requested detector.
+
+ @return A property set, which describe this detect service.
+ It uses a sequence< com::sun::star::beans::PropertyValue > internaly.
+
+ @exception com::sun::star::container::NoSuchElementException
+ if the requested entry does not exist inside this container.
+ */
+ /// @NOHTML
+
+ virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName )
+ throw(css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XNameAccess
+
+ /** @short return list of all well know container entries available on this container.
+
+ @attention Because this service implements read/write access to the configuration too,
+ this list is dynamic. Means: in multithreaded environments some items of this
+ return list could be invalid next time!
+
+ @return A list of all well known container items.
+ */
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XNameAccess
+
+ /** @short check if searched entry exist inside this container.
+
+ @attention In multithreaded environments it's not guaranteed, that a
+ queried item exist next time realy! It can be deleted by
+ another thread ...
+
+ @param sName
+ the name of the queried container entry.
+
+ @return TRUE if the requested item exist; FALSE otherwise.
+ */
+
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName )
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XElementAccess
+
+ /** @short return the uno type, which is used for all container items.
+
+ @return Type of sequence< com::sun::star::beans::PropertyValue > everytime - because it's fix.
+ */
+
+ virtual css::uno::Type SAL_CALL getElementType()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XElementAccess
+
+ /** @short return fill state of this cache.
+
+ @return TRUE if any item exist inside this conatiner; FALSE otherwhise.
+ */
+
+ virtual sal_Bool SAL_CALL hasElements()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XFlushable
+
+ /** @short update the configuration layer and notify all registered listener.
+
+ @descr All container interface methods update the internal structures of
+ this container only. But the underlying configuration layer and
+ may some possible other caches was not updated.
+ Calling of flush() will do that.
+ At the same time all currently registered flush listener will be informed,
+ so they can update her structures too.
+ Note: Before all these operations are started realy, all changes will be
+ verified and if neccessary some corrections will be done.
+ In case the cache will be invalid and could not be repaired an exception is thrown!
+ Normaly this container will not work correctly afterwards ...
+
+ @exception com::sun::star::uno::RuntimeException
+ if the changes on this container was invald and could not be repaired.
+ */
+
+ virtual void SAL_CALL flush()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XFlushable
+
+ /** @short register listener for container updates.
+
+ @param xListener
+ reference to listener, which wish to be registered.
+
+ @exception com::sun::star::uno::RuntimeException
+ if the given listener is an invalid reference.
+ Note: multiple calls of this method for the same listener won't be checked!
+ */
+
+ virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener )
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XFlushable
+
+ /** @short deregister listener for container updates.
+
+ @param xListener
+ reference to listener, which wish to be deregistered.
+
+ @exception com::sun::star::uno::RuntimeException
+ if the given listener is an invalid reference.
+ Note: multiple calls of this method for the same listener won't be checked!
+ */
+
+ virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener )
+ throw(css::uno::RuntimeException);
+
+}; // class DetectorFactory
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_