Search in sources :

Example 11 with JetAccess

use of com.centurylink.mdw.plugin.codegen.JetAccess in project mdw-designer by CenturyLinkCloud.

the class ProjectInflator method createGitRepository.

public void createGitRepository(IProgressMonitor monitor) {
    try {
        File localDir = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile() + "/" + workflowProject.getName());
        Repository newRepo = null;
        if (workflowProject.getMdwVcsRepository().hasRemoteRepository()) {
            monitor.subTask("Cloning Git repository");
            VcsRepository gitRepo = workflowProject.getMdwVcsRepository();
            Git.cloneRepository().setURI(gitRepo.getRepositoryUrlWithCredentials()).setDirectory(localDir).call();
        } else {
            newRepo = new FileRepository(new File(localDir + "/.git"));
            newRepo.create();
        }
        // .gitignore
        Generator generator = new Generator(shell);
        JetAccess jet = getJet("source/.ignorejet", getProject().getSourceProject(), ".gitignore", null);
        generator.createFile(jet, monitor);
    } catch (Exception ex) {
        PluginMessages.uiError(ex, "Create Cloud Project", workflowProject);
    }
}
Also used : FileRepository(org.eclipse.jgit.internal.storage.file.FileRepository) FileRepository(org.eclipse.jgit.internal.storage.file.FileRepository) Repository(org.eclipse.jgit.lib.Repository) VcsRepository(com.centurylink.mdw.plugin.project.model.VcsRepository) JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) VcsRepository(com.centurylink.mdw.plugin.project.model.VcsRepository) IFile(org.eclipse.core.resources.IFile) File(java.io.File) URISyntaxException(java.net.URISyntaxException) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Generator(com.centurylink.mdw.plugin.codegen.Generator)

Example 12 with JetAccess

use of com.centurylink.mdw.plugin.codegen.JetAccess in project mdw-designer by CenturyLinkCloud.

the class ProjectInflator method generateEarArtifacts.

public void generateEarArtifacts(IProgressMonitor monitor) throws CoreException {
    Generator generator = new Generator(shell);
    IProject earProject = workflowProject.getEarProject();
    // TODO: why is this META-INF here?
    earProject.getFolder("META-INF").delete(true, monitor);
    // build.xml
    JetAccess jet = getJet("ear/build.xmljet", earProject, "build.xml", null);
    generator.createFile(jet, monitor);
    // release_build.xml
    jet = getJet("ear/release_build.xmljet", earProject, "release_build.xml", null);
    generator.createFile(jet, monitor);
    // .externalToolBuilders folder
    PluginUtil.createFolder(earProject, new Path(".externalToolBuilders"), monitor);
    // builder.launch
    jet = getJet("ear/externalToolBuilders/builder.launchjet", earProject, ".externalToolBuilders/" + workflowProject.getSourceProjectName() + "Builder.launch", null);
    generator.createFile(jet, monitor);
    // ApplicationProperties.xml
    if (workflowProject.checkRequiredVersion(5, 1, 8))
        jet = getJet("ear/deploy/config/ApplicationPropertiesEmpty.xmljet", earProject, "deploy/config/ApplicationProperties.xml", null);
    else
        jet = getJet("ear/deploy/config/ApplicationProperties.xmljet", earProject, "deploy/config/ApplicationProperties.xml", null);
    generator.createFile(jet, monitor);
    // ApplicationCache.xml
    jet = getJet("ear/deploy/config/ApplicationCache.xmljet", earProject, "deploy/config/ApplicationCache.xml", null);
    generator.createFile(jet, monitor);
    // deploy/env folder
    PluginUtil.createFolder(earProject, new Path("deploy/env"), monitor);
    // project.properties
    jet = getJet("ear/deploy/env/project.propertiesjet", earProject, "deploy/env/project.properties", null);
    generator.createFile(jet, monitor);
    // env.properties.dev
    jet = getJet("ear/deploy/env/env.properties.devjet", earProject, "deploy/env/env.properties.dev", null);
    generator.createFile(jet, monitor);
    // application.xml
    PluginUtil.createFolder(earProject, new Path("EarContent/META-INF"), monitor);
    jet = getJet("ear/EarContent/META-INF/application.xmljet", earProject, workflowProject.getEarContentFolder().getProjectRelativePath() + "/META-INF/application.xml", null);
    generator.createFile(jet, monitor);
    // startWebLogic.cmd.tmpl
    jet = getJet("ear/deploy/config/startWebLogic.cmd.tmpljet", earProject, "deploy/config/startWebLogic.cmd.tmpl", null);
    generator.createFile(jet, monitor);
    // designerConfig.xml
    jet = getJet("ear/deploy/config/designerConfig.xmljet", earProject, "deploy/config/designerConfig.xml", null);
    generator.createFile(jet, monitor);
}
Also used : Path(org.eclipse.core.runtime.Path) JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) IProject(org.eclipse.core.resources.IProject) Generator(com.centurylink.mdw.plugin.codegen.Generator)

