Map
view of the specified container.
+ * Creates a Map
view of the specified container. Use this for
+ * simplest access to blobstore, knowing that MD5s will be calculated for every object.
*
* @param container
+ * existing container you wish to read or modify
+ * @param options
+ * allow you to specify a directory within the container, or whether to list
+ * recursively.
*/
InputStreamMap createInputStreamMap(String container, ListContainerOptions options);
+ /**
+ * Creates a Map
view of the specified container. Use this for
+ * simplest access to blobstore, knowing that MD5s will be calculated for every object.
+ *
+ * Only root-level blobs will be visible.
+ *
+ * @param container
+ * existing container you wish to read or modify
+ */
InputStreamMap createInputStreamMap(String container);
/**
- * Creates a Map
view of the specified container.
+ * Creates a Map
view of the specified container. Use this when you wan
+ * to control the content type, or manually specify length or size of blobs.
*
* @param container
+ * existing container you wish to read or modify
+ * @param options
+ * allow you to specify a directory within the container, or whether to list
+ * recursively.
*/
BlobMap createBlobMap(String container, ListContainerOptions options);
+ /**
+ * Creates a Map
view of the specified container. Use this when you wan
+ * to control the content type, or manually specify length or size of blobs.
+ *
+ * Only root-level blobs will be visible.
+ *
+ * @param container
+ * existing container you wish to read or modify
+ */
BlobMap createBlobMap(String container);
+ /**
+ * @return a portable asynchronous interface for the BlobStore, which returns {@code Future}s for
+ * each call.
+ */
AsyncBlobStore getAsyncBlobStore();
+ /**
+ * @return a portable interface for the BlobStore.
+ */
BlobStore getBlobStore();
+ /**
+ *
+ * @return best guess at the consistency model used in this BlobStore.
+ */
ConsistencyModels getConsistencyModel();
+ /**
+ *
+ * @return a context you can use to the access provider or vendor specific api underlying this
+ * context.
+ */
RestContext getProviderSpecificContext();
+ /**
+ * closes threads and resources related to this connection.
+ *
+ */
void close();
}
\ No newline at end of file
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java
index 4d497defa6..e7c71917f4 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java
@@ -28,6 +28,13 @@ import org.jclouds.rest.RestContextFactory;
/**
* Helper class to instantiate {@code BlobStoreContext} instances.
*
+ * + * BlobStoreContext context = new BlobStoreContextFactory() + * .createContext("s3", accesskeyid, secretkey); + *+ * * @author Adrian Cole */ public class BlobStoreContextFactory extends @@ -54,6 +61,9 @@ public class BlobStoreContextFactory extends super(properties); } + /** + * {@inheritDoc} + */ @Override protected BlobStoreContext build(BlobStoreContextBuilder, ?> contextBuilder) { return contextBuilder.buildBlobStoreContext(); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/domain/Blob.java b/blobstore/src/main/java/org/jclouds/blobstore/domain/Blob.java index 600916970e..3a00c6ddbf 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/domain/Blob.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/domain/Blob.java @@ -24,15 +24,21 @@ import com.google.common.collect.Multimap; import com.google.inject.internal.Nullable; /** - * Value type for an HTTP Blob service. Blobs are stored in containers and consist - * of a {@link org.jclouds.blobstore.domain.Value#getContent() value}, a {@link Blob#getKey key and - * - * @link Blob.Metadata#getUserMetadata() metadata} + * Value type for an HTTP Blob service. Blobs are stored in containers and consist of a + * {@link MutableBlobMetadata#getName name}, {@link Payload payload}, and + * {@link MutableBlobMetadata metadata}. * * @author Adrian Cole */ public interface Blob extends PayloadEnclosing, Comparable
implements HttpCommandEx protected abstract Q convert(HttpRequest request) throws IOException, InterruptedException; - /** - * - * FIXME Comment this - * - * @param nativeRequest - * @return - * @throws IOException - * @throws InterruptedException - * if interrupted waiting for a connection. - */ protected abstract HttpResponse invoke(Q nativeRequest) throws IOException, InterruptedException; protected abstract void cleanup(Q nativeResponse); diff --git a/core/src/main/java/org/jclouds/http/internal/HttpWire.java b/core/src/main/java/org/jclouds/http/internal/HttpWire.java index 247faceebc..ba5e00caab 100644 --- a/core/src/main/java/org/jclouds/http/internal/HttpWire.java +++ b/core/src/main/java/org/jclouds/http/internal/HttpWire.java @@ -26,10 +26,8 @@ import org.jclouds.logging.Logger; import org.jclouds.logging.internal.Wire; /** - * Logs data to the wire LOG. * * @author Adrian Cole - * @see org.apache.HttpWire.impl.conn.Wire */ public class HttpWire extends Wire { diff --git a/core/src/main/java/org/jclouds/http/internal/SignatureWire.java b/core/src/main/java/org/jclouds/http/internal/SignatureWire.java index dc105eb443..57af2f748c 100644 --- a/core/src/main/java/org/jclouds/http/internal/SignatureWire.java +++ b/core/src/main/java/org/jclouds/http/internal/SignatureWire.java @@ -26,10 +26,7 @@ import org.jclouds.logging.Logger; import org.jclouds.logging.internal.Wire; /** - * Logs data to the wire LOG. - * * @author Adrian Cole - * @see org.apache.HttpWire.impl.conn.Wire */ public class SignatureWire extends Wire { diff --git a/core/src/main/java/org/jclouds/http/options/GetOptions.java b/core/src/main/java/org/jclouds/http/options/GetOptions.java index 7542c62d81..e6472b0c92 100644 --- a/core/src/main/java/org/jclouds/http/options/GetOptions.java +++ b/core/src/main/java/org/jclouds/http/options/GetOptions.java @@ -44,8 +44,8 @@ import com.google.common.collect.Multimap; * import static org.jclouds.http.options.GetOptions.Builder.* * * - * // this will get the first megabyte of an object, provided it wasn't modified since yesterday - * ListenableFutureobject = client.get("objectName",range(0,1024).ifUnmodifiedSince(new Date().minusDays(1))); + * // this will get the first megabyte of an object. + * blob = client.get("objectName",range(0,1024)); * * * @author Adrian Cole @@ -106,7 +106,7 @@ public class GetOptions extends BaseHttpRequestOptions { /** * Only return the object if it has changed since this time. * - * Not compatible with {@link #ifETagMatches(byte[])} or {@link #ifUnmodifiedSince(Date)} + * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, @@ -124,7 +124,7 @@ public class GetOptions extends BaseHttpRequestOptions { * Return the object only if it has been modified since the specified time, otherwise return a * 304 (not modified). * - * @see GetOptions#ifModifiedSince(Date) + * @see #ifModifiedSince(Date) */ public String getIfModifiedSince() { return this.getFirstHeaderOrNull(HttpHeaders.IF_MODIFIED_SINCE); @@ -133,7 +133,7 @@ public class GetOptions extends BaseHttpRequestOptions { /** * Only return the object if it hasn't changed since this time. * - * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} + * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, @@ -151,7 +151,7 @@ public class GetOptions extends BaseHttpRequestOptions { * Return the object only if it has not been modified since the specified time, otherwise return * a 412 (precondition failed). * - * @see GetOptions#ifUnmodifiedSince(Date) + * @see #ifUnmodifiedSince(Date) */ public String getIfUnmodifiedSince() { return this.getFirstHeaderOrNull(HttpHeaders.IF_UNMODIFIED_SINCE); @@ -183,7 +183,7 @@ public class GetOptions extends BaseHttpRequestOptions { * Return the object only if its payload tag (ETag) is the same as the eTag specified, otherwise * return a 412 (precondition failed). * - * @see GetOptions#ifETagMatches(byte[]) + * @see #ifETagMatches(String) */ public String getIfMatch() { return this.getFirstHeaderOrNull(HttpHeaders.IF_MATCH); @@ -215,7 +215,7 @@ public class GetOptions extends BaseHttpRequestOptions { * Return the object only if its payload tag (ETag) is different from the one specified, otherwise * return a 304 (not modified). * - * @see GetOptions#ifETagDoesntMatch(byte[]) + * @see #ifETagDoesntMatch(String) */ public String getIfNoneMatch() { return this.getFirstHeaderOrNull(HttpHeaders.IF_NONE_MATCH); diff --git a/core/src/main/java/org/jclouds/io/TeeInputStream.java b/core/src/main/java/org/jclouds/io/TeeInputStream.java deleted file mode 100644 index b2cc3de010..0000000000 --- a/core/src/main/java/org/jclouds/io/TeeInputStream.java +++ /dev/null @@ -1,204 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC.
- * - * ==================================================================== - * Licensed 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.jclouds.io; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Ported from org.apache.commons.io.input.TeeInputStream - * - * InputStream proxy that transparently writes a copy of all bytes read from the delegate stream to - * a given OutputStream. Using {@link #skip(long)} or {@link #mark(int)}/{@link #reset()} on the - * stream will result on some bytes from the input stream being skipped or duplicated in the output - * stream. - * - * The delegate input stream is closed when the {@link #close()} method is called on this proxy. It - * is configurable whether the associated output stream will also closed. - * - * @see Commons IO 1.4 - * @see org.apache.commons.io.input.TeeInputStream - */ -public class TeeInputStream extends InputStream { - - /** - * The input stream to delegate to. - */ - private final InputStream delegate; - - /** - * The output stream that will receive a copy of all bytes read from the delegate input stream. - */ - private final OutputStream branch; - - /** - * Flag for closing also the associated output stream when this stream is closed. - */ - private final boolean closeBranch; - - /** - * Creates a TeeInputStream that delegates to the given {@link InputStream} and copies all read - * bytes to the given {@link OutputStream}. The given output stream will not be closed when this - * stream gets closed. - * - * @param input - * input stream to be delegate - * @param branch - * output stream that will receive a copy of all bytes read - */ - public TeeInputStream(InputStream delegate, OutputStream branch) { - this(delegate, branch, false); - } - - /** - * Creates a TeeInputStream that proxies the given {@link InputStream} and copies all read bytes - * to the given {@link OutputStream}. The given output stream will be closed when this stream - * gets closed if the closeBranch parameter is
true
. - * - * @param input - * input stream to be delegate - * @param branch - * output stream that will receive a copy of all bytes read - * @param closeBranch - * flag for closing also the output stream when this stream is closed - */ - public TeeInputStream(InputStream delegate, OutputStream branch, boolean closeBranch) { - this.delegate = delegate; - this.branch = branch; - this.closeBranch = closeBranch; - } - - /** - * Closes the delegate input stream and, if so configured, the associated output stream. An - * exception thrown from one stream will not prevent closing of the other stream. - * - * @throws IOException - * if either of the streams could not be closed - */ - @Override - public void close() throws IOException { - try { - delegate.close(); - } finally { - if (closeBranch) { - branch.close(); - } - } - } - - /** - * Reads a single byte from the delegate input stream and writes it to the associated output - * stream. - * - * @return next byte from the stream, or -1 if the stream has ended - * @throws IOException - * if the stream could not be read (or written) - */ - public int read() throws IOException { - int ch = delegate.read(); - if (ch != -1) { - branch.write(ch); - } - return ch; - } - - /** - * Reads bytes from the delegate input stream and writes the read bytes to the associated output - * stream. - * - * @param bts - * byte buffer - * @param st - * start offset within the buffer - * @param end - * maximum number of bytes to read - * @return number of bytes read, or -1 if the stream has ended - * @throws IOException - * if the stream could not be read (or written) - */ - @Override - public int read(byte[] bts, int st, int end) throws IOException { - int n = delegate.read(bts, st, end); - if (n != -1) { - branch.write(bts, st, n); - } - return n; - } - - /** - * Reads bytes from the delegate input stream and writes the read bytes to the associated output - * stream. - * - * @param bts - * byte buffer - * @return number of bytes read, or -1 if the stream has ended - * @throws IOException - * if the stream could not be read (or written) - */ - @Override - public int read(byte[] bts) throws IOException { - int n = delegate.read(bts); - if (n != -1) { - branch.write(bts, 0, n); - } - return n; - } - - /** - * {@inheritDoc} - */ - @Override - public int available() throws IOException { - return delegate.available(); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void mark(int readlimit) { - delegate.mark(readlimit); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean markSupported() { - return delegate.markSupported(); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void reset() throws IOException { - delegate.reset(); - } - - /** - * {@inheritDoc} - */ - @Override - public long skip(long n) throws IOException { - return delegate.skip(n); - } - -} diff --git a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java index 23bf9bab0b..a368fee5cf 100644 --- a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java +++ b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java @@ -46,7 +46,7 @@ import com.google.inject.spi.TypeListener; /** * This associates java lifecycle annotations with guice hooks. For example, we invoke - * {@link PostConstruct} after injection, and Associate {@link PostDestroy} with a global + * {@link PostConstruct} after injection, and Associate {@link PreDestroy} with a global * {@link Closer} object. * * @author Adrian Cole diff --git a/core/src/main/java/org/jclouds/logging/internal/Wire.java b/core/src/main/java/org/jclouds/logging/internal/Wire.java index 6c5ade98a8..6a291f9071 100644 --- a/core/src/main/java/org/jclouds/logging/internal/Wire.java +++ b/core/src/main/java/org/jclouds/logging/internal/Wire.java @@ -36,10 +36,9 @@ import com.google.common.io.Closeables; import com.google.common.io.FileBackedOutputStream; /** - * Logs data to the wire LOG. + * Logs data to the wire LOG, similar to {@code org.apache.HttpWire.impl.conn.Wire} * * @author Adrian Cole - * @see org.apache.HttpWire.impl.conn.Wire */ public abstract class Wire { diff --git a/core/src/main/java/org/jclouds/rest/RestContextFactory.java b/core/src/main/java/org/jclouds/rest/RestContextFactory.java index cc5e575d75..761b64de41 100644 --- a/core/src/main/java/org/jclouds/rest/RestContextFactory.java +++ b/core/src/main/java/org/jclouds/rest/RestContextFactory.java @@ -180,5 +180,9 @@ public abstract class RestContextFactory> } } + /** + * Hook so that you can specify how to create an object using the contextBuilder produced with + * this factory. + */ protected abstract T build(B contextBuilder); } diff --git a/core/src/main/java/org/jclouds/rest/annotations/Headers.java b/core/src/main/java/org/jclouds/rest/annotations/Headers.java index fe6710fd74..fe50697174 100755 --- a/core/src/main/java/org/jclouds/rest/annotations/Headers.java +++ b/core/src/main/java/org/jclouds/rest/annotations/Headers.java @@ -42,7 +42,7 @@ public @interface Headers { /** * @see HttpHeaders */ - String [] keys(); + String[] keys(); /** * can be defined literally, or with enclosed variables (ex. {variable}
) @@ -50,9 +50,8 @@ public @interface Headers { * The inputs to these variables are taken from method parameters annotated with {@code * @PathParam}. * - * @see PathParam + * @see javax.ws.rs.PathParam * - * @return */ - String [] values(); + String[] values(); } diff --git a/extensions/enterprise/pom.xml b/extensions/enterprise/pom.xml index 78ce4ca8d8..afee129bae 100644 --- a/extensions/enterprise/pom.xml +++ b/extensions/enterprise/pom.xml @@ -51,4 +51,26 @@ --> ++ + diff --git a/extensions/httpnio/src/main/java/org/jclouds/http/pool/ConnectionPoolTransformingHttpCommandExecutorService.java b/extensions/httpnio/src/main/java/org/jclouds/http/pool/ConnectionPoolTransformingHttpCommandExecutorService.java index a577e42f0f..d81e097bea 100755 --- a/extensions/httpnio/src/main/java/org/jclouds/http/pool/ConnectionPoolTransformingHttpCommandExecutorService.java +++ b/extensions/httpnio/src/main/java/org/jclouds/http/pool/ConnectionPoolTransformingHttpCommandExecutorService.java @@ -45,7 +45,6 @@ import com.google.common.collect.MapMaker; import com.google.common.util.concurrent.ListenableFuture; /** - * // TODO: Adrian: Document this! * * @author Adrian Cole */ @@ -123,7 +122,7 @@ public class ConnectionPoolTransformingHttpCommandExecutorService${project.artifactId} ++ ++ +maven-assembly-plugin ++ ++ +package ++ +single ++ ++ +jar-with-dependencies +extends Bas /** * This is an asynchronous operation that puts the command
onto a queue. Later, it - * will be processed via the {@link #invoke(TransformingHttpCommandExecutorService) invoke} + * will be processed via the {@link #invoke(HttpCommandRendezvous) invoke} * method. */ publicListenableFuture submit(HttpCommand command, diff --git a/project/pom.xml b/project/pom.xml index a7f40731b9..70d024d051 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -536,41 +536,6 @@ pageTracker._trackPageview(); - - diff --git a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/Statements.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/Statements.java index e5d15960ca..eec3de8803 100644 --- a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/Statements.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/Statements.java @@ -61,7 +61,7 @@ public class Statements { /** * - * Runs the script in a way that it can be matched later with {@link findPid} + * Runs the script in a way that it can be matched later with {@link #findPid} * * @param instanceName * - what to match the process on diff --git a/tools/antcontrib/samples/compute/build.xml b/tools/antcontrib/samples/compute/build.xml index c5786769d7..d2c8f1b164 100644 --- a/tools/antcontrib/samples/compute/build.xml +++ b/tools/antcontrib/samples/compute/build.xml @@ -114,20 +114,18 @@maven-antrun-plugin -- -- -repackage-jar-with-dependencies -package -- -run -- -- -- - - -- - - - - - - - -- -com.tonicsystems.jarjar -jarjar -1.0-rc8 -+ diff --git a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java index 293227a8a5..3f3e1ba16a 100644 --- a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java +++ b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java @@ -23,10 +23,8 @@ import static org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.buildCompu import static org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.createTemplateFromElement; import static org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.ipOrEmptyString; -import java.io.File; import java.io.IOException; import java.net.URI; -import java.nio.charset.Charset; import java.util.Map; import javax.annotation.Nullable; @@ -46,7 +44,6 @@ import org.jclouds.http.HttpUtils; import com.google.common.base.CaseFormat; import com.google.common.base.Splitter; -import com.google.common.io.Files; import com.google.inject.Provider; /** @@ -193,31 +190,17 @@ public class ComputeTask extends Task { for (NodeMetadata createdNode : computeService.runNodesWithTag(tag, nodeElement.getCount(), template)) { - logNodeDetails(createdNode); + logDetails(computeService, createdNode); addNodeDetailsAsProjectProperties(createdNode); } } - private void logNodeDetails(NodeMetadata createdNode) { - log(String.format(" id=%s, tag=%s, location=%s, tag=%s, connection=%s:%s@%s", createdNode - .getId(), createdNode.getTag(), createdNode.getLocationId(), createdNode.getName(), - createdNode.getCredentials().account, createdNode.getCredentials().key, - ipOrEmptyString(createdNode.getPublicAddresses()))); - } - private void addNodeDetailsAsProjectProperties(NodeMetadata createdNode) { if (nodeElement.getIdproperty() != null) getProject().setProperty(nodeElement.getIdproperty(), createdNode.getId()); if (nodeElement.getHostproperty() != null) getProject().setProperty(nodeElement.getHostproperty(), ipOrEmptyString(createdNode.getPublicAddresses())); - if (nodeElement.getKeyfile() != null && isKeyAuth(createdNode)) - try { - Files.write(createdNode.getCredentials().key, new File(nodeElement.getKeyfile()), - Charset.defaultCharset()); - } catch (IOException e) { - throw new BuildException(e); - } if (nodeElement.getPasswordproperty() != null && !isKeyAuth(createdNode)) getProject().setProperty(nodeElement.getPasswordproperty(), createdNode.getCredentials().key); diff --git a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java index c3a6acae82..30c9d3dca7 100644 --- a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java +++ b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java @@ -46,6 +46,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.tools.ant.logging.config.AntLoggingModule; +import com.google.common.base.Charsets; import com.google.common.base.Function; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableSet; @@ -131,6 +132,8 @@ public class ComputeTaskUtils { TemplateOptions options = new TemplateOptions() .inboundPorts(getPortsToOpenFromElement(nodeElement)); addRunScriptToOptionsIfPresentInNodeElement(nodeElement, options); + addPrivateKeyToOptionsIfPresentInNodeElement(nodeElement, options); + addPublicKeyToOptionsIfPresentInNodeElement(nodeElement, options); return options; } @@ -144,6 +147,28 @@ public class ComputeTaskUtils { } } + static void addPrivateKeyToOptionsIfPresentInNodeElement(NodeElement nodeElement, + TemplateOptions options) { + if (nodeElement.getPrivatekeyfile() != null) + try { + options.installPrivateKey(Files.toString(nodeElement.getPrivatekeyfile(), + Charsets.UTF_8)); + } catch (IOException e) { + throw new BuildException(e); + } + } + + static void addPublicKeyToOptionsIfPresentInNodeElement(NodeElement nodeElement, + TemplateOptions options) { + if (nodeElement.getPrivatekeyfile() != null) + try { + options.authorizePublicKey(Files.toString(nodeElement.getPublickeyfile(), + Charsets.UTF_8)); + } catch (IOException e) { + throw new BuildException(e); + } + } + static String ipOrEmptyString(Set+ + - - - + set) { if (set.size() > 0) { return Iterables.get(set, 0).getHostAddress(); diff --git a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/NodeElement.java b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/NodeElement.java index d9880a2ddd..7b275b0436 100644 --- a/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/NodeElement.java +++ b/tools/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/NodeElement.java @@ -32,7 +32,8 @@ public class NodeElement { private int count = 1; private String openports = "22"; private String passwordproperty; - private String keyfile; + private File privatekeyfile; + private File publickeyfile; private String hostproperty; private String idproperty; private String usernameproperty; @@ -95,16 +96,6 @@ public class NodeElement { return idproperty; } - /** - * The name of a file under which to store the DSA key of the user (if supported) - */ - public void setKeyfile(String keyfile) { - this.keyfile = keyfile; - } - - String getKeyfile() { - return keyfile; - } public void setSize(String size) { this.size = size; @@ -162,4 +153,20 @@ public class NodeElement { return tag; } + public void setPrivatekeyfile(File privatekeyfile) { + this.privatekeyfile = privatekeyfile; + } + + public File getPrivatekeyfile() { + return privatekeyfile; + } + + public void setPublickeyfile(File publickeyfile) { + this.publickeyfile = publickeyfile; + } + + public File getPublickeyfile() { + return publickeyfile; + } + }