Example #1
0
        private void ButtonNext_Click(object sender, EventArgs e)
        {
            try
            {
                InstallInfos.InstallWebApp(Path.Combine(InstallInfos.tomcatBinPath, @"..\webapps" /*\SuiviAtelier.war"*/), false);

                Form7InstallDone f7 = new Form7InstallDone();
                f7.Show();

                this.Hide();
            }
            catch (Exception)
            {
                labelError.Text      = "Impossible d'installer l'application web dans le répertoire webapps, vérifiez dans un premier temps vos droits d'utilisateur.";
                labelError.ForeColor = Color.Green;
                throw;
            }
        }
        public Form4InstallTomcat()
        {
            InitializeComponent();

            //On cache les labels
            labelInfoPort.Text  = "";
            labelError.Text     = "";
            labelPortDispo.Text = "";

            labelNomService.Text = InstallInfos.getSvcName();
            labelRepInstall.Text = InstallInfos.repPrincipal + @"\Tomcat-8.5\";
            labelZulu.Text       = InstallInfos.zuluPath;

            InstallInfos.tomcatBinPath = Path.Combine(labelRepInstall.Text, "bin");

            buttonSuivant.Enabled = false;

            //Tooltip
            toolTipTrouverPort.SetToolTip(this.buttonTrouver, "Trouvez un numéro de port qui n'est pas actuellement ouvert sur votre machine.");
        }
Example #3
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            InstallInfos.tomcatBinPath = Path.Combine(textBoxEmplacement.Text, @"\bin");
            String tomcatPath = textBoxEmplacement.Text;

            //Vérifier le chemin
            if (Directory.Exists(textBoxEmplacement.Text))
            {
                //Vérifier l'existence de Tomcat/WebApps
                if (Directory.Exists(Path.Combine(textBoxEmplacement.Text, @"webapps")))
                {
                    String webAppsPath = Path.Combine(textBoxEmplacement.Text, @"webapps");
                    //Vérifier l'existence du .war dedans
                    string[] files = System.IO.Directory.GetFiles(webAppsPath, "*.war", System.IO.SearchOption.TopDirectoryOnly);
                    //if (files.Length > 0)
                    //{
                    //file exist

                    //(supprimer l'ancienne archivee web préssente)

                    if (files.Length > 0)
                    {
                        //SI on a deja un .war on le supprime
                        File.Delete(files[0]);
                    }


                    //STOP LE SERVICE!!!!
                    String svcName = AskServiceName();

                    SvcManager.StopService(svcName, 15000);


                    Trace.WriteLine("Svc name = " + svcName);


                    //Suppression de l'ancien répertoire de l'appli web
                    try
                    {
                        Directory.Delete(Path.Combine(tomcatPath, @"webapps\SuiviAtelier"), true);
                    }
                    catch
                    {
                        //Le service tomcat le gèrera la suppression
                    }


                    //mettre les logs dans un old
                    String   logPath = Path.Combine(tomcatPath, "logs");
                    string[] logs    = Directory.GetFiles(logPath);

                    if (!Directory.Exists(Path.Combine(logPath, "old_logs")))
                    {
                        Directory.CreateDirectory(Path.Combine(logPath, "old_logs")); //attention si on a deja fait une maj ?
                    }

                    foreach (String oneLog in logs)
                    {
                        String fileName    = Path.GetFileName(oneLog);
                        String destination = Path.Combine(logPath, "old_logs", fileName);
                        try
                        {
                            File.Move(oneLog, destination);
                        }
                        catch
                        {
                            //Le log est utilisé par un processus, on le laisse dans ce fichier
                            Trace.WriteLine("its ok just a log because service is mal éteint");
                        }
                    }

                    //mettre archivweb
                    //Dans le rep Source AVEC LE NUM DE VERSION
                    if (!Directory.Exists(Path.Combine(tomcatPath, @"..\Sources")))
                    {
                        Directory.CreateDirectory(Path.Combine(tomcatPath, @"..\Sources"));
                    }
                    InstallInfos.InstallWebApp(Path.Combine(tomcatPath, @"..\Sources"), true);

                    //Sans la version (suivi atelier) dans webapps
                    InstallInfos.InstallWebApp(webAppsPath, false);



                    //LANCER LE SERVICE
                    SvcManager.StartService(svcName, 15000);

                    //}
                    //else
                    //{
                    //    setErreurOn("ERREUR - Pas de fichier .war dans le répertoire webapps de tomcat");
                    //    throw new Exception("ERREUR - Pas de fichier .war dans le répertoire webapps de tomcat");
                    //    //ERROR MESSAGE
                    //    //Pas d'application .war
                    //}
                }
                else
                {
                    setErreurOn("ERREUR - Le répertoire webapps n'a pas été trouvé");
                    //ERROR MESSAGE
                    //Pas de repertoire webapps
                    throw new Exception("ERREUR - Le répertoire webapps n'a pas été trouvé");
                }
            }
            else
            {
                setErreurOn("ERREUR - Le répertoire d'installation renseigné n'a pas été trouvé.");
                //ERROR MESSAGE
                //répertoire d'install tomcat introuvable
                throw new Exception("ERREUR - Le répertoire d'installation renseigné n'a pas été trouvé.");
            }

            labelError.Text      = "MISE A JOUR TERMINEE";
            labelError.ForeColor = System.Drawing.Color.Green;

            Form8UpdateDone form = new Form8UpdateDone();

            this.Hide();
            form.Show();
        }
Example #4
0
        public Form5TomcatService()
        {
            InitializeComponent();
            InitTabImage();

            //Triple maj de l'interface, a optimiser en utilisant les méthodes pour ca
            labelInfo.Text          = "- Nom du service Tomcat (copiez/collez dans le configurateur Tomcat) :\n\n" + InstallInfos.getSvcName() + "_" + InstallInfos.versionInstall + "\n\n- Passez le lancement en automatique.";
            this.labelCompteur.Text = "1/4";
            labelOnglet.Text        = "";
        }
Example #5
0
        private void MajLabelInfo()
        {
            switch (IndiceTab)
            {
            case 0:
                labelInfo.Text = "- Nom du service Tomcat (copiez/collez dans le configurateur Tomcat) :\n\n" + InstallInfos.getSvcName() + "_" + InstallInfos.versionInstall + "\n\n- Passez le lancement en automatique.";
                break;

            case 1:
                labelInfo.Text = "Utilisez le compte de services X3";
                break;

            case 2:
                labelInfo.Text      = "Lignes à ajouter en fin de bloc : \n\n" + @"-Dfile.encoding=UTF-8
-DSuiviAtelier.config.location=" + InstallInfos.repPrincipal + @"\SuiviAtelier_config.groovy";
                labelInfo.ForeColor = Color.Black;
                break;

            default:
                labelInfo.Text      = "Configuration terminée !\nVous pouvez fermer le configurateur Tomcat et passer à l'étape suivante de l'installation.";
                labelInfo.ForeColor = Color.Green;
                break;
            }
        }