You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2008/06/28 17:50:38 UTC

svn commit: r672533 - in /ibatis/trunk/cs/V3/src: Apache.Ibatis.Common/Resources/ Apache.Ibatis.DataMapper/ Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ Apache.Ibatis.DataMapper/Configuration/Module/

Author: gbayon
Date: Sat Jun 28 08:50:38 2008
New Revision: 672533

URL: http://svn.apache.org/viewvc?rev=672533&view=rev
Log:
cleaning

Modified:
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/ResourceLoaderRegistry.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/Resources.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessPropertiesElement.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/Module.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/ExecuteEventArgs.cs

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/ResourceLoaderRegistry.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/ResourceLoaderRegistry.cs?rev=672533&r1=672532&r2=672533&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/ResourceLoaderRegistry.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/ResourceLoaderRegistry.cs Sat Jun 28 08:50:38 2008
@@ -33,8 +33,8 @@
     /// </summary>
     public class ResourceLoaderRegistry
     {
-        private static IDictionary<string, IResourceLoader> _resourceLoaders = new Dictionary<string, IResourceLoader>();
-        private static object syncLock = new object();
+        private static readonly IDictionary<string, IResourceLoader> resourceLoaders = new Dictionary<string, IResourceLoader>();
+        private static readonly object syncLock = new object();
 
         /// <summary>
         /// Registers standard and user-configured resource handlers.
@@ -43,11 +43,11 @@
         {
             lock (syncLock)
             {
-                _resourceLoaders[FileResourceLoader.Scheme] = new FileResourceLoader();
-                _resourceLoaders[UrlResourceLoader.SchemeHttp] = new UrlResourceLoader();
-                _resourceLoaders[UrlResourceLoader.SchemeHttps] = new UrlResourceLoader();
-                _resourceLoaders[UrlResourceLoader.SchemeFtp] = new UrlResourceLoader();
-                _resourceLoaders[AssemblyResourceLoader.Scheme] = new AssemblyResourceLoader();
+                resourceLoaders[FileResourceLoader.Scheme] = new FileResourceLoader();
+                resourceLoaders[UrlResourceLoader.SchemeHttp] = new UrlResourceLoader();
+                resourceLoaders[UrlResourceLoader.SchemeHttps] = new UrlResourceLoader();
+                resourceLoaders[UrlResourceLoader.SchemeFtp] = new UrlResourceLoader();
+                resourceLoaders[AssemblyResourceLoader.Scheme] = new AssemblyResourceLoader();
 
                 // register custom resource handlers
                 //ConfigurationUtils.GetSection(ResourcesSectionName);
@@ -68,7 +68,7 @@
 
             CustomUriBuilder builder = new CustomUriBuilder(resource, Resources.DefaultBasePath);
 
-            IResourceLoader loader = _resourceLoaders[builder.Uri.Scheme];
+            IResourceLoader loader = resourceLoaders[builder.Uri.Scheme];
             return loader.Create(builder.Uri);
         }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/Resources.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/Resources.cs?rev=672533&r1=672532&r2=672533&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/Resources.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/Resources.cs Sat Jun 28 08:50:38 2008
@@ -27,18 +27,13 @@
 #region Using
 
 using System;
-using System.Collections.Specialized;
-using System.Collections.Generic;
 using System.IO;
 using System.Reflection;
 using System.Security.Permissions;
 using System.Xml;
+using Apache.Ibatis.Common.Contracts;
 using Apache.Ibatis.Common.Exceptions;
 using Apache.Ibatis.Common.Logging;
-using Apache.Ibatis.Common.Utilities.TypesResolver;
-using Apache.Ibatis.Common.Xml;
-using Apache.Ibatis.Common.Configuration;
-using Apache.Ibatis.Common.Contracts;
 
 #endregion
 
@@ -68,78 +63,6 @@
 
 		#region Methods
 
-        ///// <summary>
-        ///// Protocole separator
-        ///// </summary>
-        // public const string PROTOCOL_SEPARATOR = "://";
-
-        ///// <summary>
-        ///// Strips protocol name from the resource name
-        ///// </summary>
-        ///// <param name="filePath">Name of the resource</param>
-        ///// <returns>Name of the resource without protocol name</returns>
-        //public static string GetFileSystemResourceWithoutProtocol(string filePath)
-        //{
-        //    int pos = filePath.IndexOf(PROTOCOL_SEPARATOR);
-        //    if (pos == -1)
-        //    {
-        //        return filePath;
-        //    }
-        //    else
-        //    {
-        //        // skip forward slashes after protocol name, if any
-        //        if (filePath.Length > pos + PROTOCOL_SEPARATOR.Length)
-        //        {
-        //            while (filePath[++pos] == '/')
-        //            {
-        //                ;
-        //            }
-        //        }
-        //        return filePath.Substring(pos);
-        //    }
-        //}
-
-        ///// <summary>
-        ///// Get config file
-        ///// </summary>
-        ///// <param name="resourcePath">
-        ///// A config resource path.
-        ///// </param>
-        ///// <returns>An XmlDocument representation of the config file</returns>
-        //public static XmlDocument GetConfigAsXmlDocument(string resourcePath)
-        //{
-        //    XmlDocument config = new XmlDocument(); 
-        //    XmlTextReader reader = null; 
-        //    resourcePath = GetFileSystemResourceWithoutProtocol(resourcePath);
-			
-        //    if (!Resources.FileExists(resourcePath))
-        //    {
-        //        resourcePath = Path.Combine(_baseDirectory, resourcePath); 
-        //    }
-
-        //    try 
-        //    { 
-        //        reader = new XmlTextReader( resourcePath ); 				
-        //        config.Load(reader); 
-        //    } 
-        //    catch(Exception e) 
-        //    { 
-        //        throw new ConfigurationException( 
-        //            string.Format("Unable to load config file \"{0}\". Cause : {1}", 
-        //            resourcePath, 
-        //            e.Message ) ,e); 
-        //    } 
-        //    finally 
-        //    { 
-        //        if (reader != null) 
-        //        { 
-        //            reader.Close(); 
-        //        } 
-        //    } 
-        //    return config; 
-
-        //}
-
         /// <summary>
         /// Determines whether the specified file exists.
         /// </summary>
@@ -189,30 +112,6 @@
         }
 
 
-        ///// <summary>
-        ///// Load an XML resource from a location specify by the node.
-        ///// </summary>
-        ///// <param name="node">An location node</param>
-        ///// <param name="configStore">The config store.</param>
-        ///// <returns>Return the Xml document load.</returns>
-        //public static XmlDocument GetAsXmlDocument(XmlNode node, IConfigurationStore configStore)
-        //{
-        //    // precondiftion
-        //    // node.Attributes["uri"] <> de null et empty
-
-        //    return GetAsXmlDocument(node.Attributes["uri"].Value, configStore);
-        //}
-
-        ///// <summary>
-        ///// Gets as XML document from the specified uri.
-        ///// </summary>
-        ///// <param name="uri">The URI.</param>
-        ///// <returns>Return the Xml document load.</returns>
-        //public static XmlDocument GetAsXmlDocument(string uri)
-        //{
-        //    return GetAsXmlDocument(uri, new DefaultConfigurationStore());
-        //}
-
         /// <summary>
         /// Gets as XML document from the specified uri.
         /// </summary>
@@ -225,7 +124,7 @@
 
             IResource resource = ResourceLoaderRegistry.GetResource(uri);
 
-            XmlDocument xmlDocument = Resources.GetStreamAsXmlDocument(resource.Stream);
+            XmlDocument xmlDocument = GetStreamAsXmlDocument(resource.Stream);
 
             return xmlDocument;
         }
