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

The stream may not contain anything if there is

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

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