springnet-commits Mailing List for Spring Framework .NET (Page 38)
Brought to you by:
aseovic,
markpollack
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(163) |
Sep
(491) |
Oct
(289) |
Nov
(336) |
Dec
(84) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(227) |
Feb
(413) |
Mar
(128) |
Apr
(232) |
May
(92) |
Jun
(299) |
Jul
(386) |
Aug
(228) |
Sep
(237) |
Oct
(426) |
Nov
(325) |
Dec
(405) |
2006 |
Jan
(315) |
Feb
(311) |
Mar
(152) |
Apr
(177) |
May
(443) |
Jun
(92) |
Jul
(88) |
Aug
(80) |
Sep
(288) |
Oct
(515) |
Nov
(1049) |
Dec
(440) |
2007 |
Jan
(179) |
Feb
(406) |
Mar
(294) |
Apr
(80) |
May
(432) |
Jun
(242) |
Jul
(452) |
Aug
(710) |
Sep
(206) |
Oct
(240) |
Nov
(65) |
Dec
(227) |
2008 |
Jan
(80) |
Feb
(90) |
Mar
(98) |
Apr
(136) |
May
(101) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Mark P. <mar...@us...> - 2007-10-08 22:05:29
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9668/Aspects/Exception Modified Files: ExceptionHandlerAspectIntegrationTests.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: ExceptionHandlerAspectIntegrationTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExceptionHandlerAspectIntegrationTests.cs 2 Oct 2007 21:57:08 -0000 1.4 --- ExceptionHandlerAspectIntegrationTests.cs 8 Oct 2007 22:05:26 -0000 1.5 *************** *** 37,41 **** { /// <summary> ! /// This calss contains tests for /// </summary> /// <author>Mark Pollack</author> --- 37,41 ---- { /// <summary> ! /// This class contains tests for ExceptionHandlerAdvice /// </summary> /// <author>Mark Pollack</author> *************** *** 97,100 **** --- 97,133 ---- } + [Test] + [ExpectedException(typeof(ArgumentException))] + public void LoggingTestWithBadString() + { + string logHandlerText = "on foobar name ArithmeticException log 'My Message, Method Name ' + #method.Name"; + + ExecuteLoggingHandler(logHandlerText); + } + + [Test] + public void LoggingTestWithInvalidConstraintExpression() + { + string logHandlerText = "on exception (#e is System.FooBar) log 'My Message, Method Name ' + #method.Name"; + + ExecuteLoggingHandler(logHandlerText); + + //No exception is expected. + + //TODO need to make sure log statement was executed. + } + + [Test] + public void LoggingTestWithNonBooleanConstraintExpression() + { + string logHandlerText = "on exception (1+1) log 'My Message, Method Name ' + #method.Name"; + + ExecuteLoggingHandler(logHandlerText); + + //No exception is expected. + + //TODO need to make sure log statement was executed. + } + private void ExecuteLoggingHandler(string logHandlerText) { |
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9622 Added Files: AbstractExceptionHandler.cs AbstractExceptionHandlerAdvice.cs IExceptionHandler.cs ParsedAdviceExpression.cs RetryAdvice.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop --- NEW FILE: IExceptionHandler.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System; using System.Collections; namespace Spring.Aspects { /// <summary> /// Handles a thrown exception providing calling context. /// </summary> /// <author>Mark Pollack</author> /// <version>$Id: IExceptionHandler.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public interface IExceptionHandler { /// <summary> /// Determines whether this instance can handle the exception the specified exception. /// </summary> /// <param name="ex">The exception.</param> /// <param name="callContextDictionary">The call context dictionary.</param> /// <returns> /// <c>true</c> if this instance can handle the specified exception; otherwise, <c>false</c>. /// </returns> bool CanHandleException(Exception ex, IDictionary callContextDictionary); /// <summary> /// Handles the exception. /// </summary> /// <param name="callContextDictionary">The call context dictionary.</param> /// <returns> /// The return value from handling the exception, if not rethrown or a new exception is thrown. /// </returns> object HandleException(IDictionary callContextDictionary); /// <summary> /// Gets the source exception names. /// </summary> /// <value>The source exception names.</value> IList SourceExceptionNames { get; set; } /// <summary> /// Gets the source exception types. /// </summary> /// <value>The source exception types.</value> IList SourceExceptionTypes { get; set; } /// <summary> /// Gets the translation expression text /// </summary> /// <value>The translation expression text</value> string ActionExpressionText { get; set; } /// <summary> /// Gets or sets the constraint expression text. /// </summary> /// <value>The constraint expression text.</value> string ConstraintExpressionText { get; set; } /// <summary> /// Gets a value indicating whether to continue processing. /// </summary> /// <value><c>true</c> if continue processing; otherwise, <c>false</c>.</value> bool ContinueProcessing { get; set; } } } --- NEW FILE: AbstractExceptionHandlerAdvice.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System.Text.RegularExpressions; using AopAlliance.Intercept; using Spring.Objects.Factory; using Spring.Util; namespace Spring.Aspects { /// <summary> /// This is /// </summary> /// <remarks> /// /// </remarks> /// <author>Mark Pollack</author> /// <version>$Id: AbstractExceptionHandlerAdvice.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public abstract class AbstractExceptionHandlerAdvice : IMethodInterceptor, IInitializingObject { /// <summary> /// Gets or sets the Regex string used to parse advice expressions starting with 'on exception name' and subclass specific actions. /// </summary> /// <value>The regex string to parse advice expressions starting with 'on exception name' and subclass specific actions.</value> public abstract string OnExceptionNameRegex { get; set; } /// <summary> /// Gets or sets the Regex string used to parse advice expressions starting with 'on exception (constraint)' and subclass specific actions. /// </summary> /// <value>The regex string to parse advice expressions starting with 'on exception (constraint)' and subclass specific actions.</value> public abstract string OnExceptionRegex { get; set; } /// <summary> /// Implement this method to perform extra treatments before and after /// the call to the supplied <paramref name="invocation"/>. /// </summary> /// <remarks> /// <p> /// Polite implementations would certainly like to invoke /// <see cref="AopAlliance.Intercept.IJoinpoint.Proceed"/>. /// </p> /// </remarks> /// <param name="invocation"> /// The method invocation that is being intercepted. /// </param> /// <returns> /// The result of the call to the /// <see cref="AopAlliance.Intercept.IJoinpoint.Proceed"/> method of /// the supplied <paramref name="invocation"/>; this return value may /// well have been intercepted by the interceptor. /// </returns> /// <exception cref="System.Exception"> /// If any of the interceptors in the chain or the target object itself /// throws an exception. /// </exception> public abstract object Invoke(IMethodInvocation invocation); /// <summary> /// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/> /// after it has injected all of an object's dependencies. /// </summary> /// <remarks> /// <p> /// This method allows the object instance to perform the kind of /// initialization only possible when all of it's dependencies have /// been injected (set), and to throw an appropriate exception in the /// event of misconfiguration. /// </p> /// <p> /// Please do consult the class level documentation for the /// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a /// description of exactly <i>when</i> this method is invoked. In /// particular, it is worth noting that the /// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/> /// and <see cref="Spring.Context.IApplicationContextAware"/> /// callbacks will have been invoked <i>prior</i> to this method being /// called. /// </p> /// </remarks> /// <exception cref="System.Exception"> /// In the event of misconfiguration (such as the failure to set a /// required property) or if initialization fails. /// </exception> public abstract void AfterPropertiesSet(); /// <summary> /// Parses the advice expression. /// </summary> /// <param name="adviceExpression">The advice expression.</param> /// <returns>An instance of ParsedAdviceExpression</returns> protected virtual ParsedAdviceExpression ParseAdviceExpression(string adviceExpression) { ParsedAdviceExpression parsedAdviceExpression = new ParsedAdviceExpression(adviceExpression); Match match = GetMatch(adviceExpression, OnExceptionNameRegex); if (match.Success) { parsedAdviceExpression.Success = true; //using exception names for exception filter parsedAdviceExpression.ExceptionNames = StringUtils.CommaDelimitedListToStringArray(match.Groups[2].Value.Trim()); parsedAdviceExpression.ActionText = match.Groups[3].Value.Trim(); parsedAdviceExpression.ActionExpressionText = match.Groups[4].Value.Trim(); } else { match = GetMatch(adviceExpression, OnExceptionRegex); if (match.Success) { parsedAdviceExpression.Success = true; //using constratin expression for exception filter string constraintExpression = match.Groups[2].Value.Trim().Remove(0, 1); parsedAdviceExpression.ConstraintExpression = constraintExpression.Substring(0, constraintExpression.Length - 1); parsedAdviceExpression.ActionText = match.Groups[3].Value.Trim(); parsedAdviceExpression.ActionExpressionText = match.Groups[4].Value.Trim(); } } return parsedAdviceExpression; } /// <summary> /// Gets the match using exception constraint expression. /// </summary> /// <param name="adviceExpressionString">The advice expression string.</param> /// <param name="regexString">The regex string.</param> /// <returns>The Match object resulting from the regular expression match.</returns> protected virtual Match GetMatch(string adviceExpressionString, string regexString) { RegexOptions options = ((RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline) | RegexOptions.IgnoreCase); Regex reg = new Regex(regexString, options); return reg.Match(adviceExpressionString); } } } --- NEW FILE: RetryAdvice.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System; using System.Collections; using System.Text.RegularExpressions; using AopAlliance.Intercept; using Common.Logging; using Spring.Objects.Factory; namespace Spring.Aspects { /// <summary> /// AOP Advice to retry a method invocation on an exception /// </summary> /// <remarks> /// /// </remarks> /// <author>Mark Pollack</author> /// <version>$Id: RetryAdvice.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public class RetryAdvice : IMethodInterceptor, IInitializingObject { #region Fields private static readonly ILog log = LogManager.GetLogger(typeof (RetryAdvice)); private IExceptionHandler exceptionHandler; private string retryExpression; private int maxRetries; #endregion #region Properties /// <summary> /// Gets or sets the max retries. /// </summary> /// <value>The max retries.</value> public int MaxRetries { get { return maxRetries; } set { maxRetries = value; } } /// <summary> /// Gets or sets the retry expression. /// </summary> /// <value>The retry expression.</value> public string RetryExpression { get { return retryExpression; } set { retryExpression = value; } } #endregion #region IMethodInterceptor implementation /// <summary> /// Implement this method to perform extra treatments before and after /// the call to the supplied <paramref name="invocation"/>. /// </summary> /// <param name="invocation">The method invocation that is being intercepted.</param> /// <returns> /// The result of the call to the /// <see cref="AopAlliance.Intercept.IJoinpoint.Proceed"/> method of /// the supplied <paramref name="invocation"/>; this return value may /// well have been intercepted by the interceptor. /// </returns> /// <remarks> /// <p> /// Polite implementations would certainly like to invoke /// <see cref="AopAlliance.Intercept.IJoinpoint.Proceed"/>. /// </p> /// </remarks> /// <exception cref="System.Exception"> /// If any of the interceptors in the chain or the target object itself /// throws an exception. /// </exception> public object Invoke(IMethodInvocation invocation) { IDictionary callContextDictionary = new Hashtable(); callContextDictionary.Add("method", invocation.Method); callContextDictionary.Add("args", invocation.Arguments); callContextDictionary.Add("target", invocation.Target); int numAttempts = 0; /* Exception failureException; do { numAttempts++; try { return invocation.Proceed(); } catch (Exception ex) { failureException = ex; } } while (numAttempts <= this.maxRetries); throw failureException; */ object returnVal = null; do { try { returnVal = invocation.Proceed(); break; } catch (Exception ex) { callContextDictionary.Add("e", ex); if (exceptionHandler.CanHandleException(ex, callContextDictionary)) { numAttempts++; if (numAttempts == MaxRetries) { throw; } else { //Sleep() } } } } while (numAttempts <= MaxRetries); log.Info("Invoked successfully after " + numAttempts + " attempt(s)"); return returnVal; } #endregion #region IInitializingObject implementation /// <summary> /// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/> /// after it has injected all of an object's dependencies. /// </summary> /// <remarks> /// <p> /// This method allows the object instance to perform the kind of /// initialization only possible when all of it's dependencies have /// been injected (set), and to throw an appropriate exception in the /// event of misconfiguration. /// </p> /// <p> /// Please do consult the class level documentation for the /// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a /// description of exactly <i>when</i> this method is invoked. In /// particular, it is worth noting that the /// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/> /// and <see cref="Spring.Context.IApplicationContextAware"/> /// callbacks will have been invoked <i>prior</i> to this method being /// called. /// </p> /// </remarks> /// <exception cref="System.Exception"> /// In the event of misconfiguration (such as the failure to set a /// required property) or if initialization fails. /// </exception> public void AfterPropertiesSet() { if (exceptionHandler == null) { throw new ArgumentException("Must specify retry expression."); } IExceptionHandler handler = Parse(retryExpression); if (handler == null) { throw new ArgumentException("Was not able to parse exception handler string [" + retryExpression + "]"); } exceptionHandler = handler; } #endregion /// <summary> /// Parses the specified handler string. /// </summary> /// <param name="handlerString">The handler string.</param> /// <returns></returns> protected virtual IExceptionHandler Parse(string handlerString) { return null; } } } --- NEW FILE: AbstractExceptionHandler.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System; using System.Collections; using System.Reflection; using Common.Logging; using Spring.Expressions; namespace Spring.Aspects { /// <summary> /// An abstract base class providing all necessary functionality for typical IExceptionHandler implementations. /// </summary> /// <author>Mark Pollack</author> /// <version>$Id: AbstractExceptionHandler.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public abstract class AbstractExceptionHandler : IExceptionHandler { #region Fields /// <summary> /// The logging instance /// </summary> protected readonly ILog log = LogManager.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType); private IList sourceExceptionNames = new ArrayList(); private IList sourceExceptionTypes = new ArrayList(); private string actionExpressionText; private bool continueProcessing = false; private string constraintExpressionText; #endregion #region Constructor(s) /// <summary> /// Initializes a new instance of the <see cref="AbstractExceptionHandler"/> class. /// </summary> public AbstractExceptionHandler() { log = LogManager.GetLogger(GetType()); } /// <summary> /// Initializes a new instance of the <see cref="AbstractExceptionHandler"/> class. /// </summary> /// <param name="exceptionNames">The exception names.</param> public AbstractExceptionHandler(string[] exceptionNames) { log = LogManager.GetLogger(GetType()); foreach (string exceptionName in exceptionNames) { SourceExceptionNames.Add(exceptionName); } } #endregion #region Implementation of IExceptionHandler #region Properties /// <summary> /// Gets the source exception names. /// </summary> /// <value>The source exception names.</value> public IList SourceExceptionNames { get { return sourceExceptionNames; } set { sourceExceptionNames = value; } } /// <summary> /// Gets the source exception types. /// </summary> /// <value>The source exception types.</value> public IList SourceExceptionTypes { get { return sourceExceptionTypes; } set { sourceExceptionTypes = value; } } /// <summary> /// Gets the action translation expression text /// </summary> /// <value>The action translation expression.</value> public string ActionExpressionText { get { return actionExpressionText; } set { actionExpressionText = value; } } /// <summary> /// Gets or sets the constraint expression text. /// </summary> /// <value>The constraint expression text.</value> public string ConstraintExpressionText { get { return constraintExpressionText; } set { constraintExpressionText = value; } } /// <summary> /// Gets a value indicating whether to continue processing. /// </summary> /// <value><c>true</c> if continue processing; otherwise, <c>false</c>.</value> public bool ContinueProcessing { get { return continueProcessing; } set { continueProcessing = value; } } #endregion /// <summary> /// Determines whether this instance can handle the exception the specified exception. /// </summary> /// <param name="ex">The exception.</param> /// <param name="callContextDictionary">The call context dictionary.</param> /// <returns> /// <c>true</c> if this instance can handle the specified exception; otherwise, <c>false</c>. /// </returns> public bool CanHandleException(Exception ex, IDictionary callContextDictionary) { if (SourceExceptionNames != null) { foreach (string exceptionName in SourceExceptionNames) { if (ex.GetType().Name.IndexOf(exceptionName) >= 0) { return true; } } } if (ConstraintExpressionText != null) { IExpression expression = Expression.Parse(ConstraintExpressionText); bool canProcess; try { canProcess = (bool) expression.GetValue(null, callContextDictionary); } catch (InvalidCastException e) { log.Warn("Was not able to unbox constraint expression to boolean [" + ConstraintExpressionText + "]", e); return false; } catch (Exception e) { log.Warn("Was not able to evaluate constraint expression [" + ConstraintExpressionText + "]",e); return false; } return canProcess; } return false; } /// <summary> /// Handles the exception. /// </summary> /// <returns>The return value from handling the exception, if not rethrown or a new exception is thrown.</returns> public abstract object HandleException(IDictionary callContextDictionary); #endregion } } --- NEW FILE: ParsedAdviceExpression.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 namespace Spring.Aspects { /// <summary> /// This class contains the results of parsing an advice expresion of the form /// on exception name [ExceptionName1,ExceptionName2,...] [action] [action expression] /// or /// on exception [constraint expression] [action] [action expression] /// </summary> /// <remarks> /// /// </remarks> /// <author>Mark Pollack</author> /// <version>$Id: ParsedAdviceExpression.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public class ParsedAdviceExpression { private string adviceExpression; private string[] exceptionNames = new string[0]; private string constraintExpression = null; private string actionExpressionText = null; private string actionText = null; private bool success; /// <summary> /// Initializes a new instance of the <see cref="ParsedAdviceExpression"/> class. /// </summary> /// <param name="adviceExpression">The advice expression.</param> public ParsedAdviceExpression(string adviceExpression) { this.adviceExpression = adviceExpression; } /// <summary> /// Gets or sets the advice expression. /// </summary> /// <value>The advice expression.</value> public string AdviceExpression { get { return adviceExpression; } set { adviceExpression = value; } } /// <summary> /// Gets or sets the exception names. /// </summary> /// <value>The exception names.</value> public string[] ExceptionNames { get { return exceptionNames; } set { exceptionNames = value; } } /// <summary> /// Gets or sets the constraint expression. /// </summary> /// <value>The constraint expression.</value> public string ConstraintExpression { get { return constraintExpression; } set { constraintExpression = value; } } /// <summary> /// Gets or sets the action expression text. /// </summary> /// <value>The action expression text.</value> public string ActionExpressionText { get { return actionExpressionText; } set { actionExpressionText = value; } } /// <summary> /// Gets or sets the action text. /// </summary> /// <value>The action text.</value> public string ActionText { get { return actionText; } set { actionText = value; } } /// <summary> /// Gets or sets a value indicating whether this <see cref="ParsedAdviceExpression"/> is success. /// </summary> /// <value><c>true</c> if success; otherwise, <c>false</c>.</value> public bool Success { get { return success; } set { success = value; } } } } |
From: Mark P. <mar...@us...> - 2007-10-08 22:05:20
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9622/Logging Added Files: AbstractLoggingAdvice.cs SimpleLoggingAdvice.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop --- NEW FILE: SimpleLoggingAdvice.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System; using System.Reflection; using System.Text; using AopAlliance.Intercept; using Common.Logging; namespace Spring.Aspects.Logging { /// <summary> /// This is /// </summary> /// <remarks> /// /// </remarks> /// <author>Mark Pollack</author> /// <version>$Id: SimpleLoggingAdvice.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public class SimpleLoggingAdvice : AbstractLoggingAdvice { #region Fields /// <summary> /// Flag to indicate if unique identifier should be in the log message. /// </summary> private bool logUniqueIdentifier; /// <summary> /// Flag to indicate if the execution time should be in the log message. /// </summary> private bool logExecutionTime; /// <summary> /// Flag to indicate if the method arguments should be in the log message. /// </summary> private bool logMethodArguments; /// <summary> /// The seperator string to use for delmiting log message fields. /// </summary> private string seperator = ", "; /// <summary> /// The log level to use for logging the entry, exit, exception messages. /// </summary> private LogLevel logLevel = LogLevel.Trace; #endregion #region Constructor(s) /// <summary> /// Initializes a new instance of the <see cref="SimpleLoggingAdvice"/> class. /// </summary> public SimpleLoggingAdvice() { } /// <summary> /// Initializes a new instance of the <see cref="SimpleLoggingAdvice"/> class. /// </summary> /// <param name="useDynamicLogger">if set to <c>true</c> to use dynamic logger, if /// <c>false</c> use static logger.</param> public SimpleLoggingAdvice(bool useDynamicLogger) { UseDynamicLogger = useDynamicLogger; } #endregion /// <summary> /// Gets or sets a value indicating whether to log a unique identifier with the log message. /// </summary> /// <value><c>true</c> if [log unique identifier]; otherwise, <c>false</c>.</value> public bool LogUniqueIdentifier { get { return logUniqueIdentifier; } set { logUniqueIdentifier = value; } } /// <summary> /// Gets or sets a value indicating whether to log execution time. /// </summary> /// <value><c>true</c> if log execution time; otherwise, <c>false</c>.</value> public bool LogExecutionTime { get { return logExecutionTime; } set { logExecutionTime = value; } } /// <summary> /// Gets or sets a value indicating whether log method arguments. /// </summary> /// <value><c>true</c> if log method arguments]; otherwise, <c>false</c>.</value> public bool LogMethodArguments { get { return logMethodArguments; } set { logMethodArguments = value; } } /// <summary> /// Gets or sets the seperator string to use for delmiting log message fields. /// </summary> /// <value>The seperator.</value> public string Seperator { get { return seperator; } set { seperator = value; } } /// <summary> /// Gets or sets the entry log level. /// </summary> /// <value>The entry log level.</value> public LogLevel LogLevel { get { return logLevel; } set { logLevel = value; } } #region Protected Methods /// <summary> /// Subclasses must override this method to perform any tracing around the supplied /// IMethodInvocation. /// </summary> /// <param name="invocation">The method invocation to log</param> /// <param name="log">The log to write messages to</param> /// <returns> /// The result of the call to IMethodInvocation.Proceed() /// </returns> /// <remarks> /// Subclasses are resonsible for ensuring that the IMethodInvocation actually executes /// by calling IMethodInvocation.Proceed(). /// <para> /// By default, the passed-in ILog instance will have log level /// "trace" enabled. Subclasses do not have to check for this again, unless /// they overwrite the IsInterceptorEnabled method to modify /// the default behavior. /// </para> /// </remarks> /// <exception cref="System.Exception"> /// If any of the interceptors in the chain or the target object itself /// throws an exception. /// </exception> protected override object InvokeUnderLog(IMethodInvocation invocation, ILog log) { object returnValue = null; bool exitThroughException = false; DateTime startTime = DateTime.Now; string uniqueIdentifier = null; if (LogUniqueIdentifier) { uniqueIdentifier = CreateUniqueIdentifier(); } try { WriteToLog(LogLevel, log, GetEntryMessage(invocation, uniqueIdentifier), null); returnValue = invocation.Proceed(); return returnValue; } catch (Exception e) { TimeSpan executionTimeSpan = DateTime.Now - startTime; WriteToLog(LogLevel, log, GetExceptionMessage(invocation, e, executionTimeSpan, uniqueIdentifier), e); exitThroughException = true; throw; } finally { if (!exitThroughException) { TimeSpan executionTimeSpan = DateTime.Now - startTime; WriteToLog(LogLevel, log, GetExitMessage(invocation, returnValue, executionTimeSpan, uniqueIdentifier), null); } } } /// <summary> /// Creates a unique identifier. /// </summary> /// <remarks> /// Default implementation uses Guid.NewGuid(). Subclasses may override to provide an alternative /// ID generation implementation. /// </remarks> /// <returns>A unique identifier</returns> protected virtual string CreateUniqueIdentifier() { return Guid.NewGuid().ToString(); } /// <summary> /// Gets the entry message to log /// </summary> /// <param name="invocation">The invocation.</param> /// <param name="idString">The id string.</param> /// <returns>The entry log message</returns> protected virtual string GetEntryMessage(IMethodInvocation invocation, string idString) { StringBuilder sb = new StringBuilder(128); sb.Append("Entering "); AppendCommonInformation(sb, invocation, idString); if (logMethodArguments) { sb.Append(GetMethodArgumentAsString(invocation)).Append(Seperator); } return RemoveLastSeparator(sb, Seperator); } /// <summary> /// Gets the exception message. /// </summary> /// <param name="invocation">The method invocation.</param> /// <param name="e">The thown exception.</param> /// <param name="executionTimeSpan">The execution time span.</param> /// <param name="idString">The id string.</param> /// <returns>The exception log message.</returns> protected virtual string GetExceptionMessage(IMethodInvocation invocation, Exception e, TimeSpan executionTimeSpan, string idString) { StringBuilder sb = new StringBuilder(128); sb.Append("Exception thrown in "); sb.Append(invocation.Method.Name); AppendCommonInformation(sb, invocation, idString); if (LogExecutionTime) { sb.Append(executionTimeSpan.TotalMilliseconds); } return sb.ToString(); } /// <summary> /// Gets the exit log message. /// </summary> /// <param name="invocation">The method invocation.</param> /// <param name="returnValue">The return value.</param> /// <param name="executionTimeSpan">The execution time span.</param> /// <param name="idString">The id string.</param> /// <returns>the exit log message</returns> protected virtual string GetExitMessage(IMethodInvocation invocation, object returnValue, TimeSpan executionTimeSpan, string idString) { StringBuilder sb = new StringBuilder(128); sb.Append("Exiting "); AppendCommonInformation(sb, invocation, idString); if (LogExecutionTime) { sb.Append(executionTimeSpan.TotalMilliseconds).Append(" ms").Append(Seperator); } sb.Append("return=").Append(returnValue); return sb.ToString(); } /// <summary> /// Appends common information across entry,exit, exception logging /// </summary> /// <remarks>Add method name and unique identifier if required.</remarks> /// <param name="sb">The string buffer building logging message.</param> /// <param name="invocation">The method invocation.</param> /// <param name="idString">The unique identifier string.</param> protected virtual void AppendCommonInformation(StringBuilder sb, IMethodInvocation invocation, string idString) { sb.Append(invocation.Method.Name); if (LogUniqueIdentifier) { sb.Append(Seperator).Append(idString); } sb.Append(Seperator); } /// <summary> /// Gets the method argument as argumen name/value pairs. /// </summary> /// <param name="invocation">The method invocation.</param> /// <returns>string for logging method argument name and values.</returns> protected virtual string GetMethodArgumentAsString(IMethodInvocation invocation) { StringBuilder sb = new StringBuilder(128); ParameterInfo[] parameterInfos = invocation.Method.GetParameters(); object[] argValues = invocation.Arguments; for (int i=0; i< parameterInfos.Length; i++) { sb.Append(parameterInfos[i].Name).Append("=").Append(argValues[i]); if (i != parameterInfos.Length) sb.Append("; "); } return RemoveLastSeparator(sb, "; "); } #endregion #region Private Methods private string RemoveLastSeparator(StringBuilder sb, string seperator) { string s = sb.ToString(); if (s.EndsWith(seperator)) { return s.Remove(s.Length - seperator.Length); } else { return s; } } private void WriteToLog(LogLevel logLevel, ILog log, string text, Exception e) { switch (logLevel) { case LogLevel.All: case LogLevel.Trace: if (log.IsTraceEnabled) { if (e == null) log.Trace(text); else log.Trace(text, e); } break; case LogLevel.Debug: if (log.IsDebugEnabled) { if (e == null) log.Debug(text); else log.Debug(text, e); } break; case LogLevel.Error: if (log.IsErrorEnabled) { if (e == null) log.Error(text); else log.Error(text, e); } break; case LogLevel.Fatal: if (log.IsFatalEnabled) { if (e == null) log.Fatal(text); else log.Fatal(text, e); } break; case LogLevel.Info: if (log.IsInfoEnabled) { if (e == null) log.Info(text); else log.Info(text, e); } break; case LogLevel.Warn: if (log.IsWarnEnabled) { if (e == null) log.Warn(text); else log.Warn(text, e); } break; case LogLevel.Off: default: break; } } #endregion } } --- NEW FILE: AbstractLoggingAdvice.cs --- #region License /* * Copyright 2002-2007 the original author or authors. * * 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 using System; using System.Reflection; using AopAlliance.Intercept; using Common.Logging; using Spring.Aop.Framework; namespace Spring.Aspects.Logging { /// <summary> /// Abstract base class for logging advice /// </summary> /// <remarks> /// /// </remarks> /// <author>Mark Pollack</author> /// <version>$Id: AbstractLoggingAdvice.cs,v 1.1 2007/10/08 22:05:16 markpollack Exp $</version> public abstract class AbstractLoggingAdvice : IMethodInterceptor { #region Fields /// <summary> /// The default <code>ILog</code> instance used to write logging messages. /// </summary> protected ILog defaultLogger = LogManager.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType); /// <summary> /// Indicates whether or not proxy type names should be hidden when using dynamic loggers. /// </summary> private bool hideProxyTypeNames = false; #endregion #region Properties /// <summary> /// Sets a value indicating whether to use a dynamic logger or static logger /// </summary> /// <remarks>Default is to use a static logger. /// <para> /// Used to determine which ILog instance should be used to write log messages for /// a particular method invocation: a dynamic one for the Type getting called, /// or a static one for the Type of the trace interceptor. /// </para> /// <para> /// Specify either this property or LoggerName, not both. /// </para> /// </remarks> /// <value><c>true</c> if use dynamic logger; otherwise, <c>false</c>.</value> public bool UseDynamicLogger { set { defaultLogger = (value ? null : LogManager.GetLogger(GetType())); } } /// <summary> /// Sets the name of the logger to use. /// </summary> /// <remarks> /// The name will be passed to the underlying logging implementation through Common.Logging, /// getting interpreted as the log category according to the loggers configuration. /// <para> /// This can be specified to not log into the category of a Type (whether this /// interceptor's class or the class getting called) but rather to a specific named category. /// </para> /// <para> /// Specify either this property or UseDynamicLogger, but not both. /// </para> /// </remarks> /// <value>The name of the logger.</value> public string LoggerName { set { defaultLogger = LogManager.GetLogger(value); } } /// <summary> /// Sets a value indicating whether hide proxy type names (whenever possible) /// when using dynamic loggers, i.e. property UseDynamicLogger is set to true. /// </summary> /// <value><c>true</c> if [hide proxy type names]; otherwise, <c>false</c>.</value> public bool HideProxyTypeNames { set { hideProxyTypeNames = value; } } #endregion #region Methods /// <summary> /// Adds logging to the method invocation. /// </summary> /// <remarks> /// The method IsInterceptorEnabled is called /// as an optimization to determine if logging should be applied. If logging should be /// applied, the method invocation is passed to the InvokeUnderLog method for handling. /// If not, the method proceeds as normal. /// </remarks> /// <param name="invocation"> /// The method invocation that is being intercepted. /// </param> /// <returns> /// The result of the call to the /// <see cref="AopAlliance.Intercept.IJoinpoint.Proceed"/> method of /// the supplied <paramref name="invocation"/>; this return value may /// well have been intercepted by the interceptor. /// </returns> /// <exception cref="System.Exception"> /// If any of the interceptors in the chain or the target object itself /// throws an exception. /// </exception> public object Invoke(IMethodInvocation invocation) { object o = invocation.This; ILog log = GetLoggerForInvocation(invocation); if (IsInterceptorEnabled(invocation, log)) { return InvokeUnderLog(invocation, log); } else { return invocation.Proceed(); } } /// <summary> /// Determines whether the interceptor is enabled for the specified invocation, that /// is, whether the method InvokeUnderLog is called. /// </summary> /// <remarks>The default behavior is to check whether the given ILog instance /// is enabled by calling IsLogEnabled, whose default behavior is to check if /// the TRACE level of logging is enabled. Subclasses</remarks> /// <param name="invocation">The invocation.</param> /// <param name="log">The log to write messages to</param> /// <returns> /// <c>true</c> if [is interceptor enabled] [the specified invocation]; otherwise, <c>false</c>. /// </returns> protected virtual bool IsInterceptorEnabled(IMethodInvocation invocation, ILog log) { return IsLogEnabled(log); } /// <summary> /// Determines whether the given log is enabled. /// </summary> /// <remarks> /// Default is true when the trace level is enabled. Subclasses may override this /// to change the level at which logging occurs, or return true to ignore level /// checks.</remarks> /// <param name="log">The log instance to check.</param> /// <returns> /// <c>true</c> if log is for a given log level; otherwise, <c>false</c>. /// </returns> private bool IsLogEnabled(ILog log) { return log.IsTraceEnabled; } /// <summary> /// Subclasses must override this method to perform any tracing around the supplied /// IMethodInvocation. /// </summary> /// <remarks> /// Subclasses are resonsible for ensuring that the IMethodInvocation actually executes /// by calling IMethodInvocation.Proceed(). /// <para> /// By default, the passed-in ILog instance will have log level /// "trace" enabled. Subclasses do not have to check for this again, unless /// they overwrite the IsInterceptorEnabled method to modify /// the default behavior. /// </para> /// </remarks> /// <param name="invocation">The method invocation to log</param> /// <param name="log">The log to write messages to</param> /// <returns>The result of the call to IMethodInvocation.Proceed() /// </returns> /// <exception cref="System.Exception"> /// If any of the interceptors in the chain or the target object itself /// throws an exception. /// </exception> protected abstract object InvokeUnderLog(IMethodInvocation invocation, ILog log); /// <summary> /// Gets the appropriate log instance to use for the given IMethodInvocation. /// </summary> /// <remarks> /// If the UseDynamicLogger property is set to true, the ILog instance will be /// for the target class of the IMethodInvocation, otherwise the log will be the /// default static logger. /// </remarks> /// <param name="invocation">The method invocation being logged.</param> /// <returns>The ILog instance to use.</returns> protected virtual ILog GetLoggerForInvocation(IMethodInvocation invocation) { if (defaultLogger != null) { return defaultLogger; } else { object target = invocation.This; Type logCategoryType = target.GetType(); if (hideProxyTypeNames) { logCategoryType = AopUtils.GetTargetType(target); } return LogManager.GetLogger(logCategoryType); } } #endregion } } |
From: Mark P. <mar...@us...> - 2007-10-08 22:05:19
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Exceptions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9622/Exceptions Modified Files: ExceptionHandlerAdvice.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: ExceptionHandlerAdvice.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExceptionHandlerAdvice.cs 2 Oct 2007 21:56:53 -0000 1.5 --- ExceptionHandlerAdvice.cs 8 Oct 2007 22:05:16 -0000 1.6 *************** *** 23,26 **** --- 23,27 ---- using System.Reflection; using System.Text.RegularExpressions; + using System.Threading; using AopAlliance.Intercept; using Common.Logging; *************** *** 70,74 **** /// <author>Mark Pollack</author> /// <version>$Id$</version> ! public class ExceptionHandlerAdvice : IMethodInterceptor, IInitializingObject { #region Fields --- 71,75 ---- /// <author>Mark Pollack</author> /// <version>$Id$</version> ! public class ExceptionHandlerAdvice : AbstractExceptionHandlerAdvice { #region Fields *************** *** 78,81 **** --- 79,86 ---- private IList exceptionHandlers = new ArrayList(); + private string onExceptionNameRegex = @"^(on\s+exception\s+name)\s+(.*?)\s+(log|translate|wrap|replace|return|swallow)\s*(.*?)$"; + + private string onExceptionRegex = @"^(on\s+exception\s+)(\(.*?\))\s+(log|translate|wrap|replace|return|swallow)\s*(.*?)$"; + #endregion *************** *** 83,86 **** --- 88,111 ---- /// <summary> + /// Gets or sets the Regex string used to parse advice expressions starting with 'on exception name' and exception handling actions. + /// </summary> + /// <value>The regex string to parse advice expressions starting with 'on exception name' and exception handling actions.</value> + public override string OnExceptionNameRegex + { + get { return onExceptionNameRegex; } + set { onExceptionNameRegex = value; } + } + + /// <summary> + /// Gets or sets the Regex string used to parse advice expressions starting with 'on exception (constraint)' and exception handling actions. + /// </summary> + /// <value>The regex string to parse advice expressions starting with 'on exception (constraint)' and exception handling actions.</value> + public override string OnExceptionRegex + { + get { return onExceptionRegex; } + set { onExceptionRegex = value; } + } + + /// <summary> /// Gets or sets the exception handler. /// </summary> *************** *** 119,123 **** /// throws an exception. /// </exception> ! public object Invoke(IMethodInvocation invocation) { try --- 144,148 ---- /// throws an exception. /// </exception> ! public override object Invoke(IMethodInvocation invocation) { try *************** *** 138,142 **** if (returnVal.Equals("logged")) { ! throw ex; } --- 163,167 ---- if (returnVal.Equals("logged")) { ! throw; } *************** *** 146,150 **** if (returnVal.Equals("nomatch")) { ! throw ex; } else --- 171,175 ---- if (returnVal.Equals("nomatch")) { ! throw; } else *************** *** 193,197 **** /// required property) or if initialization fails. /// </exception> ! public void AfterPropertiesSet() { if (exceptionHandlers.Count == 0) --- 218,222 ---- /// required property) or if initialization fails. /// </exception> ! public override void AfterPropertiesSet() { if (exceptionHandlers.Count == 0) *************** *** 206,209 **** --- 231,239 ---- { IExceptionHandler handler = Parse(handlerString); + if (handler == null) + { + throw new ArgumentException("Was not able to parse exception handler string [" + handlerString + + "]"); + } newExceptionHandlers.Add(handler); } *************** *** 253,292 **** /// </summary> /// <param name="handlerString">The handler string.</param> ! /// <returns>an instance of an exception handler.</returns> protected virtual IExceptionHandler Parse(string handlerString) { ! // parts to parse out of string ! string[] exceptionNames = new string[0]; ! string constraintExpression = null; ! string actionExpressionText = null; ! string actionText = null; ! ! // is string of expected format? ! bool success = false; ! Match match = GetMatchUsingExceptionNames(handlerString); ! if (match.Success) ! { ! success = true; ! //using exception names for exception filter ! exceptionNames = StringUtils.CommaDelimitedListToStringArray(match.Groups[2].Value.Trim()); ! actionText = match.Groups[3].Value.Trim(); ! actionExpressionText = match.Groups[4].Value.Trim(); ! } ! else ! { ! match = GetMatchUsingExceptionConstraintExpression(handlerString); ! if (match.Success) ! { ! success = true; ! //using constratin expression for exception filter ! constraintExpression = match.Groups[2].Value.Trim().Remove(0, 1); ! constraintExpression = constraintExpression.Substring(0, constraintExpression.Length - 1); ! actionText = match.Groups[3].Value.Trim(); ! actionExpressionText = match.Groups[4].Value.Trim(); ! } ! } ! ! if (!success) { log.Warn("Could not parse exception hander statement " + handlerString); --- 283,293 ---- /// </summary> /// <param name="handlerString">The handler string.</param> ! /// <returns>an instance of an exception handler or null if was not able to correctly parse ! /// handler string.</returns> protected virtual IExceptionHandler Parse(string handlerString) { ! ParsedAdviceExpression parsedAdviceExpression = ParseAdviceExpression(handlerString); ! if (!parsedAdviceExpression.Success) { log.Warn("Could not parse exception hander statement " + handlerString); *************** *** 294,348 **** } ! ! return CreateExceptionHandler(handlerString, exceptionNames, constraintExpression, actionText, actionExpressionText); } ! private static IExceptionHandler CreateExceptionHandler(string handlerString, string[] exceptionNames, string constraintExpression, string actionText, string actionExpressionText) { ! if (actionText.IndexOf("log") >= 0) { //TODO support user selection of level, log.Debug , log.Info etc. ! LogExceptionHandler handler = new LogExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; ! handler.ActionExpressionText = "#log.Debug(" + actionExpressionText + ")"; return handler; } ! else if (actionText.IndexOf("translate") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; ! handler.ActionExpressionText = actionExpressionText; return handler; } ! else if (actionText.IndexOf("wrap") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; ! handler.ActionExpressionText = ParseWrappedExceptionExpression("wrap", handlerString); return handler; } ! else if (actionText.IndexOf("replace") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; ! handler.ActionExpressionText = ParseWrappedExceptionExpression("replace", handlerString); return handler; } ! else if (actionText.IndexOf("swallow") >= 0) { ! SwallowExceptionHandler handler = new SwallowExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; return handler; } ! else if (actionText.IndexOf("return") >= 0) { ! ReturnValueExceptionHandler handler = new ReturnValueExceptionHandler(exceptionNames); ! handler.ConstraintExpressionText = constraintExpression; ! handler.ActionExpressionText = actionExpressionText; return handler; } else { ! log.Warn("Could not parse exception hander statement " + handlerString); } return null; --- 295,348 ---- } ! return CreateExceptionHandler(parsedAdviceExpression); } ! private static IExceptionHandler CreateExceptionHandler(ParsedAdviceExpression parsedAdviceExpression) { ! if (parsedAdviceExpression.ActionText.IndexOf("log") >= 0) { //TODO support user selection of level, log.Debug , log.Info etc. ! LogExceptionHandler handler = new LogExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; ! handler.ActionExpressionText = "#log.Debug(" + parsedAdviceExpression.ActionExpressionText + ")"; return handler; } ! else if (parsedAdviceExpression.ActionText.IndexOf("translate") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; ! handler.ActionExpressionText = parsedAdviceExpression.ActionExpressionText; return handler; } ! else if (parsedAdviceExpression.ActionText.IndexOf("wrap") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; ! handler.ActionExpressionText = ParseWrappedExceptionExpression("wrap", parsedAdviceExpression.AdviceExpression); return handler; } ! else if (parsedAdviceExpression.ActionText.IndexOf("replace") >= 0) { ! TranslationExceptionHandler handler = new TranslationExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; ! handler.ActionExpressionText = ParseWrappedExceptionExpression("replace", parsedAdviceExpression.AdviceExpression); return handler; } ! else if (parsedAdviceExpression.ActionText.IndexOf("swallow") >= 0) { ! SwallowExceptionHandler handler = new SwallowExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; return handler; } ! else if (parsedAdviceExpression.ActionText.IndexOf("return") >= 0) { ! ReturnValueExceptionHandler handler = new ReturnValueExceptionHandler(parsedAdviceExpression.ExceptionNames); ! handler.ConstraintExpressionText = parsedAdviceExpression.ConstraintExpression; ! handler.ActionExpressionText = parsedAdviceExpression.ActionExpressionText; return handler; } else { ! log.Warn("Could not parse exception hander statement " + parsedAdviceExpression.AdviceExpression); } return null; *************** *** 384,402 **** } - private Match GetMatchUsingExceptionNames(string handlerString) - { - string regex = @"^(on\s+exception\s+name)\s+(.*?)\s+(log|translate|wrap|replace|return|swallow)\s*(.*?)$"; - RegexOptions options = ((RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline) | RegexOptions.IgnoreCase); - Regex reg = new Regex(regex, options); - return reg.Match(handlerString); - } - private Match GetMatchUsingExceptionConstraintExpression(string handlerString) - { - string regex = @"^(on\s+exception\s+)(\(.*?\))\s+(log|translate|wrap|replace|return|swallow)\s*(.*?)$"; - RegexOptions options = ((RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline) | RegexOptions.IgnoreCase); - Regex reg = new Regex(regex, options); - return reg.Match(handlerString); - } #endregion --- 384,388 ---- |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:56
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200/Aop/Framework/DynamicProxy Modified Files: AdvisedProxy.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: AdvisedProxy.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy/AdvisedProxy.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AdvisedProxy.cs 3 Aug 2007 14:38:30 -0000 1.8 --- AdvisedProxy.cs 8 Oct 2007 22:04:51 -0000 1.9 *************** *** 414,417 **** --- 414,431 ---- #endregion + + #region ITargetTypeAware implementation + + /// <summary> + /// Gets the target type behind the implementing object. + /// Ttypically a proxy configuration or an actual proxy. + /// </summary> + /// <value>The type of the target or null if not known.</value> + public Type TargetType + { + get { return m_targetType; } + } + + #endregion } } \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:56
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200/Aop Modified Files: ITargetSource.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: ITargetSource.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/ITargetSource.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ITargetSource.cs 9 Apr 2006 07:18:36 -0000 1.7 --- ITargetSource.cs 8 Oct 2007 22:04:51 -0000 1.8 *************** *** 48,57 **** /// <author>Aleksandar Seovic (.NET)</author> /// <version>$Id$</version> ! public interface ITargetSource { - /// <summary> - /// The <see cref="System.Type"/> of the target object. - /// </summary> - Type TargetType { get; } /// <summary> --- 48,53 ---- /// <author>Aleksandar Seovic (.NET)</author> /// <version>$Id$</version> ! public interface ITargetSource : ITargetTypeAware { /// <summary> |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:55
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200 Modified Files: Spring.Aop.2005.csproj Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: Spring.Aop.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Spring.Aop.2005.csproj,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Spring.Aop.2005.csproj 14 Sep 2007 15:45:50 -0000 1.35 --- Spring.Aop.2005.csproj 8 Oct 2007 22:04:51 -0000 1.36 *************** *** 267,270 **** --- 267,271 ---- <SubType>Code</SubType> </Compile> + <Compile Include="Aop\ITargetTypeAware.cs" /> <Compile Include="Aop\IThrowsAdvice.cs"> <SubType>Code</SubType> *************** *** 379,382 **** --- 380,384 ---- <SubType>Code</SubType> </Compile> + <Compile Include="Aspects\AbstractExceptionHandlerAdvice.cs" /> <Compile Include="Aspects\Cache\CacheAspect.cs" /> <Compile Include="Aspects\Cache\BaseCacheAdvice.cs" /> *************** *** 387,397 **** <Compile Include="Aspects\Cache\InvalidateCacheAdvisor.cs" /> <Compile Include="Aspects\Cache\InvalidateCacheAdvice.cs" /> - <Compile Include="Aspects\Exceptions\AbstractExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\ExceptionHandlerAdvice.cs" /> - <Compile Include="Aspects\Exceptions\IExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\LogExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\ReturnValueExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\SwallowExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\TranslationExceptionHandler.cs" /> <Compile Include="AssemblyInfo.cs"> <SubType>Code</SubType> --- 389,403 ---- <Compile Include="Aspects\Cache\InvalidateCacheAdvisor.cs" /> <Compile Include="Aspects\Cache\InvalidateCacheAdvice.cs" /> <Compile Include="Aspects\Exceptions\ExceptionHandlerAdvice.cs" /> <Compile Include="Aspects\Exceptions\LogExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\ReturnValueExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\SwallowExceptionHandler.cs" /> <Compile Include="Aspects\Exceptions\TranslationExceptionHandler.cs" /> + <Compile Include="Aspects\Logging\AbstractLoggingAdvice.cs" /> + <Compile Include="Aspects\Logging\SimpleLoggingAdvice.cs" /> + <Compile Include="Aspects\ParsedAdviceExpression.cs" /> + <Compile Include="Aspects\RetryAdvice.cs" /> + <Compile Include="Aspects\AbstractExceptionHandler.cs" /> + <Compile Include="Aspects\IExceptionHandler.cs" /> <Compile Include="AssemblyInfo.cs"> <SubType>Code</SubType> *************** *** 415,418 **** --- 421,427 ---- </ProjectReference> </ItemGroup> + <ItemGroup> + <Folder Include="Aspects\Common\" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:55
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Target In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200/Aop/Target Modified Files: EmptyTargetSource.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: EmptyTargetSource.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Target/EmptyTargetSource.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EmptyTargetSource.cs 9 Apr 2006 07:18:37 -0000 1.3 --- EmptyTargetSource.cs 8 Oct 2007 22:04:51 -0000 1.4 *************** *** 148,151 **** --- 148,153 ---- } + + [Serializable] private sealed class EmptyTargetSourceObjectReference : IObjectReference |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:55
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/AutoProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200/Aop/Framework/AutoProxy Modified Files: AbstractAutoProxyCreator.cs DefaultAdvisorAutoProxyCreator.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: DefaultAdvisorAutoProxyCreator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/DefaultAdvisorAutoProxyCreator.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DefaultAdvisorAutoProxyCreator.cs 3 Aug 2007 14:38:30 -0000 1.8 --- DefaultAdvisorAutoProxyCreator.cs 8 Oct 2007 22:04:51 -0000 1.9 *************** *** 40,43 **** --- 40,44 ---- public class DefaultAdvisorAutoProxyCreator : AbstractAdvisorAutoProxyCreator, IObjectNameAware, IInitializingObject { + /// <summary> /// Separator between prefix and remainder of object name *************** *** 46,50 **** --- 47,53 ---- private bool usePrefix; private string advisorObjectNamePrefix; + private IList advisors; + #region Properties /// <summary> *************** *** 71,74 **** --- 74,78 ---- } + #endregion /// <summary> /// Find all candidate advices to use in auto proxying. *************** *** 153,157 **** } ! private IList advisors; /// <summary> --- 157,161 ---- } ! /// <summary> *************** *** 182,185 **** --- 186,190 ---- set { + // If no infrastructure object name prefix has been set, override it. if (advisorObjectNamePrefix == null) { Index: AbstractAutoProxyCreator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AbstractAutoProxyCreator.cs 7 Sep 2007 01:51:49 -0000 1.12 --- AbstractAutoProxyCreator.cs 8 Oct 2007 22:04:51 -0000 1.13 *************** *** 24,27 **** --- 24,28 ---- using System.Collections; using System.Reflection; + using System.Runtime.Remoting; using AopAlliance.Aop; using Common.Logging; *************** *** 33,36 **** --- 34,38 ---- using Spring.Objects.Factory; using Spring.Objects.Factory.Config; + using Spring.Util; #endregion *************** *** 252,257 **** //ITargetSource targetSource = GetCustomTargetSource(obj.GetType(), objectName); ! ! object[] specificInterceptors = GetAdvicesAndAdvisorsForObject(obj.GetType(), objectName, null); // proxy if we have advice or if a TargetSourceCreator wants to do some --- 254,267 ---- //ITargetSource targetSource = GetCustomTargetSource(obj.GetType(), objectName); ! object[] specificInterceptors; ! if (RemotingServices.IsTransparentProxy(obj)) ! { ! specificInterceptors = GetAdvicesAndAdvisorsForObject(ObjectFactory.GetType(objectName), objectName, null); ! } ! else ! { ! specificInterceptors = GetAdvicesAndAdvisorsForObject(obj.GetType(), objectName, null); ! } ! // proxy if we have advice or if a TargetSourceCreator wants to do some |
From: Mark P. <mar...@us...> - 2007-10-08 22:04:54
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9200/Aop/Framework Modified Files: AdvisedSupport.cs AopUtils.cs IAdvised.cs Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: AdvisedSupport.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/AdvisedSupport.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** AdvisedSupport.cs 3 Aug 2007 14:38:30 -0000 1.33 --- AdvisedSupport.cs 8 Oct 2007 22:04:50 -0000 1.34 *************** *** 930,935 **** #endregion ! #region Properties /// <summary> /// Sets the target object that is to be advised. --- 930,948 ---- #endregion + #region ITargetTypeAware implementation ! /// <summary> ! /// Gets the target type behind the implementing object. ! /// Ttypically a proxy configuration or an actual proxy. ! /// </summary> ! /// <value>The type of the target or null if not known.</value> ! public Type TargetType ! { ! get { return TargetSource.TargetType; } ! } ! ! #endregion ! ! #region Properties /// <summary> /// Sets the target object that is to be advised. Index: IAdvised.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/IAdvised.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** IAdvised.cs 3 Aug 2007 14:38:30 -0000 1.13 --- IAdvised.cs 8 Oct 2007 22:04:50 -0000 1.14 *************** *** 51,55 **** /// <seealso cref="Spring.Aop.Framework.AdvisedSupport"/> [ProxyIgnore] ! public interface IAdvised { /// <summary> --- 51,55 ---- /// <seealso cref="Spring.Aop.Framework.AdvisedSupport"/> [ProxyIgnore] ! public interface IAdvised : ITargetTypeAware { /// <summary> Index: AopUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/AopUtils.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AopUtils.cs 2 Aug 2007 04:15:20 -0000 1.2 --- AopUtils.cs 8 Oct 2007 22:04:50 -0000 1.3 *************** *** 246,249 **** --- 246,268 ---- #endregion + + /// <summary> + /// Gets the type of the target. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns></returns> + public static Type GetTargetType(object candidate) + { + AssertUtils.ArgumentNotNull(candidate,"candidate", "Candidate object must not be null"); + if (candidate is ITargetTypeAware) + { + return ((ITargetTypeAware) candidate).TargetType; + } + if (IsDecoratorAopProxy(candidate)) + { + return candidate.GetType().BaseType; + } + return candidate.GetType(); + } } } \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-10-08 22:03:53
|
Update of /cvsroot/springnet/Spring.Net/lib/Net/2.0 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8786/2.0 Modified Files: Common.Logging.Log4Net.dll Common.Logging.Log4Net129.dll Common.Logging.NLog.dll Common.Logging.dll Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: Common.Logging.NLog.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/2.0/Common.Logging.NLog.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsV9b2dR and /tmp/cvsAh4QfU differ Index: Common.Logging.Log4Net129.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/2.0/Common.Logging.Log4Net129.dll,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvsUYC4cX and /tmp/cvsF8Ial0 differ Index: Common.Logging.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/2.0/Common.Logging.dll,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvs73BMbZ and /tmp/cvsZbXFr2 differ Index: Common.Logging.Log4Net.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/2.0/Common.Logging.Log4Net.dll,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvse1SvF3 and /tmp/cvsjPDW16 differ |
From: Mark P. <mar...@us...> - 2007-10-08 22:03:53
|
Update of /cvsroot/springnet/Spring.Net/lib/Net/1.0 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8786/1.0 Modified Files: Common.Logging.Log4Net.dll Common.Logging.Log4Net129.dll Common.Logging.NLog.dll Common.Logging.dll Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: Common.Logging.NLog.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.0/Common.Logging.NLog.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsdQieNS and /tmp/cvsaZP0NV differ Index: Common.Logging.Log4Net129.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.0/Common.Logging.Log4Net129.dll,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Binary files /tmp/cvstRMP1W and /tmp/cvsfS9L9Z differ Index: Common.Logging.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.0/Common.Logging.dll,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsroLC2Y and /tmp/cvsdDyai2 differ Index: Common.Logging.Log4Net.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.0/Common.Logging.Log4Net.dll,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvs7CyMp3 and /tmp/cvs1dw7L6 differ |
From: Mark P. <mar...@us...> - 2007-10-08 22:03:52
|
Update of /cvsroot/springnet/Spring.Net/lib/Net/1.1 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8786/1.1 Modified Files: Common.Logging.Log4Net.dll Common.Logging.Log4Net129.dll Common.Logging.NLog.dll Common.Logging.dll Log Message: Update to Common.Logging 1.2 Add Logging advice Refactoring of ExceptionHandlingAdvice start of retry advice misc improvements to spring.aop Index: Common.Logging.NLog.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.1/Common.Logging.NLog.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs1tav2S and /tmp/cvsRDtk3V differ Index: Common.Logging.Log4Net129.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.1/Common.Logging.Log4Net129.dll,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 Binary files /tmp/cvsjS6AhX and /tmp/cvsfJ9Ap0 differ Index: Common.Logging.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.1/Common.Logging.dll,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvsOmqYgZ and /tmp/cvsjgPBw2 differ Index: Common.Logging.Log4Net.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net/lib/Net/1.1/Common.Logging.Log4Net.dll,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvsYyVKm7 and /tmp/cvs45gsLa differ |
From: Mark P. <mar...@us...> - 2007-10-08 22:00:37
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Logging In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7515/Logging Log Message: Directory /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Logging added to the repository |
From: Mark P. <mar...@us...> - 2007-10-08 21:59:48
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7064/Logging Log Message: Directory /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging added to the repository |
From: Bruno B. <bb...@us...> - 2007-10-08 14:57:38
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29413 Modified Files: RemotingConfigurer.cs Log Message: Make current AppDomain's config file the default for RemotingConfigurer if filename==null [SPRNET-730] Index: RemotingConfigurer.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting/RemotingConfigurer.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RemotingConfigurer.cs 11 Sep 2007 20:56:27 -0000 1.6 --- RemotingConfigurer.cs 8 Oct 2007 14:57:34 -0000 1.7 *************** *** 47,50 **** --- 47,51 ---- private IResource _filename; + private bool _useConfigFile = true; private bool _ensureSecurity = false; *************** *** 64,72 **** /// <summary> ! /// Gets or sets the name of the remoting configurationn file. /// </summary> /// <remarks> /// If filename is <see langword="null"/> or not set, ! /// default remoting configuration will be used. /// </remarks> public IResource Filename --- 65,73 ---- /// <summary> ! /// Gets or sets the name of the remoting configuration file. /// </summary> /// <remarks> /// If filename is <see langword="null"/> or not set, ! /// current AppDomain's configuration file will be used. /// </remarks> public IResource Filename *************** *** 77,80 **** --- 78,94 ---- /// <summary> + /// Indicates whether a configuration file is used. + /// Default value is <see langword="true"/>. + /// </summary> + /// <remarks> + /// If <see langword="false"/>, default remoting configuration will be used. + /// </remarks> + public bool UseConfigFile + { + get { return _useConfigFile; } + set { _useConfigFile = value; } + } + + /// <summary> /// Gets or sets if security is enabled. /// </summary> *************** *** 110,114 **** public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory) { ! string filename = (Filename == null) ? null : Filename.File.FullName; #if NET_2_0 RemotingConfiguration.Configure(filename, EnsureSecurity); --- 124,134 ---- public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory) { ! string filename = null; ! if (UseConfigFile) ! { ! filename = (Filename == null) ! ? AppDomain.CurrentDomain.SetupInformation.ConfigurationFile ! : Filename.File.FullName; ! } #if NET_2_0 RemotingConfiguration.Configure(filename, EnsureSecurity); |
From: Bruno B. <bb...@us...> - 2007-10-08 14:57:38
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting/Config In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29413/Config Modified Files: RemotingNamespaceParser.cs spring-remoting-1.1.xsd Log Message: Make current AppDomain's config file the default for RemotingConfigurer if filename==null [SPRNET-730] Index: spring-remoting-1.1.xsd =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting/Config/spring-remoting-1.1.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** spring-remoting-1.1.xsd 7 Aug 2007 23:21:59 -0000 1.1 --- spring-remoting-1.1.xsd 8 Oct 2007 14:57:34 -0000 1.2 *************** *** 31,37 **** </xs:annotation> </xs:attribute> <xs:attribute name="ensureSecurity" type="xs:boolean" use="optional"> <xs:annotation> ! <xs:documentation>Indicates whether the security is enabled.</xs:documentation> </xs:annotation> </xs:attribute> --- 31,42 ---- </xs:annotation> </xs:attribute> + <xs:attribute name="useConfigFile" type="xs:boolean" use="optional"> + <xs:annotation> + <xs:documentation>Indicates whether a configuration file is used. Default is true.</xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="ensureSecurity" type="xs:boolean" use="optional"> <xs:annotation> ! <xs:documentation>Indicates whether the security is enabled. Default is false.</xs:documentation> </xs:annotation> </xs:attribute> Index: RemotingNamespaceParser.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting/Config/RemotingNamespaceParser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemotingNamespaceParser.cs 8 Aug 2007 00:34:59 -0000 1.2 --- RemotingNamespaceParser.cs 8 Oct 2007 14:57:34 -0000 1.3 *************** *** 154,157 **** --- 154,158 ---- string typeName = GetTypeName(element); string filename = element.GetAttribute(RemotingConfigurerConstants.FilenameAttribute); + string useConfigFile = element.GetAttribute(RemotingConfigurerConstants.UseConfigFileAttribute); string ensureSecurity = element.GetAttribute(RemotingConfigurerConstants.EnsureSecurityAttribute); *************** *** 161,164 **** --- 162,169 ---- properties.Add("Filename", filename); } + if (StringUtils.HasText(useConfigFile)) + { + properties.Add("UseConfigFile", useConfigFile); + } if (StringUtils.HasText(ensureSecurity)) { *************** *** 427,430 **** --- 432,436 ---- public const string RemotingConfigurerElement = "configurer"; public const string FilenameAttribute = "filename"; + public const string UseConfigFileAttribute = "useConfigFile"; public const string EnsureSecurityAttribute = "ensureSecurity"; } |
From: Bruno B. <bb...@us...> - 2007-10-05 17:06:44
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv337 Modified Files: ReflectionUtilsTests.cs Log Message: ContextRegistry.GetContext() / WebApplicationContext.Current should print a detailed error [SPRNET-475]. Index: ReflectionUtilsTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Util/ReflectionUtilsTests.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ReflectionUtilsTests.cs 20 Sep 2007 12:31:01 -0000 1.18 --- ReflectionUtilsTests.cs 5 Oct 2007 17:06:32 -0000 1.19 *************** *** 701,704 **** --- 701,748 ---- #endregion + #region GetExplicitBaseException + + [Test] + public void GetExplicitBaseExceptionWithNoInnerException() + { + Exception appEx = new ApplicationException(); + Exception ex = ReflectionUtils.GetExplicitBaseException(appEx); + + Assert.AreEqual(ex, appEx); + } + + [Test] + public void GetExplicitBaseExceptionWithInnerException() + { + Exception dbzEx = new DivideByZeroException(); + Exception appEx = new ApplicationException("Test message", dbzEx); + Exception ex = ReflectionUtils.GetExplicitBaseException(appEx); + + Assert.AreEqual(ex, dbzEx); + } + + [Test] + public void GetExplicitBaseExceptionWithInnerExceptions() + { + Exception dbzEx = new DivideByZeroException(); + Exception sEx = new SystemException("Test message", dbzEx); + Exception appEx = new ApplicationException("Test message", sEx); + Exception ex = ReflectionUtils.GetExplicitBaseException(appEx); + + Assert.AreEqual(ex, dbzEx); + } + + [Test] + public void GetExplicitBaseExceptionWithNullReferenceExceptionAsRootException() + { + Exception nrEx = new NullReferenceException(); + Exception appEx = new ApplicationException("Test message", nrEx); + Exception ex = ReflectionUtils.GetExplicitBaseException(appEx); + + Assert.AreEqual(ex, appEx); + } + + #endregion + #region Helper Methods |
From: Bruno B. <bb...@us...> - 2007-10-05 17:06:08
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32420 Modified Files: ObjectUtils.cs ReflectionUtils.cs Log Message: ContextRegistry.GetContext() / WebApplicationContext.Current should print a detailed error [SPRNET-475]. Index: ReflectionUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/ReflectionUtils.cs,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ReflectionUtils.cs 20 Sep 2007 12:31:01 -0000 1.50 --- ReflectionUtils.cs 5 Oct 2007 17:06:01 -0000 1.51 *************** *** 991,994 **** --- 991,1017 ---- } + /// <summary> + /// Returns the explicit <see cref="System.Exception"/> that is the root cause of an exception. + /// </summary> + /// <remarks> + /// If the InnerException property of the current exception is a null reference + /// or a <see cref="System.NullReferenceException"/>, returns the current exception. + /// </remarks> + /// <param name="ex">The last exception thrown.</param> + /// <returns> + /// The first explicit exception thrown in a chain of exceptions. + /// </returns> + public static Exception GetExplicitBaseException(Exception ex) + { + Exception innerEx = ex.InnerException; + while (innerEx != null && + !(innerEx is NullReferenceException)) + { + ex = innerEx; + innerEx = innerEx.InnerException; + } + return ex; + } + /// <summary> /// Copies all fields from one object to another. Index: ObjectUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/ObjectUtils.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectUtils.cs 7 Sep 2007 04:46:39 -0000 1.6 --- ObjectUtils.cs 5 Oct 2007 17:06:01 -0000 1.7 *************** *** 211,219 **** return constructor.Invoke(arguments); } ! catch (TargetInvocationException ex) { throw new FatalReflectionException( ! string.Format( ! CultureInfo.InvariantCulture, "Failed instantiating type [{0}].", constructor.DeclaringType), ex.InnerException); } } --- 211,223 ---- return constructor.Invoke(arguments); } ! catch (Exception ex) { + Type ctorType = constructor.DeclaringType; throw new FatalReflectionException( ! string.Format( ! CultureInfo.InvariantCulture, ! "Cannot instantiate Type [{0}] using ctor [{1}] : '{2}'", ! constructor.DeclaringType, constructor, ex.Message), ! ex); } } |
From: Bruno B. <bb...@us...> - 2007-10-05 17:05:58
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32398 Modified Files: ContextHandler.cs Log Message: ContextRegistry.GetContext() / WebApplicationContext.Current should print a detailed error [SPRNET-475]. Index: ContextHandler.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support/ContextHandler.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ContextHandler.cs 8 Aug 2007 17:46:37 -0000 1.34 --- ContextHandler.cs 5 Oct 2007 17:05:49 -0000 1.35 *************** *** 292,296 **** throw ConfigurationUtils.CreateConfigurationException( String.Format("Error creating context '{0}': {1}", ! contextName, ex.Message), ex); } throw; --- 292,296 ---- throw ConfigurationUtils.CreateConfigurationException( String.Format("Error creating context '{0}': {1}", ! contextName, ReflectionUtils.GetExplicitBaseException(ex).Message), ex); } throw; |
From: Mark P. <mar...@us...> - 2007-10-03 14:38:39
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28096 Modified Files: ado.xml dbprovider.xml orm.xml transaction.xml Log Message: Improve documentation on transaction management - in particular mixed ado.net/nhibernate operations within the same transaction. Index: transaction.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/transaction.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** transaction.xml 9 Aug 2007 06:30:17 -0000 1.19 --- transaction.xml 3 Oct 2007 14:38:35 -0000 1.20 *************** *** 199,204 **** <para>This is primarily a 'SPI' (Service Provider Interface), although it can be used programmatically. Note that in keeping with the Spring ! Framework's philosophy, IPlatformTransactionManager is an interface, and ! can thus be easily mocked or stubbed as necessary. <interfacename>IPlatformTransactionManager</interfacename> implementations are defined like any other object in the IoC container. The following --- 199,204 ---- <para>This is primarily a 'SPI' (Service Provider Interface), although it can be used programmatically. Note that in keeping with the Spring ! Framework's philosophy, <classname>IPlatformTransactionManager</classname> ! is an interface, and can thus be easily mocked or stubbed as necessary. <interfacename>IPlatformTransactionManager</interfacename> implementations are defined like any other object in the IoC container. The following *************** *** 220,223 **** --- 220,229 ---- local/distributed transaction manager from System.Transactions.</para> </listitem> + + <listitem> + <para><classname>HibernatePlatformTransactionManager</classname> - + local transaction manager for use with NHibernate or mixed + ADO.NET/NHibernate data access operations.</para> + </listitem> </itemizedlist> *************** *** 229,242 **** ContextUtil.SetAbort(). Note you can use Spring's EnterpriseServices exporter to have a EnterpriseService proxy created for your plain .NET ! object. Lastly, TxScopePlatformTransactionManager calls new ! TransactionScope(); .Complete(), Dispose(), ! Transaction.Current.Rollback(). Configuration properties for each ! transaction manager are specific to the data access technology used. Refer ! to the API docs for comprehensive information but the examples should give ! you a good basis for getting started.</para> ! ! <para>Note that other transaction managers, such as ! <classname>HibernateTransactionManager</classname>, are part of the ! Spring.NET modules project and available separately for download.</para> <para>The <literal>GetTransaction(..)</literal> method returns a --- 235,245 ---- ContextUtil.SetAbort(). Note you can use Spring's EnterpriseServices exporter to have a EnterpriseService proxy created for your plain .NET ! object. TxScopePlatformTransactionManager calls new TransactionScope(); ! .Complete(), Dispose(), Transaction.Current.Rollback(). Configuration ! properties for each transaction manager are specific to the data access ! technology used. Refer to the API docs for comprehensive information but ! the examples should give you a good basis for getting started. The ! HibernatePlatformTransactionManager is described more in the section ! <classname></classname>.</para> <para>The <literal>GetTransaction(..)</literal> method returns a *************** *** 307,312 **** and then use Spring's <classname>AdoPlatformTransactionManager</classname>, giving it a ! reference to the IDbProvider. For more information on the IDbProvider ! abstraction refer to the next chapter.</para> <programlisting><objects xmlns='http://www.springframework.net' --- 310,316 ---- and then use Spring's <classname>AdoPlatformTransactionManager</classname>, giving it a ! reference to the <classname>IDbProvider</classname>. For more information ! on the <classname>IDbProvider</classname> abstraction refer to the next ! chapter.</para> <programlisting><objects xmlns='http://www.springframework.net' *************** *** 334,339 **** </object></programlisting> ! <para>Similarly for the HibernateTransactionManager shown in the Spring ! NHibernate Modules documentation.</para> <para>Note that in all these cases, application code will not need to --- 338,344 ---- </object></programlisting> ! <para>Similarly for the HibernateTransactionManager as shown in the ! section on <link linkend="orm-tx-mgmt">ORM transaction ! management</link>.</para> <para>Note that in all these cases, application code will not need to Index: ado.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/ado.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ado.xml 19 Sep 2007 21:24:44 -0000 1.16 --- ado.xml 3 Oct 2007 14:38:35 -0000 1.17 *************** *** 867,870 **** --- 867,920 ---- <sect1> + <title>Transaction Management</title> + + <para>The AdoTemplate is used in conjunction with an implementation of a + <classname>IPlatformTransactionManager</classname>, which is Spring's + portable transaction management API. This section gives a brief overview + of the transaction managers you can use with AdoTemplate and the details + of how you can retrieve the connection/transaction ADO.NET objects that + are bound to the thread when a transaction starts. Please refer to the + section <link linkend="key-abstractions">key abstractions</link> in the + chapter on transactions for more comprehensive introduction to transaction + management. </para> + + <para>To use local transactions, those with only one transactional + resource (i.e. the database) you will typically use + <classname>AdoPlatformTransactionManager</classname>. If you need to mix + Hibernate and ADO.NET data access operations within the same local + transaction you should use + <classname>HibernatePlatformTransaction</classname> manager which is + described more in the section on <link linkend="orm-tx-mgmt">ORM + transaction management</link>. </para> + + <para>While it is most common to use Spring's <link + linkend="transaction">transaction management features</link> to avoid the + low level management of ADO.NET connection and transaction objects, you + can retrieve the connection/transaction pair that was created at the start + of a transaction and bound to the current thread. This maybe useful for + some integration with other data access APIs. The can be done using the + utility class ConnectionUtils as shown below.</para> + + <programlisting>IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient"); + ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(dbProvider); + + + IDbCommand command = DbProvider.CreateCommand(); + command.Connection = connectionTxPairToUse.Connection; + command.Transaction = connectionTxPairToUse.Transaction;</programlisting> + + <para>It is possible to provide a wrapper around the standard .NET + provider interfaces such that you can use the plain ADO.NET API in + conjunction with Spring's transaction management features. This + functionality will be available in a future release.</para> + + <para>If you are using + <classname>ServiceDomainPlatformTransactionManager</classname> or + <classname>TxScopePlatformTransactionManager</classname> then you can + retrieve the currently executing trasaction object via the standard .NET + APIs.</para> + </sect1> + + <sect1> <title>Exception Translation</title> Index: orm.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/orm.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** orm.xml 8 Aug 2007 18:41:03 -0000 1.11 --- orm.xml 3 Oct 2007 14:38:35 -0000 1.12 *************** *** 170,174 **** </section> ! <section> <title>Transaction Management</title> --- 170,174 ---- </section> ! <section id="orm-tx-mgmt"> <title>Transaction Management</title> *************** *** 184,196 **** <para>The first strategy is encapsulated in the class ! <classname>Spring.Data..NHibernate.HibernateTransactionManager </classname>in both the <literal>Spring.Data.NHibernate </literal>namespace. This strategy is preferred when you are using a single database. ADO.NET operations can also participate in the same ! transaction, either by using AdoTemplate, typical or by retrieving the ! ADO.NET connection/transaction object pair stored in thread local ! storage when the transaction begins. Refer to the documentation of ! Spring's ADO.NET framework for more information on retrieving and using ! the connection/transaction pair without using AdoTemplate.</para> <para>The second strategy is to use the class --- 184,219 ---- <para>The first strategy is encapsulated in the class ! <classname>Spring.Data.NHibernate.HibernateTransactionManager </classname>in both the <literal>Spring.Data.NHibernate </literal>namespace. This strategy is preferred when you are using a single database. ADO.NET operations can also participate in the same ! transaction, either by using AdoTemplate or by retrieving the ADO.NET ! connection/transaction object pair stored in thread local storage when ! the transaction begins. Refer to the documentation of Spring's ADO.NET ! framework for more information on retrieving and using the ! connection/transaction pair without using AdoTemplate. You can use the ! HibernateTransactionManager and associated classes such as ! SessionFactory, HibernateTemplate directly as you would any third party ! API, however they are most commonly used through Spring's XML ! configuration file to gain the benefits of easy configuration for a ! particular runtime environment and as the basis for the configuration of ! a data access layer also configured using XML. An XML fragment showing ! the declaration of <classname>HibernateTransactionManager</classname> is ! shown below. </para> ! ! <programlisting> <object id="HibernateTransactionManager" ! type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"> ! ! <property name="DbProvider" ref="DbProvider"/> ! <property name="SessionFactory" ref="MySessionFactory"/> ! ! </object></programlisting> ! ! <para>The important property of ! <classname>HibernateTransactionManager</classname> are the references to ! the DbProvider and the Hibernate ISessionFactory. For more information ! on the DbProvider, refer to the chapter <link ! linkend="dbprovider">DbProvider</link> and the following section on ! SessionFactory setup.</para> <para>The second strategy is to use the class Index: dbprovider.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/dbprovider.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dbprovider.xml 9 Aug 2007 06:30:17 -0000 1.10 --- dbprovider.xml 3 Oct 2007 14:38:35 -0000 1.11 *************** *** 3,7 **** <title>DbProvider</title> ! <section> <title>Introduction</title> --- 3,7 ---- <title>DbProvider</title> ! <section id="dbprovider-introduction"> <title>Introduction</title> |
From: Erich E. <oak...@us...> - 2007-10-03 05:06:45
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32473/Spring.Data.NHibernate12 Modified Files: Spring.Data.NHibernate12.2005.csproj Spring.Data.NHibernate12.build Log Message: fixed SPRNET-739 Index: Spring.Data.NHibernate12.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12/Spring.Data.NHibernate12.2005.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Spring.Data.NHibernate12.2005.csproj 14 Sep 2007 15:45:50 -0000 1.4 --- Spring.Data.NHibernate12.2005.csproj 3 Oct 2007 05:02:49 -0000 1.5 *************** *** 44,47 **** --- 44,48 ---- <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Web" /> <Reference Include="System.Xml" /> </ItemGroup> *************** *** 89,92 **** --- 90,108 ---- <Link>Data\NHibernate\SessionHolder.cs</Link> </Compile> + <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs"> + <Link>Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs</Link> + </Compile> + <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\HibernateDaoSupport.cs"> + <Link>Data\NHibernate\Support\HibernateDaoSupport.cs</Link> + </Compile> + <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\OpenSessionInViewModule.cs"> + <Link>Data\NHibernate\Support\OpenSessionInViewModule.cs</Link> + </Compile> + <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\SessionScope.cs"> + <Link>Data\NHibernate\Support\SessionScope.cs</Link> + </Compile> + <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\SessionScopeSettings.cs"> + <Link>Data\NHibernate\Support\SessionScopeSettings.cs</Link> + </Compile> <Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\TemplateFlushMode.cs"> <Link>Data\NHibernate\TemplateFlushMode.cs</Link> Index: Spring.Data.NHibernate12.build =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12/Spring.Data.NHibernate12.build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Spring.Data.NHibernate12.build 16 Aug 2007 05:42:33 -0000 1.2 --- Spring.Data.NHibernate12.build 3 Oct 2007 05:02:49 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- <include name="**/*.cs" /> <include name="../Spring.Data.NHibernate/Data/**/*.cs" /> + <include name="../Spring.Data.NHibernate/Support/**/*.cs" /> <exclude name="../Spring.Data.NHibernate/Data/**/SpringSessionSynchronization.cs" /> <exclude name="../Spring.Data.NHibernate/Data/**/LocalSessionFactoryObject.cs" /> *************** *** 33,40 **** <include name="System.Data.dll" /> <include name="System.EnterpriseServices.dll" /> ! <include name="NHibernate.dll" /> ! <include name="*.dll" /> ! <exclude name="${project::get-name()}.dll" /> ! <exclude name="Spring.Data.NHibernate.dll" /> <exclude name="CloverRuntime.dll" /> </references> --- 34,41 ---- <include name="System.Data.dll" /> <include name="System.EnterpriseServices.dll" /> ! <include name="NHibernate.dll" /> ! <include name="*.dll" /> ! <exclude name="${project::get-name()}.dll" /> ! <exclude name="Spring.Data.NHibernate.dll" /> <exclude name="CloverRuntime.dll" /> </references> |
From: Erich E. <oak...@us...> - 2007-10-03 05:03:42
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12/Data/NHibernate/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32473/Spring.Data.NHibernate12/Data/NHibernate/Support Added Files: dontdelete.txt Log Message: fixed SPRNET-739 --- NEW FILE: dontdelete.txt --- sources are linked here from Spring.Data.NHibernate |
From: Erich E. <oak...@us...> - 2007-10-03 05:03:42
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32473/Spring.Data.NHibernate Modified Files: Spring.Data.NHibernate.2005.csproj Log Message: fixed SPRNET-739 Index: Spring.Data.NHibernate.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Spring.Data.NHibernate.2005.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Spring.Data.NHibernate.2005.csproj 14 Sep 2007 15:45:50 -0000 1.9 --- Spring.Data.NHibernate.2005.csproj 3 Oct 2007 05:02:49 -0000 1.10 *************** *** 34,38 **** <HintPath>..\..\..\lib\NHibernate10\net\2.0\Castle.DynamicProxy.dll</HintPath> </Reference> ! <Reference Include="Common.Logging, Version=1.0.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath> --- 34,38 ---- <HintPath>..\..\..\lib\NHibernate10\net\2.0\Castle.DynamicProxy.dll</HintPath> </Reference> ! <Reference Include="Common.Logging, Version=1.1.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath> |
From: Mark P. <mar...@us...> - 2007-10-02 21:57:13
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27969 Modified Files: ExceptionHandlerAspectIntegrationTests.cs Log Message: SPRNET-742 - Exception handling aspect supports using SpEL expression as filtering condition as alternative to use of exception name. Index: ExceptionHandlerAspectIntegrationTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExceptionHandlerAspectIntegrationTests.cs 9 Aug 2007 04:03:07 -0000 1.3 --- ExceptionHandlerAspectIntegrationTests.cs 2 Oct 2007 21:57:08 -0000 1.4 *************** *** 61,65 **** string testText = @"#log.Debug('Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name)"; logHandler.SourceExceptionNames.Add("ArithmeticException"); ! logHandler.ExpressionText = testText; exceptionHandlerAdvice.ExceptionHandlers.Add(logHandler); --- 61,65 ---- string testText = @"#log.Debug('Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name)"; logHandler.SourceExceptionNames.Add("ArithmeticException"); ! logHandler.ActionExpressionText = testText; exceptionHandlerAdvice.ExceptionHandlers.Add(logHandler); *************** *** 83,88 **** public void LoggingTestWithString() { ! string logHandlerText = "on ArithmeticException log 'My Message, Method Name ' + #method.Name"; ITestObject to = CreateTestObjectProxy(logHandlerText); --- 83,102 ---- public void LoggingTestWithString() { ! string logHandlerText = "on exception name ArithmeticException log 'My Message, Method Name ' + #method.Name"; ! ! ExecuteLoggingHandler(logHandlerText); ! } ! ! ! [Test] ! public void LoggingTestWithConstraintExpression() ! { ! string logHandlerText = "on exception (#e is T(System.ArithmeticException)) log 'My Message, Method Name ' + #method.Name"; + ExecuteLoggingHandler(logHandlerText); + } + + private void ExecuteLoggingHandler(string logHandlerText) + { ITestObject to = CreateTestObjectProxy(logHandlerText); *************** *** 90,94 **** { to.Exceptional(new ArithmeticException()); ! } catch (ArithmeticException) { //TODO assert logging occured. --- 104,109 ---- { to.Exceptional(new ArithmeticException()); ! } ! catch (ArithmeticException) { //TODO assert logging occured. *************** *** 102,106 **** { string translationHandlerText = ! "on ArithmeticException translate new System.InvalidOperationException('My Message, Method Name ' + #method.Name, #e)"; ITestObject to = CreateTestObjectProxy(translationHandlerText); --- 117,121 ---- { string translationHandlerText = ! "on exception name ArithmeticException translate new System.InvalidOperationException('My Message, Method Name ' + #method.Name, #e)"; ITestObject to = CreateTestObjectProxy(translationHandlerText); *************** *** 118,122 **** Assert.IsInstanceOfType(typeof(InvalidOperationException), e, "wrong exception type thrown."); } - } --- 133,136 ---- *************** *** 125,129 **** { string translationHandlerText = ! "on ArithmeticException wrap System.InvalidOperationException 'My Message'"; ITestObject to = CreateTestObjectProxy(translationHandlerText); --- 139,143 ---- { string translationHandlerText = ! "on exception name ArithmeticException wrap System.InvalidOperationException 'My Message'"; ITestObject to = CreateTestObjectProxy(translationHandlerText); *************** *** 148,152 **** { string translationHandlerText = ! "on ArithmeticException wrap System.InvalidOperationException"; ITestObject to = CreateTestObjectProxy(translationHandlerText); --- 162,166 ---- { string translationHandlerText = ! "on exception name ArithmeticException wrap System.InvalidOperationException"; ITestObject to = CreateTestObjectProxy(translationHandlerText); *************** *** 172,176 **** { string translationHandlerText = ! "on ArithmeticException replace System.InvalidOperationException 'My Message'"; ITestObject to = CreateTestObjectProxy(translationHandlerText); --- 186,190 ---- { string translationHandlerText = ! "on exception name ArithmeticException replace System.InvalidOperationException 'My Message'"; ITestObject to = CreateTestObjectProxy(translationHandlerText); *************** *** 195,199 **** { string translationHandlerText = ! "on ArithmeticException replace System.InvalidOperationException"; ITestObject to = CreateTestObjectProxy(translationHandlerText); --- 209,213 ---- { string translationHandlerText = ! "on exception name ArithmeticException replace System.InvalidOperationException"; ITestObject to = CreateTestObjectProxy(translationHandlerText); *************** *** 217,221 **** public void SwallowWithString() { ! string returnHandlerText = "on ArithmeticException swallow"; ITestObject to = CreateTestObjectProxy(returnHandlerText); try --- 231,235 ---- public void SwallowWithString() { ! string returnHandlerText = "on exception name ArithmeticException swallow"; ITestObject to = CreateTestObjectProxy(returnHandlerText); try *************** *** 232,236 **** public void ReturnWithString() { ! string returnHandlerText = "on ArithmeticException return 12"; ITestObject to = CreateTestObjectProxy(returnHandlerText); try --- 246,250 ---- public void ReturnWithString() { ! string returnHandlerText = "on exception name ArithmeticException return 12"; ITestObject to = CreateTestObjectProxy(returnHandlerText); try |