Search in sources :

Example 1 with OsgiSettings

use of com.centurylink.mdw.plugin.project.model.OsgiSettings in project mdw-designer by CenturyLinkCloud.

the class ServiceMixSettingsPage method initValues.

@Override
public void initValues() {
    super.initValues();
    ContainerType type = ServerSettings.getContainerTypeFromClass(this.getClass().getSimpleName());
    String prevServerCmdPort = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_CMD_PORT);
    if (prevServerCmdPort.length() > 0) {
        try {
            getServerSettings().setCommandPort(Integer.parseInt(prevServerCmdPort));
        } catch (NumberFormatException ex) {
            MdwPlugin.setStringPref(type + "-" + ProjectPersist.MDW_SERVER_CMD_PORT, String.valueOf(getDefaultServerSshPort()));
        }
    } else {
        getServerSettings().setCommandPort(getDefaultServerSshPort());
    }
    serverSshPortTextField.setText(String.valueOf(getServerSettings().getCommandPort()));
    OsgiSettings osgiSettings = new OsgiSettings();
    getProject().setOsgiSettings(osgiSettings);
    if (getProject().checkRequiredVersion(5, 5)) {
        gradleRadioButton.setEnabled(true);
        osgiSettings.setGradleBuild(true);
    } else {
        gradleRadioButton.setEnabled(false);
    }
    gradleRadioButton.setSelection(osgiSettings.isGradleBuild());
    mavenRadioButton.setSelection(!osgiSettings.isGradleBuild());
    osgiSettings.setGroupId(getProject().getDefaultSourceCodePackage());
    groupIdTextField.setText(osgiSettings.getGroupId());
    osgiSettings.setArtifactId(getProject().getSourceProjectName().toLowerCase());
    artifactIdTextField.setText(osgiSettings.getArtifactId());
}
Also used : OsgiSettings(com.centurylink.mdw.plugin.project.model.OsgiSettings) ContainerType(com.centurylink.mdw.plugin.project.model.ServerSettings.ContainerType)

Example 2 with OsgiSettings

use of com.centurylink.mdw.plugin.project.model.OsgiSettings in project mdw-designer by CenturyLinkCloud.

the class ProjectInflator method generateOsgiArtifacts.

public void generateOsgiArtifacts(IProgressMonitor monitor) throws CoreException {
    Generator generator = new Generator(shell);
    IProject sourceProject = workflowProject.getSourceProject();
    OsgiSettings osgiSettings = workflowProject.getOsgiSettings();
    // bundle-context.xml
    String springPath = osgiSettings.getResourceDir() + "/META-INF/spring";
    JetAccess jet = getJet("osgi/bundle-context.xmljet", sourceProject, springPath + "/bundle-context.xml", null);
    PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder(new Path(springPath)), monitor);
    generator.createFile(jet, monitor);
    if (osgiSettings.isGradleBuild()) {
        // build.gradle
        jet = getJet("osgi/build.gradlejet", sourceProject, "build.gradle", null);
        generator.createFile(jet, monitor);
    } else {
        // pom.xml
        String template = workflowProject.checkRequiredVersion(5, 5) ? "osgi/pom.xmljet" : "osgi/52/pom.xmljet";
        jet = getJet(template, sourceProject, "pom.xml", null);
        generator.createFile(jet, monitor);
    }
    // BundleActivator.java
    String srcPath = osgiSettings.getSourceDir() + "/" + workflowProject.getDefaultSourceCodePackagePath() + "/bundle";
    PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder(new Path(srcPath)), monitor);
    String template = workflowProject.checkRequiredVersion(5, 5) ? "osgi/BundleActivator.javajet" : "osgi/52/BundleActivator.javajet";
    jet = getJet(template, sourceProject, srcPath + "/WorkflowBundleActivator.java", null);
    generator.createFile(jet, monitor);
    if (!workflowProject.checkRequiredVersion(5, 5)) {
        // env.properties.dev
        String depEnvPath = osgiSettings.getResourceDir() + "/deploy/env";
        PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder(depEnvPath), monitor);
        jet = getJet("ear/deploy/env/env.properties.devjet", sourceProject, depEnvPath + "/env.properties.dev", null);
        generator.createFile(jet, monitor);
    }
    if (workflowProject.isFilePersist())
        PluginUtil.createFoldersAsNeeded(sourceProject, workflowProject.getAssetFolder(), monitor);
}
Also used : OsgiSettings(com.centurylink.mdw.plugin.project.model.OsgiSettings) 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

OsgiSettings (com.centurylink.mdw.plugin.project.model.OsgiSettings)2 Generator (com.centurylink.mdw.plugin.codegen.Generator)1 JetAccess (com.centurylink.mdw.plugin.codegen.JetAccess)1 ContainerType (com.centurylink.mdw.plugin.project.model.ServerSettings.ContainerType)1 IProject (org.eclipse.core.resources.IProject)1 Path (org.eclipse.core.runtime.Path)1