Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / evoab / LDriver.hxx
blobb3c5df824d360977a8ac736d5986f25964dc2eb0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: LDriver.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CONNECTIVITY_EVOAB_LDRIVER_HXX_
32 #define _CONNECTIVITY_EVOAB_LDRIVER_HXX_
34 #include <cppuhelper/compbase2.hxx>
35 #include "connectivity/CommonTools.hxx"
36 #include "file/FDriver.hxx"
37 #include <unotools/tempfile.hxx>
38 #include <osl/file.h>
39 #include <osl/process.h>
41 #define EVOAB_EVOLUTION_SCHEMA "evolution"
42 #define EVOAB_LDAP_SCHEMA "ldap"
43 #define EVOAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.evoab.OEvoabDriver"
45 namespace connectivity
47 namespace evoab
50 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
52 class OEvoabDriver : public file::OFileDriver
54 private:
55 enum MaybeVoidBool
57 eUnknown,
58 eTrue,
59 eFalse
61 ::utl::TempFile m_aTempDir;
62 rtl::OUString m_aFolderListName;
63 rtl::OUString m_aVersionName;
64 rtl::OUString m_aFileExt;
65 rtl::OUString m_aWorkingDirURL;
66 rtl::OUString m_aEvoab_CLI_EffectiveCommand;
67 rtl::OUString m_aEvoab_CLI_FullPathCommand;
68 sal_Bool m_bWorkingDirCreated;
69 MaybeVoidBool m_eSupportedEvoVersion;
71 sal_Bool fileExists(const ::rtl::OUString& _rURL, sal_Bool _bIsDir=sal_False) const;
73 public:
74 OEvoabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
76 inline rtl::OUString getEvoFolderListName() const { return m_aFolderListName;}
77 inline rtl::OUString getFileExt() const { return m_aFileExt;}
78 inline rtl::OUString getEvoFolderListFileName() const { return m_aFolderListName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;}
79 inline rtl::OUString getEvoVersionFileName() const { return m_aVersionName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;}
80 inline rtl::OUString getWorkingDirURL() const { return m_aWorkingDirURL;}
81 inline rtl::OUString getEvoab_CLI_FullPathCommand() const { return m_aEvoab_CLI_FullPathCommand;}
82 inline rtl::OUString getEvoab_CLI_EffectiveCommand() const { return m_aEvoab_CLI_EffectiveCommand;}
83 inline sal_Bool doesEvoab_CLI_HavePath() const { return m_aEvoab_CLI_FullPathCommand.lastIndexOf('/')!=-1;}
84 const rtl::OUString getEvoab_CLI_Command() const;
85 const rtl::OUString getEvoab_CLI_Path() const;
86 const rtl::OUString getWorkingDirPath() const;
87 const String getEvoFolderListFileURL() const;
88 String getTempDirURL() const;
90 // XInterface
91 ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
92 // XDriver
93 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
94 virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
95 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
98 // static methods
99 static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
100 static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url );
101 static ::rtl::OUString translateProcessErrorMessage( oslProcessError nProcErr);
102 static ::rtl::OUString translateFileErrorMessage( oslFileError nFileErr);
103 static const sal_Char* getSDBC_SCHEME_EVOLUTION();
104 static const sal_Char* getEVOAB_FOLDERLIST_FILE_NAME();
105 static const sal_Char* getEVOAB_VERSION_FILE_NAME();
106 static const sal_Char* getEVOAB_META_FILE_EXT();
107 static const sal_Char* getEVOAB_CLI_FULLPATHCOMMAND();
108 static const sal_Char* getEVOAB_CLI_ARG_LIST_FOLDERS();
109 static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX();
110 static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FORMAT();
111 static const sal_Char* getEVOAB_CLI_ARG_VERSION();
112 static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_REDIRECT();
118 #endif //_CONNECTIVITY_EVOAB_LDRIVER_HXX_