@@ -264,7 +163,7 @@
 
             IResource resource = ResourceLoaderRegistry.GetResource(uri);
 
-            return Resources.GetStreamAsXmlReader(resource.Stream);
+            return GetStreamAsXmlReader(resource.Stream);
         }
 
         /// <summary>
@@ -292,252 +191,6 @@
             return reader;
         }
 
-        ///// <summary>
-        ///// Get the path resource of an url or resource location.
-        ///// </summary>
-        ///// <param name="node">The specification from where to load.</param>
-        ///// <param name="properties">the global properties</param>
-        ///// <returns></returns>
-        //public static string GetValueOfNodeResourceUrl(XmlNode node, NameValueCollection properties)
-        //{
-        //    string path = null;
-
-        //    if (node.Attributes["uri"] != null)
-        //    {
-        //        string ressource = NodeUtils.ParsePropertyTokens(node.Attributes["uri"].Value, properties);
-        //        path = Path.Combine(_applicationBase, ressource);
-        //    }
-        //    else 
-        //    {
-        //        throw new ConfigurationException("");
-        //    }
-
-        //    return path;
-        //}
-
-
-        ///// <summary>
-        ///// Get XmlDocument from a FileInfo resource
-        ///// </summary>
-        ///// <param name="resource"></param>
-        ///// <returns></returns>
-        //public static XmlDocument GetFileInfoAsXmlDocument(FileInfo resource)
-        //{
-        //    XmlDocument config = new XmlDocument();
-
-        //    try 
-        //    {
-        //        config.Load( resource.FullName );
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load XmlDocument via FileInfo. Cause : {0}", 
-        //            e.Message ) ,e); 
-        //    }
-
-        //    return config;
-        //}
-
-        ///// <summary>
-        ///// Get XmlDocument from a Uri resource
-        ///// </summary>
-        ///// <param name="resource"></param>
-        ///// <returns></returns>
-        //public static XmlDocument GetUriAsXmlDocument(Uri resource)
-        //{
-        //    XmlDocument config = new XmlDocument();
-
-        //    try 
-        //    {
-        //        config.Load( resource.AbsoluteUri );
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load XmlDocument via Uri. Cause : {0}", 
-        //            e.Message ) ,e); 
-        //    }
-
-        //    return config;
-        //}
-
-        ///// <summary>
-        ///// Get XmlDocument from relative (from root directory of the application) path resource
-        ///// </summary>
-        ///// <param name="resource"></param>
-        ///// <returns></returns>
-        //public static XmlDocument GetResourceAsXmlDocument(string resource)
-        //{
-        //    XmlDocument config = new XmlDocument();
-
-        //    try 
-        //    {
-        //        config.Load( Path.Combine(_applicationBase, resource) );
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load file via resource \"{0}\" as resource. Cause : {1}", 
-        //            resource, 
-        //            e.Message ) ,e); 
-        //    }
-
-        //    return config;
-        //}
-
-
-        ///// <summary>
-        ///// Get XmlDocument from absolute path resource
-        ///// </summary>
-        ///// <param name="url"></param>
-        ///// <returns></returns>
-        //public static XmlDocument GetUrlAsXmlDocument(string url)
-        //{
-        //    XmlDocument config = new XmlDocument();
-
-        //    try 
-        //    {
-        //        config.Load(url);
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load file via url \"{0}\" as url. Cause : {1}",
-        //            url, 
-        //            e.Message  ) ,e);
-        //    }
-
-        //    return config;
-        //}
-
-		
-        ///// <summary>
-        ///// Doit aller ds AssemblyResource
-        ///// </summary>
-        ///// <param name="resource"></param>
-        ///// <returns></returns>
-        //public static XmlDocument GetEmbeddedResourceAsXmlDocument(string resource)
-        //{
-        //    XmlDocument config = new XmlDocument();
-        //    bool isLoad = false;
-
-        //    FileAssemblyInfo fileInfo = new FileAssemblyInfo (resource);
-        //    if (fileInfo.IsAssemblyQualified)
-        //    {
-        //        Assembly assembly = Assembly.Load(fileInfo.AssemblyName);
-
-        //        Stream stream = assembly.GetManifestResourceStream(fileInfo.ResourceFileName);
-        //        // JIRA - IBATISNET-103 
-        //        if (stream == null)
-        //        {
-        //            stream = assembly.GetManifestResourceStream(fileInfo.FileName);
-        //        }
-        //        if (stream != null)
-        //        {
-        //            try
-        //            {
-        //                config.Load(stream);
-        //                isLoad = true;
-        //            }
-        //            catch(Exception e)
-        //            {
-        //                throw new ConfigurationException(
-        //                    string.Format("Unable to load file \"{0}\" in embedded resource. Cause : {1}",
-        //                    resource, 
-        //                    e.Message  ) ,e);
-        //            }
-        //        }
-        //    } 
-        //    else
-        //    {
-        //        // bare type name... loop thru all loaded assemblies
-        //        Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
-        //        foreach (Assembly assembly in assemblies)
-        //        {
-        //            Stream stream = assembly.GetManifestResourceStream(fileInfo.FileName);
-        //            if (stream != null)
-        //            {
-        //                try
-        //                {
-        //                    config.Load(stream);
-        //                    isLoad = true;
-        //                }
-        //                catch(Exception e)
-        //                {
-        //                    throw new ConfigurationException(
-        //                        string.Format("Unable to load file \"{0}\" in embedded resource. Cause : ",
-        //                        resource, 
-        //                        e.Message  ) ,e);
-        //                }
-        //                break;
-        //            }
-        //        }
-        //    }
-
-        //    if (isLoad == false) 
-        //    {
-        //        _logger.Error("Could not load embedded resource from assembly");
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load embedded resource from assembly \"{0}\".",
-        //            fileInfo.OriginalFileName));
-        //    }
-
-        //    return config;
-        //}
-
-
-        ///// <summary>
-        ///// Load a file from a given resource path
-        ///// </summary>
-        ///// <param name="resourcePath">
-        ///// The resource path
-        ///// </param>
-        ///// <returns>return a FileInfo</returns>
-        //public static FileInfo GetFileInfo(string resourcePath)
-        //{
-        //    FileInfo fileInfo = null;
-        //    resourcePath = GetFileSystemResourceWithoutProtocol(resourcePath);
-
-        //    if ( !Resources.FileExists(resourcePath)) 
-        //    {
-        //        resourcePath = Path.Combine(_applicationBase, resourcePath);
-        //    }
-
-        //    try
-        //    {
-        //        //argument : The fully qualified name of the new file, or the relative file name. 
-        //        fileInfo = new FileInfo(resourcePath);
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        throw new ConfigurationException(
-        //            string.Format("Unable to load file \"{0}\". Cause : \"{1}\"", resourcePath, e.Message),e);
-        //    }
-        //    return fileInfo;
-
-        //}
-
-
-        ///// <summary>
-        ///// Resolves the supplied type name into a <see cref="System.Type"/> instance.
-        ///// </summary>
-        ///// <param name="typeName">
-        ///// The (possibly partially assembly qualified) name of a <see cref="System.Type"/>.
-        ///// </param>
-        ///// <returns>
-        ///// A resolved <see cref="System.Type"/> instance.
-        ///// </returns>
-        ///// <exception cref="System.TypeLoadException">
-        ///// If the type cannot be resolved.
-        ///// </exception>
-        //[Obsolete("Use Apache.Ibatis.Common.Utilities.TypeUtils")]
-        //public static Type TypeForName(string typeName)
-        //{
-        //    return TypeUtils.ResolveType(typeName);
-        //        //_cachedTypeResolver.Resolve(className);
-        //}
-
 		#endregion
 
 	}

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessPropertiesElement.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessPropertiesElement.cs?rev=672533&r1=672532&r2=672533&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessPropertiesElement.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessPropertiesElement.cs Sat Jun 28 08:50:38 2008
@@ -23,11 +23,7 @@
  ********************************************************************************/
 #endregion
 
