Search in sources :

Example 6 with JetAccess

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

the class ProjectConfigurator method addFrameworkJarsToClasspath.

/**
 * For remote and cloud projects.
 */
public void addFrameworkJarsToClasspath(final IProgressMonitor monitor) throws CoreException {
    if (project.isRemote()) {
        // code generation runs on the UI thread
        Generator generator = new Generator(MdwPlugin.getShell());
        IProject sourceProject = project.getSourceProject();
        // pom.xml
        JetAccess jet = getJet("osgi/remote_pom.xmljet", sourceProject, "pom.xml");
        generator.createFile(jet, monitor);
        // force maven refresh
        addMavenNature(monitor);
    } else if (project.isOsgi() || project.isWar()) {
    // pom.xml is generated with project
    } else if (project.isCloudProject()) {
        IFolder earFolder = project.getSourceProject().getFolder(new Path("deploy/ear"));
        addJarsToClasspath(project.getJavaProject(), earFolder, monitor);
        IFolder earAppInfLib = earFolder.getFolder(new Path("APP-INF/lib"));
        addJarsToClasspath(project.getJavaProject(), earAppInfLib, monitor);
    }
    IFolder libFolder = project.getSourceProject().getFolder("lib");
    if (libFolder.exists())
        addJarsToClasspath(project.getJavaProject(), libFolder, monitor);
    IFolder webLibFolder = project.getSourceProject().getFolder(new Path("web/WEB-INF/lib"));
    if (webLibFolder.exists())
        addJarsToClasspath(project.getJavaProject(), webLibFolder, monitor);
    J2EEComponentClasspathUpdater.getInstance().queueUpdateModule(project.getSourceProject());
}
Also used : IPath(org.eclipse.core.runtime.IPath) 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) IFolder(org.eclipse.core.resources.IFolder)

Example 7 with JetAccess

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

the class ProjectConfigurator method getJet.

protected JetAccess getJet(String jetFile, IProject targetProject, String targetPath) {
    JetConfig jetConfig = new JetConfig();
    jetConfig.setModel(project);
    jetConfig.setSettings(MdwPlugin.getSettings());
    jetConfig.setPluginId(MdwPlugin.getPluginId());
    jetConfig.setTargetFolder(targetProject.getName());
    jetConfig.setTargetFile(targetPath);
    jetConfig.setTemplateRelativeUri("templates/" + jetFile);
    return new JetAccess(jetConfig);
}
Also used : JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) JetConfig(com.centurylink.mdw.plugin.codegen.JetConfig)

Example 8 with JetAccess

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

the class ProjectInflator method generateWarCloudArtifacts.

public void generateWarCloudArtifacts(IProgressMonitor monitor) throws CoreException {
    Generator generator = new Generator(shell);
    IProject sourceProject = workflowProject.getSourceProject();
    if (workflowProject.isFilePersist())
        PluginUtil.createFoldersAsNeeded(sourceProject, workflowProject.getAssetFolder(), monitor);
    // pom.xml
    JetAccess jet;
    if (workflowProject.isFilePersist()) {
        String template = workflowProject.checkRequiredVersion(6, 0) ? "cloud/cloud_fs_pom.xmljet" : "cloud/55/cloud_fs_pom.xmljet";
        jet = getJet(template, sourceProject, "pom.xml", null);
    } else
        jet = getJet("osgi/remote_pom.xmljet", sourceProject, "pom.xml", null);
    generator.createFile(jet, monitor);
}
Also used : JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) IProject(org.eclipse.core.resources.IProject) Generator(com.centurylink.mdw.plugin.codegen.Generator)

Example 9 with JetAccess

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

the class ProjectInflator method getJet.

private JetAccess getJet(String jetFile, IProject targetProject, String targetPath, IPackageFragment pkg) {
    // prepare config for creating files
    JetConfig jetConfig = new JetConfig();
    jetConfig.setModel(workflowProject);
    jetConfig.setSettings(mdwSettings);
    jetConfig.setPluginId(MdwPlugin.getPluginId());
    if (pkg == null)
        jetConfig.setPackageName("");
    else
        jetConfig.setPackageName(pkg.getElementName());
    jetConfig.setTargetFolder(targetProject.getName());
    jetConfig.setTargetFile(targetPath);
    jetConfig.setTemplateRelativeUri("templates/" + jetFile);
    return new JetAccess(jetConfig);
}
Also used : JetAccess(com.centurylink.mdw.plugin.codegen.JetAccess) JetConfig(com.centurylink.mdw.plugin.codegen.JetConfig)

Example 10 with JetAccess

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

the class ProjectInflator method generateWebArtifacts.

public void generateWebArtifacts(IProgressMonitor monitor) throws CoreException {
    Generator generator = new Generator(shell);
    IProject webProject = workflowProject.getWebProject();
    // build.xml
    JetAccess jet = getJet("web/build.xmljet", webProject, "build.xml", null);
    generator.createFile(jet, monitor);
    jet = getJet("web/readme.txtjet", webProject, "readme.txt", null);
    generator.createFile(jet, monitor);
}
Also used : 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