LCOV - code coverage report
Current view: top level - ucb/source/ucp/webdav-neon - webdavcontent.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 1 0.0 %
Date: 2014-04-11 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*************************************************************************
       3             :  *
       4             :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5             :  *
       6             :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7             :  *
       8             :  * OpenOffice.org - a multi-platform office productivity suite
       9             :  *
      10             :  * This file is part of OpenOffice.org.
      11             :  *
      12             :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13             :  * it under the terms of the GNU Lesser General Public License version 3
      14             :  * only, as published by the Free Software Foundation.
      15             :  *
      16             :  * OpenOffice.org is distributed in the hope that it will be useful,
      17             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19             :  * GNU Lesser General Public License version 3 for more details
      20             :  * (a copy is included in the LICENSE file that accompanied this code).
      21             :  *
      22             :  * You should have received a copy of the GNU Lesser General Public License
      23             :  * version 3 along with OpenOffice.org.  If not, see
      24             :  * <http://www.openoffice.org/license.html>
      25             :  * for a copy of the LGPLv3 License.
      26             :  *
      27             :  ************************************************************************/
      28             : 
      29             : #ifndef _WEBDAV_UCP_CONTENT_HXX
      30             : #define _WEBDAV_UCP_CONTENT_HXX
      31             : 
      32             : #include <config_lgpl.h>
      33             : #include <memory>
      34             : #include <list>
      35             : #include <rtl/ref.hxx>
      36             : #include <com/sun/star/ucb/ContentCreationException.hpp>
      37             : #include <com/sun/star/ucb/XContentCreator.hpp>
      38             : #include <ucbhelper/contenthelper.hxx>
      39             : #include "DAVResourceAccess.hxx"
      40             : #include "PropertyMap.hxx"
      41             : 
      42             : namespace com { namespace sun { namespace star { namespace beans {
      43             :     struct Property;
      44             :     struct PropertyValue;
      45             : } } } }
      46             : 
      47             : namespace com { namespace sun { namespace star { namespace io {
      48             :     class XInputStream;
      49             : } } } }
      50             : 
      51             : namespace com { namespace sun { namespace star { namespace sdbc {
      52             :     class XRow;
      53             : } } } }
      54             : 
      55             : namespace com { namespace sun { namespace star { namespace ucb {
      56             :     struct OpenCommandArgument3;
      57             :     struct PostCommandArgument2;
      58             :     struct PropertyCommandArgument;
      59             :     struct TransferInfo;
      60             : } } } }
      61             : 
      62             : namespace webdav_ucp
      63             : {
      64             : 
      65             : 
      66             : 
      67             : // UNO service name for the content.
      68             : #define WEBDAV_CONTENT_SERVICE_NAME "com.sun.star.ucb.WebDAVContent"
      69             : 
      70             : 
      71             : 
      72             : class ContentProvider;
      73             : class ContentProperties;
      74             : class CachableContentProperties;
      75             : 
      76             : class Content : public ::ucbhelper::ContentImplHelper,
      77             :                 public com::sun::star::ucb::XContentCreator
      78             : {
      79             :     enum ResourceType
      80             :     {
      81             :         UNKNOWN,
      82             :         FTP,
      83             :         NON_DAV,
      84             :         DAV
      85             :     };
      86             : 
      87             :     std::auto_ptr< DAVResourceAccess > m_xResAccess;
      88             :     std::auto_ptr< CachableContentProperties >
      89             :                       m_xCachedProps; // locally cached props
      90             :     OUString     m_aEscapedTitle;
      91             :     ResourceType      m_eResourceType;
      92             :     ContentProvider*  m_pProvider; // No need for a ref, base class holds object
      93             :     bool              m_bTransient;
      94             :     bool              m_bCollection;
      95             :     bool              m_bDidGetOrHead;
      96             :     std::vector< OUString > m_aFailedPropNames;
      97             : 
      98             : private:
      99             :     virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
     100             :     getProperties( const com::sun::star::uno::Reference<
     101             :                        com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
     102             :     virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
     103             :     getCommands( const com::sun::star::uno::Reference<
     104             :                      com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
     105             :     virtual OUString getParentURL() SAL_OVERRIDE;
     106             : 
     107             :     sal_Bool isFolder( const ::com::sun::star::uno::Reference<
     108             :                            ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
     109             :         throw ( ::com::sun::star::uno::Exception );
     110             : 
     111             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
     112             :     getPropertyValues( const ::com::sun::star::uno::Sequence<
     113             :                            ::com::sun::star::beans::Property >& rProperties,
     114             :                        const ::com::sun::star::uno::Reference<
     115             :                            ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
     116             :         throw ( ::com::sun::star::uno::Exception );
     117             : 
     118             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
     119             :     setPropertyValues( const ::com::sun::star::uno::Sequence<
     120             :                            ::com::sun::star::beans::PropertyValue >& rValues,
     121             :                        const ::com::sun::star::uno::Reference<
     122             :                            ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
     123             :         throw ( ::com::sun::star::uno::Exception );
     124             : 
     125             :     typedef rtl::Reference< Content > ContentRef;
     126             :     typedef std::list< ContentRef > ContentRefList;
     127             :     void queryChildren( ContentRefList& rChildren);
     128             : 
     129             :     sal_Bool
     130             :     exchangeIdentity( const ::com::sun::star::uno::Reference<
     131             :                           ::com::sun::star::ucb::XContentIdentifier >& xNewId );
     132             : 
     133             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     134             :     const OUString
     135             :     getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess );
     136             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     137             : 
     138             :     ResourceType
     139             :     getResourceType( const ::com::sun::star::uno::Reference<
     140             :                          ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
     141             :         throw ( ::com::sun::star::uno::Exception );
     142             : 
     143             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     144             :     ResourceType
     145             :     getResourceType( const ::com::sun::star::uno::Reference<
     146             :                           ::com::sun::star::ucb::XCommandEnvironment >& xEnv,
     147             :                      const std::auto_ptr< DAVResourceAccess > & rResAccess,
     148             :                      bool * networkAccessAllowed = 0)
     149             :         throw ( ::com::sun::star::uno::Exception );
     150             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     151             : 
     152             :     // Command "open"
     153             :     com::sun::star::uno::Any open(
     154             :                 const com::sun::star::ucb::OpenCommandArgument3 & rArg,
     155             :                 const com::sun::star::uno::Reference<
     156             :                     com::sun::star::ucb::XCommandEnvironment > & xEnv )
     157             :         throw( ::com::sun::star::uno::Exception );
     158             : 
     159             :     // Command "post"
     160             :     void post( const com::sun::star::ucb::PostCommandArgument2 & rArg,
     161             :                const com::sun::star::uno::Reference<
     162             :                     com::sun::star::ucb::XCommandEnvironment > & xEnv )
     163             :         throw( ::com::sun::star::uno::Exception );
     164             : 
     165             :     // Command "insert"
     166             :     void insert( const ::com::sun::star::uno::Reference<
     167             :                      ::com::sun::star::io::XInputStream > & xInputStream,
     168             :                  sal_Bool bReplaceExisting,
     169             :                  const com::sun::star::uno::Reference<
     170             :                      com::sun::star::ucb::XCommandEnvironment >& Environment )
     171             :         throw( ::com::sun::star::uno::Exception );
     172             : 
     173             :     // Command "transfer"
     174             :     void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
     175             :                    const com::sun::star::uno::Reference<
     176             :                        com::sun::star::ucb::XCommandEnvironment >& Environment )
     177             :         throw( ::com::sun::star::uno::Exception );
     178             : 
     179             :     // Command "delete"
     180             :     void destroy( sal_Bool bDeletePhysical )
     181             :         throw( ::com::sun::star::uno::Exception );
     182             : 
     183             :     // Command "lock"
     184             :     void lock( const com::sun::star::uno::Reference<
     185             :                   com::sun::star::ucb::XCommandEnvironment >& Environment )
     186             :         throw( ::com::sun::star::uno::Exception );
     187             : 
     188             :     // Command "unlock"
     189             :     void unlock( const com::sun::star::uno::Reference<
     190             :                   com::sun::star::ucb::XCommandEnvironment >& Environment )
     191             :         throw( ::com::sun::star::uno::Exception );
     192             : 
     193             :     ::com::sun::star::uno::Any MapDAVException( const DAVException & e,
     194             :                                                 sal_Bool bWrite );
     195             :     void cancelCommandExecution(
     196             :                     const DAVException & e,
     197             :                     const ::com::sun::star::uno::Reference<
     198             :                         com::sun::star::ucb::XCommandEnvironment > & xEnv,
     199             :                     sal_Bool bWrite = sal_False )
     200             :         throw( ::com::sun::star::uno::Exception );
     201             : 
     202             :     static bool shouldAccessNetworkAfterException( const DAVException & e );
     203             : 
     204             :     bool supportsExclusiveWriteLock(
     205             :         const com::sun::star::uno::Reference<
     206             :             com::sun::star::ucb::XCommandEnvironment >& Environment );
     207             : 
     208             :     void addProperty( const com::sun::star::ucb::PropertyCommandArgument &aCmdArg,
     209             :                       const com::sun::star::uno::Reference<
     210             :                       com::sun::star::ucb::XCommandEnvironment >& Environment )
     211             :     throw( com::sun::star::beans::PropertyExistException,
     212             :            com::sun::star::beans::IllegalTypeException,
     213             :            com::sun::star::lang::IllegalArgumentException,
     214             :            com::sun::star::uno::RuntimeException );
     215             : 
     216             :     void removeProperty( const OUString& Name,
     217             :                          const com::sun::star::uno::Reference<
     218             :                          com::sun::star::ucb::XCommandEnvironment >& Environment )
     219             :     throw( com::sun::star::beans::UnknownPropertyException,
     220             :            com::sun::star::beans::NotRemoveableException,
     221             :            com::sun::star::uno::RuntimeException );
     222             : 
     223             : public:
     224             :     Content( const ::com::sun::star::uno::Reference<
     225             :                  ::com::sun::star::uno::XComponentContext >& rxContext,
     226             :              ContentProvider* pProvider,
     227             :              const ::com::sun::star::uno::Reference<
     228             :                  ::com::sun::star::ucb::XContentIdentifier >& Identifier,
     229             :              rtl::Reference< DAVSessionFactory > const & rSessionFactory )
     230             :         throw ( ::com::sun::star::ucb::ContentCreationException );
     231             :     Content( const ::com::sun::star::uno::Reference<
     232             :                  ::com::sun::star::uno::XComponentContext >& rxContext,
     233             :              ContentProvider* pProvider,
     234             :              const ::com::sun::star::uno::Reference<
     235             :                  ::com::sun::star::ucb::XContentIdentifier >& Identifier,
     236             :              rtl::Reference< DAVSessionFactory > const & rSessionFactory,
     237             :              sal_Bool isCollection )
     238             :         throw ( ::com::sun::star::ucb::ContentCreationException );
     239             :     virtual ~Content();
     240             : 
     241             :     // XInterface
     242             :     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
     243             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     244             :     virtual void SAL_CALL acquire()
     245             :         throw() SAL_OVERRIDE;
     246             :     virtual void SAL_CALL release()
     247             :         throw() SAL_OVERRIDE;
     248             : 
     249             :     // XTypeProvider
     250             :     virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
     251             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     252             :     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
     253             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     254             : 
     255             :     // XServiceInfo
     256             :     virtual OUString SAL_CALL
     257             :     getImplementationName()
     258             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     259             : 
     260             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
     261             :     getSupportedServiceNames()
     262             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     263             : 
     264             :     // XContent
     265             :     virtual OUString SAL_CALL
     266             :     getContentType()
     267             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     268             : 
     269             :     // XCommandProcessor
     270             :     virtual com::sun::star::uno::Any SAL_CALL
     271             :     execute( const com::sun::star::ucb::Command& aCommand,
     272             :              sal_Int32 CommandId,
     273             :              const com::sun::star::uno::Reference<
     274             :                  com::sun::star::ucb::XCommandEnvironment >& Environment )
     275             :         throw( com::sun::star::uno::Exception,
     276             :                com::sun::star::ucb::CommandAbortedException,
     277             :                com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     278             :     virtual void SAL_CALL
     279             :     abort( sal_Int32 CommandId )
     280             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     281             : 
     282             :     // XPropertyContainer
     283             :     virtual void SAL_CALL
     284             :     addProperty( const OUString& Name,
     285             :                  sal_Int16 Attributes,
     286             :                  const com::sun::star::uno::Any& DefaultValue )
     287             :         throw( com::sun::star::beans::PropertyExistException,
     288             :                com::sun::star::beans::IllegalTypeException,
     289             :                com::sun::star::lang::IllegalArgumentException,
     290             :                com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     291             : 
     292             :     virtual void SAL_CALL
     293             :     removeProperty( const OUString& Name )
     294             :         throw( com::sun::star::beans::UnknownPropertyException,
     295             :                com::sun::star::beans::NotRemoveableException,
     296             :                com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     297             : 
     298             : 
     299             :     // Additional interfaces
     300             : 
     301             : 
     302             :     // XContentCreator
     303             :     virtual com::sun::star::uno::Sequence<
     304             :         com::sun::star::ucb::ContentInfo > SAL_CALL
     305             :    queryCreatableContentsInfo()
     306             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     307             :     virtual com::sun::star::uno::Reference<
     308             :         com::sun::star::ucb::XContent > SAL_CALL
     309             :     createNewContent( const com::sun::star::ucb::ContentInfo& Info )
     310             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     311             : 
     312             : 
     313             :     // Non-interface methods.
     314             : 
     315             : 
     316           0 :     DAVResourceAccess & getResourceAccess() { return *m_xResAccess; }
     317             : 
     318             :     // Called from resultset data supplier.
     319             :     static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
     320             :     getPropertyValues( const ::com::sun::star::uno::Reference<
     321             :                            ::com::sun::star::uno::XComponentContext >& rxContext,
     322             :                        const ::com::sun::star::uno::Sequence<
     323             :                            ::com::sun::star::beans::Property >& rProperties,
     324             :                        const ContentProperties& rData,
     325             :                        const rtl::Reference<
     326             :                            ::ucbhelper::ContentProviderImplHelper >& rProvider,
     327             :                        const OUString& rContentId );
     328             : };
     329             : 
     330             : }
     331             : 
     332             : #endif
     333             : 
     334             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10