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

COVERAGE SUMMARY FOR SOURCE FILE [SoftLayerTemplateOptions.java]

nameclass, %method, %block, %line, %
SoftLayerTemplateOptions.java100% (2/2)20%  (5/25)20%  (45/225)25%  (10.7/43)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SoftLayerTemplateOptions$Builder100% (1/1)11%  (1/9)12%  (11/93)12%  (2/17)
SoftLayerTemplateOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
authorizePublicKey (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
blockOnPort (int, int): SoftLayerTemplateOptions 0%   (0/1)0%   (0/12)0%   (0/2)
inboundPorts (int []): SoftLayerTemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
installPrivateKey (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
runScript (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
userMetadata (Map): SoftLayerTemplateOptions 0%   (0/1)0%   (0/11)0%   (0/2)
userMetadata (String, String): SoftLayerTemplateOptions 0%   (0/1)0%   (0/12)0%   (0/2)
domainName (String): SoftLayerTemplateOptions 100% (1/1)100% (11/11)100% (2/2)
     
class SoftLayerTemplateOptions100% (1/1)25%  (4/16)26%  (34/132)33%  (9/27)
authorizePublicKey (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
authorizePublicKey (String): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
blockOnPort (int, int): SoftLayerTemplateOptions 0%   (0/1)0%   (0/8)0%   (0/1)
clone (): SoftLayerTemplateOptions 0%   (0/1)0%   (0/9)0%   (0/3)
copyTo (TemplateOptions): void 0%   (0/1)0%   (0/17)0%   (0/5)
inboundPorts (int []): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
installPrivateKey (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
installPrivateKey (String): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runScript (Payload): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
runScript (byte []): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
userMetadata (Map): SoftLayerTemplateOptions 0%   (0/1)0%   (0/7)0%   (0/1)
userMetadata (String, String): SoftLayerTemplateOptions 0%   (0/1)0%   (0/8)0%   (0/1)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
SoftLayerTemplateOptions (): void 100% (1/1)100% (6/6)100% (3/3)
domainName (String): TemplateOptions 100% (1/1)100% (20/20)100% (4/4)
getDomainName (): String 100% (1/1)100% (3/3)100% (1/1)

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.softlayer.compute.options;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22import static com.google.common.base.Preconditions.checkNotNull;
23 
24import java.util.Map;
25 
26import org.jclouds.compute.ComputeService;
27import org.jclouds.compute.options.TemplateOptions;
28import org.jclouds.io.Payload;
29import org.jclouds.softlayer.features.VirtualGuestClient;
30 
31import com.google.common.net.InternetDomainName;
32 
33/**
34 * Contains options supported by the
35 * {@link ComputeService#createNodesInGroup(String, int, TemplateOptions)} and
36 * {@link ComputeService#runNodesWithTag(String, int, TemplateOptions)}
37 * operations on the <em>gogrid</em> provider.
38 * 
39 * <h2>Usage</h2> The recommended way to instantiate a
40 * {@link SoftLayerTemplateOptions} object is to statically import
41 * {@code SoftLayerTemplateOptions.*} and invoke a static creation method
42 * followed by an instance mutator (if needed):
43 * <p>
44 * 
45 * <pre>
46 * import static org.jclouds.compute.options.SoftLayerTemplateOptions.Builder.*;
47 * ComputeService client = // get connection
48 * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
49 * Set&lt;? extends NodeMetadata&gt; set = client.runNodesWithTag(tag, 2, templateBuilder.build());
50 * </pre>
51 * 
52 * @author Adrian Cole
53 */
54public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneable {
55 
56   protected String domainName = "jclouds.org";
57 
58   @Override
59   public SoftLayerTemplateOptions clone() {
60      SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
61      copyTo(options);
62      return options;
63   }
64 
65   @Override
66   public void copyTo(TemplateOptions to) {
67      super.copyTo(to);
68      if (to instanceof SoftLayerTemplateOptions) {
69         SoftLayerTemplateOptions eTo = SoftLayerTemplateOptions.class.cast(to);
70         eTo.domainName(domainName);
71      }
72   }
73 
74   /**
75    * will replace the default domain used when ordering virtual guests. Note
76    * this needs to contain a public suffix!
77    * 
78    * @see VirtualGuestClient#orderVirtualGuest
79    * @see InternetDomainName#hasPublicSuffix
80    */
81   public TemplateOptions domainName(String domainName) {
82      checkNotNull(domainName, "domainName was null");
83      checkArgument(InternetDomainName.from(domainName).hasPublicSuffix(), "domainName %s has no public suffix",
84            domainName);
85      this.domainName = domainName;
86      return this;
87   }
88 
89   public String getDomainName() {
90      return domainName;
91   }
92 
93   public static final SoftLayerTemplateOptions NONE = new SoftLayerTemplateOptions();
94 
95   public static class Builder {
96 
97      /**
98       * @see #domainName
99       */
100      public static SoftLayerTemplateOptions domainName(String domainName) {
101         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
102         return SoftLayerTemplateOptions.class.cast(options.domainName(domainName));
103      }
104 
105      // methods that only facilitate returning the correct object type
106 
107      /**
108       * @see TemplateOptions#inboundPorts(int...)
109       */
110      public static SoftLayerTemplateOptions inboundPorts(int... ports) {
111         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
112         return SoftLayerTemplateOptions.class.cast(options.inboundPorts(ports));
113      }
114 
115      /**
116       * @see TemplateOptions#blockOnPort(int, int)
117       */
118      public static SoftLayerTemplateOptions blockOnPort(int port, int seconds) {
119         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
120         return SoftLayerTemplateOptions.class.cast(options.blockOnPort(port, seconds));
121      }
122 
123      /**
124       * @see TemplateOptions#runScript(Payload)
125       */
126      public static SoftLayerTemplateOptions runScript(Payload script) {
127         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
128         return SoftLayerTemplateOptions.class.cast(options.runScript(script));
129      }
130 
131      /**
132       * @see TemplateOptions#installPrivateKey(Payload)
133       */
134      @Deprecated
135      public static SoftLayerTemplateOptions installPrivateKey(Payload rsaKey) {
136         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
137         return SoftLayerTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
138      }
139 
140      /**
141       * @see TemplateOptions#authorizePublicKey(Payload)
142       */
143      @Deprecated
144      public static SoftLayerTemplateOptions authorizePublicKey(Payload rsaKey) {
145         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
146         return SoftLayerTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
147      }
148 
149      /**
150       * @see TemplateOptions#userMetadata(Map)
151       */
152      public static SoftLayerTemplateOptions userMetadata(Map<String, String> userMetadata) {
153         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
154         return SoftLayerTemplateOptions.class.cast(options.userMetadata(userMetadata));
155      }
156 
157      /**
158       * @see TemplateOptions#userMetadata(String, String)
159       */
160      public static SoftLayerTemplateOptions userMetadata(String key, String value) {
161         SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
162         return SoftLayerTemplateOptions.class.cast(options.userMetadata(key, value));
163      }
164   }
165 
166   // methods that only facilitate returning the correct object type
167 
168   /**
169    * @see TemplateOptions#blockOnPort(int, int)
170    */
171   @Override
172   public SoftLayerTemplateOptions blockOnPort(int port, int seconds) {
173      return SoftLayerTemplateOptions.class.cast(super.blockOnPort(port, seconds));
174   }
175 
176   /**
177    * @see TemplateOptions#inboundPorts(int...)
178    */
179   @Override
180   public SoftLayerTemplateOptions inboundPorts(int... ports) {
181      return SoftLayerTemplateOptions.class.cast(super.inboundPorts(ports));
182   }
183 
184   /**
185    * @see TemplateOptions#authorizePublicKey(String)
186    */
187   @Override
188   public SoftLayerTemplateOptions authorizePublicKey(String publicKey) {
189      return SoftLayerTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
190   }
191 
192   /**
193    * @see TemplateOptions#authorizePublicKey(Payload)
194    */
195   @Override
196   @Deprecated
197   public SoftLayerTemplateOptions authorizePublicKey(Payload publicKey) {
198      return SoftLayerTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
199   }
200 
201   /**
202    * @see TemplateOptions#installPrivateKey(String)
203    */
204   @Override
205   public SoftLayerTemplateOptions installPrivateKey(String privateKey) {
206      return SoftLayerTemplateOptions.class.cast(super.installPrivateKey(privateKey));
207   }
208 
209   /**
210    * @see TemplateOptions#installPrivateKey(Payload)
211    */
212   @Override
213   @Deprecated
214   public SoftLayerTemplateOptions installPrivateKey(Payload privateKey) {
215      return SoftLayerTemplateOptions.class.cast(super.installPrivateKey(privateKey));
216   }
217 
218   /**
219    * @see TemplateOptions#runScript(Payload)
220    */
221   @Override
222   public SoftLayerTemplateOptions runScript(Payload script) {
223      return SoftLayerTemplateOptions.class.cast(super.runScript(script));
224   }
225 
226   /**
227    * @see TemplateOptions#runScript(byte[])
228    */
229   @Override
230   @Deprecated
231   public SoftLayerTemplateOptions runScript(byte[] script) {
232      return SoftLayerTemplateOptions.class.cast(super.runScript(script));
233   }
234 
235   /**
236    * {@inheritDoc}
237    */
238   @Override
239   public SoftLayerTemplateOptions userMetadata(Map<String, String> userMetadata) {
240      return SoftLayerTemplateOptions.class.cast(super.userMetadata(userMetadata));
241   }
242 
243   /**
244    * {@inheritDoc}
245    */
246   @Override
247   public SoftLayerTemplateOptions userMetadata(String key, String value) {
248      return SoftLayerTemplateOptions.class.cast(super.userMetadata(key, value));
249   }
250}

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