Author: adietish
Date: 2010-12-03 13:44:17 -0500 (Fri, 03 Dec 2010)
New Revision: 27156
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java
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/DeltaCloudInstance.java
Log:
[JBIDE-7688] provide common superclass and interface to DeltaCloudImage and
DeltaCloudInstance
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java 2010-12-03
18:44:17 UTC (rev 27156)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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;
+
+
+/**
+ * A common superclass for cloud elements. Currently know subclasses are DeltaCloudImage
and DeltaCloudInstance.
+ *
+ * @see DeltaCloudInstance
+ * @see DeltaCloudImage
+ *
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractDeltaCloudElement implements IDeltaCloudElement {
+
+ private DeltaCloud cloud;
+
+ protected AbstractDeltaCloudElement(DeltaCloud cloud) {
+ this.cloud = cloud;
+ }
+
+ public DeltaCloud getDeltaCloud() {
+ return cloud;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2010-12-03
18:43:44 UTC (rev 27155)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2010-12-03
18:44:17 UTC (rev 27156)
@@ -13,14 +13,23 @@
import org.jboss.tools.deltacloud.core.client.Image;
-public class DeltaCloudImage {
+/**
+ * A image that may be reached on a DeltaCloud instance. Wraps Image from upper layers.
+ *
+ * @see Image
+ * @see DeltaCloud
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class DeltaCloudImage extends AbstractDeltaCloudElement {
private Image image;
private DeltaCloud deltaCloud;
public DeltaCloudImage(Image image, DeltaCloud deltaCloud) {
+ super(deltaCloud);
this.image = image;
- this.deltaCloud = deltaCloud;
}
public DeltaCloud getDeltaCloud() {
@@ -31,6 +40,10 @@
return image.getName();
}
+ public String getId() {
+ return image.getId();
+ }
+
public String getArchitecture() {
return image.getArchitecture();
}
@@ -38,8 +51,4 @@
public String getDescription() {
return image.getDescription();
}
-
- public String getId() {
- return image.getId();
- }
}
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 2010-12-03
18:43:44 UTC (rev 27155)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-12-03
18:44:17 UTC (rev 27156)
@@ -18,7 +18,16 @@
import org.jboss.tools.deltacloud.core.client.InstanceAction;
import org.jboss.tools.deltacloud.core.client.InternalDeltaCloudClient;
-public class DeltaCloudInstance {
+/**
+ * An instance that may be reached on a DeltaCloud instance. Wraps Instance from upper
layers.
+ *
+ * @see Instance
+ * @see DeltaCloud
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class DeltaCloudInstance extends AbstractDeltaCloudElement {
public final static String PENDING = Instance.InstanceState.PENDING.toString();
public final static String RUNNING = Instance.InstanceState.RUNNING.toString();
@@ -31,12 +40,11 @@
public final static String REBOOT = InstanceAction.REBOOT;
public final static String DESTROY = InstanceAction.DESTROY;
- private DeltaCloud cloud;
private Instance instance;
private String givenName;
public DeltaCloudInstance(DeltaCloud cloud, Instance instance) {
- this.cloud = cloud;
+ super(cloud);
this.instance = instance;
}
@@ -119,10 +127,6 @@
return hostNames.get(0);
return null;
}
-
- public DeltaCloud getDeltaCloud() {
- return cloud;
- }
protected boolean performInstanceAction(String actionId, InternalDeltaCloudClient
client)
throws DeltaCloudClientException {
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java 2010-12-03
18:44:17 UTC (rev 27156)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * A common interface for all elements of a cloud. Currently known implementors
+ * are DeltaCloudImage and DeltaCloudInstance.
+ *
+ * @see DeltaCloudImage
+ * @see DeltaCloudInstace
+ *
+ * @author Andre Dietisheim
+ */
+public interface IDeltaCloudElement {
+
+ public DeltaCloud getDeltaCloud();
+
+ public String getName();
+
+ public String getId();
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain