Spring.Services Exports components as ServicedComponents using the specified s. This class will create ServicedComponent wrapper for each of the specified components and register them with the Component Services. First you need to generate and register your components. This is done by writing a simple e.g. console application using a configuration as shown below: <!-- actual objects 'calculatorService' and 'simpleCalculatorService' are defined elsewhere --> <!-- Define the component for exporting 'calculatorService' --> <object id="calculatorComponent" type="Spring.EnterpriseServices.ServicedComponentExporter, Spring.Services"> <property name="TargetName" value="calculatorService" /> <property name="TypeAttributes"> <list> <object type="System.EnterpriseServices.TransactionAttribute, System.EnterpriseServices" /> </list> </property> <property name="MemberAttributes"> <dictionary> <entry key="*"> <list> <object type="System.EnterpriseServices.AutoCompleteAttribute, System.EnterpriseServices" /> </list> </entry> </dictionary> </property> </object> <!-- Define the component for exporting 'simpleCalculatorService' --> <object id="simpleCalculatorComponent" type="Spring.EnterpriseServices.ServicedComponentExporter, Spring.Services"> <property name="TargetName" value="simpleCalculatorService" /> </object> <!-- Export components into assembly and autoregister with COM+ --> <object type="Spring.EnterpriseServices.EnterpriseServicesExporter, Spring.Services"> <!-- assembly name to generated - will generate 'Spring.Calculator.EnterpriseServices.dll' --> <property name="Assembly" value="Spring.Calculator.EnterpriseServices" /> <!-- use Spring's ContextRegistry for managing services. If true, requires a file 'Spring.Calculator.EnterpriseServices.dll.spring-context.xml' containing a <spring/context /> section placed next to the generated assembly. --> <property name="UseSpring" value="true" /> <property name="ApplicationName" value="Spring Calculator Application" /> <property name="ActivationMode" value="Library" /> <property name="Description" value="Spring Calculator application" /> <property name="Components"> <list> <ref object="calculatorComponent" /> <ref object="simpleCalculatorComponent" /> </list> </property> </object> To load your objectdefinitions at runtime of the components, place a configuration file next to the assembly generated by the exporter, using the filename of the exported assembly, postfixing it with '.spring-context.config'. Taking the example above, the file must be named 'Spring.Calculator.EnterpriseServices.dll.spring-context.xml' and look like: <-- --> <spring> <context> <resource uri="Config/services.xml" /> </context> </spring> This file should point to the service object definitions you exported using with a configuration as shown above. Aleksandar Seovic Erich Eichinger Creates new enterprise services exporter. Called by Spring container after object is configured in order to initialize it. Creates ServicedComponent wrappers for the specified components and registers them with COM+ Component Services. Generates all configured to the given assembly. Generates service types from the list of instances into the given assembly. the module to export types to the object factory to resolve target types the list of instances. whether to generate context lookups, Reads key pair from embedded resource. Key pair as a byte array. Applies custom attributes to generated assembly. Dynamic assembly to apply attributes to. Replaces roles expressed using string with appropriate SecurityRoleAttribute instance. Parses string representation of SecurityRoleAttribute. Role definition string. Configured SecurityRoleAttribute instance. Creates the SpringServicedComponent base class to derive all s from. internal class SpringServicedComponent: BaseType { protected delegate object GetObjectHandler(ServicedComponent servicedComponent, string targetName); protected static readonly GetObjectHandler getObjectRef; static SpringServicedComponent() { // first look for a local copy System.Reflection.Assembly servicesAssembly; string servicesAssemblyPath = Path.Combine( new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName , "Spring.Services.dll" ); servicesAssembly = System.Reflection.Assembly.LoadFrom(servicesAssemblyPath); if (servicesAssembly == null) { // then let the normal loader handle the typeload servicesAssembly = System.Reflection.Assembly.Load("Spring.Services, culture=neutral, version=x.x.x.x, publicKey=xxxxxxxx"); } Type componentHelperType = servicesAssembly.GetType("Spring.EnterpriseServices.ServicedComponentHelper"); getObjectRef = (GetObjectHandler) Delegate.CreateDelegate(typeof(GetObjectHandler) , componentHelperType.GetMethod("GetObject")); } } Gets or sets list of components to export. Gets or sets COM+ application name. Gets or sets application identifier (GUID). Defaults to generated GUID if not specified. Gets or sets application activation mode, which can be either Server or Library (default). Gets or sets application description. Gets or sets access control attribute. Gets or sets application queuing attribute. Gets or sets application roles. Gets or sets name of the generated assembly that will contain serviced components. Use Spring context to configure the serviced components within COM. Sets object factory instance. SUBJECT TO CHANGE -FOR INTERNAL USE ONLY!
Holds configuration information from a given configuration file, obtained by . You may use to replace the active configuration system.
initializes this instance with a path to be passed into Purges cached configuration Set the nested configuration system to delegate calls in case we can't resolve a config section ourselves Get the specified section Only true if the underlying config system supports this. Handles loading of <spring/context> configuration sections for in-process s generated by . Erich Eichinger Prevent auto-registering the context with the global ContextRegistry Encapsulates information necessary to create ServicedComponent wrapper around target class. Instances of this class should be used as elements in the Components list of the class, which will register them with COM+ Services. For a full description on how to export and use services with COM+, see the reference. Aleksandar Seovic Erich Eichinger Creates a new instance of the class. Validate configuration. Creates ServicedComponent wrapper around target class. Dynamic module builder to use Type of the exported object. whether to generate lookups in ContextRegistry for each service method call or use a 'new'ed target instance if is true, each ServicedComponent method call will look similar to class MyServicedComponent { void MethodX() { ContextRegistry.GetContext().GetObject("TargetName").MethodX(); } }
if is false, the instance will be simply created at component activation using 'new': class MyServicedComponent { TargetType target = new TargetType(); void MethodX() { target.MethodX(); } }
The differences are of course that in the former case, the target lifecycle is entirely managed by Spring, thus avoiding issues with ServiceComponent activation/deactivation as well as removing the need for default constructors.
Gets or sets name of the target object that should be exposed as a serviced component. Gets or sets the list of interfaces whose methods should be exported. The default value of this property is all the interfaces implemented or inherited by the target type. The interfaces to export. Gets or sets a list of custom attributes that should be applied to a proxy class. Gets or sets a dictionary of custom attributes that should be applied to proxy members. Map key is an expression that members can be matched against. Value is a list of attributes that should be applied to each member that matches expression. Set the name of the object in the object factory that created this object. Suppress output to avoid Spring.Core dependency Implements default constructor for the proxy class. Generates the IL instructions that pushes the target instance on which calls should be delegated to. The IL generator to use. Factory Object that instantiates and configures ServicedComponent.

