Ejemplo n.º 1
0
        /// <summary>
        /// Create an instance of a LoggingService and returns is as an IBuildComponent
        /// </summary>
        /// <returns>An instance of a LoggingService as a IBuildComponent</returns>
        public IBuildComponent CreateInstance(BuildComponentType type)
        {
            ErrorUtilities.VerifyThrow(type == BuildComponentType.LoggingService, "Cannot create components of type {0}", type);
            IBuildComponent loggingService = (IBuildComponent)LoggingService.CreateLoggingService(_logMode, _nodeId);

            return(loggingService);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the a component based on the request component type
        /// </summary>
        public IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
            case BuildComponentType.ConfigCache:
                return((IBuildComponent)_configCache);

            case BuildComponentType.LoggingService:
                return((IBuildComponent)_loggingService);

            case BuildComponentType.RequestEngine:
                return((IBuildComponent)_requestEngine);

            case BuildComponentType.TargetBuilder:
                return((IBuildComponent)_targetBuilder);

            case BuildComponentType.ResultsCache:
                return((IBuildComponent)_resultsCache);

            case BuildComponentType.RequestBuilder:
                return((IBuildComponent)_requestBuilder);

            default:
                throw new ArgumentException("Unexpected type " + type);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets an instance of the specified component type from the host.
        /// </summary>
        /// <param name="type">The component type to be retrieved</param>
        /// <returns>The component</returns>
        public IBuildComponent GetComponent(BuildComponentType type)
        {
            if (!_componentEntriesByType.TryGetValue(type, out BuildComponentEntry componentEntry))
            {
                ErrorUtilities.ThrowInternalError("No factory registered for component type {0}", type);
            }

            return(componentEntry.GetInstance(_host));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a TestExtension for a given component type.
        /// </summary>
        /// <param name="componentName">Name of the component for which the TestExtension is to be created.</param>
        /// <param name="testExtensionName">Fully qualified TestExtension name.</param>
        /// <param name="buildManagerTestExtension">BuildManager Test extension entry.</param>
        /// <returns>New TestExtension.</returns>
        private static TestExtension CreateTestExtensionForComponent(string componentName, string testExtensionName, BuildManagerTestExtension buildManagerTestExtension)
        {
            BuildComponentType type      = StringToEnum <BuildComponentType>(componentName);
            IBuildComponent    component = buildManagerTestExtension.GetComponent(type);
            Type testExtensionType       = Assembly.GetAssembly(typeof(BuildManagerContainerGenerator)).GetType(testExtensionName, true, true);

            object[] parameters = { component };
            return((TestExtension)testExtensionType.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, parameters, CultureInfo.InvariantCulture));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Converts the ComponentType to a BuildComponentType.
 /// </summary>
 /// <param name="componentTypeString">ComponentType string.</param>
 /// <returns>BuildComponentType for the requested string.</returns>
 private static BuildComponentType GetBuildComponentTypeFromComponentType(string componentTypeString)
 {
     try
     {
         BuildComponentType component = StringToEnum <BuildComponentType>(componentTypeString);
         return(component);
     }
     catch (ArgumentException)
     {
         throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Component type: {0} is not a valid MSBuild build component type.", componentTypeString));
     }
 }
 /// <summary>
 /// Constructs and returns a component of the specified type.
 /// </summary>
 /// <param name="type">The type of component to return</param>
 /// <returns>The component</returns>
 public IBuildComponent GetComponent(BuildComponentType type)
 {
     return(type switch
     {
         BuildComponentType.ConfigCache => (IBuildComponent)_configCache,
         BuildComponentType.LoggingService => (IBuildComponent)_loggingService,
         BuildComponentType.ResultsCache => (IBuildComponent)_resultsCache,
         BuildComponentType.RequestBuilder => (IBuildComponent)_requestBuilder,
         BuildComponentType.TargetBuilder => (IBuildComponent)_targetBuilder,
         BuildComponentType.SdkResolverService => (IBuildComponent)_sdkResolverService,
         _ => throw new ArgumentException("Unexpected type " + type),
     });
Ejemplo n.º 7
0
        /// <summary>
        /// This method is passed as a delegate to the BuildManager - so when the BuildManager needs to create an instance of this component this method is invoked.
        /// </summary>
        /// <param name="buildComponentType">Mock object to instantiate.</param>
        /// <returns>IBuildComponent of the Mock.</returns>
        internal IBuildComponent CreateMockComponent(BuildComponentType buildComponentType)
        {
            string typeToMock = buildComponentType.ToString();

            if (String.IsNullOrEmpty(typeToMock))
            {
                throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "No mocks are available for {0} build component type.", buildComponentType.ToString()));
            }

            ComponentType componentType  = StringToEnum <ComponentType>(typeToMock);
            string        typeToMockName = this.Configuration.ComponentsToMock[componentType];
            Type          mockType       = Assembly.GetAssembly(typeof(BuildManagerContainerGenerator)).GetType(typeToMockName, true, true);

            return((IBuildComponent)mockType.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, new object[] { }, CultureInfo.InvariantCulture));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Delegate the types we cannot handle to the test
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
                case BuildComponentType.ConfigCache:
                    return (IBuildComponent)_configCache;

                case BuildComponentType.TestDataProvider:
                    return (IBuildComponent)_testDataProvider;

                case BuildComponentType.RequestEngine:
                    return (IBuildComponent)_requestEngine;
                default:
                    return _getComponent(type);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Delegate the types we cannot handle to the test
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
            case BuildComponentType.ConfigCache:
                return((IBuildComponent)this.configCache);

            case BuildComponentType.TestDataProvider:
                return((IBuildComponent)this.testDataProvider);

            case BuildComponentType.RequestEngine:
                return((IBuildComponent)this.requestEngine);

            default:
                return(this.getComponent(type));
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Provides the components required by the tests
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
                case BuildComponentType.RequestBuilder:
                    RequestBuilder requestBuilder = new RequestBuilder();
                    return (IBuildComponent)requestBuilder;

                case BuildComponentType.TaskBuilder:
                    QAMockTaskBuilder taskBuilder = new QAMockTaskBuilder();
                    return (IBuildComponent)taskBuilder;

                case BuildComponentType.TargetBuilder:
                    TargetBuilder targetBuilder = new TargetBuilder();
                    return (IBuildComponent)targetBuilder;

                case BuildComponentType.ResultsCache:
                    return (IBuildComponent)_resultsCache;

                default:
                    throw new ArgumentException("Unexpected type requested. Type = " + type.ToString());
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Provides the components required by the tests
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
            case BuildComponentType.RequestBuilder:
                RequestBuilder requestBuilder = new RequestBuilder();
                return((IBuildComponent)requestBuilder);

            case BuildComponentType.TaskBuilder:
                QAMockTaskBuilder taskBuilder = new QAMockTaskBuilder();
                return((IBuildComponent)taskBuilder);

            case BuildComponentType.TargetBuilder:
                TargetBuilder targetBuilder = new TargetBuilder();
                return((IBuildComponent)targetBuilder);

            case BuildComponentType.ResultsCache:
                return((IBuildComponent)_resultsCache);

            default:
                throw new ArgumentException("Unexpected type requested. Type = " + type.ToString());
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Register a new build component factory with the host.
 /// </summary>
 public void RegisterFactory(BuildComponentType type, BuildComponentFactoryDelegate factory)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Gets an instance of the specified component type from the host.
        /// </summary>
        /// <param name="type">The component type to be retrieved</param>
        /// <returns>The component</returns>
        public IBuildComponent GetComponent(BuildComponentType type)
        {
            BuildComponentEntry componentEntry = null;

            if (!_componentEntriesByType.TryGetValue(type, out componentEntry))
            {
                ErrorUtilities.ThrowInternalError("No factory registered for component type {0}", type);
            }

            return componentEntry.GetInstance(_host);
        }
 /// <summary>
 /// Constructor for existing singleton.
 /// </summary>
 public BuildComponentEntry(BuildComponentType type, IBuildComponent singleton)
 {
     _singleton = singleton;
     this.Pattern = CreationPattern.Singleton;
 }
 /// <summary>
 /// Shuts down a specific singleton component.
 /// </summary>
 public void ShutdownComponent(BuildComponentType componentType)
 {
     BuildComponentEntry existingEntry = _componentEntriesByType[componentType];
     existingEntry.ShutdownSingletonInstance();
 }
 /// <summary>
 /// Registers a factory to replace one of the defaults.  Creation pattern is inherited from the original.
 /// </summary>
 /// <param name="componentType">The type which is created by this factory.</param>
 /// <param name="instance">The instance to be registered.</param>
 public void ReplaceFactory(BuildComponentType componentType, IBuildComponent instance)
 {
     ErrorUtilities.VerifyThrow(_componentEntriesByType[componentType].Pattern == CreationPattern.Singleton, "Previously existing factory for type {0} was not a singleton factory.", componentType);
     _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, instance);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType componentType)
 {
     ErrorUtilities.VerifyThrow(componentType == BuildComponentType.ResultsCache, "Cannot create components of type {0}", componentType);
     return new ResultsCache();
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Constructor for existing singleton.
 /// </summary>
 public BuildComponentEntry(BuildComponentType type, IBuildComponent singleton)
 {
     ComponentType = type;
     _singleton    = singleton;
     Pattern       = CreationPattern.Singleton;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Class factory for component creation.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.TargetBuilder, "Cannot create components of type {0}", type);
     return new TargetBuilder();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Constructs and returns a component of the specified type.
        /// </summary>
        public IBuildComponent GetComponent(BuildComponentType type)
        {
            IBuildComponent returnComponent = null;

            switch(type)
            {
                case BuildComponentType.LoggingService: // Singleton
                    return (IBuildComponent)this.loggingService;

                case BuildComponentType.TestDataProvider: // Singleton
                    if (this.testDataProvider != null)
                    {
                        return (IBuildComponent)this.testDataProvider;
                    }

                    returnComponent = this.getComponentCallback(type);
                    if (returnComponent != null)
                    {
                        returnComponent.InitializeComponent(this);
                        this.testDataProvider = (ITestDataProvider)returnComponent;
                    }

                    break;

                case BuildComponentType.RequestEngine: // Singleton
                    if (this.requestEngine != null)
                    {
                        return (IBuildComponent)this.requestEngine;
                    }

                    returnComponent = this.getComponentCallback(type);
                    if (returnComponent != null)
                    {
                        returnComponent.InitializeComponent(this);
                        this.requestEngine = (IBuildRequestEngine)returnComponent;
                        this.requestEngine.OnEngineException += new EngineExceptionDelegate(RequestEngine_OnEngineException);
                        this.requestEngine.OnNewConfigurationRequest += new NewConfigurationRequestDelegate(RequestEngine_OnNewConfigurationRequest);
                        this.requestEngine.OnRequestBlocked += new RequestBlockedDelegate(RequestEngine_OnNewRequest);
                        this.requestEngine.OnRequestComplete += new RequestCompleteDelegate(RequestEngine_OnRequestComplete);
                        this.requestEngine.OnStatusChanged += new EngineStatusChangedDelegate(RequestEngine_OnStatusChanged);
                    }

                    break;

                default:
                    returnComponent = this.getComponentCallback(type);
                    if (returnComponent != null)
                    {
                        returnComponent.InitializeComponent(this);
                    }
                    break;
            }

            if (returnComponent != null)
            {
                lock (this.buildComponents)
                {
                    this.buildComponents.Enqueue(returnComponent);
                }
            }

            return returnComponent;
        }
Ejemplo n.º 21
0
 public IBuildComponent CreateInstance(BuildComponentType type)
 {
     // Create the instance of OutOfProcNodeSdkResolverService and pass parameters to the constructor.
     return(new OutOfProcNodeSdkResolverService(_sendPacket));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Component factory.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.RegisteredTaskObjectCache, "Cannot create components of type {0}", type);
     return(new RegisteredTaskObjectCache());
 }
 /// <summary>
 /// Constructor for existing singleton.
 /// </summary>
 public BuildComponentEntry(BuildComponentType type, IBuildComponent singleton)
 {
     _singleton   = singleton;
     this.Pattern = CreationPattern.Singleton;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Constructs and returns a component of the specified type.
        /// </summary>
        public IBuildComponent GetComponent(BuildComponentType type)
        {
            IBuildComponent returnComponent = null;

            switch (type)
            {
            case BuildComponentType.LoggingService:     // Singleton
                return((IBuildComponent)this.loggingService);

            case BuildComponentType.TestDataProvider:     // Singleton
                if (this.testDataProvider != null)
                {
                    return((IBuildComponent)this.testDataProvider);
                }

                returnComponent = this.getComponentCallback(type);
                if (returnComponent != null)
                {
                    returnComponent.InitializeComponent(this);
                    this.testDataProvider = (ITestDataProvider)returnComponent;
                }

                break;

            case BuildComponentType.RequestEngine:     // Singleton
                if (this.requestEngine != null)
                {
                    return((IBuildComponent)this.requestEngine);
                }

                returnComponent = this.getComponentCallback(type);
                if (returnComponent != null)
                {
                    returnComponent.InitializeComponent(this);
                    this.requestEngine = (IBuildRequestEngine)returnComponent;
                    this.requestEngine.OnEngineException         += new EngineExceptionDelegate(RequestEngine_OnEngineException);
                    this.requestEngine.OnNewConfigurationRequest += new NewConfigurationRequestDelegate(RequestEngine_OnNewConfigurationRequest);
                    this.requestEngine.OnRequestBlocked          += new RequestBlockedDelegate(RequestEngine_OnNewRequest);
                    this.requestEngine.OnRequestComplete         += new RequestCompleteDelegate(RequestEngine_OnRequestComplete);
                    this.requestEngine.OnStatusChanged           += new EngineStatusChangedDelegate(RequestEngine_OnStatusChanged);
                }

                break;

            default:
                returnComponent = this.getComponentCallback(type);
                if (returnComponent != null)
                {
                    returnComponent.InitializeComponent(this);
                }
                break;
            }

            if (returnComponent != null)
            {
                lock (this.buildComponents)
                {
                    this.buildComponents.Enqueue(returnComponent);
                }
            }

            return(returnComponent);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Factory for component construction.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType componentType)
 {
     ErrorUtilities.VerifyThrow(componentType == BuildComponentType.Scheduler, "Cannot create components of type {0}", componentType);
     return new Scheduler();
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Component factory.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.RegisteredTaskObjectCache, "Cannot create components of type {0}", type);
     return new RegisteredTaskObjectCache();
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.TaskHostNodeManager, "Cannot create component of type {0}", type);
     return new TaskHostNodeManager();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Adds a factory.
 /// </summary>
 /// <param name="componentType">The type which is created by this factory.</param>
 /// <param name="factory">Delegate which is responsible for creating the Component.</param>
 /// <param name="creationPattern">Creation pattern.</param>
 public void AddFactory(BuildComponentType componentType, BuildComponentFactoryDelegate factory, CreationPattern creationPattern)
 {
     _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, factory, creationPattern);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType componentType)
 {
     ErrorUtilities.VerifyThrow(componentType == BuildComponentType.ResultsCache, "Cannot create components of type {0}", componentType);
     return(new ResultsCache());
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BuildComponentEntry(BuildComponentType type, BuildComponentFactoryDelegate factory, CreationPattern pattern)
 {
     ComponentType = type;
     _factory      = factory;
     Pattern       = pattern;
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.InProcNodeProvider, "Cannot create component of type {0}", type);
     return new NodeProviderInProc();
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Shuts down a specific singleton component.
        /// </summary>
        public void ShutdownComponent(BuildComponentType componentType)
        {
            BuildComponentEntry existingEntry = _componentEntriesByType[componentType];

            existingEntry.ShutdownSingletonInstance();
        }
Ejemplo n.º 33
0
 /// <summary>
 /// A factory which is registered to create an instance of this class.
 /// </summary>
 public static IBuildComponent CreateComponent(BuildComponentType type)
 {
     return(new MainNodeSdkResolverService());
 }
 /// <summary>
 /// Registers a factory to replace one of the defaults.  Creation pattern is inherited from the original.
 /// </summary>
 /// <param name="componentType">The type which is created by this factory.</param>
 /// <param name="factory">The factory to be registered.</param>
 public void ReplaceFactory(BuildComponentType componentType, BuildComponentFactoryDelegate factory)
 {
     BuildComponentEntry existingEntry = _componentEntriesByType[componentType];
     _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, factory, existingEntry.Pattern);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Get a component from the host.
 /// </summary>
 /// <param name="type">The component type to get.</param>
 /// <returns>The component.</returns>
 IBuildComponent IBuildComponentHost.GetComponent(BuildComponentType type)
 {
     return _componentFactories.GetComponent(type);
 }
 /// <summary>
 /// Adds a factory.
 /// </summary>
 /// <param name="componentType">The type which is created by this factory.</param>
 /// <param name="factory">Delegate which is responsible for creating the Component.</param>
 /// <param name="creationPattern">Creation pattern.</param>
 public void AddFactory(BuildComponentType componentType, BuildComponentFactoryDelegate factory, CreationPattern creationPattern)
 {
     _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, factory, creationPattern);
 }
