JBoss Tools SVN: r26012 - trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-22 17:40:19 -0400 (Fri, 22 Oct 2010)
New Revision: 26012
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/InstanceMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/MockIntegrationTestSetup.java
Log:
[JBIDE-7401] fixed start/stop-instance by changing to POST request [JBIDE-7371] added tests
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/InstanceMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/InstanceMockIntegrationTest.java 2010-10-22 21:30:49 UTC (rev 26011)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/InstanceMockIntegrationTest.java 2010-10-22 21:40:19 UTC (rev 26012)
@@ -29,7 +29,12 @@
import org.junit.Test;
/**
- * Integration tests for instances.
+ * Integration tests for instance related methods in {@link DeltaCloudClient}.
+ *
+ * @see DeltaCloudClient#listInstances()
+ * @see DeltaCloudClient#createInstance(String)
+ * @see DeltaCloudClient#destroyInstance(String)
+ * @see DeltaCloudClient#startInstance(String)
*/
public class InstanceMockIntegrationTest {
@@ -54,9 +59,11 @@
*/
@Test
public void listContainsTestInstance() throws DeltaCloudClientException {
- List<Instance> instances = testSetup.getClient().listInstances();
+ DeltaCloudClient client = testSetup.getClient();
+ List<Instance> instances = client.listInstances();
assertTrue(instances.size() > 0);
- assertNotNull(testSetup.getInstanceById(testSetup.getTestInstance().getId(), testSetup.getClient()));
+ Instance testInstance = testSetup.getTestInstance();
+ assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
}
@Test
@@ -72,16 +79,11 @@
, testInstance.getRealmId()
, testInstance.getProfileId()
, testInstance.getMemory()
+ , testInstance.getPrivateAddresses()
+ , testInstance.getPublicAddresses()
, instance);
}
- @Test
- public void listInstanceFromWebUI() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getClient().listInstances("inst0");
- assertInstance("Mock Instance With Profile Change", "mockuser", "img1", "us", "m1-large", "12288 MB",
- testInstance);
- }
-
@Test(expected = DeltaCloudClientException.class)
public void listDestroyedInstanceThrowsException() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
@@ -90,18 +92,21 @@
}
private void assertInstance(String name, String owner, String ImageId, String realmId, String profile,
- String memory, Instance instance) {
+ String memory, List<String> privateAddresses, List<String> publicAddresses, Instance instance) {
assertNotNull(instance);
assertEquals(name, instance.getName());
assertEquals(owner, instance.getOwnerId());
assertEquals(realmId, instance.getRealmId());
assertEquals(profile, instance.getProfileId());
assertEquals(memory, instance.getMemory());
+ assertTrue(privateAddresses.equals(instance.getPrivateAddresses()));
+ assertTrue(publicAddresses.equals(instance.getPublicAddresses()));
}
-
+
@Test(expected = DeltaCloudClientException.class)
public void cannotDestroyIfNotAuthenticated() throws MalformedURLException, DeltaCloudClientException {
- DeltaCloudClient unauthenticatedClient = new DeltaCloudClient(MockIntegrationTestSetup.DELTACLOUD_URL, "badUser", "badPassword");
+ DeltaCloudClient unauthenticatedClient = new DeltaCloudClient(MockIntegrationTestSetup.DELTACLOUD_URL,
+ "badUser", "badPassword");
Image image = testSetup.getFirstImage(unauthenticatedClient);
unauthenticatedClient.createInstance(image.getId());
}
@@ -121,10 +126,10 @@
}
@Test(expected = DeltaCloudClientException.class)
- public void createInstance_DeltaCloudExceptionOnUnknowsImageId() throws DeltaCloudClientException {
+ public void cannotDestroyUnknownImageId() throws DeltaCloudClientException {
testSetup.getClient().createInstance("dummy");
}
-
+
@Test
public void canDestroy() throws DeltaCloudClientException {
Image image = testSetup.getFirstImage(testSetup.getClient());
@@ -133,8 +138,29 @@
assertNull(testSetup.getInstanceById(instance.getId(), testSetup.getClient()));
}
- @Test(expected=DeltaCloudClientException.class)
+ @Test(expected = DeltaCloudClientException.class)
public void destroyThrowExceptionOnUnknowInstanceId() throws DeltaCloudClientException {
testSetup.getClient().destroyInstance("dummy");
}
+
+ @Test
+ public void canShutdownInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ client.shutdownInstance(testInstance.getId());
+ testInstance = client.listInstances(testInstance.getId()); // reload!
+ assertEquals(State.STOPPED, testInstance.getState());
+ }
+
+ @Test
+ public void canStartInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ if (testInstance.getState() == State.RUNNING) {
+ client.shutdownInstance(testInstance.getId());
+ }
+ client.startInstance(testInstance.getId());
+ testInstance = client.listInstances(testInstance.getId());
+ assertEquals(State.RUNNING, testInstance.getState());
+ }
}
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/MockIntegrationTestSetup.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/MockIntegrationTestSetup.java 2010-10-22 21:30:49 UTC (rev 26011)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/MockIntegrationTestSetup.java 2010-10-22 21:40:19 UTC (rev 26012)
@@ -39,8 +39,13 @@
ensureDeltaCloudIsRunning();
this.client = new DeltaCloudClient(DELTACLOUD_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD);
Image image = getFirstImage(client);
+ this.testInstance = createTestInstance(image);
+ }
+
+ private Instance createTestInstance(Image image) throws DeltaCloudClientException {
assertNotNull(image);
- this.testInstance = client.createInstance(image.getId());
+ Instance instance = client.createInstance(image.getId());
+ return instance;
}
public void ensureDeltaCloudIsRunning() throws IOException {
14 years, 2 months
JBoss Tools SVN: r26011 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core/client and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-22 17:30:49 -0400 (Fri, 22 Oct 2010)
New Revision: 26011
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
Log:
[JBIDE-7401] fixed by changing to POST request
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-22 21:09:02 UTC (rev 26010)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-22 21:30:49 UTC (rev 26011)
@@ -1,3 +1,9 @@
+2010-10-22 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
+ (shutdownInstance): [JBIDE-7401] changed to POST (api break in dc 0.0.8)
+ (startInstance): [JBIDE-7401] changed to POST (api break in dc 0.0.8)
+
2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (listProfile): Fix to
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 21:09:02 UTC (rev 26010)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 21:30:49 UTC (rev 26011)
@@ -362,17 +362,26 @@
@Override
public void rebootInstance(String instanceId) throws DeltaCloudClientException {
+ /**
+ * shouldn't that be PUT? changing resource states == PUT!
+ */
sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.REBOOT, RequestType.GET);
}
@Override
public void shutdownInstance(String instanceId) throws DeltaCloudClientException {
- sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.STOP, RequestType.GET);
+ /**
+ * shouldn't that be PUT? changing resource states == PUT!
+ */
+ sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.STOP, RequestType.POST);
}
@Override
public void startInstance(String instanceId) throws DeltaCloudClientException {
- sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.START, RequestType.GET);
+ /**
+ * shouldn't that be PUT? changing resource states == PUT!
+ */
+ sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.START, RequestType.POST);
}
@Override
14 years, 2 months
JBoss Tools SVN: r26010 - trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-10-22 17:09:02 -0400 (Fri, 22 Oct 2010)
New Revision: 26010
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/pom.xml
Log:
force modeshape-client.jar to be pulled from remote location (JBDS-1343)
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
===================================================================
(Binary files differ)
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/pom.xml
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/pom.xml 2010-10-22 20:34:35 UTC (rev 26009)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/pom.xml 2010-10-22 21:09:02 UTC (rev 26010)
@@ -1,13 +1,50 @@
<project
-xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.jboss.tools</groupId>
- <artifactId>org.jboss.tools.parent.pom</artifactId>
- <version>0.0.1-SNAPSHOT</version>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.jboss.tools.modeshape.plugins</groupId>
- <artifactId>org.jboss.tools.modeshape.rest</artifactId>
+ <artifactId>org.jboss.tools.modeshape.rest</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <configuration>
+ <tasks>
+ <delete file="modeshape-client.jar" quiet="true" />
+ <get
+ src="http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER3/JBDS/modeshape-..."
+ dest="modeshape-client.jar" usetimestamp="true" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-commons-net</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
14 years, 2 months
JBoss Tools SVN: r26009 - trunk/requirements/soap.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-10-22 16:34:35 -0400 (Fri, 22 Oct 2010)
New Revision: 26009
Modified:
trunk/requirements/soap/build.properties
trunk/requirements/soap/buildRequirement.xml
Log:
https://jira.jboss.org/browse/JBDS-1374 add SOA-P 5.1 ER3 to JBT requirements
Modified: trunk/requirements/soap/build.properties
===================================================================
--- trunk/requirements/soap/build.properties 2010-10-22 19:39:26 UTC (rev 26008)
+++ trunk/requirements/soap/build.properties 2010-10-22 20:34:35 UTC (rev 26009)
@@ -4,11 +4,15 @@
soap43.build.archive.md5=9d19284caf81b96d93c21148477df2fd
soap43.build.archive.root=jboss-soa-p.4.3.0
-#soap50.build.uri=http://download.devel.redhat.com/released/JBossSOAP/5.0/5.0.0/GA
soap50.build.uri=http://download.devel.redhat.com/released/JBossSOAP/5.0/...
-#soap50.build.name=soa-5.0.0.GA
soap50.build.name=soa-5.0.1.GA-signed
soap50.build.archive=${soap50.build.name}.zip
-#soap50.build.archive.md5=b1a1f60384f5d4c07e4495f7fbf2096d
soap50.build.archive.md5=b9088f7884c7464419623c596dafe25f
soap50.build.archive.root=jboss-soa-p.5.0.0
+
+# JBDS-1374 add SOA-P 5.1 - http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER3/signed/soa-5.1....
+soap51.build.uri=http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER3/signed/
+soap51.build.name=soa-5.1.0.ER3
+soap51.build.archive=${soap50.build.name}.zip
+soap51.build.archive.md5=1761514994009e359efcf080758c711d
+soap51.build.archive.root=jboss-soa-p.5.1.0
Modified: trunk/requirements/soap/buildRequirement.xml
===================================================================
--- trunk/requirements/soap/buildRequirement.xml 2010-10-22 19:39:26 UTC (rev 26008)
+++ trunk/requirements/soap/buildRequirement.xml 2010-10-22 20:34:35 UTC (rev 26009)
@@ -23,6 +23,11 @@
<param name="build.archive" value="${soap50.build.archive}"/>
<param name="md5" value="${soap50.build.archive.md5}" />
</antcall>
+ <antcall target="build.soap">
+ <param name="build.uri" value="${soap51.build.uri}"/>
+ <param name="build.archive" value="${soap51.build.archive}"/>
+ <param name="md5" value="${soap51.build.archive.md5}" />
+ </antcall>
</target>
</project>
14 years, 2 months
JBoss Tools SVN: r26008 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjohnstn
Date: 2010-10-22 15:39:26 -0400 (Fri, 22 Oct 2010)
New Revision: 26008
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java: New file.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java: New file.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java: New file.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java: New file.
* plugin.xml: Add menu item for launching an instance when the selected item(s) are not
images that will require entry of the image id.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
messages for NewInstance2 wizard.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-22 19:35:39 UTC (rev 26007)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-22 19:39:26 UTC (rev 26008)
@@ -1,3 +1,14 @@
+2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java: New file.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java: New file.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java: New file.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java: New file.
+ * plugin.xml: Add menu item for launching an instance when the selected item(s) are not
+ images that will require entry of the image id.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
+ messages for NewInstance2 wizard.
+
2010-10-20 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/UrlToCloudTypeConverter.java:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-22 19:35:39 UTC (rev 26007)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-22 19:39:26 UTC (rev 26008)
@@ -208,6 +208,20 @@
</with>
</activeWhen>
</handler>
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceHandler2"
+ commandId="org.jboss.tools.deltacloud.ui.createinstance2">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
<!-- image command handlers -->
<handler
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceHandler"
@@ -406,6 +420,36 @@
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.jboss.tools.deltacloud.ui.views.DeltaCloudView?after=images">
+ <!-- image commands -->
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.createinstance2"
+ icon="icons/instance.gif"
+ label="%command.createinstance.label"
+ style="push"
+ tooltip="%command.createinstance.tooltip">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <and>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </instanceof>
+ <not>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+ </instanceof>
+ </not>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
<menuContribution
allPopups="true"
locationURI="popup:org.jboss.tools.deltacloud.ui.views.DeltaCloudView?after=filters">
@@ -565,6 +609,24 @@
</with>
</visibleWhen>
</command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.createinstance2"
+ icon="icons/instance.gif"
+ label="%command.createinstance.label"
+ style="push"
+ tooltip="%command.createinstance.tooltip">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
<command
commandId="org.jboss.tools.deltacloud.ui.filterimages"
label="%command.filterimages.label"
@@ -614,6 +676,11 @@
id="org.jboss.tools.deltacloud.ui.editconnection"
name="%command.editconnection.name">
</command>
+ <command
+ description="%command.createinstance.description"
+ id="org.jboss.tools.deltacloud.ui.createinstance2"
+ name="%command.createinstance.name">
+ </command>
<!-- image commands -->
<command
description="%command.createinstance.description"
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-10-22 19:39:26 UTC (rev 26008)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance2;
+
+/**
+ * @author Jeff Johnston
+ */
+public class CreateInstanceHandler2 extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CloudViewElement element = UIUtils.getFirstElement(selection, CloudViewElement.class);
+ while (element != null && !(element instanceof CVCloudElement)) {
+ element = (CloudViewElement) element.getParent();
+ }
+ if (element != null) {
+ CVCloudElement cloudElement = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ IWizard wizard = new NewInstance2(cloud);
+ WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(),
+ wizard);
+ dialog.create();
+ dialog.open();
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java 2010-10-22 19:39:26 UTC (rev 26008)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.rse.core.IRSECoreRegistry;
+import org.eclipse.rse.core.IRSESystemType;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.osgi.service.prefs.Preferences;
+
+public class NewInstance2 extends Wizard {
+
+ private final static String CREATE_INSTANCE_FAILURE_TITLE = "CreateInstanceError.title"; //$NON-NLS-1$
+ private final static String CREATE_INSTANCE_FAILURE_MSG = "CreateInstanceError.msg"; //$NON-NLS-1$
+ private final static String DEFAULT_REASON = "CreateInstanceErrorReason.msg"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_TITLE = "ConfirmCreate.title"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_MSG = "ConfirmCreate.msg"; //$NON-NLS-1$
+ private final static String DONT_SHOW_THIS_AGAIN_MSG = "DontShowThisAgain.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_TITLE = "StartingInstance.title"; //$NON-NLS-1$
+ private final static String RSE_CONNECTING_MSG = "ConnectingRSE.msg"; //$NON-NLS-1$
+
+
+ private NewInstancePage2 mainPage;
+
+ private DeltaCloud cloud;
+ private DeltaCloudInstance instance;
+
+ public NewInstance2(DeltaCloud cloud) {
+ this.cloud = cloud;
+ }
+
+ @Override
+ public void addPages() {
+ // TODO Auto-generated method stub
+ mainPage = new NewInstancePage2(cloud);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+
+ private class WatchCreateJob extends Job {
+
+ private DeltaCloud cloud;
+ private String instanceId;
+ private String instanceName;
+
+ public WatchCreateJob(String title, DeltaCloud cloud,
+ String instanceId, String instanceName) {
+ super(title);
+ this.cloud = cloud;
+ this.instanceId = instanceId;
+ this.instanceName = instanceName;
+ }
+
+ public IStatus run(IProgressMonitor pm) {
+ if (!pm.isCanceled()){
+ DeltaCloudInstance instance = null;
+ try {
+ pm.beginTask(WizardMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {instanceName}), IProgressMonitor.UNKNOWN);
+ pm.worked(1);
+ cloud.registerActionJob(instanceId, this);
+ boolean finished = false;
+ while (!finished && !pm.isCanceled()) {
+ instance = cloud.refreshInstance(instanceId);
+ if (instance != null && !instance.getState().equals(DeltaCloudInstance.PENDING))
+ break;
+ Thread.sleep(400);
+ }
+
+ } catch (Exception e) {
+ // do nothing
+ } finally {
+ cloud.addReplaceInstance(instance);
+ cloud.removeActionJob(instanceId, this);
+ String hostname = instance.getHostName();
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ boolean autoConnect = prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
+ if (hostname != null && hostname.length() > 0 && autoConnect) {
+ ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+ RSECorePlugin rsep = RSECorePlugin.getDefault();
+ IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
+ IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
+ IRSESystemType sshType = null;
+ for (IRSESystemType sysType : sysTypes) {
+ if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
+ sshType = sysType;
+ }
+ String connectionName = instance.getName() + " [" + instance.getId() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ IHost host = registry.createHost(sshType, connectionName, hostname, null);
+ if (host != null) {
+ host.setDefaultUserId("root"); //$NON-NLS-1$
+ IConnectorService[] services = host.getConnectorServices();
+ if (services.length > 0) {
+ final IConnectorService service = services[0];
+ Job connect = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG, connectionName)) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ service.connect(monitor);
+ return Status.OK_STATUS;
+ } catch(Exception e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ };
+ connect.setUser(true);
+ connect.schedule();
+ }
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ pm.done();
+ }
+ return Status.OK_STATUS;
+ }
+ else {
+ pm.done();
+ return Status.CANCEL_STATUS;
+ }
+ };
+ };
+
+ @Override
+ public boolean performFinish() {
+ String imageId = mainPage.getImageId();
+ String profileId = mainPage.getHardwareProfile();
+ String realmId = mainPage.getRealmId();
+ String memory = mainPage.getMemoryProperty();
+ String storage = mainPage.getStorageProperty();
+ String keyname = mainPage.getKeyName();
+ String name = null;
+
+ // Save persistent settings for this particular cloud
+ cloud.setLastImageId(imageId);
+ cloud.setLastKeyname(keyname);
+ cloud.save();
+
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+
+ try {
+ name = URLEncoder.encode(mainPage.getInstanceName(), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } //$NON-NLS-1$
+
+ boolean result = false;
+ String errorMessage = WizardMessages.getString(DEFAULT_REASON);
+ try {
+ boolean dontShowDialog = prefs.getBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, false);
+ if (!dontShowDialog) {
+ MessageDialogWithToggle dialog =
+ MessageDialogWithToggle.openOkCancelConfirm(getShell(), WizardMessages.getString(CONFIRM_CREATE_TITLE),
+ WizardMessages.getString(CONFIRM_CREATE_MSG),
+ WizardMessages.getString(DONT_SHOW_THIS_AGAIN_MSG),
+ false, null, null);
+ int retCode = dialog.getReturnCode();
+ boolean toggleState = dialog.getToggleState();
+ if (retCode == Dialog.CANCEL)
+ return true;
+ // If warning turned off by user, set the preference for future usage
+ if (toggleState) {
+ prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, true);
+ }
+ }
+ instance = cloud.createInstance(name, imageId, realmId, profileId, keyname, memory, storage);
+ if (instance != null)
+ result = true;
+ if (instance != null && instance.getState().equals(DeltaCloudInstance.PENDING)) {
+ final String instanceId = instance.getId();
+ final String instanceName = name;
+ Job job = new WatchCreateJob(WizardMessages.getString(STARTING_INSTANCE_TITLE),
+ cloud, instanceId, instanceName);
+ job.setUser(true);
+ job.schedule();
+ }
+ } catch (DeltaCloudException e) {
+ errorMessage = e.getLocalizedMessage();
+ }
+ if (!result) {
+ ErrorDialog.openError(this.getShell(),
+ WizardMessages.getString(CREATE_INSTANCE_FAILURE_TITLE),
+ WizardMessages.getFormattedString(CREATE_INSTANCE_FAILURE_MSG, new String[] {name, imageId, realmId, profileId}),
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, errorMessage));
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-10-22 19:39:26 UTC (rev 26008)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.ObservablePojo;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class NewInstanceModel extends ObservablePojo {
+
+ public static final String PROPERTY_URL = "url"; //$NON-NLS-1$
+ public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
+ public static final String PROPERTY_IMAGE_ID = "imageId"; //$NON-NLS-1$
+ public static final String PROPERTY_ARCH = "arch"; //$NON-NLS-1$
+ public static final String PROPERTY_REALM = "realm"; //$NON-NLS-1$
+ public static final String PROPERTY_KEYNAME = "keyname"; //$NON-NLS-1$
+ public static final String PROPERTY_PROFILE = "profile"; //$NON-NLS-1$
+
+ private static final String IMAGE_ID_NOT_FOUND = "ErrorImageIdNotFound.text"; //$NON-NLS-1$
+
+ private String name;
+ private String imageId;
+ private String arch;
+ private String realm;
+ private String keyname;
+ private String profile;
+
+ public static class ImageContainer {
+ private DeltaCloudImage image;
+
+ public DeltaCloudImage getImage() {
+ return image;
+ }
+
+ public void setImage(DeltaCloudImage image) {
+ this.image = image;
+ }
+ }
+
+ public static class ArchConverter extends Converter {
+
+ private DeltaCloud cloud;
+ private ImageContainer imageContainer;
+
+ public ArchConverter(DeltaCloud cloud, ImageContainer imageContainer,
+ Object fromType, Object toType) {
+ super(fromType, toType);
+ this.cloud = cloud;
+ this.imageContainer = imageContainer;
+ }
+
+ @Override
+ public Object convert(final Object fromObject) {
+ return getArch((String) fromObject);
+ }
+
+ private String getArch(String id) {
+ String arch = "";
+ if (id != null && id.length() > 0) {
+ DeltaCloudImage[] images = cloud.getCurrImages();
+ for (int i = 0; i < images.length; ++i) {
+ DeltaCloudImage image = images[i];
+ if (image.getId().equals(id)) {
+ imageContainer.setImage(image);
+ arch = image.getArchitecture();
+ break;
+ }
+ }
+ }
+ return arch;
+ }
+
+ }
+
+ public static class ArchValidator implements IValidator {
+
+ @Override
+ public IStatus validate(Object value) {
+ Assert.isTrue(value instanceof String);
+ if (value != null && ((String)value).length() > 0) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.error(WizardMessages.getString(IMAGE_ID_NOT_FOUND));
+ }
+ }
+ }
+
+
+ public NewInstanceModel(String name, String imageId, String arch, String realm,
+ String keyname, String profile) {
+ this.name = name;
+ this.imageId = imageId;
+ this.realm = realm;
+ this.keyname = keyname;
+ this.profile = profile;
+ this.arch = arch;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_NAME, this.name, this.name = name);
+ }
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ public void setImageId(String imageId) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_IMAGE_ID, this.imageId, this.imageId = imageId);
+ }
+
+ public String getRealm() {
+ return realm;
+ }
+
+ public void setRealm(String realm) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_REALM, this.realm, this.realm = realm);
+ }
+
+ public String getKeyname() {
+ return keyname;
+ }
+
+ public void setKeyname(String keyname) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_KEYNAME, this.keyname, this.keyname = keyname);
+ }
+
+ public String getArch() {
+ return arch;
+ }
+
+ public void setArch(String arch) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_ARCH, this.arch, this.arch = arch);
+ }
+
+ public String getProfile() {
+ return profile;
+ }
+
+ public void setProfile(String profile) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_PROFILE, this.profile, this.profile = profile);
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java 2010-10-22 19:39:26 UTC (rev 26008)
@@ -0,0 +1,507 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.wizard.WizardPageSupport;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
+
+public class NewInstancePage2 extends WizardPage {
+
+ private static final int IMAGE_CHECK_DELAY = 500;
+
+ private final static String NAME = "NewInstance.name"; //$NON-NLS-1$
+ private final static String DESCRIPTION = "NewInstance.desc"; //$NON-NLS-1$
+ private final static String TITLE = "NewInstance.title"; //$NON-NLS-1$
+
+ private static final String NAME_LABEL = "Name.label"; //$NON-NLS-1$
+ private static final String IMAGE_LABEL = "Image.label"; //$NON-NLS-1$
+ private static final String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
+ private static final String HARDWARE_LABEL = "Profile.label"; //$NON-NLS-1$
+ private static final String REALM_LABEL = "Realm.label"; //$NON-NLS-1$
+ private static final String KEY_LABEL = "Key.label"; //$NON-NLS-1$
+ private static final String MANAGE_BUTTON_LABEL = "ManageButton.label"; //$NON-NLS-1$
+ private static final String PROPERTIES_LABEL = "Properties.label"; //$NON-NLS-1$
+ private static final String MUST_ENTER_A_NAME = "ErrorMustProvideName.text"; //$NON-NLS-1$
+ private static final String MUST_ENTER_A_KEYNAME = "ErrorMustProvideKeyName.text"; //$NON-NLS-1$
+ private static final String MUST_ENTER_IMAGE_ID = "ErrorMustProvideImageId.text"; //$NON-NLS-1$
+ private static final String NONE_RESPONSE = "None.response"; //$NON-NLS-1$
+
+ private NewInstanceModel model;
+
+ private DeltaCloud cloud;
+ private DeltaCloudImage image;
+ private Label arch;
+ private Text nameText;
+ private Text imageText;
+ private Text keyText;
+ private Combo hardware;
+ private Button keyManage;
+ private Control realm;
+ private ProfileComposite currPage;
+ private Map<String, ProfileComposite> profilePages;
+ private ArrayList<String> realmIds;
+ private DeltaCloudHardwareProfile[] allProfiles;
+
+ private ModifyListener comboListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ String id = hardware.getItem(hardware.getSelectionIndex());
+ currPage.setVisible(false);
+ currPage = profilePages.get(id);
+ currPage.setVisible(true);
+ }
+ };
+
+ private SelectionListener manageListener = new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ Shell shell = getShell();
+ ManageKeys wizard = new ManageKeys(cloud, ".pem"); //$NON-NLS-1$
+ WizardDialog dialog = new CustomWizardDialog(shell, wizard,
+ IDialogConstants.OK_LABEL);
+ dialog.create();
+ dialog.open();
+ String keyname = wizard.getKeyName();
+ if (keyname != null)
+ keyText.setText(keyname);
+ }
+
+ };
+
+ public NewInstancePage2(DeltaCloud cloud) {
+ super(WizardMessages.getString(NAME));
+ this.cloud = cloud;
+ profilePages = new HashMap<String, ProfileComposite>();
+ allProfiles = cloud.getProfiles();
+ String defaultKeyname = cloud.getLastKeyname();
+ model = new NewInstanceModel("", //$NON-NLS-1$
+ "", //$NON-NLS-1$
+ "", //$NON-NLS-1$
+ "", //$NON-NLS-1$
+ defaultKeyname,
+ ""); //$NON-NLS-1$
+ setDescription(WizardMessages.getString(DESCRIPTION));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ public String getHardwareProfile() {
+ return hardware.getText();
+ }
+
+ public String getRealmId() {
+ if (realm instanceof Combo) {
+ int index = ((Combo)realm).getSelectionIndex();
+ return realmIds.get(index);
+ } else {
+ return null;
+ }
+ }
+
+ public String getCpuProperty() {
+ return currPage.getCPU();
+ }
+
+ public String getStorageProperty() {
+ return currPage.getStorage();
+ }
+
+ public String getMemoryProperty() {
+ return currPage.getMemory();
+ }
+
+ public String getInstanceName() {
+ return nameText.getText();
+ }
+
+ public String getKeyName() {
+ return keyText.getText();
+ }
+
+ public String getImageId() {
+ return imageText.getText();
+ }
+
+ public void setImage(DeltaCloudImage image) {
+ this.image = image;
+ }
+
+ public void clearProfiles() {
+ hardware.removeModifyListener(comboListener);
+ hardware.removeAll();
+ currPage.setVisible(false);
+ hardware.setEnabled(false);
+ hardware.addModifyListener(comboListener);
+ }
+
+ public void filterProfiles() {
+ ArrayList<DeltaCloudHardwareProfile> profiles = new ArrayList<DeltaCloudHardwareProfile>();
+ for (DeltaCloudHardwareProfile p : allProfiles) {
+ if (p.getArchitecture() == null || image.getArchitecture().equals(p.getArchitecture())) {
+ profiles.add(p);
+ }
+ }
+ String[] ids = new String[profiles.size()];
+ for (int i = 0; i < profiles.size(); ++i) {
+ DeltaCloudHardwareProfile p = profiles.get(i);
+ ids[i] = p.getId();
+ }
+ if (ids.length > 0) {
+ hardware.removeModifyListener(comboListener);
+ hardware.setItems(ids);
+ hardware.setText(ids[0]);
+ currPage = profilePages.get(ids[0]);
+ currPage.setVisible(true);
+ hardware.setEnabled(true);
+ hardware.addModifyListener(comboListener);
+ }
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ DataBindingContext dbc = new DataBindingContext();
+ WizardPageSupport.create(this, dbc);
+
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label dummyLabel = new Label(container, SWT.NULL);
+
+ Label imageLabel = new Label(container, SWT.NULL);
+ imageLabel.setText(WizardMessages.getString(IMAGE_LABEL));
+
+ Label archLabel = new Label(container, SWT.NULL);
+ archLabel.setText(WizardMessages.getString(ARCH_LABEL));
+
+
+ Label nameLabel = new Label(container, SWT.NULL);
+ nameLabel.setText(WizardMessages.getString(NAME_LABEL));
+
+ Label realmLabel = new Label(container, SWT.NULL);
+ realmLabel.setText(WizardMessages.getString(REALM_LABEL));
+
+
+ nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ bindText(dbc, nameText, NewInstanceModel.PROPERTY_NAME, MUST_ENTER_A_NAME);
+
+ imageText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(IMAGE_CHECK_DELAY, imageText),
+ BeanProperties.value(NewInstanceModel.class, NewInstanceModel.PROPERTY_IMAGE_ID)
+ .observe(model),
+ new UpdateValueStrategy().setAfterGetValidator(new MandatoryStringValidator(
+ WizardMessages.getString(MUST_ENTER_IMAGE_ID))),
+ null);
+
+ arch = new Label(container, SWT.NULL);
+ bindArchLabel(dbc, imageText, arch, this);
+
+ DeltaCloudRealm[] realms = cloud.getRealms();
+ realmIds = new ArrayList<String>();
+ ArrayList<String> realmNames = new ArrayList<String>();
+ for (int i = 0; i < realms.length; ++i) {
+ DeltaCloudRealm r = realms[i];
+ if (r.getState() == null || r.getState().equals(DeltaCloudRealm.AVAILABLE)) {
+ realmNames.add(r.getId() + " [" + r.getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ realmIds.add(r.getId());
+ }
+ }
+ if (realmIds.size() > 0) {
+ Combo combo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ combo.setItems(realmNames.toArray(new String[realmNames.size()]));
+ combo.setText(realmNames.get(0));
+ realm = combo;
+ } else {
+ Label label = new Label(container, SWT.NULL);
+ label.setText(WizardMessages.getString(NONE_RESPONSE));
+ realm = label;
+ }
+ IObservableValue realmObservable = WidgetProperties.text().observe(realm);
+ dbc.bindValue(
+ realmObservable,
+ BeanProperties.value(NewInstanceModel.class, NewInstanceModel.PROPERTY_REALM).observe(
+ model));
+
+
+ Label hardwareLabel = new Label(container, SWT.NULL);
+ hardwareLabel.setText(WizardMessages.getString(HARDWARE_LABEL));
+
+ hardware = new Combo(container, SWT.READ_ONLY);
+ Group groupContainer = new Group(container, SWT.BORDER);
+ groupContainer.setText(WizardMessages.getString(PROPERTIES_LABEL));
+ FormLayout groupLayout = new FormLayout();
+ groupLayout.marginHeight = 0;
+ groupLayout.marginWidth = 0;
+ groupContainer.setLayout(groupLayout);
+ hardware.setEnabled(false);
+ IObservableValue hardwareObservable = WidgetProperties.text().observe(hardware);
+ dbc.bindValue(
+ hardwareObservable,
+ BeanProperties.value(NewInstanceModel.class, NewInstanceModel.PROPERTY_PROFILE).observe(
+ model));
+
+ for (DeltaCloudHardwareProfile p : allProfiles) {
+ ProfileComposite pc = new ProfileComposite(p, groupContainer);
+ profilePages.put(p.getId(), pc);
+ pc.setVisible(false);
+ }
+
+ Point p1 = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ dummyLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ nameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ nameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameText, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ imageLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameText, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ imageText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageLabel, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ archLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageLabel, 8 + centering);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ arch.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(arch, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ realmLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(arch, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ realm.setLayoutData(f);
+
+ Control control = realm;
+
+ Label keyLabel = new Label(container, SWT.NULL);
+ keyLabel.setText(WizardMessages.getString(KEY_LABEL));
+
+ keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ bindText(dbc, keyText, NewInstanceModel.PROPERTY_KEYNAME, MUST_ENTER_A_KEYNAME);
+
+ keyManage = new Button(container, SWT.NULL);
+ keyManage.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
+ keyManage.addSelectionListener(manageListener);
+ if (cloud.getType().equals(DeltaCloudInstance.MOCK_TYPE))
+ keyManage.setEnabled(false);
+ Point p3 = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering2 = (p3.y - p2.y + 1) / 2;
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 8 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ keyLabel.setLayoutData(f);
+
+ f = new FormData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.top = new FormAttachment(realm, 8);
+ f.right = new FormAttachment(realm, 0, SWT.RIGHT);
+ keyManage.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 8 + centering2);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(keyManage, -10);
+ keyText.setLayoutData(f);
+
+ control = keyText;
+
+ f = new FormData();
+ f.top = new FormAttachment(control, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ hardwareLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(control, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ hardware.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(hardware, 10);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(100, 0);
+ groupContainer.setLayoutData(f);
+
+ // We have to set the image id here instead of in the constructor
+ // of the model because the image id triggers other items to fill
+ // in their values such as the architecture and hardware profiles.
+ String defaultImage = cloud.getLastImageId();
+ model.setImageId(defaultImage);
+
+ setControl(container);
+ }
+
+ /**
+ * Displays the arch in the given label if the given binding is valid.
+ *
+ * @param archLabel
+ * the arch label
+ * @return the value change listener
+ */
+ private class ArchAdapter implements IValueChangeListener {
+
+ private Label archLabel;
+ private NewInstanceModel.ImageContainer container;
+ private NewInstancePage2 page;
+
+ public ArchAdapter(Label archLabel,
+ NewInstanceModel.ImageContainer container,
+ NewInstancePage2 page) {
+ this.archLabel = archLabel;
+ this.page = page;
+ this.container = container;
+ }
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ if (status.isOK()) {
+ archLabel.setText(model.getArch());
+ page.setImage(container.getImage());
+ page.filterProfiles();
+ } else {
+ archLabel.setText("");
+ page.clearProfiles();
+ }
+ }
+ }
+
+ /**
+ * Binds the architecture label to the given image id text widget. Attaches a
+ * listener to the image id text widget Adds a validity decorator to the image text
+ * widget.
+ *
+ * @param dbc
+ * the databinding context to use
+ * @param imageText
+ * the image id text widget
+ * @param archLabel
+ * the label to display the image architecture in
+ * @return
+ * @return the binding that was created
+ */
+ private Binding bindArchLabel(DataBindingContext dbc, Text imageText, final Label archLabel,
+ final NewInstancePage2 page) {
+ UpdateValueStrategy updateStrategy = new UpdateValueStrategy();
+ NewInstanceModel.ImageContainer c = new NewInstanceModel.ImageContainer();
+ updateStrategy.setConverter(new NewInstanceModel.ArchConverter(cloud, c, String.class, String.class));
+ updateStrategy.setBeforeSetValidator(new NewInstanceModel.ArchValidator());
+
+ Binding binding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(100, imageText),
+ BeanProperties.value(NewInstanceModel.PROPERTY_ARCH).observe(model),
+ updateStrategy,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ binding.getValidationStatus().addValueChangeListener(new ArchAdapter(archLabel, c, page));
+ ControlDecorationSupport.create(binding, SWT.LEFT | SWT.TOP);
+ return binding;
+ }
+
+ /**
+ * Bind the given text widget to the cloud connection model. Attaches
+ * validator to the binding that enforce a non-empty input.
+ *
+ * @param dbc
+ * the databinding context to use
+ * @param text
+ * the name text widget to bind
+ */
+ private void bindText(DataBindingContext dbc, final Text text, String property, String errMsgId) {
+ Binding nameTextBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(text),
+ BeanProperties.value(NewInstanceModel.class, property)
+ .observe(model),
+ new UpdateValueStrategy().setBeforeSetValidator(new MandatoryStringValidator(WizardMessages.getString(errMsgId))),
+ null);
+ ControlDecorationSupport.create(nameTextBinding, SWT.LEFT | SWT.TOP);
+ }
+
+
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-10-22 19:35:39 UTC (rev 26007)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-10-22 19:39:26 UTC (rev 26008)
@@ -70,6 +70,10 @@
ErrorInvalidURL.text=URL specified is invalid
ErrorNonCloudURL.text=URL specified is not a valid Delta-cloud address
ErrorInvalidPem.text=File specified is not a valid existing key
+ErrorImageIdNotFound.text = No existing image with specified id can be found
+ErrorMustProvideName.text=A name must be specified
+ErrorMustProvideKeyName.text=A key name must be specified
+ErrorMustProvideImageId.text=An image id must be specified
NewInstance.desc=Specify details for a new instance you wish to launch based on an image
NewInstance.title=Launch Instance
14 years, 2 months
JBoss Tools SVN: r26007 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjohnstn
Date: 2010-10-22 15:35:39 -0400 (Fri, 22 Oct 2010)
New Revision: 26007
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
Log:
2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (listProfile): Fix to
wrap the xml result in a StringReader before trying to unmarshal.
(listImages): Ditto.
(listRealms): Ditto.
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getLastImageId): New method.
(setLastImageId): Ditto.
(getLastKeyname): Ditto.
(setLastKeyname): Ditto.
(getImage): Ditto.
(save): Make public.
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add code to get
the last keyname and last imageid used for the cloud.
(saveClouds): Save the last keyname and last imageid used for instance launching.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-22 19:24:17 UTC (rev 26006)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-22 19:35:39 UTC (rev 26007)
@@ -1,3 +1,19 @@
+2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (listProfile): Fix to
+ wrap the xml result in a StringReader before trying to unmarshal.
+ (listImages): Ditto.
+ (listRealms): Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getLastImageId): New method.
+ (setLastImageId): Ditto.
+ (getLastKeyname): Ditto.
+ (setLastKeyname): Ditto.
+ (getImage): Ditto.
+ (save): Make public.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add code to get
+ the last keyname and last imageid used for the cloud.
+ (saveClouds): Save the last keyname and last imageid used for instance launching.
+
2010-10-21 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-10-22 19:24:17 UTC (rev 26006)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-10-22 19:35:39 UTC (rev 26007)
@@ -39,6 +39,8 @@
private String username;
private String url;
private String type;
+ private String lastKeyname = "";
+ private String lastImageId = "";
private DeltaCloudClient client;
private ArrayList<DeltaCloudInstance> instances;
private ArrayList<DeltaCloudImage> images;
@@ -131,6 +133,22 @@
return type;
}
+ public String getLastImageId() {
+ return lastImageId;
+ }
+
+ public void setLastImageId(String lastImageId) {
+ this.lastImageId = lastImageId;
+ }
+
+ public String getLastKeyname() {
+ return lastKeyname;
+ }
+
+ public void setLastKeyname(String lastKeyname) {
+ this.lastKeyname = lastKeyname;
+ }
+
public IInstanceFilter getInstanceFilter() {
return instanceFilter;
}
@@ -180,7 +198,7 @@
t.start();
}
- private void save() {
+ public void save() {
// Currently we have to save all clouds instead of just this one
DeltaCloudManager.getDefault().saveClouds();
}
@@ -399,6 +417,18 @@
}
}
+ public DeltaCloudImage getImage(String imageId) {
+ DeltaCloudImage retVal = null;
+ try {
+ Image image = client.listImages(imageId);
+ retVal = new DeltaCloudImage(image);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // do nothing and return null
+ }
+ return retVal;
+ }
+
public boolean testConnection() {
String instanceId = "madeupValue"; //$NON-NLS-1$
try {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-10-22 19:24:17 UTC (rev 26006)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-10-22 19:35:39 UTC (rev 26007)
@@ -64,6 +64,8 @@
Node typeNode = attrs.getNamedItem("type"); // $NON-NLS-1$
Node imageFilterNode = attrs.getNamedItem("imagefilter"); //$NON-NLS-1$
Node instanceFilterNode = attrs.getNamedItem("instancefilter"); //$NON-NLS-1$
+ Node lastKeyNameNode = attrs.getNamedItem("lastkeyname"); //$NON-NLS-1$
+ Node lastImageIdNode = attrs.getNamedItem("lastimage"); //$NON-NLS-1$
String name = nameNode.getNodeValue();
String url = urlNode.getNodeValue();
String username = usernameNode.getNodeValue();
@@ -79,6 +81,12 @@
instanceFilterRules = instanceFilterNode.getNodeValue();
else
instanceFilterRules = IInstanceFilter.ALL_STRING;
+ String lastKeyName = "";
+ if (lastKeyNameNode != null)
+ lastKeyName = lastKeyNameNode.getNodeValue();
+ String lastImageId = "";
+ if (lastImageIdNode != null)
+ lastImageId = lastImageIdNode.getNodeValue();
ISecurePreferences root = SecurePreferencesFactory.getDefault();
ISecurePreferences node = root.node(key);
String password;
@@ -86,6 +94,8 @@
password = node.get("password", null); //$NON-NLS-1$
DeltaCloud cloud = new DeltaCloud(name, url, username, password, type,
false, imageFilterRules, instanceFilterRules);
+ cloud.setLastImageId(lastImageId);
+ cloud.setLastKeyname(lastKeyName);
cloud.loadChildren();
clouds.add(cloud);
} catch (Exception e1) {
@@ -116,10 +126,13 @@
for (DeltaCloud d : clouds) {
p.println("<cloud name=\"" + d.getName() + "\" url=\"" //$NON-NLS-1$ //$NON-NLS-2$
+ d.getURL() +
- "\" username=\"" + d.getUsername() +
- "\" type=\"" + d.getType() +
- "\" imagefilter=\"" + d.getImageFilter() +
- "\" instancefilter=\"" + d.getInstanceFilter() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ "\" username=\"" + d.getUsername() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" type=\"" + d.getType() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" imagefilter=\"" + d.getImageFilter() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" instancefilter=\"" + d.getInstanceFilter() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" lastkeyname=\"" + d.getLastKeyname() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" lastimage=\"" + d.getLastImageId() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\"/>"); //$NON-NLS-1$
}
p.println("</clouds>"); //$NON-NLS-1$
p.close();
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 19:24:17 UTC (rev 26006)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 19:35:39 UTC (rev 26007)
@@ -286,7 +286,7 @@
@Override
public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
String request = DCNS.HARDWARE_PROFILES + "/" + profileId;
- return JAXB.unmarshal(sendRequest(request, RequestType.GET), HardwareProfile.class);
+ return JAXB.unmarshal(new StringReader(sendRequest(request, RequestType.GET)), HardwareProfile.class);
}
@Override
@@ -301,7 +301,7 @@
@Override
public Image listImages(String imageId) throws DeltaCloudClientException {
- return JAXB.unmarshal(sendRequest(DCNS.IMAGES + "/" + imageId, RequestType.GET), Image.class);
+ return JAXB.unmarshal(new StringReader(sendRequest(DCNS.IMAGES + "/" + imageId, RequestType.GET)), Image.class);
}
@Override
@@ -322,7 +322,7 @@
@Override
public Realm listRealms(String realmId) throws DeltaCloudClientException {
- return JAXB.unmarshal(sendRequest(DCNS.REALMS + "/" + realmId, RequestType.GET), Realm.class);
+ return JAXB.unmarshal(new StringReader(sendRequest(DCNS.REALMS + "/" + realmId, RequestType.GET)), Realm.class);
}
public void createKey(String keyname, String keyStoreLocation) throws DeltaCloudClientException {
14 years, 2 months
JBoss Tools SVN: r26006 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-22 15:24:17 -0400 (Fri, 22 Oct 2010)
New Revision: 26006
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
Log:
[JBIDE-7371] fixed bug in request creation (created always GET)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 16:14:24 UTC (rev 26005)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-22 19:24:17 UTC (rev 26006)
@@ -123,7 +123,6 @@
try {
HttpUriRequest request = getRequest(requestType, requestUrl);
- request.setHeader("Accept", "application/xml;q=1");
HttpResponse httpResponse = httpClient.execute(request);
if (isHttpError(httpResponse.getStatusLine().getStatusCode())) {
throw new DeltaCloudClientException(
@@ -178,14 +177,19 @@
* @return the request instance
*/
protected HttpUriRequest getRequest(RequestType requestType, String requestUrl) {
+ HttpUriRequest request = null;
switch (requestType) {
case POST:
- return new HttpPost(requestUrl);
+ request = new HttpPost(requestUrl);
+ break;
case DELETE:
- return new HttpDelete(requestUrl);
+ request = new HttpDelete(requestUrl);
+ break;
default:
- return new HttpGet(requestUrl);
+ request = new HttpGet(requestUrl);
}
+ request.setHeader("Accept", "application/xml;q=1");
+ return request;
}
/**
14 years, 2 months
JBoss Tools SVN: r26005 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/dtd.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-10-22 12:14:24 -0400 (Fri, 22 Oct 2010)
New Revision: 26005
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/dtd/jboss-ws-security_1_0.xsd
Log:
JBDS-1305: Update the jboss-ws-security_1_0.xsd - updated from http://anonsvn.jboss.org/repos/jbossws/stack/native/branches/jbossws-nati...
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/dtd/jboss-ws-security_1_0.xsd
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/dtd/jboss-ws-security_1_0.xsd 2010-10-22 15:45:26 UTC (rev 26004)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/dtd/jboss-ws-security_1_0.xsd 2010-10-22 16:14:24 UTC (rev 26005)
@@ -136,6 +136,16 @@
<xs:documentation>Specifies the token to be used for JAAS authentication. If this is not specified, the username token will be used if available.</xs:documentation>
</xs:annotation>
</xs:element>
+ <xs:element name="authorize" type="authorizeType" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies that authentication is required and either provides a list of roles authorized to access the endpoint or unchecked if any
+ authenticated user can access the endpoint.
+
+ This should only be used for POJO endpoints, EJB3 endpoints should configure security as for any other EJB3 session bean.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="requireTimestampType">
@@ -351,4 +361,19 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
+ <xs:complexType name="authorizeType">
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="role" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Specifies a role that is allowed to call the endpoint.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="unchecked" type="uncheckedType" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Specifies that any authenticated user can call the endpoint.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ <xs:complexType name="uncheckedType"/>
</xs:schema>
14 years, 2 months
JBoss Tools SVN: r26004 - trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-22 11:45:26 -0400 (Fri, 22 Oct 2010)
New Revision: 26004
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta
Log:
JBIDE-7388
https://jira.jboss.org/browse/JBIDE-7388
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta 2010-10-22 15:43:38 UTC (rev 26003)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta 2010-10-22 15:45:26 UTC (rev 26004)
@@ -588,7 +588,7 @@
<XChildrenEntities/>
<XEntityRenderer/>
<XModelAttributes>
- <XModelAttribute default="1.1" name="version" xmlname="version">
+ <XModelAttribute default="1.2" name="version" xmlname="version">
<Constraint loader="List">
<value name="1.0"/>
<value name="1.1"/>
14 years, 2 months
JBoss Tools SVN: r26003 - trunk/struts/plugins/org.jboss.tools.struts/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-22 11:43:38 -0400 (Fri, 22 Oct 2010)
New Revision: 26003
Modified:
trunk/struts/plugins/org.jboss.tools.struts/resources/meta/struts-options.xml
Log:
JBIDE-7388
https://jira.jboss.org/browse/JBIDE-7388
Modified: trunk/struts/plugins/org.jboss.tools.struts/resources/meta/struts-options.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/resources/meta/struts-options.xml 2010-10-22 15:42:55 UTC (rev 26002)
+++ trunk/struts/plugins/org.jboss.tools.struts/resources/meta/struts-options.xml 2010-10-22 15:43:38 UTC (rev 26003)
@@ -59,7 +59,7 @@
url_pattern="*.do" />
</StrutsSupport>
<NewProject model-entity="SharableNewProject" NAME="New Project"
- SCOPE="project" directory="" template="Blank" version="Struts 1.1" />
+ SCOPE="project" directory="" template="Blank" version="Struts 1.2" />
</Project>
<Automation model-entity="SharableAutomation" NAME="Automation"
SCOPE="project">
14 years, 2 months