This factory object should be used to instantiate and configure serviced components created by .

Aleksandar Seovic
Creates new instance of serviced component factory. Returns configured instance of the serviced component. Configured instance of the serviced component. Initializes factory object. Creates new instance of serviced component. New instance of serviced component. Gets or sets component name, as registered with COM+ Services. Gets or sets name of the remote server that COM+ component is registered with. Returns type of serviced component. Gets or sets whether serviced component should be treated as singleton. Default is false. Gets or sets the template object definition that should be used to configure proxy instance. This class supports s exported using . and must never be used directly. Erich Eichinger Reads in the 'xxx.spring-context.xml' configuration file associated with the specified . See for an in-depth description on how to export and configure COM+ components. Called by a exported by to obtain a reference to the service it proxies. Implementation of the custom configuration parser for remoting definitions. Bruno Baia Initializes a new instance of the class. Parse the specified element and register any resulting IObjectDefinitions with the IObjectDefinitionRegistry that is embedded in the supplied ParserContext. The element to be parsed into one or more IObjectDefinitions The object encapsulating the current state of the parsing process. The primary IObjectDefinition (can be null as explained above) Implementations should return the primary IObjectDefinition that results from the parse phase if they wish to used nested inside (for example) a <property> tag. Implementations may return null if they will not be used in a nested scenario. Parses remoting definitions. Validator XML element. The name of the object definition. The parser context. A remoting object definition. Parses the RemotingConfigurer definition. The element to parse. The name of the object definition. The parser context. RemotingConfigurer object definition. Parses the SaoFactoryObject definition. The element to parse. The name of the object definition. The parser context. SaoFactoryObject object definition. Parses the CaoFactoryObject definition. The element to parse. The name of the object definition. The parser context. CaoFactoryObject object definition. Parses the RemoteObjectFactory definition. The element to parse. The name of the object definition. The parser context. RemoteObjectFactory object definition. Parses the SaoExporter definition. The element to parse. The name of the object definition. The parser context. SaoExporter object definition. Parses the CaoExporter definition. The element to parse. The name of the object definition. The parser context. CaoExporter object definition. Parses the LifeTime definition. Gets the name of the object type for the specified element. The element. The name of the object type. This class extends to allow users to define object lifecycle details by simply setting its properties.