Ejemplo n.º 37
0
            /// <summary>
            /// Constructs and returns a component of the specified type.
            /// </summary>
            /// <param name="type">The type of component to return</param>
            /// <returns>The component</returns>
            public IBuildComponent GetComponent(BuildComponentType type)
            {
                switch (type)
                {
                    case BuildComponentType.ConfigCache:
                        return (IBuildComponent)_configCache;

                    case BuildComponentType.LoggingService:
                        return (IBuildComponent)_loggingService;

                    case BuildComponentType.ResultsCache:
                        return (IBuildComponent)_resultsCache;

                    case BuildComponentType.RequestBuilder:
                        return (IBuildComponent)_requestBuilder;

                    case BuildComponentType.TargetBuilder:
                        return (IBuildComponent)_targetBuilder;

                    default:
                        throw new ArgumentException("Unexpected type " + type);
                }
            }
 /// <summary>
 /// Constructor.
 /// </summary>
 public BuildComponentEntry(BuildComponentType type, BuildComponentFactoryDelegate factory, CreationPattern pattern)
 {
     this.ComponentType = type;
     _factory = factory;
     this.Pattern = pattern;
 }
Ejemplo n.º 39
0
 public IBuildComponent GetComponent(BuildComponentType type)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Static factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType componentType)
 {
     ErrorUtilities.VerifyThrow(componentType == BuildComponentType.OutOfProcTaskHostNodeProvider, "Factory cannot create components of type {0}", componentType);
     return new NodeProviderOutOfProcTaskHost();
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Class factory for component creation.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.RequestEngine, "Cannot create component of type {0}", type);
     return new BuildRequestEngine();
 }