Example 13 with JetAccess

use of com.centurylink.mdw.plugin.codegen.JetAccess in project mdw-designer by CenturyLinkCloud.

the class ProjectInflator method generateSourceArtifacts.

public void generateSourceArtifacts(IProgressMonitor monitor) throws CoreException {
    Generator generator = new Generator(shell);
    IProject sourceProject = workflowProject.getSourceProject();
    // build.xml
    JetAccess jet = getJet("source/build.xmljet", sourceProject, "build.xml", null);
    generator.createFile(jet, monitor);
    // base .*ignore
    jet = getJet("source/.ignorejet", sourceProject, ".cvsignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/.ignorejet", sourceProject, ".dmignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/.ignorejet", sourceProject, ".svnignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/.ignorejet", sourceProject, ".gitignore", null);
    generator.createFile(jet, monitor);
    // META-INF .*ignore
    jet = getJet("source/src/META-INF/.ignorejet", sourceProject, "src/META-INF/.cvsignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/src/META-INF/.ignorejet", sourceProject, "src/META-INF/.dmignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/src/META-INF/.ignorejet", sourceProject, "src/META-INF/.svnignore", null);
    generator.createFile(jet, monitor);
    jet = getJet("source/src/META-INF/.ignorejet", sourceProject, "src/META-INF/.gitignore", null);
    generator.createFile(jet, monitor);
    if (workflowProject.isEjbSourceProject() && workflowProject.getServerSettings().isJBoss()) {
        jet = getJet("source/src/META-INF/jboss.xmljet", sourceProject, "src/META-INF/jboss.xml", null);
        generator.createFile(jet, monitor);
    }
    // baseline ejb impl
    if (workflowProject.isEjbSourceProject()) {
        String ejbPath = "src/" + workflowProject.getDefaultSourceCodePackagePath() + "/services";
        PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder(new Path(ejbPath)), monitor);
        jet = getJet("source/src/ejbs/WorkflowManager.javajet", sourceProject, ejbPath + "/" + workflowProject.getSourceProjectName() + "Manager.java", null);
        generator.createFile(jet, monitor);
        jet = getJet("source/src/ejbs/WorkflowManagerBean.javajet", sourceProject, ejbPath + "/" + workflowProject.getSourceProjectName() + "ManagerBean.java", null);
        generator.createFile(jet, monitor);
    } else {
        String srcPath = "src/" + workflowProject.getDefaultSourceCodePackagePath() + "/hello";
        PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder(new Path(srcPath)), monitor);
        jet = getJet("source/src/pojos/Hello.javajet", sourceProject, srcPath + "/" + workflowProject.getSourceProjectName() + "Hello.java", null);
        generator.createFile(jet, monitor);
    }
}
Also used : Path(org.eclipse.core.runtime.Path) JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) IProject(org.eclipse.core.resources.IProject) Generator(com.centurylink.mdw.plugin.codegen.Generator)

Aggregations

JetAccess (com.centurylink.mdw.plugin.codegen.JetAccess)13 Generator (com.centurylink.mdw.plugin.codegen.Generator)9 IProject (org.eclipse.core.resources.IProject)7 Path (org.eclipse.core.runtime.Path)5 JetConfig (com.centurylink.mdw.plugin.codegen.JetConfig)4 IOException (java.io.IOException)3 CoreException (org.eclipse.core.runtime.CoreException)3 File (java.io.File)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IFile (org.eclipse.core.resources.IFile)2 IFolder (org.eclipse.core.resources.IFolder)2 AntBuilder (com.centurylink.mdw.plugin.ant.AntBuilder)1 OsgiSettings (com.centurylink.mdw.plugin.project.model.OsgiSettings)1 VcsRepository (com.centurylink.mdw.plugin.project.model.VcsRepository)1 URISyntaxException (java.net.URISyntaxException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IPath (org.eclipse.core.runtime.IPath)1 FileRepository (org.eclipse.jgit.internal.storage.file.FileRepository)1 Repository (org.eclipse.jgit.lib.Repository)1