Remoting exporters uses this class as a base proxy class in order to support lifecycle configuration when exporting a remote object.

Aleksandar Seovic
Initializes a new instance of the class. Obtains a lifetime service object to control the lifetime policy for this instance.

This method uses property values to configure for this object.

It is very much inspired by Ingo Rammer's example in Chapter 6 of "Advanced .NET Remoting", but is modified slightly to make it more "Spring-friendly". Basically, the main difference is that instead of pulling lease configuration from the .NET config file, this implementation relies on Spring DI to get appropriate values injected, which makes it much more flexible.

An object of type used to control the lifetime policy for this instance. This is the current lifetime service object for this instance if one exists; otherwise, a new lifetime service object initialized to the value of the property. The immediate caller does not have infrastructure permission.
Gets or sets a value indicating whether this instance has infinite lifetime. if this instance has infinite lifetime; otherwise, . Gets or sets the initial lease time. The initial lease time. Gets or sets the amount of time lease should be extended for on each call to this object. The amount of time lease should be extended for on each call to this object. Gets or sets the amount of time lease manager will for this object's sponsors to respond. The amount of time lease manager will for this object's sponsors to respond. Configurable implementation of the interface. Bruno Baia Defines lifetime's properties of remote objects that is used by Spring. Bruno Baia Gets or sets a value indicating whether this instance has infinite lifetime. true if this instance has infinite lifetime; otherwise, false. Gets the initial lease time. The initial lease time. Gets the amount of time lease should be extended for on each call to this object. The amount of time lease should be extended for on each call to this object. Gets the amount of time lease manager will for this object's sponsors to respond. The amount of time lease manager will for this object's sponsors to respond. Gets or sets a value indicating whether this instance has infinite lifetime. true if this instance has infinite lifetime; otherwise, false. Gets or sets the initial lease time. The initial lease time. Gets or sets the amount of time lease should be extended for on each call to this object. The amount of time lease should be extended for on each call to this object. Gets or sets the amount of time lease manager will for this object's sponsors to respond. The amount of time lease manager will for this object's sponsors to respond. Interface for a CAO based object factory.

Provides a well known location for clients to retrieve references to CAO references.

Aleksandar Seovic Mark Pollack Bruno Baia
Returns the CAO proxy. The remote object. Returns the CAO proxy using the argument list to call the constructor. The matching of arguments to call the constructor is done by type. The alternative ways, by index and by constructor name are not supported. Constructor arguments used to create the object. The remote object. Builds a proxy type based on to wrap a target object that is intended to be remotable. Bruno Baia Creates a new instance of the class. The lifetime properties to be applied to the target object. Creates a remotable proxy type based on . The generated proxy class. If the is not an instance of . Implements constructors for the proxy class. The to use. Generate initialization code for 's lifetime properties. ILGenerator Registers an object type on the server as a Client Activated Object (CAO). Aleksandar Seovic Mark Pollack Bruno Baia Creates a new instance of the class. Publish the object Disconnect the remote object from the registered remoting channels. Gets or sets the name of the target object definition. Gets or sets the list of interfaces whose methods should be exported. The default value of this property is all the interfaces implemented or inherited by the target type. The interfaces to export. Sets the that this object runs in.

Normally this call will be used to initialize the object.

Invoked after population of normal object properties but before an init callback such as 's or a custom init-method. Invoked after the setting of any 's property.

