EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.ec2.compute.options]

COVERAGE SUMMARY FOR SOURCE FILE [EC2TemplateOptions.java]

nameclass, %method, %block, %line, %
EC2TemplateOptions.java100% (2/2)45%  (25/56)36%  (254/713)40%  (55.8/139)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EC2TemplateOptions100% (1/1)45%  (17/38)31%  (166/531)38%  (40/105)
authorizePublicKey (Payload): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
blockDeviceMappings (Iterable): EC2TemplateOptions 0%   (0/1)0%   (0/10)0%   (0/2)
blockUntilRunning (boolean): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
clone (): EC2TemplateOptions 0%   (0/1)0%   (0/9)0%   (0/3)
dontAuthorizePublicKey (): EC2TemplateOptions 0%   (0/1)0%   (0/6)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/65)0%   (0/8)
installPrivateKey (Payload): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
mapEBSSnapshotToDeviceName (String, String, Integer, boolean): EC2TemplateOpt... 0%   (0/1)0%   (0/14)0%   (0/2)
mapEphemeralDeviceToDeviceName (String, String): EC2TemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
mapNewVolumeToDeviceName (String, int, boolean): EC2TemplateOptions 0%   (0/1)0%   (0/14)0%   (0/2)
nameTask (String): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
overrideCredentialsWith (Credentials): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runAsRoot (boolean): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runScript (Payload): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runScript (Statement): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runScript (byte []): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/34)0%   (0/1)
unmapDeviceNamed (String): EC2TemplateOptions 0%   (0/1)0%   (0/10)0%   (0/2)
userData (byte []): EC2TemplateOptions 0%   (0/1)0%   (0/17)0%   (0/3)
userMetadata (Map): EC2TemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
userMetadata (String, String): EC2TemplateOptions 0%   (0/1)0%   (0/8)0%   (0/1)
equals (Object): boolean 100% (1/1)6%   (5/79)8%   (2/25)
copyTo (TemplateOptions): void 100% (1/1)56%  (29/52)64%  (9/14)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
EC2TemplateOptions (): void 100% (1/1)100% (12/12)100% (5/5)
authorizePublicKey (String): EC2TemplateOptions 100% (1/1)100% (7/7)100% (1/1)
blockOnPort (int, int): EC2TemplateOptions 100% (1/1)100% (8/8)100% (1/1)
getBlockDeviceMappings (): Set 100% (1/1)100% (4/4)100% (1/1)
getGroups (): Set 100% (1/1)100% (3/3)100% (1/1)
getKeyPair (): String 100% (1/1)100% (3/3)100% (1/1)
getUserData (): byte [] 100% (1/1)100% (3/3)100% (1/1)
inboundPorts (int []): EC2TemplateOptions 100% (1/1)100% (7/7)100% (1/1)
installPrivateKey (String): EC2TemplateOptions 100% (1/1)100% (7/7)100% (1/1)
keyPair (String): EC2TemplateOptions 100% (1/1)100% (20/20)100% (5/5)
noKeyPair (): EC2TemplateOptions 100% (1/1)100% (13/13)100% (3/3)
securityGroups (Iterable): EC2TemplateOptions 100% (1/1)100% (28/28)100% (5/5)
securityGroups (String []): EC2TemplateOptions 100% (1/1)100% (5/5)100% (1/1)
shouldAutomaticallyCreateKeyPair (): boolean 100% (1/1)100% (7/7)100% (1/1)
     
