Blame SOURCES/0001-munge-cmis-headers-to-remove-exception-specs.patch

eac0b7
From 9300cfc3cab41e0ba50eb515792286932dbcbe1e Mon Sep 17 00:00:00 2001
eac0b7
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
eac0b7
Date: Mon, 26 Oct 2020 19:41:16 +0000
eac0b7
Subject: [PATCH] munge cmis headers to remove exception specs
eac0b7
eac0b7
Change-Id: Ieea3838f4acbaabd8ee5c219a69967889292a5ca
eac0b7
---
eac0b7
 include/libcmis/allowable-actions.hxx | 130 +++++++++++++++
eac0b7
 include/libcmis/document.hxx          | 146 +++++++++++++++++
eac0b7
 include/libcmis/exception.hxx         |  60 +++++++
eac0b7
 include/libcmis/folder.hxx            |  83 ++++++++++
eac0b7
 include/libcmis/libcmis.hxx           |  47 ++++++
eac0b7
 include/libcmis/oauth2-data.hxx       |  76 +++++++++
eac0b7
 include/libcmis/object-type.hxx       | 143 +++++++++++++++++
eac0b7
 include/libcmis/object.hxx            | 217 ++++++++++++++++++++++++++
eac0b7
 include/libcmis/property-type.hxx     | 125 +++++++++++++++
eac0b7
 include/libcmis/property.hxx          |  88 +++++++++++
eac0b7
 include/libcmis/rendition.hxx         |  88 +++++++++++
eac0b7
 include/libcmis/repository.hxx        | 117 ++++++++++++++
eac0b7
 include/libcmis/session-factory.hxx   | 149 ++++++++++++++++++
eac0b7
 include/libcmis/session.hxx           | 100 ++++++++++++
eac0b7
 include/libcmis/xml-utils.hxx         | 167 ++++++++++++++++++++
eac0b7
 include/libcmis/xmlserializable.hxx   |  46 ++++++
eac0b7
 16 files changed, 1782 insertions(+)
eac0b7
 create mode 100644 include/libcmis/allowable-actions.hxx
eac0b7
 create mode 100644 include/libcmis/document.hxx
eac0b7
 create mode 100644 include/libcmis/exception.hxx
eac0b7
 create mode 100644 include/libcmis/folder.hxx
eac0b7
 create mode 100644 include/libcmis/libcmis.hxx
eac0b7
 create mode 100644 include/libcmis/oauth2-data.hxx
eac0b7
 create mode 100644 include/libcmis/object-type.hxx
eac0b7
 create mode 100644 include/libcmis/object.hxx
eac0b7
 create mode 100644 include/libcmis/property-type.hxx
eac0b7
 create mode 100644 include/libcmis/property.hxx
eac0b7
 create mode 100644 include/libcmis/rendition.hxx
eac0b7
 create mode 100644 include/libcmis/repository.hxx
eac0b7
 create mode 100644 include/libcmis/session-factory.hxx
eac0b7
 create mode 100644 include/libcmis/session.hxx
eac0b7
 create mode 100644 include/libcmis/xml-utils.hxx
eac0b7
 create mode 100644 include/libcmis/xmlserializable.hxx