In the case of application context initialization errors. If thrown by any application context methods.
Sets object factory to use. This class extends to allow CAOs to be disconnect from the client. Create a new instance of the RemoteFactory. Returns the CAO proxy. The remote object. Returns the CAO proxy using the argument list to call the constructor. The matching of arguments to call the constructor is done by type. The alternative ways, by index and by constructor name are not supported. Constructor arguments used to create the object. The remote object. Set infinite lifetime. Factory for creating a reference to a client activated object (CAO). Aleksandar Seovic Mark Pollack Bruno Baia Creates a new instance of the class. Callback method called once all factory properties have been set. if an error occured Return the CAO proxy. the CAO proxy The remote target name to activate. The Uri of the remote type. Argument list used to call the CAO constructor. Always return false. The type of object to be created. Factory for creating MarshalByRefObject wrapper around target class. Bruno Baia Creates a new instance of the MarshalByRefObjectFactory. Initializes factory object. Creates new instance of the remotable target proxy. New instance of the remotable target proxy. Gets or sets the target object. Gets or sets the class or subclass that the proxy must inherit from. Gets or sets the list of interfaces to wrap. The default value of this property is all the interfaces implemented or inherited by the target type. The interfaces to export. Returns type of the remotable target proxy. Always returns false. Convenience class to configure remoting infrastructure from the IoC container. Bruno Baia Initializes a new instance of the class. Modify the application context's internal object factory after its standard initialization. The object factory used by the application context. Gets or sets the name of the remoting configuration file. If filename is or not set, current AppDomain's configuration file will be used. Indicates whether a configuration file is used. Default value is . If , default remoting configuration will be used. Gets or sets if security is enabled. This property is only available since .NET Framework 2.0. Return the order value of this object, where a higher value means greater in terms of sorting. Publishes an instance of an object under a given url as a Server Activated Object (SAO). Remoting servers exported by always correspond to . Objects can be exported either as SingleCall or Singleton by marking the exported object identified by as either singleton or prototype. Aleksandar Seovic Mark Pollack Bruno Baia Erich Eichinger Holds EXPORTER_ID to SaoExporter instance mappings. Returns the target object instance exported by the SaoExporter identified by . Creates a new instance of the class. Cleanup before GC Publish the object Disconnect the remote object from the registered remoting channels. Stops exporting the object identified by . true to release both managed and unmanaged resources; false to release only unmanaged resources. Gets or sets the name of the target object definition. Gets or sets the name of the remote application. Gets or sets the name of the exported remote service. The name that will be used in the URI to refer to this service. This will be of the form, tcp://host:port/ServiceName or tcp://host:port/ApplicationName/ServiceName Gets or sets the list of interfaces whose methods should be exported. The default value of this property is all the interfaces implemented or inherited by the target type. The interfaces to export. Sets object factory to use. Builds a proxy type based on to wrap a target object that is intended to be remotable. The wrapped target object is retrieved by name from the IoC container. Creates a new instance of the class. The exporter to be associated with the proxy. Generates the IL instructions that pushes the target instance on which calls should be delegated to. The IL generator to use. Implements constructors for the proxy class. The to use. Deaclares a field that holds the target object instance. The builder to use for code generation. Factory for creating a reference to a remote server activated object (SAO). This is useful alternative to adminstrative type registration on the client when you would like the client to have only a reference to the interface that an SAO implements and not the actual SAO implentation. Aleksandar Seovic Mark Pollack Bruno Baia Creates a new instance of the SaoFactoryObject class. Callback method called once all factory properties have been set. if an error occured Return the SAO proxy. the SAO proxy The remote service interface. The URI of the well known object Is the object managed by this factory a singleton or a prototype? The type of object to be created. Factory that provides instances of to host objects created by Spring's IoC container. Bruno Baia Creates a for a specified Spring-managed object with a specific base address. A reference to a Spring-managed object or to a service type. The of type that contains the base addresses for the service hosted. A for the Spring-managed object. If the Service attribute in the ServiceHost directive was not provided. Factory that provides instances of to host objects created with Spring's IoC container. Bruno Baia The owning factory. The instance managed by this factory. Creates a new instance of the class. Return a instance managed by this factory. An instance of managed by this factory. Publish the object. Close the SpringServiceHost Validates the configuration. Gets or sets the name of the target object that should be exposed as a service. The name of the target object that should be exposed as a service. Gets or sets the base addresses for the hosted service. The base addresses for the hosted service. Controls, whether the underlying should cache the generated proxy types. Defaults to true. Callback that supplies the owning factory to an object instance. Owning (may not be ). The object can immediately call methods on the factory.

