JBoss Tools SVN: r31414 - trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/utils.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-05-22 12:04:11 -0400 (Sun, 22 May 2011)
New Revision: 31414
Modified:
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtilsTestCase.java
Log:
Refactoring pieces of the metamodel classes and JdtUtils API + Fixing incomplete jaxrs-api jar
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtilsTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtilsTestCase.java 2011-05-22 12:45:02 UTC (rev 31413)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtilsTestCase.java 2011-05-22 16:04:11 UTC (rev 31414)
@@ -14,6 +14,10 @@
import java.util.List;
import java.util.Map;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import junit.framework.Assert;
@@ -38,21 +42,10 @@
import org.junit.Test;
import org.osgi.framework.Bundle;
-//FIXME : add assertions on binary source attachement, causing errors or failures when missing
public class JdtUtilsTestCase extends AbstractCommonTestCase {
- public static final String PROVIDER = "javax.ws.rs.ext.Provider";
+ private final Bundle bundle = JBossJaxrsCoreTestsPlugin.getDefault().getBundle();
- public static final String PRODUCES = "javax.ws.rs.Produces";
-
- public static final String CONSUMES = "javax.ws.rs.Consumes";
-
- public static final String PATH = "javax.ws.rs.Path";
-
- public static final String HTTP_METHOD = "javax.ws.rs.HttpMethod";
-
- private Bundle bundle = JBossJaxrsCoreTestsPlugin.getDefault().getBundle();
-
@Test
public void shouldResolveTypeByQNameInSourceCode() throws CoreException {
Assert.assertNotNull("Type not found", JdtUtils.resolveType(
@@ -142,12 +135,12 @@
@Test
public void shouldAssertTypeHasAnnotationWithFullyQualifiedNameUsage() throws JavaModelException, CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType resourceType = JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource", javaProject, progressMonitor);
+ IType resourceType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource",
+ javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
Assert.assertNotNull("Type Annotation not found",
- JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, PATH));
+ JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, Path.class));
}
@Test
@@ -158,7 +151,7 @@
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
Assert.assertNotNull("Type Annotation not found",
- JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, PATH));
+ JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, Path.class));
}
@Test
@@ -179,8 +172,8 @@
@Test
public void shouldNotAssertTypeHasInvalidAnnotation() throws JavaModelException, CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType resourceType = JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource", javaProject, progressMonitor);
+ IType resourceType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource",
+ javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
Assert.assertNull("Type Annotation not expected",
@@ -191,25 +184,23 @@
@Test
public void shouldNotAssertTypeHasUnusedAnnotation() throws JavaModelException, CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType resourceType = JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource", javaProject, progressMonitor);
+ IType resourceType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource",
+ javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
Assert.assertNull("Type Annotation not expected",
- JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, HTTP_METHOD));
+ JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, HttpMethod.class));
}
@Test
public void shouldResolveTypeAnnotationAttributeValue() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType resourceType = JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource", javaProject, progressMonitor);
+ IType resourceType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.PurchaseOrderResource",
+ javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, PATH);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object value = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "value");
+ Object value = JdtUtils.resolveAnnotationAttributeValue(resourceType, compilationUnit, Path.class, "value");
Assert.assertEquals("Wrong result", "/orders", value);
}
@@ -220,10 +211,8 @@
javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, PATH);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object value = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "unknown");
- Assert.assertNull("Wrong result", value);
+ Assert.assertNull("Wrong result",
+ JdtUtils.resolveAnnotationAttributeValue(resourceType, compilationUnit, Path.class, "unknown"));
}
@Test
@@ -233,7 +222,7 @@
progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, PRODUCES);
+ IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, Produces.class);
Assert.assertNull("Type Annotation not expected", annotationBinding);
}
@@ -244,9 +233,7 @@
javaProject, progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, PATH);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object value = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "value");
+ Object value = JdtUtils.resolveAnnotationAttributeValue(type, compilationUnit, Path.class, "value");
Assert.assertNotNull("Values not found", value);
Assert.assertTrue("Wrong result type", value instanceof String);
Assert.assertEquals("Wrong result value", "/orders", value);
@@ -255,13 +242,11 @@
@Test
public void shouldResolveTypeAnnotationAttributeValueAsSingleStringQualifiedValue() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource",
- javaProject, progressMonitor);
+ IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject,
+ progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, PATH);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object value = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "value");
+ Object value = JdtUtils.resolveAnnotationAttributeValue(type, compilationUnit, Path.class, "value");
Assert.assertNotNull("Values not found", value);
Assert.assertTrue("Wrong result type", value instanceof String);
Assert.assertEquals("Wrong result value", "/customers", value);
@@ -270,18 +255,16 @@
@Test
public void shouldResolveTypeAnnotationAttributeValueAsSingleQualifiedMediaTypeValue() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
- IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource",
- javaProject, progressMonitor);
+ IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject,
+ progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, CONSUMES);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object value = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "value");
+ Object value = JdtUtils.resolveAnnotationAttributeValue(type, compilationUnit, Consumes.class, "value");
Assert.assertNotNull("Values not found", value);
Assert.assertTrue("Wrong result type: " + value.getClass(), value instanceof Object[]);
- Assert.assertEquals("Wrong result: " + value, 1, ((Object[])value).length);
- Assert.assertTrue("Wrong result type: " + value, ((Object[])value)[0] instanceof String);
- Assert.assertEquals("Wrong result value", "application/xml", ((Object[])value)[0]);
+ Assert.assertEquals("Wrong result: " + value, 1, ((Object[]) value).length);
+ Assert.assertTrue("Wrong result type: " + value, ((Object[]) value)[0] instanceof String);
+ Assert.assertEquals("Wrong result value", "application/xml", ((Object[]) value)[0]);
}
@Test
@@ -293,9 +276,7 @@
// warning : ensure the annotation syntax includes brackets to make an
// array : @Consumes({ APPLICATION_XML })
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, CONSUMES);
- Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Object values = JdtUtils.resolveAnnotationAttributeValue(annotationBinding, "value");
+ Object values = JdtUtils.resolveAnnotationAttributeValue(type, compilationUnit, Consumes.class, "value");
Assert.assertNotNull("Values not found", values);
Assert.assertTrue("Wrong result type: " + values.getClass(), values instanceof Object[]);
Assert.assertEquals("Wrong result value", "application/xml", ((Object[]) values)[0]);
@@ -308,7 +289,7 @@
progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, CONSUMES);
+ IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(type, compilationUnit, Consumes.class);
Assert.assertNull("Type Annotation not expected", annotationBinding);
}
@@ -352,9 +333,8 @@
@Test
public void shouldResolveMultipleConcreteTypeArgumentsOnSourceImplementation() throws CoreException {
- IType parameterizedType = JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.extra.AnotherDummyProvider", javaProject,
- new NullProgressMonitor());
+ IType parameterizedType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.extra.AnotherDummyProvider",
+ javaProject, new NullProgressMonitor());
Assert.assertNotNull("Parameterized Type not found", parameterizedType);
// MessageBodyReader
@@ -418,9 +398,10 @@
javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, PATH);
+ IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit,
+ Path.class);
Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Assert.assertEquals("Type Annotation not found", PATH,
+ Assert.assertEquals("Type Annotation not found", Path.class.getName(),
JdtUtils.resolveAnnotationFullyQualifiedName(annotationBinding));
}
@@ -431,9 +412,10 @@
javaProject, progressMonitor);
Assert.assertNotNull("ResourceType not found", resourceType);
CompilationUnit compilationUnit = JdtUtils.parse(resourceType, progressMonitor);
- IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit, CONSUMES);
+ IAnnotationBinding annotationBinding = JdtUtils.resolveAnnotationBinding(resourceType, compilationUnit,
+ Consumes.class);
Assert.assertNotNull("Type Annotation not found", annotationBinding);
- Assert.assertEquals("Type Annotation not found", CONSUMES,
+ Assert.assertEquals("Type Annotation not found", Consumes.class.getName(),
JdtUtils.resolveAnnotationFullyQualifiedName(annotationBinding));
}
@@ -479,7 +461,7 @@
Assert.assertNotNull("ResourceType not found", resourceType);
Assert.assertTrue("Wrong result", JdtUtils.isTopLevelType(resourceType));
}
-
+
@Test
public void shouldResolveMethodBinding() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
@@ -487,42 +469,44 @@
progressMonitor);
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("getProduct")) {
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("getProduct")) {
IMethodBinding methodBinding = JdtUtils.resolveMethodBinding(method, compilationUnit);
Assert.assertNotNull("Binding not found", methodBinding);
}
}
}
-
+
@Test
public void shouldGetCompiltationUnitFromType() throws CoreException {
- IResource resource = project.findMember("src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java");
+ IResource resource = project
+ .findMember("src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java");
Assert.assertNotNull("Resource not found", resource);
Assert.assertNotNull("CompilationUnit not found", JdtUtils.getCompilationUnit(resource));
}
-
+
@Test
public void shouldGetCompiltationUnitFromProject() {
IResource resource = project.findMember("src/main/resources/log4j.xml");
Assert.assertNotNull("Resource not found", resource);
Assert.assertNull("CompilationUnit not expected", JdtUtils.getCompilationUnit(resource));
}
-
+
@Test
public void shouldResolveMethodAnnotationBinding() throws CoreException {
- IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject,
- new NullProgressMonitor());
+ IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator",
+ javaProject, new NullProgressMonitor());
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("getProductResourceLocator")) {
- IAnnotationBinding binding = JdtUtils.resolveAnnotationBinding(method, compilationUnit, javax.ws.rs.Path.class);
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("getProductResourceLocator")) {
+ IAnnotationBinding binding = JdtUtils.resolveAnnotationBinding(method, compilationUnit,
+ javax.ws.rs.Path.class);
Assert.assertNotNull("Binding not found", binding);
}
}
}
-
+
@Test
public void shouldResolveMethodZeroQueryParam() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
@@ -531,9 +515,10 @@
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("getProduct")) {
- Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method, compilationUnit, QueryParam.class);
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("getProduct")) {
+ Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method,
+ compilationUnit, QueryParam.class);
Assert.assertEquals("Wrong number of params", 0, resolvedQueryParams.size());
}
}
@@ -547,14 +532,15 @@
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("createCustomer")) {
- Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method, compilationUnit, QueryParam.class);
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("createCustomer")) {
+ Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method,
+ compilationUnit, QueryParam.class);
Assert.assertEquals("Wrong number of params", 0, resolvedQueryParams.size());
}
}
}
-
+
@Test
public void shouldResolveMethodZeroQueryParamOnNoQueryParamAnnotatedParamMethod() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
@@ -563,14 +549,15 @@
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("createCustomer")) {
- Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method, compilationUnit, QueryParam.class);
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("createCustomer")) {
+ Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method,
+ compilationUnit, QueryParam.class);
Assert.assertEquals("Wrong number of params", 0, resolvedQueryParams.size());
}
}
}
-
+
@Test
public void shouldResolveMethodTwoQueryParam() throws CoreException {
NullProgressMonitor progressMonitor = new NullProgressMonitor();
@@ -579,13 +566,13 @@
Assert.assertNotNull("Type not found", type);
CompilationUnit compilationUnit = JdtUtils.parse(type, null);
- for(IMethod method : type.getMethods()) {
- if(method.getElementName().equals("getCustomers")) {
- Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method, compilationUnit, QueryParam.class);
+ for (IMethod method : type.getMethods()) {
+ if (method.getElementName().equals("getCustomers")) {
+ Map<IAnnotationBinding, ITypedRegion> resolvedQueryParams = JdtUtils.resolveMethodParamBindings(method,
+ compilationUnit, QueryParam.class);
Assert.assertEquals("Wrong number of params", 2, resolvedQueryParams.size());
}
}
- }
-
-
+ }
+
}
13 years, 4 months
JBoss Tools SVN: r31413 - in trunk/ws: plugins/org.jboss.tools.ws.jaxrs.core/META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-05-22 08:45:02 -0400 (Sun, 22 May 2011)
New Revision: 31413
Removed:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/lib/
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/lib/
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/build.properties
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/.classpath
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/build.properties
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/.classpath
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF
Log:
Removing duplicate jaxrs-api.jar in org.jboss.tools.ws.jaxrs.core.test and org.jboss.tools.ws.jaxrs.ui plugins
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF 2011-05-22 12:45:02 UTC (rev 31413)
@@ -22,7 +22,10 @@
org.eclipse.ltk.core.refactoring;bundle-version="3.5.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Export-Package: org.jboss.tools.ws.jaxrs.core.configuration,
+Export-Package: javax.ws.rs,
+ javax.ws.rs.core,
+ javax.ws.rs.ext,
+ org.jboss.tools.ws.jaxrs.core.configuration,
org.jboss.tools.ws.jaxrs.core.internal.builder;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
org.jboss.tools.ws.jaxrs.core.metamodel,
org.jboss.tools.ws.jaxrs.core.utils
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/build.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/build.properties 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/build.properties 2011-05-22 12:45:02 UTC (rev 31413)
@@ -4,4 +4,6 @@
.,\
plugin.xml,\
lib/jaxrs-api.jar
-jars.compile.order = .
+jars.compile.order = .,\
+ lib/jaxrs-api.jar
+source.lib/jaxrs-api.jar =
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/.classpath
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/.classpath 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/.classpath 2011-05-22 12:45:02 UTC (rev 31413)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib" path="lib/jaxrs-api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF 2011-05-22 12:45:02 UTC (rev 31413)
@@ -23,5 +23,4 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %PLUGIN_PROVIDER
-Bundle-ClassPath: lib/jaxrs-api.jar,
- .
+Bundle-ClassPath: .
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/build.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/build.properties 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/build.properties 2011-05-22 12:45:02 UTC (rev 31413)
@@ -4,5 +4,4 @@
.,\
plugin.xml,\
icons/,\
- plugin.properties,\
- lib/jaxrs-api.jar
+ plugin.properties
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/.classpath
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/.classpath 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/.classpath 2011-05-22 12:45:02 UTC (rev 31413)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib" path="lib/jaxrs-api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF 2011-05-21 14:24:44 UTC (rev 31412)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF 2011-05-22 12:45:02 UTC (rev 31413)
@@ -18,5 +18,4 @@
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: org.apache.log4j
Eclipse-BuddyPolicy: registered
-Bundle-ClassPath: lib/jaxrs-api.jar,
- .
+Bundle-ClassPath: .
13 years, 4 months
JBoss Tools SVN: r31412 - in trunk/deltacloud/tests: org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-05-21 10:24:44 -0400 (Sat, 21 May 2011)
New Revision: 31412
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
Log:
[JBIDE-8975] corrected package structure in Deltacloud client, removed bundle activator
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -24,12 +24,12 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.StateAware.State;
/**
* A class that holds the integration test context
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -16,10 +16,10 @@
import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
-import org.jboss.tools.deltacloud.core.client.API;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.unmarshal.APIUnmarshaller;
+import org.jboss.tools.deltacloud.client.API;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.API.Driver;
+import org.jboss.tools.deltacloud.client.unmarshal.APIUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.APIResponseFakes.APIResponse;
import org.junit.Test;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -20,11 +20,11 @@
import javax.xml.bind.JAXBException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
-import org.jboss.tools.deltacloud.core.client.Property;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfileUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfilesUnmarshaller;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.Property;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfileUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfilesUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile1Response;
import org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile2Response;
import org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfilesResponse;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -17,10 +17,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImageUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImagesUnmarshaller;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.unmarshal.ImageUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.ImagesUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImageResponse;
import org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImagesResponse;
import org.junit.Test;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -18,9 +18,9 @@
import java.util.Collection;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.Image;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.Image;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -20,12 +20,12 @@
import javax.xml.bind.JAXBException;
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ActionUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstanceUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstancesUnmarshaller;
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.unmarshal.ActionUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstanceUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstancesUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceActionResponse;
import org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceResponse;
import org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstancesResponse;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -23,15 +23,15 @@
import java.util.List;
import java.util.concurrent.ExecutionException;
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.StateAware.State;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -21,13 +21,13 @@
import javax.xml.bind.JAXBException;
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Key;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ActionUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeysUnmarshaller;
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Key;
+import org.jboss.tools.deltacloud.client.unmarshal.ActionUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeyUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeysUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes;
import org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyActionResponse;
import org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyResponse;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -20,11 +20,11 @@
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.Key;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.Key;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -17,9 +17,9 @@
import java.io.IOException;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -17,11 +17,11 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Realm;
-import org.jboss.tools.deltacloud.core.client.Realm.RealmState;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmsUnmarshaller;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Realm;
+import org.jboss.tools.deltacloud.client.Realm.RealmState;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmsUnmarshaller;
import org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes;
import org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes.RealmsResponse;
import org.junit.Test;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -17,9 +17,9 @@
import java.io.IOException;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Realm;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Realm;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -19,13 +19,13 @@
import java.util.Collections;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest;
+import org.jboss.tools.deltacloud.client.API.Driver;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
import org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
import org.jboss.tools.internal.deltacloud.client.test.fakes.ServerFake;
import org.junit.After;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
-import org.jboss.tools.deltacloud.core.client.Property;
-import org.jboss.tools.deltacloud.core.client.Property.UNIT;
+import org.jboss.tools.deltacloud.client.Property;
+import org.jboss.tools.deltacloud.client.Property.UNIT;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
+import org.jboss.tools.deltacloud.client.StateAware.State;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
-import org.jboss.tools.deltacloud.core.client.Realm.RealmState;
+import org.jboss.tools.deltacloud.client.Realm.RealmState;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -12,7 +12,7 @@
import static org.junit.Assert.assertEquals;
-import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
import org.junit.Test;
public class UrlBuilderTest {
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -24,12 +24,12 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.StateAware.State;
/**
* A class that holds the integration test context
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -15,9 +15,9 @@
import java.io.IOException;
import java.net.MalformedURLException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.internal.deltacloud.test.context.MockIntegrationTestContext;
import org.jboss.tools.internal.deltacloud.test.fakes.DeltaCloudFake;
import org.jboss.tools.internal.deltacloud.test.fakes.ServerFake;
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2011-05-21 14:23:46 UTC (rev 31411)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2011-05-21 14:24:44 UTC (rev 31412)
@@ -13,9 +13,9 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import org.jboss.tools.deltacloud.client.Instance;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.client.Instance;
import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.core.job.CloudElementSchedulingRule;
13 years, 4 months
JBoss Tools SVN: r31411 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud: client and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-05-21 10:23:46 -0400 (Sat, 21 May 2011)
New Revision: 31411
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/API.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Action.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ActionAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/AddressList.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudAuthClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClient.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientImpl.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudNotFoundClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HardwareProfile.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpMethod.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusCode.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusRange.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/IdAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Image.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Instance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Key.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Property.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Realm.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ResourceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/StateAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractDeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractListObjectsRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateInstanceRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/DeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfileRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfilesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImageRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImagesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstanceRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstancesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeysRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmsRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/PerformActionRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/TypeRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/AbstractHttpTransport.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/Base64Coder.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/IHttpTransport.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/URLConnectionTransport.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/APIUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractActionAwareUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDOMUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectsUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ActionUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfileUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfilesUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/IDeltaCloudObjectUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImageUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImagesUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstanceUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstancesUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeyUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeysUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmsUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/StringUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/UrlBuilder.java
Log:
[JBIDE-8975] corrected package structure in Deltacloud client, removed bundle activator
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/API.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/API.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/API.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class API extends IdAware {
+
+ private static final long serialVersionUID = 1L;
+
+ public static enum Driver {
+ UNKNOWN, MOCK, EC2;
+
+ public static Driver checkedValueOf(String name) {
+ for (Driver driver : values()) {
+ if (driver.name().equals(name)) {
+ return driver;
+ }
+ }
+ return UNKNOWN;
+ }
+
+ }
+
+ private Driver driver;
+
+ public API() {
+ }
+
+ public void setDriver(Driver driver) {
+ this.driver = driver;
+ }
+
+ public void setDriver(String driver) {
+ setDriver(Driver.checkedValueOf(driver.toUpperCase()));
+ }
+
+ public Driver getDriver() {
+ return driver;
+ }
+
+ @Override
+ public String toString() {
+ return "API [driver=" + driver.name() + super.toString() + "]";
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Action.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Action.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Action.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * An action that may be performed on a resource
+ *
+ * @author André Dietisheim
+ */
+public class Action<OWNER> {
+
+ public static final String START_NAME = "start";
+ public static final String STOP_NAME = "stop";
+ public static final String REBOOT_NAME = "reboot";
+ public static final String DESTROY_NAME = "destroy";
+
+ private String name;
+ private String url;
+ private HttpMethod method;
+ private OWNER owner;
+
+ public HttpMethod getMethod() {
+ return method;
+ }
+
+ public void setMethodString(String method) {
+ this.method = HttpMethod.valueOf(method.toUpperCase());
+ }
+
+ public void setMethod(HttpMethod method) {
+ this.method = method;
+ }
+
+ public void setMethod(String method) {
+ this.method = HttpMethod.valueOf(method.toUpperCase());
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setOwner(OWNER owner) {
+ this.owner = owner;
+ }
+
+ public OWNER getOwner() {
+ return owner;
+ }
+
+ public boolean isStart() {
+ return START_NAME.equals(getName());
+ }
+
+ public boolean isStop() {
+ return STOP_NAME.equals(getName());
+ }
+
+ public boolean isReboot() {
+ return REBOOT_NAME.equals(getName());
+ }
+
+ public boolean isDestroy() {
+ return DESTROY_NAME.equals(getName());
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ActionAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ActionAware.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ActionAware.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+public abstract class ActionAware<OWNER> extends IdAware {
+
+ private List<Action<OWNER>> actions;
+
+ public Action<OWNER> getAction(String name) {
+ if (name == null) {
+ return null;
+ }
+
+ for (Action<OWNER> action : getActions()) {
+ if (name.equals(action.getName())) {
+ return action;
+ }
+ }
+ return null;
+ }
+
+ public List<String> getActionNames() {
+ ArrayList<String> names = new ArrayList<String>();
+ for (Action<OWNER> action : getActions()) {
+ names.add(action.getName());
+ }
+ return names;
+ }
+
+ public boolean start(DeltaCloudClient client) throws DeltaCloudClientException {
+ InputStream in = client.performAction(getAction(Action.START_NAME));
+ update(in);
+ return in != null;
+ }
+
+ public boolean stop(DeltaCloudClient client) throws DeltaCloudClientException {
+ InputStream in = client.performAction(getAction(Action.STOP_NAME));
+ update(in);
+ return in != null;
+ }
+
+ public boolean destroy(DeltaCloudClient client) throws DeltaCloudClientException {
+ InputStream in = client.performAction(getAction(Action.DESTROY_NAME));
+ return in != null;
+ }
+
+ public boolean reboot(DeltaCloudClient client) throws DeltaCloudClientException {
+ InputStream in = client.performAction(getAction(Action.REBOOT_NAME));
+ update(in);
+ return in != null;
+ }
+
+ protected void update(InputStream in) throws DeltaCloudClientException {
+ if (in == null) {
+ return;
+ }
+
+ doUpdate(in);
+ }
+
+ protected abstract void doUpdate(InputStream in) throws DeltaCloudClientException;
+
+ public boolean canStart() {
+ return getAction(Action.START_NAME) != null;
+ }
+
+ public boolean canStop() {
+ return getAction(Action.STOP_NAME) != null;
+ }
+
+ public boolean canReboot() {
+ return getAction(Action.REBOOT_NAME) != null;
+ }
+
+ public boolean canDestroy() {
+ return getAction(Action.DESTROY_NAME) != null;
+ }
+
+ public void setActions(List<Action<OWNER>> actions) {
+ this.actions = actions;
+ }
+
+ public List<Action<OWNER>> getActions() {
+ return actions;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/AddressList.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/AddressList.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/AddressList.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+@XmlType
+public class AddressList
+{
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement
+ @XmlList
+ private List<String> addresses;
+
+ public AddressList()
+ {
+ }
+
+ public AddressList(List<String> addresses)
+ {
+ setAddress(addresses);
+ }
+
+ protected void setAddress(List<String> addresses)
+ {
+ this.addresses = addresses;
+ }
+
+ public List<String> getAddress()
+ {
+ return addresses;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudAuthClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudAuthClientException.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudAuthClientException.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class DeltaCloudAuthClientException extends DeltaCloudClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeltaCloudAuthClientException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public DeltaCloudAuthClientException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public DeltaCloudAuthClientException(String message)
+ {
+ super(message);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClient.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClient.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.API.Driver;
+
+/**
+ * @author Martyn Taylor
+ * @author Andre Dietisheim
+ */
+public interface DeltaCloudClient {
+
+ /**
+ * Returns the server type this client is connected to.
+ *
+ * @return the server type
+ *
+ * @see DeltaCloudServerType
+ */
+ public Driver getServerType();
+
+ /**
+ * Returns a list of Delta Cloud Realms
+ *
+ * @return List of Delta Cloud Realms
+ * @throws DeltaCloudClientException
+ */
+ public List<Realm> listRealms() throws DeltaCloudClientException;
+
+ /**
+ * Returns a single Delta Cloud Realm given its ID
+ *
+ * @param realmId
+ * @return Delta Cloud Realm
+ * @throws DeltaCloudClientException
+ */
+ public Realm listRealms(String realmId) throws DeltaCloudClientException;
+
+ public List<HardwareProfile> listProfiles() throws DeltaCloudClientException;
+
+ /**
+ * Returns a Delta Cloud Flavors
+ *
+ * @param flavorId
+ * @return Delta Cloud Flavor
+ * @throws DeltaCloudClientException
+ */
+ public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException;
+
+ /**
+ * Returns a List of Delta Cloud Images
+ *
+ * @return List of Delta Cloud Images
+ * @throws DeltaCloudClientException
+ */
+ public List<Image> listImages() throws DeltaCloudClientException;
+
+ /**
+ * Returns a Delta Cloud Image given its ID
+ *
+ * @param imageId
+ * @return
+ * @throws DeltaCloudClientException
+ */
+ public Image listImages(String imageId) throws DeltaCloudClientException;
+
+ /**
+ * Returns a list of all Instances from the Delta Cloud Provider
+ *
+ * @return
+ * @throws DeltaCloudClientException
+ */
+ public List<Instance> listInstances() throws DeltaCloudClientException;
+
+ /**
+ * Returns an Instance from the Delta Cloud Provider given on the Instances
+ * ID
+ *
+ * @param instanceId
+ * @return
+ * @throws DeltaCloudClientException
+ */
+ public Instance listInstances(String instanceId) throws DeltaCloudClientException;
+
+ /**
+ * Creates a new Delta Cloud Instance based on the Image specified by the
+ * Image ID. Default parameters are used for the Flavor, Realm and Name.
+ * These are specified by the Delta Cloud Provider
+ *
+ * @param imageId
+ * @return The newly created Delta Cloud Instance
+ * @throws DeltaCloudClientException
+ */
+ public Instance createInstance(String imageId) throws DeltaCloudClientException;
+
+ /**
+ * Creates a new Delta Cloud Instance, the instance will be based on the
+ * Image specified by the instance ID. It will be of type flavor and in the
+ * location realm
+ *
+ * @param imageId
+ * @param flavor
+ * @param realm
+ * @param name
+ * @return
+ * @throws DeltaCloudClientException
+ */
+ public Instance createInstance(String name, String imageId, String profileId, String realmId, String memory, String storage)
+ throws DeltaCloudClientException;
+
+ public Instance createInstance(String name, String imageId, String profileId, String realmId, String keyname, String memory,
+ String storage) throws DeltaCloudClientException;
+
+ /**
+ * Creates a key for a given name on the deltacloud server.
+ *
+ * @param keyname
+ * the name of the key to retrieve from the server
+ * @param keyStoreLocation
+ * the path to the file to store the key in
+ * @throws DeltaCloudClientException
+ * the delta cloud client exception
+ */
+ public Key createKey(String keyname) throws DeltaCloudClientException;
+
+ /**
+ * Lists all keys available on the deltacloud server this client is
+ * connected to.
+ *
+ * @return the keys that are available
+ * @throws DeltaCloudClientException
+ *
+ */
+ public List<Key> listKeys() throws DeltaCloudClientException;
+
+ /**
+ * Returns a key with the given name if it is available on the server.
+ * Throws a DeltaCloudException if it is not available.
+ */
+ public Key listKey(String id) throws DeltaCloudClientException;
+
+ /**
+ * Performs the given action.
+ *
+ * @param action the action to execute
+ * @return true, if successful
+ * @throws DeltaCloudClientException the delta cloud client exception
+ * @see Action
+ */
+ public InputStream performAction(Action<?> action) throws DeltaCloudClientException;
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientException.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientException.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Martyn Taylor
+ */
+public class DeltaCloudClientException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+
+ public DeltaCloudClientException(String message, Throwable clause)
+ {
+ super(message, clause);
+ }
+
+ public DeltaCloudClientException(Throwable clause)
+ {
+ super(clause);
+ }
+
+ public DeltaCloudClientException(String message)
+ {
+ super(message);
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientImpl.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientImpl.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudClientImpl.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.API.Driver;
+import org.jboss.tools.deltacloud.client.request.CreateInstanceRequest;
+import org.jboss.tools.deltacloud.client.request.CreateKeyRequest;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
+import org.jboss.tools.deltacloud.client.request.ListHardwareProfileRequest;
+import org.jboss.tools.deltacloud.client.request.ListHardwareProfilesRequest;
+import org.jboss.tools.deltacloud.client.request.ListImageRequest;
+import org.jboss.tools.deltacloud.client.request.ListImagesRequest;
+import org.jboss.tools.deltacloud.client.request.ListInstanceRequest;
+import org.jboss.tools.deltacloud.client.request.ListInstancesRequest;
+import org.jboss.tools.deltacloud.client.request.ListKeyRequest;
+import org.jboss.tools.deltacloud.client.request.ListKeysRequest;
+import org.jboss.tools.deltacloud.client.request.ListRealmRequest;
+import org.jboss.tools.deltacloud.client.request.ListRealmsRequest;
+import org.jboss.tools.deltacloud.client.request.PerformActionRequest;
+import org.jboss.tools.deltacloud.client.request.TypeRequest;
+import org.jboss.tools.deltacloud.client.transport.IHttpTransport;
+import org.jboss.tools.deltacloud.client.transport.URLConnectionTransport;
+import org.jboss.tools.deltacloud.client.unmarshal.APIUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfileUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfilesUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.ImageUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.ImagesUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstanceUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstancesUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeyUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeysUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmsUnmarshaller;
+
+/**
+ * @author Andre Dietisheim (based on prior implementation by Martyn Taylor)
+ */
+public class DeltaCloudClientImpl implements DeltaCloudClient {
+
+ private String baseUrl;
+ private IHttpTransport transport;
+
+ public DeltaCloudClientImpl(String url) throws MalformedURLException, DeltaCloudClientException {
+ this(url, null, null);
+ }
+
+ public DeltaCloudClientImpl(String url, String username, String password) throws MalformedURLException,
+ DeltaCloudClientException {
+ this(url, new URLConnectionTransport(username, password));
+ }
+
+ public DeltaCloudClientImpl(String url, IHttpTransport transport) throws DeltaCloudClientException {
+ this.baseUrl = url;
+ this.transport = transport;
+ }
+
+ protected InputStream request(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
+ return transport.request(deltaCloudRequest);
+ }
+
+ public Driver getServerType() {
+ try {
+ InputStream response = request(new TypeRequest(baseUrl));
+ API api = new APIUnmarshaller().unmarshall(response, new API());
+ return api.getDriver();
+ } catch (DeltaCloudClientException e) {
+ return Driver.UNKNOWN;
+ }
+ }
+
+ @Override
+ public Instance createInstance(String imageId) throws DeltaCloudClientException {
+ try {
+ InputStream response = request(new CreateInstanceRequest(baseUrl, imageId));
+ return new InstanceUnmarshaller().unmarshall(response, new Instance());
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+
+ }
+
+ public Instance createInstance(String name, String imageId, String profileId, String realmId, String memory,
+ String storage) throws DeltaCloudClientException {
+ return createInstance(name, imageId, profileId, realmId, null, memory, storage);
+ }
+
+ public Instance createInstance(String name, String imageId, String profileId, String realmId, String keyId,
+ String memory, String storage) throws DeltaCloudClientException {
+ try {
+ InputStream response = request(
+ new CreateInstanceRequest(baseUrl, name, imageId, profileId, realmId, keyId, memory, storage));
+ Instance instance = new InstanceUnmarshaller().unmarshall(response, new Instance());
+ // TODO: WORKAROUND for
+ // https://issues.jboss.org/browse/JBIDE-8005
+ if (keyId != null) {
+ instance.setKeyId(keyId);
+ }
+ // TODO: WORKAROUND for
+ // https://issues.jboss.org/browse/JBIDE-8005
+ return instance;
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ @Override
+ public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
+ try {
+ InputStream response = request(new ListHardwareProfileRequest(baseUrl, profileId));
+ return new HardwareProfileUnmarshaller().unmarshall(response, new HardwareProfile());
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ @Override
+ public List<HardwareProfile> listProfiles() throws DeltaCloudClientException {
+ try {
+ InputStream response = request(new ListHardwareProfilesRequest(baseUrl));
+ List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
+ new HardwareProfilesUnmarshaller().unmarshall(response, profiles);
+ return profiles;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(MessageFormat.format("could not get realms on cloud at \"{0}\"",
+ baseUrl), e);
+ }
+ }
+
+ @Override
+ public List<Image> listImages() throws DeltaCloudClientException {
+ InputStream response = request(new ListImagesRequest(baseUrl));
+ List<Image> images = new ArrayList<Image>();
+ new ImagesUnmarshaller().unmarshall(response, images);
+ return images;
+ }
+
+ @Override
+ public Image listImages(String imageId) throws DeltaCloudClientException {
+ InputStream response = request(new ListImageRequest(baseUrl, imageId));
+ return new ImageUnmarshaller().unmarshall(response, new Image());
+ }
+
+ @Override
+ public List<Instance> listInstances() throws DeltaCloudClientException {
+ InputStream inputStream = request(new ListInstancesRequest(baseUrl));
+ List<Instance> instances = new ArrayList<Instance>();
+ new InstancesUnmarshaller().unmarshall(inputStream, instances);
+ return instances;
+ }
+
+ @Override
+ public Instance listInstances(String instanceId) throws DeltaCloudClientException {
+ try {
+ InputStream response = request(new ListInstanceRequest(baseUrl, instanceId));
+ return new InstanceUnmarshaller().unmarshall(response, new Instance());
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ @Override
+ public List<Realm> listRealms() throws DeltaCloudClientException {
+ try {
+ InputStream inputStream = request(new ListRealmsRequest(baseUrl));
+ List<Realm> realms = new ArrayList<Realm>();
+ new RealmsUnmarshaller().unmarshall(inputStream, realms);
+ return realms;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(
+ MessageFormat.format("could not get realms on cloud at \"{0}\"", baseUrl), e);
+ }
+ }
+
+ @Override
+ public Realm listRealms(String realmId) throws DeltaCloudClientException {
+ try {
+ InputStream response = request(new ListRealmRequest(baseUrl, realmId));
+ return new RealmUnmarshaller().unmarshall(response, new Realm());
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(
+ MessageFormat.format("could not get realms on cloud at \"{0}\"", baseUrl), e);
+ }
+ }
+
+ public Key createKey(String keyname) throws DeltaCloudClientException {
+ try {
+ CreateKeyRequest keyRequest = new CreateKeyRequest(baseUrl, keyname);
+ InputStream inputStream = request(keyRequest);
+ Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
+ return key;
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ public List<Key> listKeys() throws DeltaCloudClientException {
+ InputStream inputStream = request(new ListKeysRequest(baseUrl));
+ List<Key> keys = new ArrayList<Key>();
+ new KeysUnmarshaller().unmarshall(inputStream, keys);
+ return keys;
+ }
+
+ public Key listKey(String id) throws DeltaCloudClientException {
+ InputStream inputStream = request(new ListKeyRequest(baseUrl, id));
+ Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
+ return key;
+ }
+
+ public InputStream performAction(Action<?> action) throws DeltaCloudClientException {
+ InputStream in = null;
+ if (action != null) {
+ try {
+ in = request(new PerformActionRequest(action.getUrl(), action.getMethod()));
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+ return in;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudNotFoundClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudNotFoundClientException.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/DeltaCloudNotFoundClientException.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class DeltaCloudNotFoundClientException extends DeltaCloudClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeltaCloudNotFoundClientException(String message, Throwable clause)
+ {
+ super(message, clause);
+ }
+
+ public DeltaCloudNotFoundClientException(Throwable clause)
+ {
+ super(clause);
+ }
+
+ public DeltaCloudNotFoundClientException(String message)
+ {
+ super(message);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HardwareProfile.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HardwareProfile.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.Property.Names;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+public class HardwareProfile extends IdAware {
+ private static final long serialVersionUID = 1L;
+
+ private List<Property> properties;
+
+ public HardwareProfile() {
+ }
+
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+
+ public List<Property> getProperties() {
+ if (properties == null)
+ properties = new ArrayList<Property>();
+ return properties;
+ }
+
+ public Property getNamedProperty(Names nameEnum) {
+ if (nameEnum == null) {
+ return null;
+ }
+ return getNamedProperty(nameEnum.name().toLowerCase());
+ }
+
+ public Property getNamedProperty(String name) {
+ if (properties != null) {
+ for (Property p : properties) {
+ if (p.getName().equals(name))
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public String getArchitecture() {
+ Property p = getNamedProperty(Property.Names.ARCHITECTURE);
+ if (p != null)
+ return p.getValue();
+ return null;
+ }
+
+ public String getMemory() {
+ Property p = getNamedProperty("memory");
+ if (p != null)
+ return p.toString();
+ return null;
+ }
+
+ public String getStorage() {
+ Property p = getNamedProperty("storage");
+ if (p != null)
+ return p.toString();
+ return null;
+ }
+
+ public String getCPU() {
+ Property p = getNamedProperty("cpu");
+ if (p != null)
+ return p.getValue();
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ s += "Hardware-profile:\t\t" + getId() + "\n";
+ for (Property p : properties) {
+ s += p.getName() + ":\t\t" + p.getValue() + "\n";
+ }
+ return s;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpMethod.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpMethod.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpMethod.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,24 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+public enum HttpMethod {
+ GET, POST, PUT, DELETE, HEAD;
+}
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusCode.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusCode.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusCode.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public enum HttpStatusCode {
+
+ OK(200), NOT_FOUND(404), FORBIDDEN(403), UNAUTHORIZED(401);
+
+ private int code;
+
+ private HttpStatusCode(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public boolean isStatus(int statusCode) {
+ return code == statusCode;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusRange.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusRange.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/HttpStatusRange.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public enum HttpStatusRange {
+
+ CLIENT_ERROR(400, 499), SERVER_ERROR(500, 599);
+
+ private int start;
+ private int stop;
+
+ HttpStatusRange(int start, int stop) {
+ this.start = start;
+ this.stop = stop;
+ }
+
+ public boolean isInRange(int statusCode) {
+ return statusCode >= start
+ && statusCode <= stop;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/IdAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/IdAware.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/IdAware.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+public abstract class IdAware {
+
+ protected String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @XmlAttribute
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return "IdAware [id=" + id + "]";
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Image.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Image.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Image.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+
+/**
+ * @author Martyn Taylor
+ */
+public class Image extends IdAware
+{
+ private static final long serialVersionUID = 1L;
+
+ private String ownerId;
+
+ private String name;
+
+ private String description;
+
+ private String architecture;
+
+ public Image()
+ {
+ }
+
+ public void setOwnerId(String ownerId)
+ {
+ this.ownerId = ownerId;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public void setArchitecture(String architecture)
+ {
+ this.architecture = architecture;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getArchitecture()
+ {
+ return architecture;
+ }
+
+ @Override
+ public String toString()
+ {
+ String s = "";
+ s += "Image:\t\t" + getId() + "\n";
+ s += "Owner:\t\t" + getOwnerId() + "\n";
+ s += "Name:\t\t" + getName() + "\n";
+ s += "Desc:\t\t" + getDescription() + "\n";
+ s += "Arch:\t\t" + getArchitecture() + "\n";
+ return s;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Instance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Instance.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Instance.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.unmarshal.InstanceUnmarshaller;
+
+/**
+ * @author Martyn Taylor
+ * @author Andre Dietisheim
+ */
+public class Instance extends StateAware<Instance> {
+
+ private static final long serialVersionUID = 1L;
+
+ private String ownerId;
+
+ private String name;
+
+ private String imageId;
+
+ private String profileId;
+
+ private String memory;
+
+ private String storage;
+
+ private String cpu;
+
+ private String realmId;
+
+ private String keyId;
+
+ private AddressList publicAddresses;
+
+ private AddressList privateAddresses;
+
+ public Instance() {
+ }
+
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setImageId(String imageId) {
+ this.imageId = imageId;
+ }
+
+ public void setProfileId(String profileId) {
+ this.profileId = profileId;
+ }
+
+ protected void setMemory(String memory) {
+ this.memory = memory;
+ }
+
+ protected void setStorage(String storage) {
+ this.storage = storage;
+ }
+
+ protected void setCPU(String cpu) {
+ this.cpu = cpu;
+ }
+
+ public void setRealmId(String realmId) {
+ this.realmId = realmId;
+ }
+
+ public void setKeyId(String keyId) {
+ this.keyId = keyId;
+ }
+
+ public String getKeyId() {
+ return keyId;
+ }
+
+ public void setPrivateAddresses(AddressList privateAddresses) {
+ this.privateAddresses = privateAddresses;
+ }
+
+ public void setPublicAddresses(AddressList publicAddresses) {
+ this.publicAddresses = publicAddresses;
+ }
+
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ public String getProfileId() {
+ return profileId;
+ }
+
+ public String getMemory() {
+ return memory;
+ }
+
+ public String getStorage() {
+ return storage;
+ }
+
+ public String getCPU() {
+ return cpu;
+ }
+
+ public String getRealmId() {
+ return realmId;
+ }
+
+ public List<String> getPublicAddresses() {
+ return publicAddresses.getAddress();
+ }
+
+ public List<String> getPrivateAddresses() {
+ return privateAddresses.getAddress();
+ }
+
+ @Override
+ protected void doUpdate(InputStream in) throws DeltaCloudClientException {
+ new InstanceUnmarshaller().unmarshall(in, this);
+ }
+
+
+ @Override
+ public String toString() {
+ String s = "";
+ s += "Instance:\t" + getId() + "\n";
+ s += "Owner:\t\t" + getOwnerId() + "\n";
+ s += "Image:\t\t" + getImageId() + "\n";
+ s += "Realm:\t\t" + getRealmId() + "\n";
+ s += "Profile:\t\t" + getProfileId() + "\n";
+ if (getMemory() != null)
+ s += "Memory:\t\t" + getMemory() + "\n";
+ if (getStorage() != null) {
+ s += "Storage:\t\t" + getStorage() + "\n";
+ }
+ if (getCPU() != null) {
+ s += "CPU:\t\t" + getCPU() + "\n";
+ }
+ s += "State:\t\t" + getState() + "\n";
+
+ List<Action<Instance>> actions = getActions();
+ if (actions != null) {
+ for (int i = 0; i < actions.size(); i++) {
+ if (i == 0) {
+ s += "Actions:\t" + actions.get(i) + "\n";
+ } else {
+ s += "\t\t" + actions.get(i) + "\n";
+ }
+ }
+ }
+
+ for (int i = 0; i < publicAddresses.getAddress().size(); i++) {
+ if (i == 0) {
+ s += "Public Addr:\t" + publicAddresses.getAddress().get(i) + "\n";
+ } else {
+ s += "\t\t" + publicAddresses.getAddress().get(i) + "\n";
+ }
+ }
+
+ for (int i = 0; i < publicAddresses.getAddress().size(); i++) {
+ if (i == 0) {
+ s += "Private Addr:\t" + publicAddresses.getAddress().get(i) + "\n";
+ } else {
+ s += "\t\t" + privateAddresses.getAddress().get(i) + "\n";
+ }
+ }
+
+ return s;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Key.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Key.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Key.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.tools.deltacloud.client.unmarshal.KeyUnmarshaller;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class Key extends StateAware<Key> {
+
+ private static final long serialVersionUID = 1L;
+
+ private URL url;
+ private String pem;
+ private String fingerprint;
+ private String state;
+
+ public Key() {
+ }
+
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+ public void setUrl(String url) throws MalformedURLException {
+ this.url = new URL(url);
+ }
+
+ public void setPem(String pem) {
+ this.pem = pem;
+ }
+
+ public void setFingerprint(String fingerprint) {
+ this.fingerprint = fingerprint;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public String getFingerprint() {
+ return fingerprint;
+ }
+
+ public String getPem() {
+ return pem;
+ }
+
+ @Override
+ protected void doUpdate(InputStream in) throws DeltaCloudClientException {
+ new KeyUnmarshaller().unmarshall(in, this);
+ }
+
+ @Override
+ public String toString() {
+ return "Key [url=" + url + ", pem=" + pem + ", fingerprint=" + fingerprint + ", state=" + state + ", actions="
+ + getActions() + ", toString()=" + super.toString() + "]";
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Property.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Property.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Property.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+import java.util.List;
+
+/**
+ * @author Martyn Taylor
+ */
+public class Property extends IdAware {
+
+ private static final long serialVersionUID = 1L;
+
+ public static enum Kind {
+ FIXED, RANGE, ENUM
+ };
+
+ public static enum Names {
+ MEMORY, STORAGE, CPU, ARCHITECTURE
+ }
+
+ public static enum UNIT {
+ MB {
+ public boolean matches(String value) {
+ return name().equals(value);
+ }},
+ GB{
+ public boolean matches(String value) {
+ return name().equals(value);
+ }},
+ LABEL{
+ public boolean matches(String value) {
+ return name().toLowerCase().equals(value);
+ }},
+ COUNT{
+ public boolean matches(String value) {
+ return name().toLowerCase().equals(value);
+ }};
+
+ public abstract boolean matches(String value);
+ }
+
+ public class Range {
+ private String first;
+ private String last;
+
+ public Range(String first, String last) {
+ this.first = first;
+ this.last = last;
+ }
+
+ public String getFirst() {
+ return first;
+ }
+
+ public String getLast() {
+ return last;
+ }
+ }
+
+ public Property() {
+ }
+
+ private String kind;
+
+ private String unit;
+
+ private String name;
+
+ private String value;
+
+ // For range
+ private String first;
+ private String last;
+
+ // For enum
+ private List<String> enums;
+
+ public String getKind() {
+ return kind;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public Range getRange() {
+ return new Range(first, last);
+ }
+
+ public List<String> getEnums() {
+ return enums;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public void setKind(String kind) {
+ this.kind = kind;
+ }
+
+ public void setRange(String first, String last) {
+ this.first = first;
+ this.last = last;
+ }
+
+ public void setEnums(List<String> enums) {
+ this.enums = enums;
+ }
+
+ public String toString() {
+ if (kind.equals("range")) {
+ // return first += "-" + last + "(default:" + value + ")";
+ return new StringBuilder()
+ .append(first)
+ .append('-').append(last)
+ .append("(default: ").append(value).append(")")
+ .toString();
+ } else if (kind.equals("enum")) {
+ String s = enums.get(0);
+ for (int i = 1; i < enums.size(); ++i) {
+ s += ", " + enums.get(i);
+ }
+ s += " (default:" + value + ")";
+ return s;
+ } else {
+ // return value += " " + (unit.equals("label") ? "" : unit);
+ StringBuilder builder = new StringBuilder();
+ builder.append(value);
+ if (!UNIT.LABEL.matches(unit)) {
+ builder.append(' ').append(unit);
+ }
+ return builder.toString();
+ }
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Realm.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Realm.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/Realm.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+public class Realm extends IdAware {
+ private static final long serialVersionUID = 1L;
+
+ public static final int LIMIT_DEFAULT = -1;
+
+ private String name;
+ private RealmState state;
+ private int limit;
+
+ public static enum RealmState {
+ AVAILABLE, UNAVAILABLE, UNKNOWN
+ }
+
+ public Realm() {
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public void setLimit(int limit) {
+ this.limit = limit;
+ }
+
+ public void setLimit(String limit) {
+ try {
+ this.limit = Integer.parseInt(limit);
+ } catch (Exception e) {
+ this.limit = LIMIT_DEFAULT;
+ }
+ }
+
+ public int getLimit() {
+ return limit;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setState(String state) {
+ try {
+ this.state = RealmState.valueOf(state.toUpperCase());
+ } catch (Exception e) {
+ this.state = RealmState.UNKNOWN;
+ }
+ }
+
+ public RealmState getState() {
+ return state;
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ s += "Realm:\t\t" + getId() + "\n";
+ s += "Name\t\t" + getName() + "\n";
+ s += "State:\t\t" + getState() + "\n";
+ s += "Limit:\t\t" + getLimit() + "\n";
+ return s;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ResourceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ResourceAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/ResourceAction.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+
+/**
+ * @author André Dietisheim
+ */
+public interface ResourceAction<OWNER> {
+
+ public static final String DESTROY = "destroy";
+
+ public String getName();
+
+ public String getUrl();
+
+ public HttpMethod getMethod();
+
+ public OWNER getOwner();
+
+ public boolean isDestroy();
+}
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/StateAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/StateAware.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/StateAware.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client;
+
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <OWNER>
+ */
+public abstract class StateAware<OWNER> extends ActionAware<OWNER> {
+
+ public static enum State {
+ RUNNING, STOPPED, PENDING, TERMINATED, BOGUS
+ };
+
+ private State state;
+
+ public void setState(String state) {
+ try {
+ this.state = State.valueOf(state);
+ } catch (Exception e) {
+ this.state = State.BOGUS;
+ }
+ }
+
+ public State getState() {
+ return state;
+ }
+
+ public boolean isRunning() {
+ return getState() == State.RUNNING;
+ }
+
+ public boolean isStopped() {
+ return getState() == State.STOPPED;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractDeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractDeltaCloudRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractDeltaCloudRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractDeltaCloudRequest implements DeltaCloudRequest {
+
+ private String urlString;
+ private URL url;
+ private HttpMethod httpMethod;
+ private UrlBuilder urlBuilder;
+
+ protected AbstractDeltaCloudRequest(String baseURL, HttpMethod httpMethod) {
+ this.httpMethod = httpMethod;
+ this.urlBuilder = createUrlBuilder(baseURL);
+ }
+
+ protected abstract String doCreateUrl(UrlBuilder urlBuilder);
+
+ protected UrlBuilder createUrlBuilder(String baseUrl) {
+ return new UrlBuilder(baseUrl).path(API_PATH_SEGMENT);
+ }
+
+ public URL getUrl() throws MalformedURLException {
+ if (url == null) {
+ this.url = new URL(getUrlString());
+ }
+ return url;
+ }
+
+ public String getUrlString() {
+ if (urlString == null) {
+ this.urlString = doCreateUrl(urlBuilder);
+ }
+ return urlString;
+ }
+
+ public String toString() {
+ return getUrlString();
+ }
+
+ public HttpMethod getHttpMethod() {
+ return httpMethod;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractListObjectsRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractListObjectsRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/AbstractListObjectsRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Lists images, instances, realms or profiles on the deltacloud server.
+ *
+ * @see ListRealmRequest
+ * @see ListHardwareProfilesRequest
+ * @see ListHardwareProfilesRequest
+ * @see ListInstancesRequest
+ *
+ * @author André Dietisheim
+ */
+public abstract class AbstractListObjectsRequest extends AbstractDeltaCloudRequest {
+
+ private String objectType;
+
+ public AbstractListObjectsRequest(String baseUrl, String objectType) {
+ super(baseUrl, HttpMethod.GET);
+ this.objectType = objectType;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path(objectType).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateInstanceRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateInstanceRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Creates a new instance
+ *
+ * @author André Dietisheim
+ */
+public class CreateInstanceRequest extends AbstractDeltaCloudRequest {
+
+ private String name;
+ private String imageId;
+ private String profileId;
+ private String realmId;
+ private String keyname;
+ private String memory;
+ private String storage;
+
+ public CreateInstanceRequest(String baseUrl, String imageId) {
+ this(baseUrl, null, imageId, null, null, null, null, null);
+ }
+
+ public CreateInstanceRequest(String baseUrl, String name, String imageId, String profileId, String realmId,
+ String keyId, String memory, String storage) {
+ super(baseUrl, HttpMethod.POST);
+ this.name = name;
+ this.imageId = imageId;
+ this.profileId = profileId;
+ this.realmId = realmId;
+ this.keyname = keyId;
+ this.memory = memory;
+ this.storage = storage;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("instances")
+ .parameter("keyname", keyname)
+ // WORKAROUND for JBIDE-8005, STEAM-303
+ .parameter("key_name", keyname)
+ // WORKAROUND for JBIDE-8005, STEAM-303
+ .parameter("name", name)
+ .parameter("image_id", imageId)
+ .parameter("hwp_id", profileId)
+ .parameter("realm_id", realmId)
+ .parameter("hwp_memory", memory)
+ .parameter("hwp_storage", storage)
+ .parameter("commit", "create")
+ .toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateKeyRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/CreateKeyRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Creates a key on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class CreateKeyRequest extends AbstractDeltaCloudRequest {
+
+ private String keyName;
+
+ public CreateKeyRequest(String baseUrl, String keyName) {
+ super(baseUrl, HttpMethod.POST);
+ this.keyName = keyName;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("keys")
+ .parameter("name", keyName)
+ .parameter("commit", "create")
+ .toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/DeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/DeltaCloudRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/DeltaCloudRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+
+/**
+ * @author André Dietisheim
+ */
+public interface DeltaCloudRequest {
+
+ public static final char PATH_SEPARATOR = '/';
+ public static final char PARAMETER_SEPARATOR = '?';
+ public static final String API_PATH_SEGMENT = "api";
+
+ public URL getUrl() throws MalformedURLException;
+
+ public String getUrlString();
+
+ public HttpMethod getHttpMethod();
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfileRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfileRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfileRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * A request for a hardware profile on a deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListHardwareProfileRequest extends AbstractDeltaCloudRequest {
+
+ private String profileId;
+
+ /**
+ * Instantiates a new type request.
+ *
+ * @param baseUrl the base url
+ * @param imageId
+ */
+ public ListHardwareProfileRequest(String baseUrl, String profileId) {
+ super(baseUrl, HttpMethod.GET);
+ this.profileId = profileId;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("hardware_profiles").path(profileId).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfilesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfilesRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListHardwareProfilesRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+/**
+ * Lists profiles on the deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListHardwareProfilesRequest extends AbstractListObjectsRequest {
+
+ public ListHardwareProfilesRequest(String baseUrl) {
+ super(baseUrl, "hardware_profiles");
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImageRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImageRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImageRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+
+/**
+ * A request for an image on a deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListImageRequest extends AbstractDeltaCloudRequest {
+
+ private String imageId;
+
+ public ListImageRequest(String baseUrl, String imageId) {
+ super(baseUrl, HttpMethod.GET);
+ this.imageId = imageId;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("images").path(imageId).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImagesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImagesRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListImagesRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+/**
+ * Lists images on the deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListImagesRequest extends AbstractListObjectsRequest {
+
+ public ListImagesRequest(String baseUrl) {
+ super(baseUrl, "images");
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstanceRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstanceRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Lists an instance on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class ListInstanceRequest extends AbstractDeltaCloudRequest {
+
+ private String instanceId;
+
+ public ListInstanceRequest(String baseUrl, String instanceId) {
+ super(baseUrl, HttpMethod.GET);
+ this.instanceId = instanceId;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("instances").path(instanceId).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstancesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstancesRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListInstancesRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+/**
+ * Lists instances on the deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListInstancesRequest extends AbstractListObjectsRequest {
+
+ public ListInstancesRequest(String baseUrl) {
+ super(baseUrl, "instances");
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeyRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeyRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * List a key with a given name that is available on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class ListKeyRequest extends AbstractDeltaCloudRequest {
+
+ private String name;
+
+ public ListKeyRequest(String baseUrl, String name) {
+ super(baseUrl, HttpMethod.GET);
+ this.name = name;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("keys").path(name).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeysRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeysRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListKeysRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Lists keys available on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class ListKeysRequest extends AbstractDeltaCloudRequest {
+
+ public ListKeysRequest(String baseUrl) {
+ super(baseUrl, HttpMethod.GET);
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("keys").toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Lists a realm on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class ListRealmRequest extends AbstractDeltaCloudRequest {
+
+ private String realmId;
+
+ public ListRealmRequest(String baseUrl, String realmId) {
+ super(baseUrl, HttpMethod.GET);
+ this.realmId = realmId;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("realms").path(realmId).toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmsRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmsRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/ListRealmsRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+/**
+ * Lists realms on the deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class ListRealmsRequest extends AbstractListObjectsRequest {
+
+ public ListRealmsRequest(String baseUrl) {
+ super(baseUrl, "realms");
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/PerformActionRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/PerformActionRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/PerformActionRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * Performs an action on a resource of the deltacloud server. The typical
+ * actions are
+ * <ul>
+ * <li>START</li>
+ * <li>STOP</li>
+ * <li>DESTROY</li>
+ * <li>REBOOT</li>
+ * </ul>
+ *
+ * @author André Dietisheim
+ *
+ * @see Action
+ */
+public class PerformActionRequest extends AbstractDeltaCloudRequest {
+
+ public PerformActionRequest(String url, HttpMethod httpMethod) {
+ super(url, httpMethod);
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.toString();
+ }
+
+ @Override
+ protected UrlBuilder createUrlBuilder(String baseURL) {
+ return new UrlBuilder(baseURL);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/TypeRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/TypeRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/request/TypeRequest.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.request;
+
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.utils.UrlBuilder;
+
+/**
+ * A request for the type of deltacloud server.
+ *
+ * @author André Dietisheim
+ */
+public class TypeRequest extends AbstractDeltaCloudRequest {
+
+ public TypeRequest(String baseUrl) {
+ super(baseUrl, HttpMethod.GET);
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.parameter("format", "xml").toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/AbstractHttpTransport.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/AbstractHttpTransport.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/AbstractHttpTransport.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.transport;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudAuthClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpStatusCode;
+import org.jboss.tools.deltacloud.client.HttpStatusRange;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractHttpTransport implements IHttpTransport {
+
+ private String username;
+ private String password;
+
+ public AbstractHttpTransport(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ @Override
+ public final InputStream request(DeltaCloudRequest request) throws DeltaCloudClientException {
+ try {
+ return doRequest(request);
+ } catch (MalformedURLException e) {
+ throw new DeltaCloudClientException(MessageFormat.format(
+ "Could not connect to \"{0}\". The url is invalid.", request.getUrlString()), e);
+ } catch(DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ protected abstract InputStream doRequest(DeltaCloudRequest request) throws Exception;
+
+ protected void throwOnHttpErrors(int statusCode, String statusMessage, URL requestUrl)
+ throws DeltaCloudClientException {
+ if (HttpStatusCode.OK.isStatus(statusCode)) {
+ return;
+ } else if (HttpStatusCode.UNAUTHORIZED.isStatus(statusCode)) {
+ throw new DeltaCloudAuthClientException(
+ MessageFormat.format("The server reported an authorization error \"{0}\" on requesting \"{1}\"",
+ statusMessage, requestUrl));
+ } else if (HttpStatusCode.NOT_FOUND.isStatus(statusCode)) {
+ throw new DeltaCloudNotFoundClientException(MessageFormat.format(
+ "The server could not find the resource \"{0}\"",
+ requestUrl));
+ } else if (HttpStatusRange.CLIENT_ERROR.isInRange(statusCode)
+ || HttpStatusRange.SERVER_ERROR.isInRange(statusCode)) {
+ throw new DeltaCloudClientException(
+ MessageFormat.format("The server reported an error \"{0}\" on requesting \"{1}\"",
+ statusMessage, requestUrl));
+ }
+ }
+
+ protected String getUsername() {
+ return username;
+ }
+
+ protected String getPassword() {
+ return password;
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/Base64Coder.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/Base64Coder.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/Base64Coder.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,226 @@
+// Copyright 2003-2010 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
+// www.source-code.biz, www.inventec.ch/chdh
+//
+// This module is multi-licensed and may be used under the terms
+// of any of the following licenses:
+//
+// EPL, Eclipse Public License, V1.0 or later, http://www.eclipse.org/legal
+// LGPL, GNU Lesser General Public License, V2.1 or later, http://www.gnu.org/licenses/lgpl.html
+// GPL, GNU General Public License, V2 or later, http://www.gnu.org/licenses/gpl.html
+// AL, Apache License, V2.0 or later, http://www.apache.org/licenses
+// BSD, BSD License, http://www.opensource.org/licenses/bsd-license.php
+//
+// Please contact the author if you need another license.
+// This module is provided "as is", without warranties of any kind.
+
+package org.jboss.tools.deltacloud.client.transport;
+
+/**
+* A Base64 encoder/decoder.
+*
+* <p>
+* This class is used to encode and decode data in Base64 format as described in RFC 1521.
+*
+* <p>
+* Project home page: <a href="http://www.source-code.biz/base64coder/java/">www.source-code.biz/base64coder/java</a><br>
+* Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland<br>
+* Multi-licensed: EPL / LGPL / GPL / AL / BSD.
+*/
+public class Base64Coder {
+
+// The line separator string of the operating system.
+private static final String systemLineSeparator = System.getProperty("line.separator");
+
+// Mapping table from 6-bit nibbles to Base64 characters.
+private static char[] map1 = new char[64];
+ static {
+ int i=0;
+ for (char c='A'; c<='Z'; c++) map1[i++] = c;
+ for (char c='a'; c<='z'; c++) map1[i++] = c;
+ for (char c='0'; c<='9'; c++) map1[i++] = c;
+ map1[i++] = '+'; map1[i++] = '/'; }
+
+// Mapping table from Base64 characters to 6-bit nibbles.
+private static byte[] map2 = new byte[128];
+ static {
+ for (int i=0; i<map2.length; i++) map2[i] = -1;
+ for (int i=0; i<64; i++) map2[map1[i]] = (byte)i; }
+
+/**
+* Encodes a string into Base64 format.
+* No blanks or line breaks are inserted.
+* @param s A String to be encoded.
+* @return A String containing the Base64 encoded data.
+*/
+public static String encodeString (String s) {
+ return new String(encode(s.getBytes())); }
+
+/**
+* Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters.
+* This method is compatible with <code>sun.misc.BASE64Encoder.encodeBuffer(byte[])</code>.
+* @param in An array containing the data bytes to be encoded.
+* @return A String containing the Base64 encoded data, broken into lines.
+*/
+public static String encodeLines (byte[] in) {
+ return encodeLines(in, 0, in.length, 76, systemLineSeparator); }
+
+/**
+* Encodes a byte array into Base 64 format and breaks the output into lines.
+* @param in An array containing the data bytes to be encoded.
+* @param iOff Offset of the first byte in <code>in</code> to be processed.
+* @param iLen Number of bytes to be processed in <code>in</code>, starting at <code>iOff</code>.
+* @param lineLen Line length for the output data. Should be a multiple of 4.
+* @param lineSeparator The line separator to be used to separate the output lines.
+* @return A String containing the Base64 encoded data, broken into lines.
+*/
+public static String encodeLines (byte[] in, int iOff, int iLen, int lineLen, String lineSeparator) {
+ int blockLen = (lineLen*3) / 4;
+ if (blockLen <= 0) throw new IllegalArgumentException();
+ int lines = (iLen+blockLen-1) / blockLen;
+ int bufLen = ((iLen+2)/3)*4 + lines*lineSeparator.length();
+ StringBuilder buf = new StringBuilder(bufLen);
+ int ip = 0;
+ while (ip < iLen) {
+ int l = Math.min(iLen-ip, blockLen);
+ buf.append (encode(in, iOff+ip, l));
+ buf.append (lineSeparator);
+ ip += l; }
+ return buf.toString(); }
+
+/**
+* Encodes a byte array into Base64 format.
+* No blanks or line breaks are inserted in the output.
+* @param in An array containing the data bytes to be encoded.
+* @return A character array containing the Base64 encoded data.
+*/
+public static char[] encode (byte[] in) {
+ return encode(in, 0, in.length); }
+
+/**
+* Encodes a byte array into Base64 format.
+* No blanks or line breaks are inserted in the output.
+* @param in An array containing the data bytes to be encoded.
+* @param iLen Number of bytes to process in <code>in</code>.
+* @return A character array containing the Base64 encoded data.
+*/
+public static char[] encode (byte[] in, int iLen) {
+ return encode(in, 0, iLen); }
+
+/**
+* Encodes a byte array into Base64 format.
+* No blanks or line breaks are inserted in the output.
+* @param in An array containing the data bytes to be encoded.
+* @param iOff Offset of the first byte in <code>in</code> to be processed.
+* @param iLen Number of bytes to process in <code>in</code>, starting at <code>iOff</code>.
+* @return A character array containing the Base64 encoded data.
+*/
+public static char[] encode (byte[] in, int iOff, int iLen) {
+ int oDataLen = (iLen*4+2)/3; // output length without padding
+ int oLen = ((iLen+2)/3)*4; // output length including padding
+ char[] out = new char[oLen];
+ int ip = iOff;
+ int iEnd = iOff + iLen;
+ int op = 0;
+ while (ip < iEnd) {
+ int i0 = in[ip++] & 0xff;
+ int i1 = ip < iEnd ? in[ip++] & 0xff : 0;
+ int i2 = ip < iEnd ? in[ip++] & 0xff : 0;
+ int o0 = i0 >>> 2;
+ int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
+ int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
+ int o3 = i2 & 0x3F;
+ out[op++] = map1[o0];
+ out[op++] = map1[o1];
+ out[op] = op < oDataLen ? map1[o2] : '='; op++;
+ out[op] = op < oDataLen ? map1[o3] : '='; op++; }
+ return out; }
+
+/**
+* Decodes a string from Base64 format.
+* No blanks or line breaks are allowed within the Base64 encoded input data.
+* @param s A Base64 String to be decoded.
+* @return A String containing the decoded data.
+* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
+*/
+public static String decodeString (String s) {
+ return new String(decode(s)); }
+
+/**
+* Decodes a byte array from Base64 format and ignores line separators, tabs and blanks.
+* CR, LF, Tab and Space characters are ignored in the input data.
+* This method is compatible with <code>sun.misc.BASE64Decoder.decodeBuffer(String)</code>.
+* @param s A Base64 String to be decoded.
+* @return An array containing the decoded data bytes.
+* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
+*/
+public static byte[] decodeLines (String s) {
+ char[] buf = new char[s.length()];
+ int p = 0;
+ for (int ip = 0; ip < s.length(); ip++) {
+ char c = s.charAt(ip);
+ if (c != ' ' && c != '\r' && c != '\n' && c != '\t')
+ buf[p++] = c; }
+ return decode(buf, 0, p); }
+
+/**
+* Decodes a byte array from Base64 format.
+* No blanks or line breaks are allowed within the Base64 encoded input data.
+* @param s A Base64 String to be decoded.
+* @return An array containing the decoded data bytes.
+* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
+*/
+public static byte[] decode (String s) {
+ return decode(s.toCharArray()); }
+
+/**
+* Decodes a byte array from Base64 format.
+* No blanks or line breaks are allowed within the Base64 encoded input data.
+* @param in A character array containing the Base64 encoded data.
+* @return An array containing the decoded data bytes.
+* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
+*/
+public static byte[] decode (char[] in) {
+ return decode(in, 0, in.length); }
+
+/**
+* Decodes a byte array from Base64 format.
+* No blanks or line breaks are allowed within the Base64 encoded input data.
+* @param in A character array containing the Base64 encoded data.
+* @param iOff Offset of the first character in <code>in</code> to be processed.
+* @param iLen Number of characters to process in <code>in</code>, starting at <code>iOff</code>.
+* @return An array containing the decoded data bytes.
+* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
+*/
+public static byte[] decode (char[] in, int iOff, int iLen) {
+ if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4.");
+ while (iLen > 0 && in[iOff+iLen-1] == '=') iLen--;
+ int oLen = (iLen*3) / 4;
+ byte[] out = new byte[oLen];
+ int ip = iOff;
+ int iEnd = iOff + iLen;
+ int op = 0;
+ while (ip < iEnd) {
+ int i0 = in[ip++];
+ int i1 = in[ip++];
+ int i2 = ip < iEnd ? in[ip++] : 'A';
+ int i3 = ip < iEnd ? in[ip++] : 'A';
+ if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
+ throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
+ int b0 = map2[i0];
+ int b1 = map2[i1];
+ int b2 = map2[i2];
+ int b3 = map2[i3];
+ if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
+ throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
+ int o0 = ( b0 <<2) | (b1>>>4);
+ int o1 = ((b1 & 0xf)<<4) | (b2>>>2);
+ int o2 = ((b2 & 3)<<6) | b3;
+ out[op++] = (byte)o0;
+ if (op<oLen) out[op++] = (byte)o1;
+ if (op<oLen) out[op++] = (byte)o2; }
+ return out; }
+
+// Dummy constructor.
+private Base64Coder() {}
+
+} // end class Base64Coder
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/IHttpTransport.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/IHttpTransport.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/IHttpTransport.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.transport;
+
+import java.io.InputStream;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
+
+/**
+ * An interface for http transport implementation to be used by the
+ * DeltaCloudClient.
+ *
+ * @author André Dietisheim
+ * @see URLConnectionTransport
+ */
+public interface IHttpTransport {
+
+ public InputStream request(DeltaCloudRequest request) throws DeltaCloudClientException;
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/URLConnectionTransport.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/URLConnectionTransport.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/transport/URLConnectionTransport.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.deltacloud.client.transport;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.MessageFormat;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
+
+public class URLConnectionTransport extends AbstractHttpTransport {
+
+ private static final char USERNAME_PASSWORD_DELIMITER = ':';
+ private static final String PROPERTY_AUTHORIZATION = "Authorization";
+ private static final String PROPERTY_ACCEPT = "Accept";
+ private static final String PREFIX_BASIC_AUTHENTICATION = "Basic ";
+ private static final int TIMEOUT = 10 * 1024;
+ private static final String RESPONSE_CODE_PREFIX = "HTTP response code: ";
+ private static final int RESPONSE_CODE_LENGTH = 3;
+
+ public URLConnectionTransport(String username, String password) {
+ super(username, password);
+ }
+
+ @Override
+ protected InputStream doRequest(DeltaCloudRequest request) throws Exception {
+ try {
+ URL url = request.getUrl();
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(TIMEOUT);
+ connection.setRequestProperty(PROPERTY_ACCEPT, "application/xml;q=1");
+ connection.setInstanceFollowRedirects(true);
+ addCredentials(connection);
+ setRequestMethod(request, connection);
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ throwOnHttpErrors(
+ connection.getResponseCode(), connection.getResponseMessage(), request.getUrl());
+ return in;
+ } catch (FileNotFoundException e) {
+ /*
+ * thrown by #connect when server resonds with 404
+ */
+ throw new DeltaCloudNotFoundClientException(
+ MessageFormat.format("Could not find resource {0}", request.getUrlString()));
+ }
+ }
+
+ private void setRequestMethod(DeltaCloudRequest request, HttpURLConnection connection) throws IOException {
+ HttpMethod httpMethod = request.getHttpMethod();
+ connection.setRequestMethod(httpMethod.name());
+ switch (httpMethod) {
+ case PUT:
+ case POST:
+ connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+ connection.setRequestProperty("Content-Length", "0");// String.valueOf(request.getParametersLength()));
+ connection.setDoOutput(true);
+ connection.getOutputStream().flush();
+ break;
+ case GET:
+ connection.setDoOutput(false);
+ break;
+ }
+
+ }
+
+ /**
+ * Adds the credentials to the given http url connection.
+ *
+ * The current implementation uses low level API. Alternatively
+ * {@link Authenticator#setDefault(Authenticator)} could be used which would
+ * then rule all url connections in the same jvm.
+ *
+ * @param httpClient
+ * the http client
+ * @return the default http client
+ * @throws IOException
+ */
+ private void addCredentials(URLConnection urlConnection) throws IOException {
+ String username = getUsername();
+ String password = getPassword();
+ if (username != null && password != null) {
+ String credentials = new StringBuilder()
+ .append(PREFIX_BASIC_AUTHENTICATION)
+ .append(getAuthenticationValue(username, password))
+ .toString();
+ urlConnection.setRequestProperty(PROPERTY_AUTHORIZATION, credentials);
+ }
+
+ }
+
+ private String getAuthenticationValue(String username, String password) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ out.write(username.getBytes());
+ out.write(USERNAME_PASSWORD_DELIMITER);
+ out.write(password.getBytes());
+ char[] encoded = Base64Coder.encode(out.toByteArray());
+ return new String(encoded);
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/APIUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/APIUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/APIUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.API;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class APIUnmarshaller extends AbstractDOMUnmarshaller<API> {
+
+ public APIUnmarshaller() {
+ super("api", API.class);
+ }
+
+ protected API doUnmarshall(Element element, API server) throws Exception {
+ if (element != null) {
+ server.setDriver(getAttributeText("driver", element));
+ }
+ return server;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractActionAwareUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractActionAwareUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractActionAwareUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <DELTACLOUDOBJECT>
+ */
+public abstract class AbstractActionAwareUnmarshaller<DELTACLOUDOBJECT> extends AbstractDOMUnmarshaller<DELTACLOUDOBJECT>{
+
+ private String actionElementName;
+ public AbstractActionAwareUnmarshaller(String tagName, Class<DELTACLOUDOBJECT> type, String actionElementName) {
+ super(tagName, type);
+ this.actionElementName = actionElementName;
+ }
+
+ protected List<Action<DELTACLOUDOBJECT>> getActions(Element element, DELTACLOUDOBJECT owner) throws DeltaCloudClientException {
+ if (element == null) {
+ return null;
+ }
+ List<Action<DELTACLOUDOBJECT>> actions = new ArrayList<Action<DELTACLOUDOBJECT>>();
+ NodeList nodeList = element.getElementsByTagName(actionElementName);
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node linkNode = nodeList.item(i);
+ Action<DELTACLOUDOBJECT> action = createAction(linkNode);
+ if (action != null) {
+ action.setOwner(owner);
+ actions.add(action);
+ }
+ }
+ return actions;
+ }
+
+ protected Action<DELTACLOUDOBJECT> createAction(Node node) throws DeltaCloudClientException {
+ if (!(node instanceof Element)) {
+ return null;
+ }
+ return unmarshallAction((Element) node);
+ }
+
+ protected abstract Action<DELTACLOUDOBJECT> unmarshallAction(Element element) throws DeltaCloudClientException;
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDOMUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDOMUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDOMUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <DELTACLOUDOBJECT>
+ */
+public abstract class AbstractDOMUnmarshaller<DELTACLOUDOBJECT> {
+
+ private Class<DELTACLOUDOBJECT> type;
+ private String tagName;
+
+ public AbstractDOMUnmarshaller(String tagName, Class<DELTACLOUDOBJECT> type) {
+ this.type = type;
+ this.tagName = tagName;
+ }
+
+ public DELTACLOUDOBJECT unmarshall(InputStream inputStream, DELTACLOUDOBJECT deltacloudObject) throws DeltaCloudClientException {
+ try {
+ Element element = getFirstElement(tagName, getDocument(inputStream));
+ if (element == null) {
+ return null;
+ }
+ return unmarshall(element, deltacloudObject);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not unmarshall type \"{0}\"", type), e);
+ }
+
+ }
+
+ protected Document getDocument(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = factory.newDocumentBuilder();
+ return documentBuilder.parse(inputStream);
+ }
+
+ public DELTACLOUDOBJECT unmarshall(Element element, DELTACLOUDOBJECT resource) throws DeltaCloudClientException {
+ try {
+ return doUnmarshall(element, resource);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not unmarshall type \"{0}\"", type), e);
+ }
+ }
+
+ protected abstract DELTACLOUDOBJECT doUnmarshall(Element element, DELTACLOUDOBJECT resource) throws Exception;
+
+ protected String getFirstElementAttributeText(String elementName, String attributeId, Element element) {
+ Element firstElement = getFirstElement(elementName, element);
+ if (firstElement == null) {
+ return null;
+ }
+ return firstElement.getAttribute(attributeId);
+ }
+
+ protected String getFirstElementText(String elementName, Element element) {
+ Element firstElement = getFirstElement(elementName, element);
+ if (firstElement == null) {
+ return null;
+ }
+ return firstElement.getTextContent();
+ }
+
+ protected Element getFirstElement(String elementName, Element element) {
+ NodeList elements = element.getElementsByTagName(elementName);
+ if (elements != null
+ && elements.getLength() > 0) {
+ return (Element) elements.item(0);
+ }
+ return null;
+ }
+
+ protected Element getFirstElement(String elementName, Document document) {
+ NodeList elements = document.getElementsByTagName(elementName);
+ if (elements != null
+ && elements.getLength() > 0) {
+ return (Element) elements.item(0);
+ }
+ return null;
+ }
+
+ protected String getAttributeText(String attributeName, Element element) {
+ Node attribute = element.getAttributeNode(attributeName);
+ if (attribute != null) {
+ return attribute.getTextContent();
+ }
+ return null;
+ }
+
+ protected String stripText(String textContent) {
+ if (textContent == null || textContent.length() == 0) {
+ return textContent;
+ }
+ return textContent.trim();
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <RESOURCE>
+ */
+public abstract class AbstractDeltaCloudObjectUnmarshaller<RESOURCE> implements IDeltaCloudObjectUnmarshaller<RESOURCE> {
+
+ private Class<RESOURCE> type;
+
+ public AbstractDeltaCloudObjectUnmarshaller(Class<RESOURCE> type) {
+ this.type = type;
+ }
+
+ public RESOURCE create(InputStream inputStream) throws DeltaCloudClientException {
+
+ try {
+ return doCreate(inputStream);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not unmarshall resource of type \"{0}\"", type), e);
+ }
+ }
+
+ protected abstract RESOURCE doCreate(InputStream inputStream) throws Exception;
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectsUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectsUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/AbstractDeltaCloudObjectsUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+@SuppressWarnings("rawtypes")
+public abstract class AbstractDeltaCloudObjectsUnmarshaller<CHILD> extends AbstractDOMUnmarshaller<List> {
+
+ private String childTag;
+
+ public AbstractDeltaCloudObjectsUnmarshaller(String parentTag, String childTag) {
+ super(parentTag, List.class);
+ this.childTag = childTag;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List doUnmarshall(Element element, List children) throws Exception {
+ if (element != null) {
+ NodeList nodeList = element.getElementsByTagName(childTag);
+ if (nodeList != null
+ && nodeList.getLength() > 0) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node instanceof Element) {
+ CHILD child = unmarshallChild(node);
+ children.add(child);
+ }
+ }
+ }
+ }
+ return children;
+ }
+
+ protected abstract CHILD unmarshallChild(Node node) throws DeltaCloudClientException;
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ActionUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ActionUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ActionUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class ActionUnmarshaller<OWNER> extends AbstractDOMUnmarshaller<Action<OWNER>> {
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public ActionUnmarshaller() {
+ super("link", (Class) Action.class);
+ }
+
+ @Override
+ protected Action<OWNER> doUnmarshall(Element element, Action<OWNER> action) throws Exception {
+ if (element != null) {
+ action.setMethod(getAttributeText("method", element));
+ action.setName(getAttributeText("rel", element));
+ action.setUrl(getAttributeText("href", element));
+ }
+ return action;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfileUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfileUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfileUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.Property;
+import org.jboss.tools.deltacloud.client.Property.Kind;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfileUnmarshaller extends AbstractDOMUnmarshaller<HardwareProfile> {
+
+ public HardwareProfileUnmarshaller() {
+ super("hardware_profile", HardwareProfile.class);
+ }
+
+ @Override
+ protected HardwareProfile doUnmarshall(Element element, HardwareProfile profile) throws Exception {
+ profile.setId(getAttributeText("id", element));
+ profile.setProperties(createProperties(element.getElementsByTagName("property")));
+ return profile;
+ }
+
+ private List<Property> createProperties(NodeList propertiesList) {
+ List<Property> properties = new ArrayList<Property>();
+ for (int i = 0; i < propertiesList.getLength(); i++) {
+ Property property = createProperty(propertiesList.item(i));
+ properties.add(property);
+ }
+ return properties;
+ }
+
+ private Property createProperty(Node node) {
+ Assert.isTrue(node instanceof Element);
+ Element element = (Element) node;
+ Property property = new Property();
+ property.setName(element.getAttribute("name"));
+ property.setId(element.getAttribute("id"));
+ property.setUnit(element.getAttribute("unit"));
+ property.setValue(element.getAttribute("value"));
+ String kind = element.getAttribute("kind");
+ Assert.isTrue(kind != null);
+ kind = kind.toUpperCase();
+ property.setKind(kind);
+ if (Kind.RANGE.toString().equals(property.getKind())) {
+ setRange(element, property);
+ } else if (Kind.ENUM.toString().equals(property.getKind())) {
+ setEnum(element, property);
+ } else if (Kind.FIXED.toString().equals(property.getKind())) {
+ // no special treatement
+ }
+ return property;
+ }
+
+ private void setRange(Element propertyElement, Property property) {
+ Node node = propertyElement.getElementsByTagName("range").item(0);
+ Assert.isLegal(node instanceof Element);
+ Element rangeElement = (Element) node;
+ property.setRange(rangeElement.getAttribute("first"), rangeElement.getAttribute("last"));
+ }
+
+ private void setEnum(Element propertyElement, Property property) {
+ Node node = propertyElement.getElementsByTagName("enum").item(0);
+ Assert.isLegal(node instanceof Element);
+ Element enumElement = (Element) node;
+ NodeList nodeList = enumElement.getElementsByTagName("entry");
+ ArrayList<String> enumValues = new ArrayList<String>();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node entryNode = nodeList.item(i);
+ Assert.isTrue(entryNode instanceof Element);
+ Element entryElement = (Element) entryNode;
+ enumValues.add(entryElement.getAttribute("value"));
+ }
+ property.setEnums(enumValues);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfilesUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfilesUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/HardwareProfilesUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfilesUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<HardwareProfile> {
+
+ public HardwareProfilesUnmarshaller() {
+ super("hardware_profiles", "hardware_profile");
+ }
+
+ @Override
+ protected HardwareProfile unmarshallChild(Node node) throws DeltaCloudClientException {
+ return new HardwareProfileUnmarshaller().unmarshall((Element) node, new HardwareProfile());
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/IDeltaCloudObjectUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/IDeltaCloudObjectUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/IDeltaCloudObjectUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.io.InputStream;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IDeltaCloudObjectUnmarshaller<DELTACLOUDOBJECT> {
+
+ public DELTACLOUDOBJECT unmarshall(InputStream inputStream);
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImageUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImageUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImageUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.Image;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class ImageUnmarshaller extends AbstractDOMUnmarshaller<Image> {
+
+ public ImageUnmarshaller() {
+ super("image", Image.class);
+ }
+
+ protected Image doUnmarshall(Element element, Image image) throws Exception {
+ image.setId(getAttributeText("id", element));
+ image.setName(getFirstElementText("name", element));
+ image.setOwnerId(getFirstElementText("owner_id", element));
+ image.setDescription(getFirstElementText("description", element));
+ image.setArchitecture(getFirstElementText("architecture", element));
+ return image;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImagesUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImagesUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/ImagesUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Image;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class ImagesUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<Image> {
+
+ public ImagesUnmarshaller() {
+ super("images", "image");
+ }
+
+ @Override
+ protected Image unmarshallChild(Node node) throws DeltaCloudClientException {
+ Image image = new ImageUnmarshaller().unmarshall((Element) node, new Image());
+ return image;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstanceUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstanceUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstanceUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.AddressList;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+public class InstanceUnmarshaller extends AbstractActionAwareUnmarshaller<Instance> {
+
+ public InstanceUnmarshaller() {
+ super("instance", Instance.class, "link");
+ }
+
+ protected Instance doUnmarshall(Element element, Instance instance) throws Exception {
+ instance.setId(getAttributeText("id", element));
+ instance.setName(getFirstElementText("name", element));
+ instance.setOwnerId(getFirstElementText("owner_id", element));
+ instance.setOwnerId(getFirstElementText("owner_id", element));
+ instance.setImageId(getFirstElementAttributeText("image", "id", element));
+ instance.setProfileId(getFirstElementAttributeText("hardware_profile", "id", element));
+ instance.setRealmId(getFirstElementAttributeText("realm", "id", element));
+ instance.setState(getFirstElementText("state", element));
+ setKeyname(instance, element);
+ instance.setActions(getActions(element, instance));
+ instance.setPublicAddresses(getAddressList("public_addresses", element));
+ instance.setPrivateAddresses(getAddressList("private_addresses", element));
+ return instance;
+ }
+
+ private AddressList getAddressList(String elementName, Element element) {
+ Element addressElement = getFirstElement(elementName, element);
+ if (addressElement != null) {
+ NodeList addressList = addressElement.getChildNodes();
+ if (addressList != null) {
+ List<String> addresses = new ArrayList<String>();
+ for (int i = 0; i < addressList.getLength(); i++) {
+ Node addressNode = addressList.item(i);
+ if (addressNode != null) {
+ String address = stripText(addressNode.getTextContent());
+ if (address != null && address.length() > 0) {
+ addresses.add(address);
+ }
+ }
+ }
+ return new AddressList(addresses);
+ }
+ }
+ return new AddressList();
+ }
+
+ private void setKeyname(Instance instance, Element element) {
+ Element authenticationElement = getFirstElement("authentication", element);
+ if (authenticationElement != null) {
+ Element loginElement = getFirstElement("login", authenticationElement);
+ if (loginElement != null) {
+ String keyname = getFirstElementText("keyname", loginElement);
+ instance.setKeyId(keyname);
+ }
+ }
+ }
+
+ @Override
+ protected Action<Instance> unmarshallAction(Element element) throws DeltaCloudClientException {
+ Action<Instance> action = new Action<Instance>();
+ new ActionUnmarshaller<Instance>().unmarshall(element, action);
+ return action;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstancesUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstancesUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/InstancesUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class InstancesUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<Instance> {
+
+ public InstancesUnmarshaller() {
+ super("instances", "instance");
+ }
+
+ @Override
+ protected Instance unmarshallChild(Node node) throws DeltaCloudClientException {
+ Instance instance = new InstanceUnmarshaller().unmarshall((Element) node, new Instance());
+ return instance;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeyUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeyUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeyUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Key;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class KeyUnmarshaller extends AbstractActionAwareUnmarshaller<Key> {
+
+ public KeyUnmarshaller() {
+ super("key", Key.class, "link");
+ }
+
+ protected Key doUnmarshall(Element element, Key key) throws Exception {
+ if (element != null) {
+ key.setId(getAttributeText("id", element));
+ key.setUrl(getAttributeText("href", element));
+ key.setState(getFirstElementText("state", element));
+ key.setFingerprint(getFirstElementText("fingerprint", element));
+ key.setPem(trimPem(getPem(element))); //$NON-NLS-1$
+ key.setActions(getActions(element, key));
+ }
+ return key;
+ }
+
+ private String getPem(Element element) {
+ Element pemElement = getFirstElement("pem", element);
+ if (pemElement != null) {
+ return getFirstElementText("pem", pemElement);
+ }
+ return null;
+ }
+
+ private String trimPem(String pem) throws IOException {
+ if (pem == null
+ || pem.length() <= 0) {
+ return null;
+ }
+ StringBuffer sb = new StringBuffer();
+ String line = null;
+ BufferedReader reader = new BufferedReader(new StringReader(pem));
+ while ((line = reader.readLine()) != null) {
+ // We must trim off the white-space from the xml
+ // Complete white-space lines are to be ignored.
+ String trimmedLine = line.trim();
+ if (trimmedLine.length() > 0) {
+ sb.append(trimmedLine).append('\n');
+ }
+ }
+ return sb.toString();
+ }
+
+ @Override
+ protected Action<Key> unmarshallAction(Element element) throws DeltaCloudClientException {
+ Action<Key> keyAction = new Action<Key>();
+ new ActionUnmarshaller<Key>().unmarshall(element, keyAction);
+ return keyAction;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeysUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeysUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/KeysUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Key;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class KeysUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<Key> {
+
+ public KeysUnmarshaller() {
+ super("keys", "key");
+ }
+
+ @Override
+ protected Key unmarshallChild(Node node) throws DeltaCloudClientException {
+ Key key = new KeyUnmarshaller().unmarshall((Element) node, new Key());
+ return key;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.Realm;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class RealmUnmarshaller extends AbstractDOMUnmarshaller<Realm> {
+
+ public RealmUnmarshaller() {
+ super("realm", Realm.class);
+ }
+
+ protected Realm doUnmarshall(Element element, Realm realm) throws Exception {
+ realm.setId(getAttributeText("id", element));
+ realm.setName(getFirstElementText("name", element));
+ realm.setLimit(getFirstElementText("limit", element));
+ realm.setState(getFirstElementText("state", element));
+ return realm;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmsUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmsUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/unmarshal/RealmsUnmarshaller.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.unmarshal;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Realm;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class RealmsUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<Realm> {
+
+ public RealmsUnmarshaller() {
+ super("realms", "realm");
+ }
+
+ @Override
+ protected Realm unmarshallChild(Node node) throws DeltaCloudClientException {
+ return new RealmUnmarshaller().unmarshall((Element) node, new Realm());
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/StringUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/StringUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/StringUtils.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class StringUtils {
+
+ /**
+ * Returns a formatted string for a collection of elements that get
+ * formatted by a user supplied element formatter.
+ *
+ * @param elements
+ * the elements to be processed
+ * @param elements
+ * the elements
+ * @param elementFormatter
+ * the formatter to apply on each element to be processed
+ * @return the formatted string
+ */
+ public static <E> String getFormattedString(Collection<E> elements, IElementFormatter<E> elementFormatter) {
+ StringBuilder builder = new StringBuilder();
+ for (E element : elements) {
+ String formattedElement = elementFormatter.format(element);
+ if (formattedElement != null && formattedElement.length() > 0) {
+ builder.append(formattedElement);
+ }
+ }
+ if (builder.length() > 0) {
+ return builder.toString();
+ } else {
+ return "";
+ }
+ }
+
+ public interface IElementFormatter<E> {
+ public String format(E element);
+ }
+
+ /**
+ * Returns a collection of formatted strings for the given collection of
+ * elements and given formatter
+ *
+ * @param <E>
+ * the type of elements that shall be processed
+ * @param elements
+ * the elements to be processed
+ * @param elementFormatter
+ * the formatter to apply on each element to be processed
+ * @return the formatted strings
+ */
+ public static <E> Collection<String> getFormattedStrings(Collection<E> elements,
+ IElementFormatter<E> elementFormatter) {
+ List<String> strings = new ArrayList<String>();
+ for (E element : elements) {
+ String formattedElement = elementFormatter.format(element);
+ if (formattedElement != null && formattedElement.length() > 0) {
+ strings.add(formattedElement);
+ }
+ }
+ return strings;
+ }
+
+ public static String null2EmptyString(String stringValue) {
+ if (stringValue == null) {
+ return "";
+ }
+ return stringValue;
+ }
+
+ public static String emptyString2Null(String stringValue) {
+ if (stringValue != null
+ && stringValue.length() == 0) {
+ return null;
+ }
+ return stringValue;
+ }
+
+ public static boolean isEmpty(String stringValue) {
+ return stringValue == null || stringValue.isEmpty();
+ }
+
+
+ public static String toString(InputStream inputStream) throws IOException {
+ StringBuilder builder = new StringBuilder();
+ for(int character = -1; (character = inputStream.read()) != -1; ) {
+ builder.append((char) character);
+ }
+ return builder.toString();
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/UrlBuilder.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/UrlBuilder.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/utils/UrlBuilder.java 2011-05-21 14:23:46 UTC (rev 31411)
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+
+package org.jboss.tools.deltacloud.client.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Collection;
+
+/**
+ * A builder for an url. Currently no state checking is done, the user is
+ * responsible to build something that makes sense.
+ *
+ * @author André Dietisheim
+ */
+public class UrlBuilder {
+ private static final String URL_ENCODING = "UTF-8";
+ private static final String HOST_PROTOCOL_DELIMITER = ":";
+ private static final String HTTP_PROTOCOL_PREFIX = "http://";
+ private static final char PARAMETER_URL_DELIMITER = '?';
+ private static final char PARAMETER_DELIMITER = '&';
+ private static final char PARAMETER_NAME_VALUE_DELIMITER = '=';
+ private static final char PATH_SEPARATOR = '/';
+
+ private StringBuilder urlStringBuilder = new StringBuilder();
+
+ private boolean parametersAdded = false;
+
+ public UrlBuilder() {
+ }
+
+ public UrlBuilder(String baseUrl) {
+ urlStringBuilder.append(baseUrl);
+ }
+
+ public UrlBuilder(URL baseUrl) {
+ urlStringBuilder.append(baseUrl.toString());
+ }
+
+ /**
+ * adds a host to .
+ *
+ * @param host
+ * the host
+ *
+ * @return the url builder
+ */
+ public UrlBuilder host(String host) {
+ urlStringBuilder.append(HTTP_PROTOCOL_PREFIX);
+ urlStringBuilder.append(host);
+ return this;
+ }
+
+ /**
+ * Adds a port.
+ *
+ * @param port
+ * the port
+ *
+ * @return the url builder
+ */
+ public UrlBuilder port(Object port) {
+ urlStringBuilder.append(HOST_PROTOCOL_DELIMITER);
+ urlStringBuilder.append(port);
+ return this;
+ }
+
+ /**
+ * adds a path to the url.
+ *
+ * @param path
+ * the path
+ *
+ * @return the url builder
+ */
+ public UrlBuilder path(String path) {
+ urlStringBuilder.append(PATH_SEPARATOR);
+ urlStringBuilder.append(path);
+ return this;
+ }
+
+ public UrlBuilder path(Collection<String> paths) {
+ for (String path : paths) {
+ path(path);
+ }
+ return this;
+ }
+
+ public UrlBuilder parameter(String name, String value) {
+ if (value != null) {
+ appendParameterDelimiter();
+ urlStringBuilder.append(name).append(PARAMETER_NAME_VALUE_DELIMITER).append(urlEncode(value));
+ }
+ return this;
+ }
+
+ private void appendParameterDelimiter() {
+ if (!parametersAdded) {
+ urlStringBuilder.append(PARAMETER_URL_DELIMITER);
+ parametersAdded = true;
+ } else {
+ urlStringBuilder.append(PARAMETER_DELIMITER);
+ }
+ }
+
+ public UrlBuilder parameters(String... parameters) {
+ for (String parameter : parameters) {
+ parameter(parameter);
+ }
+ return this;
+ }
+
+ public UrlBuilder parameter(String parameter) {
+ appendParameterDelimiter();
+ urlStringBuilder.append(urlEncode(parameter));
+ return this;
+ }
+
+ private String urlEncode(String value) {
+ try {
+ return URLEncoder.encode(value, URL_ENCODING);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public URL toUrl() throws MalformedURLException {
+ return new URL(urlStringBuilder.toString());
+ }
+
+ public String toString() {
+ return urlStringBuilder.toString();
+ }
+}
13 years, 4 months
JBoss Tools SVN: r31410 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.client/META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-05-21 10:22:16 -0400 (Sat, 21 May 2011)
New Revision: 31410
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/client/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/API.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Action.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ActionAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/AddressList.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudNotFoundClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusCode.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusRange.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/IdAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Image.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Instance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Key.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Property.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Realm.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ResourceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/StateAware.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/request/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/transport/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/unmarshal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/utils/
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/about.html
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/DeltaCloudDriver.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImageFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstanceFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudKey.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/DeltaCloudRealm.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudResourceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java
Log:
[JBIDE-8975] corrected package structure in Deltacloud client, removed bundle activator
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/ChangeLog 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/ChangeLog 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,11 +1,11 @@
-2011-03-29 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-03-29 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
(request):
(DeltaCloudClientImpl):
[JBIDE-8635] removed http client and replaced by urlConnection
-2011-03-11 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-03-11 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/StateAware.java:
* src/org/jboss/tools/deltacloud/core/client/ActionAware.java
@@ -21,7 +21,7 @@
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (performAction):
[JBIDE-8565] refreshing instance and key after performing action
-2011-02-18 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-02-18 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
(loadCloud):
@@ -35,25 +35,25 @@
(setLastRealmName):
[JBIDE-8333]
-2011-02-15 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-02-15 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (update):
[JBIDE-8420] storing credentials before loading children
(was: loaded children and stored afterwards. storing was skipped since loading threw an exception)
-2011-02-07 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-02-07 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (waitForState):
[JBIDE-8343] increased wait delay for refreshing instance, waiting before refreshing (was: refreshed first and waited afterwards)
-2011-02-03 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-02-03 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/ImageFilter.java:
* src/org/jboss/tools/deltacloud/core/InstanceFilter.java:
* src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java:
[JBIDE-8187] added capability to filter for instance alias
-2011-01-27 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-01-27 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (getServerType):
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getDriver):
@@ -65,7 +65,7 @@
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (throwOnHttpErrors):
[JBIDE-8250] authorization error is status code 401 (was: 403)
-2011-01-11 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-01-11 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
(listRealms):
@@ -102,13 +102,13 @@
(listImages):
[JBIDE-7935] moved image unmarshalling to its own class (and created tests for it)
-2011-01-10 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-01-10 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java:
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (listProfile):
[JBIDE-7935] moved HardwareProfile unmarshalling to HardwareProfileUnmarshaller
-2011-01-04 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-01-04 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstancesRepository.java:
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (loadInstances):
@@ -123,7 +123,7 @@
(setAlias):
(getAlias):
-2011-01-03 adietisheim <adietisheim@adietisheim-thinkpad>
+2011-01-03 adietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (createInstance):
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
@@ -131,12 +131,12 @@
(setAlias):
[JBIDE-7294] implementing alias support
-2010-12-27 adietisheim <adietisheim@adietisheim-thinkpad>
+2010-12-27 adietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (isValid):
[JBIDE-7864] added isValid property tester to offer "launch instance" on valid clouds only
-2010-12-23 adietisheim <adietisheim@adietisheim-thinkpad>
+2010-12-23 adietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java (CLOUDELEMENT.KEYS):
* src/org/jboss/tools/deltacloud/core/DeltaCloudKey.java:
@@ -145,7 +145,7 @@
(getKeys):
[JBIDE-7763] added methods to DeltaCloud to get all keys and to create a key on the server
-2010-12-22 adietisheim <adietisheim@adietisheim-thinkpad>
+2010-12-22 adietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (DeltaCloudClientImpl):
[JBIDE-7981] need to create a documentbuilder on each new parsing to avoid threads using the same builder.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/META-INF/MANIFEST.MF 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/META-INF/MANIFEST.MF 2011-05-21 14:22:16 UTC (rev 31410)
@@ -4,13 +4,10 @@
Bundle-Vendor: JBoss by Red Hat
Bundle-SymbolicName: org.jboss.tools.deltacloud.client
Bundle-Version: 0.2.0.qualifier
-Bundle-Activator: org.jboss.tools.deltacloud.client.DeltaCloudClientBundle
-Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0"
Export-Package: org.jboss.tools.deltacloud.client,
- org.jboss.tools.deltacloud.core.client,
- org.jboss.tools.deltacloud.core.client.request;x-friends:="org.jboss.tools.deltacloud.client.test",
- org.jboss.tools.deltacloud.core.client.transport,
- org.jboss.tools.deltacloud.core.client.unmarshal;x-friends:="org.jboss.tools.deltacloud.client.test",
- org.jboss.tools.deltacloud.core.client.utils
+ org.jboss.tools.deltacloud.client.request;x-friends:="org.jboss.tools.deltacloud.client.test",
+ org.jboss.tools.deltacloud.client.transport,
+ org.jboss.tools.deltacloud.client.unmarshal;x-friends:="org.jboss.tools.deltacloud.client.test",
+ org.jboss.tools.deltacloud.client.utils
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/about.html
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/about.html 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/about.html 2011-05-21 14:22:16 UTC (rev 31410)
@@ -23,8 +23,8 @@
<p>Information about this plugin is available at <a href="http://www.jboss.org/tools">JBoss Tools project page</a></p>
<p>
-This software is distributed under the terms of the Eclipse Public License - v 1.0
-(see <a href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License - Version 1.0</a>).
+This software is distributed under the terms of the Apache License, Version 2.0
+(see <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>).
</p>
</body>
</html>
\ No newline at end of file
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/API.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/API.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/API.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public class API extends IdAware {
-
- private static final long serialVersionUID = 1L;
-
- public static enum Driver {
- UNKNOWN, MOCK, EC2;
-
- public static Driver checkedValueOf(String name) {
- for (Driver driver : values()) {
- if (driver.name().equals(name)) {
- return driver;
- }
- }
- return UNKNOWN;
- }
-
- }
-
- private Driver driver;
-
- public API() {
- }
-
- public void setDriver(Driver driver) {
- this.driver = driver;
- }
-
- public void setDriver(String driver) {
- setDriver(Driver.checkedValueOf(driver.toUpperCase()));
- }
-
- public Driver getDriver() {
- return driver;
- }
-
- @Override
- public String toString() {
- return "API [driver=" + driver.name() + super.toString() + "]";
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Action.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Action.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Action.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-/**
- * An action that may be performed on a resource
- *
- * @author André Dietisheim
- */
-public class Action<OWNER> {
-
- public static final String START_NAME = "start";
- public static final String STOP_NAME = "stop";
- public static final String REBOOT_NAME = "reboot";
- public static final String DESTROY_NAME = "destroy";
-
- private String name;
- private String url;
- private HttpMethod method;
- private OWNER owner;
-
- public HttpMethod getMethod() {
- return method;
- }
-
- public void setMethodString(String method) {
- this.method = HttpMethod.valueOf(method.toUpperCase());
- }
-
- public void setMethod(HttpMethod method) {
- this.method = method;
- }
-
- public void setMethod(String method) {
- this.method = HttpMethod.valueOf(method.toUpperCase());
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setOwner(OWNER owner) {
- this.owner = owner;
- }
-
- public OWNER getOwner() {
- return owner;
- }
-
- public boolean isStart() {
- return START_NAME.equals(getName());
- }
-
- public boolean isStop() {
- return STOP_NAME.equals(getName());
- }
-
- public boolean isReboot() {
- return REBOOT_NAME.equals(getName());
- }
-
- public boolean isDestroy() {
- return DESTROY_NAME.equals(getName());
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ActionAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ActionAware.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ActionAware.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Martyn Taylor
- * @author André Dietisheim
- */
-public abstract class ActionAware<OWNER> extends IdAware {
-
- private List<Action<OWNER>> actions;
-
- public Action<OWNER> getAction(String name) {
- if (name == null) {
- return null;
- }
-
- for (Action<OWNER> action : getActions()) {
- if (name.equals(action.getName())) {
- return action;
- }
- }
- return null;
- }
-
- public List<String> getActionNames() {
- ArrayList<String> names = new ArrayList<String>();
- for (Action<OWNER> action : getActions()) {
- names.add(action.getName());
- }
- return names;
- }
-
- public boolean start(DeltaCloudClient client) throws DeltaCloudClientException {
- InputStream in = client.performAction(getAction(Action.START_NAME));
- update(in);
- return in != null;
- }
-
- public boolean stop(DeltaCloudClient client) throws DeltaCloudClientException {
- InputStream in = client.performAction(getAction(Action.STOP_NAME));
- update(in);
- return in != null;
- }
-
- public boolean destroy(DeltaCloudClient client) throws DeltaCloudClientException {
- InputStream in = client.performAction(getAction(Action.DESTROY_NAME));
- return in != null;
- }
-
- public boolean reboot(DeltaCloudClient client) throws DeltaCloudClientException {
- InputStream in = client.performAction(getAction(Action.REBOOT_NAME));
- update(in);
- return in != null;
- }
-
- protected void update(InputStream in) throws DeltaCloudClientException {
- if (in == null) {
- return;
- }
-
- doUpdate(in);
- }
-
- protected abstract void doUpdate(InputStream in) throws DeltaCloudClientException;
-
- public boolean canStart() {
- return getAction(Action.START_NAME) != null;
- }
-
- public boolean canStop() {
- return getAction(Action.STOP_NAME) != null;
- }
-
- public boolean canReboot() {
- return getAction(Action.REBOOT_NAME) != null;
- }
-
- public boolean canDestroy() {
- return getAction(Action.DESTROY_NAME) != null;
- }
-
- public void setActions(List<Action<OWNER>> actions) {
- this.actions = actions;
- }
-
- public List<Action<OWNER>> getActions() {
- return actions;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/AddressList.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/AddressList.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/AddressList.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlList;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- * @author Martyn Taylor
- * @author André Dietisheim
- */
-@XmlType
-public class AddressList
-{
- private static final long serialVersionUID = 1L;
-
- @XmlElement
- @XmlList
- private List<String> addresses;
-
- public AddressList()
- {
- }
-
- public AddressList(List<String> addresses)
- {
- setAddress(addresses);
- }
-
- protected void setAddress(List<String> addresses)
- {
- this.addresses = addresses;
- }
-
- public List<String> getAddress()
- {
- return addresses;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public class DeltaCloudAuthClientException extends DeltaCloudClientException {
-
- private static final long serialVersionUID = 1L;
-
- public DeltaCloudAuthClientException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public DeltaCloudAuthClientException(Throwable cause)
- {
- super(cause);
- }
-
- public DeltaCloudAuthClientException(String message)
- {
- super(message);
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-
-/**
- * @author Martyn Taylor
- * @author Andre Dietisheim
- */
-public interface DeltaCloudClient {
-
- /**
- * Returns the server type this client is connected to.
- *
- * @return the server type
- *
- * @see DeltaCloudServerType
- */
- public Driver getServerType();
-
- /**
- * Returns a list of Delta Cloud Realms
- *
- * @return List of Delta Cloud Realms
- * @throws DeltaCloudClientException
- */
- public List<Realm> listRealms() throws DeltaCloudClientException;
-
- /**
- * Returns a single Delta Cloud Realm given its ID
- *
- * @param realmId
- * @return Delta Cloud Realm
- * @throws DeltaCloudClientException
- */
- public Realm listRealms(String realmId) throws DeltaCloudClientException;
-
- public List<HardwareProfile> listProfiles() throws DeltaCloudClientException;
-
- /**
- * Returns a Delta Cloud Flavors
- *
- * @param flavorId
- * @return Delta Cloud Flavor
- * @throws DeltaCloudClientException
- */
- public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException;
-
- /**
- * Returns a List of Delta Cloud Images
- *
- * @return List of Delta Cloud Images
- * @throws DeltaCloudClientException
- */
- public List<Image> listImages() throws DeltaCloudClientException;
-
- /**
- * Returns a Delta Cloud Image given its ID
- *
- * @param imageId
- * @return
- * @throws DeltaCloudClientException
- */
- public Image listImages(String imageId) throws DeltaCloudClientException;
-
- /**
- * Returns a list of all Instances from the Delta Cloud Provider
- *
- * @return
- * @throws DeltaCloudClientException
- */
- public List<Instance> listInstances() throws DeltaCloudClientException;
-
- /**
- * Returns an Instance from the Delta Cloud Provider given on the Instances
- * ID
- *
- * @param instanceId
- * @return
- * @throws DeltaCloudClientException
- */
- public Instance listInstances(String instanceId) throws DeltaCloudClientException;
-
- /**
- * Creates a new Delta Cloud Instance based on the Image specified by the
- * Image ID. Default parameters are used for the Flavor, Realm and Name.
- * These are specified by the Delta Cloud Provider
- *
- * @param imageId
- * @return The newly created Delta Cloud Instance
- * @throws DeltaCloudClientException
- */
- public Instance createInstance(String imageId) throws DeltaCloudClientException;
-
- /**
- * Creates a new Delta Cloud Instance, the instance will be based on the
- * Image specified by the instance ID. It will be of type flavor and in the
- * location realm
- *
- * @param imageId
- * @param flavor
- * @param realm
- * @param name
- * @return
- * @throws DeltaCloudClientException
- */
- public Instance createInstance(String name, String imageId, String profileId, String realmId, String memory, String storage)
- throws DeltaCloudClientException;
-
- public Instance createInstance(String name, String imageId, String profileId, String realmId, String keyname, String memory,
- String storage) throws DeltaCloudClientException;
-
- /**
- * Creates a key for a given name on the deltacloud server.
- *
- * @param keyname
- * the name of the key to retrieve from the server
- * @param keyStoreLocation
- * the path to the file to store the key in
- * @throws DeltaCloudClientException
- * the delta cloud client exception
- */
- public Key createKey(String keyname) throws DeltaCloudClientException;
-
- /**
- * Lists all keys available on the deltacloud server this client is
- * connected to.
- *
- * @return the keys that are available
- * @throws DeltaCloudClientException
- *
- */
- public List<Key> listKeys() throws DeltaCloudClientException;
-
- /**
- * Returns a key with the given name if it is available on the server.
- * Throws a DeltaCloudException if it is not available.
- */
- public Key listKey(String id) throws DeltaCloudClientException;
-
- /**
- * Performs the given action.
- *
- * @param action the action to execute
- * @return true, if successful
- * @throws DeltaCloudClientException the delta cloud client exception
- * @see Action
- */
- public InputStream performAction(Action<?> action) throws DeltaCloudClientException;
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-/**
- * @author Martyn Taylor
- */
-public class DeltaCloudClientException extends Exception
-{
- private static final long serialVersionUID = 1L;
-
- public DeltaCloudClientException(String message, Throwable clause)
- {
- super(message, clause);
- }
-
- public DeltaCloudClientException(Throwable clause)
- {
- super(clause);
- }
-
- public DeltaCloudClientException(String message)
- {
- super(message);
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.request.CreateInstanceRequest;
-import org.jboss.tools.deltacloud.core.client.request.CreateKeyRequest;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListHardwareProfileRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListHardwareProfilesRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListImageRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListImagesRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListInstanceRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListInstancesRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListKeyRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListKeysRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListRealmRequest;
-import org.jboss.tools.deltacloud.core.client.request.ListRealmsRequest;
-import org.jboss.tools.deltacloud.core.client.request.PerformActionRequest;
-import org.jboss.tools.deltacloud.core.client.request.TypeRequest;
-import org.jboss.tools.deltacloud.core.client.transport.IHttpTransport;
-import org.jboss.tools.deltacloud.core.client.transport.URLConnectionTransport;
-import org.jboss.tools.deltacloud.core.client.unmarshal.APIUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfileUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfilesUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImageUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImagesUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstanceUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstancesUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeysUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmsUnmarshaller;
-
-/**
- * @author Andre Dietisheim (based on prior implementation by Martyn Taylor)
- */
-public class DeltaCloudClientImpl implements DeltaCloudClient {
-
- private String baseUrl;
- private IHttpTransport transport;
-
- public DeltaCloudClientImpl(String url) throws MalformedURLException, DeltaCloudClientException {
- this(url, null, null);
- }
-
- public DeltaCloudClientImpl(String url, String username, String password) throws MalformedURLException,
- DeltaCloudClientException {
- this(url, new URLConnectionTransport(username, password));
- }
-
- public DeltaCloudClientImpl(String url, IHttpTransport transport) throws DeltaCloudClientException {
- this.baseUrl = url;
- this.transport = transport;
- }
-
- protected InputStream request(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
- return transport.request(deltaCloudRequest);
- }
-
- public Driver getServerType() {
- try {
- InputStream response = request(new TypeRequest(baseUrl));
- API api = new APIUnmarshaller().unmarshall(response, new API());
- return api.getDriver();
- } catch (DeltaCloudClientException e) {
- return Driver.UNKNOWN;
- }
- }
-
- @Override
- public Instance createInstance(String imageId) throws DeltaCloudClientException {
- try {
- InputStream response = request(new CreateInstanceRequest(baseUrl, imageId));
- return new InstanceUnmarshaller().unmarshall(response, new Instance());
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
-
- }
-
- public Instance createInstance(String name, String imageId, String profileId, String realmId, String memory,
- String storage) throws DeltaCloudClientException {
- return createInstance(name, imageId, profileId, realmId, null, memory, storage);
- }
-
- public Instance createInstance(String name, String imageId, String profileId, String realmId, String keyId,
- String memory, String storage) throws DeltaCloudClientException {
- try {
- InputStream response = request(
- new CreateInstanceRequest(baseUrl, name, imageId, profileId, realmId, keyId, memory, storage));
- Instance instance = new InstanceUnmarshaller().unmarshall(response, new Instance());
- // TODO: WORKAROUND for
- // https://issues.jboss.org/browse/JBIDE-8005
- if (keyId != null) {
- instance.setKeyId(keyId);
- }
- // TODO: WORKAROUND for
- // https://issues.jboss.org/browse/JBIDE-8005
- return instance;
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
- }
-
- @Override
- public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
- try {
- InputStream response = request(new ListHardwareProfileRequest(baseUrl, profileId));
- return new HardwareProfileUnmarshaller().unmarshall(response, new HardwareProfile());
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
- }
-
- @Override
- public List<HardwareProfile> listProfiles() throws DeltaCloudClientException {
- try {
- InputStream response = request(new ListHardwareProfilesRequest(baseUrl));
- List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
- new HardwareProfilesUnmarshaller().unmarshall(response, profiles);
- return profiles;
- } catch (Exception e) {
- throw new DeltaCloudClientException(MessageFormat.format("could not get realms on cloud at \"{0}\"",
- baseUrl), e);
- }
- }
-
- @Override
- public List<Image> listImages() throws DeltaCloudClientException {
- InputStream response = request(new ListImagesRequest(baseUrl));
- List<Image> images = new ArrayList<Image>();
- new ImagesUnmarshaller().unmarshall(response, images);
- return images;
- }
-
- @Override
- public Image listImages(String imageId) throws DeltaCloudClientException {
- InputStream response = request(new ListImageRequest(baseUrl, imageId));
- return new ImageUnmarshaller().unmarshall(response, new Image());
- }
-
- @Override
- public List<Instance> listInstances() throws DeltaCloudClientException {
- InputStream inputStream = request(new ListInstancesRequest(baseUrl));
- List<Instance> instances = new ArrayList<Instance>();
- new InstancesUnmarshaller().unmarshall(inputStream, instances);
- return instances;
- }
-
- @Override
- public Instance listInstances(String instanceId) throws DeltaCloudClientException {
- try {
- InputStream response = request(new ListInstanceRequest(baseUrl, instanceId));
- return new InstanceUnmarshaller().unmarshall(response, new Instance());
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
- }
-
- @Override
- public List<Realm> listRealms() throws DeltaCloudClientException {
- try {
- InputStream inputStream = request(new ListRealmsRequest(baseUrl));
- List<Realm> realms = new ArrayList<Realm>();
- new RealmsUnmarshaller().unmarshall(inputStream, realms);
- return realms;
- } catch (Exception e) {
- throw new DeltaCloudClientException(
- MessageFormat.format("could not get realms on cloud at \"{0}\"", baseUrl), e);
- }
- }
-
- @Override
- public Realm listRealms(String realmId) throws DeltaCloudClientException {
- try {
- InputStream response = request(new ListRealmRequest(baseUrl, realmId));
- return new RealmUnmarshaller().unmarshall(response, new Realm());
- } catch (Exception e) {
- throw new DeltaCloudClientException(
- MessageFormat.format("could not get realms on cloud at \"{0}\"", baseUrl), e);
- }
- }
-
- public Key createKey(String keyname) throws DeltaCloudClientException {
- try {
- CreateKeyRequest keyRequest = new CreateKeyRequest(baseUrl, keyname);
- InputStream inputStream = request(keyRequest);
- Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
- return key;
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
- }
-
- public List<Key> listKeys() throws DeltaCloudClientException {
- InputStream inputStream = request(new ListKeysRequest(baseUrl));
- List<Key> keys = new ArrayList<Key>();
- new KeysUnmarshaller().unmarshall(inputStream, keys);
- return keys;
- }
-
- public Key listKey(String id) throws DeltaCloudClientException {
- InputStream inputStream = request(new ListKeyRequest(baseUrl, id));
- Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
- return key;
- }
-
- public InputStream performAction(Action<?> action) throws DeltaCloudClientException {
- InputStream in = null;
- if (action != null) {
- try {
- in = request(new PerformActionRequest(action.getUrl(), action.getMethod()));
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- throw new DeltaCloudClientException(e);
- }
- }
- return in;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudNotFoundClientException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudNotFoundClientException.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/DeltaCloudNotFoundClientException.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public class DeltaCloudNotFoundClientException extends DeltaCloudClientException {
-
- private static final long serialVersionUID = 1L;
-
- public DeltaCloudNotFoundClientException(String message, Throwable clause)
- {
- super(message, clause);
- }
-
- public DeltaCloudNotFoundClientException(Throwable clause)
- {
- super(clause);
- }
-
- public DeltaCloudNotFoundClientException(String message)
- {
- super(message);
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.Property.Names;
-
-/**
- * @author Martyn Taylor
- * @author André Dietisheim
- */
-public class HardwareProfile extends IdAware {
- private static final long serialVersionUID = 1L;
-
- private List<Property> properties;
-
- public HardwareProfile() {
- }
-
- public void setProperties(List<Property> properties) {
- this.properties = properties;
- }
-
- public List<Property> getProperties() {
- if (properties == null)
- properties = new ArrayList<Property>();
- return properties;
- }
-
- public Property getNamedProperty(Names nameEnum) {
- if (nameEnum == null) {
- return null;
- }
- return getNamedProperty(nameEnum.name().toLowerCase());
- }
-
- public Property getNamedProperty(String name) {
- if (properties != null) {
- for (Property p : properties) {
- if (p.getName().equals(name))
- return p;
- }
- }
- return null;
- }
-
- public String getArchitecture() {
- Property p = getNamedProperty(Property.Names.ARCHITECTURE);
- if (p != null)
- return p.getValue();
- return null;
- }
-
- public String getMemory() {
- Property p = getNamedProperty("memory");
- if (p != null)
- return p.toString();
- return null;
- }
-
- public String getStorage() {
- Property p = getNamedProperty("storage");
- if (p != null)
- return p.toString();
- return null;
- }
-
- public String getCPU() {
- Property p = getNamedProperty("cpu");
- if (p != null)
- return p.getValue();
- return null;
- }
-
- @Override
- public String toString() {
- String s = "";
- s += "Hardware-profile:\t\t" + getId() + "\n";
- for (Property p : properties) {
- s += p.getName() + ":\t\t" + p.getValue() + "\n";
- }
- return s;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-public enum HttpMethod {
- GET, POST, PUT, DELETE, HEAD;
-}
\ No newline at end of file
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusCode.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusCode.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusCode.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public enum HttpStatusCode {
-
- OK(200), NOT_FOUND(404), FORBIDDEN(403), UNAUTHORIZED(401);
-
- private int code;
-
- private HttpStatusCode(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
-
- public boolean isStatus(int statusCode) {
- return code == statusCode;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusRange.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusRange.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/HttpStatusRange.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public enum HttpStatusRange {
-
- CLIENT_ERROR(400, 499), SERVER_ERROR(500, 599);
-
- private int start;
- private int stop;
-
- HttpStatusRange(int start, int stop) {
- this.start = start;
- this.stop = stop;
- }
-
- public boolean isInRange(int statusCode) {
- return statusCode >= start
- && statusCode <= stop;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/IdAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/IdAware.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/IdAware.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- * @author Martyn Taylor
- * @author André Dietisheim
- */
-public abstract class IdAware {
-
- protected String id;
-
- public void setId(String id) {
- this.id = id;
- }
-
- @XmlAttribute
- public String getId() {
- return id;
- }
-
- @Override
- public String toString() {
- return "IdAware [id=" + id + "]";
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Image.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Image.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Image.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-
-/**
- * @author Martyn Taylor
- */
-public class Image extends IdAware
-{
- private static final long serialVersionUID = 1L;
-
- private String ownerId;
-
- private String name;
-
- private String description;
-
- private String architecture;
-
- public Image()
- {
- }
-
- public void setOwnerId(String ownerId)
- {
- this.ownerId = ownerId;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public void setArchitecture(String architecture)
- {
- this.architecture = architecture;
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getArchitecture()
- {
- return architecture;
- }
-
- @Override
- public String toString()
- {
- String s = "";
- s += "Image:\t\t" + getId() + "\n";
- s += "Owner:\t\t" + getOwnerId() + "\n";
- s += "Name:\t\t" + getName() + "\n";
- s += "Desc:\t\t" + getDescription() + "\n";
- s += "Arch:\t\t" + getArchitecture() + "\n";
- return s;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Instance.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Instance.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstanceUnmarshaller;
-
-/**
- * @author Martyn Taylor
- * @author Andre Dietisheim
- */
-public class Instance extends StateAware<Instance> {
-
- private static final long serialVersionUID = 1L;
-
- private String ownerId;
-
- private String name;
-
- private String imageId;
-
- private String profileId;
-
- private String memory;
-
- private String storage;
-
- private String cpu;
-
- private String realmId;
-
- private String keyId;
-
- private AddressList publicAddresses;
-
- private AddressList privateAddresses;
-
- public Instance() {
- }
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setImageId(String imageId) {
- this.imageId = imageId;
- }
-
- public void setProfileId(String profileId) {
- this.profileId = profileId;
- }
-
- protected void setMemory(String memory) {
- this.memory = memory;
- }
-
- protected void setStorage(String storage) {
- this.storage = storage;
- }
-
- protected void setCPU(String cpu) {
- this.cpu = cpu;
- }
-
- public void setRealmId(String realmId) {
- this.realmId = realmId;
- }
-
- public void setKeyId(String keyId) {
- this.keyId = keyId;
- }
-
- public String getKeyId() {
- return keyId;
- }
-
- public void setPrivateAddresses(AddressList privateAddresses) {
- this.privateAddresses = privateAddresses;
- }
-
- public void setPublicAddresses(AddressList publicAddresses) {
- this.publicAddresses = publicAddresses;
- }
-
- public String getOwnerId() {
- return ownerId;
- }
-
- public String getName() {
- return name;
- }
-
- public String getImageId() {
- return imageId;
- }
-
- public String getProfileId() {
- return profileId;
- }
-
- public String getMemory() {
- return memory;
- }
-
- public String getStorage() {
- return storage;
- }
-
- public String getCPU() {
- return cpu;
- }
-
- public String getRealmId() {
- return realmId;
- }
-
- public List<String> getPublicAddresses() {
- return publicAddresses.getAddress();
- }
-
- public List<String> getPrivateAddresses() {
- return privateAddresses.getAddress();
- }
-
- @Override
- protected void doUpdate(InputStream in) throws DeltaCloudClientException {
- new InstanceUnmarshaller().unmarshall(in, this);
- }
-
-
- @Override
- public String toString() {
- String s = "";
- s += "Instance:\t" + getId() + "\n";
- s += "Owner:\t\t" + getOwnerId() + "\n";
- s += "Image:\t\t" + getImageId() + "\n";
- s += "Realm:\t\t" + getRealmId() + "\n";
- s += "Profile:\t\t" + getProfileId() + "\n";
- if (getMemory() != null)
- s += "Memory:\t\t" + getMemory() + "\n";
- if (getStorage() != null) {
- s += "Storage:\t\t" + getStorage() + "\n";
- }
- if (getCPU() != null) {
- s += "CPU:\t\t" + getCPU() + "\n";
- }
- s += "State:\t\t" + getState() + "\n";
-
- List<Action<Instance>> actions = getActions();
- if (actions != null) {
- for (int i = 0; i < actions.size(); i++) {
- if (i == 0) {
- s += "Actions:\t" + actions.get(i) + "\n";
- } else {
- s += "\t\t" + actions.get(i) + "\n";
- }
- }
- }
-
- for (int i = 0; i < publicAddresses.getAddress().size(); i++) {
- if (i == 0) {
- s += "Public Addr:\t" + publicAddresses.getAddress().get(i) + "\n";
- } else {
- s += "\t\t" + publicAddresses.getAddress().get(i) + "\n";
- }
- }
-
- for (int i = 0; i < publicAddresses.getAddress().size(); i++) {
- if (i == 0) {
- s += "Private Addr:\t" + publicAddresses.getAddress().get(i) + "\n";
- } else {
- s += "\t\t" + privateAddresses.getAddress().get(i) + "\n";
- }
- }
-
- return s;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Key.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Key.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Key.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
-
-/**
- * @author Andre Dietisheim
- */
-public class Key extends StateAware<Key> {
-
- private static final long serialVersionUID = 1L;
-
- private URL url;
- private String pem;
- private String fingerprint;
- private String state;
-
- public Key() {
- }
-
- public void setUrl(URL url) {
- this.url = url;
- }
-
- public void setUrl(String url) throws MalformedURLException {
- this.url = new URL(url);
- }
-
- public void setPem(String pem) {
- this.pem = pem;
- }
-
- public void setFingerprint(String fingerprint) {
- this.fingerprint = fingerprint;
- }
-
- public URL getUrl() {
- return url;
- }
-
- public String getFingerprint() {
- return fingerprint;
- }
-
- public String getPem() {
- return pem;
- }
-
- @Override
- protected void doUpdate(InputStream in) throws DeltaCloudClientException {
- new KeyUnmarshaller().unmarshall(in, this);
- }
-
- @Override
- public String toString() {
- return "Key [url=" + url + ", pem=" + pem + ", fingerprint=" + fingerprint + ", state=" + state + ", actions="
- + getActions() + ", toString()=" + super.toString() + "]";
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Property.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Property.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Property.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-import java.util.List;
-
-/**
- * @author Martyn Taylor
- */
-public class Property extends IdAware {
-
- private static final long serialVersionUID = 1L;
-
- public static enum Kind {
- FIXED, RANGE, ENUM
- };
-
- public static enum Names {
- MEMORY, STORAGE, CPU, ARCHITECTURE
- }
-
- public static enum UNIT {
- MB {
- public boolean matches(String value) {
- return name().equals(value);
- }},
- GB{
- public boolean matches(String value) {
- return name().equals(value);
- }},
- LABEL{
- public boolean matches(String value) {
- return name().toLowerCase().equals(value);
- }},
- COUNT{
- public boolean matches(String value) {
- return name().toLowerCase().equals(value);
- }};
-
- public abstract boolean matches(String value);
- }
-
- public class Range {
- private String first;
- private String last;
-
- public Range(String first, String last) {
- this.first = first;
- this.last = last;
- }
-
- public String getFirst() {
- return first;
- }
-
- public String getLast() {
- return last;
- }
- }
-
- public Property() {
- }
-
- private String kind;
-
- private String unit;
-
- private String name;
-
- private String value;
-
- // For range
- private String first;
- private String last;
-
- // For enum
- private List<String> enums;
-
- public String getKind() {
- return kind;
- }
-
- public String getUnit() {
- return unit;
- }
-
- public String getName() {
- return name;
- }
-
- public String getValue() {
- return value;
- }
-
- public Range getRange() {
- return new Range(first, last);
- }
-
- public List<String> getEnums() {
- return enums;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public void setKind(String kind) {
- this.kind = kind;
- }
-
- public void setRange(String first, String last) {
- this.first = first;
- this.last = last;
- }
-
- public void setEnums(List<String> enums) {
- this.enums = enums;
- }
-
- public String toString() {
- if (kind.equals("range")) {
- // return first += "-" + last + "(default:" + value + ")";
- return new StringBuilder()
- .append(first)
- .append('-').append(last)
- .append("(default: ").append(value).append(")")
- .toString();
- } else if (kind.equals("enum")) {
- String s = enums.get(0);
- for (int i = 1; i < enums.size(); ++i) {
- s += ", " + enums.get(i);
- }
- s += " (default:" + value + ")";
- return s;
- } else {
- // return value += " " + (unit.equals("label") ? "" : unit);
- StringBuilder builder = new StringBuilder();
- builder.append(value);
- if (!UNIT.LABEL.matches(unit)) {
- builder.append(' ').append(unit);
- }
- return builder.toString();
- }
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Realm.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Realm.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/Realm.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.deltacloud.core.client;
-
-/**
- * @author Martyn Taylor
- * @author André Dietisheim
- */
-public class Realm extends IdAware {
- private static final long serialVersionUID = 1L;
-
- public static final int LIMIT_DEFAULT = -1;
-
- private String name;
- private RealmState state;
- private int limit;
-
- public static enum RealmState {
- AVAILABLE, UNAVAILABLE, UNKNOWN
- }
-
- public Realm() {
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-
- public void setLimit(int limit) {
- this.limit = limit;
- }
-
- public void setLimit(String limit) {
- try {
- this.limit = Integer.parseInt(limit);
- } catch (Exception e) {
- this.limit = LIMIT_DEFAULT;
- }
- }
-
- public int getLimit() {
- return limit;
- }
-
- public String getName() {
- return name;
- }
-
- public void setState(String state) {
- try {
- this.state = RealmState.valueOf(state.toUpperCase());
- } catch (Exception e) {
- this.state = RealmState.UNKNOWN;
- }
- }
-
- public RealmState getState() {
- return state;
- }
-
- @Override
- public String toString() {
- String s = "";
- s += "Realm:\t\t" + getId() + "\n";
- s += "Name\t\t" + getName() + "\n";
- s += "State:\t\t" + getState() + "\n";
- s += "Limit:\t\t" + getLimit() + "\n";
- return s;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ResourceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ResourceAction.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/ResourceAction.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-
-/**
- * @author André Dietisheim
- */
-public interface ResourceAction<OWNER> {
-
- public static final String DESTROY = "destroy";
-
- public String getName();
-
- public String getUrl();
-
- public HttpMethod getMethod();
-
- public OWNER getOwner();
-
- public boolean isDestroy();
-}
\ No newline at end of file
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/StateAware.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/StateAware.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.client/src/org/jboss/tools/deltacloud/core/client/StateAware.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.core.client;
-
-
-/**
- * @author André Dietisheim
- *
- * @param <OWNER>
- */
-public abstract class StateAware<OWNER> extends ActionAware<OWNER> {
-
- public static enum State {
- RUNNING, STOPPED, PENDING, TERMINATED, BOGUS
- };
-
- private State state;
-
- public void setState(String state) {
- try {
- this.state = State.valueOf(state);
- } catch (Exception e) {
- this.state = State.BOGUS;
- }
- }
-
- public State getState() {
- return state;
- }
-
- public boolean isRunning() {
- return getState() == State.RUNNING;
- }
-
- public boolean isStopped() {
- return getState() == State.STOPPED;
- }
-}
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 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -17,18 +17,18 @@
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.tools.deltacloud.client.DeltaCloudAuthClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.Key;
+import org.jboss.tools.deltacloud.client.Realm;
+import org.jboss.tools.deltacloud.client.API.Driver;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance.State;
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudAuthClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.Key;
-import org.jboss.tools.deltacloud.core.client.Realm;
import org.jboss.tools.internal.deltacloud.core.observable.ObservablePojo;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudDriver.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudDriver.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudDriver.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import org.jboss.tools.deltacloud.core.client.API.Driver;
+import org.jboss.tools.deltacloud.client.API.Driver;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -13,8 +13,8 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
-import org.jboss.tools.deltacloud.core.client.Property;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.Property;
/**
* @author Jeff Johnston
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -12,7 +12,7 @@
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.Property;
+import org.jboss.tools.deltacloud.client.Property;
public class DeltaCloudHardwareProperty {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import org.jboss.tools.deltacloud.core.client.Image;
+import org.jboss.tools.deltacloud.client.Image;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImageFactory.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImageFactory.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImageFactory.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -15,7 +15,7 @@
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.jboss.tools.deltacloud.core.client.Image;
+import org.jboss.tools.deltacloud.client.Image;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -14,10 +14,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Instance;
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Instance;
/**
* An instance that may be reached on a DeltaCloud instance. Wraps Instance from
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstanceFactory.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstanceFactory.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstanceFactory.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -15,7 +15,7 @@
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.jboss.tools.deltacloud.core.client.Instance;
+import org.jboss.tools.deltacloud.client.Instance;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudKey.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudKey.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudKey.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import org.jboss.tools.deltacloud.core.client.Key;
+import org.jboss.tools.deltacloud.client.Key;
/**
* @author André Dietisheim
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 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -29,7 +29,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ListenerList;
-import org.jboss.tools.deltacloud.core.client.utils.StringUtils;
+import org.jboss.tools.deltacloud.client.utils.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import org.jboss.tools.deltacloud.core.client.Realm;
+import org.jboss.tools.deltacloud.client.Realm;
/**
*
@@ -18,7 +18,7 @@
*
* TODO: there are 2 realm classes:
* <ul>
- * <li>org.jboss.tools.deltacloud.core.client.Realm</li>
+ * <li>org.jboss.tools.deltacloud.client.Realm</li>
* <li>org.jboss.tools.deltacloud.core.DeltaCloudRealm</li>
* </ul>
* remove the DeltaCloudRealm class
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudResourceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudResourceAction.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudResourceAction.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import org.jboss.tools.deltacloud.core.client.Action;
+import org.jboss.tools.deltacloud.client.Action;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -14,10 +14,10 @@
import org.eclipse.core.commands.IHandler;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.jboss.tools.deltacloud.client.utils.StringUtils;
+import org.jboss.tools.deltacloud.client.utils.StringUtils.IElementFormatter;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.DeltaCloudResourceAction;
-import org.jboss.tools.deltacloud.core.client.utils.StringUtils;
-import org.jboss.tools.deltacloud.core.client.utils.StringUtils.IElementFormatter;
import org.jboss.tools.deltacloud.core.job.InstanceActionJob;
import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java 2011-05-21 07:25:11 UTC (rev 31409)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java 2011-05-21 14:22:16 UTC (rev 31410)
@@ -14,8 +14,8 @@
import java.io.FileNotFoundException;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.deltacloud.client.utils.StringUtils;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.client.utils.StringUtils;
import org.jboss.tools.deltacloud.ui.preferences.StringPreferenceValue;
import org.jboss.tools.deltacloud.ui.preferences.StringsPreferenceValue;
13 years, 4 months
JBoss Tools SVN: r31408 - trunk/cdi/tests.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-20 20:18:21 -0400 (Fri, 20 May 2011)
New Revision: 31408
Modified:
trunk/cdi/tests/pom.xml
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
tests
Modified: trunk/cdi/tests/pom.xml
===================================================================
--- trunk/cdi/tests/pom.xml 2011-05-21 00:05:23 UTC (rev 31407)
+++ trunk/cdi/tests/pom.xml 2011-05-21 00:18:21 UTC (rev 31408)
@@ -17,6 +17,7 @@
<module>org.jboss.tools.cdi.ui.test</module>
<module>org.jboss.tools.cdi.seam.solder.core.test</module>
<module>org.jboss.tools.cdi.seam.config.core.test</module>
+ <module>org.jboss.tools.cdi.seam.config.ui.test</module>
<module>org.jboss.tools.cdi.seam.faces.core.test</module>
<module>org.jboss.tools.cdi.seam.text.ext.test</module>
</modules>
13 years, 4 months
JBoss Tools SVN: r31407 - in trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test: META-INF and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-20 20:05:23 -0400 (Fri, 20 May 2011)
New Revision: 31407
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.project
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/build.properties
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/plugin.properties
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/pom.xml
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/CdiSeamConfigUIAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/ContentAssistantTestCase.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/SeamConfigContentAssistTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/TestUtil.java
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
tests
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.classpath (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.classpath 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.project (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.project 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.cdi.seam.config.ui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/MANIFEST.MF 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.cdi.seam.config.ui.test
+Bundle-Version: 1.0.0.qualifier
+Require-Bundle: org.junit,
+ org.eclipse.ui,
+ org.eclipse.core.resources,
+ org.eclipse.jface.text,
+ org.jboss.tools.common,
+ org.jboss.tools.common.el.core,
+ org.jboss.tools.common.model.ui,
+ org.jboss.tools.cdi.core,
+ org.jboss.tools.cdi.core.test,
+ org.jboss.tools.cdi.seam.config.core,
+ org.jboss.tools.cdi.seam.config.core.test,
+ org.jboss.tools.tests,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %Bundle-Vendor.0
+Export-Package: org.jboss.tools.cdi.seam.config.ui.test
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/build.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/build.properties (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/build.properties 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,9 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.properties,\
+ .
+src.includes = src/,\
+ META-INF/,\
+ build.properties
+jars.compile.order = .
+source.. = src/
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/plugin.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/plugin.properties (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/plugin.properties 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.cdi.seam.config.ui.test
+Bundle-Vendor.0 = JBoss by Red Hat
+Bundle-Name.0 = CDI Seam Config UI Tests Plug-in
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/plugin.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/pom.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/pom.xml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/pom.xml 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.cdi.tests</groupId>
+ <artifactId>org.jboss.tools.cdi.seam.config.ui.test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <properties>
+ <emma.filter>org.jboss.tools.cdi*</emma.filter>
+ <emma.instrument.bundles>org.jboss.tools.cdi.core,org.jboss.tools.cdi.seam.config.ui</emma.instrument.bundles>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.tycho</groupId>
+ <artifactId>maven-osgi-test-plugin</artifactId>
+ <configuration>
+ <explodedBundles>
+ <bundle>org.jboss.tools.cdi.core.test</bundle>
+ </explodedBundles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/CdiSeamConfigUIAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/CdiSeamConfigUIAllTests.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/CdiSeamConfigUIAllTests.java 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.cdi.seam.config.ui.test;
+
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.jboss.tools.cdi.core.test.CDICoreTestSetup;
+import org.jboss.tools.cdi.seam.config.core.test.SeamConfigTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class CdiSeamConfigUIAllTests {
+
+ public static Test suite() {
+ // it could be done here because it is not needed to be enabled back
+ JavaModelManager.getIndexManager().disable();
+
+ TestSuite suiteAll = new TestSuite("CDI Config UI Tests");
+
+ TestSuite suiteConfig = new TestSuite("CDI Seam Config UI Tests");
+ suiteConfig.addTestSuite(SeamConfigContentAssistTest.class);
+
+ suiteAll.addTest(new SeamConfigTestSetup(suiteConfig));
+
+ return suiteAll;
+ }
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/CdiSeamConfigUIAllTests.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/ContentAssistantTestCase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/ContentAssistantTestCase.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/ContentAssistantTestCase.java 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.seam.config.ui.test;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.jboss.tools.common.editor.ObjectMultiPageEditor;
+import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+//copied from ContentAssistantTestCase - they should have common super class
+public class ContentAssistantTestCase extends TestCase {
+ protected IProject project = null;
+ protected IEditorPart editor = null;
+ protected StructuredTextEditor jspTextEditor = null;
+ protected StructuredTextViewer viewer = null;
+ protected IContentAssistant contentAssistant = null;
+ protected IDocument document = null;
+
+ public void openEditor(String fileName) {
+ IEditorPart editorPart = WorkbenchUtils.openEditor(project.getName()+"/"+ fileName); //$NON-NLS-1$
+ editor = editorPart;
+
+//getting editor start
+ if(editorPart instanceof EditorPartWrapper) {
+ editorPart = ((EditorPartWrapper)editorPart).getEditor();
+ }
+ if (editorPart instanceof ObjectMultiPageEditor) {
+ jspTextEditor = ((ObjectMultiPageEditor) editorPart).getSourceEditor();
+ } else if (editorPart instanceof StructuredTextEditor) {
+ jspTextEditor = (StructuredTextEditor)editorPart;
+ }
+
+ // clean deffered events
+ while (Display.getCurrent().readAndDispatch());
+
+//getting editor end.
+
+ viewer = jspTextEditor.getTextViewer();
+ document = viewer.getDocument();
+ SourceViewerConfiguration config = TestUtil
+ .getSourceViewerConfiguration(jspTextEditor);
+ contentAssistant = (config == null ? null : config
+ .getContentAssistant(viewer));
+
+ assertTrue(
+ "Cannot get the Content Assistant instance for the editor for page \"" //$NON-NLS-1$
+ + fileName + "\"", (contentAssistant != null)); //$NON-NLS-1$
+
+ assertTrue("The IDocument is not instance of IStructuredDocument for page \"" //$NON-NLS-1$
+ + fileName + "\"", //$NON-NLS-1$
+ (document instanceof IStructuredDocument));
+
+ }
+
+ public ICompletionProposal[] checkProposals(String fileName, int offset, String[] proposals, boolean exactly) {
+ return checkProposals(fileName, null, offset, proposals, exactly, true);
+ }
+
+ public ICompletionProposal[] checkProposals(String fileName, String substring, int offset, String[] proposals, boolean exactly) {
+ return checkProposals(fileName, substring, offset, proposals, exactly, false);
+ }
+ public ICompletionProposal[] checkProposals(String fileName, String substring, int offset, String[] proposals, boolean exactly, boolean excludeELProposalsFromExactTest){
+ openEditor(fileName);
+
+ int position = 0;
+ if (substring != null) {
+ String documentContent = document.get();
+ position = documentContent.indexOf(substring);
+ }
+
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, position+offset);
+
+ assertTrue("Content Assistant returned no proposals", (res != null && res.size() > 0)); //$NON-NLS-1$
+
+ // for (int i = 0; i < result.length; i++) {
+ // System.out.println("proposal - "+result[i].getDisplayString());
+ // }
+
+ ICompletionProposal[] result = res.toArray(new ICompletionProposal[res.size()]);
+ int foundCounter = 0;
+ for (int i = 0; i < proposals.length; i++) {
+ boolean found = compareProposal(proposals[i], result);
+ if (found)
+ foundCounter++;
+ assertTrue("Proposal " + proposals[i] + " not found!", found ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (exactly) {
+ if (excludeELProposalsFromExactTest) {
+ assertTrue("Some other proposals were found!", foundCounter == proposals.length); //$NON-NLS-1$
+ } else {
+ assertTrue("Some other proposals were found!", result.length == proposals.length); //$NON-NLS-1$
+ }
+ }
+
+// System.out.println("checkProposals <<< Exiting");
+ return result;
+ }
+
+ //CustomCompletionProposal instead of AutoContentAssistantProposal
+ public boolean compareProposal(String proposalName, ICompletionProposal[] proposals){
+ for (int i = 0; i < proposals.length; i++) {
+ if (proposals[i] instanceof CustomCompletionProposal) {
+ CustomCompletionProposal ap = (CustomCompletionProposal)proposals[i];
+
+ if(proposals[i].getClass() == CustomCompletionProposal.class) {
+ //It is wtp's proposal - ignore it.
+ continue;
+ }
+
+ String replacementString = ap.getReplacementString().toLowerCase();
+ if (replacementString.equalsIgnoreCase(proposalName)) return true;
+
+
+ // For a tag proposal there will be not only the the tag name but all others characters like default attributes, tag ending characters and so on
+ if (replacementString.indexOf("/>") != -1) {
+ replacementString = replacementString.substring(0, replacementString.indexOf("/>"));
+ }
+ if (replacementString.indexOf('>') != -1) {
+ replacementString = replacementString.substring(0, replacementString.indexOf('>'));
+ }
+ if (replacementString.equalsIgnoreCase(proposalName)) return true;
+
+ String[] replacementStringParts = replacementString.split(" "); //$NON-NLS-1$
+ if (replacementStringParts != null && replacementStringParts.length > 0) {
+ if (replacementStringParts[0].equalsIgnoreCase(proposalName)) return true;
+ }
+
+ // for an attribute proposal there will be a pare of attribute-value (i.e. attrName="attrValue")
+ replacementStringParts = replacementString.split("="); //$NON-NLS-1$
+ if (replacementStringParts != null && replacementStringParts.length > 0) {
+ if (replacementStringParts[0].equalsIgnoreCase(proposalName)) return true;
+ }
+
+ // for an Unclosed EL the closing character is appended to the proposal string (i.e. person} )
+ // perform case sensitive compare operation
+ replacementStringParts = replacementString.split("}"); //$NON-NLS-1$
+ if (replacementStringParts != null && replacementStringParts.length > 0) {
+ if (replacementStringParts[0].equals(proposalName)) return true;
+ }
+
+ // For an attribute value proposal there will be the quote characters
+ replacementString = Utils.trimQuotes(replacementString);
+ if (replacementString.equalsIgnoreCase(proposalName)) return true;
+
+ } else {
+ if(proposals[i].getDisplayString().toLowerCase().equals(proposalName.toLowerCase())) return true;
+ }
+ }
+ return false;
+ }
+
+ public void closeEditor() {
+ if (editor != null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().closeEditor(editor, false);
+ editor = null;
+ }
+ }
+
+ /**
+ * @return the project
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /**
+ * @param project the project to set
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ /**
+ * @return the jspTextEditor
+ */
+ public StructuredTextEditor getTextEditor() {
+ return jspTextEditor;
+ }
+
+ /**
+ * @return the viewer
+ */
+ public StructuredTextViewer getViewer() {
+ return viewer;
+ }
+
+ /**
+ * @param viewer the viewer to set
+ */
+ public void setViewer(StructuredTextViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /**
+ * @return the contentAssistant
+ */
+ public IContentAssistant getContentAssistant() {
+ return contentAssistant;
+ }
+
+ /**
+ * @param contentAssistant the contentAssistant to set
+ */
+ public void setContentAssistant(IContentAssistant contentAssistant) {
+ this.contentAssistant = contentAssistant;
+ }
+
+ /**
+ * @return the document
+ */
+ public IDocument getDocument() {
+ return document;
+ }
+
+ /**
+ * @param document the document to set
+ */
+ public void setDocument(IDocument document) {
+ this.document = document;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/ContentAssistantTestCase.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/SeamConfigContentAssistTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/SeamConfigContentAssistTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/SeamConfigContentAssistTest.java 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,69 @@
+package org.jboss.tools.cdi.seam.config.ui.test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+public class SeamConfigContentAssistTest extends ContentAssistantTestCase {
+ protected static String PLUGIN_ID = "org.jboss.tools.cdi.seam.config.core.test";
+ protected static String PROJECT_NAME = "CDIConfigTest";
+ protected static String PROJECT_PATH = "/projects/CDIConfigTest";
+
+ protected static String FILE_PATH = "src/META-INF/seam-beans.xml";
+
+ protected ICDIProject cdiProject;
+
+ public SeamConfigContentAssistTest() {
+ project = getTestProject();
+ cdiProject = CDICorePlugin.getCDIProject(project, false);
+ }
+
+ public IProject getTestProject() {
+ if(project==null) {
+ try {
+ project = findTestProject();
+ if(project==null || !project.exists()) {
+ project = ResourcesUtils.importProject(PLUGIN_ID, PROJECT_PATH);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import CDI test project: " + e.getMessage());
+ }
+ }
+ return project;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ }
+
+ public void testCustomClasses() {
+ String[] proposals = {"test01:MyBean1", "test01:MyBean2", "test01:MyBean3", "test01:MyBean4"};
+ checkProposals(FILE_PATH, "<test01:", 8, proposals, true);
+ }
+
+ public void testEEClassesAndKeyWords() {
+ String[] proposals = {"s:modifies"};
+ checkProposals(FILE_PATH, "<s:mo", 5, proposals, true);
+ proposals = new String[]{"s:modifies", "s:replaces", "s:parameters",
+ "s:Inject", "s:Alternative", "s:Delegate", "s:Dependent", "s:Disposes",
+ "s:Named", "s:New", "s:NormalScope"};
+ checkProposals(FILE_PATH, "<s:mo", 3, proposals, false);
+ }
+
+ public void testPackageInNamespace() {
+ String[] proposals = {
+ "urn:java:org.jboss.beans.test01",
+ "urn:java:org.jboss.beans.test02",
+ "urn:java:org.jboss.beans.test03",
+ "urn:java:org.jboss.beans.test04",
+ "urn:java:org.jboss.beans.test05",
+ "urn:java:org.jboss.beans.test06"};
+ String text = "urn:java:org.jboss.beans.";
+ checkProposals(FILE_PATH, text, text.length(), proposals, false);
+ }
+
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/SeamConfigContentAssistTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/TestUtil.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/TestUtil.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/TestUtil.java 2011-05-21 00:05:23 UTC (rev 31407)
@@ -0,0 +1,144 @@
+package org.jboss.tools.cdi.seam.config.ui.test;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistantExtension;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.wst.sse.ui.internal.contentassist.StructuredContentAssistant;
+import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
+
+//copied from org.jboss.tools.jst.jsp.test.TestUtil
+//TODO remove this class and move original to common
+public class TestUtil {
+
+ /** The Constant MAX_IDLE. */
+ public static final long MAX_IDLE = 5*60*1000L;
+
+ /**
+ * Returns the CA Processor from content assistant for the given offset in the document.
+ *
+ *
+ * @param viewer
+ * @param offset
+ * @param ca
+ */
+
+ public static IContentAssistProcessor getProcessor(ITextViewer viewer, int offset, IContentAssistant ca) {
+ try {
+ IDocument document= viewer.getDocument();
+ String type= TextUtilities.getContentType(document, ((IContentAssistantExtension)ca).getDocumentPartitioning(), offset, true);
+ return ca.getContentAssistProcessor(type);
+ } catch (BadLocationException x) {
+ }
+
+ return null;
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ public static void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+
+ // If this is the UI thread,
+ // then process input.
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ /**
+ * Wait for idle.
+ */
+ public static void waitForIdle(long maxIdle) {
+ long start = System.currentTimeMillis();
+ while (!Job.getJobManager().isIdle()) {
+ delay(500);
+ if ( (System.currentTimeMillis()-start) > maxIdle )
+ throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
+ }
+ }
+
+ public static SourceViewerConfiguration getSourceViewerConfiguration(AbstractTextEditor editor) {
+ Class editorClass = editor.getClass();
+ while (editorClass != null) {
+ try {
+ Method m = editorClass.getDeclaredMethod("getSourceViewerConfiguration", new Class[] {});
+
+ if(m != null) {
+ m.setAccessible(true);
+ Object result = m.invoke(editor, new Object[]{});
+ return (result instanceof SourceViewerConfiguration ? (SourceViewerConfiguration)result : null);
+ }
+ } catch (NoSuchMethodException ne) {
+ } catch (Exception e) {
+ }
+ editorClass = editorClass.getSuperclass();
+ }
+ return null;
+
+ }
+
+ public static void prepareCAInvokation(IContentAssistant ca, ITextViewer viewer, int offset) {
+ if (ca == null || viewer == null)
+ return;
+
+ // sets cursor position
+ viewer.getTextWidget().setCaretOffset(offset);
+
+ TestUtil.waitForIdle(TestUtil.MAX_IDLE);
+ TestUtil.delay(1000);
+
+ ca.showPossibleCompletions();
+ }
+
+ public static int MAX_CATEGORIES_COUNT = 10;
+ public static List<ICompletionProposal> collectProposals(IContentAssistant ca, ITextViewer viewer, int offset) {
+ prepareCAInvokation(ca, viewer, offset);
+
+ final IContentAssistProcessor p= TestUtil.getProcessor(viewer, offset, ca);
+ List<ICompletionProposal> res= new ArrayList<ICompletionProposal>();
+ // Try to acquire all the proposal categories assuming that there are less than 10 or equal
+ for (int i = 0; i < MAX_CATEGORIES_COUNT && p != null; i++) {
+ ICompletionProposal[] result= p.computeCompletionProposals(viewer, offset);
+ for (int j = 0; result != null && j < result.length; j++) {
+ res.add(result[j]);
+ }
+ }
+ return ProposalSorter.filterAndSortProposals(res, null, null);
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.ui.test/src/org/jboss/tools/cdi/seam/config/ui/test/TestUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 4 months
JBoss Tools SVN: r31405 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui: src/org/jboss/tools/cdi/seam/config/ui/contentassist and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-20 20:02:39 -0400 (Fri, 20 May 2011)
New Revision: 31405
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath 2011-05-20 18:32:51 UTC (rev 31404)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath 2011-05-21 00:02:39 UTC (rev 31405)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-20 18:32:51 UTC (rev 31404)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-21 00:02:39 UTC (rev 31405)
@@ -172,8 +172,8 @@
Set<TagData> tagData = collectTagData();
for (TagData tag: tagData) {
- if(tag.isUnique()) {
- if(XMLUtilities.getUniqueChild((Element)parentElement, tag.getName()) != null) continue;
+ if(tag.isUnique() && childOtherThanCurrentNodeExists(tag.getName())) {
+ continue;
}
String tagText = tag.getText();
int positionAdjustment = (tagText.indexOf("><") > 0) ? tagText.indexOf("><") + 1 : tagText.length();
@@ -185,6 +185,11 @@
}
}
+ private boolean childOtherThanCurrentNodeExists(String tagName) {
+ Element element = XMLUtilities.getUniqueChild((Element)parentElement, tagName);
+ return element != null && element != currentNode;
+ }
+
private Set<TagData> collectTagData() {
String parentElementName = sax.getLocalName();
String parentElementPrefix = sax.getPrefix();
@@ -213,11 +218,12 @@
addTypeNames(tagData, true, false); //only annotations allowed here.
addTagData(tagData, getTagNamesForMembers(parentElementPrefix, contextType, false), RELEVANCE_TAG_MEMBER);
- if(eePrefix != null
- && XMLUtilities.getUniqueChild((Element)parentElement, eePrefix + ":" + KEYWORD_MODIFIES) == null
- && XMLUtilities.getUniqueChild((Element)parentElement, eePrefix + ":" + KEYWORD_REPLACES) == null) {
- addTagData(tagData, eePrefix, KEYWORD_MODIFIES, false, true, RELEVANCE_TAG_KEYWORD);
- addTagData(tagData, eePrefix, KEYWORD_REPLACES, false, true, RELEVANCE_TAG_KEYWORD);
+ if(eePrefix != null) {
+ if(!childOtherThanCurrentNodeExists(eePrefix + ":" + KEYWORD_MODIFIES)
+ && !childOtherThanCurrentNodeExists(eePrefix + ":" + KEYWORD_REPLACES)) {
+ addTagData(tagData, eePrefix, KEYWORD_MODIFIES, false, true, RELEVANCE_TAG_KEYWORD);
+ addTagData(tagData, eePrefix, KEYWORD_REPLACES, false, true, RELEVANCE_TAG_KEYWORD);
+ }
addTagData(tagData, eePrefix, KEYWORD_PARAMETERS, true, true, RELEVANCE_TAG_KEYWORD);
}
} else if(sax.getParent() != null && ((contextType = Util.resolveType(sax.getParent(), cdi)) != null)) {
@@ -318,8 +324,8 @@
}
for (TagData tag: tagData) {
- if(tag.isUnique()) {
- if(XMLUtilities.getUniqueChild((Element)parentElement, tag.getName()) != null) continue;
+ if(tag.isUnique() && childOtherThanCurrentNodeExists(tag.getName())) {
+ continue;
}
String tagText = isEnded ? tag.getName() : tag.getText();
if(tagText.startsWith("<")) tagText = tagText.substring(1);
@@ -451,7 +457,9 @@
CustomCompletionProposal textProposal = new CustomCompletionProposal(
tagText, begin, length, positionAdjustment,
CDISeamConfigUiImages.PACKAGE_IMAGE,
- displayText, null, proposedInfo, relevance);
+ displayText, null, proposedInfo, relevance) {
+ // we make it our own type to filter from WTP's proposals
+ };
contentAssistRequest.addProposal(textProposal);
}
13 years, 4 months
JBoss Tools SVN: r31404 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-05-20 14:32:51 -0400 (Fri, 20 May 2011)
New Revision: 31404
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
Log:
https://issues.jboss.org/browse/JBIDE-8977
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-05-20 18:14:37 UTC (rev 31403)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-05-20 18:32:51 UTC (rev 31404)
@@ -99,8 +99,8 @@
// original + deployed
ArrayList<IQualifier> total = new ArrayList<IQualifier>();
- private TableViewer availableListViewer;
- private TableViewer deployedListViewer;
+ private TableViewer availableTableViewer;
+ private TableViewer deployedTableViewer;
private Button add, addAll;
private Button remove, removeAll;
@@ -141,12 +141,12 @@
}
}
- deployedListViewer.setInput(originalQualifiers);
+ deployedTableViewer.setInput(originalQualifiers);
qualifiers.clear();
loadAvailableQualifiers();
- availableListViewer.setInput(qualifiers);
+ availableTableViewer.setInput(qualifiers);
if(nLabel != null)
nLabel.setText(MessageFormat.format(CDIUIMessages.ADD_QUALIFIERS_TO_BEAN_WIZARD_MESSAGE,
new Object[]{bean.getBeanClass().getElementName()}));
@@ -204,10 +204,10 @@
Display.getDefault().syncExec(new Runnable() {
public void run() {
- if (availableListViewer == null || availableListViewer.getControl().isDisposed())
+ if (availableTableViewer == null || availableTableViewer.getControl().isDisposed())
return;
- availableListViewer.refresh();
- deployedListViewer.refresh();
+ availableTableViewer.refresh();
+ deployedTableViewer.refresh();
setEnablement();
}
});
@@ -286,7 +286,7 @@
pattern.setLayoutData(data);
pattern.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e){
- availableListViewer.refresh();
+ availableTableViewer.refresh();
}
});
pattern.setFocus();
@@ -306,18 +306,18 @@
label = new Label(this, SWT.NONE);
label.setText(CDIUIMessages.ADD_QUALIFIERS_TO_BEAN_WIZARD_IN_BEAN);
- Table availableList = new Table(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ Table availableTable = new Table(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
data = new GridData(GridData.FILL_BOTH);
data.heightHint = 200;
data.widthHint = 150;
- availableList.setLayoutData(data);
+ availableTable.setLayoutData(data);
- availableListViewer = new TableViewer(availableList);
+ availableTableViewer = new TableViewer(availableTable);
- availableListViewer.setLabelProvider(labelProvider);
+ availableTableViewer.setLabelProvider(labelProvider);
IContentProvider contentProvider = new QualifiersListContentProvider();
- availableListViewer.setContentProvider(contentProvider);
- availableListViewer.setComparator(new ViewerComparator() {
+ availableTableViewer.setContentProvider(contentProvider);
+ availableTableViewer.setComparator(new ViewerComparator() {
public int compare(Viewer viewer, Object o1, Object o2) {
if (o1 instanceof IQualifier && o2 instanceof IQualifier) {
IQualifier q1 = (IQualifier) o1;
@@ -328,21 +328,21 @@
return super.compare(viewer, o1, o2);
}
});
- availableListViewer.setInput(qualifiers);
+ availableTableViewer.setInput(qualifiers);
- availableListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ availableTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
setEnablement();
}
});
- availableListViewer.addDoubleClickListener(new IDoubleClickListener() {
+ availableTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
setEnablement();
if (add.isEnabled())
add(false);
}
});
- availableListViewer.addFilter(new QualifierFilter());
+ availableTableViewer.addFilter(new QualifierFilter());
Composite comp = new Composite(this, SWT.NONE);
data = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
@@ -394,15 +394,15 @@
}
});
- Table deployedList = new Table(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ Table deployedTable = new Table(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
data = new GridData(GridData.FILL_BOTH);
data.widthHint = 150;
- deployedList.setLayoutData(data);
+ deployedTable.setLayoutData(data);
- deployedListViewer = new TableViewer(deployedList);
- deployedListViewer.setLabelProvider(labelProvider);
- deployedListViewer.setContentProvider(contentProvider);
- deployedListViewer.setComparator(new ViewerComparator() {
+ deployedTableViewer = new TableViewer(deployedTable);
+ deployedTableViewer.setLabelProvider(labelProvider);
+ deployedTableViewer.setContentProvider(contentProvider);
+ deployedTableViewer.setComparator(new ViewerComparator() {
public int compare(Viewer viewer, Object o1, Object o2) {
if (o1 instanceof IQualifier && o2 instanceof IQualifier) {
IQualifier q1 = (IQualifier) o1;
@@ -413,14 +413,14 @@
return super.compare(viewer, o1, o2);
}
});
- deployedListViewer.setInput(originalQualifiers);
+ deployedTableViewer.setInput(originalQualifiers);
- deployedListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ deployedTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
setEnablement();
}
});
- deployedListViewer.addDoubleClickListener(new IDoubleClickListener() {
+ deployedTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
setEnablement();
if (remove.isEnabled())
@@ -487,7 +487,7 @@
}
protected IQualifier[] getAvailableSelection() {
- IStructuredSelection sel = (IStructuredSelection) availableListViewer.getSelection();
+ IStructuredSelection sel = (IStructuredSelection) availableTableViewer.getSelection();
if (sel.isEmpty())
return new IQualifier[0];
@@ -497,7 +497,7 @@
}
protected IQualifier[] getDeployedSelection() {
- IStructuredSelection sel = (IStructuredSelection) deployedListViewer.getSelection();
+ IStructuredSelection sel = (IStructuredSelection) deployedTableViewer.getSelection();
if (sel.isEmpty())
return new IQualifier[0];
@@ -595,13 +595,13 @@
if (add2) {
qualifiers.remove(qualifier);
deployed.add(qualifier);
- availableListViewer.remove(qualifier);
- deployedListViewer.add(qualifier);
+ availableTableViewer.remove(qualifier);
+ deployedTableViewer.add(qualifier);
} else {
qualifiers.add(qualifier);
deployed.remove(qualifier);
- availableListViewer.add(qualifier);
- deployedListViewer.remove(qualifier);
+ availableTableViewer.add(qualifier);
+ deployedTableViewer.remove(qualifier);
}
}
@@ -609,12 +609,12 @@
if(deployed.isEmpty() || (namedQualifier != null && deployed.size() == 1 && deployed.contains(namedQualifier))) {
if(!originalQualifiers.contains(defaultQualifier)){
originalQualifiers.add(defaultQualifier);
- deployedListViewer.add(defaultQualifier);
+ deployedTableViewer.add(defaultQualifier);
}
}else{
if(originalQualifiers.contains(defaultQualifier)){
originalQualifiers.remove(defaultQualifier);
- deployedListViewer.remove(defaultQualifier);
+ deployedTableViewer.remove(defaultQualifier);
}
}
}
13 years, 4 months