diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/Page.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/Page.java index 947f6fec244856926568269bff4ba7ac26015456..623884634762413958389924631868e34de695f8 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/Page.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/Page.java @@ -1,10 +1,19 @@ package org.universaal.tools.packaging.api; -import org.universaal.tools.packaging.tool.parts.MultipartApplication; +import org.universaal.tools.packaging.tool.parts.MPA; public interface Page { - public void setMPA(MultipartApplication mpa); + public final String PAGE1 = "Application details #"; + public final String PAGE2 = "Contacts #"; + public final String PAGE3 = "Application capabilities #"; + public final String PAGE4 = "Application requirements #"; + public final String PAGE5 = "Application management #"; + public final String PAGE_LICENSE = "SLA and licenses #"; + public final String PAGE_PART = "Part #"; + public final String PAGE_ERROR = "Error"; + + public void setMPA(MPA mpa); public boolean validate(); } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/WizardMod.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/WizardMod.java index 449c295a248ec79d283c6adadaf6bf07111eb397..a8a50c1e50c3f641f47174af160822d97e08a279 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/WizardMod.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/api/WizardMod.java @@ -140,9 +140,9 @@ public abstract class WizardMod implements IWizard { pages.add(page); page.setWizard(this); - for(int i = 0; i < pages.size(); i++) - if(pages.get(i) == null) - pages.remove(i); +// for(int i = 0; i < pages.size(); i++) +// if(pages.get(i) == null) +// pages.remove(i); } /** diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/actions/SampleAction.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/actions/SampleAction.java index 113e5b303236c84f92ac37811e4e14919c4d8579..5cd4bfb63f75519f15e18b0a5f96e5205d312b0f 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/actions/SampleAction.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/actions/SampleAction.java @@ -8,7 +8,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.handlers.HandlerUtil; import org.universaal.tools.packaging.tool.gui.GUI; -import org.universaal.tools.packaging.tool.parts.MultipartApplication; +import org.universaal.tools.packaging.tool.parts.MPA; /** * Our sample action implements workbench action delegate. @@ -20,14 +20,14 @@ import org.universaal.tools.packaging.tool.parts.MultipartApplication; */ public class SampleAction extends AbstractHandler { - public MultipartApplication app; + public MPA mpa; public static GUI gui; public Object execute(ExecutionEvent event) throws ExecutionException { - app = new MultipartApplication(); + mpa = new MPA(); - gui = new GUI(app, event); + gui = new GUI(mpa, event); IWorkbenchWindow w = HandlerUtil.getActiveWorkbenchWindow(event); WizardDialog wizardDialog = new WizardDialog(w.getShell(), gui); @@ -43,7 +43,7 @@ public class SampleAction extends AbstractHandler { return null; } - public MultipartApplication getApp() { - return app; + public MPA getMPA() { + return mpa; } } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/ErrorPage.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/ErrorPage.java index 1a416568a4c3471803d22d2397de296c02f519e9..b049f35198db0b17e204caf215157593c97b0a18 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/ErrorPage.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/ErrorPage.java @@ -11,4 +11,4 @@ public class ErrorPage extends PageImpl { public void createControl(Composite parent) { } -} +} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUI.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUI.java index 669e5c4f7a688e44c279173d4b3a06050ccca418..98f2403c9faa95e7accc8b35c12094b18903e1ce 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUI.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUI.java @@ -10,28 +10,28 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.handlers.HandlerUtil; +import org.universaal.tools.packaging.api.Page; import org.universaal.tools.packaging.api.WizardMod; -import org.universaal.tools.packaging.tool.parts.MultipartApplication; +import org.universaal.tools.packaging.tool.parts.Application; +import org.universaal.tools.packaging.tool.parts.MPA; public class GUI extends WizardMod { - private List<IProject> artifacts; private ExecutionEvent event; - public static MultipartApplication app; + public static MPA mpa; private PageImpl p1, p2, pl, p3, p4, p5, pp, p; + private List<IProject> artifacts; public GUI(){ super(); setNeedsProgressMonitor(true); - - app = new MultipartApplication(); } - public GUI(MultipartApplication application, ExecutionEvent event) { + public GUI(MPA multipartApplication, ExecutionEvent event) { super(); setNeedsProgressMonitor(true); - app = application; this.event = event; + mpa = multipartApplication; } @Override @@ -44,40 +44,42 @@ public class GUI extends WizardMod { e.printStackTrace(); } - p1 = new Page1("Application details"); - addPage(p1); - p1.setMPA(app); + for(int i = 0; i < artifacts.size(); i++){ + + mpa.getApplications().add(new Application()); - p2 = new Page2("Contacts"); - addPage(p2); - p2.setMPA(app); + p1 = new Page1(Page.PAGE1+(i+1), i); + addPage(p1); + p1.setMPA(mpa); - pl = new PageLicenses("SLA and licenses"); - addPage(pl); - pl.setMPA(app); + p2 = new Page2(Page.PAGE2+(i+1), i); + addPage(p2); + p2.setMPA(mpa); - p3 = new Page3("Application capabilities"); - addPage(p3); - p3.setMPA(app); + pl = new PageLicenses(Page.PAGE_LICENSE+(i+1), i); + addPage(pl); + pl.setMPA(mpa); - p4 = new Page4("Application requirements"); - addPage(p4); - p4.setMPA(app); + p3 = new Page3(Page.PAGE3+(i+1), i); + addPage(p3); + p3.setMPA(mpa); - p5 = new Page5("Application management"); - addPage(p5); - p5.setMPA(app); + p4 = new Page4(Page.PAGE4+(i+1), i); + addPage(p4); + p4.setMPA(mpa); - for(int i = 0; i < artifacts.size(); i++){ + p5 = new Page5(Page.PAGE5+(i+1), i); + addPage(p5); + p5.setMPA(mpa); - pp = new PagePart("Part #"+(i+1)+" details"); + pp = new PagePart(Page.PAGE_PART+(i+1), i); addPage(pp); - pp.setMPA(app); + pp.setMPA(mpa); pp.setArtifact(artifacts.get(i)); } } else{ - p = new ErrorPage("MPA error"); + p = new ErrorPage(Page.PAGE_ERROR); addPage(p); } } @@ -106,4 +108,8 @@ public class GUI extends WizardMod { } } } + + public int getArtifactsCount(){ + return artifacts.size(); + } } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUIpage.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUIpage.java deleted file mode 100644 index c7f8d6fd7f9fcc14a1763ff95bcfa1563b03d8b5..0000000000000000000000000000000000000000 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/GUIpage.java +++ /dev/null @@ -1,162 +0,0 @@ -//package org.universaal.tools.packaging.tool.gui; -// -//import java.io.File; -// -//import org.eclipse.core.resources.IProject; -//import org.eclipse.jface.resource.ImageDescriptor; -//import org.eclipse.jface.wizard.WizardPage; -//import org.eclipse.swt.SWT; -//import org.eclipse.swt.layout.GridData; -//import org.eclipse.swt.layout.GridLayout; -//import org.eclipse.swt.widgets.Combo; -//import org.eclipse.swt.widgets.Composite; -//import org.eclipse.swt.widgets.Event; -//import org.eclipse.swt.widgets.Label; -//import org.eclipse.swt.widgets.Listener; -//import org.eclipse.swt.widgets.Text; -//import org.universaal.tools.packaging.tool.parts.DeploymentUnit; -//import org.universaal.tools.packaging.tool.parts.DeploymentUnit.ContainerUnit; -//import org.universaal.tools.packaging.tool.parts.ExecutionUnit; -//import org.universaal.tools.packaging.tool.parts.Part; -//import org.universaal.tools.packaging.tool.parts.universaal.aal_mpa.v1_0.OsType; -//import org.universaal.tools.packaging.tool.parts.universaal.aal_mpa.v1_0.PlatformType; -//import org.universaal.tools.packaging.tool.util.POMParser; -// -//public class GUIpage extends WizardPage { -// -// private Composite container; -// private IProject artifact; -// -// private Combo osList, platformList, containerList; -// -// private Part part; -// private DeploymentUnit du; -// private ContainerUnit cu; -// private ExecutionUnit eu; -// -// protected GUIpage(String pageName, String title, ImageDescriptor titleImage, IProject artifact) { -// super(pageName, title, titleImage); -// this.artifact = artifact; -// } -// -// public void createControl(Composite parent) { -// -// container = new Composite(parent, SWT.NULL); -// GridLayout layout = new GridLayout(); -// container.setLayout(layout); -// -// layout.numColumns = 2; -// GridData gd = new GridData(GridData.FILL_HORIZONTAL); -// -// POMParser p = new POMParser(new File(artifact.getFile("pom.xml").getLocation()+"")); -// -// Label label1 = new Label(container, SWT.NULL); -// Text text1 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label1.setText("Artifact ID"); -// text1.setText(p.getArtifactID()); -// text1.setLayoutData(gd); -// -// Label label2 = new Label(container, SWT.NULL); -// Text text2 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label2.setText("Group ID"); -// text2.setText(p.getGroupID()); -// text2.setLayoutData(gd); -// -// Label label3 = new Label(container, SWT.NULL); -// Text text3 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label3.setText("URL"); -// text3.setText(p.getUrl()); -// text3.setLayoutData(gd); -// -// Label label4 = new Label(container, SWT.NULL); -// Text text4 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label4.setText("Version"); -// text4.setText(p.getVersion()); -// text4.setLayoutData(gd); -// -// Label label5 = new Label(container, SWT.NULL); -// Text text5 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label5.setText("Packaging"); -// text5.setText(p.getPackaging()); -// text5.setLayoutData(gd); -// -// Label label6 = new Label(container, SWT.NULL); -// Text text6 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label6.setText("Description"); -// text6.setText(p.getDescription()); -// text6.setLayoutData(gd); -// -// Label label8 = new Label(container, SWT.NULL); -// Text text8 = new Text(container, SWT.BORDER | SWT.SINGLE); -// label8.setText("Name"); -// text8.setText(p.getName()); -// text8.setLayoutData(gd); -// -// //label.setText("CHECK"); -// //text.setText(artifacts.get(i).getName()); -// -// /*text.addKeyListener(new KeyListener() { -// -// public void keyPressed(KeyEvent e) { -// } -// -// public void keyReleased(KeyEvent e) { -// if (!text.getText().isEmpty()) { -// setPageComplete(true); -// } -// } -// -// });*/ -// -// // Required to avoid an error in the system -// setControl(container); -// setPageComplete(true); -// //setPageComplete(false); -// -// part = new Part(); -// part.setPartId(p.getGroupID()+p.getArtifactID()); -// -// du = new DeploymentUnit(); -// du.setId(p.getGroupID()+p.getArtifactID()); -// -// osList = new Combo(container, SWT.NULL); -// for(int i = 0; i < OsType.values().length; i++) -// osList.add(OsType.values()[i].value()); -// osList.addListener(SWT.Selection, new Listener() { -// -// public void handleEvent(Event event) { -// du.setOsUnit(OsType.fromValue(osList.getItem(osList.getSelectionIndex()))); -// } -// }); -// -// platformList = new Combo(container, SWT.NULL); -// for(int i = 0; i < PlatformType.values().length; i++) -// platformList.add(PlatformType.values()[i].value()); -// platformList.addListener(SWT.Selection, new Listener() { -// -// public void handleEvent(Event event) { -// du.setPlatformUnit(PlatformType.fromValue(platformList.getItem(platformList.getSelectionIndex()))); -// } -// }); -// -// cu = new ContainerUnit(); -// containerList = new Combo(container, SWT.NULL); -// cu.setEquinox(value); -// cu.setFelix(value); -// cu.setKaraf(value); -// cu.setTomcat(value); -// cu.getKaraf().setEmbedding(value); -// cu.getKaraf().setEmbeddingName(value); -// cu.getKaraf().setFeatures(value); -// -// du.setContainerUnit(cu); -// -// eu = new ExecutionUnit(); -// eu.setConfigFiles(value); -// eu.setDeploymentUnit(value); -// eu.setSpaceStartLevel(value); -// -// part.getExecutionUnit().add(eu); -// part.getDeploymentUnit().add(du); -// } -//} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page1.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page1.java index eeb6cf1f4106ebf297ef23e68a6c6818d3960c34..254dbf95476b2fcc95cb28119068153927f9e469 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page1.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page1.java @@ -5,7 +5,6 @@ import java.util.List; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -15,9 +14,11 @@ import org.eclipse.swt.widgets.Text; public class Page1 extends PageImpl { private Text name, id, description, tags, version_major, version_minor, version_micro, version_build, app_profile; + private int partNumber; - protected Page1(String pageName) { - super(pageName, "Specify details of the MPA you are creating"); + protected Page1(String pageName, int pn) { + super(pageName, "Specify details of the MPA you are creating", pn); + partNumber = pn; } public void createControl(Composite parent) { @@ -35,28 +36,28 @@ public class Page1 extends PageImpl { name = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(name); label1.setText("Application name"); - name.setText(app.getApplication().getName()); + name.setText(multipartApplication.getApplications().get(partNumber).getApplication().getName()); name.setLayoutData(gd); Label label2 = new Label(container, SWT.NULL); id = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(id); label2.setText("Application ID"); - id.setText(app.getApplication().getAppID()); + id.setText(multipartApplication.getApplications().get(partNumber).getApplication().getAppID()); id.setLayoutData(gd); Label label3 = new Label(container, SWT.NULL); description = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(description); label3.setText("Description"); - description.setText(app.getApplication().getDescription()); + description.setText(multipartApplication.getApplications().get(partNumber).getApplication().getDescription()); description.setLayoutData(gd); Label label4 = new Label(container, SWT.NULL); tags = new Text(container, SWT.BORDER | SWT.SINGLE); label4.setText("Insert tags (if any) separated by commas"); - List<String> tgs = app.getApplication().getTags(); + List<String> tgs = multipartApplication.getApplications().get(partNumber).getApplication().getTags(); String tbv = ""; for(int i = 0; i < tgs.size(); i++) tbv.concat(tgs.get(i)); @@ -68,112 +69,88 @@ public class Page1 extends PageImpl { version_major = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(version_major); label5.setText("Major version"); - version_major.setText(app.getApplication().getVersion().getMajor()); + version_major.setText(multipartApplication.getApplications().get(partNumber).getApplication().getVersion().getMajor()); version_major.setLayoutData(gd); Label label6 = new Label(container, SWT.NULL); version_minor = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(version_minor); label6.setText("Minor version"); - version_minor.setText(app.getApplication().getVersion().getMinor()); + version_minor.setText(multipartApplication.getApplications().get(partNumber).getApplication().getVersion().getMinor()); version_minor.setLayoutData(gd); Label label7 = new Label(container, SWT.NULL); version_micro = new Text(container, SWT.BORDER | SWT.SINGLE); label7.setText("Micro version"); - version_micro.setText(app.getApplication().getVersion().getMicro()); + version_micro.setText(multipartApplication.getApplications().get(partNumber).getApplication().getVersion().getMicro()); version_micro.setLayoutData(gd); Label label8 = new Label(container, SWT.NULL); version_build = new Text(container, SWT.BORDER | SWT.SINGLE); label8.setText("Build"); - version_build.setText(app.getApplication().getVersion().getBuild()); + version_build.setText(multipartApplication.getApplications().get(partNumber).getApplication().getVersion().getBuild()); version_build.setLayoutData(gd); Label label9 = new Label(container, SWT.NULL); app_profile = new Text(container, SWT.BORDER | SWT.SINGLE); label9.setText("Application profile"); - app_profile.setText(app.getApplication().getApplicationProfile()); + app_profile.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProfile()); app_profile.setLayoutData(gd); - name.addKeyListener(new KeyListener() { + name.addKeyListener(new QL() { - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().setName(name.getText()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().setName(name.getText()); } }); - id.addKeyListener(new KeyListener() { + id.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().setAppID(id.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().setAppID(id.getText()); } }); - description.addKeyListener(new KeyListener() { + description.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().setDescription(description.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().setDescription(description.getText()); } }); - version_major.addKeyListener(new KeyListener() { + version_major.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getVersion().setMajor(version_major.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().getVersion().setMajor(version_major.getText()); } }); - version_minor.addKeyListener(new KeyListener() { + version_minor.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getVersion().setMinor(version_minor.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().getVersion().setMinor(version_minor.getText()); } }); - version_micro.addKeyListener(new KeyListener() { + version_micro.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getVersion().setMicro(version_micro.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().getVersion().setMicro(version_micro.getText()); } }); - version_build.addKeyListener(new KeyListener() { + version_build.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getVersion().setBuild(version_build.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().getVersion().setBuild(version_build.getText()); } }); - app_profile.addKeyListener(new KeyListener() { + app_profile.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().setApplicationProfile(app_profile.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().setApplicationProfile(app_profile.getText()); } }); } @@ -185,10 +162,10 @@ public class Page1 extends PageImpl { String[] tag = tags.getText().split(","); if(tag != null){ for(int i = 0; i < tag.length; i++) - app.getApplication().getTags().add(tag[i]); + multipartApplication.getApplications().get(partNumber).getApplication().getTags().add(tag[i]); } else{ - app.getApplication().getTags().add(tags.getText()); + multipartApplication.getApplications().get(partNumber).getApplication().getTags().add(tags.getText()); } } return super.getNextPage(); diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page2.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page2.java index 708b3bc6751a02c89cf40ab91e3da9a4ca867e41..cbc9e080fc05993ed6a6f58b912ea64947b299c5 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page2.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page2.java @@ -5,7 +5,6 @@ import java.net.URI; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; @@ -19,10 +18,11 @@ public class Page2 extends PageImpl { private Text certificate, person, email, organization, phone, address, web; private boolean addLicense; + private int partNumber; - protected Page2(String pageName) { - super(pageName, "Specify contact details"); - //addLicense = !getMPA().getApplication().getLicenses().isEmpty(); + protected Page2(String pageName, int pn) { + super(pageName, "Specify contact details", pn); + partNumber = pn; } public void createControl(Composite parent) { @@ -41,131 +41,110 @@ public class Page2 extends PageImpl { certificate = new Text(container, SWT.BORDER | SWT.SINGLE); //mandatory.add(certificate); l1.setText("Security certificate"); - certificate.setText(app.getApplication().getApplicationProvider().getCertificate().toString()); + certificate.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getCertificate().toString()); certificate.setLayoutData(gd); Label l2 = new Label(container, SWT.NULL); person = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(person); l2.setText("Contact person"); - person.setText(app.getApplication().getApplicationProvider().getContactPerson()); + person.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getContactPerson()); person.setLayoutData(gd); Label l3 = new Label(container, SWT.NULL); email = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(email); l3.setText("Contact e-mail"); - email.setText(app.getApplication().getApplicationProvider().getContactPerson()); + email.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getContactPerson()); email.setLayoutData(gd); Label l4 = new Label(container, SWT.NULL); organization = new Text(container, SWT.BORDER | SWT.SINGLE); mandatory.add(organization); l4.setText("Organization name"); - organization.setText(app.getApplication().getApplicationProvider().getOrganizationName()); + organization.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getOrganizationName()); organization.setLayoutData(gd); Label l5 = new Label(container, SWT.NULL); phone = new Text(container, SWT.BORDER | SWT.SINGLE); //mandatory.add(phone); l5.setText("Phone number"); - phone.setText(app.getApplication().getApplicationProvider().getPhone()); + phone.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getPhone()); phone.setLayoutData(gd); Label l6 = new Label(container, SWT.NULL); address = new Text(container, SWT.BORDER | SWT.SINGLE); //mandatory.add(address); l6.setText("Street address"); - address.setText(app.getApplication().getApplicationProvider().getStreetAddress()); + address.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getStreetAddress()); address.setLayoutData(gd); Label l7 = new Label(container, SWT.NULL); web = new Text(container, SWT.BORDER | SWT.SINGLE); //mandatory.add(web); l7.setText("Website"); - web.setText(app.getApplication().getApplicationProvider().getWebAddress().toString()); + web.setText(multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().getWebAddress().toString()); web.setLayoutData(gd); - certificate.addKeyListener(new KeyListener() { + certificate.addKeyListener(new QL() { - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { + @Override + public void keyReleased(KeyEvent e) { try{ - app.getApplication().getApplicationProvider().setCertificate(new URI(certificate.getText())); + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setCertificate(new URI(certificate.getText())); } catch(Exception ex){ ex.printStackTrace(); - } - } - }); - person.addKeyListener(new KeyListener() { - - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getApplicationProvider().setContactPerson(person.getText()); - } - }); - email.addKeyListener(new KeyListener() { - - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getApplicationProvider().setEmail(email.getText()); - } - }); - organization.addKeyListener(new KeyListener() { - - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); + } } + }); + person.addKeyListener(new QL() { - public void keyPressed(KeyEvent e) { - app.getApplication().getApplicationProvider().setOrganizationName(organization.getText()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setContactPerson(person.getText()); } - }); - phone.addKeyListener(new KeyListener() { + }); + email.addKeyListener(new QL() { - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setEmail(email.getText()); } + }); + organization.addKeyListener(new QL() { - public void keyPressed(KeyEvent e) { - app.getApplication().getApplicationProvider().setPhone(phone.getText()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setOrganizationName(organization.getText()); } }); - address.addKeyListener(new KeyListener() { + phone.addKeyListener(new QL() { - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getApplication().getApplicationProvider().setStreetAddress(address.getText()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setPhone(phone.getText()); } }); - web.addKeyListener(new KeyListener() { + address.addKeyListener(new QL() { - public void keyReleased(KeyEvent e) { - setPageComplete(validate()); + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setStreetAddress(address.getText()); } + }); + web.addKeyListener(new QL() { - public void keyPressed(KeyEvent e) { + @Override + public void keyReleased(KeyEvent e) { try{ - app.getApplication().getApplicationProvider().setWebAddress(new URI(web.getText())); + multipartApplication.getApplications().get(partNumber).getApplication().getApplicationProvider().setWebAddress(new URI(web.getText())); } catch(Exception ex){ ex.printStackTrace(); - } + } } - }); + }); gd = new GridData(GridData.FILL, GridData.CENTER, true, false); final Label l8 = new Label(container, SWT.NULL); @@ -189,7 +168,7 @@ public class Page2 extends PageImpl { }); b.setLayoutData(gd); Label l9 = new Label(container, SWT.NULL); - l9.setText("(in: "+app.getApplication().getLicenses().size()+")"); + l9.setText("(in: "+multipartApplication.getApplications().get(partNumber).getApplication().getLicenses().size()+")"); } @Override @@ -197,8 +176,6 @@ public class Page2 extends PageImpl { if(addLicense) return super.getNextPage(); // SLA and licences - //else - //app.getApplication().getLicenses().clear(); return super.getNextPage().getNextPage(); // Capabilities } diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page3.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page3.java index d910bd267072be7625ef14dc88e7dcbb9a434080..17d409a00463e4e11aba285d892af083e4ade4dd 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page3.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page3.java @@ -5,7 +5,6 @@ import java.util.Properties; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; @@ -19,22 +18,24 @@ public class Page3 extends PageImpl { private Combo targetSpace; private Text targetSpaceVersion, mw_version, targetOntologies, targetContainerName, targetContainerVersion, targetDeploymentTool; + private int partNumber; - protected Page3(String pageName) { - super(pageName, "Specify capabilities of the MPA"); + protected Page3(String pageName, int pn) { + super(pageName, "Specify capabilities of the MPA", pn); + partNumber = pn; } public void createControl(Composite parent) { container = new Composite(parent, SWT.NULL); setControl(container); - + GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 2; gd = new GridData(GridData.FILL_HORIZONTAL); - Properties capabilities = app.getCapabilities().getCapabilities(); + Properties capabilities = multipartApplication.getApplications().get(partNumber).getCapabilities().getCapabilities(); Label l1 = new Label(container, SWT.NULL); targetSpace = new Combo (container, SWT.READ_ONLY); @@ -89,74 +90,53 @@ public class Page3 extends PageImpl { targetDeploymentTool.setText(capabilities.getProperty(Capability.Mandatory.TARGET_DEPLOYMENT_TOOL.toString())); targetDeploymentTool.setLayoutData(gd); - targetSpace.addKeyListener(new KeyListener() { + targetSpace.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.TARGET_SPACE.toString(), targetSpace.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.TARGET_SPACE.toString(), targetSpace.getText()); } }); - targetSpaceVersion.addKeyListener(new KeyListener() { + targetSpaceVersion.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.TARGET_SPACE_VERSION.toString(), targetSpaceVersion.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.TARGET_SPACE_VERSION.toString(), targetSpaceVersion.getText()); } }); - mw_version.addKeyListener(new KeyListener() { + mw_version.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.MW_VERSION.toString(), mw_version.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.MW_VERSION.toString(), mw_version.getText()); } }); - targetOntologies.addKeyListener(new KeyListener() { + targetOntologies.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.ONTOLOGIES.toString(), targetOntologies.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.ONTOLOGIES.toString(), targetOntologies.getText()); } }); - targetContainerName.addKeyListener(new KeyListener() { + targetContainerName.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.TARGET_CONTAINER_NAME.toString(), targetContainerName.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.TARGET_CONTAINER_NAME.toString(), targetContainerName.getText()); } }); - targetContainerVersion.addKeyListener(new KeyListener() { + targetContainerVersion.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.TARGET_CONTAINER_VERSION.toString(), targetContainerVersion.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.TARGET_CONTAINER_VERSION.toString(), targetContainerVersion.getText()); } }); - targetDeploymentTool.addKeyListener(new KeyListener() { + targetDeploymentTool.addKeyListener(new QL() { + @Override public void keyReleased(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyPressed(KeyEvent e) { - app.getCapabilities().setCapability(Capability.Mandatory.TARGET_DEPLOYMENT_TOOL.toString(), targetDeploymentTool.getText()); + multipartApplication.getApplications().get(partNumber).getCapabilities().setCapability(Capability.Mandatory.TARGET_DEPLOYMENT_TOOL.toString(), targetDeploymentTool.getText()); } }); } @@ -164,7 +144,7 @@ public class Page3 extends PageImpl { @Override public IWizardPage getPreviousPage() { - if(!app.getApplication().getLicenses().isEmpty()) + if(!multipartApplication.getApplications().get(partNumber).getApplication().getLicenses().isEmpty()) return super.getPreviousPage(); return super.getPreviousPage().getPreviousPage(); diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page4.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page4.java index 9c871768ee010499da1b1199f489bc1c33586e41..da3ab6cf58e44f3c1a7fea97d0b7457432a1c867 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page4.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page4.java @@ -5,8 +5,6 @@ import java.util.List; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; @@ -21,14 +19,15 @@ import org.universaal.tools.packaging.tool.parts.SingleRequirement; public class Page4 extends PageImpl { - //private List<Requirement> requirements; + private int partNumber; private List<String> reqs, vals, logicalCriteria, logicalRelations; private Text req1, req2, req3, req4, req5; private Text val1, val2, val3, val4, val5; private Combo c1, c2, c3, c4, c5, c12, c23, c34, c45; - protected Page4(String pageName) { - super(pageName, "Specify requirements for the MPA you are creating."); + protected Page4(String pageName, int pn) { + super(pageName, "Specify requirements for the MPA you are creating.", pn); + partNumber = pn; } public void createControl(Composite parent) { @@ -47,7 +46,7 @@ public class Page4 extends PageImpl { logicalCriteria = new ArrayList<String>(); logicalRelations = new ArrayList<String>(); - List<Requirement> list = app.getRequirements().getRequirementsList(); + List<Requirement> list = multipartApplication.getApplications().get(partNumber).getRequirements().getRequirementsList(); for(int i = 0; i < list.size(); i++){ if(list.get(i).isSingleReq()){ @@ -234,25 +233,25 @@ public class Page4 extends PageImpl { val5.setText(vals.get(4)); val5.setLayoutData(gd); - req1.addKeyListener(new QL() {}); - req2.addKeyListener(new QL() {}); - req3.addKeyListener(new QL() {}); - req4.addKeyListener(new QL() {}); - req5.addKeyListener(new QL() {}); - val1.addKeyListener(new QL() {}); - val2.addKeyListener(new QL() {}); - val3.addKeyListener(new QL() {}); - val4.addKeyListener(new QL() {}); - val5.addKeyListener(new QL() {}); - c1.addKeyListener(new QL() {}); - c2.addKeyListener(new QL() {}); - c3.addKeyListener(new QL() {}); - c4.addKeyListener(new QL() {}); - c5.addKeyListener(new QL() {}); - c12.addKeyListener(new QL() {}); - c23.addKeyListener(new QL() {}); - c34.addKeyListener(new QL() {}); - c45.addKeyListener(new QL() {}); + req1.addKeyListener(new FullListener()); + req2.addKeyListener(new FullListener() {}); + req3.addKeyListener(new FullListener() {}); + req4.addKeyListener(new FullListener() {}); + req5.addKeyListener(new FullListener() {}); + val1.addKeyListener(new FullListener() {}); + val2.addKeyListener(new FullListener() {}); + val3.addKeyListener(new FullListener() {}); + val4.addKeyListener(new FullListener() {}); + val5.addKeyListener(new FullListener() {}); + c1.addKeyListener(new FullListener() {}); + c2.addKeyListener(new FullListener() {}); + c3.addKeyListener(new FullListener() {}); + c4.addKeyListener(new FullListener() {}); + c5.addKeyListener(new FullListener() {}); + c12.addKeyListener(new FullListener() {}); + c23.addKeyListener(new FullListener() {}); + c34.addKeyListener(new FullListener() {}); + c45.addKeyListener(new FullListener() {}); } @Override @@ -295,21 +294,11 @@ public class Page4 extends PageImpl { SingleRequirement r2 = new SingleRequirement(req2.getText(), val2.getText(), lc2); RequirementsGroup r = new RequirementsGroup(r1, r2, lr); - app.getRequirements().getRequirementsList().add(new Requirement(r, false)); + multipartApplication.getApplications().get(partNumber).getRequirements().getRequirementsList().add(new Requirement(r, false)); } private void single(Text req1, Text val1, LogicalCriteria lc1){ SingleRequirement r = new SingleRequirement(req1.getText(), val1.getText(), lc1); - app.getRequirements().getRequirementsList().add(new Requirement(r, false)); - } - - public abstract class QL implements KeyListener{ - - public void keyPressed(KeyEvent e) { - setPageComplete(validate()); - } - - public void keyReleased(KeyEvent e) { - } + multipartApplication.getApplications().get(partNumber).getRequirements().getRequirementsList().add(new Requirement(r, false)); } } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page5.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page5.java index c535ae36550e07e5effd172377367a126c546f96..66f9f85ccf5602a0446ef7e3137aecf41e3ac0bd 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page5.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/Page5.java @@ -1,17 +1,24 @@ package org.universaal.tools.packaging.tool.gui; +import java.util.List; + import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; import org.universaal.tools.packaging.tool.parts.ApplicationManagement.RemoteManagement; -import org.universaal.tools.packaging.tool.parts.Artifact; -import org.universaal.tools.packaging.tool.parts.Version; public class Page5 extends PageImpl { - protected Page5(String pageName) { - super(pageName, "Specify details for the MPA you are creating."); + private int partNumber; + private Text contact, artifactID1, artifactID2, artifactID3, prot1, prot2, prot3, v1, v2, v3; + + protected Page5(String pageName, int pn) { + super(pageName, "Specify details for the MPA you are creating.", pn); + partNumber = pn; } public void createControl(Composite parent) { @@ -24,14 +31,149 @@ public class Page5 extends PageImpl { layout.numColumns = 2; gd = new GridData(GridData.FILL_HORIZONTAL); - app.getManagement().setContact(""); - RemoteManagement e = app.getManagement().new RemoteManagement(); - e.setProtocol(""); - Artifact software = new Artifact(); - software.setArtifactID(""); - Version version = new Version(); - software.setVersion(version); - e.setSoftware(software); - app.getManagement().getRemoteManagement().add(e); + List<RemoteManagement> remoteM = multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement(); + while(remoteM.size() <= 2){ + remoteM.add(multipartApplication.getApplications().get(partNumber).getManagement().new RemoteManagement()); + } + + Label l1 = new Label(container, SWT.NULL); + contact = new Text(container, SWT.BORDER | SWT.SINGLE); + mandatory.add(contact); + l1.setText("Contact Person"); + contact.setText(multipartApplication.getApplications().get(partNumber).getManagement().getContact()); + contact.setLayoutData(gd); + contact.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().setContact(contact.getText()); + } + }); + + Label l2 = new Label(container, SWT.NULL); + artifactID1 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(artifactID1); + l2.setText("Artifact #1 ID"); + artifactID1.setText(remoteM.get(0).getSoftware().getArtifactID()); + artifactID1.setLayoutData(gd); + artifactID1.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(0).getSoftware().setArtifactID(artifactID1.getText()); + } + }); + + Label l3 = new Label(container, SWT.NULL); + prot1 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(prot1); + l3.setText("Protocol"); + prot1.setText(remoteM.get(0).getProtocol()); + prot1.setLayoutData(gd); + prot1.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(0).setProtocol(prot1.getText()); + } + }); + + Label l4 = new Label(container, SWT.NULL); + v1 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(v1); + l4.setText("Version"); + v1.setText(remoteM.get(0).getSoftware().getVersion().getVersion()); + v1.setLayoutData(gd); + v1.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(0).getSoftware().getVersion().setVersion(v1.getText()); + } + }); + + Label l5 = new Label(container, SWT.NULL); + artifactID2 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(artifactID1); + l5.setText("Artifact #2 ID"); + artifactID2.setText(remoteM.get(1).getSoftware().getArtifactID()); + artifactID2.setLayoutData(gd); + artifactID2.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(1).getSoftware().setArtifactID(artifactID2.getText()); + } + }); + + Label l6 = new Label(container, SWT.NULL); + prot2 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(prot1); + l6.setText("Protocol"); + prot2.setText(remoteM.get(1).getProtocol()); + prot2.setLayoutData(gd); + prot2.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(1).setProtocol(prot2.getText()); + } + }); + + Label l7 = new Label(container, SWT.NULL); + v2 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(v1); + l7.setText("Version"); + v2.setText(remoteM.get(1).getSoftware().getVersion().getVersion()); + v2.setLayoutData(gd); + v2.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(1).getSoftware().getVersion().setVersion(v2.getText()); + } + }); + + Label l8 = new Label(container, SWT.NULL); + artifactID3 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(artifactID1); + l8.setText("Artifact #3 ID"); + artifactID3.setText(remoteM.get(2).getSoftware().getArtifactID()); + artifactID3.setLayoutData(gd); + artifactID3.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(2).getSoftware().setArtifactID(artifactID3.getText()); + } + }); + + Label l9 = new Label(container, SWT.NULL); + prot3 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(prot1); + l9.setText("Protocol"); + prot3.setText(remoteM.get(2).getProtocol()); + prot3.setLayoutData(gd); + prot3.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(2).setProtocol(prot3.getText()); + } + }); + + Label l10 = new Label(container, SWT.NULL); + v3 = new Text(container, SWT.BORDER | SWT.SINGLE); + //mandatory.add(v1); + l10.setText("Version"); + v3.setText(remoteM.get(2).getSoftware().getVersion().getVersion()); + v3.setLayoutData(gd); + v3.addKeyListener(new QL() { + + @Override + public void keyReleased(KeyEvent e) { + multipartApplication.getApplications().get(partNumber).getManagement().getRemoteManagement().get(2).getSoftware().getVersion().setVersion(v3.getText()); + } + }); } } diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageImpl.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageImpl.java index fb12c674bf293ac040cd83b588a6fb7fe9981e46..92cb102e4d8d2a15f5c55015901f298ba802bc80 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageImpl.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageImpl.java @@ -7,6 +7,8 @@ import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; @@ -14,17 +16,18 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; import org.universaal.tools.packaging.api.Page; import org.universaal.tools.packaging.tool.actions.SampleAction; -import org.universaal.tools.packaging.tool.parts.MultipartApplication; +import org.universaal.tools.packaging.tool.parts.MPA; public abstract class PageImpl extends WizardPage implements Page { protected Composite container; protected GridData gd; - protected static MultipartApplication app; + protected static MPA multipartApplication; protected List<Control> mandatory; protected static int otherLicenses = 1; + protected int partNumber = 0; protected PageImpl(String pageName) { super(pageName); @@ -34,17 +37,18 @@ public abstract class PageImpl extends WizardPage implements Page { setPageComplete(false); } - protected PageImpl(String pageName, String description) { + protected PageImpl(String pageName, String description, int pn) { super(pageName); setDescription(description); setTitle(pageName); + partNumber = pn; mandatory = new ArrayList<Control>(); setPageComplete(false); } - public void setMPA(MultipartApplication mpa) { - app = mpa; + public void setMPA(MPA mpa) { + multipartApplication = mpa; } public boolean validate(){ @@ -62,6 +66,9 @@ public abstract class PageImpl extends WizardPage implements Page { public void addPageCustom(boolean sec, IWizardPage page){ + //TODO wrong! + //partNumber + if(!sec){ SampleAction.gui.addPage(page); @@ -94,9 +101,24 @@ public abstract class PageImpl extends WizardPage implements Page { } } - public MultipartApplication getMPA(){ - return app; + public int getPartNumber(){ + return partNumber; } public void setArtifact(IProject p){} -} + + public abstract class QL implements KeyListener{ + + public void keyPressed(KeyEvent e) { + setPageComplete(validate()); + } + + public abstract void keyReleased(KeyEvent e); + } + + public class FullListener extends QL{ + + @Override + public void keyReleased(KeyEvent e) { + }} +} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageLicenses.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageLicenses.java index 5dd6d94d314c62ffc07f6ae42d5528535a2be180..153f136faf904fdfcbbd52044a40c3d294fb9466 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageLicenses.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PageLicenses.java @@ -17,8 +17,9 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import org.universaal.tools.packaging.tool.parts.Application.LicenseSet; -import org.universaal.tools.packaging.tool.parts.Application.SLA; +import org.universaal.tools.packaging.api.Page; +import org.universaal.tools.packaging.tool.parts.App.LicenseSet; +import org.universaal.tools.packaging.tool.parts.App.SLA; import org.universaal.tools.packaging.tool.parts.License; import org.universaal.tools.packaging.tool.parts.LicenseCategory; @@ -30,15 +31,18 @@ public class PageLicenses extends PageImpl { private SLA sla; private License lic; private boolean addLicense = false, pageAdded = false, onlyLicense = false; + private int partNumber; - protected PageLicenses(String pageName) { - super(pageName, "Add SLA and license(s) for you MPA"); + protected PageLicenses(String pageName, int pn) { + super(pageName, "Add SLA and license(s) for you MPA", pn); + this.partNumber = pn; } - protected PageLicenses(String pageName, boolean onlyLicense) { + protected PageLicenses(String pageName, boolean onlyLicense, int pn) { - super(pageName, "Add SLA and license(s) for you MPA"); + super(pageName, "Add SLA and license(s) for you MPA", pn); this.onlyLicense = onlyLicense; + this.partNumber = pn; } public void createControl(Composite parent) { @@ -53,8 +57,8 @@ public class PageLicenses extends PageImpl { gd = new GridData(GridData.FILL, GridData.CENTER, true, false); gd.horizontalSpan = 2; - List<LicenseSet> ls = app.getApplication().getLicenses(); - LicenseSet l = app.getApplication().new LicenseSet(); + List<LicenseSet> ls = multipartApplication.getApplications().get(partNumber).getApplication().getLicenses(); + LicenseSet l = multipartApplication.getApplications().get(partNumber).getApplication().new LicenseSet(); lic = new License(); @@ -62,7 +66,7 @@ public class PageLicenses extends PageImpl { ls.add(l); if(!onlyLicense){ - sla = app.getApplication().new SLA(); + sla = multipartApplication.getApplications().get(partNumber).getApplication().new SLA(); Label l1 = new Label(container, SWT.NULL); slaLink = new Text(container, SWT.BORDER | SWT.SINGLE); @@ -169,7 +173,7 @@ public class PageLicenses extends PageImpl { final Button b = new Button(container, SWT.PUSH); b.setText("Add another license"); Label t = new Label(container, SWT.NULL); - t.setText("License "+getMPA().getApplication().getLicenses().size()); + t.setText("License "+multipartApplication.getApplications().get(partNumber).getApplication().getLicenses().size()); b.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { @@ -187,14 +191,14 @@ public class PageLicenses extends PageImpl { }); b.setLayoutData(gd); Label l9 = new Label(container, SWT.NULL); - l9.setText("(of "+app.getApplication().getLicenses().size()+")"); + l9.setText("(of "+multipartApplication.getApplications().get(partNumber).getApplication().getLicenses().size()+")"); } @Override public IWizardPage getNextPage() { if(addLicense){ - addPageCustom(pageAdded, new PageLicenses("License #"+PageImpl.otherLicenses++, true)); + addPageCustom(pageAdded, new PageLicenses(Page.PAGE_LICENSE+PageImpl.otherLicenses++, true, partNumber)); pageAdded = true; } diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PagePart.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PagePart.java index 46691f3f7832a037b443c3ae5ed7f63f535bd0b6..382b4b4b91576b3a94896005a2f5e489146bfcf6 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PagePart.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/gui/PagePart.java @@ -1,10 +1,15 @@ package org.universaal.tools.packaging.tool.gui; import java.io.File; +import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; +import org.universaal.tools.packaging.tool.parts.Capability; +import org.universaal.tools.packaging.tool.parts.DeploymentUnit; +import org.universaal.tools.packaging.tool.parts.ExecutionUnit; +import org.universaal.tools.packaging.tool.parts.Requirement; import org.universaal.tools.packaging.tool.util.POMParser; public class PagePart extends PageImpl { @@ -12,17 +17,30 @@ public class PagePart extends PageImpl { private IProject artifact; private POMParser p; - protected PagePart(String pageName) { - super(pageName, "Specify details for the MPA you are creating."); + private int partNumber; + + protected PagePart(String pageName, int pn) { + super(pageName, "Specify details for the MPA you are creating.", pn); + this.partNumber = pn; } public void createControl(Composite parent) { container = new Composite(parent, SWT.NULL); setControl(container); + + List<DeploymentUnit> dus = multipartApplication.getApplications().get(partNumber).getPart().getDeploymentUnits(); + List<ExecutionUnit> eus = multipartApplication.getApplications().get(partNumber).getPart().getExecutionUnits(); + List<Capability> pcs = multipartApplication.getApplications().get(partNumber).getPart().getPartCapabilities(); + List<Requirement> prs = multipartApplication.getApplications().get(partNumber).getPart().getPartRequirements(); } public void setArtifact(IProject artifact){ this.artifact = artifact; p = new POMParser(new File(artifact.getFile("pom.xml").getLocation()+"")); } + + //capability + //describes single offering, mostly used for devices and platforms + //name.value + } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/App.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/App.java new file mode 100644 index 0000000000000000000000000000000000000000..8710cf8857c4f4db73dccabfa5636c93f9f90eda --- /dev/null +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/App.java @@ -0,0 +1,219 @@ +package org.universaal.tools.packaging.tool.parts; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; + +public class App { + + private String name, appID, description, applicationProfile = "org.universAAL.ontology.profile.AALAppSubProfile"; + private Version version; + private boolean multipart; + private List<String> tags; + private Contact applicationProvider; + private List<LicenseSet> licenses; + + public App(){ + name = Application.defaultString; + appID = Application.defaultString; + description = Application.defaultString; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAppID() { + return appID; + } + + public void setAppID(String appID) { + this.appID = appID; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getApplicationProfile() { + return applicationProfile; + } + + public void setApplicationProfile(String applicationProfile) { + this.applicationProfile = applicationProfile; + } + + public Version getVersion() { + if(version == null) + version = new Version(); + return version; + } + + public boolean isMultipart() { + return multipart; + } + + public void setMultipart(boolean multipart) { + this.multipart = multipart; + } + + public List<String> getTags() { + if(tags == null) + tags = new ArrayList<String>(); + return tags; + } + + public Contact getApplicationProvider() { + if(applicationProvider == null) + applicationProvider = new Contact(); + return applicationProvider; + } + + public List<LicenseSet> getLicenses() { + if(licenses == null) + licenses = new ArrayList<App.LicenseSet>(); + return licenses; + } + + public class SLA { + + String name; + URI link; + + public SLA(){ + + name = Application.defaultString; + try { + link = new URI(Application.defaultURL); + } catch (URISyntaxException e) { + } + } + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public URI getLink() { + return link; + } + public void setLink(URI link) { + this.link = link; + } + } + + public class LicenseSet{ + + SLA sla; + List<License> licenseList; + + public SLA getSla() { + return sla; + } + public void setSla(SLA sla) { + this.sla = sla; + } + public List<License> getLicenseList() { + if(licenseList == null) + licenseList = new ArrayList<License>(); + return licenseList; + } + } + + /* + * <xs:element name="app"> + <xs:annotation> + <xs:documentation>basic info about the application + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string"> + <xs:annotation> + <xs:documentation>friendly name e.g. Medication Manager + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="version" type="uapp:versionType"> + <xs:annotation> + <xs:documentation>version of the application</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="appId" type="xs:string"> + <xs:annotation> + <xs:documentation>unique name. It is used as key by the Space + Application Registry e.g. + org.universaal.aaalapplication.medmanager</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="description" type="xs:string"> + <xs:annotation> + <xs:documentation>free text description about the application + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="multipart" type="xs:boolean"> + <xs:annotation> + <xs:documentation>The application consists of multiple parts + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tags" type="xs:string"> + <xs:annotation> + <xs:documentation>comma separated list of tags, e.g. + "medication, medication monitoring, control" + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="applicationProvider" type="uapp:contactType"> + <xs:annotation> + <xs:documentation>contact information to the provider of the + application</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element maxOccurs="unbounded" minOccurs="0" name="licenses"> + <xs:annotation> + <xs:documentation>root license - each artifact may be licensed + under different license</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" minOccurs="0" + name="license" type="uapp:licenseType" /> + <xs:element minOccurs="0" name="sla"> + <xs:annotation> + <xs:documentation>service level agreement, if any + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" /> + <xs:element name="link" type="xs:anyURI" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="applicationProfile" type="xs:string"> + <xs:annotation> + <xs:documentation>URI of the AALAppSubProfile??? Is it not + fixed to org.universAAL.ontology.profile.AALAppSubProfile? + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + */ +} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Application.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Application.java index d565331f9356030eaf80200db1e4c5e9c35a0152..541ed6feae2569a81f6c353ad134f33582bcedbc 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Application.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Application.java @@ -1,219 +1,54 @@ package org.universaal.tools.packaging.tool.parts; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; public class Application { - String name, appID, description, applicationProfile = "org.universAAL.ontology.profile.AALAppSubProfile"; - Version version; - boolean multipart; - List<String> tags; - Contact applicationProvider; - List<LicenseSet> licenses; + public static final String defaultURL = "http://www.webpage.com"; + public static final String defaultString = "asdf"; + public static final String defaultFile = "c:\file.txt"; + + private App application; + private ApplicationCapabilities capabilities; + private ApplicationRequirements requirements; + private ApplicationManagement management; + private Part part; public Application(){ - name = MultipartApplication.defaultString; - appID = MultipartApplication.defaultString; - description = MultipartApplication.defaultString; + this.application = new App(); + this.capabilities = new ApplicationCapabilities(); + this.requirements = new ApplicationRequirements(); + this.management = new ApplicationManagement(); + this.part = new Part("defaultId"); } - public String getName() { - return name; + public App getApplication() { + return application; } - - public void setName(String name) { - this.name = name; + public void setApplication(App app) { + this.application = app; } - - public String getAppID() { - return appID; + public ApplicationCapabilities getCapabilities() { + return capabilities; } - - public void setAppID(String appID) { - this.appID = appID; + public void setCapabilities(ApplicationCapabilities capabilities) { + this.capabilities = capabilities; } - - public String getDescription() { - return description; + public ApplicationRequirements getRequirements() { + return requirements; } - - public void setDescription(String description) { - this.description = description; + public void setRequirements(ApplicationRequirements requirements) { + this.requirements = requirements; } - - public String getApplicationProfile() { - return applicationProfile; + public ApplicationManagement getManagement() { + return management; } - - public void setApplicationProfile(String applicationProfile) { - this.applicationProfile = applicationProfile; + public void setManagement(ApplicationManagement management) { + this.management = management; } - - public Version getVersion() { - if(version == null) - version = new Version(); - return version; - } - - public boolean isMultipart() { - return multipart; + public Part getPart() { + return part; } - - public void setMultipart(boolean multipart) { - this.multipart = multipart; + public void setPart(Part part) { + this.part = part; } - - public List<String> getTags() { - if(tags == null) - tags = new ArrayList<String>(); - return tags; - } - - public Contact getApplicationProvider() { - if(applicationProvider == null) - applicationProvider = new Contact(); - return applicationProvider; - } - - public List<LicenseSet> getLicenses() { - if(licenses == null) - licenses = new ArrayList<Application.LicenseSet>(); - return licenses; - } - - public class SLA { - - String name; - URI link; - - public SLA(){ - - name = MultipartApplication.defaultString; - try { - link = new URI(MultipartApplication.defaultURL); - } catch (URISyntaxException e) { - } - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public URI getLink() { - return link; - } - public void setLink(URI link) { - this.link = link; - } - } - - public class LicenseSet{ - - SLA sla; - List<License> licenseList; - - public SLA getSla() { - return sla; - } - public void setSla(SLA sla) { - this.sla = sla; - } - public List<License> getLicenseList() { - if(licenseList == null) - licenseList = new ArrayList<License>(); - return licenseList; - } - } - - /* - * <xs:element name="app"> - <xs:annotation> - <xs:documentation>basic info about the application - </xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string"> - <xs:annotation> - <xs:documentation>friendly name e.g. Medication Manager - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="version" type="uapp:versionType"> - <xs:annotation> - <xs:documentation>version of the application</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="appId" type="xs:string"> - <xs:annotation> - <xs:documentation>unique name. It is used as key by the Space - Application Registry e.g. - org.universaal.aaalapplication.medmanager</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="description" type="xs:string"> - <xs:annotation> - <xs:documentation>free text description about the application - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="multipart" type="xs:boolean"> - <xs:annotation> - <xs:documentation>The application consists of multiple parts - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="tags" type="xs:string"> - <xs:annotation> - <xs:documentation>comma separated list of tags, e.g. - "medication, medication monitoring, control" - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="applicationProvider" type="uapp:contactType"> - <xs:annotation> - <xs:documentation>contact information to the provider of the - application</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element maxOccurs="unbounded" minOccurs="0" name="licenses"> - <xs:annotation> - <xs:documentation>root license - each artifact may be licensed - under different license</xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" - name="license" type="uapp:licenseType" /> - <xs:element minOccurs="0" name="sla"> - <xs:annotation> - <xs:documentation>service level agreement, if any - </xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string" /> - <xs:element name="link" type="xs:anyURI" /> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="applicationProfile" type="xs:string"> - <xs:annotation> - <xs:documentation>URI of the AALAppSubProfile??? Is it not - fixed to org.universAAL.ontology.profile.AALAppSubProfile? - </xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - */ } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationCapabilities.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationCapabilities.java index e85764561940800938dcccee900ff51fa37ec784..9a002eaaa46a24432c9b8b91ad9dedcbcc711ba5 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationCapabilities.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationCapabilities.java @@ -15,13 +15,13 @@ public class ApplicationCapabilities { Mandatory[] mandatory = Capability.Mandatory.values(); for(int i = 0; i < mandatory.length; i++){ - Capability c = new Capability(mandatory[i].toString(), MultipartApplication.defaultString); + Capability c = new Capability(mandatory[i].toString(), Application.defaultString); capabilities.put(c.getName(), c.getValue()); } Optional[] optional = Capability.Optional.values(); for(int i = 0; i < optional.length; i++){ - Capability c = new Capability(optional[i].toString(), MultipartApplication.defaultString); + Capability c = new Capability(optional[i].toString(), Application.defaultString); capabilities.put(c.getName(), c.getValue()); } } diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationManagement.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationManagement.java index 243f7b945a71600a21caae890cd9c9117526434b..c94d35901e0c8514df1f01317b6ed989dce7d922 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationManagement.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ApplicationManagement.java @@ -41,7 +41,7 @@ public class ApplicationManagement { private List<RemoteManagement> remoteManagement; public ApplicationManagement(){ - contact = MultipartApplication.defaultString; + contact = Application.defaultString; } public String getContact() { @@ -64,7 +64,8 @@ public class ApplicationManagement { private Artifact software; public RemoteManagement(){ - protocol = MultipartApplication.defaultString; + protocol = Application.defaultString; + software = new Artifact(); } public String getProtocol() { diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Artifact.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Artifact.java index 718536a4ea8bb1047decdbb4583da6662fd280f6..5349b04cf0087e054866009439180e1288469397 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Artifact.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Artifact.java @@ -14,7 +14,8 @@ public class Artifact { private Version version; public Artifact(){ - artifactID = MultipartApplication.defaultString; + artifactID = Application.defaultString; + version = new Version(); } public String getArtifactID() { diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Contact.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Contact.java index accd73edef9bf32933d35d2fe2154e8b417195c4..cecafa2131ab0522a2f68b3bb4a918bd6c47e7db 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Contact.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Contact.java @@ -74,26 +74,26 @@ public class Contact { public Contact(){ - organizationName = MultipartApplication.defaultString; - contactPerson = MultipartApplication.defaultString; - streetAddress = MultipartApplication.defaultString; - email = MultipartApplication.defaultString; - phone = MultipartApplication.defaultString; + organizationName = Application.defaultString; + contactPerson = Application.defaultString; + streetAddress = Application.defaultString; + email = Application.defaultString; + phone = Application.defaultString; try{ - certificate = new URI(MultipartApplication.defaultURL); - webAddress = new URI(MultipartApplication.defaultURL); + certificate = new URI(Application.defaultURL); + webAddress = new URI(Application.defaultURL); } catch(Exception ex){} } public Contact(URI certificate, URI webAddress){ - organizationName = MultipartApplication.defaultString; - contactPerson = MultipartApplication.defaultString; - streetAddress = MultipartApplication.defaultString; - email = MultipartApplication.defaultString; - phone = MultipartApplication.defaultString; + organizationName = Application.defaultString; + contactPerson = Application.defaultString; + streetAddress = Application.defaultString; + email = Application.defaultString; + phone = Application.defaultString; this.certificate = certificate; this.webAddress = webAddress; @@ -167,8 +167,8 @@ public class Contact { String channelName, channelDetails; public OtherChannel(){ - channelName = MultipartApplication.defaultString; - channelDetails = MultipartApplication.defaultString; + channelName = Application.defaultString; + channelDetails = Application.defaultString; } public String getChannelName() { diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/DeploymentUnit.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/DeploymentUnit.java index e86fcf68dff7cade2cbc467d18305d197ac2e7f5..aa8326f7b4cde1157601fe16a2eb647bdd7f6e5b 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/DeploymentUnit.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/DeploymentUnit.java @@ -8,60 +8,9 @@ import org.apache.karaf.xmlns.features.v1_0.FeaturesRoot; public class DeploymentUnit { - /* - * <xs:element name="deploymentUnit"> - <xs:complexType> - <xs:choice> - <xs:element name="osUnit" type="uapp:osType"> - <xs:annotation> - <xs:documentation>Not used for the moment. Intended to describe - application that are installed on OS level rpm, exe, msi... - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="platformUnit" type="uapp:platformType"> - <xs:annotation> - <xs:documentation>Not used for the moment. Intended to describe - units that are OS independent like POJO java apps - </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="containerUnit"> - <xs:complexType> - <xs:choice> - <xs:element name="karaf"> - <xs:complexType> - <xs:sequence> - <xs:element name="embedding" type="uapp:embeddingType" /> - <xs:element ref="krf:features" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="android"> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string" /> - <xs:element minOccurs="0" name="description" type="xs:string" /> - <xs:element maxOccurs="unbounded" name="location" - type="xs:anyURI" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tomcat" /> - <xs:element name="equinox" /> - <xs:element name="felix" /> - <xs:element name="osgi-android" /> - </xs:choice> - </xs:complexType> - </xs:element> - </xs:choice> - <xs:attribute name="id" type="xs:ID" /> - </xs:complexType> - </xs:element> - */ - String id; - OS osType; - Platform platformType; + private String id; + private OS osType; + private Platform platformType; public DeploymentUnit(String id, OS osType, Platform platformType){ @@ -86,30 +35,30 @@ public class DeploymentUnit { public class ContainerUnit { - Container container; + private Container container; - Embedding embedding; - FeaturesRoot features; + private Embedding embedding; + private FeaturesRoot features; - String description; - URI location; + private String description; + private URI location; public ContainerUnit(Embedding embedding, FeaturesRoot features){ - container = Container.KARAF; + this.container = Container.KARAF; this.embedding = embedding; this.features = features; - description = null; - location = null; + this.description = null; + this.location = null; } public ContainerUnit(String description, URI location){ - container = Container.ANDROID; + this.container = Container.ANDROID; this.description = description; this.location = location; - embedding = null; - features = null; + this.embedding = null; + this.features = null; } public Container getContainer() { @@ -141,4 +90,56 @@ public class DeploymentUnit { TOMCAT, EQUINOX, FELIX, OSGI_ANDROID, KARAF, ANDROID } + + /* + * <xs:element name="deploymentUnit"> + <xs:complexType> + <xs:choice> + <xs:element name="osUnit" type="uapp:osType"> + <xs:annotation> + <xs:documentation>Not used for the moment. Intended to describe + application that are installed on OS level rpm, exe, msi... + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="platformUnit" type="uapp:platformType"> + <xs:annotation> + <xs:documentation>Not used for the moment. Intended to describe + units that are OS independent like POJO java apps + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="containerUnit"> + <xs:complexType> + <xs:choice> + <xs:element name="karaf"> + <xs:complexType> + <xs:sequence> + <xs:element name="embedding" type="uapp:embeddingType" /> + <xs:element ref="krf:features" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="android"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" /> + <xs:element minOccurs="0" name="description" type="xs:string" /> + <xs:element maxOccurs="unbounded" name="location" + type="xs:anyURI" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="tomcat" /> + <xs:element name="equinox" /> + <xs:element name="felix" /> + <xs:element name="osgi-android" /> + </xs:choice> + </xs:complexType> + </xs:element> + </xs:choice> + <xs:attribute name="id" type="xs:ID" /> + </xs:complexType> + </xs:element> + */ } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ExecutionUnit.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ExecutionUnit.java index ff4d71a3116e4f2ad765d524fdf664295f7d2b14..66a4446e8832ffb52babeb94f0342570f101c762 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ExecutionUnit.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/ExecutionUnit.java @@ -4,23 +4,11 @@ import java.io.File; public class ExecutionUnit { - /* - * <xs:element name="executionUnit"> - <xs:complexType> - <xs:sequence> - <!-- <xs:element name="deploymentUnit" type="xs:IDREF"/> --> - <xs:element name="configFiles" /> - <xs:element name="spaceStartLevel" minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - */ - - File configFile; - int spaceStartLevel = 0; + private File configFile; + private int spaceStartLevel = 0; public ExecutionUnit(){ - configFile = new File(MultipartApplication.defaultFile); + configFile = new File(Application.defaultFile); } public File getConfigFile() { @@ -35,4 +23,16 @@ public class ExecutionUnit { public void setSpaceStartLevel(int spaceStartLevel) { this.spaceStartLevel = spaceStartLevel; } + + /* + * <xs:element name="executionUnit"> + <xs:complexType> + <xs:sequence> + <!-- <xs:element name="deploymentUnit" type="xs:IDREF"/> --> + <xs:element name="configFiles" /> + <xs:element name="spaceStartLevel" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + */ } diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/License.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/License.java index 5c4d2f20ef65ff196732b797a6dc4b2e6331f338..a32e70b7285ce0d187ea6f62b12dc456488995d5 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/License.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/License.java @@ -23,9 +23,9 @@ public class License { URI link; public License(){ - name = MultipartApplication.defaultString; + name = Application.defaultString; try { - link= new URI(MultipartApplication.defaultURL); + link= new URI(Application.defaultURL); } catch (URISyntaxException e) { } category = LicenseCategory.APPLICATION; diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MPA.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MPA.java new file mode 100644 index 0000000000000000000000000000000000000000..bd67d46c823bf1d5dc0be5faa127164d54ff38a1 --- /dev/null +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MPA.java @@ -0,0 +1,15 @@ +package org.universaal.tools.packaging.tool.parts; + +import java.util.ArrayList; +import java.util.List; + +public class MPA { + + private List<Application> applications; + + public List<Application> getApplications() { + if(applications == null) + applications = new ArrayList<Application>(); + return applications; + } +} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MultipartApplication.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MultipartApplication.java deleted file mode 100644 index 2252c7c65dbbbaa75622e54c981f01378a67353b..0000000000000000000000000000000000000000 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/MultipartApplication.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.universaal.tools.packaging.tool.parts; - -import java.util.ArrayList; -import java.util.List; - -public class MultipartApplication { - - public static final String defaultURL = "http://www.webpage.com"; - public static final String defaultString = "asdf"; - public static final String defaultFile = "c:\file.txt"; - - private Application application; - private ApplicationCapabilities capabilities; - private ApplicationRequirements requirements; - private ApplicationManagement management; - private List<Part> parts; - - public MultipartApplication(){ - this.application = new Application(); - this.capabilities = new ApplicationCapabilities(); - this.requirements = new ApplicationRequirements(); - this.management = new ApplicationManagement(); - } - - public Application getApplication() { - return application; - } - public void setApplication(Application app) { - this.application = app; - } - public ApplicationCapabilities getCapabilities() { - return capabilities; - } - public void setCapabilities(ApplicationCapabilities capabilities) { - this.capabilities = capabilities; - } - public ApplicationRequirements getRequirements() { - return requirements; - } - public void setRequirements(ApplicationRequirements requirements) { - this.requirements = requirements; - } - public ApplicationManagement getManagement() { - return management; - } - public void setManagement(ApplicationManagement management) { - this.management = management; - } - public List<Part> getParts() { - if(parts == null) - parts = new ArrayList<Part>(); - return parts; - } -} \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Part.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Part.java index 09ee9e5e5d929b1d09217d06512a548f0182563c..59e2ad48b044ffe63b3421b9deabd244c9e87478 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Part.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Part.java @@ -7,6 +7,42 @@ import java.util.List; public class Part { + private String id; + private List<Capability> partCapabilities; + private List<Requirement> partRequirements; + private List<DeploymentUnit> deploymentUnits; + private List<ExecutionUnit> executionUnits; + + public Part(String id){ + SecureRandom random = new SecureRandom(); + + this.id = id+"_"+new BigInteger(130, random).toString(32);; + } + + public String getId() { + return id; + } + public List<Capability> getPartCapabilities() { + if(partCapabilities == null) + partCapabilities = new ArrayList<Capability>(); + return partCapabilities; + } + public List<Requirement> getPartRequirements() { + if(partRequirements == null) + partRequirements = new ArrayList<Requirement>(); + return partRequirements; + } + public List<DeploymentUnit> getDeploymentUnits() { + if(deploymentUnits == null) + deploymentUnits = new ArrayList<DeploymentUnit>(); + return deploymentUnits; + } + public List<ExecutionUnit> getExecutionUnits() { + if(executionUnits == null) + executionUnits = new ArrayList<ExecutionUnit>(); + return executionUnits; + } + /* * <xs:element name="part"> <xs:complexType> @@ -43,40 +79,4 @@ public class Part { </xs:complexType> </xs:element> */ - - String id; - List<Capability> partCapabilities; - List<Requirement> partRequirements; - List<DeploymentUnit> deploymentUnits; - List<ExecutionUnit> executionUnits; - - public Part(String id){ - SecureRandom random = new SecureRandom(); - - this.id = id+"_"+new BigInteger(130, random).toString(32);; - } - - public String getId() { - return id; - } - public List<Capability> getPartCapabilities() { - if(partCapabilities == null) - partCapabilities = new ArrayList<Capability>(); - return partCapabilities; - } - public List<Requirement> getPartRequirements() { - if(partRequirements == null) - partRequirements = new ArrayList<Requirement>(); - return partRequirements; - } - public List<DeploymentUnit> getDeploymentUnits() { - if(deploymentUnits == null) - deploymentUnits = new ArrayList<DeploymentUnit>(); - return deploymentUnits; - } - public List<ExecutionUnit> getExecutionUnits() { - if(executionUnits == null) - executionUnits = new ArrayList<ExecutionUnit>(); - return executionUnits; - } } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Requirement.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Requirement.java index 209a95583e1244b4b5d4aa739abeccf009e46684..3a5f7028bbcd207490dbc32ffe9a984c1803c6ed 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Requirement.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Requirement.java @@ -2,21 +2,6 @@ package org.universaal.tools.packaging.tool.parts; public class Requirement { - /* - * <xs:complexType name="reqType"> - <xs:annotation> - <xs:documentation>describes single offering, mostly used for devices - and platforms</xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:choice> - <xs:element name="reqAtom" type="uapp:reqAtomType" /> - <xs:element name="reqGroup" type="uapp:reqGroupType" /> - </xs:choice> - <xs:element minOccurs="0" name="optional" type="xs:boolean" /> - </xs:sequence> - </xs:complexType> - */ private SingleRequirement singleRequirement; private RequirementsGroup requirementGroup; private boolean singleReq; @@ -55,4 +40,20 @@ public class Requirement { public boolean isSingleReq() { return singleReq; } + + /* + * <xs:complexType name="reqType"> + <xs:annotation> + <xs:documentation>describes single offering, mostly used for devices + and platforms</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:choice> + <xs:element name="reqAtom" type="uapp:reqAtomType" /> + <xs:element name="reqGroup" type="uapp:reqGroupType" /> + </xs:choice> + <xs:element minOccurs="0" name="optional" type="xs:boolean" /> + </xs:sequence> + </xs:complexType> + */ } \ No newline at end of file diff --git a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Version.java b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Version.java index 18b2d7bb4eef04193b9f23a5a527f00573c7d4e7..4b5d804f9bd345a8fef5f1abcd27de13948eb6b8 100644 --- a/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Version.java +++ b/mpa/org.universaal.tools.packaging.tool/src/org/universaal/tools/packaging/tool/parts/Version.java @@ -14,13 +14,13 @@ public class Version { * */ - String major, minor, micro, build; + private String major, minor, micro, build; public Version(){ - major = MultipartApplication.defaultString; - minor = MultipartApplication.defaultString; - micro = MultipartApplication.defaultString; - build = MultipartApplication.defaultString; + major = "major"; + minor = "minor"; + micro = "micro"; + build = "build"; } public String getMajor() { @@ -54,4 +54,27 @@ public class Version { public void setBuild(String build) { this.build = build; } + + public String getVersion(){ + return major+"."+minor+"."+micro+"."+build; + } + + public void setVersion(String v){ + + try{ + if(v != null && !v.isEmpty()){ + String[] vs = v.split("."); + if(vs.length > 0){ + major = vs[0]; + if(vs[1] != null) + minor = vs[1]; + if(vs[2] != null) + micro = vs[2]; + if(vs[3] != null) + build = vs[3]; + } + } + } + catch(Exception ex){} + } } \ No newline at end of file