eac0b7
eac0b7
diff --git a/include/libcmis/allowable-actions.hxx b/include/libcmis/allowable-actions.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..24998761d10f
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/allowable-actions.hxx
eac0b7
@@ -0,0 +1,130 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _ALLOWABLE_ACTIONS_HXX_
eac0b7
+#define _ALLOWABLE_ACTIONS_HXX_
eac0b7
+
eac0b7
+#include <map>
eac0b7
+#include <string>
eac0b7
+
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Object;
eac0b7
+
eac0b7
+    class ObjectAction
eac0b7
+    {
eac0b7
+        public:
eac0b7
+            enum Type
eac0b7
+            {
eac0b7
+                DeleteObject,
eac0b7
+                UpdateProperties,
eac0b7
+                GetFolderTree,
eac0b7
+                GetProperties,
eac0b7
+                GetObjectRelationships,
eac0b7
+                GetObjectParents,
eac0b7
+                GetFolderParent,
eac0b7
+                GetDescendants,
eac0b7
+                MoveObject,
eac0b7
+                DeleteContentStream,
eac0b7
+                CheckOut,
eac0b7
+                CancelCheckOut,
eac0b7
+                CheckIn,
eac0b7
+                SetContentStream,
eac0b7
+                GetAllVersions,
eac0b7
+                AddObjectToFolder,
eac0b7
+                RemoveObjectFromFolder,
eac0b7
+                GetContentStream,
eac0b7
+                ApplyPolicy,
eac0b7
+                GetAppliedPolicies,
eac0b7
+                RemovePolicy,
eac0b7
+                GetChildren,
eac0b7
+                CreateDocument,
eac0b7
+                CreateFolder,
eac0b7
+                CreateRelationship,
eac0b7
+                DeleteTree,
eac0b7
+                GetRenditions,
eac0b7
+                GetACL,
eac0b7
+                ApplyACL
eac0b7
+            };
eac0b7
+
eac0b7
+        private:
eac0b7
+            Type m_type;
eac0b7
+            bool m_enabled;
eac0b7
+            bool m_valid;
eac0b7
+
eac0b7
+        public:
eac0b7
+            ObjectAction( xmlNodePtr node );
eac0b7
+            virtual ~ObjectAction( ){ }
eac0b7
+
eac0b7
+            Type getType( ) { return m_type; }
eac0b7
+            bool isEnabled( ) { return m_enabled; }
eac0b7
+            bool isValid( ) { return m_valid; }
eac0b7
+
eac0b7
+            /** Parses the permission name into one of the enum values or throws
eac0b7
+                an exception for invalid input strings.
eac0b7
+              */
eac0b7
+            static Type parseType( std::string type );
eac0b7
+
eac0b7
+    };
eac0b7
+
eac0b7
+    /** Class providing access to the allowed actions on an object.
eac0b7
+      */
eac0b7
+    class AllowableActions
eac0b7
+    {
eac0b7
+        protected:
eac0b7
+            std::map< ObjectAction::Type, bool > m_states;
eac0b7
+
eac0b7
+        public:
eac0b7
+            /** Default constructor for testing purpose
eac0b7
+              */
eac0b7
+            AllowableActions( );
eac0b7
+            AllowableActions( xmlNodePtr node );
eac0b7
+            AllowableActions( const AllowableActions& copy );
eac0b7
+            virtual ~AllowableActions( );
eac0b7
+
eac0b7
+            AllowableActions& operator=( const AllowableActions& copy );
eac0b7
+
eac0b7
+            /** Returns the permissions for the corresponding actions.
eac0b7
+              */
eac0b7
+            bool isAllowed( ObjectAction::Type action );
eac0b7
+
eac0b7
+            /** Returns true if the action was defined, false if the default
eac0b7
+                value is used.
eac0b7
+              */
eac0b7
+            bool isDefined( ObjectAction::Type action );
eac0b7
+
eac0b7
+            std::string toString( );
eac0b7
+    };
eac0b7
+    typedef boost::shared_ptr< AllowableActions > AllowableActionsPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/document.hxx b/include/libcmis/document.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..ce123b081efb
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/document.hxx
eac0b7
@@ -0,0 +1,146 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _DOCUMENT_HXX_
eac0b7
+#define _DOCUMENT_HXX_
eac0b7
+
eac0b7
+#include <iostream>
eac0b7
+#include <string>
eac0b7
+#include <vector>
eac0b7
+
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+#include "object.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Folder;
eac0b7
+    class Session;
eac0b7
+
eac0b7
+    /** Interface for a CMIS Document object.
eac0b7
+      */
eac0b7
+    class Document : public virtual Object
eac0b7
+    {
eac0b7
+        public:
eac0b7
+            Document( Session* session ) : Object( session ) { }
eac0b7
+            virtual ~Document( ) { }
eac0b7
+
eac0b7
+            /** Get the folder parents for the document.
eac0b7
+
eac0b7
+                Note that an unfiled document will have no parent folder.
eac0b7
+
eac0b7
+                @return the parents folder if any.
eac0b7
+              */
eac0b7
+            virtual std::vector< boost::shared_ptr< Folder > > getParents( ) = 0;
eac0b7
+            
eac0b7
+            /** Get the content stream without using a temporary file.
eac0b7
+
eac0b7
+                

The stream may not contain anything if there is

eac0b7
+                no content or if something wrong happened during the
eac0b7
+                download.

eac0b7
+
eac0b7
+                @param streamId of the rendition
eac0b7
+                @return
eac0b7
+                    An input stream to read the data from.
eac0b7
+
eac0b7
+                @throws Exception
eac0b7
+                    if anything wrong happened during the file transfer.
eac0b7
+                    In such a case, the content of the stream can't be
eac0b7
+                    guaranteed.
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< std::istream > getContentStream( std::string streamId = std::string( ) ) 
eac0b7
+                        = 0;
eac0b7
+
eac0b7
+            /** Set or replace the content stream of the document.
eac0b7
+
eac0b7
+                @param is the output stream containing the new data for the content stream
eac0b7
+                @param contentType the mime-type of the new content stream
eac0b7
+                @param filename the filename to set for the file
eac0b7
+                @param overwrite if set to false, don't overwrite the content stream if one is already set.
eac0b7
+
eac0b7
+                @throw Exception if anything happens during the upload like a wrong authentication, 
eac0b7
+                                no rights to set the stream, server doesn't have the ContentStreamUpdatability
eac0b7
+                                capability.
eac0b7
+              */
eac0b7
+            virtual void setContentStream( boost::shared_ptr< std::ostream > os, std::string contentType,
eac0b7
+                                           std::string filename, bool overwrite = true ) = 0;
eac0b7
+
eac0b7
+            /** Get the content mime type.
eac0b7
+              */
eac0b7
+            virtual std::string getContentType( );
eac0b7
+            
eac0b7
+            /** Get the content stream filename.
eac0b7
+              */
eac0b7
+            virtual std::string getContentFilename( );
eac0b7
+
eac0b7
+            /** Get the content length in bytes.
eac0b7
+              */
eac0b7
+            virtual long getContentLength( );
eac0b7
+
eac0b7
+            /** Checks out the document and returns the object corresponding to the 
eac0b7
+                created Private Working Copy.
eac0b7
+
eac0b7
+                \return the Private Working Copy document
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< Document > checkOut( ) = 0;
eac0b7
+
eac0b7
+            /** Cancels the checkout if the document is a private working copy, or
eac0b7
+                throws an exception.
eac0b7
+              */
eac0b7
+            virtual void cancelCheckout( ) = 0;
eac0b7
+
eac0b7
+            /** Check in the private working copy and create a new version or throw
eac0b7
+                an exception.
eac0b7
+
eac0b7
+                The current object will be updated to reflect the changes performed
eac0b7
+                on the server side.
eac0b7
+
eac0b7
+                \param isMajor defines it the version to create is a major or minor one
eac0b7
+                \param comment contains the checkin comment
eac0b7
+                \param properties the properties to set the new version
eac0b7
+                \param stream the content stream to set for the new version
eac0b7
+                \param contentType the mime type of the stream to set
eac0b7
+
eac0b7
+                \return the document with the new version
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< Document > checkIn( bool isMajor, std::string comment,
eac0b7
+                                  const std::map< std::string, PropertyPtr >& properties,
eac0b7
+                                  boost::shared_ptr< std::ostream > stream,
eac0b7
+                                  std::string contentType, std::string fileName ) = 0;
eac0b7
+
eac0b7
+            virtual std::vector< boost::shared_ptr< Document > > getAllVersions( ) = 0;
eac0b7
+
eac0b7
+            // virtual methods form Object
eac0b7
+            virtual std::vector< std::string > getPaths( );
eac0b7
+
eac0b7
+            virtual std::string toString( );
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< Document > DocumentPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/exception.hxx b/include/libcmis/exception.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..16f3573da2b1
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/exception.hxx
eac0b7
@@ -0,0 +1,60 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _EXCEPTION_HXX_
eac0b7
+#define _EXCEPTION_HXX_
eac0b7
+
eac0b7
+#include <exception>
eac0b7
+#include <string>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Exception : public std::exception
eac0b7
+    {
eac0b7
+        private:
eac0b7
+            std::string m_message;
eac0b7
+            std::string m_type;
eac0b7
+
eac0b7
+        public:
eac0b7
+            Exception( std::string message, std::string type = "runtime" ) :
eac0b7
+                exception( ),
eac0b7
+                m_message( message ),
eac0b7
+                m_type( type )
eac0b7
+            {
eac0b7
+            }
eac0b7
+
eac0b7
+            ~Exception( ) throw () { }
eac0b7
+            virtual const char* what() const throw()
eac0b7
+            {
eac0b7
+                return m_message.c_str( );
eac0b7
+            }
eac0b7
+
eac0b7
+            std::string getType( ) const { return m_type; }
eac0b7
+    };
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/folder.hxx b/include/libcmis/folder.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..9f17e3883898
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/folder.hxx
eac0b7
@@ -0,0 +1,83 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _FOLDER_HXX_
eac0b7
+#define _FOLDER_HXX_
eac0b7
+
eac0b7
+#include <map>
eac0b7
+#include <string>
eac0b7
+#include <vector>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+#include "object.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Document;
eac0b7
+    class Session;
eac0b7
+    
eac0b7
+    struct UnfileObjects {
eac0b7
+        enum Type
eac0b7
+        {
eac0b7
+            Unfile,
eac0b7
+            DeleteSingleFiled,
eac0b7
+            Delete
eac0b7
+        };
eac0b7
+    };
eac0b7
+
eac0b7
+    /** Class representing a CMIS folder.
eac0b7
+      */
eac0b7
+    class Folder : public virtual Object
eac0b7
+    {
eac0b7
+        public:
eac0b7
+            Folder( Session* session ) : Object( session ) { }
eac0b7
+            virtual ~Folder() { }
eac0b7
+
eac0b7
+            virtual std::vector< std::string > getPaths( );
eac0b7
+
eac0b7
+            virtual ::boost::shared_ptr< Folder > getFolderParent( );
eac0b7
+            virtual std::vector< ObjectPtr > getChildren( ) = 0;
eac0b7
+            virtual std::string getParentId( );
eac0b7
+            virtual std::string getPath( );
eac0b7
+
eac0b7
+            virtual bool isRootFolder( );
eac0b7
+
eac0b7
+            virtual ::boost::shared_ptr< Folder > createFolder( const std::map< std::string, PropertyPtr >& properties )
eac0b7
+                = 0;
eac0b7
+            virtual ::boost::shared_ptr< Document > createDocument( const std::map< std::string, PropertyPtr >& properties,
eac0b7
+                                    boost::shared_ptr< std::ostream > os, std::string contentType, std::string fileName ) = 0;
eac0b7
+
eac0b7
+            virtual std::vector< std::string > removeTree( bool allVersion = true, UnfileObjects::Type unfile = UnfileObjects::Delete,
eac0b7
+                                    bool continueOnError = false ) = 0;
eac0b7
+        
eac0b7
+            virtual std::string toString( );
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< Folder > FolderPtr;
eac0b7
+
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/libcmis.hxx b/include/libcmis/libcmis.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..540e5af127f2
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/libcmis.hxx
eac0b7
@@ -0,0 +1,47 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _LIBCMIS_HXX_
eac0b7
+#define _LIBCMIS_HXX_
eac0b7
+
eac0b7
+#include "allowable-actions.hxx"
eac0b7
+#include "document.hxx"
eac0b7
+#include "exception.hxx"
eac0b7
+#include "folder.hxx"
eac0b7
+#include "oauth2-data.hxx"
eac0b7
+#include "object-type.hxx"
eac0b7
+#include "object.hxx"
eac0b7
+#include "property-type.hxx"
eac0b7
+#include "property.hxx"
eac0b7
+#include "rendition.hxx"
eac0b7
+#include "repository.hxx"
eac0b7
+#include "session-factory.hxx"
eac0b7
+#include "session.hxx"
eac0b7
+#include "xml-utils.hxx"
eac0b7
+#include "xmlserializable.hxx"
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/oauth2-data.hxx b/include/libcmis/oauth2-data.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..000f9394b034
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/oauth2-data.hxx
eac0b7
@@ -0,0 +1,76 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _LIBCMIS_OAUTH2_DATA_HXX_
eac0b7
+#define _LIBCMIS_OAUTH2_DATA_HXX_
eac0b7
+
eac0b7
+#include <string>
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    /** Class storing the data needed for OAuth2 authentication.
eac0b7
+      */
eac0b7
+    class OAuth2Data
eac0b7
+    {
eac0b7
+        private:
eac0b7
+
eac0b7
+            std::string m_authUrl;
eac0b7
+            std::string m_tokenUrl;
eac0b7
+            std::string m_clientId;
eac0b7
+            std::string m_clientSecret;
eac0b7
+            std::string m_scope;
eac0b7
+            std::string m_redirectUri;
eac0b7
+        public:
eac0b7
+
eac0b7
+            OAuth2Data( );
eac0b7
+            OAuth2Data( const std::string& authUrl, 
eac0b7
+                        const std::string& tokenUrl,
eac0b7
+                        const std::string& scope, 
eac0b7
+                        const std::string& redirectUri,
eac0b7
+                        const std::string& clientId, 
eac0b7
+                        const std::string& clientSecret );
eac0b7
+
eac0b7
+            OAuth2Data( const OAuth2Data& copy );
eac0b7
+            ~OAuth2Data( );
eac0b7
+
eac0b7
+            OAuth2Data& operator=( const OAuth2Data& copy );
eac0b7
+
eac0b7
+            bool isComplete();
eac0b7
+
eac0b7
+            const std::string& getAuthUrl() { return m_authUrl; }
eac0b7
+            const std::string& getTokenUrl() { return m_tokenUrl; }
eac0b7
+            const std::string& getClientId() { return m_clientId; }
eac0b7
+            const std::string& getClientSecret() { return m_clientSecret; }
eac0b7
+            const std::string& getScope() { return m_scope; }
eac0b7
+            const std::string& getRedirectUri() { return m_redirectUri; }
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< OAuth2Data > OAuth2DataPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif //_LIBCMIS_OAUTH2_DATA_HXX_
eac0b7
+
eac0b7
diff --git a/include/libcmis/object-type.hxx b/include/libcmis/object-type.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..a8576ec80f0b
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/object-type.hxx
eac0b7
@@ -0,0 +1,143 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _OBJECT_TYPE_HXX_
eac0b7
+#define _OBJECT_TYPE_HXX_
eac0b7
+
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+#include <string>
eac0b7
+#include <vector>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+#include "property-type.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    /** Class representing a CMIS object type definition.
eac0b7
+      */
eac0b7
+    class ObjectType
eac0b7
+    {
eac0b7
+        public:
eac0b7
+
eac0b7
+            enum ContentStreamAllowed
eac0b7
+            {
eac0b7
+                NotAllowed,
eac0b7
+                Allowed,
eac0b7
+                Required
eac0b7
+            };
eac0b7
+
eac0b7
+        protected:
eac0b7
+            time_t m_refreshTimestamp;
eac0b7
+
eac0b7
+            std::string m_id;
eac0b7
+            std::string m_localName;
eac0b7
+            std::string m_localNamespace;
eac0b7
+            std::string m_displayName;
eac0b7
+            std::string m_queryName;
eac0b7
+            std::string m_description;
eac0b7
+
eac0b7
+            std::string m_parentTypeId;
eac0b7
+            std::string m_baseTypeId;
eac0b7
+
eac0b7
+            bool m_creatable;
eac0b7
+            bool m_fileable;
eac0b7
+            bool m_queryable;
eac0b7
+            bool m_fulltextIndexed;
eac0b7
+            bool m_includedInSupertypeQuery;
eac0b7
+            bool m_controllablePolicy;
eac0b7
+            bool m_controllableAcl;
eac0b7
+            bool m_versionable;
eac0b7
+            libcmis::ObjectType::ContentStreamAllowed m_contentStreamAllowed;
eac0b7
+
eac0b7
+            std::map< std::string, libcmis::PropertyTypePtr > m_propertiesTypes;
eac0b7
+
eac0b7
+            ObjectType( );
eac0b7
+            void initializeFromNode( xmlNodePtr node );
eac0b7
+
eac0b7
+        public:
eac0b7
+
eac0b7
+            ObjectType( xmlNodePtr node );
eac0b7
+            ObjectType( const ObjectType& copy );
eac0b7
+            virtual ~ObjectType() { }
eac0b7
+
eac0b7
+            ObjectType& operator=( const ObjectType& copy );
eac0b7
+
eac0b7
+            /** Reload the data from the server.
eac0b7
+
eac0b7
+                \attention
eac0b7
+                    This method needs to be implemented in subclasses or it will
eac0b7
+                    do nothing
eac0b7
+             */
eac0b7
+            virtual void refresh( );
eac0b7
+            virtual time_t getRefreshTimestamp( ) const;
eac0b7
+
eac0b7
+            std::string getId( ) const;
eac0b7
+            std::string getLocalName( ) const;
eac0b7
+            std::string getLocalNamespace( ) const;
eac0b7
+            std::string getDisplayName( ) const;
eac0b7
+            std::string getQueryName( ) const;
eac0b7
+            std::string getDescription( ) const;
eac0b7
+
eac0b7
+            virtual boost::shared_ptr< ObjectType >  getParentType( );
eac0b7
+            virtual boost::shared_ptr< ObjectType >  getBaseType( );
eac0b7
+            virtual std::vector< boost::shared_ptr< ObjectType > > getChildren( );
eac0b7
+
eac0b7
+            /** Get the parent type id without extracting the complete parent type from
eac0b7
+                the repository. This is mainly provided for performance reasons.
eac0b7
+
eac0b7
+                \since libcmis 0.4
eac0b7
+              */
eac0b7
+            std::string getParentTypeId( ) const;
eac0b7
+
eac0b7
+            /** Get the base type id without extracting the complete base type from
eac0b7
+                the repository. This is mainly provided for performance reasons.
eac0b7
+
eac0b7
+                \since libcmis 0.4
eac0b7
+              */
eac0b7
+            std::string getBaseTypeId( ) const;
eac0b7
+
eac0b7
+            bool isCreatable( ) const;
eac0b7
+            bool isFileable( ) const;
eac0b7
+            bool isQueryable( ) const;
eac0b7
+            bool isFulltextIndexed( ) const;
eac0b7
+            bool isIncludedInSupertypeQuery( ) const;
eac0b7
+            bool isControllablePolicy( ) const;
eac0b7
+            bool isControllableACL( ) const;
eac0b7
+            bool isVersionable( ) const;
eac0b7
+            ContentStreamAllowed getContentStreamAllowed( ) const;
eac0b7
+
eac0b7
+            std::map< std::string, PropertyTypePtr >& getPropertiesTypes( );
eac0b7
+
eac0b7
+            virtual std::string toString( );
eac0b7
+    };
eac0b7
+
eac0b7
+    typedef ::boost::shared_ptr< ObjectType > ObjectTypePtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/object.hxx b/include/libcmis/object.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..fa8d465e7c3b
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/object.hxx
eac0b7
@@ -0,0 +1,217 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _OBJECT_HXX_
eac0b7
+#define _OBJECT_HXX_
eac0b7
+
eac0b7
+#include <ctime>
eac0b7
+#include <map>
eac0b7
+#include <string>
eac0b7
+#include <vector>
eac0b7
+
eac0b7
+#ifndef __cplusplus
eac0b7
+#include <stdbool.h>
eac0b7
+#endif
eac0b7
+
eac0b7
+#include <boost/date_time.hpp>
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+#include "allowable-actions.hxx"
eac0b7
+#include "exception.hxx"
eac0b7
+#include "object-type.hxx"
eac0b7
+#include "property.hxx"
eac0b7
+#include "xmlserializable.hxx"
eac0b7
+#include "rendition.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Folder;
eac0b7
+    class Session;
eac0b7
+
eac0b7
+    /** Class representing any CMIS object.
eac0b7
+      */
eac0b7
+    class Object : public XmlSerializable
eac0b7
+    {
eac0b7
+        protected:
eac0b7
+            Session* m_session;
eac0b7
+
eac0b7
+            ObjectTypePtr m_typeDescription;
eac0b7
+            time_t m_refreshTimestamp;
eac0b7
+
eac0b7
+            /** Type id used as cache before we get it as a property
eac0b7
+              */
eac0b7
+            std::string m_typeId;
eac0b7
+
eac0b7
+            std::map< std::string, PropertyPtr > m_properties;
eac0b7
+            boost::shared_ptr< AllowableActions > m_allowableActions;
eac0b7
+            std::vector< RenditionPtr > m_renditions;
eac0b7
+            void initializeFromNode( xmlNodePtr node );
eac0b7
+
eac0b7
+        public:
eac0b7
+
eac0b7
+            Object( Session* session );
eac0b7
+            Object( Session* session, xmlNodePtr node );
eac0b7
+            Object( const Object& copy );
eac0b7
+            virtual ~Object( ) { }
eac0b7
+
eac0b7
+            Object& operator=( const Object& copy );
eac0b7
+
eac0b7
+            virtual std::string getId( );
eac0b7
+            virtual std::string getName( );
eac0b7
+            virtual std::string getStringProperty( const std::string& propertyName );
eac0b7
+
eac0b7
+            /** Computes the paths for the objects.
eac0b7
+
eac0b7
+                Note that folders will have only path, documents may have
eac0b7
+                several ones and there may be cases where there is no path
eac0b7
+                at all (unfilled objects);
eac0b7
+              */
eac0b7
+            virtual std::vector< std::string > getPaths( );
eac0b7
+
eac0b7
+            virtual std::string getBaseType( );
eac0b7
+            virtual std::string getType( );
eac0b7
+
eac0b7
+            virtual std::string getCreatedBy( );
eac0b7
+            virtual boost::posix_time::ptime getCreationDate( );
eac0b7
+            virtual std::string getLastModifiedBy( );
eac0b7
+            virtual boost::posix_time::ptime getLastModificationDate( );
eac0b7
+
eac0b7
+            virtual std::string getChangeToken( );
eac0b7
+            virtual bool isImmutable( );
eac0b7
+
eac0b7
+            virtual std::vector< std::string > getSecondaryTypes();
eac0b7
+
eac0b7
+            /** Convenience function adding a secondary type to the object.
eac0b7
+
eac0b7
+                Behind the scene this function is basically computing the
eac0b7
+                properties and sets them for you to avoid reading the CMIS
eac0b7
+                1.1 specification, section 2.1.9.
eac0b7
+
eac0b7
+                \param id
eac0b7
+                    the identifier of the secondary type to add
eac0b7
+                \param properties
eac0b7
+                    the properties coming with the secondary type
eac0b7
+
eac0b7
+                \return
eac0b7
+                    the updated object. Note that it may represent the same
eac0b7
+                    object on the server but it still is a different object
eac0b7
+                    instance (see updateProperties method).
eac0b7
+
eac0b7
+                \throw Exception
eac0b7
+                    if anything wrong happens. Note that the server is likely
eac0b7
+                    to throw a constraint exception if it doesn't allow the
eac0b7
+                    operation.
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< Object > addSecondaryType(
eac0b7
+                                                        std::string id,
eac0b7
+                                                        PropertyPtrMap properties );
eac0b7
+
eac0b7
+            /** Convenience function removing a secondary type from the object.
eac0b7
+
eac0b7
+                Behind the scene this function is basically computing the
eac0b7
+                correct property and sets it for you to avoid reading the
eac0b7
+                CMIS 1.1 specification, section 2.1.9.
eac0b7
+
eac0b7
+                The server should remove the related properties, there is
eac0b7
+                normally no need to worry about them.
eac0b7
+
eac0b7
+                \param id
eac0b7
+                    the identifier of the secondary type to remove
eac0b7
+
eac0b7
+                \return
eac0b7
+                    the updated object. Note that it may represent the same
eac0b7
+                    object on the server but it still is a different object
eac0b7
+                    instance (see updateProperties method).
eac0b7
+
eac0b7
+                \throw Exception
eac0b7
+                    if anything wrong happens. Note that the server is likely
eac0b7
+                    to throw a constraint exception if it doesn't allow the
eac0b7
+                    operation.
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< Object > removeSecondaryType( std::string id );
eac0b7
+
eac0b7
+            /** Gives access to the properties of the object.
eac0b7
+
eac0b7
+                \attention
eac0b7
+                    API users should consider this method as read-only as the
eac0b7
+                    changed properties won't be updated to the server. Updating
eac0b7
+                    the returned map may lead to changes loss when calling
eac0b7
+                    updateProperties.
eac0b7
+
eac0b7
+                \sa updateProperties to change properties on the server
eac0b7
+              */
eac0b7
+            virtual libcmis::PropertyPtrMap& getProperties( );
eac0b7
+
eac0b7
+
eac0b7
+            /** Get the renditions of the object.
eac0b7
+
eac0b7
+                \param filter is defined by the CMIS spec section 2.2.1.2.4.1.
eac0b7
+                              By default, this value is just ignored, but some bindings and servers
eac0b7
+                              may use it.
eac0b7
+
eac0b7
+                \attention
eac0b7
+                    The streamId of the rendition is used in getContentStream( )
eac0b7
+              */
eac0b7
+            virtual std::vector< RenditionPtr> getRenditions( std::string filter = std::string( ) );
eac0b7
+            virtual AllowableActionsPtr getAllowableActions( ) { return m_allowableActions; }
eac0b7
+
eac0b7
+            /** Update the object properties and return the updated object.
eac0b7
+
eac0b7
+                \attention
eac0b7
+                    even if the returned object may have the same Id than 'this'
eac0b7
+                    and thus representing the same object on the server, those
eac0b7
+                    are still two different instances to ease memory handling.
eac0b7
+              */
eac0b7
+            virtual boost::shared_ptr< Object > updateProperties(
eac0b7
+                        const PropertyPtrMap& properties ) = 0;
eac0b7
+
eac0b7
+            virtual ObjectTypePtr getTypeDescription( );
eac0b7
+
eac0b7
+            /** Reload the data from the server.
eac0b7
+              */
eac0b7
+            virtual void refresh( ) = 0;
eac0b7
+            virtual time_t getRefreshTimestamp( ) { return m_refreshTimestamp; }
eac0b7
+
eac0b7
+            virtual void remove( bool allVersions = true ) = 0;
eac0b7
+
eac0b7
+            virtual void move( boost::shared_ptr< Folder > source, boost::shared_ptr< Folder > destination ) = 0;
eac0b7
+
eac0b7
+
eac0b7
+            virtual std::string getThumbnailUrl( );
eac0b7
+
eac0b7
+            /** Dump the object as a string for debugging or display purpose.
eac0b7
+              */
eac0b7
+            virtual std::string toString( );
eac0b7
+
eac0b7
+            void toXml( xmlTextWriterPtr writer );
eac0b7
+    };
eac0b7
+
eac0b7
+    typedef ::boost::shared_ptr< Object > ObjectPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/property-type.hxx b/include/libcmis/property-type.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..56be22347c86
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/property-type.hxx
eac0b7
@@ -0,0 +1,125 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _PROPERTY_TYPE_HXX_
eac0b7
+#define _PROPERTY_TYPE_HXX_
eac0b7
+
eac0b7
+#include <boost/date_time.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+#include <string>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class ObjectType;
eac0b7
+    typedef boost::shared_ptr< ObjectType > ObjectTypePtr;
eac0b7
+
eac0b7
+    class PropertyType
eac0b7
+    {
eac0b7
+        public:
eac0b7
+
eac0b7
+            enum Type
eac0b7
+            {
eac0b7
+                String,
eac0b7
+                Integer,
eac0b7
+                Decimal,
eac0b7
+                Bool,
eac0b7
+                DateTime
eac0b7
+            };
eac0b7
+
eac0b7
+        private:
eac0b7
+
eac0b7
+            std::string m_id;
eac0b7
+            std::string m_localName;
eac0b7
+            std::string m_localNamespace;
eac0b7
+            std::string m_displayName;
eac0b7
+            std::string m_queryName;
eac0b7
+            Type m_type;
eac0b7
+            std::string m_xmlType;
eac0b7
+            bool m_multiValued;
eac0b7
+            bool m_updatable;
eac0b7
+            bool m_inherited;
eac0b7
+            bool m_required;
eac0b7
+            bool m_queryable;
eac0b7
+            bool m_orderable;
eac0b7
+            bool m_openChoice;
eac0b7
+            bool m_temporary;
eac0b7
+
eac0b7
+        public:
eac0b7
+
eac0b7
+            /// Default constructor, mostly present for testing.
eac0b7
+            PropertyType( );
eac0b7
+            PropertyType( xmlNodePtr node );
eac0b7
+            PropertyType( const PropertyType& copy );
eac0b7
+            /// constructor for temporary type definitions
eac0b7
+            PropertyType( std::string type,
eac0b7
+                          std::string id,
eac0b7
+                          std::string localName,
eac0b7
+                          std::string displayName,
eac0b7
+                          std::string queryName );
eac0b7
+            virtual ~PropertyType( ) { };
eac0b7
+
eac0b7
+            PropertyType& operator=( const PropertyType& copy );
eac0b7
+
eac0b7
+            std::string getId( ) { return m_id; }
eac0b7
+            std::string getLocalName( ) { return m_localName; }
eac0b7
+            std::string getLocalNamespace( ) { return m_localNamespace; }
eac0b7
+            std::string getDisplayName( ) { return m_displayName; }
eac0b7
+            std::string getQueryName( ) { return m_queryName; }
eac0b7
+            Type getType( ) { return m_type; }
eac0b7
+            std::string getXmlType( ) { return m_xmlType; }
eac0b7
+            bool isMultiValued( ) { return m_multiValued; }
eac0b7
+            bool isUpdatable( ) { return m_updatable; }
eac0b7
+            bool isInherited( ) { return m_inherited; }
eac0b7
+            bool isRequired( ) { return m_required; }
eac0b7
+            bool isQueryable( ) { return m_queryable; }
eac0b7
+            bool isOrderable( ) { return m_orderable; }
eac0b7
+            bool isOpenChoice( ) { return m_openChoice; }
eac0b7
+
eac0b7
+            void setId( std::string id ) { m_id = id; }
eac0b7
+            void setLocalName( std::string localName ) { m_localName = localName; }
eac0b7
+            void setLocalNamespace( std::string localNamespace ) { m_localNamespace = localNamespace; }
eac0b7
+            void setDisplayName( std::string displayName ) { m_displayName = displayName; }
eac0b7
+            void setQueryName( std::string queryName ) { m_queryName = queryName; }
eac0b7
+            void setType( Type type ) { m_type = type; }
eac0b7
+            void setMultiValued( bool multivalued ) { m_multiValued = multivalued; }
eac0b7
+            void setUpdatable( bool updatable ) { m_updatable = updatable; }
eac0b7
+            void setInherited( bool inherited ) { m_inherited = inherited; }
eac0b7
+            void setRequired( bool required ) { m_required = required; }
eac0b7
+            void setQueryable( bool queryable ) { m_queryable = queryable; }
eac0b7
+            void setOrderable( bool orderable ) { m_orderable = orderable; }
eac0b7
+            void setOpenChoice( bool openChoice ) { m_openChoice = openChoice; }
eac0b7
+
eac0b7
+            void setTypeFromXml( std::string typeStr );
eac0b7
+            void setTypeFromJsonType( std::string jsonType );
eac0b7
+
eac0b7
+            void update( std::vector< ObjectTypePtr > typesDefs );
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< PropertyType > PropertyTypePtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/property.hxx b/include/libcmis/property.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..aa6560590c11
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/property.hxx
eac0b7
@@ -0,0 +1,88 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _PROPERTY_HXX_
eac0b7
+#define _PROPERTY_HXX_
eac0b7
+
eac0b7
+#include <libxml/tree.h>
eac0b7
+#include <libxml/xmlwriter.h>
eac0b7
+
eac0b7
+#include <boost/date_time.hpp>
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+
eac0b7
+#include <string>
eac0b7
+#include <vector>
eac0b7
+
eac0b7
+#include "property-type.hxx"
eac0b7
+#include "xmlserializable.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class ObjectType;
eac0b7
+
eac0b7
+    class Property : public XmlSerializable
eac0b7
+    {
eac0b7
+        private:
eac0b7
+            PropertyTypePtr m_propertyType;
eac0b7
+            std::vector< std::string > m_strValues;
eac0b7
+            std::vector< bool > m_boolValues;
eac0b7
+            std::vector< long > m_longValues;
eac0b7
+            std::vector< double > m_doubleValues;
eac0b7
+            std::vector< boost::posix_time::ptime > m_dateTimeValues;
eac0b7
+
eac0b7
+        protected:
eac0b7
+            Property( );
eac0b7
+
eac0b7
+        public:
eac0b7
+            /** Property constructor allowing to use different values for the id and names.
eac0b7
+              */
eac0b7
+            Property( PropertyTypePtr propertyType, std::vector< std::string > strValues );
eac0b7
+
eac0b7
+            ~Property( ){ }
eac0b7
+
eac0b7
+            PropertyTypePtr getPropertyType( ) { return m_propertyType; }
eac0b7
+
eac0b7
+            std::vector< boost::posix_time::ptime > getDateTimes( ) { return m_dateTimeValues; }
eac0b7
+            std::vector< bool > getBools( ) { return m_boolValues; }
eac0b7
+            std::vector< std::string > getStrings( ) { return m_strValues; }
eac0b7
+            std::vector< long > getLongs( ) { return m_longValues; }
eac0b7
+            std::vector< double > getDoubles( ) { return m_doubleValues; }
eac0b7
+
eac0b7
+            void setPropertyType( PropertyTypePtr propertyType);
eac0b7
+            void setValues( std::vector< std::string > strValues );
eac0b7
+
eac0b7
+            void toXml( xmlTextWriterPtr writer );
eac0b7
+
eac0b7
+            std::string toString( );
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< Property > PropertyPtr;
eac0b7
+    typedef std::map< std::string, libcmis::PropertyPtr > PropertyPtrMap;
eac0b7
+
eac0b7
+    PropertyPtr parseProperty( xmlNodePtr node, boost::shared_ptr< ObjectType > objectType );
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/rendition.hxx b/include/libcmis/rendition.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..2e386515e77d
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/rendition.hxx
eac0b7
@@ -0,0 +1,88 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2013 Cao Cuong Ngo <cao.cuong.ngo@gmail.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+
eac0b7
+#ifndef _RENDITION_HXX_
eac0b7
+#define _RENDITION_HXX_
eac0b7
+
eac0b7
+#include <string>
eac0b7
+
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{  
eac0b7
+    class Rendition
eac0b7
+    {
eac0b7
+        private:
eac0b7
+            Rendition( );
eac0b7
+    
eac0b7
+            std::string m_streamId;
eac0b7
+            std::string m_mimeType;
eac0b7
+            std::string m_kind;
eac0b7
+            std::string m_href;
eac0b7
+            std::string m_title;
eac0b7
+            long m_length;
eac0b7
+            long m_width;
eac0b7
+            long m_height;
eac0b7
+            std::string m_renditionDocumentId;
eac0b7
+
eac0b7
+        public:
eac0b7
+            Rendition( std::string streamId, std::string mimeType, 
eac0b7
+                       std::string kind, std::string href,
eac0b7
+                       std::string title = std::string( ),
eac0b7
+                       long length = -1, long width = -1, long height = -1,
eac0b7
+                       std::string renditionDocumentId = std::string( ) );
eac0b7
+
eac0b7
+            /** Parse an XML node of type cmisRenditionType
eac0b7
+              */
eac0b7
+            Rendition( xmlNodePtr node );
eac0b7
+            ~Rendition( );
eac0b7
+            
eac0b7
+            bool isThumbnail( );
eac0b7
+
eac0b7
+            const std::string& getStreamId( ) const;
eac0b7
+            const std::string& getMimeType( ) const;
eac0b7
+            const std::string& getKind( ) const;
eac0b7
+            const std::string& getUrl( ) const;
eac0b7
+            const std::string& getTitle( ) const;
eac0b7
+
eac0b7
+            /** Provides the stream length in bytes or a negative value if missing.
eac0b7
+              */
eac0b7
+            long getLength( ) const;
eac0b7
+            long getWidth( ) const;
eac0b7
+            long getHeight( ) const;
eac0b7
+            const std::string& getRenditionDocumentId( );
eac0b7
+
eac0b7
+            std::string toString( );
eac0b7
+    };
eac0b7
+
eac0b7
+    typedef ::boost::shared_ptr< Rendition > RenditionPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
+
eac0b7
diff --git a/include/libcmis/repository.hxx b/include/libcmis/repository.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..a4435d89ae75
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/repository.hxx
eac0b7
@@ -0,0 +1,117 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 Cédric Bosdonnat <cbosdo@users.sourceforge.net>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _REPOSITORY_HXX_
eac0b7
+#define _REPOSITORY_HXX_
eac0b7
+
eac0b7
+#include <map>
eac0b7
+#include <string>
eac0b7
+
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    /** Class representing a repository and its infos.
eac0b7
+
eac0b7
+        \sa 2.2.2.2 section of the CMIS specifications
eac0b7
+      */
eac0b7
+    class Repository
eac0b7
+    {
eac0b7
+        public:
eac0b7
+
eac0b7
+            enum Capability
eac0b7
+            {
eac0b7
+                ACL,
eac0b7
+                AllVersionsSearchable,
eac0b7
+                Changes,
eac0b7
+                ContentStreamUpdatability,
eac0b7
+                GetDescendants,
eac0b7
+                GetFolderTree,
eac0b7
+                OrderBy,
eac0b7
+                Multifiling,
eac0b7
+                PWCSearchable,
eac0b7
+                PWCUpdatable,
eac0b7
+                Query,
eac0b7
+                Renditions,
eac0b7
+                Unfiling,
eac0b7
+                VersionSpecificFiling,
eac0b7
+                Join
eac0b7
+            };
eac0b7
+
eac0b7
+        protected:
eac0b7
+            std::string m_id;
eac0b7
+            std::string m_name;
eac0b7
+            std::string m_description;
eac0b7
+            std::string m_vendorName;
eac0b7
+            std::string m_productName;
eac0b7
+            std::string m_productVersion;
eac0b7
+            std::string m_rootId;
eac0b7
+            std::string m_cmisVersionSupported;
eac0b7
+            boost::shared_ptr< std::string > m_thinClientUri;
eac0b7
+            boost::shared_ptr< std::string > m_principalAnonymous;
eac0b7
+            boost::shared_ptr< std::string > m_principalAnyone;
eac0b7
+
eac0b7
+            std::map< Capability, std::string > m_capabilities ;
eac0b7
+
eac0b7
+            Repository( );
eac0b7
+            void initializeFromNode( xmlNodePtr node );
eac0b7
+
eac0b7
+        public:
eac0b7
+            Repository( xmlNodePtr node );
eac0b7
+            virtual ~Repository( ) { };
eac0b7
+
eac0b7
+            std::string getId( ) const;
eac0b7
+            std::string getName( ) const;
eac0b7
+            std::string getDescription( ) const;
eac0b7
+            std::string getVendorName( ) const;
eac0b7
+            std::string getProductName( ) const;
eac0b7
+            std::string getProductVersion( ) const;
eac0b7
+            std::string getRootId( ) const;
eac0b7
+            std::string getCmisVersionSupported( ) const;
eac0b7
+            boost::shared_ptr< std::string > getThinClientUri( ) const;
eac0b7
+            boost::shared_ptr< std::string > getPrincipalAnonymous( ) const;
eac0b7
+            boost::shared_ptr< std::string > getPrincipalAnyone( ) const;
eac0b7
+
eac0b7
+            std::string getCapability( Capability capability ) const;
eac0b7
+
eac0b7
+            /** Wrapper function providing the capability as a boolean value.
eac0b7
+                If the capability value is not a boolean, returns false.
eac0b7
+             */
eac0b7
+            bool getCapabilityAsBool( Capability capability ) const;
eac0b7
+
eac0b7
+            std::string toString( ) const;
eac0b7
+
eac0b7
+        private:
eac0b7
+
eac0b7
+            static std::map< Capability, std::string > parseCapabilities( xmlNodePtr node );
eac0b7
+    };
eac0b7
+    
eac0b7
+    typedef ::boost::shared_ptr< Repository > RepositoryPtr;
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/session-factory.hxx b/include/libcmis/session-factory.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..b0b94f835f30
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/session-factory.hxx
eac0b7
@@ -0,0 +1,149 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _SESSION_FACTORY_HXX_
eac0b7
+#define _SESSION_FACTORY_HXX_
eac0b7
+
eac0b7
+#include <vector>
eac0b7
+#include <map>
eac0b7
+#include <string>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+#include "oauth2-data.hxx"
eac0b7
+#include "repository.hxx"
eac0b7
+#include "session.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    /** This callback provides the OAuth2 code or NULL.
eac0b7
+
eac0b7
+        The resulting char* will be freed later.
eac0b7
+      */
eac0b7
+    typedef char* ( *OAuth2AuthCodeProvider )( const char* authUrl,
eac0b7
+        const char* username, const char* password );
eac0b7
+
eac0b7
+    class AuthProvider 
eac0b7
+    {
eac0b7
+        public:
eac0b7
+            virtual ~AuthProvider() { };
eac0b7
+
eac0b7
+            /** The function implementing it needs to fill the username and password parameters
eac0b7
+                and return true. Returning false means that the user cancelled the authentication
eac0b7
+                and will fail the query.
eac0b7
+              */
eac0b7
+            virtual bool authenticationQuery( std::string& username, std::string& password ) = 0;
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< AuthProvider > AuthProviderPtr;
eac0b7
+  
eac0b7
+    /** Handler class used to request user input when an invalid SSL certificate is encountered.
eac0b7
+     */ 
eac0b7
+    class CertValidationHandler
eac0b7
+    {
eac0b7
+        public:
eac0b7
+             virtual ~CertValidationHandler( ){ };
eac0b7
+
eac0b7
+             /** This function is provided a vector of X509 certificates encoded in base64, with
eac0b7
+                 the first certificate being the one to validate, and the others are the issuers
eac0b7
+                 chain.
eac0b7
+
eac0b7
+                 The result will be stored in the session object to avoid asking several times
eac0b7
+                 to validate the same certificate.
eac0b7
+
eac0b7
+                 \result true if the certificate should be ignored, false to fail the request.
eac0b7
+               */
eac0b7
+             virtual bool validateCertificate( std::vector< std::string > certificatesChain ) = 0;
eac0b7
+    };
eac0b7
+    typedef ::boost::shared_ptr< CertValidationHandler > CertValidationHandlerPtr;
eac0b7
+
eac0b7
+    class SessionFactory
eac0b7
+    {
eac0b7
+        private:
eac0b7
+
eac0b7
+            static AuthProviderPtr s_authProvider;
eac0b7
+
eac0b7
+            static std::string s_proxy;
eac0b7
+            static std::string s_noProxy;
eac0b7
+            static std::string s_proxyUser;
eac0b7
+            static std::string s_proxyPass;
eac0b7
+
eac0b7
+            static OAuth2AuthCodeProvider s_oauth2AuthCodeProvider;
eac0b7
+
eac0b7
+            static CertValidationHandlerPtr s_certValidationHandler;
eac0b7
+
eac0b7
+        public:
eac0b7
+
eac0b7
+            static void setAuthenticationProvider( AuthProviderPtr provider ) { s_authProvider = provider; }
eac0b7
+            static AuthProviderPtr getAuthenticationProvider( ) { return s_authProvider; }
eac0b7
+            
eac0b7
+            static void setOAuth2AuthCodeProvider( OAuth2AuthCodeProvider provider ) { s_oauth2AuthCodeProvider = provider; }
eac0b7
+            static OAuth2AuthCodeProvider getOAuth2AuthCodeProvider( ) { return s_oauth2AuthCodeProvider; }
eac0b7
+
eac0b7
+            /** Set the handler to ask the user what to do with invalid SSL certificates. If not set,
eac0b7
+                every invalid certificate will raise an exception.
eac0b7
+              */
eac0b7
+            static void setCertificateValidationHandler( CertValidationHandlerPtr handler ) { s_certValidationHandler = handler; }
eac0b7
+            static CertValidationHandlerPtr getCertificateValidationHandler( ) { return s_certValidationHandler; }
eac0b7
+
eac0b7
+            static void setProxySettings( std::string proxy,
eac0b7
+                    std::string noProxy,
eac0b7
+                    std::string proxyUser,
eac0b7
+                    std::string proxyPass );
eac0b7
+
eac0b7
+            static const std::string& getProxy() { return s_proxy; }
eac0b7
+            static const std::string& getNoProxy() { return s_noProxy; }
eac0b7
+            static const std::string& getProxyUser() { return s_proxyUser; }
eac0b7
+            static const std::string& getProxyPass() { return s_proxyPass; }
eac0b7
+
eac0b7
+            /** Create a session from the given parameters. The binding type is automatically
eac0b7
+                detected based on the provided URL.
eac0b7
+
eac0b7
+                The resulting pointer should be deleted by the caller.
eac0b7
+              */
eac0b7
+            static Session* createSession( std::string bindingUrl,
eac0b7
+                    std::string username = std::string( ),
eac0b7
+                    std::string password = std::string( ),
eac0b7
+                    std::string repositoryId = std::string( ),
eac0b7
+                    bool noSslCheck = false,
eac0b7
+                    OAuth2DataPtr oauth2 = OAuth2DataPtr(), bool verbose = false );
eac0b7
+
eac0b7
+            /**
eac0b7
+                Gets the informations of the repositories on the server.
eac0b7
+
eac0b7
+                \deprecated
eac0b7
+                    Since libcmis 0.4.0, this helper function simply creates a session
eac0b7
+                    using the createSession function with no repository and then calls
eac0b7
+                    getRepositories on the resulting session.
eac0b7
+                    Kept only for backward API compatibility.
eac0b7
+              */
eac0b7
+            static std::vector< RepositoryPtr > getRepositories( std::string bindingUrl,
eac0b7
+                    std::string username = std::string( ),
eac0b7
+                    std::string password = std::string( ),
eac0b7
+                    bool verbose = false );
eac0b7
+    };
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/session.hxx b/include/libcmis/session.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..d28361a15005
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/session.hxx
eac0b7
@@ -0,0 +1,100 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _SESSION_HXX_
eac0b7
+#define _SESSION_HXX_
eac0b7
+
eac0b7
+#include <vector>
eac0b7
+#include <string>
eac0b7
+#include <boost/shared_ptr.hpp>
eac0b7
+
eac0b7
+#include "object-type.hxx"
eac0b7
+#include "object.hxx"
eac0b7
+#include "folder.hxx"
eac0b7
+#include "repository.hxx"
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    class Session
eac0b7
+    {
eac0b7
+        public:
eac0b7
+
eac0b7
+            virtual ~Session() { };
eac0b7
+
eac0b7
+            /** Get the current repository.
eac0b7
+              */
eac0b7
+            virtual RepositoryPtr getRepository( ) = 0;
eac0b7
+
eac0b7
+            virtual std::vector< RepositoryPtr > getRepositories( ) = 0;
eac0b7
+
eac0b7
+            /** Change the current repository.
eac0b7
+
eac0b7
+                \return
eac0b7
+                    false if no repository with the provided id can be found on the server,
eac0b7
+                    true otherwise
eac0b7
+              */
eac0b7
+            virtual bool setRepository( std::string repositoryId ) = 0;
eac0b7
+
eac0b7
+            /** Get the Root folder of the repository
eac0b7
+              */
eac0b7
+            virtual FolderPtr getRootFolder() = 0;
eac0b7
+            
eac0b7
+            /** Get a CMIS object from its ID.
eac0b7
+              */
eac0b7
+            virtual ObjectPtr getObject( std::string id ) = 0;
eac0b7
+
eac0b7
+            /** Get a CMIS object from one of its path.
eac0b7
+              */
eac0b7
+            virtual ObjectPtr getObjectByPath( std::string path ) = 0;
eac0b7
+
eac0b7
+            /** Get a CMIS folder from its ID.
eac0b7
+              */
eac0b7
+            virtual libcmis::FolderPtr getFolder( std::string id ) = 0;
eac0b7
+
eac0b7
+            /** Get a CMIS object type from its ID.
eac0b7
+              */
eac0b7
+            virtual ObjectTypePtr getType( std::string id ) = 0;
eac0b7
+
eac0b7
+            /** Get all the CMIS base object types known by the server.
eac0b7
+              */
eac0b7
+            virtual std::vector< ObjectTypePtr > getBaseTypes( ) = 0;
eac0b7
+
eac0b7
+            /** Enable or disable the SSL certificate verification.
eac0b7
+
eac0b7
+                By default, SSL certificates are verified and errors are thrown in case of
eac0b7
+                one is invalid. The user may decide to ignore the checks for this CMIS session
eac0b7
+                to workaround self-signed certificates or other similar problems.
eac0b7
+
eac0b7
+                As each session only handles the connection to one CMIS server, it should
eac0b7
+                concern only one SSL certificate and should provide the same feature as the
eac0b7
+                certificate exception feature available on common web browser.
eac0b7
+              */
eac0b7
+            virtual void setNoSSLCertificateCheck( bool noCheck ) = 0;
eac0b7
+    };
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/xml-utils.hxx b/include/libcmis/xml-utils.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..afe5985dad23
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/xml-utils.hxx
eac0b7
@@ -0,0 +1,167 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _XML_UTILS_HXX_
eac0b7
+#define _XML_UTILS_HXX_
eac0b7
+
eac0b7
+#include <map>
eac0b7
+#include <ostream>
eac0b7
+#include <sstream>
eac0b7
+#include <string>
eac0b7
+
eac0b7
+#include <boost/date_time.hpp>
eac0b7
+#include <libxml/tree.h>
eac0b7
+#include <libxml/xpathInternals.h>
eac0b7
+#include <libxml/xmlwriter.h>
eac0b7
+
eac0b7
+#include "exception.hxx"
eac0b7
+
eac0b7
+#define NS_CMIS_PREFIX      "cmis"
eac0b7
+#define NS_CMISRA_PREFIX    "cmisra"
eac0b7
+#define NS_SOAP_ENV_PREFIX  "soap-env"
eac0b7
+#define NS_CMIS_URL         "http://docs.oasis-open.org/ns/cmis/core/200908/"
eac0b7
+#define NS_CMISRA_URL       "http://docs.oasis-open.org/ns/cmis/restatom/200908/"
eac0b7
+#define NS_CMISM_URL        "http://docs.oasis-open.org/ns/cmis/messaging/200908/"
eac0b7
+#define NS_CMISW_URL        "http://docs.oasis-open.org/ns/cmis/ws/200908/"
eac0b7
+#define NS_APP_URL          "http://www.w3.org/2007/app"
eac0b7
+#define NS_ATOM_URL         "http://www.w3.org/2005/Atom"
eac0b7
+#define NS_SOAP_URL         "http://schemas.xmlsoap.org/wsdl/soap/"
eac0b7
+#define NS_SOAP_ENV_URL     "http://schemas.xmlsoap.org/soap/envelope/"
eac0b7
+
eac0b7
+#define LIBCURL_VERSION_VALUE ( \
eac0b7
+        ( LIBCURL_VERSION_MAJOR << 16 ) | ( LIBCURL_VERSION_MINOR << 8 ) | ( LIBCURL_VERSION_PATCH ) \
eac0b7
+)
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+    /** Class used to decode a stream.
eac0b7
+
eac0b7
+        An instance of this class can hold remaining un-decoded data to use
eac0b7
+        for a future decode call.
eac0b7
+      */
eac0b7
+    class EncodedData
eac0b7
+    {
eac0b7
+        private:
eac0b7
+            xmlTextWriterPtr m_writer;
eac0b7
+            FILE* m_stream;
eac0b7
+            std::ostream* m_outStream;
eac0b7
+
eac0b7
+            std::string m_encoding;
eac0b7
+            bool m_decode;
eac0b7
+            unsigned long m_pendingValue;
eac0b7
+            int m_pendingRank;
eac0b7
+            size_t m_missingBytes;
eac0b7
+
eac0b7
+        public:
eac0b7
+            EncodedData( FILE* stream );
eac0b7
+            EncodedData( std::ostream* stream );
eac0b7
+            EncodedData( const EncodedData& rCopy );
eac0b7
+            EncodedData( xmlTextWriterPtr writer );
eac0b7
+
eac0b7
+            EncodedData& operator=( const EncodedData& rCopy );
eac0b7
+
eac0b7
+            void setEncoding( std::string encoding ) { m_encoding = encoding; }
eac0b7
+            void decode( void* buf, size_t size, size_t nmemb );
eac0b7
+            void encode( void* buf, size_t size, size_t nmemb );
eac0b7
+            void finish( );
eac0b7
+
eac0b7
+        private:
eac0b7
+            void write( void* buf, size_t size, size_t nmemb );
eac0b7
+            void decodeBase64( const char* buf, size_t len );
eac0b7
+            void encodeBase64( const char* buf, size_t len );
eac0b7
+    };
eac0b7
+
eac0b7
+    class HttpResponse
eac0b7
+    {
eac0b7
+        private:
eac0b7
+            std::map< std::string, std::string > m_headers;
eac0b7
+            boost::shared_ptr< std::stringstream > m_stream;
eac0b7
+            boost::shared_ptr< EncodedData > m_data;
eac0b7
+
eac0b7
+        public:
eac0b7
+            HttpResponse( );
eac0b7
+            ~HttpResponse( ) { };
eac0b7
+
eac0b7
+            std::map< std::string, std::string >& getHeaders( ) { return m_headers; }
eac0b7
+            boost::shared_ptr< EncodedData > getData( ) { return m_data; }
eac0b7
+            boost::shared_ptr< std::stringstream > getStream( ) { return m_stream; }
eac0b7
+    };
eac0b7
+    typedef boost::shared_ptr< HttpResponse > HttpResponsePtr;
eac0b7
+
eac0b7
+    void registerNamespaces( xmlXPathContextPtr xpathCtx );
eac0b7
+
eac0b7
+    /** Register the CMIS and WSDL / SOAP namespaces
eac0b7
+      */
eac0b7
+    void registerCmisWSNamespaces( xmlXPathContextPtr xpathCtx );
eac0b7
+
eac0b7
+    /** Register only the WSD / SOAP namespaces.
eac0b7
+      */
eac0b7
+    void registerSoapNamespaces( xmlXPathContextPtr xpathCtx );
eac0b7
+
eac0b7
+    std::string getXPathValue( xmlXPathContextPtr xpathCtx, std::string req );
eac0b7
+
eac0b7
+    xmlDocPtr wrapInDoc( xmlNodePtr entryNode );
eac0b7
+
eac0b7
+    /** Utility extracting an attribute value from an Xml Node,
eac0b7
+        based on the attribute name. If the defaultValue is NULL and
eac0b7
+        the attribute can't be found then throw an exception.
eac0b7
+      */
eac0b7
+    std::string getXmlNodeAttributeValue( xmlNodePtr node,
eac0b7
+                                          const char* attributeName,
eac0b7
+                                          const char* defaultValue = NULL );
eac0b7
+
eac0b7
+    /** Parse a xsd:dateTime string and return the corresponding UTC posix time.
eac0b7
+     */
eac0b7
+    boost::posix_time::ptime parseDateTime( std::string dateTimeStr );
eac0b7
+
eac0b7
+    /// Write a UTC time object to an xsd:dateTime string
eac0b7
+    std::string writeDateTime( boost::posix_time::ptime time );
eac0b7
+
eac0b7
+    bool parseBool( std::string str );
eac0b7
+
eac0b7
+    long parseInteger( std::string str );
eac0b7
+
eac0b7
+    double parseDouble( std::string str );
eac0b7
+
eac0b7
+    /** Trim spaces on the left and right of a string.
eac0b7
+     */
eac0b7
+    std::string trim( const std::string& str );
eac0b7
+
eac0b7
+    std::string base64encode( const std::string& str );
eac0b7
+
eac0b7
+    std::string sha1( const std::string& str );
eac0b7
+
eac0b7
+    std::string tolower( std::string sText );
eac0b7
+
eac0b7
+    int stringstream_write_callback(void * context, const char * s, int len);
eac0b7
+
eac0b7
+    std::string escape( std::string str );
eac0b7
+
eac0b7
+    std::string unescape( std::string str );
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
diff --git a/include/libcmis/xmlserializable.hxx b/include/libcmis/xmlserializable.hxx
eac0b7
new file mode 100644
eac0b7
index 000000000000..533308590073
eac0b7
--- /dev/null
eac0b7
+++ b/include/libcmis/xmlserializable.hxx
eac0b7
@@ -0,0 +1,46 @@
eac0b7
+/* libcmis
eac0b7
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
eac0b7
+ *
eac0b7
+ * The contents of this file are subject to the Mozilla Public License Version
eac0b7
+ * 1.1 (the "License"); you may not use this file except in compliance with
eac0b7
+ * the License or as specified alternatively below. You may obtain a copy of
eac0b7
+ * the License at http://www.mozilla.org/MPL/
eac0b7
+ *
eac0b7
+ * Software distributed under the License is distributed on an "AS IS" basis,
eac0b7
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
eac0b7
+ * for the specific language governing rights and limitations under the
eac0b7
+ * License.
eac0b7
+ *
eac0b7
+ * Major Contributor(s):
eac0b7
+ * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
eac0b7
+ *
eac0b7
+ *
eac0b7
+ * All Rights Reserved.
eac0b7
+ *
eac0b7
+ * For minor contributions see the git repository.
eac0b7
+ *
eac0b7
+ * Alternatively, the contents of this file may be used under the terms of
eac0b7
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
eac0b7
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
eac0b7
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
eac0b7
+ * instead of those above.
eac0b7
+ */
eac0b7
+#ifndef _XMLSERIALIZABLE_HXX_
eac0b7
+#define _XMLSERIALIZABLE_HXX_
eac0b7
+
eac0b7
+#include <libxml/xmlwriter.h>
eac0b7
+
eac0b7
+namespace libcmis
eac0b7
+{
eac0b7
+
eac0b7
+    /// Interface for objects dumpable as XML
eac0b7
+    class XmlSerializable
eac0b7
+    {
eac0b7
+        public:
eac0b7
+            virtual ~XmlSerializable( ) { }
eac0b7
+
eac0b7
+            virtual void toXml( xmlTextWriterPtr writer ) = 0;
eac0b7
+    };
eac0b7
+}
eac0b7
+
eac0b7
+#endif
eac0b7
-- 
eac0b7
2.26.2
eac0b7