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 2005/04/13 22:21:33 UTC

svn commit: r161205 - in incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess: Configuration/DomDaoManagerBuilder.cs DaoSessionHandlers/SimpleDaoSession.cs IBatisNet.DataAccess.csproj MessageManager.cs

Author: gbayon
Date: Wed Apr 13 13:21:31 2005
New Revision: 161205

URL: http://svn.apache.org/viewcvs?view=rev&rev=161205
Log:
- Resolved JIRA 33

Added:
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/MessageManager.cs
Modified:
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSession.cs
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs?view=diff&r1=161204&r2=161205
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs Wed Apr 13 13:21:31 2005
@@ -95,7 +95,6 @@
 			}
 			catch(Exception ex)
 			{
-//				configurationScope.ErrorContext.Cause = ex;
 				throw new ConfigurationException( configurationScope.ErrorContext.ToString(), ex);
 			}
 		}
@@ -367,7 +366,7 @@
 		private Provider ParseProvider(ConfigurationScope configurationScope)
 		{
 			XmlAttribute attribute = null;
-			XmlNode node = configurationScope.NodeContext.SelectSingleNode("database/provider");
+			XmlNode node = configurationScope.NodeContext.SelectSingleNode("//database/provider");
 
 			configurationScope.ErrorContext.MoreInfo = "configure provider";
 
@@ -403,10 +402,6 @@
 						configurationScope.NodeContext.Attributes["name"].Value));
 				}
 			}
-
-			configurationScope.ErrorContext.ObjectId = string.Empty;
-			configurationScope.ErrorContext.Resource = string.Empty;
-			configurationScope.ErrorContext.MoreInfo = string.Empty;
 		}
 
 //		/// <summary>

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSession.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSession.cs?view=diff&r1=161204&r2=161205
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSession.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSession.cs Wed Apr 13 13:21:31 2005
@@ -130,10 +130,6 @@
 		/// </summary>
 		public override void OpenConnection()
 		{
-			if (_logger.IsDebugEnabled)
-			{
-				_logger.Debug("Open Connection");
-			}
 			if (_connection == null)
 			{
 				_connection =  _dataSource.Provider.GetConnection();
@@ -141,6 +137,10 @@
 				try
 				{
 					_connection.Open();
+					if (_logger.IsDebugEnabled)
+					{
+						_logger.Debug("Open Connection");
+					}
 				}
 				catch(Exception ex)
 				{
@@ -152,6 +152,10 @@
 				try
 				{
 					_connection.Open();
+					if (_logger.IsDebugEnabled)
+					{
+						_logger.Debug("Open Connection");
+					}
 				}
 				catch(Exception ex)
 				{

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj?view=diff&r1=161204&r2=161205
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj Wed Apr 13 13:21:31 2005
@@ -140,6 +140,11 @@
                     BuildAction = "Content"
                 />
                 <File
+                    RelPath = "MessageManager.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "notice.txt"
                     BuildAction = "Content"
                 />

Added: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/MessageManager.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/MessageManager.cs?view=auto&rev=161205
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/MessageManager.cs (added)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/MessageManager.cs Wed Apr 13 13:21:31 2005
@@ -0,0 +1,134 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: $
+ * $Date: $
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed 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.
+ * 
+ ********************************************************************************/
+#endregion
+
+#region Autors
+
+/************************************************
+* Gilles Bayon 
+*************************************************/
+#endregion 
+
+#region Using
+
+using System;
+using System.Resources;
+using System.Reflection; 
+using System.IO;
+#endregion 
+
+namespace IBatisNet.DataAccess
+{
+	/// <summary>
+	/// Summary description for MessageManager.
+	/// </summary>
+	public class MessageManager
+	{
+		#region Fields
+
+		private const string RESOURCE_FILENAME = "IBatisNet.DataAccess";
+		private static MessageManager _internalManager = new MessageManager();
+		private ResourceManager _resourceManager= null;
+
+		#endregion 
+
+		#region Constructor
+
+		/// <summary>
+		/// Constructor.
+		/// </summary>
+		public MessageManager()
+		{
+			_resourceManager = new ResourceManager(this.GetType().Namespace + RESOURCE_FILENAME, Assembly.GetExecutingAssembly());						
+		}
+		#endregion 
+
+		#region Properties
+
+		/// <summary>
+		/// Gets a message manager for the assembly resource file.
+		/// </summary>
+		public static MessageManager Instance
+		{
+			get
+			{
+				return _internalManager;
+			}
+		}
+
+
+
+		/// <summary>
+		/// Gets the message with the specified key from the assembly resource file.
+		/// </summary>
+		/// <param name="key">Key of the item to retrieve from the resource file.</param>
+		/// <returns>Value from the resource file identified by the key.</returns>
+		public string this [ string key ]
+		{
+			get
+			{
+				return _resourceManager.GetString( key, System.Globalization.CultureInfo.CurrentUICulture );																
+			}
+		}
+		#endregion 
+
+		#region Methods
+
+		/// <summary>
+		/// Gets a resource stream.
+		/// </summary>
+		/// <param name="name">The resource key.</param>
+		/// <returns>A resource stream.</returns>
+		public Stream GetStream( string name )
+		{
+			return Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType().Namespace + "." + name); 
+		}
+
+		/// <summary>
+		/// Formats a message stored in the assembly resource file.
+		/// </summary>
+		/// <param name="key">The resource key.</param>
+		/// <param name="format">The format arguments.</param>
+		/// <returns>A formatted string.</returns>
+		public string FormatMessage( string key, params object[] format )
+		{
+			return String.Format( System.Globalization.CultureInfo.CurrentCulture, this[key], format );  
+		}
+		#endregion 
+
+
+		/// <summary>
+		/// Class used to expose constants that represent keys in the resource file.
+		/// </summary>
+		internal abstract class MessageKeys
+		{		
+			internal const string ViewAlreadyConfigured = "ViewAlreadyConfigured";	
+			internal const string CantFindCommandMapping = "CantFindCommandMapping";	
+			internal const string CantGetNextView = "CantGetNextView";	
+			internal const string DocumentNotValidated = "DocumentNotValidated";
+
+
+		}
+	}
+}