Invoked after population of normal object properties but before an init callback like 's method or a custom init-method.

In case of initialization errors.
Return the of object that this creates. Always returns Factory that provides instances of to host objects created by Spring's IoC container. Steve Bohlen Creates a for a specified Spring-managed object with a specific base address. A reference to a Spring-managed object or to a service type. The of type that contains the base addresses for the service hosted. A for the Spring-managed object. If the Service attribute in the ServiceHost directive was not provided. The for the <wcf:channelFactory> tag. Bruno Baia Parse the specified XmlElement and register the resulting ObjectDefinitions with the IObjectDefinitionRegistry embedded in the supplied The element to be parsed. The object encapsulating the current state of the parsing process. Provides access to a IObjectDefinitionRegistry The primary object definition.

This method is never invoked if the parser is namespace aware and was called to process the root node.

Namespace parser for the WCF namespace. Bruno Baia Register the for the WCF tags. Builds a WCF service type. Bruno Baia Target instance calls should be delegated to. Creates a new instance of the class. The name of the service within Spring's IoC container. The to use. Whether to cache the generated service proxy type. Creates a new instance of the class. The name of the service within Spring's IoC container. The name of the generated WCF service . The to use. Whether to cache the generated service proxy type. Creates a proxy that delegates calls to an instance of the target object. This overriden implementation caches the generated proxy type and sets the '__objectFactory' field. If the does not implement any interfaces. Implements constructors for the proxy class. This implementation generates a constructor that gets instance of the target object using . The builder to use. Creates an appropriate type builder. Add a field to hold a reference to the application context. The name to use for the proxy type name. The type to extends if provided. The type builder to use. that creates a channel that is used by clients to send messages to a specified endpoint address. The type of channel produced by the channel factory. Bruno Baia Creates a new instance of the class. The configuration name used for the endpoint. Return an instance (possibly shared or independent) of the channel managed by this factory. An instance (possibly shared or independent) of the channel managed by this factory. Gets the configuration name used for the endpoint. Return the of channel that this creates. Is the object managed by this factory a singleton or a prototype ? Default value is . Exports an object as a WCF service. Bruno Baia The name of the object in the factory. The owning factory. The generated WCF service wrapper type. Creates a new instance of the class. Publish the object Return an instance (possibly shared or independent) of the object managed by this factory. If this method is being called in the context of an enclosing IoC container and returns , the IoC container will consider this factory object as not being fully initialized and throw a corresponding (and most probably fatal) exception. An instance (possibly shared or independent) of the object managed by this factory. Validates the configuration. Generates the WCF service wrapper type. Gets or sets the name of the target object definition. Gets or sets the service contract interface type. If not set, uses the unique interface implemented or inherited by the target type. An error will be thrown if the target type implements more than one interface. The service contract interface type. Gets or sets a list of custom attributes that should be applied to the WCF service class. Gets or sets a dictionary of custom attributes that should be applied to the WCF service members. Dictionary key is an expression that members can be matched against. Value is a list of attributes that should be applied to each member that matches expression. Controls, whether the underlying should cache the generated proxy types. Defaults to true. Gets or sets the name for the <portType> element in Web Services Description Language (WSDL). The default value is the name of the class or interface to which the System.ServiceModel.ServiceContractAttribute is applied. Gets or sets the namespace of the <portType> element in Web Services Description Language (WSDL). The WSDL namespace of the <portType> element. The default value is "http://tempuri.org". Gets or sets the name used to locate the service in an application configuration file. The name used to locate the service element in an application configuration file. The default is the name of the service implementation class. Gets or sets the type of callback contract when the contract is a duplex contract. A that indicates the callback contract. The default is null. Specifies whether the binding for the contract must support the value of the ProtectionLevel property. One of the values. The default is . Gets or sets whether sessions are allowed, not allowed or required. A that indicates whether sessions are allowed, not allowed, or required. Callback that supplies the owning factory to an object instance. Owning (may not be ). The object can immediately call methods on the factory.

