brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [31/50] [abbrv] brooklyn-server git commit: white_check_mark: Fix build and cleanup
Date Thu, 29 Jun 2017 15:36:13 GMT
white_check_mark: Fix build and cleanup

Signed-off-by: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a334e0fe
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a334e0fe
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a334e0fe

Branch: refs/heads/master
Commit: a334e0fe66f194f5aec2be8f6781a0d56f33c71c
Parents: e9ff139
Author: CloudsoftOps <ops@cloudsoft.io>
Authored: Thu May 18 19:08:23 2017 +0100
Committer: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Fri May 19 14:03:37 2017 +0100

----------------------------------------------------------------------
 brooklyn-server/locations/container/pom.xml     | 153 ++++++++++++
 .../entity/docker/DockerContainer.java          |  26 +-
 .../entity/docker/DockerContainerImpl.java      | 113 +++++----
 .../entity/kubernetes/KubernetesPod.java        |  41 +++-
 .../entity/kubernetes/KubernetesPodImpl.java    |  18 ++
 .../entity/kubernetes/KubernetesResource.java   |  34 ++-
 .../kubernetes/KubernetesResourceImpl.java      |  18 ++
 .../entity/openshift/OpenShiftPod.java          |  19 +-
 .../entity/openshift/OpenShiftPodImpl.java      |  18 ++
 .../entity/openshift/OpenShiftResource.java     |  19 +-
 .../entity/openshift/OpenShiftResourceImpl.java |  18 ++
 .../location/docker/DockerJcloudsLocation.java  | 123 +++++-----
 .../location/docker/DockerLocationResolver.java |  42 +++-
 .../location/kubernetes/ImageChooser.java       |  86 ++++---
 .../location/kubernetes/KubernetesCerts.java    |  38 +--
 .../kubernetes/KubernetesClientRegistry.java    |  21 +-
 .../KubernetesClientRegistryImpl.java           |  45 +++-
 .../location/kubernetes/KubernetesLocation.java | 238 ++++++++++---------
 .../kubernetes/KubernetesLocationConfig.java    |  32 ++-
 .../kubernetes/KubernetesLocationResolver.java  |  26 +-
 .../machine/KubernetesEmptyMachineLocation.java |  25 +-
 .../machine/KubernetesMachineLocation.java      |  18 ++
 .../machine/KubernetesSshMachineLocation.java   |  18 ++
 .../openshift/OpenShiftClientRegistryImpl.java  |  23 +-
 .../location/openshift/OpenShiftLocation.java   | 104 ++++----
 .../openshift/OpenShiftLocationConfig.java      |  21 +-
 .../openshift/OpenShiftLocationResolver.java    |  26 +-
 ...pache.brooklyn.api.location.LocationResolver |  18 ++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  19 +-
 .../docker/DockerJcloudsLocationLiveTest.java   | 143 ++++++-----
 .../docker/DockerLocationResolverTest.java      |  34 ++-
 .../location/kubernetes/ImageChooserTest.java   |  32 ++-
 .../kubernetes/KubernetesCertsTest.java         |  72 +++---
 .../kubernetes/KubernetesLocationLiveTest.java  |  98 ++++----
 .../KubernetesLocationResolverTest.java         |  32 ++-
 .../KubernetesLocationYamlLiveTest.java         | 119 +++++-----
 .../openshift/OpenShiftLocationLiveTest.java    |  36 ++-
 .../OpenShiftLocationResolverTest.java          |  30 ++-
 .../OpenShiftLocationYamlLiveTest.java          |  62 ++---
 .../resources/nginx-replication-controller.yaml |  17 ++
 .../src/test/resources/nginx-service.yaml       |  17 ++
 docker-location/pom.xml                         | 145 -----------
 kubernetes-location/pom.xml                     | 112 ---------
 openshift-location/pom.xml                      | 113 ---------
 pom.xml                                         | 205 ----------------
 45 files changed, 1451 insertions(+), 1216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/pom.xml b/brooklyn-server/locations/container/pom.xml
