diff options
author | Selvasundaram <selvam@gluster.com> | 2011-07-14 20:40:29 +0530 |
---|---|---|
committer | Selvasundaram <selvam@gluster.com> | 2011-07-14 20:40:29 +0530 |
commit | 4a85ffe9e19f1880f4e00468fdee56191babc818 (patch) | |
tree | a88061820614de7d36d408569c9ea7dcf0c4c2d9 /src/com.gluster.storage.management.client/src/com/gluster/storage/management | |
parent | 0c8eaa743eecf409e299a82080c629b744c44592 (diff) |
Export SSH keys feature
Diffstat (limited to 'src/com.gluster.storage.management.client/src/com/gluster/storage/management')
2 files changed, 59 insertions, 1 deletions
diff --git a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/AbstractClient.java b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/AbstractClient.java index 8898cf92..c083d298 100644 --- a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/AbstractClient.java +++ b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/AbstractClient.java @@ -32,6 +32,7 @@ import com.sun.jersey.api.client.WebResource.Builder; import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.representation.Form;
import com.sun.jersey.client.urlconnection.HTTPSProperties;
+import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.core.util.MultivaluedMapImpl;
@@ -135,6 +136,7 @@ public abstract class AbstractClient { return res.queryParams(queryParams).header(HTTP_HEADER_AUTH, authHeader).accept(MediaType.APPLICATION_XML)
.get(responseClass);
} catch (Exception e1) {
+ e1.printStackTrace();
throw createGlusterException(e1);
}
}
@@ -160,7 +162,7 @@ public abstract class AbstractClient { return new GlusterRuntimeException("Couldn't connect to Gluster Management Gateway!");
}
- return new GlusterRuntimeException("Exception in REST communication!", e);
+ return new GlusterRuntimeException("Exception in REST communication! [" + e.getMessage() + "]", e);
}
}
@@ -185,6 +187,13 @@ public abstract class AbstractClient { throw new GlusterRuntimeException("Error while downloading resource [" + res.getURI().getPath() + "]", e);
}
}
+
+
+/* public void uploadResource(WebResource res, FormDataMultiPart form) {
+ ClientResponse response = res.header(HTTP_HEADER_AUTH, authHeader).type(MediaType.MULTIPART_FORM_DATA)
+ .accept(MediaType.TEXT_PLAIN).header(name, value)post(form);
+ }
+*/
/**
* Fetches the default resource (the one returned by {@link AbstractClient#getResourcePath()}) by dispatching a GET
diff --git a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/KeysClient.java b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/KeysClient.java new file mode 100644 index 00000000..15c70146 --- /dev/null +++ b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/KeysClient.java @@ -0,0 +1,49 @@ +/** + * KeysClient.java + * + * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ +package com.gluster.storage.management.client; + +import java.io.File; + +public class KeysClient extends AbstractClient { + // Resource path: /glustermg/1.0/keys + private static final String RESOURCE_NAME = "keys"; + + public KeysClient() { + super(); + } + + public KeysClient(String clusterName) { + super(clusterName); + } + + @Override + public String getResourcePath() { + return RESOURCE_NAME; + } + + public void exportSshKeys(String filePath) { + downloadResource(resource, filePath); + } + + public void importSshKeys(File keysFile) { + + } +} |