class EC2TemplateOptions$Builder100% (1/1)44%  (8/18)48%  (88/182)46%  (16/35)
EC2TemplateOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
blockDeviceMappings (Set): EC2TemplateOptions 0%   (0/1)0%   (0/8)0%   (0/2)
mapEBSSnapshotToDeviceName (String, String, Integer, boolean): EC2TemplateOpt... 0%   (0/1)0%   (0/11)0%   (0/2)
mapEphemeralDeviceToDeviceName (String, String): EC2TemplateOptions 0%   (0/1)0%   (0/9)0%   (0/2)
mapNewVolumeToDeviceName (String, int, boolean): EC2TemplateOptions 0%   (0/1)0%   (0/10)0%   (0/2)
runScript (byte []): EC2TemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
unmapDeviceNamed (String): EC2TemplateOptions 0%   (0/1)0%   (0/8)0%   (0/2)
userData (byte []): EC2TemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
userMetadata (Map): EC2TemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
userMetadata (String, String): EC2TemplateOptions 0%   (0/1)0%   (0/12)0%   (0/2)
authorizePublicKey (String): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)
blockOnPort (int, int): EC2TemplateOptions 100% (1/1)100% (12/12)100% (2/2)
inboundPorts (int []): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)
installPrivateKey (String): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)
keyPair (String): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)
noKeyPair (): EC2TemplateOptions 100% (1/1)100% (10/10)100% (2/2)
securityGroups (Iterable): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)
securityGroups (String []): EC2TemplateOptions 100% (1/1)100% (11/11)100% (2/2)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.ec2.compute.options;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22import static com.google.common.base.Preconditions.checkNotNull;
23import static com.google.common.base.Preconditions.checkState;
24 
25import java.util.Arrays;
26import java.util.Map;
27import java.util.Set;
28 
29import org.jclouds.compute.options.TemplateOptions;
30import org.jclouds.domain.Credentials;
31import org.jclouds.ec2.domain.BlockDeviceMapping;
32import org.jclouds.ec2.domain.BlockDeviceMapping.MapEBSSnapshotToDevice;
33import org.jclouds.ec2.domain.BlockDeviceMapping.MapEphemeralDeviceToDevice;
34import org.jclouds.ec2.domain.BlockDeviceMapping.MapNewVolumeToDevice;
35import org.jclouds.ec2.domain.BlockDeviceMapping.UnmapDeviceNamed;
36import org.jclouds.io.Payload;
37import org.jclouds.javax.annotation.Nullable;
38import org.jclouds.scriptbuilder.domain.Statement;
39import org.jclouds.util.Preconditions2;
40 
41import com.google.common.collect.ImmutableSet;
42import com.google.common.collect.Iterables;
43 
44/**
45 * Contains options supported in the {@code ComputeService#runNode} operation on
46 * the "ec2" provider. <h2>
47 * Usage</h2> The recommended way to instantiate a EC2TemplateOptions object is
48 * to statically import EC2TemplateOptions.* and invoke a static creation method
49 * followed by an instance mutator (if needed):
50 * <p/>
51 * <code>
52 * import static org.jclouds.aws.ec2.compute.options.EC2TemplateOptions.Builder.*;
53 * <p/>
54 * ComputeService client = // get connection
55 * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
56 * Set<? extends NodeMetadata> set = client.runNodesWithTag(tag, 2, templateBuilder.build());
57 * <code>
58 * 
59 * @author Adrian Cole
60 */
61public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
62   @Override
63   public EC2TemplateOptions clone() {
64      EC2TemplateOptions options = new EC2TemplateOptions();
65      copyTo(options);
66      return options;
67   }
68 
69   @Override
70   public void copyTo(TemplateOptions to) {
71      super.copyTo(to);
72      if (to instanceof EC2TemplateOptions) {
73         EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to);
74         if (getGroups().size() > 0)
75            eTo.securityGroups(getGroups());
76         if (getKeyPair() != null)
77            eTo.keyPair(getKeyPair());
78         if (getBlockDeviceMappings().size() > 0)
79            eTo.blockDeviceMappings(getBlockDeviceMappings());
80         if (!shouldAutomaticallyCreateKeyPair())
81            eTo.noKeyPair();
82         if (getUserData() != null)
83            eTo.userData(getUserData());
84      }
85   }
86 
87   private Set<String> groupNames = ImmutableSet.of();
88   private String keyPair = null;
89   private boolean noKeyPair;
90   private byte[] userData;
91   private ImmutableSet.Builder<BlockDeviceMapping> blockDeviceMappings = ImmutableSet.<BlockDeviceMapping> builder();
92 
93   public static final EC2TemplateOptions NONE = new EC2TemplateOptions();
94 
95   /**
96    * 
97    * @see EC2TemplateOptions#securityGroups(Iterable<String>)
98    */
99   public EC2TemplateOptions securityGroups(String... groupNames) {
100      return securityGroups(ImmutableSet.copyOf(groupNames));
101   }
102 
103   /**
104    * Specifies the security groups to be used for nodes with this template
105    */
106   public EC2TemplateOptions securityGroups(Iterable<String> groupNames) {
107      checkArgument(Iterables.size(groupNames) > 0, "you must specify at least one security group");
108      for (String groupId : groupNames)
109         Preconditions2.checkNotEmpty(groupId, "all security groups must be non-empty");
110      this.groupNames = ImmutableSet.copyOf(groupNames);
111      return this;
112   }
113 
114   /**
115    * Unencoded data
116    */
117   public EC2TemplateOptions userData(byte[] unencodedData) {
118      checkArgument(checkNotNull(unencodedData, "unencodedData").length <= 16 * 1024,
119            "userData cannot be larger than 16kb");
120      this.userData = unencodedData;
121      return this;
122   }
123 
124   /**
125    * Specifies the keypair used to run instances with
126    */
127   public EC2TemplateOptions keyPair(String keyPair) {
128      checkNotNull(keyPair, "use noKeyPair option to request boot without a keypair");
129      checkState(!noKeyPair, "you cannot specify both options keyPair and noKeyPair");
130      Preconditions2.checkNotEmpty(keyPair, "keypair must be non-empty");
131      this.keyPair = keyPair;
132      return this;
133   }
134 
135   /**
136    * Do not use a keypair on instances
137    */
138   public EC2TemplateOptions noKeyPair() {
139      checkState(keyPair == null, "you cannot specify both options keyPair and noKeyPair");
140      this.noKeyPair = true;
141      return this;
142   }
143 
144   public EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId,
145         @Nullable Integer sizeInGib, boolean deleteOnTermination) {
146      blockDeviceMappings.add(new MapEBSSnapshotToDevice(deviceName, snapshotId, sizeInGib, deleteOnTermination));
147      return this;
148   }
149 
150   public EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination) {
151      blockDeviceMappings.add(new MapNewVolumeToDevice(deviceName, sizeInGib, deleteOnTermination));
152      return this;
153   }
154 
155   public EC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName) {
156      blockDeviceMappings.add(new MapEphemeralDeviceToDevice(deviceName, virtualName));
157      return this;
158   }
159 
160   public EC2TemplateOptions unmapDeviceNamed(String deviceName) {
161      blockDeviceMappings.add(new UnmapDeviceNamed(deviceName));
162      return this;
163   }
164 
165   public EC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings) {
166      this.blockDeviceMappings.addAll(checkNotNull(blockDeviceMappings, "blockDeviceMappings"));
167      return this;
168   }
169 
170   public static class Builder {
171      /**
172       * @see EC2TemplateOptions#blockDeviceMappings
173       */
174      public static EC2TemplateOptions blockDeviceMappings(Set<? extends BlockDeviceMapping> blockDeviceMappings) {
175         EC2TemplateOptions options = new EC2TemplateOptions();
176         return options.blockDeviceMappings(blockDeviceMappings);
177      }
178 
179      /**
180       * @see EC2TemplateOptions#mapEBSSnapshotToDeviceName
181       */
182      public static EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId,
183            @Nullable Integer sizeInGib, boolean deleteOnTermination) {
184         EC2TemplateOptions options = new EC2TemplateOptions();
185         return options.mapEBSSnapshotToDeviceName(deviceName, snapshotId, sizeInGib, deleteOnTermination);
186      }
187 
188      /**
189       * @see EC2TemplateOptions#mapNewVolumeToDeviceName
190       */
191      public static EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib,
192            boolean deleteOnTermination) {
193         EC2TemplateOptions options = new EC2TemplateOptions();
194         return options.mapNewVolumeToDeviceName(deviceName, sizeInGib, deleteOnTermination);
195      }
196 
197      /**
198       * @see EC2TemplateOptions#mapEphemeralDeviceToDeviceName
199       */
200      public static EC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName) {
201         EC2TemplateOptions options = new EC2TemplateOptions();
202         return options.mapEphemeralDeviceToDeviceName(deviceName, virtualName);
203      }
204 
205      /**
206       * @see EC2TemplateOptions#unmapDeviceNamed
207       */
208      public static EC2TemplateOptions unmapDeviceNamed(String deviceName) {
209         EC2TemplateOptions options = new EC2TemplateOptions();
210         return options.unmapDeviceNamed(deviceName);
211      }
212 
213      /**
214       * @see EC2TemplateOptions#securityGroups(Iterable<String>)
215       */
216      public static EC2TemplateOptions securityGroups(String... groupNames) {
217         EC2TemplateOptions options = new EC2TemplateOptions();
218         return EC2TemplateOptions.class.cast(options.securityGroups(groupNames));
219      }
220 
221      /**
222       * @see EC2TemplateOptions#securityGroups(Iterable<String>)
223       */
224      public static EC2TemplateOptions securityGroups(Iterable<String> groupNames) {
225         EC2TemplateOptions options = new EC2TemplateOptions();
226         return EC2TemplateOptions.class.cast(options.securityGroups(groupNames));
227      }
228 
229      /**
230       * @see EC2TemplateOptions#keyPair
231       */
232      public static EC2TemplateOptions keyPair(String keyPair) {
233         EC2TemplateOptions options = new EC2TemplateOptions();
234         return EC2TemplateOptions.class.cast(options.keyPair(keyPair));
235      }
236 
237      /**
238       * @see EC2TemplateOptions#userData
239       */
240      public static EC2TemplateOptions userData(byte[] unencodedData) {
241         EC2TemplateOptions options = new EC2TemplateOptions();
242         return EC2TemplateOptions.class.cast(options.userData(unencodedData));
243      }
244 
245      /**
246       * @see EC2TemplateOptions#noKeyPair
247       */
248      public static EC2TemplateOptions noKeyPair() {
249         EC2TemplateOptions options = new EC2TemplateOptions();
250         return EC2TemplateOptions.class.cast(options.noKeyPair());
251      }
252 
253      // methods that only facilitate returning the correct object type
254      /**
255       * @see TemplateOptions#inboundPorts
256       */
257      public static EC2TemplateOptions inboundPorts(int... ports) {
258         EC2TemplateOptions options = new EC2TemplateOptions();
259         return EC2TemplateOptions.class.cast(options.inboundPorts(ports));
260      }
261 
262      /**
263       * @see TemplateOptions#port
264       */
265      public static EC2TemplateOptions blockOnPort(int port, int seconds) {
266         EC2TemplateOptions options = new EC2TemplateOptions();
267         return EC2TemplateOptions.class.cast(options.blockOnPort(port, seconds));
268      }
269 
270      /**
271       * @see TemplateOptions#runScript
272       */
273      public static EC2TemplateOptions runScript(byte[] script) {
274         EC2TemplateOptions options = new EC2TemplateOptions();
275         return EC2TemplateOptions.class.cast(options.runScript(script));
276      }
277 
278      /**
279       * @see TemplateOptions#installPrivateKey
280       */
281      public static EC2TemplateOptions installPrivateKey(String rsaKey) {
282         EC2TemplateOptions options = new EC2TemplateOptions();
283         return EC2TemplateOptions.class.cast(options.installPrivateKey(rsaKey));
284      }
285 
286      /**
287       * @see TemplateOptions#authorizePublicKey
288       */
289      public static EC2TemplateOptions authorizePublicKey(String rsaKey) {
290         EC2TemplateOptions options = new EC2TemplateOptions();
291         return EC2TemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
292      }
293 
294      /**
295       * @see TemplateOptions#userMetadata(Map)
296       */
297      public static EC2TemplateOptions userMetadata(Map<String, String> userMetadata) {
298         EC2TemplateOptions options = new EC2TemplateOptions();
299         return EC2TemplateOptions.class.cast(options.userMetadata(userMetadata));
300      }
301 
302      /**
303       * @see TemplateOptions#userMetadata(String, String)
304       */
305      public static EC2TemplateOptions userMetadata(String key, String value) {
306         EC2TemplateOptions options = new EC2TemplateOptions();
307         return EC2TemplateOptions.class.cast(options.userMetadata(key, value));
308      }
309   }
310 
311   // methods that only facilitate returning the correct object type
312 
313   /**
314    * {@inheritDoc}
315    */
316   @Override
317   public EC2TemplateOptions blockOnPort(int port, int seconds) {
318      return EC2TemplateOptions.class.cast(super.blockOnPort(port, seconds));
319   }
320 
321   /**
322    * {@inheritDoc}
323    */
324   @Override
325   public EC2TemplateOptions inboundPorts(int... ports) {
326      return EC2TemplateOptions.class.cast(super.inboundPorts(ports));
327   }
328 
329   /**
330    * {@inheritDoc}
331    */
332   @Override
333   public EC2TemplateOptions authorizePublicKey(String publicKey) {
334      return EC2TemplateOptions.class.cast(super.authorizePublicKey(publicKey));
335   }
336 
337   /**
338    * {@inheritDoc}
339    */
340   @Override
341   @Deprecated
342   public EC2TemplateOptions authorizePublicKey(Payload publicKey) {
343      return EC2TemplateOptions.class.cast(super.authorizePublicKey(publicKey));
344   }
345 
346   /**
347    * {@inheritDoc}
348    */
349   @Override
350   public EC2TemplateOptions installPrivateKey(String privateKey) {
351      return EC2TemplateOptions.class.cast(super.installPrivateKey(privateKey));
352   }
353 
354   /**
355    * {@inheritDoc}
356    */
357   @Override
358   @Deprecated
359   public EC2TemplateOptions installPrivateKey(Payload privateKey) {
360      return EC2TemplateOptions.class.cast(super.installPrivateKey(privateKey));
361   }
362 
363   /**
364    * {@inheritDoc}
365    */
366   @Override
367   public EC2TemplateOptions runScript(Payload script) {
368      return EC2TemplateOptions.class.cast(super.runScript(script));
369   }
370 
371   /**
372    * {@inheritDoc}
373    */
374   @Override
375   @Deprecated
376   public EC2TemplateOptions runScript(byte[] script) {
377      return EC2TemplateOptions.class.cast(super.runScript(script));
378   }
379 
380   /**
381    * {@inheritDoc}
382    */
383   @Override
384   public EC2TemplateOptions blockUntilRunning(boolean blockUntilRunning) {
385      return EC2TemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
386   }
387 
388   /**
389    * {@inheritDoc}
390    */
391   @Override
392   public EC2TemplateOptions dontAuthorizePublicKey() {
393      return EC2TemplateOptions.class.cast(super.dontAuthorizePublicKey());
394   }
395 
396   /**
397    * {@inheritDoc}
398    */
399   @Override
400   public EC2TemplateOptions nameTask(String name) {
401      return EC2TemplateOptions.class.cast(super.nameTask(name));
402   }
403 
404   /**
405    * {@inheritDoc}
406    */
407   @Override
408   public EC2TemplateOptions runAsRoot(boolean runAsRoot) {
409      return EC2TemplateOptions.class.cast(super.runAsRoot(runAsRoot));
410   }
411 
412   /**
413    * {@inheritDoc}
414    */
415   @Override
416   public EC2TemplateOptions runScript(Statement script) {
417      return EC2TemplateOptions.class.cast(super.runScript(script));
418   }
419 
420   /**
421    * {@inheritDoc}
422    */
423   @Override
424   public EC2TemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
425      return EC2TemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
426   }
427 
428   /**
429    * {@inheritDoc}
430    */
431   @Override
432   public EC2TemplateOptions userMetadata(Map<String, String> userMetadata) {
433      return EC2TemplateOptions.class.cast(super.userMetadata(userMetadata));
434   }
435 
436   /**
437    * {@inheritDoc}
438    */
439   @Override
440   public EC2TemplateOptions userMetadata(String key, String value) {
441      return EC2TemplateOptions.class.cast(super.userMetadata(key, value));
442   }
443 
444   /**
445    * @return groupNames the user specified to run instances with, or zero
446    *         length set to create an implicit group
447    */
448   public Set<String> getGroups() {
449      return groupNames;
450   }
451 
452   /**
453    * @return keyPair to use when running the instance or null, to generate a
454    *         keypair.
455    */
456   public String getKeyPair() {
457      return keyPair;
458   }
459 
460   /**
461    * @return true (default) if we are supposed to use a keypair
462    */
463   public boolean shouldAutomaticallyCreateKeyPair() {
464      return !noKeyPair;
465   }
466 
467   /**
468    * @return unencoded user data.
469    */
470   public byte[] getUserData() {
471      return userData;
472   }
473 
474   /**
475    * @return BlockDeviceMapping to use when running the instance or null.
476    */
477   public Set<BlockDeviceMapping> getBlockDeviceMappings() {
478      return blockDeviceMappings.build();
479   }
480 
481   @Override
482   public int hashCode() {
483 
484      final int prime = 31;
485      int result = super.hashCode();
486      result = prime * result + ((blockDeviceMappings == null) ? 0 : blockDeviceMappings.hashCode());
487      result = prime * result + ((groupNames == null) ? 0 : groupNames.hashCode());
488      result = prime * result + ((keyPair == null) ? 0 : keyPair.hashCode());
489      result = prime * result + (noKeyPair ? 1231 : 1237);
490      result = prime * result + Arrays.hashCode(userData);
491      return result;
492   }
493 
494   @Override
495   public boolean equals(Object obj) {
496      if (this == obj)
497         return true;
498      if (!super.equals(obj))
499         return false;
500      if (getClass() != obj.getClass())
501         return false;
502      EC2TemplateOptions other = (EC2TemplateOptions) obj;
503      if (blockDeviceMappings == null) {
504         if (other.blockDeviceMappings != null)
505            return false;
506      } else if (!blockDeviceMappings.equals(other.blockDeviceMappings))
507         return false;
508      if (groupNames == null) {
509         if (other.groupNames != null)
510            return false;
511      } else if (!groupNames.equals(other.groupNames))
512         return false;
513      if (keyPair == null) {
514         if (other.keyPair != null)
515            return false;
516      } else if (!keyPair.equals(other.keyPair))
517         return false;
518 
519      if (!Arrays.equals(userData, other.userData))
520         return false;
521 
522      return true;
523   }
524 
525   @Override
526   public String toString() {
527      return "[groupNames=" + groupNames + ", keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", userData="
528            + Arrays.toString(userData) + ", blockDeviceMappings=" + blockDeviceMappings.build() + "]";
529   }
530}

[all classes][org.jclouds.ec2.compute.options]
EMMA 2.0.5312 (C) Vladimir Roubtsov