index e69de29..1e12a98 100644
--- a/brooklyn-server/locations/container/pom.xml
+++ b/brooklyn-server/locations/container/pom.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         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>
+    <artifactId>brooklyn-locations-container</artifactId>
+    <packaging>jar</packaging>
+    <name>Brooklyn Container Location Targets</name>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.12.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+    </parent>
+
+    <properties>
+        <kubernetes-client.version>1.4.27</kubernetes-client.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>io.fabric8</groupId>
+            <artifactId>kubernetes-client</artifactId>
+            <version>${kubernetes-client.version}</version>
+            <classifier>bundle</classifier>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.squareup.okio</groupId>
+                    <artifactId>okio</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.fabric8</groupId>
+            <artifactId>openshift-client</artifactId>
+            <version>${kubernetes-client.version}</version>
+            <classifier>bundle</classifier>
+        </dependency>
+
+        <!--
+            Expect AMP to exclude this, and to choose its own jclouds-docker version.
+            So if this version is not kept up-to-date then it won't impact AMP.
+        -->
+        <dependency>
+            <groupId>${jclouds.groupId}.api</groupId>
+            <artifactId>docker</artifactId>
+            <version>${jclouds.version}</version>
+            <exclusions>
+                <exclusion>
+                    <!-- Conflicts with javax.ws.rs-api -->
+                    <groupId>javax.ws.rs</groupId>
+                    <artifactId>jsr311-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-software-base</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-locations-jclouds</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-test-support</artifactId>
+            <version>${brooklyn.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-test-support</artifactId>
+            <version>${brooklyn.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-locations-jclouds</artifactId>
+            <version>${brooklyn.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-launcher</artifactId>
+            <version>${brooklyn.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-launcher</artifactId>
+            <version>${brooklyn.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-camp</artifactId>
+            <version>${brooklyn.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${jax-rs-api.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainer.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainer.java
index de82874..f8831a4 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainer.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainer.java
@@ -1,5 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.docker;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.reflect.TypeToken;
 import org.apache.brooklyn.api.entity.ImplementedBy;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.BasicConfigInheritance;
@@ -7,9 +27,6 @@ import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.config.MapConfigKey;
 import org.apache.brooklyn.entity.software.base.SoftwareProcess;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-
 /**
  * The DockerContainer type is for easily deploying any docker image from the
  * image repository set on the target swarm or docker-engine based location
@@ -60,7 +77,8 @@ public interface DockerContainer extends SoftwareProcess {
     @SuppressWarnings("serial")
     ConfigKey<Iterable<String>> INBOUND_TCP_PORTS =
             ConfigKeys.newConfigKey(
-                    new TypeToken<Iterable<String>>() {},
+                    new TypeToken<Iterable<String>>() {
+                    },
                     "docker.container.inboundPorts",
                     "List of ports, that the docker image opens, to be made public");
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainerImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainerImpl.java
index a3d2671..f0a9708 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainerImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/docker/DockerContainerImpl.java
@@ -1,8 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.docker;
 
-import java.util.Iterator;
-import java.util.List;
-
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.api.sensor.EnricherSpec;
 import org.apache.brooklyn.core.entity.Attributes;
@@ -13,59 +30,59 @@ import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessImpl;
 import org.apache.brooklyn.util.collections.MutableList;
 
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableSet;
+import java.util.Iterator;
+import java.util.List;
 
 public class DockerContainerImpl extends EmptySoftwareProcessImpl implements DockerContainer {
 
-   @Override
-   public void init() {
-      super.init();
+    @Override
+    public void init() {
+        super.init();
 
-      String imageName = config().get(DockerContainer.IMAGE_NAME);
-      if (!Strings.isNullOrEmpty(imageName)) {
-         config().set(PROVISIONING_PROPERTIES.subKey("imageId"), imageName);
-      }
+        String imageName = config().get(DockerContainer.IMAGE_NAME);
+        if (!Strings.isNullOrEmpty(imageName)) {
+            config().set(PROVISIONING_PROPERTIES.subKey("imageId"), imageName);
+        }
 
-      if (Boolean.TRUE.equals(config().get(DockerContainer.DISABLE_SSH))) {
-         config().set(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, true);
-         config().set(PROVISIONING_PROPERTIES.subKey("useJcloudsSshInit"), false);
-         config().set(PROVISIONING_PROPERTIES.subKey("waitForSshable"), false);
-         config().set(PROVISIONING_PROPERTIES.subKey("pollForFirstReachableAddress"), false);
-         config().set(EmptySoftwareProcessImpl.USE_SSH_MONITORING, false);
-      }
+        if (Boolean.TRUE.equals(config().get(DockerContainer.DISABLE_SSH))) {
+            config().set(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, true);
+            config().set(PROVISIONING_PROPERTIES.subKey("useJcloudsSshInit"), false);
+            config().set(PROVISIONING_PROPERTIES.subKey("waitForSshable"), false);
+            config().set(PROVISIONING_PROPERTIES.subKey("pollForFirstReachableAddress"), false);
+            config().set(EmptySoftwareProcessImpl.USE_SSH_MONITORING, false);
+        }
 
-      ImmutableSet.Builder<AttributeSensor<Integer>> builder = ImmutableSet.builder();
-      List<String> portRanges = MutableList.copyOf(config().get(DockerContainer.INBOUND_TCP_PORTS));
-      for (String portRange : portRanges) {
-         Iterator<Integer> iterator = PortRanges.fromString(portRange).iterator();
-         while (iterator.hasNext()) {
-            Integer port = iterator.next();
-            AttributeSensor<Integer> element = Sensors.newIntegerSensor("docker.port." + port);
-            sensors().set(element, port);
-            builder.add(element);
-         }
-      }
+        ImmutableSet.Builder<AttributeSensor<Integer>> builder = ImmutableSet.builder();
+        List<String> portRanges = MutableList.copyOf(config().get(DockerContainer.INBOUND_TCP_PORTS));
+        for (String portRange : portRanges) {
+            Iterator<Integer> iterator = PortRanges.fromString(portRange).iterator();
+            while (iterator.hasNext()) {
+                Integer port = iterator.next();
+                AttributeSensor<Integer> element = Sensors.newIntegerSensor("docker.port." + port);
+                sensors().set(element, port);
+                builder.add(element);
+            }
+        }
 
-      enrichers().add(EnricherSpec.create(OnPublicNetworkEnricher.class).configure(OnPublicNetworkEnricher.SENSORS, builder.build()));
-   }
+        enrichers().add(EnricherSpec.create(OnPublicNetworkEnricher.class).configure(OnPublicNetworkEnricher.SENSORS, builder.build()));
+    }
 
-   @Override
-   protected void disconnectSensors() {
-      if(isSshMonitoringEnabled()) {
-         disconnectServiceUpIsRunning();
-      }
-      super.disconnectSensors();
-   }
+    @Override
+    protected void disconnectSensors() {
+        if (isSshMonitoringEnabled()) {
+            disconnectServiceUpIsRunning();
+        }
+        super.disconnectSensors();
+    }
 
-   @Override
-   protected void connectSensors() {
-      super.connectSensors();
-      if (isSshMonitoringEnabled()) {
-         connectServiceUpIsRunning();
-      } else {
-         sensors().set(Attributes.SERVICE_UP, true);
-      }
-   }
+    @Override
+    protected void connectSensors() {
+        super.connectSensors();
+        if (isSshMonitoringEnabled()) {
+            connectServiceUpIsRunning();
+        } else {
+            sensors().set(Attributes.SERVICE_UP, true);
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPod.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPod.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPod.java
index 5dfc509..b5e9a9d 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPod.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPod.java
@@ -1,22 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.kubernetes;
 
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.ImmutableMap;
+import com.google.common.reflect.TypeToken;
 import org.apache.brooklyn.api.entity.ImplementedBy;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.container.entity.docker.DockerContainer;
+import org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig;
 import org.apache.brooklyn.core.config.BasicConfigInheritance;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.config.MapConfigKey;
 import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.math.MathPredicates;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-
-import org.apache.brooklyn.container.entity.docker.DockerContainer;
-import org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig;
+import java.util.List;
+import java.util.Map;
 
 @ImplementedBy(KubernetesPodImpl.class)
 public interface KubernetesPod extends DockerContainer {
@@ -26,7 +42,8 @@ public interface KubernetesPod extends DockerContainer {
     ConfigKey<Boolean> PRIVILEGED = KubernetesLocationConfig.PRIVILEGED;
 
     @SuppressWarnings("serial")
-    ConfigKey<List<String>> PERSISTENT_VOLUMES = ConfigKeys.builder(new TypeToken<List<String>>() {})
+    ConfigKey<List<String>> PERSISTENT_VOLUMES = ConfigKeys.builder(new TypeToken<List<String>>() {
+    })
             .name("persistentVolumes")
             .description("Persistent volumes used by the pod")
             .build();
@@ -44,13 +61,15 @@ public interface KubernetesPod extends DockerContainer {
             .build();
 
     @SuppressWarnings("serial")
-    ConfigKey<Map<String, String>> SECRETS = ConfigKeys.builder(new TypeToken<Map<String, String>>() {})
+    ConfigKey<Map<String, String>> SECRETS = ConfigKeys.builder(new TypeToken<Map<String, String>>() {
+    })
             .name("secrets")
             .description("Secrets to be added to the pod")
             .build();
 
     @SuppressWarnings("serial")
-    ConfigKey<Map<String, String>> LIMITS = ConfigKeys.builder(new TypeToken<Map<String, String>>() {})
+    ConfigKey<Map<String, String>> LIMITS = ConfigKeys.builder(new TypeToken<Map<String, String>>() {
+    })
             .name("limits")
             .description("Container resource limits for the pod")
             .build();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPodImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPodImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPodImpl.java
index c71c1a7..0765896 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPodImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesPodImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.kubernetes;
 
 import org.apache.brooklyn.container.entity.docker.DockerContainerImpl;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResource.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResource.java
index 4fbd75d..5754897 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResource.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResource.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.kubernetes;
 
 import org.apache.brooklyn.api.entity.ImplementedBy;
@@ -12,18 +30,18 @@ import org.apache.brooklyn.util.core.ResourcePredicates;
 public interface KubernetesResource extends SoftwareProcess {
 
     ConfigKey<String> RESOURCE_FILE = ConfigKeys.builder(String.class)
-                                             .name("resource")
-                                             .description("Kubernetes resource YAML file URI")
-                                             .constraint(ResourcePredicates.urlExists())
-                                             .build();
+            .name("resource")
+            .description("Kubernetes resource YAML file URI")
+            .constraint(ResourcePredicates.urlExists())
+            .build();
 
     AttributeSensor<String> RESOURCE_TYPE = Sensors.builder(String.class, "kubernetes.resource.type")
-                                             .description("Kubernetes resource type")
-                                             .build();
+            .description("Kubernetes resource type")
+            .build();
 
     AttributeSensor<String> RESOURCE_NAME = Sensors.builder(String.class, "kubernetes.resource.name")
-                                             .description("Kubernetes resource name")
-                                             .build();
+            .description("Kubernetes resource name")
+            .build();
 
     AttributeSensor<String> KUBERNETES_NAMESPACE = KubernetesPod.KUBERNETES_NAMESPACE;
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResourceImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResourceImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResourceImpl.java
index 59b8fdf..d87e22d 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResourceImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/kubernetes/KubernetesResourceImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.kubernetes;
 
 import org.apache.brooklyn.core.entity.BrooklynConfigKeys;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
index feec036..739580c 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
@@ -1,7 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.openshift;
 
 import org.apache.brooklyn.api.entity.ImplementedBy;
-
 import org.apache.brooklyn.container.entity.kubernetes.KubernetesPod;
 
 @ImplementedBy(OpenShiftPodImpl.class)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
index 03a3e6d..2d83421 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.openshift;
 
 import org.apache.brooklyn.container.entity.kubernetes.KubernetesPodImpl;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
index f57a3c6..6c39538 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
@@ -1,7 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.openshift;
 
 import org.apache.brooklyn.api.entity.ImplementedBy;
-
 import org.apache.brooklyn.container.entity.kubernetes.KubernetesResource;
 
 @ImplementedBy(OpenShiftResourceImpl.class)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
index 473f7f8..fc1be96 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.entity.openshift;
 
 import org.apache.brooklyn.container.entity.kubernetes.KubernetesResourceImpl;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerJcloudsLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerJcloudsLocation.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerJcloudsLocation.java
index 4354ed3..124a191 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerJcloudsLocation.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerJcloudsLocation.java
@@ -1,17 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.docker;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
+import com.google.common.base.Functions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.location.MachineLocation;
 import org.apache.brooklyn.api.location.NoMachinesAvailableException;
 import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.container.entity.docker.DockerContainer;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.location.LocationConfigKeys;
 import org.apache.brooklyn.location.jclouds.JcloudsLocation;
@@ -29,37 +43,35 @@ import org.jclouds.docker.compute.options.DockerTemplateOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Functions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
+import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
 
-import org.apache.brooklyn.container.entity.docker.DockerContainer;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * For provisioning docker containers, using the jclouds-docker integration.
- * 
- * This adds special support for default Cloudsoft images. If the image description matches our 
- * cloudsoft regexes, then auto-generate a password and pass that in as 
- * {@code CLOUDSOFT_ROOT_PASSWORD} when launching the container. That will then be used as the 
+ * <p>
+ * This adds special support for default Cloudsoft images. If the image description matches our
+ * cloudsoft regexes, then auto-generate a password and pass that in as
+ * {@code CLOUDSOFT_ROOT_PASSWORD} when launching the container. That will then be used as the
  * {@link DockerTemplateOptions#getLoginPassword()}.
- * 
+ * <p>
  * Also, if no image is specified then this will set the default to "cloudsoft/centos:7"
  * (see https://hub.docker.com/r/cloudsoft/centos/).
  */
 public class DockerJcloudsLocation extends JcloudsLocation {
 
-    private static final Logger LOG = LoggerFactory.getLogger(DockerJcloudsLocation.class);
-
     public static final ConfigKey<Boolean> INJECT_LOGIN_CREDENTIAL = ConfigKeys.newBooleanConfigKey(
-            "injectLoginCredential", 
-            "Whether to inject login credentials (if null, will infer from image choice)", 
+            "injectLoginCredential",
+            "Whether to inject login credentials (if null, will infer from image choice)",
             null);
-
     public static final ConfigKey<String> DEFAULT_IMAGE_DESCRIPTION_REGEX = ConfigKeys.newStringConfigKey(
-            "defaultImageDescriptionRegex", 
+            "defaultImageDescriptionRegex",
             "The default image description to use, if no other image preferences are supplied",
             "cloudsoft/centos:7");
-
+    private static final Logger LOG = LoggerFactory.getLogger(DockerJcloudsLocation.class);
     /**
      * The regex for the image descriptions that support us injecting login credentials.
      */
@@ -72,33 +84,11 @@ public class DockerJcloudsLocation extends JcloudsLocation {
             new ImageMetadata(OsFamily.UBUNTU, "14.04", "cloudsoft/ubuntu:14.04"),
             new ImageMetadata(OsFamily.UBUNTU, "16.04", "cloudsoft/ubuntu:16.04"));
 
-    private static class ImageMetadata {
-        private final OsFamily osFamily;
-        private final String osVersion;
-        private final String imageDescription;
-        
-        public ImageMetadata(OsFamily osFamily, String osVersion, String imageDescription) {
-            this.osFamily = checkNotNull(osFamily, "osFamily");
-            this.osVersion = checkNotNull(osVersion, "osVersion");
-            this.imageDescription = checkNotNull(imageDescription, "imageDescription");
-        }
-        
-        public boolean matches(@Nullable OsFamily osFamily, @Nullable String osVersionRegex) {
-            if (osFamily != null && osFamily != this.osFamily) return false;
-            if (osVersionRegex != null && !osVersion.matches(osVersionRegex)) return false;
-            return true;
-        }
-        
-        public String getImageDescription() {
-            return imageDescription;
-        }
-    }
-
     @Override
     protected MachineLocation obtainOnce(ConfigBag setup) throws NoMachinesAvailableException {
         // Use the provider name that jclouds expects; rely on resolver to have validated this.
         setup.configure(JcloudsLocation.CLOUD_PROVIDER, "docker");
-        
+
         // Inject default image, if absent
         String imageId = setup.get(JcloudsLocation.IMAGE_ID);
         String imageNameRegex = setup.get(JcloudsLocation.IMAGE_NAME_REGEX);
@@ -106,14 +96,14 @@ public class DockerJcloudsLocation extends JcloudsLocation {
         String defaultImageDescriptionRegex = setup.get(DEFAULT_IMAGE_DESCRIPTION_REGEX);
         OsFamily osFamily = setup.get(OS_FAMILY);
         String osVersionRegex = setup.get(OS_VERSION_REGEX);
-        
+
         if (Strings.isBlank(imageId) && Strings.isBlank(imageNameRegex) && Strings.isBlank(imageDescriptionRegex)) {
             if (osFamily != null || osVersionRegex != null) {
                 for (ImageMetadata imageMetadata : DEFAULT_IMAGES) {
                     if (imageMetadata.matches(osFamily, osVersionRegex)) {
                         String imageDescription = imageMetadata.getImageDescription();
-                        LOG.debug("Setting default image regex to {}, for obtain call in {}; removing osFamily={} and osVersionRegex={}", 
-                                new Object[] {imageDescription, this, osFamily, osVersionRegex});
+                        LOG.debug("Setting default image regex to {}, for obtain call in {}; removing osFamily={} and osVersionRegex={}",
+                                new Object[]{imageDescription, this, osFamily, osVersionRegex});
                         setup.configure(JcloudsLocation.IMAGE_DESCRIPTION_REGEX, imageDescription);
                         setup.configure(OS_FAMILY, null);
                         setup.configure(OS_VERSION_REGEX, null);
@@ -125,10 +115,10 @@ public class DockerJcloudsLocation extends JcloudsLocation {
                 setup.configure(JcloudsLocation.IMAGE_DESCRIPTION_REGEX, defaultImageDescriptionRegex);
             }
         }
-        
+
         return super.obtainOnce(setup);
     }
-    
+
     @Override
     public Template buildTemplate(ComputeService computeService, ConfigBag config, Collection<JcloudsLocationCustomizer> customizers) {
         String loginUser = config.get(JcloudsLocation.LOGIN_USER);
@@ -159,13 +149,13 @@ public class DockerJcloudsLocation extends JcloudsLocation {
                 templateOptions.overrideLoginUser(loginUser);
                 templateOptions.overrideLoginPassword(loginPassword);
 
-                env.add("CLOUDSOFT_ROOT_PASSWORD="+loginPassword);
+                env.add("CLOUDSOFT_ROOT_PASSWORD=" + loginPassword);
             }
         }
 
         Entity context = validateCallerContext(config);
-        Map<String,Object> containerEnv = MutableMap.copyOf(context.config().get(DockerContainer.CONTAINER_ENVIRONMENT));
-        for (Map.Entry<String,String> entry : Maps.transformValues(containerEnv, Functions.toStringFunction()).entrySet()) {
+        Map<String, Object> containerEnv = MutableMap.copyOf(context.config().get(DockerContainer.CONTAINER_ENVIRONMENT));
+        for (Map.Entry<String, String> entry : Maps.transformValues(containerEnv, Functions.toStringFunction()).entrySet()) {
             env.add(String.format("%s=%s", entry.getKey(), entry.getValue()));
         }
         templateOptions.env(env);
@@ -173,7 +163,6 @@ public class DockerJcloudsLocation extends JcloudsLocation {
         return template;
     }
 
-
     private Entity validateCallerContext(ConfigBag setup) {
         // Lookup entity flags
         Object callerContext = setup.get(LocationConfigKeys.CALLER_CONTEXT);
@@ -182,4 +171,26 @@ public class DockerJcloudsLocation extends JcloudsLocation {
         }
         return (Entity) callerContext;
     }
+
+    private static class ImageMetadata {
+        private final OsFamily osFamily;
+        private final String osVersion;
+        private final String imageDescription;
+
+        public ImageMetadata(OsFamily osFamily, String osVersion, String imageDescription) {
+            this.osFamily = checkNotNull(osFamily, "osFamily");
+            this.osVersion = checkNotNull(osVersion, "osVersion");
+            this.imageDescription = checkNotNull(imageDescription, "imageDescription");
+        }
+
+        public boolean matches(@Nullable OsFamily osFamily, @Nullable String osVersionRegex) {
+            if (osFamily != null && osFamily != this.osFamily) return false;
+            if (osVersionRegex != null && !osVersion.matches(osVersionRegex)) return false;
+            return true;
+        }
+
+        public String getImageDescription() {
+            return imageDescription;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerLocationResolver.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerLocationResolver.java
index 1b2318f..e76b12f 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerLocationResolver.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/docker/DockerLocationResolver.java
@@ -1,7 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.docker;
 
-import java.util.Map;
-
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.location.LocationResolver;
 import org.apache.brooklyn.core.location.AbstractLocationResolver;
@@ -12,34 +28,36 @@ import org.apache.brooklyn.util.collections.MutableMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Map;
+
 /**
  * Locations starting with the given prefix (@code "docker") will use this resolver, to instantiate
  * a {@link DockerJcloudsLocation}.
- * 
+ * <p>
  * We ensure that config will be picked up from brooklyn.properties using the appropriate precedence:
  * <ol>
- *   <li>named location config
- *   <li>Prefix {@code brooklyn.location.docker.}
- *   <li>Prefix {@code brooklyn.jclouds.docker.}
- *   <li>Prefix {@code brooklyn.jclouds.}
+ * <li>named location config
+ * <li>Prefix {@code brooklyn.location.docker.}
+ * <li>Prefix {@code brooklyn.jclouds.docker.}
+ * <li>Prefix {@code brooklyn.jclouds.}
  * </ol>
  */
 public class DockerLocationResolver extends AbstractLocationResolver implements LocationResolver {
 
     public static final Logger log = LoggerFactory.getLogger(DockerLocationResolver.class);
-    
+
     public static final String PREFIX = "docker";
 
     @Override
     public boolean isEnabled() {
         return LocationConfigUtils.isResolverPrefixEnabled(managementContext, getPrefix());
     }
-    
+
     @Override
     public String getPrefix() {
         return PREFIX;
     }
-    
+
     @Override
     protected Class<? extends Location> getLocationType() {
         return DockerJcloudsLocation.class;
@@ -53,10 +71,10 @@ public class DockerLocationResolver extends AbstractLocationResolver implements
     @Override
     protected Map<String, Object> getFilteredLocationProperties(String provider, String namedLocation, Map<String, ?> prioritisedProperties, Map<String, ?> globalProperties) {
         Map<String, Object> dockerConf = new LocationPropertiesFromBrooklynProperties().getLocationProperties(getPrefix(), namedLocation, globalProperties);
-        
+
         Object providerInConf = dockerConf.get("provider");
         if (providerInConf != null && !provider.equals(providerInConf)) {
-            throw new IllegalArgumentException(provider+" location configured with provider '"+providerInConf+"', but must be blank or '"+provider+"'");
+            throw new IllegalArgumentException(provider + " location configured with provider '" + providerInConf + "', but must be blank or '" + provider + "'");
         }
 
         String providerOrApi = "docker";

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/ImageChooser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/ImageChooser.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/ImageChooser.java
index 93b8f6d..5536b82 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/ImageChooser.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/ImageChooser.java
@@ -1,71 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.kubernetes;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
 import org.jclouds.compute.domain.OsFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
+import javax.annotation.Nullable;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 public class ImageChooser {
 
     private static final Logger LOG = LoggerFactory.getLogger(ImageChooser.class);
-
-    public static class ImageMetadata {
-        private final OsFamily osFamily;
-        private final String osVersion;
-        private final String imageName;
-        
-        public ImageMetadata(OsFamily osFamily, String osVersion, String imageName) {
-            this.osFamily = checkNotNull(osFamily, "osFamily");
-            this.osVersion = checkNotNull(osVersion, "osVersion");
-            this.imageName = checkNotNull(imageName, "imageName");
-        }
-        
-        public boolean matches(@Nullable OsFamily osFamily, @Nullable String osVersionRegex) {
-            if (osFamily != null && osFamily != this.osFamily) return false;
-            if (osVersionRegex != null && !osVersion.matches(osVersionRegex)) return false;
-            return true;
-        }
-        
-        public String getImageName() {
-            return imageName;
-        }
-    }
-
     private static final List<ImageMetadata> DEFAULT_IMAGES = ImmutableList.of(
             new ImageMetadata(OsFamily.CENTOS, "7", "cloudsoft/centos:7"),
             new ImageMetadata(OsFamily.UBUNTU, "14.04", "cloudsoft/ubuntu:14.04"),
             new ImageMetadata(OsFamily.UBUNTU, "16.04", "cloudsoft/ubuntu:16.04"));
-    
     private final List<ImageMetadata> images;
 
     public ImageChooser() {
         this.images = DEFAULT_IMAGES;
     }
-    
+
     public ImageChooser(List<? extends ImageMetadata> images) {
         this.images = ImmutableList.copyOf(images);
     }
 
     public Optional<String> chooseImage(String osFamily, String osVersionRegex) {
-        return chooseImage((osFamily == null ? (OsFamily)null : OsFamily.fromValue(osFamily)), osVersionRegex);
+        return chooseImage((osFamily == null ? (OsFamily) null : OsFamily.fromValue(osFamily)), osVersionRegex);
     }
-    
+
     public Optional<String> chooseImage(OsFamily osFamily, String osVersionRegex) {
         for (ImageMetadata imageMetadata : images) {
             if (imageMetadata.matches(osFamily, osVersionRegex)) {
                 String imageName = imageMetadata.getImageName();
-                LOG.debug("Choosing container image {}, for osFamily={} and osVersionRegex={}", new Object[] {imageName, osFamily, osVersionRegex});
+                LOG.debug("Choosing container image {}, for osFamily={} and osVersionRegex={}", new Object[]{imageName, osFamily, osVersionRegex});
                 return Optional.of(imageName);
             }
         }
         return Optional.absent();
     }
+
+    public static class ImageMetadata {
+        private final OsFamily osFamily;
+        private final String osVersion;
+        private final String imageName;
+
+        public ImageMetadata(OsFamily osFamily, String osVersion, String imageName) {
+            this.osFamily = checkNotNull(osFamily, "osFamily");
+            this.osVersion = checkNotNull(osVersion, "osVersion");
+            this.imageName = checkNotNull(imageName, "imageName");
+        }
+
+        public boolean matches(@Nullable OsFamily osFamily, @Nullable String osVersionRegex) {
+            if (osFamily != null && osFamily != this.osFamily) return false;
+            if (osVersionRegex != null && !osVersion.matches(osVersionRegex)) return false;
+            return true;
+        }
+
+        public String getImageName() {
+            return imageName;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesCerts.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesCerts.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesCerts.java
index 6005c52..5bb7e2d 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesCerts.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesCerts.java
@@ -1,14 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.kubernetes;
 
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CA_CERT_DATA;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CA_CERT_FILE;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_CERT_DATA;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_CERT_FILE;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_KEY_ALGO;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_KEY_DATA;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_KEY_FILE;
-import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.CLIENT_KEY_PASSPHRASE;
-
+import com.google.common.base.Optional;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.util.core.ResourceUtils;
 import org.apache.brooklyn.util.core.config.ConfigBag;
@@ -16,7 +26,7 @@ import org.apache.brooklyn.util.text.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
+import static org.apache.brooklyn.container.location.kubernetes.KubernetesLocationConfig.*;
 
 class KubernetesCerts {
 
@@ -27,7 +37,7 @@ class KubernetesCerts {
     public final Optional<String> clientKeyData;
     public final Optional<String> clientKeyAlgo;
     public final Optional<String> clientKeyPassphrase;
-    
+
     public KubernetesCerts(ConfigBag config) {
         caCertData = getData(CA_CERT_DATA, CA_CERT_FILE, config);
         clientCertData = getData(CLIENT_CERT_DATA, CLIENT_CERT_FILE, config);
@@ -40,7 +50,7 @@ class KubernetesCerts {
         String data = Strings.isNonBlank(config.get(dataKey)) ? config.get(dataKey).trim() : null;
         String file = config.get(fileKey);
         String fileData = Strings.isNonBlank(file) ? getFileContents(file).trim() : null;
-        
+
         if (Strings.isNonBlank(data) && Strings.isNonBlank(fileData)) {
             if (data.equals(fileData)) {
                 LOG.warn("Duplicate (matching) configuration for " + dataKey.getName() + " and " + fileKey.getName() + " (continuing)");
@@ -48,7 +58,7 @@ class KubernetesCerts {
                 throw new IllegalStateException("Duplicate conflicting configuration for " + dataKey.getName() + " and " + fileKey.getName());
             }
         }
-        
+
         String result = Strings.isNonBlank(data) ? data : (Strings.isNonBlank(fileData) ? fileData : null);
         return Optional.fromNullable(result);
     }
@@ -57,7 +67,7 @@ class KubernetesCerts {
         String result = config.get(key);
         return Optional.fromNullable(Strings.isNonBlank(result) ? result : null);
     }
-    
+
     protected String getFileContents(String file) {
         return ResourceUtils.create(this).getResourceAsString(file);
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistry.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistry.java
index db8b4cc..9cbf0b1 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistry.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistry.java
@@ -1,8 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.kubernetes;
 
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
 import io.fabric8.kubernetes.client.KubernetesClient;
+import org.apache.brooklyn.util.core.config.ConfigBag;
 
 public interface KubernetesClientRegistry {
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a334e0fe/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java
index e1777e5..27ab589 100644
--- a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java
@@ -1,20 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.brooklyn.container.location.kubernetes;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-
 import com.google.common.base.Throwables;
 import com.google.common.io.BaseEncoding;
-
 import io.fabric8.kubernetes.client.ConfigBuilder;
 import io.fabric8.kubernetes.client.DefaultKubernetesClient;
 import io.fabric8.kubernetes.client.KubernetesClient;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.text.Strings;
+import org.apache.brooklyn.util.time.Duration;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 public class KubernetesClientRegistryImpl implements KubernetesClientRegistry {
 
@@ -38,10 +54,13 @@ public class KubernetesClientRegistryImpl implements KubernetesClientRegistry {
         if (url.getProtocol().equals("https")) {
             KubernetesCerts certs = new KubernetesCerts(conf);
             if (certs.caCertData.isPresent()) configBuilder.withCaCertData(toBase64Encoding(certs.caCertData.get()));
-            if (certs.clientCertData.isPresent()) configBuilder.withClientCertData(toBase64Encoding(certs.clientCertData.get()));
-            if (certs.clientKeyData.isPresent()) configBuilder.withClientKeyData(toBase64Encoding(certs.clientKeyData.get()));
+            if (certs.clientCertData.isPresent())
+                configBuilder.withClientCertData(toBase64Encoding(certs.clientCertData.get()));
+            if (certs.clientKeyData.isPresent())
+                configBuilder.withClientKeyData(toBase64Encoding(certs.clientKeyData.get()));
             if (certs.clientKeyAlgo.isPresent()) configBuilder.withClientKeyAlgo(certs.clientKeyAlgo.get());
-            if (certs.clientKeyPassphrase.isPresent()) configBuilder.withClientKeyPassphrase(certs.clientKeyPassphrase.get());
+            if (certs.clientKeyPassphrase.isPresent())
+                configBuilder.withClientKeyPassphrase(certs.clientKeyPassphrase.get());
             // TODO Should we also set configBuilder.withTrustCerts(true) here?
         }
 


Mime
View raw message