1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _DAVSESSIONFACTORY_HXX_
28 #define _DAVSESSIONFACTORY_HXX_
29 
30 #ifdef min
31 #undef min // GNU libstdc++ <memory> includes <limit> which defines methods called min...
32 #endif
33 #include <map>
34 #include <memory>
35 #include <osl/mutex.hxx>
36 #include <salhelper/simplereferenceobject.hxx>
37 #include <rtl/ref.hxx>
38 #include <com/sun/star/uno/Reference.hxx>
39 #include <ucbhelper/proxydecider.hxx>
40 #include "DAVException.hxx"
41 
42 using namespace com::sun::star;
43 
44 namespace com { namespace sun { namespace star { namespace lang {
45 	class XMultiServiceFactory;
46 } } } }
47 
48 namespace webdav_ucp
49 {
50 
51 class DAVSession;
52 
53 class DAVSessionFactory : public salhelper::SimpleReferenceObject
54 {
55 public:
56     ~DAVSessionFactory() SAL_THROW(());
57 
58     rtl::Reference< DAVSession >
59 		createDAVSession( const ::rtl::OUString & inUri,
60 						  const ::com::sun::star::uno::Reference<
61 	   						::com::sun::star::lang::XMultiServiceFactory >&
62                                 rxSMgr )
63             throw( DAVException );
64 
65     ::uno::Reference< ::lang::XMultiServiceFactory > getServiceFactory() {	return m_xMSF; }
66 private:
67     typedef std::map< rtl::OUString, DAVSession * > Map;
68 
69     Map m_aMap;
70     osl::Mutex m_aMutex;
71     std::auto_ptr< ucbhelper::InternetProxyDecider > m_xProxyDecider;
72 
73     ::uno::Reference< ::lang::XMultiServiceFactory > m_xMSF;
74 
75     void releaseElement( DAVSession * pElement ) SAL_THROW(());
76 
77     friend class DAVSession;
78 };
79 
80 } // namespace webdav_ucp
81 
82 #endif // _DAVSESSIONFACTORY_HXX_
83