Line data Source code
1 : /* libcmis
2 : * Version: MPL 1.1 / GPLv2+ / LGPLv2+
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License or as specified alternatively below. You may obtain a copy of
7 : * the License at http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * Major Contributor(s):
15 : * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
16 : *
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24 : * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25 : * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26 : * instead of those above.
27 : */
28 : #ifndef _SESSION_HXX_
29 : #define _SESSION_HXX_
30 :
31 : #include <string>
32 : #include <boost/shared_ptr.hpp>
33 :
34 : #include "object-type.hxx"
35 : #include "object.hxx"
36 : #include "folder.hxx"
37 : #include "repository.hxx"
38 :
39 : namespace libcmis
40 : {
41 0 : class AuthProvider
42 : {
43 : public:
44 0 : virtual ~AuthProvider() { };
45 :
46 : /** The function implementing it needs to fill the username and password parameters
47 : and return true. Returning false means that the user cancelled the authentication
48 : and will fail the query.
49 : */
50 : virtual bool authenticationQuery( std::string& username, std::string& password ) = 0;
51 : };
52 : typedef ::boost::shared_ptr< AuthProvider > AuthProviderPtr;
53 :
54 : class Session
55 : {
56 : public:
57 :
58 0 : virtual ~Session() { };
59 :
60 : /** Get the current repository.
61 : */
62 : virtual RepositoryPtr getRepository( ) throw ( Exception ) = 0;
63 :
64 : /** Get the Root folder of the repository
65 : */
66 : virtual FolderPtr getRootFolder() throw ( Exception )= 0;
67 :
68 : /** Get a CMIS object from its ID.
69 : */
70 : virtual ObjectPtr getObject( std::string id ) throw ( Exception ) = 0;
71 :
72 : /** Get a CMIS object from one of its path.
73 : */
74 : virtual ObjectPtr getObjectByPath( std::string path ) throw ( Exception ) = 0;
75 :
76 : /** Get a CMIS folder from its ID.
77 : */
78 : virtual libcmis::FolderPtr getFolder( std::string id ) throw ( Exception ) = 0;
79 :
80 : /** Get a CMIS object type from its ID.
81 : */
82 : virtual ObjectTypePtr getType( std::string id ) throw ( Exception ) = 0;
83 :
84 : /** Set an authentication provider for providing authentication interactively.
85 : */
86 : virtual void setAuthenticationProvider( AuthProviderPtr provider ) = 0;
87 : };
88 : }
89 :
90 : #endif
|