Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18183/Spring/Spring.Core/Objects/Factory/Xml
Modified Files:
DefaultXmlObjectDefinitionParser.cs
IXmlObjectDefinitionParser.cs ObjectsDtd.cs
ObjectsDtdResolver.cs XmlObjectFactory.cs
Log Message:
Added centralised Type resolution mechanism, runtime type converter, Xml Config handler, multiple documentation updates.
Index: IXmlObjectDefinitionParser.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/IXmlObjectDefinitionParser.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IXmlObjectDefinitionParser.cs 6 Jul 2004 12:54:27 -0000 1.1
--- IXmlObjectDefinitionParser.cs 26 Jul 2004 07:47:57 -0000 1.2
***************
*** 36,45 ****
/// <remarks>
/// <p>
! /// Used by XmlBeanDefinitionReader for actually parsing a DOM document.
/// </p>
/// <p>
/// Instantiated per document to parse: implementations can hold state in
! /// instance variables during the execution of the registerBeanDefinitions
! /// method, for example global settings that are defined for all bean
/// definitions in the document.
/// </p>
--- 36,46 ----
/// <remarks>
/// <p>
! /// Used by XmlObjectDefinitionReader for actually parsing a DOM document.
/// </p>
/// <p>
/// Instantiated per document to parse: implementations can hold state in
! /// instance variables during the execution of the
! /// <see cref="Spring.Objects.Factory.Xml.IXmlObjectDefinitionParser.RegisterObjectDefinitions"/>
! /// method, for example global settings that are defined for all object
/// definitions in the document.
/// </p>
***************
*** 49,53 ****
public interface IXmlObjectDefinitionParser
{
-
/// <summary>
/// Parse object definitions from the given DOM node, and register them with the
--- 50,53 ----
Index: ObjectsDtdResolver.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsDtdResolver.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ObjectsDtdResolver.cs 9 Jul 2004 15:03:37 -0000 1.1
--- ObjectsDtdResolver.cs 26 Jul 2004 07:47:57 -0000 1.2
***************
*** 37,41 ****
/// <summary>
/// <see cref="System.Xml.XmlResolver"/> implementation for the Spring objects DTD,
! /// to load the DTD from the...
/// </summary>
/// <author>Juergen Hoeller</author>
--- 37,41 ----
/// <summary>
/// <see cref="System.Xml.XmlResolver"/> implementation for the Spring objects DTD,
! /// to load the DTD from an embedded resource.
/// </summary>
/// <author>Juergen Hoeller</author>
***************
*** 45,49 ****
#region Constants
! private const string DtdLookup = "spring-objects.dtd";
private const string DtdResourceKey = "spring.net.dtd";
--- 45,49 ----
#region Constants
! private const string DtdLookup = "SPRING/DTD";
private const string DtdResourceKey = "spring.net.dtd";
***************
*** 117,140 ****
{
object entity = null;
! try
! {
! // #$%£"! try load it from a resource embedded within this assembly
! string dtd = MyResources.GetString (
! DtdResourceKey,
! CultureInfo.CurrentUICulture);
! byte [] dtdBytes = new UTF8Encoding ().GetBytes (dtd);
! // mmm...
! entity = new MemoryStream (dtdBytes, false);
! }
! catch (Exception ex)
{
! #region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
! "Exception thrown when retrieving DTD resource.",
! ex);
}
- #endregion
}
// if null, try the default behaviour -> download from a website or wherever
--- 117,143 ----
{
object entity = null;
! if (absoluteUri.AbsoluteUri.IndexOf (DtdLookup) >= 0)
{
! try
{
! // #$%£"! try load it from a resource embedded within this assembly
! string dtd = MyResources.GetString (
! DtdResourceKey,
! CultureInfo.CurrentUICulture);
! byte [] dtdBytes = new UTF8Encoding ().GetBytes (dtd);
! // mmm...
! entity = new MemoryStream (dtdBytes, false);
! }
! catch (Exception ex)
! {
! #region Instrumentation
! if (log.IsDebugEnabled)
! {
! log.Debug (
! "Exception thrown when retrieving DTD resource.",
! ex);
! }
! #endregion
}
}
// if null, try the default behaviour -> download from a website or wherever
Index: XmlObjectFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/XmlObjectFactory.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** XmlObjectFactory.cs 16 Jul 2004 13:59:03 -0000 1.2
--- XmlObjectFactory.cs 26 Jul 2004 07:47:57 -0000 1.3
***************
*** 64,67 ****
--- 64,68 ----
/// <author>Juergen Hoeller</author>
/// <author>Rick Evans (.NET)</author>
+ /// <version>$Id$</version>
public class XmlObjectFactory : DefaultListableObjectFactory
{
***************
*** 69,90 ****
#region Constructor (s) / Destructor
/// <summary>
- /// Creates a new instance of the XmlObjectFactory class.
- /// </summary>
- public XmlObjectFactory ()
- {
- }
-
- /// <summary>
- /// Creates a new instance of the XmlObjectFactory class.
- /// </summary>
- /// <param name="parentFactory">
- /// The parent object factory.
- /// </param>
- public XmlObjectFactory (IObjectFactory parentFactory)
- : base (parentFactory)
- {
- }
-
- /// <summary>
/// Creates a new instance of the XmlObjectFactory class, with the
/// given resource, which must be parsable using DOM.
--- 70,73 ----
***************
*** 128,159 ****
#endregion
- #region Methods
- /// <summary>
- /// Loads object definitions from an application / web config file section.
- /// </summary>
- /// <seealso cref="Spring.Objects.Factory.Xml.ObjectsDefinitionConfigResource"/>
- public void LoadObjectDefinitionsFromConfig ()
- {
- LoadObjectDefinitionsFromConfig (
- ObjectsDefinitionConfigResource.DefaultConfigSectionName);
- }
-
- /// <summary>
- /// Loads object definitions from an application / web config file section.
- /// </summary>
- /// <param name="name">
- /// The name of the config section element containing object definitions.
- /// </param>
- /// <seealso cref="Spring.Objects.Factory.Xml.ObjectsDefinitionConfigResource"/>
- public void LoadObjectDefinitionsFromConfig (string name)
- {
- _reader = new XmlObjectDefinitionReader (this);
- XmlElement objectsElement
- = ConfigurationSettings.GetConfig (name) as XmlElement;
- _reader.LoadObjectDefinitions (
- objectsElement, new ObjectsDefinitionConfigResource ());
- }
- #endregion
-
#region Fields
private XmlObjectDefinitionReader _reader;
--- 111,114 ----
Index: ObjectsDtd.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsDtd.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ObjectsDtd.cs 13 Jul 2004 07:47:45 -0000 1.2
--- ObjectsDtd.cs 26 Jul 2004 07:47:57 -0000 1.3
***************
*** 39,43 ****
public sealed class ObjectsDtd
{
-
/// <summary>
/// Value of a T/F attribute that represents true.
--- 39,42 ----
***************
*** 51,55 ****
/// <summary>
! ///
/// </summary>
public const string DefaultValue = "default";
--- 50,54 ----
/// <summary>
! /// Signifies that a default value is to be applied.
/// </summary>
public const string DefaultValue = "default";
***************
*** 218,221 ****
--- 217,230 ----
///
/// </summary>
+ public const string AutowireAttribute = "autowire";
+
+ /// <summary>
+ /// The string of characters that delimit object names.
+ /// </summary>
+ public const string ObjectNameDelimeters = ",; ";
+
+ /// <summary>
+ ///
+ /// </summary>
public static readonly string DependencyCheckAllAttributeValue
= Enum.GetName (typeof (DependencyCheckingMode), DependencyCheckingMode.All);
***************
*** 236,244 ****
///
/// </summary>
- public const string AutowireAttribute = "autowire";
-
- /// <summary>
- ///
- /// </summary>
public static readonly string AutowireByNameValue
= Enum.GetName (typeof (AutoWiringMode), AutoWiringMode.ByName);
--- 245,248 ----
***************
*** 271,275 ****
/// </p>
/// </remarks>
! private ObjectsDtd ()
{
}
--- 275,279 ----
/// </p>
/// </remarks>
! private ObjectsDtd ()
{
}
Index: DefaultXmlObjectDefinitionParser.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/DefaultXmlObjectDefinitionParser.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DefaultXmlObjectDefinitionParser.cs 23 Jul 2004 10:18:28 -0000 1.6
--- DefaultXmlObjectDefinitionParser.cs 26 Jul 2004 07:47:57 -0000 1.7
***************
*** 41,68 ****
{
! /// <summary>
! /// Default implementation of the
! /// <see cref="Spring.Objects.Factory.Xml.IXmlObjectDefinitionParser"/> interface.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Parses object definitions according to the "spring-objects" DTD.
! /// </p>
/// </remarks>
/// <author>Rod Johnson</author>
/// <author>Juergen Hoeller</author>
/// <author>Rick Evans (.NET)</author>
! public class DefaultXmlObjectDefinitionParser : IXmlObjectDefinitionParser {
#region Constants
/// <summary>
- /// The string of characters that delimit object names.
- /// </summary>
- public const string ObjectNameDelimeters = ",; ";
-
- /// <summary>
/// The shared ILog instance for this class (and derived classes).
/// </summary>
! protected static readonly ILog logger =
LogManager.GetLogger (typeof (DefaultXmlObjectDefinitionParser));
#endregion
--- 41,65 ----
{
! /// <summary>
! /// Default implementation of the
! /// <see cref="Spring.Objects.Factory.Xml.IXmlObjectDefinitionParser"/> interface.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Parses object definitions according to the "spring-objects" DTD.
! /// </p>
/// </remarks>
/// <author>Rod Johnson</author>
/// <author>Juergen Hoeller</author>
/// <author>Rick Evans (.NET)</author>
! public class DefaultXmlObjectDefinitionParser
! : IXmlObjectDefinitionParser
! {
#region Constants
/// <summary>
/// The shared ILog instance for this class (and derived classes).
/// </summary>
! protected static readonly ILog log =
LogManager.GetLogger (typeof (DefaultXmlObjectDefinitionParser));
#endregion
***************
*** 72,76 ****
/// Creates a new instance of the DefaultXmlObjectDefinitionParser class.
/// </summary>
! public DefaultXmlObjectDefinitionParser ()
{
}
--- 69,73 ----
/// Creates a new instance of the DefaultXmlObjectDefinitionParser class.
/// </summary>
! public DefaultXmlObjectDefinitionParser ()
{
}
***************
*** 82,90 ****
/// that is being (or is to be) populated with object definitions.
/// </summary>
! protected IObjectDefinitionRegistry ObjectFactory
{
get
{
! return _objectFactory;
}
}
--- 79,87 ----
/// that is being (or is to be) populated with object definitions.
/// </summary>
! protected IObjectDefinitionRegistry ObjectRegistry
{
get
{
! return _objectRegistry;
}
}
***************
*** 190,201 ****
bool resolveTypes)
{
! _objectFactory = objectRegistry;
_resolveTypes = resolveTypes;
_resource = resource;
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug ("Loading object definitions...");
}
#endregion
--- 187,198 ----
bool resolveTypes)
{
! _objectRegistry = objectRegistry;
_resolveTypes = resolveTypes;
_resource = resource;
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug ("Loading object definitions...");
}
#endregion
***************
*** 204,210 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
--- 201,207 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
***************
*** 217,223 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
--- 214,220 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
***************
*** 230,236 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
--- 227,233 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
***************
*** 248,259 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Found {0} <{1}> elements defining objects.",
! objectDefinitionCounter,
! ObjectsDtd.ObjectElement));
}
#endregion
--- 245,256 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Found {0} <{1}> elements defining objects.",
! objectDefinitionCounter,
! ObjectsDtd.ObjectElement));
}
#endregion
***************
*** 279,285 ****
&& nameAttr.Length > 0)
{
! string [] names =
! StringUtils.Split (
! nameAttr, ObjectNameDelimeters, true, true);
foreach (string name in names)
{
--- 276,280 ----
&& nameAttr.Length > 0)
{
! string [] names = GetObjectNames (nameAttr);
foreach (string name in names)
{
***************
*** 288,294 ****
}
// if we ain't got an id, assign any existing (first) alias
! if (id == null
! || string.Empty.Equals (id)
! && aliases.Count > 0)
{
string firstAlias = aliases [0];
--- 283,287 ----
}
// if we ain't got an id, assign any existing (first) alias
! if (!StringUtils.HasText (id) && aliases.Count > 0)
{
string firstAlias = aliases [0];
***************
*** 297,301 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
StringBuilder buffer = new StringBuilder ();
--- 290,294 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
StringBuilder buffer = new StringBuilder ();
***************
*** 304,313 ****
buffer.Append (alias).Append (",");
}
! logger.Debug (
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "No XML 'id' specified - using '{0}' as ID and {1} as aliases.",
! id,
! buffer.ToString ()));
}
#endregion
--- 297,306 ----
buffer.Append (alias).Append (",");
}
! log.Debug (
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "No XML 'id' specified - using '{0}' as ID and {1} as aliases.",
! id,
! buffer.ToString ()));
}
#endregion
***************
*** 315,319 ****
AbstractObjectDefinition objectDefinition
= ParseObjectDefinition (ele, id);
! if (id == null || string.Empty.Equals (id))
{
if (objectDefinition is RootObjectDefinition)
--- 308,312 ----
AbstractObjectDefinition objectDefinition
= ParseObjectDefinition (ele, id);
! if (!StringUtils.HasText (id))
{
if (objectDefinition is RootObjectDefinition)
***************
*** 322,328 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
--- 315,321 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
***************
*** 342,348 ****
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
--- 335,341 ----
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug (
string.Format (
System.Globalization.CultureInfo.CurrentUICulture,
***************
*** 352,358 ****
#endregion
! _objectFactory.RegisterObjectDefinition (id, objectDefinition);
! foreach (string alias in aliases) {
! _objectFactory.RegisterAlias (id, alias);
}
}
--- 345,352 ----
#endregion
! ObjectRegistry.RegisterObjectDefinition (id, objectDefinition);
! foreach (string alias in aliases)
! {
! ObjectRegistry.RegisterAlias (id, alias);
}
}
***************
*** 391,398 ****
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Either '{0}' or '{1}' is required.",
! ObjectsDtd.ClassAttribute,
! ObjectsDtd.ParentAttribute));
}
AbstractObjectDefinition bd = null;
--- 385,392 ----
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Either '{0}' or '{1}' is required.",
! ObjectsDtd.ClassAttribute,
! ObjectsDtd.ParentAttribute));
}
AbstractObjectDefinition bd = null;
***************
*** 406,420 ****
if (ResolveTypes)
{
! Type type = ResolveType(className);
! rbd = new RootObjectDefinition(type, cargs, pvs);
}
else
{
! rbd = new RootObjectDefinition(className, cargs, pvs);
}
if (ele.HasAttribute (ObjectsDtd.DependsOnAttribute))
{
string dependsOn = ele.GetAttribute (ObjectsDtd.DependsOnAttribute);
! rbd.DependsOn = StringUtils.Split (dependsOn, ObjectNameDelimeters, true, true);
}
string dependencyCheck = ele.GetAttribute (ObjectsDtd.DependencyCheckAttribute);
--- 400,414 ----
if (ResolveTypes)
{
! Type type = ObjectUtils.ResolveType (className);
! rbd = new RootObjectDefinition (type, cargs, pvs);
}
else
{
! rbd = new RootObjectDefinition (className, cargs, pvs);
}
if (ele.HasAttribute (ObjectsDtd.DependsOnAttribute))
{
string dependsOn = ele.GetAttribute (ObjectsDtd.DependsOnAttribute);
! rbd.DependsOn = GetObjectNames (dependsOn);
}
string dependencyCheck = ele.GetAttribute (ObjectsDtd.DependencyCheckAttribute);
***************
*** 431,467 ****
rbd.AutowireMode = GetAutowireMode(autowire);
string initMethodName = ele.GetAttribute(ObjectsDtd.InitMethodAttribute);
! if (!initMethodName.Equals(string.Empty))
{
rbd.InitMethodName = initMethodName;
}
! string destroyMethodName = ele.GetAttribute(ObjectsDtd.DestroyMethodAttribute);
! if (!destroyMethodName.Equals(string.Empty))
{
rbd.DestroyMethodName = destroyMethodName;
}
-
bd = rbd;
}
else
{
! bd = new ChildObjectDefinition(parent, pvs);
}
!
! if (ele.HasAttribute(ObjectsDtd.SingletonAttribute))
{
! bd.IsSingleton = ObjectsDtd.TrueValue.Equals (ele.GetAttribute(ObjectsDtd.SingletonAttribute));
}
!
! string lazyInit = ele.GetAttribute(ObjectsDtd.LazyInitAttribute);
! if (ObjectsDtd.DefaultValue.Equals(lazyInit) && bd.IsSingleton)
{
// just apply default to singletons, as lazy-init has no meaning for prototypes
lazyInit = _defaultLazyInit;
}
! bd.LazyInit = ObjectsDtd.TrueValue.Equals(lazyInit);
bd.ResourceDescription = _resource.Description;
return bd;
}
! catch (TypeLoadException ex)
{
throw new ObjectDefinitionStoreException (
--- 425,458 ----
rbd.AutowireMode = GetAutowireMode(autowire);
string initMethodName = ele.GetAttribute(ObjectsDtd.InitMethodAttribute);
! if (StringUtils.HasText (initMethodName))
{
rbd.InitMethodName = initMethodName;
}
! string destroyMethodName = ele.GetAttribute (ObjectsDtd.DestroyMethodAttribute);
! if (StringUtils.HasText (destroyMethodName))
{
rbd.DestroyMethodName = destroyMethodName;
}
bd = rbd;
}
else
{
! bd = new ChildObjectDefinition (parent, pvs);
}
! if (ele.HasAttribute (ObjectsDtd.SingletonAttribute))
{
! bd.IsSingleton = ObjectsDtd.TrueValue.Equals (ele.GetAttribute (ObjectsDtd.SingletonAttribute));
}
! string lazyInit = ele.GetAttribute (ObjectsDtd.LazyInitAttribute);
! if (ObjectsDtd.DefaultValue.Equals (lazyInit) && bd.IsSingleton)
{
// just apply default to singletons, as lazy-init has no meaning for prototypes
lazyInit = _defaultLazyInit;
}
! bd.LazyInit = ObjectsDtd.TrueValue.Equals (lazyInit);
bd.ResourceDescription = _resource.Description;
return bd;
}
! catch (TypeLoadException ex)
{
throw new ObjectDefinitionStoreException (
***************
*** 469,478 ****
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Object class [{0}] not found.",
! className),
ex);
}
! catch (ApplicationException err)
{
throw new ObjectDefinitionStoreException (
--- 460,469 ----
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Object class [{0}] not found.",
! className),
ex);
}
! catch (ApplicationException ex)
{
throw new ObjectDefinitionStoreException (
***************
*** 480,535 ****
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Class that object class [{0}] depends on not found.",
! className),
! err);
}
}
! /// <summary>
! /// Try to convert a string definig a type to a System.Type
! /// </summary>
! /// <param name="partialOrFullClassName"></param>
! /// <returns></returns>
! Type ResolveType (string partialOrFullClassName)
! {
! Type type = Type.GetType (partialOrFullClassName);
! if (type != null)
! return type;
!
! string[] splitted = partialOrFullClassName.Split (new char[] {','});
! if (splitted.Length > 1)
! {
! Assembly assembly = LoadAssembly (partialOrFullClassName);
! return assembly.GetType (splitted[0]);
! }
! throw new ObjectDefinitionException (partialOrFullClassName);
! }
!
! private Assembly LoadAssembly (string className)
! {
! string assemblyName =
! className.Substring (className.IndexOf (',') + 1).Trim ();
!
! Assembly assembly =
! assembly = Assembly.LoadWithPartialName (assemblyName);
! return assembly;
! }
!
! /// <summary>
! /// Parse constructor argument subelements of the given object element.
/// </summary>
! /// <param name="objectName"></param>
! /// <param name="objectEle"></param>
! /// <returns></returns>
! protected internal virtual ConstructorArgumentValues GetConstructorArgSubElements (
string objectName, XmlElement objectEle)
{
XmlNodeList nl = objectEle.ChildNodes;
ConstructorArgumentValues cargs = new ConstructorArgumentValues ();
! for (int i = 0; i < nl.Count; ++i)
{
! XmlNode node = nl.Item(i);
! if (node is XmlElement && ObjectsDtd.ConstructorArgElement.Equals (node.Name))
{
ParseConstructorArgElement (objectName, cargs, (XmlElement) node);
--- 471,493 ----
objectName,
string.Format (
! System.Globalization.CultureInfo.CurrentUICulture,
! "Class that object class [{0}] depends on not found.",
! className),
! ex);
}
}
! /// <summary>
! /// Parse constructor argument subelements of the given object element.
/// </summary>
! protected ConstructorArgumentValues GetConstructorArgSubElements (
string objectName, XmlElement objectEle)
{
XmlNodeList nl = objectEle.ChildNodes;
ConstructorArgumentValues cargs = new ConstructorArgumentValues ();
! foreach (XmlNode node in nl)
{
! if (node is XmlElement
! && ObjectsDtd.ConstructorArgElement.Equals (node.Name))
{
ParseConstructorArgElement (objectName, cargs, (XmlElement) node);
***************
*** 548,553 ****
/// The element containing the top level object definition.
/// </param>
! /// <returns>The property (s) associated with the object (definition).</returns>
! protected internal virtual MutablePropertyValues GetPropertyValueSubElements (
string objectName, XmlElement objectEle)
{
--- 506,513 ----
/// The element containing the top level object definition.
/// </param>
! /// <returns>
! /// The property (s) associated with the object (definition).
! /// </returns>
! protected virtual MutablePropertyValues GetPropertyValueSubElements (
string objectName, XmlElement objectEle)
{
***************
*** 577,581 ****
/// The name of the element containing the ctor arg definition.
/// </param>
! protected internal virtual void ParseConstructorArgElement (
string objectName, ConstructorArgumentValues cargs, XmlElement ele)
{
--- 537,541 ----
/// The name of the element containing the ctor arg definition.
/// </param>
! protected virtual void ParseConstructorArgElement (
string objectName, ConstructorArgumentValues cargs, XmlElement ele)
{
***************
*** 583,587 ****
string indexAttr = ele.GetAttribute (ObjectsDtd.IndexAttribute);
string typeAttr = ele.GetAttribute (ObjectsDtd.TypeAttribute);
! if (!string.Empty.Equals (indexAttr))
{
try
--- 543,547 ----
string indexAttr = ele.GetAttribute (ObjectsDtd.IndexAttribute);
string typeAttr = ele.GetAttribute (ObjectsDtd.TypeAttribute);
! if (StringUtils.HasText (indexAttr))
{
try
***************
*** 594,598 ****
"'index' cannot be lower than 0");
}
! if (!string.Empty.Equals(typeAttr))
{
cargs.AddIndexedArgumentValue (index, val, TypeAliasResolver.Resolve(typeAttr));
--- 554,558 ----
"'index' cannot be lower than 0");
}
! if (StringUtils.HasText (typeAttr))
{
cargs.AddIndexedArgumentValue (index, val, TypeAliasResolver.Resolve(typeAttr));
***************
*** 612,616 ****
else
{
! if (!string.Empty.Equals (typeAttr))
{
cargs.AddGenericArgumentValue (val, TypeAliasResolver.Resolve(typeAttr));
--- 572,576 ----
else
{
! if (StringUtils.HasText (typeAttr))
{
cargs.AddGenericArgumentValue (val, TypeAliasResolver.Resolve(typeAttr));
***************
*** 656,660 ****
/// The name of the object associated with the property.
/// </param>
! protected internal virtual object GetPropertyValue (
XmlElement ele, string objectName)
{
--- 616,620 ----
/// The name of the object associated with the property.
/// </param>
! protected virtual object GetPropertyValue (
XmlElement ele, string objectName)
{
***************
*** 697,701 ****
/// The name of the object (definition) associated with the top level property.
/// </param>
! protected internal virtual object ParsePropertySubElement (
XmlElement ele, string objectName)
{
--- 657,661 ----
/// The name of the object (definition) associated with the top level property.
/// </param>
! protected virtual object ParsePropertySubElement (
XmlElement ele, string objectName)
{
***************
*** 782,786 ****
/// </param>
/// <returns>The list definition.</returns>
! protected internal virtual IList GetList (
XmlElement collectionEle, string objectName)
{
--- 742,746 ----
/// </param>
/// <returns>The list definition.</returns>
! protected virtual IList GetList (
XmlElement collectionEle, string objectName)
{
***************
*** 834,838 ****
protected IDictionary GetMap (XmlElement mapEle, string objectName)
{
! ManagedMap m = new ManagedMap();
IList l = GetChildElementsByTagName (mapEle, ObjectsDtd.EntryElement);
foreach (XmlElement entryEle in l)
--- 794,798 ----
protected IDictionary GetMap (XmlElement mapEle, string objectName)
{
! ManagedMap m = new ManagedMap ();
IList l = GetChildElementsByTagName (mapEle, ObjectsDtd.EntryElement);
foreach (XmlElement entryEle in l)
***************
*** 847,851 ****
/// <summary>
! /// Don&t use the horrible DOM API to get child elements: get an element&s
/// children with a given element name.
/// </summary>
--- 807,811 ----
/// <summary>
! /// Don't use the horrible DOM API to get child elements: get an element's
/// children with a given element name.
/// </summary>
***************
*** 925,930 ****
{
DependencyCheckingMode code = DependencyCheckingMode.None;
! if (att != null
! && att.Trim ().Length > 0)
{
try
--- 885,889 ----
{
DependencyCheckingMode code = DependencyCheckingMode.None;
! if (StringUtils.HasText (att))
{
try
***************
*** 936,942 ****
{
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug ("Error while parsing dependency checking mode.", ex);
}
#endregion
--- 895,901 ----
{
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug ("Error while parsing dependency checking mode.", ex);
}
#endregion
***************
*** 956,961 ****
{
AutoWiringMode mode = AutoWiringMode.No;
! if (att != null
! && att.Trim ().Length > 0)
{
try
--- 915,919 ----
{
AutoWiringMode mode = AutoWiringMode.No;
! if (StringUtils.HasText (att))
{
try
***************
*** 967,973 ****
{
#region Instrumentation
! if (logger.IsDebugEnabled)
{
! logger.Debug ("Error while parsing autowire mode.", ex);
}
#endregion
--- 925,931 ----
{
#region Instrumentation
! if (log.IsDebugEnabled)
{
! log.Debug ("Error while parsing autowire mode.", ex);
}
#endregion
***************
*** 976,983 ****
return mode;
}
#endregion
#region Fields
! private IObjectDefinitionRegistry _objectFactory;
private IResource _resource;
private string _defaultLazyInit;
--- 934,957 ----
return mode;
}
+
+ /// <summary>
+ /// Given a string containing delimited object names, returns
+ /// a string array split on the objects name delimeter.
+ /// </summary>
+ /// <param name="value">
+ /// The string containing delimited object names.
+ /// </param>
+ /// <returns>
+ /// A string array split on the objects name delimeter.
+ /// </returns>
+ private string [] GetObjectNames (string value)
+ {
+ return StringUtils.Split (
+ value, ObjectsDtd.ObjectNameDelimeters, true, true);
+ }
#endregion
#region Fields
! private IObjectDefinitionRegistry _objectRegistry;
private IResource _resource;
private string _defaultLazyInit;
***************
*** 986,989 ****
private bool _resolveTypes;
#endregion
! }
}
--- 960,963 ----
private bool _resolveTypes;
#endregion
! }
}
|