SPRNET-1523 cleaning up past merge and fixing conflicts
This commit is contained in:
@@ -260,6 +260,37 @@ namespace Spring.Objects.Factory
|
||||
#endif
|
||||
object this[string name] { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method allows an object factory to be used as a replacement for the
|
||||
/// Singleton or Prototype design pattern.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that callers should retain references to returned objects. There is no
|
||||
/// guarantee that this method will be implemented to be efficient. For example,
|
||||
/// it may be synchronized, or may need to run an RDBMS query.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the object to return.</typeparam>
|
||||
/// <returns>The instance of the object.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.Factory.ObjectDefinitionStoreException">
|
||||
/// If there is more than a single object of the requested type defined in the factory.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
T GetObject<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
|
||||
@@ -814,7 +814,8 @@ namespace Spring.Objects.Factory.Support
|
||||
AutowireMode = other.AutowireMode;
|
||||
ResourceDescription = other.ResourceDescription;
|
||||
IsPrimary = other.IsPrimary;
|
||||
|
||||
IsAutowireCandidate = other.IsAutowireCandidate;
|
||||
|
||||
AbstractObjectDefinition aod = other as AbstractObjectDefinition;
|
||||
if (aod != null)
|
||||
{
|
||||
@@ -846,6 +847,7 @@ namespace Spring.Objects.Factory.Support
|
||||
buffer.Append("; Singleton = ").Append(IsSingleton);
|
||||
buffer.Append("; LazyInit = ").Append(IsLazyInit);
|
||||
buffer.Append("; Autowire = ").Append(AutowireMode);
|
||||
buffer.Append("; Autowire-Candidate = ").Append(IsAutowireCandidate);
|
||||
buffer.Append("; Primary = ").Append(IsPrimary);
|
||||
buffer.Append("; DependencyCheck = ").Append(DependencyCheck);
|
||||
buffer.Append("; InitMethodName = ").Append(InitMethodName);
|
||||
|
||||
@@ -1917,6 +1917,38 @@ namespace Spring.Objects.Factory.Support
|
||||
return GetObjectInternal(name, null, null, false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method allows an object factory to be used as a replacement for the
|
||||
/// Singleton or Prototype design pattern.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that callers should retain references to returned objects. There is no
|
||||
/// guarantee that this method will be implemented to be efficient. For example,
|
||||
/// it may be synchronized, or may need to run an RDBMS query.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the object to return.</typeparam>
|
||||
/// <returns>The instance of the object.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.Factory.ObjectDefinitionStoreException">
|
||||
/// If there is more than a single object of the requested type defined in the factory.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
public abstract T GetObject<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
|
||||
@@ -949,20 +949,41 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
public T GetObject<T>()
|
||||
public override T GetObject<T>()
|
||||
{
|
||||
IList<string> objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
|
||||
if (objectNamesForType.Count > 1)
|
||||
{
|
||||
IList<string> autowireCandidates = new List<string>();
|
||||
foreach (var objectName in objectNamesForType)
|
||||
{
|
||||
if (GetObjectDefinition(objectName).IsAutowireCandidate)
|
||||
autowireCandidates.Add(objectName);
|
||||
|
||||
}
|
||||
if (autowireCandidates.Count > 0)
|
||||
objectNamesForType = autowireCandidates;
|
||||
}
|
||||
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Count == 0))
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T).FullName, "Requested Type not Defined in the Context.");
|
||||
}
|
||||
|
||||
if (objectNamesForType.Count > 1)
|
||||
if (objectNamesForType.Count == 1)
|
||||
{
|
||||
throw new ObjectDefinitionStoreException(string.Format("More than one definition for {0} found in the Context.", typeof(T).FullName));
|
||||
return (T)GetObject(objectNamesForType[0]);
|
||||
}
|
||||
else if (objectNamesForType.Count == 0 && ParentObjectFactory != null)
|
||||
{
|
||||
return ParentObjectFactory.GetObject<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T), "expected single bean but found " +
|
||||
objectNamesForType.Count + ": " + StringUtils.ArrayToCommaDelimitedString(objectNamesForType));
|
||||
}
|
||||
|
||||
return (T)GetObject(objectNamesForType[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -336,6 +336,28 @@ namespace Spring.Objects.Factory.Support
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the autowire candidate value for this definition.
|
||||
/// </summary>
|
||||
/// <param name="autowireCandidate">The autowire candidate value</param>
|
||||
/// <returns></returns>
|
||||
public ObjectDefinitionBuilder SetAutowireCandidate(bool autowireCandidate)
|
||||
{
|
||||
objectDefinition.IsAutowireCandidate = autowireCandidate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the primary value for this definition.
|
||||
/// </summary>
|
||||
/// <param name="primary">If object is primary</param>
|
||||
/// <returns></returns>
|
||||
public ObjectDefinitionBuilder SetPrimary(bool primary)
|
||||
{
|
||||
objectDefinition.IsPrimary = primary;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the dependency check mode for this definition.
|
||||
/// </summary>
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Spring.Objects.Factory.Xml
|
||||
private string merge;
|
||||
private string initMethod;
|
||||
private string destroyMethod;
|
||||
private string autowireCandidates;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the autowire setting for the document that's currently parsed.
|
||||
@@ -90,10 +91,20 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// Gets or sets the destroy method for the document that's currently parsed.
|
||||
/// </summary>
|
||||
/// <value>The destroy methood</value>
|
||||
public string DestroyMethod
|
||||
public string DestroyMethod
|
||||
{
|
||||
get { return destroyMethod; }
|
||||
set { destroyMethod = value; }
|
||||
set { destroyMethod = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets autowire candidates for the document that's currently parsed
|
||||
/// </summary>
|
||||
/// <value>The Autowire Candidates</value>
|
||||
public string AutowireCandidates
|
||||
{
|
||||
get { return autowireCandidates; }
|
||||
set { autowireCandidates = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </remarks>
|
||||
public const string TrueValue = "true";
|
||||
|
||||
/// <summary>
|
||||
/// Value of a boolean attribute that represents
|
||||
/// <see langword="false"/>.
|
||||
/// </summary>
|
||||
public const string FalseValue = "false";
|
||||
|
||||
/// <summary>
|
||||
/// Signifies that a default value is to be applied.
|
||||
/// </summary>
|
||||
@@ -90,6 +96,11 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </summary>
|
||||
public const string DefaultAutowireAttribute = "default-autowire";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default autowire candidates.
|
||||
/// </summary>
|
||||
public const string DefaultAutowireCandidatesAttribute = "default-autowire-candidates";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default collection merge mode.
|
||||
/// </summary>
|
||||
@@ -595,6 +606,11 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </summary>
|
||||
public const string AutowireAttribute = "autowire";
|
||||
|
||||
/// <summary>
|
||||
/// The autowiring mode for an individual object definition.
|
||||
/// </summary>
|
||||
public const string AutowireCandidateAttribute = "autowire-candidate";
|
||||
|
||||
/// <summary>
|
||||
/// Attribute element to farther deifne the qualifier of an object
|
||||
/// </summary>
|
||||
|
||||
@@ -175,6 +175,48 @@ namespace Spring.Objects.Factory.Xml
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.AutowireCandidates = GetAttributeValue(root, ObjectDefinitionConstants.DefaultAutowireCandidatesAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default init method '{0}'.",
|
||||
ddd.InitMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.DestroyMethod = GetAttributeValue(root, ObjectDefinitionConstants.DefaultDestroyMethodAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default destroy method '{0}'.",
|
||||
ddd.DestroyMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.AutowireCandidates = GetAttributeValue(root, ObjectDefinitionConstants.DefaultAutowireCandidatesAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default autowire candidates '{0}'.",
|
||||
ddd.AutowireCandidates));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.InitMethod = GetAttributeValue(root, ObjectDefinitionConstants.DefaultInitMethodAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
@@ -203,6 +245,7 @@ namespace Spring.Objects.Factory.Xml
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
defaults = ddd;
|
||||
}
|
||||
|
||||
|
||||
@@ -481,10 +481,24 @@ namespace Spring.Objects.Factory.Xml
|
||||
autowire = childParserContext.ParserHelper.Defaults.Autowire;
|
||||
}
|
||||
od.AutowireMode = GetAutowireMode(autowire);
|
||||
string primary = GetAttributeValue(element, ObjectDefinitionConstants.PrimaryAttribute);
|
||||
if (primary == null)
|
||||
|
||||
string autowireCandidates = GetAttributeValue(element, ObjectDefinitionConstants.AutowireCandidateAttribute);
|
||||
if (string.IsNullOrEmpty(autowireCandidates) || ObjectDefinitionConstants.DefaultValue.Equals(autowireCandidates))
|
||||
{
|
||||
primary = "false";
|
||||
if (!string.IsNullOrEmpty(childParserContext.ParserHelper.Defaults.AutowireCandidates))
|
||||
{
|
||||
string[] patterns = childParserContext.ParserHelper.Defaults.AutowireCandidates.Split(',');
|
||||
od.IsAutowireCandidate = PatternMatchUtils.SimpleMatch(patterns, id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
od.IsAutowireCandidate = ObjectDefinitionConstants.TrueValue.Equals(autowireCandidates);
|
||||
}
|
||||
string primary = GetAttributeValue(element, ObjectDefinitionConstants.PrimaryAttribute);
|
||||
if (string.IsNullOrEmpty(primary))
|
||||
{
|
||||
primary = ObjectDefinitionConstants.FalseValue;
|
||||
}
|
||||
od.IsPrimary = IsTrueStringValue(primary);
|
||||
string initMethodName = GetAttributeValue(element, ObjectDefinitionConstants.InitMethodAttribute);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsd:schema xmlns="http://www.springframework.net" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense" targetNamespace="http://www.springframework.net" elementFormDefault="qualified" attributeFormDefault="unqualified" vs:friendlyname="Spring.NET Configuration" vs:ishtmlschema="false" vs:iscasesensitive="true" vs:requireattributequotes="true" vs:defaultnamespacequalifier="" vs:defaultnsprefix="">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
Spring Objects XML Schema Definition
|
||||
Based on Spring Beans DTD, authored by Rod Johnson & Juergen Hoeller
|
||||
|
||||
@@ -29,61 +29,61 @@
|
||||
|
||||
There is also support for lists, dictionaries, and sets.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<!-- base types -->
|
||||
<xsd:complexType name="identifiedType" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for a bean. The scope of the identifier is the enclosing object factory.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:ID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for an object.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<!-- base types -->
|
||||
<xsd:complexType name="identifiedType" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for a bean. The scope of the identifier is the enclosing object factory.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:ID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for an object.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="nonNullString">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a base type for any required string. Defines a string with a minimum length of 0</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:minLength value="0"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="description">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing informative text describing the purpose of the enclosing
|
||||
element. Always optional.
|
||||
Used primarily for user documentation of XML object definition documents.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="nonNullString"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="valueObject">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="expression">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="2"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<!--
|
||||
<xsd:simpleType name="nonNullString">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a base type for any required string. Defines a string with a minimum length of 0</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:minLength value="0"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="description">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing informative text describing the purpose of the enclosing
|
||||
element. Always optional.
|
||||
Used primarily for user documentation of XML object definition documents.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="nonNullString"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="valueObject">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="expression">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="2"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<!--
|
||||
Defines a reference to another object in this factory or an external
|
||||
factory (parent or included factory).
|
||||
-->
|
||||
<xsd:complexType name="objectReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:complexType name="objectReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
References must specify a name of the target object.
|
||||
The "object" attribute can reference any name from any object in the context,
|
||||
to be checked at runtime.
|
||||
@@ -91,68 +91,68 @@
|
||||
they can be checked by this DTD, thus should be preferred for references
|
||||
within the same object factory XML file.
|
||||
-->
|
||||
</xsd:complexType>
|
||||
<!-- Defines a reference to another object or a type. -->
|
||||
<xsd:complexType name="objectOrClassReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:group name="objectList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0"/>
|
||||
<xsd:choice>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<!--
|
||||
</xsd:complexType>
|
||||
<!-- Defines a reference to another object or a type. -->
|
||||
<xsd:complexType name="objectOrClassReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:group name="objectList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0"/>
|
||||
<xsd:choice>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<!--
|
||||
Defines a reference to another object in this factory or an external
|
||||
factory (parent or included factory).
|
||||
-->
|
||||
<xsd:element name="ref" type="objectReference"/>
|
||||
<!--
|
||||
<xsd:element name="ref" type="objectReference"/>
|
||||
<!--
|
||||
Defines a string property value, which must also be the id of another
|
||||
object in this factory or an external factory (parent or included factory).
|
||||
While a regular 'value' element could instead be used for the same effect,
|
||||
using idref in this case allows validation of local object ids by the xml
|
||||
parser, and name completion by helper tools.
|
||||
-->
|
||||
<xsd:element name="idref" type="objectReference"/>
|
||||
<!--
|
||||
<xsd:element name="idref" type="objectReference"/>
|
||||
<!--
|
||||
A objectList can contain multiple inner object, ref, collection, or value elements.
|
||||
Lists are untyped, pending generics support, although references will be
|
||||
strongly typed.
|
||||
A objectList can also map to an array type. The necessary conversion
|
||||
is automatically performed by AbstractObjectFactory.
|
||||
-->
|
||||
<xsd:element name="list">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
<xsd:element name="list">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
A set can contain multiple inner object, ref, collection, or value elements.
|
||||
Sets are untyped, pending generics support, although references will be
|
||||
strongly typed.
|
||||
-->
|
||||
<xsd:element name="set">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
<xsd:element name="set">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
A Spring map is a mapping from a string key to object (a .NET IDictionary).
|
||||
Maps may be empty.
|
||||
-->
|
||||
<xsd:element name="dictionary" type="objectMap"/>
|
||||
<!--
|
||||
<xsd:element name="dictionary" type="objectMap"/>
|
||||
<!--
|
||||
Name-values elements differ from map elements in that values must be strings.
|
||||
Name-values may be empty.
|
||||
-->
|
||||
<xsd:element name="name-values" type="objectNameValues"/>
|
||||
<!--
|
||||
<xsd:element name="name-values" type="objectNameValues"/>
|
||||
<!--
|
||||
Contains a string representation of a property value.
|
||||
The property may be a string, or may be converted to the
|
||||
required type using the System.ComponentModel.TypeConverter
|
||||
@@ -164,220 +164,220 @@
|
||||
Configure more complex objects by setting properties to references
|
||||
to other objects.
|
||||
-->
|
||||
<xsd:element name="value" type="valueObject"/>
|
||||
<!--
|
||||
<xsd:element name="value" type="valueObject"/>
|
||||
<!--
|
||||
Contains a string representation of an expression.
|
||||
-->
|
||||
<xsd:element name="expression" type="expression"/>
|
||||
<!--
|
||||
<xsd:element name="expression" type="expression"/>
|
||||
<!--
|
||||
Denotes a .NET null value. Necessary because an empty "value" tag
|
||||
will resolve to an empty String, which will not be resolved to a
|
||||
null value unless a special TypeConverter does so.
|
||||
-->
|
||||
<xsd:element name="null" />
|
||||
<xsd:any namespace="##other" processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
<xsd:complexType name="objectNameValues">
|
||||
<xsd:sequence>
|
||||
<!--
|
||||
<xsd:element name="null" />
|
||||
<xsd:any namespace="##other" processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
<xsd:complexType name="objectNameValues">
|
||||
<xsd:sequence>
|
||||
<!--
|
||||
The "value" attribute is the string value of the property. The "key"
|
||||
attribute is the name of the property.
|
||||
-->
|
||||
<xsd:element name="add" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType mixed="true">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" use="required" type="xsd:string"/>
|
||||
<xsd:attribute name="delimiters" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="importElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Import an external file containing object definitions into this file.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="resource" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="aliasElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines an additional alias name for an object definition.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="alias" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="objectMap">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapEntryElement" name="entry" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapEntryElement">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapKeyElement" name="key" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="key-ref" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapKeyElement">
|
||||
<xsd:group ref="objectList" minOccurs="1"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="lookupMethod">
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="object" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="constructorArgument">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines constructor argument.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!--
|
||||
<xsd:element name="add" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType mixed="true">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" use="required" type="xsd:string"/>
|
||||
<xsd:attribute name="delimiters" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="importElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Import an external file containing object definitions into this file.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="resource" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="aliasElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines an additional alias name for an object definition.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="alias" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="objectMap">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapEntryElement" name="entry" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapEntryElement">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapKeyElement" name="key" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="key-ref" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapKeyElement">
|
||||
<xsd:group ref="objectList" minOccurs="1"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="lookupMethod">
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="object" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="constructorArgument">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines constructor argument.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional named parameter attribute,
|
||||
to specify a named parameter in the constructor argument list.
|
||||
-->
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional index attribute,
|
||||
to specify the exact index in the constructor argument list. Only needed
|
||||
to avoid ambiguities, e.g. in case of 2 arguments of the same type.
|
||||
-->
|
||||
<xsd:attribute name="index" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="index" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional type attribute,
|
||||
to specify the exact type of the constructor argument. Only needed
|
||||
to avoid ambiguities, e.g. in case of 2 single argument constructors
|
||||
that can both be converted from a String.
|
||||
-->
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="property">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines property.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!-- The property name attribute is the name of the objects property. -->
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="property">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines property.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!-- The property name attribute is the name of the objects property. -->
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="metaType">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The key name of the metadata attribute being defined.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The value of the metadata attribute being defined (as a simple String).
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="qualifierType">
|
||||
<xsd:complexType name="metaType">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The key name of the metadata attribute being defined.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The value of the metadata attribute being defined (as a simple String).
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="qualifierType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
Object definitions can provide qualifiers to match against attributes
|
||||
on a field or parameter for fine-grained autowire candidate resolution.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="attribute" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="type" type="nonNullString" default="Spring.Objects.Factory.Attributes.QualifierAttribute"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="attribute" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="type" type="nonNullString" default="Spring.Objects.Factory.Attributes.QualifierAttribute"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="vanillaObject">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a single named object.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<!--
|
||||
<xsd:complexType name="vanillaObject">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a single named object.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<!--
|
||||
Object definitions can specify zero or more constructor arguments.
|
||||
They correspond to either a specific index of the constructor argument list
|
||||
or are supposed to be matched generically by type.
|
||||
This is an alternative to "autowire constructor".
|
||||
-->
|
||||
<xsd:element name="constructor-arg" type="constructorArgument" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
<xsd:element name="constructor-arg" type="constructorArgument" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
Object definitions can have zero or more properties.
|
||||
Spring supports primitives, references to other objects in the same or
|
||||
related factories, lists, dictionaries and properties.
|
||||
-->
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
Object definitions can specify zero or more lookup-methods.
|
||||
-->
|
||||
<xsd:element name="lookup-method" type="lookupMethod" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definitions can have zero or more replaced-methods. -->
|
||||
<xsd:element name="replaced-method" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="arg-type" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="match" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="replacer" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="lookup-method" type="lookupMethod" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definitions can have zero or more replaced-methods. -->
|
||||
<xsd:element name="replaced-method" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="arg-type" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="match" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definitions can have zero or more subscriptions. -->
|
||||
<xsd:element name="listener" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="ref" type="objectOrClassReference" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!-- The event(s) the object is interested in. -->
|
||||
<xsd:attribute name="event" type="nonNullString" use="optional"/>
|
||||
<!-- The name or name pattern of the method that will handle the event(s). -->
|
||||
<xsd:attribute name="method" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definition can have zero or more meta attribute definitions used for autowiring dependencies -->
|
||||
<xsd:element name="meta" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definition can have zero or more qualifier definition used for autowiring dependencies -->
|
||||
<xsd:element name="qualifier" type="qualifierType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="replacer" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definitions can have zero or more subscriptions. -->
|
||||
<xsd:element name="listener" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="ref" type="objectOrClassReference" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!-- The event(s) the object is interested in. -->
|
||||
<xsd:attribute name="event" type="nonNullString" use="optional"/>
|
||||
<!-- The name or name pattern of the method that will handle the event(s). -->
|
||||
<xsd:attribute name="method" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definition can have zero or more meta attribute definitions used for autowiring dependencies -->
|
||||
<xsd:element name="meta" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definition can have zero or more qualifier definition used for autowiring dependencies -->
|
||||
<xsd:element name="qualifier" type="qualifierType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Objects can be identified by an id, to enable reference checking.
|
||||
There are constraints on a valid XML id: if you want to reference your object
|
||||
in .NET code using a name that's illegal as an XML id, use the optional
|
||||
"name" attribute. If neither given, the object type name is used as id.
|
||||
-->
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional"/>
|
||||
<!--
|
||||
Optional. Can be used to create one or more aliases illegal in an id.
|
||||
Multiple aliases can be separated by any number of spaces or commas.
|
||||
-->
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Each object definition must specify the full, assembly qualified of the type,
|
||||
or the name of the parent object from which the type can be worked out.
|
||||
|
||||
@@ -386,16 +386,16 @@
|
||||
singleton status. It will inherit all of the parent's other parameters
|
||||
like lazy initialization or autowire settings.
|
||||
-->
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Is this object "abstract", i.e. not meant to be instantiated itself but
|
||||
rather just serving as parent for concrete child object definitions?
|
||||
Default is false. Specify true to tell the object factory to not try to
|
||||
instantiate that particular object in any case.
|
||||
-->
|
||||
<xsd:attribute name="abstract" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
<xsd:attribute name="abstract" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
Is this object a "singleton" (one shared instance, which will
|
||||
be returned by all calls to GetObject() with the id),
|
||||
or a "prototype" (independent instance resulting from each call to
|
||||
@@ -404,8 +404,8 @@
|
||||
Singletons are most commonly used, and are ideal for multi-threaded
|
||||
service objects.
|
||||
-->
|
||||
<xsd:attribute name="singleton" type="xsd:boolean" use="optional" default="true"/>
|
||||
<!--
|
||||
<xsd:attribute name="singleton" type="xsd:boolean" use="optional" default="true"/>
|
||||
<!--
|
||||
Optional attribute controlling the scope of singleton instances. It is
|
||||
only applicable to ASP.Net web applications and it has no effect on prototype
|
||||
objects. Applications other than ASP.Net web applications simply ignore this attribute.
|
||||
@@ -426,30 +426,30 @@
|
||||
Server.Transfer method, they can easily share the state by configuring dependency to the same
|
||||
request-scoped object.
|
||||
-->
|
||||
<xsd:attribute name="scope" use="optional" default="application">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="application"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="request"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="scope" use="optional" default="application">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="application"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="request"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object to be lazily initialized?
|
||||
If false, it will get instantiated on startup by object factories
|
||||
that perform eager initialization of singletons.
|
||||
-->
|
||||
<xsd:attribute name="lazy-init" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="lazy-init" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Optional attribute controlling whether to "autowire" object properties.
|
||||
This is an automagical process in which object references don't need to be coded
|
||||
explicitly in the XML object definition file, but Spring works out dependencies.
|
||||
@@ -487,23 +487,38 @@
|
||||
always override autowiring. Autowire behaviour can be combined with dependency
|
||||
checking, which will be performed after all autowiring has been completed.
|
||||
-->
|
||||
<xsd:attribute name="autowire" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object the rpimary object if type resolving during Autowiring
|
||||
-->
|
||||
<xsd:attribute name="primary" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
<xsd:attribute name="autowire" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Indicates whether or not this object should be considered when looking
|
||||
for matching candidates to satisfy another object's autowiring requirements.
|
||||
Note that this does not affect explicit references by name, which will get
|
||||
resolved even if the specified bean is not marked as an autowire candidate.
|
||||
-->
|
||||
<xsd:attribute name="autowire-candidate" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object the rpimary object if type resolving during Autowiring
|
||||
-->
|
||||
<xsd:attribute name="primary" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
Optional attribute controlling whether to check whether all this
|
||||
objects dependencies, expressed in its properties, are satisfied.
|
||||
Default is no dependency checking.
|
||||
@@ -512,18 +527,18 @@
|
||||
"object" includes collaborators (other objects in the factory)
|
||||
"all" includes both types of dependency checking
|
||||
-->
|
||||
<xsd:attribute name="dependency-check" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="dependency-check" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
The names of the objects that this object depends on being initialized.
|
||||
The object factory will guarantee that these objects get initialized before.
|
||||
|
||||
@@ -531,85 +546,92 @@
|
||||
constructor arguments. This property should just be necessary for other kinds
|
||||
of dependencies like statics (*ugh*) or database preparation on startup.
|
||||
-->
|
||||
<xsd:attribute name="depends-on" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="depends-on" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Optional attribute for the name of the custom initialization method
|
||||
to invoke after setting object properties. The method must have no arguments,
|
||||
but may throw any exception.
|
||||
-->
|
||||
<xsd:attribute name="init-method" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="init-method" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Optional attribute for the name of the custom destroy method to invoke
|
||||
on object factory shutdown. The method must have no arguments,
|
||||
but may throw any exception. Note: Only invoked on singleton objects!
|
||||
-->
|
||||
<xsd:attribute name="destroy-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-object" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="destroy-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-object" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="objects">
|
||||
<xsd:element name="objects">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>The document root. At least one object definition is required.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description"
|
||||
minOccurs="0" maxOccurs="1" />
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="import" type="importElement" />
|
||||
<xsd:element name="alias" type="aliasElement" />
|
||||
<xsd:element name="object" type="vanillaObject" />
|
||||
<xsd:any namespace="##other"
|
||||
processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Default values for all object definitions. Can be overridden at
|
||||
the "object" level. See those attribute definitions for details.
|
||||
-->
|
||||
<xsd:attribute name="default-lazy-init" type="xsd:boolean"
|
||||
use="optional" default="false" />
|
||||
<xsd:attribute name="default-merge" type="xsd:boolean"
|
||||
use="optional" default="false" />
|
||||
<xsd:attribute name="default-dependency-check"
|
||||
use="optional" default="none">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none" />
|
||||
<xsd:enumeration value="objects" />
|
||||
<xsd:enumeration value="simple" />
|
||||
<xsd:enumeration value="all" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire" use="optional"
|
||||
default="no">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no" />
|
||||
<xsd:enumeration value="byName" />
|
||||
<xsd:enumeration value="byType" />
|
||||
<xsd:enumeration value="constructor" />
|
||||
<xsd:enumeration value="autodetect" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-init-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>The document root. At least one object definition is required.</xsd:documentation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'init-method' value; see the documentation for the
|
||||
'init-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="import" type="importElement"/>
|
||||
<xsd:element name="alias" type="aliasElement"/>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<xsd:any namespace="##other" processContents="strict"/>
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Default values for all object definitions. Can be overridden at
|
||||
the "object" level. See those attribute definitions for details.
|
||||
-->
|
||||
<xsd:attribute name="default-lazy-init" type="xsd:boolean" use="optional" default="false"/>
|
||||
<xsd:attribute name="default-merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
<xsd:attribute name="default-dependency-check" use="optional" default="none">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire" use="optional" default="no">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-init-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'init-method' value; see the documentation for the
|
||||
'init-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-destroy-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'destroy-method' value; see the documentation for the
|
||||
'destroy-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-destroy-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'destroy-method' value; see the documentation for the
|
||||
'destroy-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire-candidates" type="xsd:string" use="optional" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -1608,6 +1608,36 @@ namespace Spring.Objects.Factory
|
||||
Assert.AreEqual(ExpectedAge, child.Age);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectByTypeWithAmbiguity()
|
||||
{
|
||||
DefaultListableObjectFactory lbf = new DefaultListableObjectFactory();
|
||||
RootObjectDefinition bd1 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition bd2 = new RootObjectDefinition(typeof(TestObject));
|
||||
lbf.RegisterObjectDefinition("bd1", bd1);
|
||||
lbf.RegisterObjectDefinition("bd2", bd2);
|
||||
|
||||
Assert.That(delegate { lbf.GetObject<TestObject>(); }, Throws.Exception.TypeOf<NoSuchObjectDefinitionException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectByTypeFiltersOutNonAutowireCandidates()
|
||||
{
|
||||
DefaultListableObjectFactory lbf = new DefaultListableObjectFactory();
|
||||
RootObjectDefinition bd1 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition bd2 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition na1 = new RootObjectDefinition(typeof(TestObject));
|
||||
na1.IsAutowireCandidate = false;
|
||||
|
||||
lbf.RegisterObjectDefinition("bd1", bd1);
|
||||
lbf.RegisterObjectDefinition("na1", na1);
|
||||
TestObject actual = lbf.GetObject<TestObject>(); // na1 was filtered
|
||||
Assert.That(lbf.GetObject("bd1", typeof(TestObject)), Is.SameAs(actual));
|
||||
|
||||
lbf.RegisterObjectDefinition("bd2", bd2);
|
||||
Assert.That(delegate { lbf.GetObject<TestObject>(); }, Throws.Exception.TypeOf<NoSuchObjectDefinitionException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectDefinitionResolvesAliases()
|
||||
{
|
||||
|
||||
@@ -354,5 +354,37 @@ namespace Spring.Objects.Factory.Xml
|
||||
Assert.AreEqual("test1", od2.DependsOn[0]);
|
||||
Assert.AreEqual(DependencyCheckingMode.Simple, od2.DependencyCheck);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParsesAutowireCandidate()
|
||||
{
|
||||
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
|
||||
XmlObjectDefinitionReader reader = new XmlObjectDefinitionReader(of);
|
||||
reader.LoadObjectDefinitions(new StringResource(
|
||||
@"<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<objects xmlns='http://www.springframework.net' default-autowire-candidates='test1*,test4*'>
|
||||
<object id='test1' type='Spring.Objects.TestObject, Spring.Core.Tests' />
|
||||
<object id='test2' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='false' />
|
||||
<object id='test3' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='true' />
|
||||
<object id='test4' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='default' />
|
||||
<object id='test5' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='default' />
|
||||
</objects>
|
||||
"));
|
||||
var od = (AbstractObjectDefinition)of.GetObjectDefinition("test1");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "No attribute set should default to true");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test2");
|
||||
Assert.That(od.IsAutowireCandidate, Is.False, "Specifically attribute set to false should set to false");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test3");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "Specifically attribute set to true should set to false");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test4");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "Attribute set to default should check pattern and return true");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test5");
|
||||
Assert.That(od.IsAutowireCandidate, Is.False, "Attribute set to default should check pattern and return false");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user