1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _DAVSESSIONFACTORY_HXX_
24 #define _DAVSESSIONFACTORY_HXX_
25 
26 #ifdef min
27 #undef min // GNU libstdc++ <memory> includes <limit> which defines methods called min...
28 #endif
29 #include <map>
30 #include <memory>
31 #include <osl/mutex.hxx>
32 #include <salhelper/simplereferenceobject.hxx>
33 #include <rtl/ref.hxx>
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <ucbhelper/proxydecider.hxx>
36 #include "DAVException.hxx"
37 
38 using namespace com::sun::star;
39 
40 namespace com { namespace sun { namespace star { namespace lang {
41 	class XMultiServiceFactory;
42 } } } }
43 
44 namespace http_dav_ucp
45 {
46 
47 class DAVSession;
48 
49 class DAVSessionFactory : public salhelper::SimpleReferenceObject
50 {
51 public:
52     ~DAVSessionFactory() SAL_THROW(());
53 
54     rtl::Reference< DAVSession >
55 		createDAVSession( const ::rtl::OUString & inUri,
56 						  const ::com::sun::star::uno::Reference<
57 	   						::com::sun::star::lang::XMultiServiceFactory >&
58                                 rxSMgr )
59             throw( DAVException );
60 
getServiceFactory()61     ::uno::Reference< ::lang::XMultiServiceFactory > getServiceFactory() {	return m_xMSF; }
62 private:
63     typedef std::map< rtl::OUString, DAVSession * > Map;
64 
65     Map m_aMap;
66     osl::Mutex m_aMutex;
67     std::auto_ptr< ucbhelper::InternetProxyDecider > m_xProxyDecider;
68 
69     ::uno::Reference< ::lang::XMultiServiceFactory > m_xMSF;
70 
71     void releaseElement( DAVSession * pElement ) SAL_THROW(());
72 
73     friend class DAVSession;
74 };
75 
76 } // namespace http_dav_ucp
77 
78 #endif // _DAVSESSIONFACTORY_HXX_
79