Ejemplo n.º 42
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.InProcNodeProvider, "Cannot create component of type {0}", type);
     return(new NodeProviderInProc());
 }
Ejemplo n.º 43
0
 void IBuildComponentHost.RegisterFactory(BuildComponentType factoryType, BuildComponentFactoryDelegate factory)
 {
     _componentFactories.ReplaceFactory(factoryType, factory);
 }
Ejemplo n.º 44
0
 public IBuildComponent GetComponent(BuildComponentType type)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.TaskHostNodeManager, "Cannot create component of type {0}", type);
     return(new TaskHostNodeManager());
 }
 /// <summary>
 /// Class factory for component creation.
 /// </summary>
 internal static IBuildComponent CreateComponent(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.TargetBuilder, "Cannot create components of type {0}", type);
     return(new TargetBuilder());
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Registers a factory with the component host.
 /// </summary>
 /// <param name="factoryType">The factory type to register.</param>
 /// <param name="factory">The factory method.</param>
 void IBuildComponentHost.RegisterFactory(BuildComponentType factoryType, BuildComponentFactoryDelegate factory)
 {
     _componentFactories.ReplaceFactory(factoryType, factory);
 }
Ejemplo n.º 48
0
 IBuildComponent IBuildComponentHost.GetComponent(BuildComponentType type)
 {
     return(_componentFactories.GetComponent(type));
 }
