Package org.apache.syncope.installer.utilities

Examples of org.apache.syncope.installer.utilities.FileSystemUtils


        jbossPort = args[16];
        jbossJdbcModuleName = args[17];
        jbossAdminUsername = args[18];
        jbossAdminPassword = args[19];

        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);

        handler.logOutput("Configure web.xml file according to " + selectedContainer + " properties", true);
        InstallLog.getInstance().info("Configure web.xml file according to " + selectedContainer + " properties");

        if (withDataSource) {
            fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH), CoreWebXml.
                    withDataSource());
            switch (selectedContainer) {
                case JBOSS:
                    fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH),
                            CoreWebXml.withDataSourceForJBoss());
                    fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
                            + PersistenceContextEMFactoryXml.PATH), PersistenceContextEMFactoryXml.FILE);
                    fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
                            + JBossDeploymentStructureXml.PATH),
                            String.format(JBossDeploymentStructureXml.FILE, jbossJdbcModuleName));
                    break;
                case GLASSFISH:
                    fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + GlassfishCoreWebXml.PATH),
                            GlassfishCoreWebXml.withDataSource());
                    break;
            }
        }

        final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);

        switch (selectedContainer) {
            case TOMCAT:
                final Tomcat tomcat = new Tomcat(
                        tomcatSsl, tomcatHost, tomcatPort, installPath, artifactId, tomcatUser, tomcatPassword, handler);
                boolean deployCoreResult = tomcat.deployCore();
                if (deployCoreResult) {
                    handler.logOutput("Core successfully deployed ", true);
                    InstallLog.getInstance().info("Core successfully deployed ");
                } else {
                    final String messageError = "Deploy core on Tomcat failed";
                    handler.emitError(messageError, messageError);
                    InstallLog.getInstance().error(messageError);
                }

                boolean deployConsoleResult = tomcat.deployConsole();
                if (deployConsoleResult) {
                    handler.logOutput("Console successfully deployed ", true);
                    InstallLog.getInstance().info("Console successfully deployed ");
                } else {
                    final String messageError = "Deploy console on Tomcat failed";
                    handler.emitError(messageError, messageError);
                    InstallLog.getInstance().error(messageError);
                }
                break;
            case JBOSS:
                final JBoss jBoss = new JBoss(
                        jbossSsl, jbossHost, jbossPort, jbossAdminUsername,
                        jbossAdminPassword, installPath, artifactId, handler);

                boolean deployCoreJboss = jBoss.deployCore();
                if (deployCoreJboss) {
                    handler.logOutput("Core successfully deployed ", true);
                    InstallLog.getInstance().info("Core successfully deployed ");
                } else {
                    final String messageError = "Deploy core on JBoss failed";
                    handler.emitError(messageError, messageError);
                    InstallLog.getInstance().error(messageError);
                }

                boolean deployConsoleJBoss = jBoss.deployConsole();
                if (deployConsoleJBoss) {
                    handler.logOutput("Console successfully deployed ", true);
                    InstallLog.getInstance().info("Console successfully deployed ");
                } else {
                    final String messageError = "Deploy console on JBoss failed";
                    handler.emitError(messageError, messageError);
                    InstallLog.getInstance().error(messageError);
                }
                break;
            case GLASSFISH:
                final String createJavaOptCommand = "sh " + glassfishDir + Glassfish.CREATE_JAVA_OPT_COMMAND;
                fileSystemUtils.exec(createJavaOptCommand, null);

                final Glassfish glassfish = new Glassfish(installPath, artifactId);

                fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), null);
                fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(), null);
                break;
        }
    }
View Full Code Here


        final String logsDirectory = args[7];
        final String bundlesDirectory = args[8];
        final String syncopeVersion = args[9];
        final String syncopeAdminPassword = args[10];

        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
        fileSystemUtils.createDirectory(installPath);
        InstallLog.initialize(installPath, handler);

        final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
        mavenUtils.archetypeGenerate(
                syncopeVersion, groupId, artifactId, secretKey, anonymousKey, installPath);

        fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + Pom.PATH),
                String.format(Pom.FILE, syncopeVersion, syncopeVersion, groupId, artifactId));
        fileSystemUtils.createDirectory(confDirectory);
        fileSystemUtils.createDirectory(logsDirectory);
        fileSystemUtils.createDirectory(bundlesDirectory);
        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
    }
View Full Code Here

        persistenceUser = args[4];
        persistencePassword = args[5];
        mysqlInnoDB = Boolean.valueOf(args[6]);
        oracleTableSpace = args[7];

        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);

        final StringBuilder persistenceProperties = new StringBuilder(PersistenceProperties.HEADER);

        handler.logOutput("Configure persistence file according to " + dbSelected + " properties", true);
        InstallLog.getInstance().info("Configure persistence file according to " + dbSelected + " properties");

        switch (dbSelected) {
            case POSTGRES:
                persistenceProperties.append(String.format(
                        PersistenceProperties.POSTGRES, persistenceUrl, persistenceUser, persistencePassword));
                break;
            case MYSQL:
                persistenceProperties.append(String.format(
                        PersistenceProperties.MYSQL, persistenceUrl, persistenceUser, persistencePassword));
                if (mysqlInnoDB) {
                    persistenceProperties.append(PersistenceProperties.QUARTZ_INNO_DB);
                } else {
                    persistenceProperties.append(PersistenceProperties.QUARTZ);
                }
                break;
            case ORACLE:
                persistenceProperties.append(String.format(
                        PersistenceProperties.ORACLE, persistenceUrl, persistenceUser, persistencePassword,
                        oracleTableSpace));
                writeOrmFile(fileSystemUtils, OrmXml.ORACLE_ORM);
                break;
            case SQLSERVER:
                persistenceProperties.append(String.format(
                        PersistenceProperties.SQLSERVER, persistenceUrl, persistenceUser, persistencePassword));
                writeOrmFile(fileSystemUtils, OrmXml.SQLSERVER_ORM);
                break;
        }

        fileSystemUtils.writeToFile(new File(
                installPath + "/" + artifactId + PersistenceProperties.PATH), persistenceProperties.toString());

    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.installer.utilities.FileSystemUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.