Author: jjohnstn
Date: 2010-09-01 20:12:04 -0400 (Wed, 01 Sep 2010)
New Revision: 24633
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
Log:
2010-09-01 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (deleteKey): Change
arguments to just the key name is given. Don't delete any file.
(createKey): Change the directory argument to just be a String instead of an IPath.
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java (deleteKey): New method.
(createKey): Ditto.
(refreshInstance): Remove stack trace on error since a pending cloud start will
result in not found until the cloud actually is running.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-09-01 21:48:21
UTC (rev 24632)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-09-02 00:12:04
UTC (rev 24633)
@@ -1,3 +1,13 @@
+2010-09-01 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (deleteKey): Change
+ arguments to just the key name is given. Don't delete any file.
+ (createKey): Change the directory argument to just be a String instead of an IPath.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (deleteKey): New method.
+ (createKey): Ditto.
+ (refreshInstance): Remove stack trace on error since a pending cloud start will
+ result in not found until the cloud actually is running.
+
2010-08-30 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/Activator.java: Add Copyright and License info.
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-09-01
21:48:21 UTC (rev 24632)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-09-02
00:12:04 UTC (rev 24633)
@@ -16,6 +16,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.equinox.security.storage.EncodingUtils;
import org.eclipse.equinox.security.storage.ISecurePreferences;
@@ -176,7 +177,23 @@
notifyInstanceListListeners(instanceArray);
return instanceArray;
}
+
+ public void createKey(String keyname, String keystoreLocation) throws
DeltaCloudException {
+ try {
+ client.createKey(keyname, keystoreLocation);
+ } catch (DeltaCloudClientException e) {
+ throw new DeltaCloudException(e);
+ }
+ }
+ public void deleteKey(String keyname) throws DeltaCloudException {
+ try {
+ client.deleteKey(keyname);
+ } catch (DeltaCloudClientException e) {
+ throw new DeltaCloudException(e);
+ }
+ }
+
public DeltaCloudInstance refreshInstance(String instanceId) {
DeltaCloudInstance retVal = null;
try {
@@ -196,7 +213,7 @@
}
}
} catch (DeltaCloudClientException e) {
- e.printStackTrace();
+ // will get here when a pending instance is being checked
}
return retVal;
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-09-01
21:48:21 UTC (rev 24632)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-09-02
00:12:04 UTC (rev 24633)
@@ -43,7 +43,7 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.log4j.Logger;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -247,14 +247,14 @@
return JAXB.unmarshal(sendRequest(DCNS.REALMS + "/" + realmId,
RequestType.GET), Realm.class);
}
- public void createKey(String keyname, IPath keyStoreLocation) throws
DeltaCloudClientException {
+ public void createKey(String keyname, String keyStoreLocation) throws
DeltaCloudClientException {
String xml = sendRequest(DCNS.KEYS + "?name=" + keyname, RequestType.POST);
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new InputSource(new StringReader(xml)));
List<String> keyText = getElementText(document, "pem"); //$NON-NLS-1$
- File keyFile = keyStoreLocation.append(keyname + ".pem").toFile();
//$NON-NLS-1$
+ File keyFile = Path.fromOSString(keyStoreLocation).append(keyname +
".pem").toFile(); //$NON-NLS-1$
if (!keyFile.exists())
keyFile.createNewFile();
keyFile.setReadable(false, false);
@@ -279,14 +279,8 @@
}
}
- public void deleteKey(String keyname, IPath keyStoreLocation) throws
DeltaCloudClientException {
- try {
- File keyFile = keyStoreLocation.append(keyname + ".pem").toFile();
//$NON-NLS-1$
- if (keyFile.exists())
- keyFile.delete();
- } finally {
- sendRequest(DCNS.KEYS + "/" + keyname, RequestType.DELETE);
- }
+ public void deleteKey(String keyname) throws DeltaCloudClientException {
+ sendRequest(DCNS.KEYS + "/" + keyname, RequestType.DELETE);
}
@Override
Show replies by date