TransactionManager.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Bridge / TransactionManager.cs / 1 / TransactionManager.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.Transactions.Bridge
{ 
    using System;
    using System.Collections; 
    using System.Configuration; 
    using System.ServiceModel.Internal;
 
    // The TransactionManager type represents a transaction manager
    // from the viewpoint of the propagation protocol.  The MSTB
    // service (or equivalent) creates one TransactionManager object
    // per protocol. 
    //
    abstract class TransactionManager 
    { 
        protected TransactionManager( )
        { 
            PropagationProtocolsTracing.TraceVerbose( "TransactionManager::TransactionManager" );
            id = Guid.NewGuid( );
            PropagationProtocolsTracing.TraceVerbose( id.ToString( "B", null ) );
        } 

        public void Initialize(string fullyQualifiedTypeName, object bridgeConfig) 
        { 
            PropagationProtocolsTracing.TraceVerbose( "TransactionManager::Initialize" );
            PropagationProtocolsTracing.TraceVerbose( fullyQualifiedTypeName ); 

            if (!TransactionBridge.IsAssemblyMicrosoftSigned( fullyQualifiedTypeName ))
            {
                PropagationProtocolsTracing.TraceVerbose( "Protocol type has wrong signature: " + 
                                                         fullyQualifiedTypeName);
 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( 
                    new ConfigurationErrorsException(SR.GetString(SR.ProtocolTypeWrongSignature)));
            } 

            this.bridgeConfig = bridgeConfig;

            // 1. create a object of the type specified by the fully qualified 
            //    name; cast as IProtocolProvider
            Type type = Type.GetType( fullyQualifiedTypeName, true ); 
 
            PropagationProtocolsTracing.TraceVerbose( type.ToString( ) );
 
            protocolProvider = (IProtocolProvider) Activator.CreateInstance( type );

            // 2. call initialize on the transaction manager
            this.Initialize(); 

            // 3. get the protocol provider's coordinator and propagation services 
            protocolProviderCoordinatorService = protocolProvider.CoordinatorService; 
            protocolProviderPropagationService = protocolProvider.PropagationService;
        } 

        // The following overrides are called in the following order
        abstract public void Initialize();
        abstract public void Start(); 
        abstract public void Recover();
 
        abstract public void Stop( ); 

        // Expose a property for the provider to query the Max log entry size enforced by PPL. 
        abstract public int MaxLogEntrySize
        {
            get ;
        } 

        public TransactionManagerCoordinatorService CoordinatorService 
        { 
            get{ return transactionManagerCoordinatorService; }
        } 

        public TransactionManagerPropagationService PropagationService
        {
            get{ return transactionManagerPropagationService;} 
        }
 
        public TransactionManagerSettings Settings 
        {
            get { return TransactionManagerSettings; } 
        }

        override public string ToString( )
        { 
            return this.GetType( ).ToString( ) + " " + id.ToString( "B", null );
        } 
 
        public IProtocolProvider IProtocolProvider
        { 
            get { return protocolProvider; }
        }

        public IProtocolProviderCoordinatorService IProtocolProviderCoordinatorService 
        {
            get { return protocolProviderCoordinatorService; } 
        } 

        public IProtocolProviderPropagationService IProtocolProviderPropagationService 
        {
            get{ return protocolProviderPropagationService; }
        }
 
        protected TransactionManagerCoordinatorService TransactionManagerCoordinatorService
        { 
            get { return transactionManagerCoordinatorService; } 
            set { transactionManagerCoordinatorService = value; }
        } 

        protected TransactionManagerPropagationService TransactionManagerPropagationService
        {
            get { return transactionManagerPropagationService; } 
            set { transactionManagerPropagationService = value; }
        } 
 
        protected TransactionManagerSettings TransactionManagerSettings
        { 
            get { return transactionManagerSettings; }
            set { transactionManagerSettings = value; }
        }
 
        protected object BridgeConfiguration
        { 
            get { return bridgeConfig; } 
        }
 
        protected static void UnhandledExceptionHandler(Exception exception)
        {
            DiagnosticUtility.InvokeFinalHandler(exception);
        } 

        /* ------------------------------------------------------------------- 
         * attributes 
         * ----------------------------------------------------------------- */
        private IProtocolProvider protocolProvider; 
        private IProtocolProviderCoordinatorService protocolProviderCoordinatorService;
        private IProtocolProviderPropagationService protocolProviderPropagationService;

        private TransactionManagerCoordinatorService transactionManagerCoordinatorService; 
        private TransactionManagerPropagationService transactionManagerPropagationService;
        private TransactionManagerSettings transactionManagerSettings; 
 
        private Guid id;
        private object bridgeConfig; 

    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK