first steps toward the client API
git-svn-id: https://svn.apache.org/repos/asf/incubator/chemistry/dotcmis/trunk@1062859 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS.suo b/DotCMIS.suo
index 1fde0eb..b358d86 100644
--- a/DotCMIS.suo
+++ b/DotCMIS.suo
Binary files differ
diff --git a/DotCMIS/DotCMIS.csproj b/DotCMIS/DotCMIS.csproj
index 8c7534a..6aef5f1 100644
--- a/DotCMIS/DotCMIS.csproj
+++ b/DotCMIS/DotCMIS.csproj
@@ -53,6 +53,7 @@
<Compile Include="binding\services.cs" />
<Compile Include="binding\converter.cs" />
<Compile Include="binding\webservices\webservices.cs" />
+ <Compile Include="client\client-caches.cs" />
<Compile Include="client\client-intf.cs" />
<Compile Include="client\client-impl.cs" />
<Compile Include="const.cs" />
diff --git a/DotCMIS/binding/atompub/atompub-writer.cs b/DotCMIS/binding/atompub/atompub-writer.cs
index ff38fdf..9774371 100644
--- a/DotCMIS/binding/atompub/atompub-writer.cs
+++ b/DotCMIS/binding/atompub/atompub-writer.cs
@@ -193,13 +193,13 @@
private string statement;
private bool? searchAllVersions;
private bool? includeAllowableActions;
- private IncludeRelationships? includeRelationships;
+ private IncludeRelationshipsFlag? includeRelationships;
private string renditionFilter;
private long? maxItems;
private long? skipCount;
public AtomQueryWriter(string statement, bool? searchAllVersions,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount)
{
this.statement = statement;
diff --git a/DotCMIS/binding/atompub/atompub.cs b/DotCMIS/binding/atompub/atompub.cs
index a26f66d..4db125c 100644
--- a/DotCMIS/binding/atompub/atompub.cs
+++ b/DotCMIS/binding/atompub/atompub.cs
@@ -696,7 +696,7 @@
}
protected IObjectData GetObjectInternal(string repositoryId, IdentifierType idOrPath, string objectIdOrPath,
- ReturnVersion? returnVersion, string filter, bool? includeAllowableActions, IncludeRelationships? includeRelationships,
+ ReturnVersion? returnVersion, string filter, bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships,
string renditionFilter, bool? includePolicyIds, bool? includeAcl, IExtensionsData extension)
{
IObjectData result = null;
@@ -1012,7 +1012,7 @@
}
public IObjectInFolderList GetChildren(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, long? maxItems, long? skipCount, IExtensionsData extension)
{
ObjectInFolderList result = new ObjectInFolderList();
@@ -1103,7 +1103,7 @@
}
public IList<IObjectInFolderContainer> GetDescendants(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension)
{
IList<IObjectInFolderContainer> result = new List<IObjectInFolderContainer>();
@@ -1135,7 +1135,7 @@
}
public IList<IObjectInFolderContainer> GetFolderTree(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension)
{
IList<IObjectInFolderContainer> result = new List<IObjectInFolderContainer>();
@@ -1167,7 +1167,7 @@
}
public IList<IObjectParentData> GetObjectParents(string repositoryId, string objectId, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includeRelativePathSegment, IExtensionsData extension)
{
IList<IObjectParentData> result = new List<IObjectParentData>();
@@ -1333,7 +1333,7 @@
}
public IObjectList GetCheckedOutDocs(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension)
{
ObjectList result = new ObjectList();
@@ -1674,7 +1674,7 @@
public IProperties GetProperties(string repositoryId, string objectId, string filter, IExtensionsData extension)
{
IObjectData obj = GetObjectInternal(repositoryId, IdentifierType.Id, objectId, ReturnVersion.This, filter,
- false, IncludeRelationships.None, "cmis:none", false, false, extension);
+ false, IncludeRelationshipsFlag.None, "cmis:none", false, false, extension);
return obj.Properties;
}
@@ -1683,7 +1683,7 @@
long? maxItems, long? skipCount, IExtensionsData extension)
{
IObjectData obj = GetObjectInternal(repositoryId, IdentifierType.Id, objectId, ReturnVersion.This,
- PropertyIds.ObjectId, false, IncludeRelationships.None, renditionFilter, false, false, extension);
+ PropertyIds.ObjectId, false, IncludeRelationshipsFlag.None, renditionFilter, false, false, extension);
IList<IRenditionData> result = obj.Renditions;
if (result == null)
@@ -1695,7 +1695,7 @@
}
public IObjectData GetObject(string repositoryId, string objectId, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds,
bool? includeAcl, IExtensionsData extension)
{
return GetObjectInternal(repositoryId, IdentifierType.Id, objectId, ReturnVersion.This, filter, includeAllowableActions,
@@ -1703,7 +1703,7 @@
}
public IObjectData GetObjectByPath(string repositoryId, string path, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
IExtensionsData extension)
{
return GetObjectInternal(repositoryId, IdentifierType.Path, path, ReturnVersion.This, filter, includeAllowableActions,
@@ -2217,7 +2217,7 @@
}
public IObjectData GetObjectOfLatestVersion(string repositoryId, string objectId, string versionSeriesId, bool major,
- string filter, bool? includeAllowableActions, IncludeRelationships? includeRelationships,
+ string filter, bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships,
string renditionFilter, bool? includePolicyIds, bool? includeAcl, IExtensionsData extension)
{
ReturnVersion returnVersion = ReturnVersion.Latest;
@@ -2240,7 +2240,7 @@
}
IObjectData objectData = GetObjectInternal(repositoryId, IdentifierType.Id, objectId, returnVersion, filter,
- false, IncludeRelationships.None, "cmis:none", false, false, extension);
+ false, IncludeRelationshipsFlag.None, "cmis:none", false, false, extension);
return objectData.Properties;
}
@@ -2410,7 +2410,7 @@
}
public IObjectList Query(string repositoryId, string statement, bool? searchAllVersions,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension)
{
ObjectList result = new ObjectList();
diff --git a/DotCMIS/binding/services.cs b/DotCMIS/binding/services.cs
index 47c67ce..f7b1844 100644
--- a/DotCMIS/binding/services.cs
+++ b/DotCMIS/binding/services.cs
@@ -42,25 +42,25 @@
public interface INavigationService
{
IObjectInFolderList GetChildren(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, long? maxItems, long? skipCount, IExtensionsData extension);
IList<IObjectInFolderContainer> GetDescendants(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension);
IList<IObjectInFolderContainer> GetFolderTree(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension);
IList<IObjectParentData> GetObjectParents(string repositoryId, string objectId, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includeRelativePathSegment, IExtensionsData extension);
IObjectData GetFolderParent(string repositoryId, string folderId, string filter, ExtensionsData extension);
IObjectList GetCheckedOutDocs(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension);
}
@@ -89,11 +89,11 @@
long? maxItems, long? skipCount, IExtensionsData extension);
IObjectData GetObject(string repositoryId, string objectId, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds,
bool? includeAcl, IExtensionsData extension);
IObjectData GetObjectByPath(string repositoryId, string path, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
IExtensionsData extension);
IContentStream GetContentStream(string repositoryId, string objectId, string streamId, long? offset, long? length,
@@ -127,7 +127,7 @@
IExtensionsData extension);
IObjectData GetObjectOfLatestVersion(string repositoryId, string objectId, string versionSeriesId, bool major,
- string filter, bool? includeAllowableActions, IncludeRelationships? includeRelationships,
+ string filter, bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships,
string renditionFilter, bool? includePolicyIds, bool? includeAcl, IExtensionsData extension);
IProperties GetPropertiesOfLatestVersion(string repositoryId, string objectId, string versionSeriesId, bool major,
@@ -147,7 +147,7 @@
public interface IDiscoveryService
{
IObjectList Query(string repositoryId, string statement, bool? searchAllVersions,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension);
IObjectList GetContentChanges(string repositoryId, ref string changeLogToken, bool? includeProperties,
diff --git a/DotCMIS/binding/webservices/webservices.cs b/DotCMIS/binding/webservices/webservices.cs
index cc02b52..3b8efed 100644
--- a/DotCMIS/binding/webservices/webservices.cs
+++ b/DotCMIS/binding/webservices/webservices.cs
@@ -480,7 +480,7 @@
}
public IObjectInFolderList GetChildren(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, long? maxItems, long? skipCount, IExtensionsData extension)
{
NavigationServicePortClient port = Provider.GetNavigationService();
@@ -502,7 +502,7 @@
}
public IList<IObjectInFolderContainer> GetDescendants(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension)
{
NavigationServicePortClient port = Provider.GetNavigationService();
@@ -537,7 +537,7 @@
}
public IList<IObjectInFolderContainer> GetFolderTree(string repositoryId, string folderId, long? depth, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includePathSegment, IExtensionsData extension)
{
NavigationServicePortClient port = Provider.GetNavigationService();
@@ -572,7 +572,7 @@
}
public IList<IObjectParentData> GetObjectParents(string repositoryId, string objectId, string filter,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
bool? includeRelativePathSegment, IExtensionsData extension)
{
NavigationServicePortClient port = Provider.GetNavigationService();
@@ -625,7 +625,7 @@
}
public IObjectList GetCheckedOutDocs(string repositoryId, string folderId, string filter, string orderBy,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension)
{
NavigationServicePortClient port = Provider.GetNavigationService();
@@ -858,7 +858,7 @@
}
public IObjectData GetObject(string repositoryId, string objectId, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds,
bool? includeAcl, IExtensionsData extension)
{
ObjectServicePortClient port = Provider.GetObjectService();
@@ -880,7 +880,7 @@
}
public IObjectData GetObjectByPath(string repositoryId, string path, string filter, bool? includeAllowableActions,
- IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
+ IncludeRelationshipsFlag? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeAcl,
IExtensionsData extension)
{
ObjectServicePortClient port = Provider.GetObjectService();
@@ -1136,7 +1136,7 @@
}
public IObjectData GetObjectOfLatestVersion(string repositoryId, string objectId, string versionSeriesId, bool major,
- string filter, bool? includeAllowableActions, IncludeRelationships? includeRelationships,
+ string filter, bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships,
string renditionFilter, bool? includePolicyIds, bool? includeAcl, IExtensionsData extension)
{
VersioningServicePortClient port = Provider.GetVersioningService();
@@ -1252,7 +1252,7 @@
}
public IObjectList Query(string repositoryId, string statement, bool? searchAllVersions,
- bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter,
+ bool? includeAllowableActions, IncludeRelationshipsFlag? includeRelationships, string renditionFilter,
long? maxItems, long? skipCount, IExtensionsData extension)
{
DiscoveryServicePortClient port = Provider.GetDiscoveryService();
diff --git a/DotCMIS/client/client-caches.cs b/DotCMIS/client/client-caches.cs
new file mode 100644
index 0000000..448881d
--- /dev/null
+++ b/DotCMIS/client/client-caches.cs
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace DotCMIS.Client
+{
+ /// <summary>
+ /// Client cache interface.
+ /// </summary>
+ public interface ICache
+ {
+ void Initialize(ISession session, IDictionary<string, string> parameters);
+ bool ContainsId(string objectId, string cacheKey);
+ bool ContainsPath(string path, string cacheKey);
+ void Put(ICmisObject cmisObject, string cacheKey);
+ void PutPath(string path, ICmisObject cmisObject, string cacheKey);
+ ICmisObject GetById(string objectId, string cacheKey);
+ ICmisObject GetByPath(string path, string cacheKey);
+ void Clear();
+ int CacheSize { get; }
+ }
+
+ /// <summary>
+ /// Cache implementation that doesn't cache.
+ /// </summary>
+ internal class NoCache : ICache
+ {
+ public void Initialize(ISession session, IDictionary<string, string> parameters) { }
+ public bool ContainsId(string objectId, string cacheKey) { return false; }
+ public bool ContainsPath(string path, string cacheKey) { return false; }
+ public void Put(ICmisObject cmisObject, string cacheKey) { }
+ public void PutPath(string path, ICmisObject cmisObject, string cacheKey) { }
+ public ICmisObject GetById(string objectId, string cacheKey) { return null; }
+ public ICmisObject GetByPath(string path, string cacheKey) { return null; }
+ public void Clear() { }
+ public int CacheSize { get { return 0; } }
+ }
+}
diff --git a/DotCMIS/client/client-impl.cs b/DotCMIS/client/client-impl.cs
index 739c9a2..42fa223 100644
--- a/DotCMIS/client/client-impl.cs
+++ b/DotCMIS/client/client-impl.cs
@@ -1,9 +1,744 @@
-using System;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using DotCMIS.Binding;
+using DotCMIS.Data;
+using DotCMIS.Exceptions;
+using System.Threading;
+using DotCMIS.Enums;
namespace DotCMIS.Client
{
-
+ /// <summary>
+ /// Session factory implementation.
+ /// </summary>
+ public class SessionFactory : ISessionFactory
+ {
+ private SessionFactory()
+ {
+ }
+
+ public static SessionFactory NewInstance()
+ {
+ return new SessionFactory();
+ }
+
+ public ISession CreateSession(IDictionary<string, string> parameters)
+ {
+ Session session = new Session(parameters);
+ session.Connect();
+
+ return session;
+ }
+
+ public IList<IRepository> GetRepositories(IDictionary<string, string> parameters)
+ {
+ ICmisBinding binding = CmisBindingHelper.CreateProvider(parameters);
+
+ IList<IRepositoryInfo> repositoryInfos = binding.GetRepositoryService().GetRepositoryInfos(null);
+
+ IList<IRepository> result = new List<IRepository>();
+ foreach (IRepositoryInfo data in repositoryInfos)
+ {
+ result.Add(new Repository(data, parameters, this));
+ }
+
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Binding helper class.
+ /// </summary>
+ internal class CmisBindingHelper
+ {
+ public static ICmisBinding CreateProvider(IDictionary<string, string> parameters)
+ {
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+
+ if (!parameters.ContainsKey(SessionParameter.BindingType))
+ {
+ parameters[SessionParameter.BindingType] = BindingType.Custom;
+ }
+
+ string bt = parameters[SessionParameter.BindingType];
+ switch (bt)
+ {
+ case BindingType.AtomPub:
+ return CreateAtomPubBinding(parameters);
+ case BindingType.WebServices:
+ return CreateWebServiceBinding(parameters);
+ case BindingType.Custom:
+ return CreateCustomBinding(parameters);
+ default:
+ throw new CmisRuntimeException("Ambiguous session parameter: " + parameters);
+ }
+ }
+
+ private static ICmisBinding CreateCustomBinding(IDictionary<string, string> parameters)
+ {
+ CmisBindingFactory factory = CmisBindingFactory.NewInstance();
+ ICmisBinding binding = factory.CreateCmisBinding(parameters);
+
+ return binding;
+ }
+
+ private static ICmisBinding CreateWebServiceBinding(IDictionary<string, string> parameters)
+ {
+ CmisBindingFactory factory = CmisBindingFactory.NewInstance();
+ ICmisBinding binding = factory.CreateCmisWebServicesBinding(parameters);
+
+ return binding;
+ }
+
+ private static ICmisBinding CreateAtomPubBinding(IDictionary<string, string> parameters)
+ {
+ CmisBindingFactory factory = CmisBindingFactory.NewInstance();
+ ICmisBinding binding = factory.CreateCmisAtomPubBinding(parameters);
+
+ return binding;
+ }
+ }
+
+ /// <summary>
+ /// Repository implementation.
+ /// </summary>
+ public class Repository : RepositoryInfo, IRepository
+ {
+ private IDictionary<string, string> parameters;
+ private ISessionFactory sessionFactory;
+
+ public Repository(IRepositoryInfo info, IDictionary<string, string> parameters, ISessionFactory sessionFactory)
+ : base(info)
+ {
+ this.parameters = new Dictionary<string, string>(parameters);
+ this.parameters[SessionParameter.RepositoryId] = Id;
+
+ this.sessionFactory = sessionFactory;
+ }
+
+ public ISession CreateSession()
+ {
+ return sessionFactory.CreateSession(parameters);
+ }
+ }
+
+ /// <summary>
+ /// Session implementation.
+ /// </summary>
+ public class Session : ISession
+ {
+ protected static IOperationContext FallbackContext = new OperationContext(null, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
+ protected IOperationContext context = FallbackContext;
+
+ protected IDictionary<string, string> parameters;
+ protected ICache cache;
+
+ private object sessionLock = new object();
+
+ public ICmisBinding Binding { get; protected set; }
+ public IRepositoryInfo RepositoryInfo { get; protected set; }
+ public IOperationContext DefaultContext
+ {
+ get
+ {
+ Lock();
+ try
+ {
+ return context;
+ }
+ finally
+ {
+ Unlock();
+ }
+ }
+ set
+ {
+ Lock();
+ try
+ {
+ context = (value == null ? FallbackContext : value);
+ }
+ finally
+ {
+ Unlock();
+ }
+ }
+ }
+
+ public Session(IDictionary<string, string> parameters)
+ {
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+
+ this.parameters = parameters;
+
+ cache = CreateCache();
+ }
+
+ public void Connect()
+ {
+ Lock();
+ try
+ {
+ Binding = CmisBindingHelper.CreateProvider(parameters);
+
+ string repositoryId;
+ if (!parameters.TryGetValue(SessionParameter.RepositoryId, out repositoryId))
+ {
+ throw new ArgumentException("Repository Id is not set!");
+ }
+
+ RepositoryInfo = Binding.GetRepositoryService().GetRepositoryInfo(repositoryId, null);
+ }
+ finally
+ {
+ Unlock();
+ }
+ }
+
+ protected ICache CreateCache()
+ {
+ try
+ {
+ string typeName;
+ Type cacheType;
+
+ if (parameters.TryGetValue(SessionParameter.CacheClass, out typeName))
+ {
+ cacheType = Type.GetType(typeName);
+ }
+ else
+ {
+ cacheType = typeof(NoCache);
+ }
+
+ object cacheObject = Activator.CreateInstance(cacheType);
+ if (!(cacheObject is ICache))
+ {
+ throw new Exception("Class does not implement ICache!");
+ }
+
+ ((ICache)cacheObject).Initialize(this, parameters);
+
+ return (ICache)cacheObject;
+ }
+ catch (Exception e)
+ {
+ throw new ArgumentException("Unable to create cache: " + e, e);
+ }
+ }
+
+ public void Clear()
+ {
+ Lock();
+ try
+ {
+ cache = CreateCache();
+ Binding.ClearAllCaches();
+ }
+ finally
+ {
+ Unlock();
+ }
+ }
+
+ // session context
+
+ public IOperationContext CreateOperationContext()
+ {
+ return new OperationContext();
+ }
+
+ public IOperationContext CreateOperationContext(HashSet<string> filter, bool includeAcls, bool includeAllowableActions, bool includePolicies,
+ IncludeRelationshipsFlag includeRelationships, HashSet<string> renditionFilter, bool includePathSegments, string orderBy,
+ bool cacheEnabled, int maxItemsPerPage)
+ {
+ return new OperationContext(filter, includeAcls, includeAllowableActions, includePolicies, includeRelationships, renditionFilter,
+ includePathSegments, orderBy, cacheEnabled, maxItemsPerPage);
+ }
+
+ public IObjectId CreateObjectId(string id)
+ {
+ return new ObjectId(id);
+ }
+
+ // services
+
+ public IObjectFactory ObjectFactory { get; protected set; }
+
+ // types
+
+ public IObjectType GetTypeDefinition(string typeId)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IItemIterable<IObjectType> GetTypeChildren(string typeId, bool includePropertyDefinitions)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IList<ITree<IObjectType>> GetTypeDescendants(string typeId, int depth, bool includePropertyDefinitions)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ // navigation
+
+ public IFolder GetRootFolder()
+ {
+ return GetRootFolder(DefaultContext);
+ }
+
+ public IFolder GetRootFolder(IOperationContext context)
+ {
+ string rootFolderId = RepositoryInfo.RootFolderId;
+
+ ICmisObject rootFolder = GetObject(CreateObjectId(rootFolderId), context);
+ if (!(rootFolder is IFolder))
+ {
+ throw new CmisRuntimeException("Root folder object is not a folder!");
+ }
+
+ return (IFolder)rootFolder;
+ }
+
+ public IItemIterable<IDocument> GetCheckedOutDocs()
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IItemIterable<IDocument> GetCheckedOutDocs(IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public ICmisObject GetObject(IObjectId objectId)
+ {
+ return GetObject(objectId, DefaultContext);
+ }
+
+ public ICmisObject GetObject(IObjectId objectId, IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public ICmisObject GetObjectByPath(string path)
+ {
+ return GetObjectByPath(path, DefaultContext);
+ }
+
+ public ICmisObject GetObjectByPath(string path, IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ // discovery
+
+ public IItemIterable<IQueryResult> Query(string statement, bool searchAllVersions)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IItemIterable<IQueryResult> query(string statement, bool searchAllVersions, IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IChangeEvents getContentChanges(string changeLogToken, bool includeProperties, long maxNumItems)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IChangeEvents getContentChanges(string changeLogToken, bool includeProperties, long maxNumItems,
+ IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ // create
+
+ public IObjectId CreateDocument(IDictionary<string, string> properties, IObjectId folderId, IContentStream contentStream,
+ VersioningState? versioningState, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateDocument(IDictionary<string, string> properties, IObjectId folderId, IContentStream contentStream,
+ VersioningState? versioningState)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateDocumentFromSource(IObjectId source, IDictionary<string, string> properties, IObjectId folderId,
+ VersioningState? versioningState, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateDocumentFromSource(IObjectId source, IDictionary<string, string> properties, IObjectId folderId,
+ VersioningState? versioningState)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateFolder(IDictionary<string, string> properties, IObjectId folderId, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateFolder(IDictionary<string, string> properties, IObjectId folderId)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreatePolicy(IDictionary<string, string> properties, IObjectId folderId, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreatePolicy(IDictionary<string, string> properties, IObjectId folderId)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateRelationship(IDictionary<string, string> properties, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IObjectId CreateRelationship(IDictionary<string, string> properties)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IItemIterable<IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes,
+ RelationshipDirection? relationshipDirection, IObjectType type, IOperationContext context)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ // permissions
+
+ public IAcl GetAcl(IObjectId objectId, bool onlyBasicPermissions)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public IAcl ApplyAcl(IObjectId objectId, IList<IAce> addAces, IList<IAce> removeAces, AclPropagation? aclPropagation)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public void ApplyPolicy(IObjectId objectId, IObjectId policyIds)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ public void RemovePolicy(IObjectId objectId, IObjectId policyIds)
+ { throw new CmisNotSupportedException("Client not implemented!"); }
+
+ protected void Lock()
+ {
+ Monitor.Enter(sessionLock);
+ }
+
+ protected void Unlock()
+ {
+ Monitor.Exit(sessionLock);
+ }
+ }
+
+ /// <summary>
+ /// Operation context implementation.
+ /// </summary>
+ public class OperationContext : IOperationContext
+ {
+ public const string PropertiesStar = "*";
+ public const string RenditionNone = "cmis:none";
+
+ private HashSet<string> filter;
+ private bool includeAllowableActions;
+ private bool includeAcls;
+ private IncludeRelationshipsFlag? includeRelationships;
+ private bool includePolicies;
+ private HashSet<string> renditionFilter;
+ private bool includePathSegments;
+ private string orderBy;
+ private bool cacheEnabled;
+ private string cacheKey;
+ private int maxItemsPerPage;
+
+ public OperationContext()
+ {
+ filter = null;
+ includeAcls = false;
+ includeAllowableActions = true;
+ includePolicies = false;
+ includeRelationships = IncludeRelationshipsFlag.None;
+ renditionFilter = null;
+ includePathSegments = true;
+ orderBy = null;
+ cacheEnabled = false;
+ maxItemsPerPage = 100;
+
+ GenerateCacheKey();
+ }
+
+ public OperationContext(HashSet<string> filter, bool includeAcls, bool includeAllowableActions,
+ bool includePolicies, IncludeRelationshipsFlag includeRelationships, HashSet<string> renditionFilter,
+ bool includePathSegments, String orderBy, bool cacheEnabled, int maxItemsPerPage)
+ {
+ this.filter = filter;
+ this.includeAcls = includeAcls;
+ this.includeAllowableActions = includeAllowableActions;
+ this.includePolicies = includePolicies;
+ this.includeRelationships = includeRelationships;
+ this.renditionFilter = renditionFilter;
+ this.includePathSegments = includePathSegments;
+ this.orderBy = orderBy;
+ this.cacheEnabled = cacheEnabled;
+ this.maxItemsPerPage = maxItemsPerPage;
+
+ GenerateCacheKey();
+ }
+
+ public HashSet<string> Filter
+ {
+ get { return new HashSet<string>(filter); }
+ set
+ {
+ if (value != null)
+ {
+ HashSet<string> tempSet = new HashSet<string>();
+ foreach (string oid in value)
+ {
+ if (oid == null) { continue; }
+
+ string toid = oid.Trim();
+ if (toid.Length == 0) { continue; }
+ if (toid == PropertiesStar)
+ {
+ tempSet = new HashSet<string>();
+ tempSet.Add(PropertiesStar);
+ break;
+ }
+ if (toid.IndexOf(',') > -1)
+ {
+ throw new ArgumentException("Query id must not contain a comma!");
+ }
+
+ tempSet.Add(toid);
+ }
+
+ if (tempSet.Count == 0) { filter = null; }
+ else { filter = tempSet; }
+ }
+ else
+ {
+ filter = null;
+ }
+
+ GenerateCacheKey();
+ }
+ }
+
+ public string FilterString
+ {
+ get
+ {
+ if (filter == null) { return null; }
+
+ if (filter.Contains(PropertiesStar))
+ {
+ return PropertiesStar;
+ }
+
+ this.filter.Add(PropertyIds.ObjectId);
+ this.filter.Add(PropertyIds.BaseTypeId);
+ this.filter.Add(PropertyIds.ObjectTypeId);
+
+ StringBuilder sb = new StringBuilder();
+
+ foreach (String oid in filter)
+ {
+ if (sb.Length > 0) { sb.Append(','); }
+ sb.Append(oid);
+ }
+
+ return sb.ToString();
+ }
+
+ set
+ {
+ if (value == null || value.Trim().Length == 0)
+ {
+ Filter = null;
+ return;
+ }
+
+ string[] ids = value.Split(',');
+ HashSet<string> tempSet = new HashSet<string>();
+ foreach (string qid in ids)
+ {
+ tempSet.Add(qid);
+ }
+
+ Filter = tempSet;
+ }
+ }
+
+ public bool IncludeAllowableActions
+ {
+ get { return includeAllowableActions; }
+ set { includeAllowableActions = value; GenerateCacheKey(); }
+ }
+
+ public bool IncludeAcls
+ {
+ get { return includeAcls; }
+ set { includeAcls = value; GenerateCacheKey(); }
+ }
+
+ public IncludeRelationshipsFlag? IncludeRelationships
+ {
+ get { return includeRelationships; }
+ set { includeRelationships = value; GenerateCacheKey(); }
+ }
+
+ public bool IncludePolicies
+ {
+ get { return includePolicies; }
+ set { includePolicies = value; GenerateCacheKey(); }
+ }
+
+ public HashSet<string> RenditionFilter
+ {
+ get { return new HashSet<string>(renditionFilter); }
+ set
+ {
+ HashSet<string> tempSet = new HashSet<string>();
+ if (value != null)
+ {
+ foreach (String rf in value)
+ {
+ if (rf == null) { continue; }
+
+ String trf = rf.Trim();
+ if (trf.Length == 0) { continue; }
+ if (trf.IndexOf(',') > -1)
+ {
+ throw new ArgumentException("Rendition must not contain a comma!");
+ }
+
+ tempSet.Add(trf);
+ }
+
+ if (tempSet.Count == 0)
+ {
+ tempSet.Add(RenditionNone);
+ }
+ }
+ else
+ {
+ tempSet.Add(RenditionNone);
+ }
+
+ renditionFilter = tempSet;
+
+ GenerateCacheKey();
+ }
+ }
+
+ public string RenditionFilterString
+ {
+ get
+ {
+ if (renditionFilter == null) { return null; }
+
+ StringBuilder sb = new StringBuilder();
+ foreach (string rf in renditionFilter)
+ {
+ if (sb.Length > 0) { sb.Append(','); }
+ sb.Append(rf);
+ }
+
+ return sb.ToString();
+ }
+
+ set
+ {
+ if (value == null || value.Trim().Length == 0)
+ {
+ RenditionFilter = null;
+ return;
+ }
+
+ string[] renditions = value.Split(',');
+ HashSet<string> tempSet = new HashSet<string>();
+ foreach (string rend in renditions)
+ {
+ tempSet.Add(rend);
+ }
+
+ RenditionFilter = tempSet;
+ }
+ }
+
+ public bool IncludePathSegments
+ {
+ get { return includePathSegments; }
+ set { includePathSegments = value; GenerateCacheKey(); }
+ }
+
+ public string OrderBy
+ {
+ get { return orderBy; }
+ set { orderBy = value; GenerateCacheKey(); }
+ }
+
+ public bool CacheEnabled
+ {
+ get { return cacheEnabled; }
+ set { cacheEnabled = value; GenerateCacheKey(); }
+ }
+
+ public string CacheKey
+ {
+ get { return cacheKey; }
+ }
+
+ public int MaxItemsPerPage
+ {
+ get { return maxItemsPerPage; }
+ set { maxItemsPerPage = value; }
+ }
+
+ protected void GenerateCacheKey()
+ {
+ if (!cacheEnabled)
+ {
+ cacheKey = null;
+ }
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.Append(includeAcls ? "1" : "0");
+ sb.Append(includeAllowableActions ? "1" : "0");
+ sb.Append(includePolicies ? "1" : "0");
+ sb.Append("|");
+ sb.Append(filter == null ? "" : FilterString);
+ sb.Append("|");
+ sb.Append(includeRelationships == null ? "" : includeRelationships.GetCmisValue());
+
+ sb.Append("|");
+ sb.Append(renditionFilter == null ? "" : RenditionFilterString);
+
+ cacheKey = sb.ToString();
+ }
+ }
+
+ /// <summary>
+ /// Object id implementation.
+ /// </summary>
+ public class ObjectId : IObjectId
+ {
+ private string id;
+ public string Id
+ {
+ get { return id; }
+ set
+ {
+ if (value == null || value.Length == 0)
+ {
+ throw new ArgumentException("Id must be set!");
+ }
+
+ id = value;
+ }
+ }
+
+ public ObjectId(string id)
+ {
+ Id = id;
+ }
+ }
}
diff --git a/DotCMIS/client/client-intf.cs b/DotCMIS/client/client-intf.cs
index 0d2b913..e7612b1 100644
--- a/DotCMIS/client/client-intf.cs
+++ b/DotCMIS/client/client-intf.cs
@@ -23,10 +23,115 @@
using DotCMIS.Data;
using DotCMIS.Enums;
using DotCMIS.Data.Extensions;
+using DotCMIS.Binding;
namespace DotCMIS.Client
{
- public interface IOperationContext { }
+ public interface ISessionFactory
+ {
+ ISession CreateSession(IDictionary<string, string> parameters);
+ IList<IRepository> GetRepositories(IDictionary<string, string> parameters);
+ }
+
+ public interface IRepository : IRepositoryInfo
+ {
+ ISession CreateSession();
+ }
+
+ public interface ISession
+ {
+ void Clear();
+
+ // session context
+
+ ICmisBinding Binding { get; }
+
+ IOperationContext DefaultContext { get; set; }
+ IOperationContext CreateOperationContext();
+ IOperationContext CreateOperationContext(HashSet<string> filter, bool includeAcls, bool includeAllowableActions, bool includePolicies,
+ IncludeRelationshipsFlag includeRelationships, HashSet<string> renditionFilter, bool includePathSegments, string orderBy,
+ bool cacheEnabled, int maxItemsPerPage);
+ IObjectId CreateObjectId(string id);
+
+ // services
+
+ IRepositoryInfo RepositoryInfo { get; }
+ IObjectFactory ObjectFactory { get; }
+
+ // types
+
+ IObjectType GetTypeDefinition(string typeId);
+ IItemIterable<IObjectType> GetTypeChildren(string typeId, bool includePropertyDefinitions);
+ IList<ITree<IObjectType>> GetTypeDescendants(string typeId, int depth, bool includePropertyDefinitions);
+
+ // navigation
+
+ IFolder GetRootFolder();
+ IFolder GetRootFolder(IOperationContext context);
+ IItemIterable<IDocument> GetCheckedOutDocs();
+ IItemIterable<IDocument> GetCheckedOutDocs(IOperationContext context);
+ ICmisObject GetObject(IObjectId objectId);
+ ICmisObject GetObject(IObjectId objectId, IOperationContext context);
+ ICmisObject GetObjectByPath(string path);
+ ICmisObject GetObjectByPath(string path, IOperationContext context);
+
+ // discovery
+
+ IItemIterable<IQueryResult> Query(string statement, bool searchAllVersions);
+ IItemIterable<IQueryResult> query(string statement, bool searchAllVersions, IOperationContext context);
+ IChangeEvents getContentChanges(string changeLogToken, bool includeProperties, long maxNumItems);
+ IChangeEvents getContentChanges(string changeLogToken, bool includeProperties, long maxNumItems,
+ IOperationContext context);
+
+ // create
+
+ IObjectId CreateDocument(IDictionary<string, string> properties, IObjectId folderId, IContentStream contentStream,
+ VersioningState? versioningState, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces);
+ IObjectId CreateDocument(IDictionary<string, string> properties, IObjectId folderId, IContentStream contentStream,
+ VersioningState? versioningState);
+ IObjectId CreateDocumentFromSource(IObjectId source, IDictionary<string, string> properties, IObjectId folderId,
+ VersioningState? versioningState, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces);
+ IObjectId CreateDocumentFromSource(IObjectId source, IDictionary<string, string> properties, IObjectId folderId,
+ VersioningState? versioningState);
+ IObjectId CreateFolder(IDictionary<string, string> properties, IObjectId folderId, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces);
+ IObjectId CreateFolder(IDictionary<string, string> properties, IObjectId folderId);
+ IObjectId CreatePolicy(IDictionary<string, string> properties, IObjectId folderId, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces);
+ IObjectId CreatePolicy(IDictionary<string, string> properties, IObjectId folderId);
+ IObjectId CreateRelationship(IDictionary<string, string> properties, IList<IPolicy> policies, IList<IAce> addAces,
+ IList<IAce> removeAces);
+ IObjectId CreateRelationship(IDictionary<string, string> properties);
+
+ IItemIterable<IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes,
+ RelationshipDirection? relationshipDirection, IObjectType type, IOperationContext context);
+
+ // permissions
+
+ IAcl GetAcl(IObjectId objectId, bool onlyBasicPermissions);
+ IAcl ApplyAcl(IObjectId objectId, IList<IAce> addAces, IList<IAce> removeAces, AclPropagation? aclPropagation);
+ void ApplyPolicy(IObjectId objectId, IObjectId policyIds);
+ void RemovePolicy(IObjectId objectId, IObjectId policyIds);
+ }
+
+ public interface IObjectFactory { }
+
+ public interface IOperationContext
+ {
+ HashSet<string> Filter { get; set; }
+ string FilterString { get; set; }
+ bool IncludeAllowableActions { get; set; }
+ bool IncludeAcls { get; set; }
+ IncludeRelationshipsFlag? IncludeRelationships { get; set; }
+ bool IncludePolicies { get; set; }
+ HashSet<string> RenditionFilter { get; set; }
+ string RenditionFilterString { get; set; }
+ bool IncludePathSegments { get; set; }
+ string OrderBy { get; set; }
+ bool CacheEnabled { get; set; }
+ string CacheKey { get; }
+ int MaxItemsPerPage { get; set; }
+ }
public interface ITree<T>
{
@@ -70,16 +175,16 @@
bool IsMultiValued { get; }
PropertyType PropertyType { get; }
PropertyDefinition PropertyDefinition { get; }
- V getValue<V>();
+ V GetValue<V>();
string GetValueAsString();
- string getValuesAsString();
+ string GetValuesAsString();
}
public interface ICmisObjectProperties
{
IList<IProperty> Properties { get; }
IProperty GetProperty(string id);
- T getPropertyValue<T>(string id);
+ T GetPropertyValue<T>(string id);
// convenience accessors
string Name { get; }
@@ -102,48 +207,48 @@
public interface ICmisObject : IObjectId, ICmisObjectProperties
{
// object
- IAllowableActions getAllowableActions();
- IList<IRelationship> getRelationships();
- IAcl getAcl();
+ IAllowableActions GetAllowableActions();
+ IList<IRelationship> GetRelationships();
+ IAcl GetAcl();
// object service
- void delete(bool allVersions);
- ICmisObject updateProperties(IDictionary<string, object> properties);
- IObjectId updateProperties(IDictionary<string, object> properties, bool refresh);
+ void Delete(bool allVersions);
+ ICmisObject UpdateProperties(IDictionary<string, object> properties);
+ IObjectId UpdateProperties(IDictionary<string, object> properties, bool refresh);
// renditions
- IList<IRendition> getRenditions();
+ IList<IRendition> GetRenditions();
// policy service
- void applyPolicy(IObjectId policyId);
- void removePolicy(IObjectId policyIds);
- IList<IPolicy> getPolicies();
+ void ApplyPolicy(IObjectId policyId);
+ void RemovePolicy(IObjectId policyIds);
+ IList<IPolicy> GetPolicies();
// ACL service
- IAcl applyAcl(IList<Ace> addAces, IList<Ace> removeAces, AclPropagation? aclPropagation);
- IAcl addAcl(IList<Ace> addAces, AclPropagation? aclPropagation);
- IAcl removeAcl(IList<Ace> removeAces, AclPropagation? aclPropagation);
+ IAcl applyAcl(IList<IAce> AddAces, IList<IAce> removeAces, AclPropagation? aclPropagation);
+ IAcl addAcl(IList<IAce> AddAces, AclPropagation? aclPropagation);
+ IAcl removeAcl(IList<IAce> RemoveAces, AclPropagation? aclPropagation);
// extensions
- IList<ICmisExtensionElement> getExtensions(ExtensionLevel level);
+ IList<ICmisExtensionElement> GetExtensions(ExtensionLevel level);
- long getRefreshTimestamp();
- void refresh();
- void refreshIfOld(long durationInMillis);
+ long GetRefreshTimestamp();
+ void Refresh();
+ void RefreshIfOld(long durationInMillis);
}
public interface IFileableCmisObject : ICmisObject
{
// object service
- IFileableCmisObject move(IObjectId sourceFolderId, IObjectId targetFolderId);
+ IFileableCmisObject Move(IObjectId sourceFolderId, IObjectId targetFolderId);
// navigation service
IList<IFolder> GetParents();
IList<string> GetPaths();
// multifiling service
- void addToFolder(IObjectId folderId, bool allVersions);
- void removeFromFolder(IObjectId folderId);
+ void AddToFolder(IObjectId folderId, bool allVersions);
+ void RemoveFromFolder(IObjectId folderId);
}
public interface IDocumentProperties
@@ -194,19 +299,19 @@
public interface IFolder : IFileableCmisObject, IFolderProperties
{
- IDocument createDocument(IDictionary<string, object> properties, IContentStream contentStream, VersioningState? versioningState,
+ IDocument CreateDocument(IDictionary<string, object> properties, IContentStream contentStream, VersioningState? versioningState,
IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces, IOperationContext context);
- IDocument createDocument(IDictionary<string, object> properties, IContentStream contentStream, VersioningState? versioningState);
- IDocument createDocumentFromSource(IObjectId source, IDictionary<string, object> properties, VersioningState? versioningState,
+ IDocument CreateDocument(IDictionary<string, object> properties, IContentStream contentStream, VersioningState? versioningState);
+ IDocument CreateDocumentFromSource(IObjectId source, IDictionary<string, object> properties, VersioningState? versioningState,
IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces, IOperationContext context);
- IDocument createDocumentFromSource(IObjectId source, IDictionary<string, object> properties, VersioningState? versioningState);
- IFolder createFolder(IDictionary<string, object> properties, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces,
+ IDocument CreateDocumentFromSource(IObjectId source, IDictionary<string, object> properties, VersioningState? versioningState);
+ IFolder CreateFolder(IDictionary<string, object> properties, IList<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces,
IOperationContext context);
- IFolder createFolder(IDictionary<string, object> properties);
- IPolicy createPolicy(IDictionary<string, object> properties, List<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces,
+ IFolder CreateFolder(IDictionary<string, object> properties);
+ IPolicy CreatePolicy(IDictionary<string, object> properties, List<IPolicy> policies, IList<IAce> addAces, IList<IAce> removeAces,
IOperationContext context);
- IPolicy createPolicy(IDictionary<string, object> properties);
- IList<string> deleteTree(bool allversions, UnfileObject? unfile, bool continueOnFailure);
+ IPolicy CreatePolicy(IDictionary<string, object> properties);
+ IList<string> DeleteTree(bool allversions, UnfileObject? unfile, bool continueOnFailure);
IList<ITree<IFileableCmisObject>> GetFolderTree(int depth);
IList<ITree<IFileableCmisObject>> GetFolderTree(int depth, IOperationContext context);
IList<ITree<IFileableCmisObject>> GetDescendants(int depth);
@@ -242,4 +347,12 @@
ICmisObject GetTarget();
ICmisObject GetTarget(IOperationContext context);
}
+
+ public interface IQueryResult
+ {
+ }
+
+ public interface IChangeEvents
+ {
+ }
}
diff --git a/DotCMIS/const.cs b/DotCMIS/const.cs
index b586e9b..31afcee 100644
--- a/DotCMIS/const.cs
+++ b/DotCMIS/const.cs
@@ -60,12 +60,17 @@
// message size
public const string MessageSize = "org.apache.chemistry.dotcmis.binding.message.size";
+
+ // session parameter
+ public const string CacheClass = "org.apache.chemistry.dotcmis.cache.classname";
+ public const string RepositoryId = "org.apache.chemistry.dotcmis.session.repository.id";
}
public static class BindingType
{
public const string AtomPub = "atompub";
public const string WebServices = "webservices";
+ public const string Custom = "custom";
}
public static class PropertyIds
diff --git a/DotCMIS/data/data-impl.cs b/DotCMIS/data/data-impl.cs
index b929921..86ec88c 100644
--- a/DotCMIS/data/data-impl.cs
+++ b/DotCMIS/data/data-impl.cs
@@ -27,6 +27,30 @@
{
public class RepositoryInfo : ExtensionsData, IRepositoryInfo
{
+ public RepositoryInfo()
+ {
+ }
+
+ public RepositoryInfo(IRepositoryInfo source)
+ {
+ Id = source.Id;
+ Name = source.Name;
+ Description = source.Description;
+ VendorName = source.VendorName;
+ ProductName = source.ProductName;
+ ProductVersion = source.ProductVersion;
+ RootFolderId = source.RootFolderId;
+ Capabilities = source.Capabilities;
+ AclCapabilities = source.AclCapabilities;
+ LatestChangeLogToken = source.LatestChangeLogToken;
+ CmisVersionSupported = source.CmisVersionSupported;
+ ThinClientUri = source.ThinClientUri;
+ ChangesIncomplete = source.ChangesIncomplete;
+ ChangesOnType = source.ChangesOnType;
+ PrincipalIdAnonymous = source.PrincipalIdAnonymous;
+ PrincipalIdAnyone = source.PrincipalIdAnyone;
+ }
+
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
diff --git a/DotCMIS/enums.cs b/DotCMIS/enums.cs
index 02b5ee3..1a87f25 100644
--- a/DotCMIS/enums.cs
+++ b/DotCMIS/enums.cs
@@ -227,7 +227,7 @@
Bits64
}
- public enum IncludeRelationships
+ public enum IncludeRelationshipsFlag
{
[CmisValue("none")]
None,
@@ -346,7 +346,7 @@
MapEnums(typeof(Updatability), typeof(enumUpdatability));
MapEnums(typeof(DateTimeResolution), typeof(enumDateTimeResolution));
MapEnums(typeof(DecimalPrecision), typeof(enumDecimalPrecision));
- MapEnums(typeof(IncludeRelationships), typeof(enumIncludeRelationships));
+ MapEnums(typeof(IncludeRelationshipsFlag), typeof(enumIncludeRelationships));
MapEnums(typeof(ChangeType), typeof(enumTypeOfChanges));
}
diff --git a/DotCMISUnitTest/CRUDTest.cs b/DotCMISUnitTest/CRUDTest.cs
index aadc941..64c3cd3 100644
--- a/DotCMISUnitTest/CRUDTest.cs
+++ b/DotCMISUnitTest/CRUDTest.cs
@@ -39,7 +39,7 @@
IObjectData rootFolder = GetFullObject(RepositoryInfo.RootFolderId);
Assert.AreEqual(BaseTypeId.CmisFolder, rootFolder.BaseTypeId);
- IObjectData rootFolder2 = Binding.GetObjectService().GetObjectByPath(RepositoryInfo.Id, "/", null, true, IncludeRelationships.Both, null, true, true, null);
+ IObjectData rootFolder2 = Binding.GetObjectService().GetObjectByPath(RepositoryInfo.Id, "/", null, true, IncludeRelationshipsFlag.Both, null, true, true, null);
Assert.AreEqual(BaseTypeId.CmisFolder, rootFolder2.BaseTypeId);
Assert.AreEqual(rootFolder.Id, rootFolder2.Id);
@@ -48,7 +48,7 @@
[Test]
public void TestCreateDocument()
{
- string content1 = "my content";
+ string content1 = "my content";
IObjectData doc = CreateDocument(RepositoryInfo.RootFolderId, "dottest", content1);
diff --git a/DotCMISUnitTest/TestFramework.cs b/DotCMISUnitTest/TestFramework.cs
index e13293b..bb8702b 100644
--- a/DotCMISUnitTest/TestFramework.cs
+++ b/DotCMISUnitTest/TestFramework.cs
@@ -17,15 +17,15 @@
* under the License.
*/
using System.Collections.Generic;
+using System.IO;
using System.Net;
+using System.Text;
using DotCMIS;
using DotCMIS.Binding;
-using NUnit.Framework;
using DotCMIS.Data;
using DotCMIS.Enums;
using DotCMIS.Exceptions;
-using System.Text;
-using System.IO;
+using NUnit.Framework;
namespace DotCMISUnitTest
{
@@ -108,7 +108,7 @@
public IObjectData GetFullObject(string objectId)
{
- IObjectData result = Binding.GetObjectService().GetObject(RepositoryInfo.Id, objectId, "*", true, IncludeRelationships.Both, "*", true, true, null);
+ IObjectData result = Binding.GetObjectService().GetObject(RepositoryInfo.Id, objectId, "*", true, IncludeRelationshipsFlag.Both, "*", true, true, null);
Assert.NotNull(result);
Assert.NotNull(result.Id);