Ejemplo n.º 49
0
 /// <summary>
 /// Register a new build component factory with the host.
 /// </summary>
 public void RegisterFactory(BuildComponentType type, BuildComponentFactoryDelegate factory)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Static factory for component creation.
 /// </summary>
 static internal IBuildComponent CreateComponent(BuildComponentType componentType)
 {
     ErrorUtilities.VerifyThrow(componentType == BuildComponentType.OutOfProcNodeProvider, "Factory cannot create components of type {0}", componentType);
     return(new NodeProviderOutOfProc());
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Registers a factory to replace one of the defaults.  Creation pattern is inherited from the original.
        /// </summary>
        /// <param name="componentType">The type which is created by this factory.</param>
        /// <param name="factory">The factory to be registered.</param>
        public void ReplaceFactory(BuildComponentType componentType, BuildComponentFactoryDelegate factory)
        {
            BuildComponentEntry existingEntry = _componentEntriesByType[componentType];

            _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, factory, existingEntry.Pattern);
        }
Ejemplo n.º 52
0
 /// <summary>
 /// Register a component factory.
 /// </summary>
 public void RegisterFactory(BuildComponentType type, BuildComponentFactoryDelegate factory)
 {
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Registers a factory to replace one of the defaults.  Creation pattern is inherited from the original.
 /// </summary>
 /// <param name="componentType">The type which is created by this factory.</param>
 /// <param name="instance">The instance to be registered.</param>
 public void ReplaceFactory(BuildComponentType componentType, IBuildComponent instance)
 {
     ErrorUtilities.VerifyThrow(_componentEntriesByType[componentType].Pattern == CreationPattern.Singleton, "Previously existing factory for type {0} was not a singleton factory.", componentType);
     _componentEntriesByType[componentType] = new BuildComponentEntry(componentType, instance);
 }
Ejemplo n.º 54
0
 public void RegisterFactory(BuildComponentType type, BuildComponentFactoryDelegate factory)
 {
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Create an instance of a LoggingService and returns is as an IBuildComponent
 /// </summary>
 /// <returns>An instance of a LoggingService as a IBuildComponent</returns>
 public IBuildComponent CreateInstance(BuildComponentType type)
 {
     ErrorUtilities.VerifyThrow(type == BuildComponentType.LoggingService, "Cannot create components of type {0}", type);
     IBuildComponent loggingService = (IBuildComponent)LoggingService.CreateLoggingService(_logMode, _nodeId);
     return loggingService;
 }