-using System;
-using System.Text;
 using System.Xml;
-
-using Apache.Ibatis.Common.Configuration;
 using Apache.Ibatis.Common.Resources;
 
 namespace Apache.Ibatis.DataMapper.Configuration.Interpreters.Config.Xml.Processor

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/Module.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/Module.cs?rev=672533&r1=672532&r2=672533&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/Module.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/Module.cs Sat Jun 28 08:50:38 2008
@@ -33,10 +33,17 @@
     /// </summary>
     public abstract class Module : ModuleBuilder, IModule
     {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="Module"/> class.
+        /// </summary>
         public Module()
         {
         }
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="Module"/> class.
+        /// </summary>
+        /// <param name="nameSpace">The name space.</param>
         public Module(string nameSpace)
             : base(nameSpace)
         {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/ExecuteEventArgs.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/ExecuteEventArgs.cs?rev=672533&r1=672532&r2=672533&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/ExecuteEventArgs.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/ExecuteEventArgs.cs Sat Jun 28 08:50:38 2008
@@ -33,15 +33,15 @@
 	/// </summary>
 	public class ExecuteEventArgs : EventArgs
 	{
-		private string _statementName = string.Empty;
+		private string statementName = string.Empty;
 
 		/// <summary>
 		/// Set or get the statement name
 		/// </summary>
 		public string StatementName
 		{
-			get { return _statementName; }
-			set { _statementName = value; }
+			get { return statementName; }
+			set { statementName = value; }
 		}
 	}
 }