nacx requested changes on this pull request.

Thanks, @trevorflanagan! Examples and documentation contributions are super 
great and highly appreciated. Thanks!

Please, add also a README either linking to the jclouds guide or just explain 
how to set up an account, etc, so users landing here know what the requirements 
are to try them.

> @@ -22,7 +22,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.jclouds.examples</groupId>
   <artifactId>blobstore-basics</artifactId>
-  <version>2.1.0</version>
+  <version>2.2.0-SNAPSHOT</version>

Do not use SNAPSHOT in jclouds-examples. If you need that for DimensionData, 
just us it for those ones.

> +         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.jclouds.examples</groupId>
+        <artifactId>jclouds-examples</artifactId>
+        <version>2.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dimensiondata-cloudcontrol-examples</artifactId>
+    <name>dimensiondata-cloudcontrol-examples</name>
+    <version>2.2.0-SNAPSHOT</version>
+
+    <properties>
+        <jclouds.version>2.1.0</jclouds.version>

This should probably pull 2.2.0-snapshot too, to make sure these examples don't 
have runtime issues.

> +        </dependency>
+        <dependency>
+          <groupId>org.apache.jclouds.driver</groupId>
+          <artifactId>jclouds-slf4j</artifactId>
+          <version>${jclouds.version}</version>
+        </dependency>
+        <!-- 3rd party dependencies -->
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.0.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jclouds.driver</groupId>
+            <artifactId>jclouds-slf4j</artifactId>
+            <version>2.2.0-SNAPSHOT</version>

Use `jclouds.version` once changed.

> +            <groupId>org.apache.jclouds.driver</groupId>
+            <artifactId>jclouds-slf4j</artifactId>
+            <version>2.2.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                    <source>1.6</source>
+                    <target>1.6</target>

Let's move this to 1.7

> +        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+              <artifactId>maven-assembly-plugin</artifactId>
+              <version>2.2.1</version>
+              <configuration>
+                <descriptors>
+                  
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>

Can't you use the default descriptor from the maven assembly plugin? Why do we 
need a custom one?

> +import com.google.common.collect.ImmutableSet;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.jclouds.ContextBuilder;
+import org.jclouds.dimensiondata.cloudcontrol.DimensionDataCloudControlApi;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Server;
+import org.jclouds.dimensiondata.cloudcontrol.domain.TagKey;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Vlan;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to delete the assets created in 
org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer:
+ * <ol>Server</ol>

Wrong HTML tags. `<ol>` should enclose `<li>` tags.

> +import org.jclouds.dimensiondata.cloudcontrol.domain.Vlan;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to delete the assets created in 
org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer:
+ * <ol>Server</ol>
+ * <ol>Vlan</ol>
+ * <ol>Network Domain</ol>
+ * <ol>Tag Key</ol>
+ */
+public class DeleteServerVlanAndNetworkDomain
+{
+    private static final String AU_9 = "AU9";

Better `private static final String REGION = 
System.getProperty("jclouds.region", "AU9")` to let users customize it?

> +         */
+        String endpoint = args[0];
+        String username = args[1];
+        String password = args[2];
+        ContextBuilder contextBuilder = 
ContextBuilder.newBuilder(DIMENSIONDATA_CLOUDCONTROL_PROVIDER);
+        DimensionDataCloudControlApi api = contextBuilder
+                .endpoint(endpoint)
+                .credentials(username, password)
+                .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
+                .buildApi(DimensionDataCloudControlApi.class);
+
+        /*
+         * Retrieve the Guice injector from the context.
+         * We will use this for retrieving the some Predicates that are used 
by the following operations.
+         */
+        Injector injector = contextBuilder.buildInjector();

Don't do this, as you're building the context twice. Instead:

```java
ApiContext<DimensionDataCloudControlApi> ctx = contextBuilder
   .endpoint(endpoint)
   .credentials(username, password)
   .modules(ImmutableSet.of(new SLF4JLoggingModule()))
   .build();

Injector injector = ctx.utils().injector();
DimensionDataCloudControlApi api = ctx.getApi();
```

Also remember to always close the `ctx` in a `finally` clause.

> +import org.jclouds.ContextBuilder;
+import org.jclouds.dimensiondata.cloudcontrol.DimensionDataCloudControlApi;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Disk;
+import org.jclouds.dimensiondata.cloudcontrol.domain.NIC;
+import org.jclouds.dimensiondata.cloudcontrol.domain.NetworkInfo;
+import org.jclouds.dimensiondata.cloudcontrol.domain.TagInfo;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to Deploy:

Same comments about HTML tags and context creation. Apply everywhere.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#pullrequestreview-163246263

Reply via email to