chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1799607 [2/2] - in /chemistry/portcmis/trunk/PortCMIS: binding/ binding/atompub/ binding/browser/ binding/browser/json/ client/ const/ data/ enum/ exceptions/ utils/
Date Thu, 22 Jun 2017 19:44:33 GMT
Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientUtils.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientUtils.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientUtils.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientUtils.cs Thu Jun 22 19:44:32 2017
@@ -29,7 +29,7 @@ using System.Text;
 namespace PortCMIS.Client
 {
     /// <summary>
-    /// Operation context implementation.
+    /// Operation defaultContext implementation.
     /// </summary>
     public class OperationContext : IOperationContext
     {
@@ -342,7 +342,7 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Generates a cache key from the current state of the operation context.
+        /// Generates a cache key from the current state of the operation defaultContext.
         /// </summary>
         /// 
         protected virtual void GenerateCacheKey()
@@ -384,14 +384,10 @@ namespace PortCMIS.Client
     /// <summary>
     /// Operation Context helpers.
     /// </summary>
-    public class OperationContextUtils
+    public static class OperationContextUtils
     {
-        private OperationContextUtils()
-        {
-        }
-
         /// <summary>
-        /// Creates a new operation context object.
+        /// Creates a new operation defaultContext object.
         /// </summary>
         public static IOperationContext CreateOperationContext()
         {
@@ -399,15 +395,20 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Copies an operation context object.
+        /// Copies an operation defaultContext object.
         /// </summary>
-        public static IOperationContext CopyOperationContext(OperationContext context)
+        public static IOperationContext CopyOperationContext(IOperationContext context)
         {
+            if (context == null)
+            {
+                throw new ArgumentNullException(nameof(context));
+            }
+
             return new OperationContext(context);
         }
 
         /// <summary>
-        /// Creates a new operation context object with the given parameters.
+        /// Creates a new operation defaultContext object with the given parameters.
         /// </summary>
         /// <remarks>
         /// Caching is enabled.
@@ -422,7 +423,7 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Creates a new operation context object that only selects the bare minimum.
+        /// Creates a new operation defaultContext object that only selects the bare minimum.
         /// </summary>
         /// <remarks>
         /// Caching is enabled.
@@ -433,7 +434,7 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Creates a new operation context object that only selects the bare minimum plus
the provided properties.
+        /// Creates a new operation defaultContext object that only selects the bare minimum
plus the provided properties.
         /// </summary>
         /// <remarks>
         /// Caching is enabled.
@@ -460,7 +461,7 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Creates a new operation context object that selects everything.
+        /// Creates a new operation defaultContext object that selects everything.
         /// </summary>
         /// <remarks>
         /// Caching is enabled.
@@ -472,7 +473,7 @@ namespace PortCMIS.Client
         }
 
         /// <summary>
-        /// Returns an unmodifiable view of the specified operation context.
+        /// Returns an unmodifiable view of the specified operation defaultContext.
         /// </summary>
         public static IOperationContext CreateReadOnlyOperationContext(IOperationContext
context)
         {
@@ -486,73 +487,73 @@ namespace PortCMIS.Client
             public override ISet<string> Filter
             {
                 get { return base.Filter == null ? null : new HashSet<string>(base.Filter);
}
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override string FilterString
             {
                 get { return base.FilterString; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override bool IncludeAllowableActions
             {
                 get { return base.IncludeAllowableActions; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override bool IncludeAcls
             {
                 get { return base.IncludeAcls; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override IncludeRelationships? IncludeRelationships
             {
                 get { return base.IncludeRelationships; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override bool IncludePolicies
             {
                 get { return base.IncludePolicies; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override ISet<string> RenditionFilter
             {
                 get { return base.RenditionFilter == null ? null : new HashSet<string>(base.RenditionFilter);
}
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override string RenditionFilterString
             {
                 get { return base.RenditionFilterString; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override bool IncludePathSegments
             {
                 get { return base.IncludePathSegments; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override string OrderBy
             {
                 get { return base.OrderBy; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override bool CacheEnabled
             {
                 get { return base.CacheEnabled; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
 
             public override int MaxItemsPerPage
             {
                 get { return base.MaxItemsPerPage; }
-                set { throw new Exception("Not supported!"); }
+                set { throw new NotSupportedException("Not supported!"); }
             }
         }
     }
@@ -1167,15 +1168,11 @@ namespace PortCMIS.Client
     /// <summary>
     /// Content Stream helpers.
     /// </summary>
-    public class ContentStreamUtils
+    public static class ContentStreamUtils
     {
         /// <summary>Octet Stream MIME type.</summary>
         private const string OctetStream = "application/octet-stream";
 
-        private ContentStreamUtils()
-        {
-        }
-
         /// <summary>
         /// Creates a content stream object.
         /// </summary>

Modified: chemistry/portcmis/trunk/PortCMIS/const/ClientVersion.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/const/ClientVersion.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/const/ClientVersion.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/const/ClientVersion.cs Thu Jun 22 19:44:32 2017
@@ -22,13 +22,13 @@ namespace PortCMIS
     /// <summary>
     /// PortCMIS client version.
     /// </summary>
-    public class ClientVersion
+    public static class ClientVersion
     {
         /// <summary>PortCMIS user agent name</summary>
         public const string UserAgentName = "Apache-Chemistry-PortCMIS";
 
         /// <summary>PortCMIS version</summary>
-        public const string Version = "0.2";
+        public const string Version = "0.3";
 
         /// <summary>PortCMIS user agent name</summary>
         public const string UserAgent = UserAgentName + "/" + Version;

Modified: chemistry/portcmis/trunk/PortCMIS/const/ExtensionFeatures.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/const/ExtensionFeatures.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/const/ExtensionFeatures.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/const/ExtensionFeatures.cs Thu Jun 22 19:44:32 2017
@@ -19,7 +19,7 @@
 
 using PortCMIS.Data;
 
-namespace PortCMIS.Const
+namespace PortCMIS.Constants
 {
     /// <summary>
     /// CMIS extensions defined by the CMIS TC.
@@ -27,7 +27,7 @@ namespace PortCMIS.Const
     public class ExtensionFeatures
     {
         /// <summary>
-        /// DateTime format extension for the Browers Bindings.
+        /// DateTime format extension for the Browser Bindings.
         /// </summary>
         public readonly static IExtensionFeature ExtendedDatetimeFormat = new ExtensionFeature()
         {

Modified: chemistry/portcmis/trunk/PortCMIS/data/DataImpl.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/data/DataImpl.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/data/DataImpl.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/data/DataImpl.cs Thu Jun 22 19:44:32 2017
@@ -21,6 +21,7 @@ using PortCMIS.Data.Extensions;
 using PortCMIS.Enums;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Numerics;
 using System.Text;
@@ -44,6 +45,11 @@ namespace PortCMIS.Data
         /// </summary>
         public RepositoryInfo(IRepositoryInfo source)
         {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
             Id = source.Id;
             Name = source.Name;
             Description = source.Description;
@@ -1075,7 +1081,7 @@ namespace PortCMIS.Data
                     }
                     else
                     {
-                        return new BigInteger(Convert.ToInt64(value));
+                        return new BigInteger(Convert.ToInt64(value, CultureInfo.InvariantCulture));
                     }
                 case PropertyType.Boolean:
                     if (!(value is bool))
@@ -1094,7 +1100,7 @@ namespace PortCMIS.Data
                     {
                         throw new ArgumentException("Property '" + Id + "' is a Decimal property!");
                     }
-                    return Convert.ToDecimal(value);
+                    return Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                 case PropertyType.Uri:
                     if (!(value is string))
                     {

Modified: chemistry/portcmis/trunk/PortCMIS/enum/Enums.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/enum/Enums.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/enum/Enums.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/enum/Enums.cs Thu Jun 22 19:44:32 2017
@@ -760,7 +760,7 @@ namespace PortCMIS.Enums
     // --- attribute class ---
 
     [AttributeUsage(AttributeTargets.Field)]
-    internal class CmisValueAttribute : System.Attribute
+    internal sealed class CmisValueAttribute : System.Attribute
     {
         public CmisValueAttribute(string value)
         {

Modified: chemistry/portcmis/trunk/PortCMIS/exceptions/Exceptions.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/exceptions/Exceptions.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/exceptions/Exceptions.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/exceptions/Exceptions.cs Thu Jun 22 19:44:32 2017
@@ -29,27 +29,27 @@ namespace PortCMIS.Exceptions
         /// <summary>
         /// Constructor.
         /// </summary>
-        public CmisBaseException() : base() { Code = null; }
+        protected CmisBaseException() : base() { Code = null; }
 
         /// <summary>
         /// Constructor.
         /// <param name="message">The exception message.</param>
         /// </summary>
-        public CmisBaseException(string message) : base(message) { Code = null; }
+        protected CmisBaseException(string message) : base(message) { Code = null; }
 
         /// <summary>
         /// Constructor.
         /// <param name="message">The exception message.</param>
         /// <param name="inner">The inner exception.</param>
         /// </summary>
-        public CmisBaseException(string message, Exception inner) : base(message, inner)
{ Code = null; }
+        protected CmisBaseException(string message, Exception inner) : base(message, inner)
{ Code = null; }
 
         /// <summary>
         /// Constructor.
         /// <param name="message">The exception message.</param>
         /// <param name="code">The exception code. (Web Services only.)</param>
         /// </summary>
-        public CmisBaseException(string message, long? code)
+        protected CmisBaseException(string message, long? code)
             : this(message)
         {
             Code = code;
@@ -60,7 +60,7 @@ namespace PortCMIS.Exceptions
         /// <param name="message">The exception message.</param>
         /// <param name="errorContent">The error content</param>
         /// </summary>
-        public CmisBaseException(string message, string errorContent)
+        protected CmisBaseException(string message, string errorContent)
             : this(message)
         {
             ErrorContent = errorContent;
@@ -72,7 +72,7 @@ namespace PortCMIS.Exceptions
         /// <param name="errorContent">The error content</param>
         /// <param name="inner">The inner exception.</param>
         /// </summary>
-        public CmisBaseException(string message, string errorContent, Exception inner)
+        protected CmisBaseException(string message, string errorContent, Exception inner)
             : this(message, inner)
         {
             ErrorContent = errorContent;
@@ -797,21 +797,21 @@ namespace PortCMIS.Exceptions
     /// <summary>
     /// Invalid Server Data exception.
     /// </summary>
-    public class CmisInvalidServerData : InvalidOperationException
+    public class CmisInvalidServerDataException : InvalidOperationException
     {
         /// <summary>
         /// Constructor.
         /// </summary>
-        public CmisInvalidServerData() : base() { }
+        public CmisInvalidServerDataException() : base() { }
 
         /// <summary>
         /// Constructor.
         /// </summary>
-        public CmisInvalidServerData(string message) : base(message) { }
+        public CmisInvalidServerDataException(string message) : base(message) { }
 
         /// <summary>
         /// Constructor.
         /// </summary>
-        public CmisInvalidServerData(string message, Exception inner) : base(message, inner)
{ }
+        public CmisInvalidServerDataException(string message, Exception inner) : base(message,
inner) { }
     }
 }

Modified: chemistry/portcmis/trunk/PortCMIS/utils/Cache.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/utils/Cache.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/utils/Cache.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/utils/Cache.cs Thu Jun 22 19:44:32 2017
@@ -31,7 +31,7 @@ namespace PortCMIS.Utils
         private int capacity;
         private TimeSpan ttl;
         private Dictionary<K, LinkedListNode<LRUCacheItem<K, V>>> cacheDict
= new Dictionary<K, LinkedListNode<LRUCacheItem<K, V>>>();
-        private LinkedList<LRUCacheItem<K, V>> lruList = new LinkedList<LRUCacheItem<K,
V>>();
+        private readonly LinkedList<LRUCacheItem<K, V>> lruList = new LinkedList<LRUCacheItem<K,
V>>();
 
         public LRUCache(int capacity, TimeSpan ttl)
         {
@@ -124,9 +124,6 @@ namespace PortCMIS.Utils
 
         public DateTime Expiration { get; private set; }
 
-        public bool IsExpired
-        {
-            get { return Value == null || DateTime.UtcNow > Expiration; }
-        }
+        public bool IsExpired => Value == null || DateTime.UtcNow > Expiration;
     }
 }

Modified: chemistry/portcmis/trunk/PortCMIS/utils/Logger.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/utils/Logger.cs?rev=1799607&r1=1799606&r2=1799607&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/utils/Logger.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/utils/Logger.cs Thu Jun 22 19:44:32 2017
@@ -18,6 +18,7 @@
 */
 
 using System;
+using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -89,12 +90,22 @@ namespace PortCMIS.Utils
 
         private static object loggerLock = new object();
 
+
+        /// <summary>
+        /// Logs an error message.
+        /// </summary>
+        /// <param name="message">the message</param>
+        public static void Error(string message)
+        {
+            Error(message, null);
+        }
+
         /// <summary>
         /// Logs an error message.
         /// </summary>
         /// <param name="message">the message</param>
         /// <param name="e">the exception</param>
-        public static void Error(string message, Exception e = null)
+        public static void Error(string message, Exception e)
         {
             lock (loggerLock)
             {
@@ -106,8 +117,17 @@ namespace PortCMIS.Utils
         /// Logs a warn message.
         /// </summary>
         /// <param name="message">the message</param>
+        public static void Warn(string message)
+        {
+            Warn(message, null);
+        }
+
+        /// <summary>
+        /// Logs a warn message.
+        /// </summary>
+        /// <param name="message">the message</param>
         /// <param name="e">the exception</param>
-        public static void Warn(string message, Exception e = null)
+        public static void Warn(string message, Exception e)
         {
             lock (loggerLock)
             {
@@ -122,8 +142,17 @@ namespace PortCMIS.Utils
         /// Logs an info message.
         /// </summary>
         /// <param name="message">the message</param>
+        public static void Info(string message)
+        {
+            Info(message, null);
+        }
+
+        /// <summary>
+        /// Logs an info message.
+        /// </summary>
+        /// <param name="message">the message</param>
         /// <param name="e">the exception</param>
-        public static void Info(string message, Exception e = null)
+        public static void Info(string message, Exception e)
         {
             lock (loggerLock)
             {
@@ -138,8 +167,17 @@ namespace PortCMIS.Utils
         /// Logs a debug message.
         /// </summary>
         /// <param name="message">the message</param>
+        public static void Debug(string message)
+        {
+            Debug(message, null);
+        }
+
+        /// <summary>
+        /// Logs a debug message.
+        /// </summary>
+        /// <param name="message">the message</param>
         /// <param name="e">the exception</param>
-        public static void Debug(string message, Exception e = null)
+        public static void Debug(string message, Exception e)
         {
             lock (loggerLock)
             {
@@ -154,8 +192,17 @@ namespace PortCMIS.Utils
         /// Logs a trace message.
         /// </summary>
         /// <param name="message">the message</param>
+        public static void Trace(string message)
+        {
+            Trace(message, null);
+        }
+
+        /// <summary>
+        /// Logs a trace message.
+        /// </summary>
+        /// <param name="message">the message</param>
         /// <param name="e">the exception</param>
-        public static void Trace(string message, Exception e = null)
+        public static void Trace(string message, Exception e)
         {
             lock (loggerLock)
             {
@@ -176,7 +223,7 @@ namespace PortCMIS.Utils
             DateTime now = DateTime.Now;
 
             StringBuilder sb = new StringBuilder();
-            sb.Append(now.ToString("o"));
+            sb.Append(now.ToString("o", CultureInfo.InvariantCulture));
             sb.Append(' ');
             sb.Append(levelname);
             sb.Append(": ");



Mime
View raw message