Beispiel #1
0
        /// <summary>
        /// This will start an application
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            Logger.LogMessage(this,
                              string.Format(CultureInfo.CurrentCulture, "Executing task: {0}",
                                            MethodBase.GetCurrentMethod().ReflectedType.FullName));

            //Validate
            if (string.IsNullOrEmpty(ApplicationName))
            {
                throw new ApplicationException("The application name has not been provided");
            }
            if (string.IsNullOrEmpty(MessageBoxConnection))
            {
                throw new ApplicationException("The message box connection has not been provided");
            }

            //Setup Catalog
            Catalog.ConnectionString = MessageBoxConnection;

            //Check if application exists
            if (BtsCatalogExplorerHelper.ApplicationExists(Catalog, ApplicationName))
            {
                BtsCatalogExplorerHelper.StartApplication(Catalog, ApplicationName);
            }
            else
            {
                Log.LogMessage("The application does not exist so task will exit", null);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// This will add a reference from one BTS App to anotther
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            Logger.LogMessage(this, string.Format(CultureInfo.CurrentCulture, "Executing task: {0}", MethodBase.GetCurrentMethod().ReflectedType.FullName));

            //Validate
            if (string.IsNullOrEmpty(MessageBoxConnection))
            {
                throw new ApplicationException("The message box connection has not been set");
            }

            if (string.IsNullOrEmpty(ApplicationName))
            {
                throw new ApplicationException("The application name has not been provided");
            }

            if (string.IsNullOrEmpty(ReferencedApplicationName))
            {
                throw new ApplicationException("The referenced application name has not been provided");
            }

            //Setup Catalog
            Catalog.ConnectionString = MessageBoxConnection;

            //Check if app exists
            if (BtsCatalogExplorerHelper.ApplicationExists(Catalog, ApplicationName))
            {
                //check that the refernced application also exists
                if (BtsCatalogExplorerHelper.ApplicationExists(Catalog, ReferencedApplicationName))
                {
                    Logger.LogMessage(this, "Adding reference to the application");
                    BtsCatalogExplorerHelper.AddReference(Catalog, ApplicationName, ReferencedApplicationName);
                    Logger.LogMessage(this, "Application reference added");
                }
                else
                {
                    Logger.LogMessage(this, "The referenced application does not exist in the BizTalk group, therefore it was not stopped");
                    throw new ApplicationException("The referenced application does not exist");
                }
            }
            else
            {
                Logger.LogMessage(this, "The source application does not exist in the BizTalk group, therefore it was not stopped");
                throw new ApplicationException("The referenced application does not exist");
            }

            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// This will stop an application.  It also performs clean up exercises so only use within dev environment
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            Logger.LogMessage(this,
                              string.Format(CultureInfo.CurrentCulture, @"Executing task: {0}",
                                            MethodBase.GetCurrentMethod().ReflectedType.FullName));

            //Validate
            if (string.IsNullOrEmpty(MessageBoxConnection))
            {
                throw new ApplicationException(@"The message box connection has not been set");
            }

            if (string.IsNullOrEmpty(ApplicationName))
            {
                throw new ApplicationException(@"The application name has not been provided");
            }

            //Setup Catalog
            Catalog.ConnectionString = MessageBoxConnection;

            //Check if app exists
            if (BtsCatalogExplorerHelper.ApplicationExists(Catalog, ApplicationName))
            {
                //Stop Application
                var app = Catalog.Applications[ApplicationName];
                if (app.Status == Status.Stopped)
                {
                    Logger.LogMessage(this, "The application is already stopped");
                }
                else
                {
                    CleanOrchestrations(app);
                    Logger.LogMessage(this, "Stopping the application");
                    BtsCatalogExplorerHelper.StopApplication(Catalog, ApplicationName);
                    Logger.LogMessage(this, "The application is stopped");
                }
            }
            else
            {
                Logger.LogMessage(this,
                                  "The application does not exist in the BizTalk group, therefore it was not stopped");
            }

            return(true);
        }