Invoked after population of normal object properties but before an init callback like 's method or a custom init-method.

In case of initialization errors.
Return the of object that this creates, or if not known in advance. Is the object managed by this factory a singleton or a prototype? Set the name of the object in the object factory that created this object. The name of the object in the factory.

Invoked after population of normal object properties but before an init callback like 's method or a custom init-method.

Builds a WCF service type. Applies attributes to the proxy class. The type builder to use. The proxied class. Provides a host for Spring-managed services. Bruno Baia Creates a new instance of the class. The name of the service within Spring's IoC container. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The name of the Spring context to use. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The to use. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The to use. Whether to cache the generated service proxy type. The base addresses for the hosted service. Provides a host for Spring-managed services. Bruno Baia Creates a new instance of the class. The name of the service within Spring's IoC container. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The name of the Spring context to use. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The to use. The base addresses for the hosted service. Creates a new instance of the class. The name of the service within Spring's IoC container. The to use. Whether to cache the generated service proxy type. The base addresses for the hosted service. Factory Object that dynamically implements service interface for web service.

This factory object should be used to obtain reference to a web service that can be safely cast to a service interface, which allows client code to code against interface, and not directly against the web service.

The WSDL contract needs to conform to WS-I Basic Profiles.

Bruno Baia Aleksandar Seovic
The web service proxy default constructor. Creates a new instance of the class. Creates new instance of the web service proxy. New instance of the web service proxy. Initializes factory object. Validates the configuration. Generates the web service proxy type. Gets XML Web Services documents from a Spring resource. Gets or sets the base type that web service proxy should inherit. Default is Gets or sets the URI for an that contains the web service description (WSDL). Gets or sets type of the proxy class to wrap. Gets or sets service interface that proxy should implement. Gets or sets the instance to use when connecting to a server that requires authentication. Gets or sets the url of the proxy server to use for retrieving the WSDL.

This only applies when using an as uri.

The default is to use the system proxy setting.

Gets or sets the instance to use when connecting to a proxy server that requires authentication.

This only applies when using an as uri.

Gets or sets the web service binding name to use for the proxy. Gets or sets a list of custom attributes that should be applied to a proxy class. Gets or sets a dictionary of custom attributes that should be applied to web service members. Dictionary key is an expression that members can be matched against. Value is a list of attributes that should be applied to each member that matches expression. Returns type of the web service proxy. Always returns false. Gets or sets the template object definition that should be used to configure proxy instance. Proxy type builder that can be used to create a proxy for derived classes. Creates a new instance of the class. The URI that contains the Web Service meta info (WSDL). The XML Web Service documents to use to create the proxy. The name of the Web Service binding to use. Creates the proxy type. The generated proxy class. Generates the IL instructions that pushes the target instance on which calls should be delegated to. The IL generator to use. Implements constructors for the proxy class. The to use. Search and returns the binding for the specified name. Search and returns the url for the specified binding. Search and returns the operation that matches the specified method. Search and returns the OperationBinding that matches the specified Operation. Search and returns the type mapping between method parameters/return value and the element parts of a literal-use SOAP message. Creates a that should be applied to proxy type. Creates a or a that should be applied to proxy method. Proxy method builder that can be used to create a proxy method for web services operation invocation. Creates a new instance of the method builder. The type builder to use. The implementation to use. Generates the proxy method. The IL generator to use. The method to proxy. The interface definition of the method, if applicable. Proxy type builder that can be used to create a proxy for .Net-generated proxy class that can be safely cast to a service interface. Creates a new instance of the class. Gets the mapping of the interface to proxy into the actual methods on the target type that does not need to implement that interface.

As the proxy type does not implement the interface, we try to find matching methods.

The of the target object. The interface to implement. An interface mapping for the interface to proxy.