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());
}
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);
}
Aggregations