You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/08/18 15:25:49 UTC

[1/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master f092e183f -> 23889db5c


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
index f8d03c9..7107050 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
@@ -20,13 +20,12 @@ package org.apache.brooklyn.camp.brooklyn.spi.dsl;
 
 import java.io.Serializable;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
-
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.api.management.TaskFactory;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
 import org.apache.brooklyn.core.util.task.DeferredSupplier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
index e30f7f2..5836148 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
@@ -18,11 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.dsl;
 
-import io.brooklyn.camp.spi.resolve.PlanInterpreter;
-import io.brooklyn.camp.spi.resolve.PlanInterpreter.PlanInterpreterAdapter;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode.Role;
-
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
@@ -32,6 +27,10 @@ import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon;
 import org.apache.brooklyn.camp.brooklyn.spi.dsl.parse.DslParser;
 import org.apache.brooklyn.camp.brooklyn.spi.dsl.parse.FunctionWithArgs;
 import org.apache.brooklyn.camp.brooklyn.spi.dsl.parse.QuotedString;
+import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter;
+import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter.PlanInterpreterAdapter;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode.Role;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
index f67f2c9..9635a95 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
@@ -19,10 +19,9 @@
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
 import org.apache.brooklyn.api.management.ManagementContext;
-
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.AbstractResourceLookup;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.AbstractResourceLookup;
 
 public abstract class AbstractBrooklynResourceLookup<T extends AbstractResource>  extends AbstractResourceLookup<T> {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
index 63ac989..a7a9647 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
@@ -18,16 +18,15 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 
 public abstract class AbstractTemplateBrooklynLookup<T extends AbstractResource>  extends AbstractBrooklynResourceLookup<T> {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
index ac3e542..9496c0d 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
@@ -18,10 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -29,6 +25,9 @@ import java.util.List;
 import org.apache.brooklyn.api.entity.Application;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 
 
 public class AssemblyBrooklynLookup extends AbstractBrooklynResourceLookup<Assembly> {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
index a41ee05..8efe3b0 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
@@ -18,10 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,6 +27,9 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynAssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 
 public class AssemblyTemplateBrooklynLookup extends AbstractTemplateBrooklynLookup<AssemblyTemplate> {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
index 05c8485..6a6c827 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
@@ -18,17 +18,16 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponent.Builder;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-
 import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.PlatformComponent.Builder;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 
 
 public class PlatformComponentBrooklynLookup extends AbstractBrooklynResourceLookup<PlatformComponent> {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
index a7089e8..d97eaa7 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
@@ -18,10 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.lookup;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -29,6 +25,9 @@ import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 
 public class PlatformComponentTemplateBrooklynLookup extends AbstractTemplateBrooklynLookup<PlatformComponentTemplate> {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
index bf79b7a..d69a3e4 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
@@ -18,24 +18,23 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.platform;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.PlatformTransaction;
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyBrooklynLookup;
 import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyTemplateBrooklynLookup;
 import org.apache.brooklyn.camp.brooklyn.spi.lookup.PlatformComponentBrooklynLookup;
 import org.apache.brooklyn.camp.brooklyn.spi.lookup.PlatformComponentTemplateBrooklynLookup;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.PlatformTransaction;
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
 
 import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
index 8922059..0deb246 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
@@ -18,9 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.Set;
@@ -30,6 +27,8 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 import org.apache.brooklyn.core.util.ResourceUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
index 0396009..fbe4637 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
@@ -18,9 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.Set;
@@ -30,6 +27,8 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 import org.apache.brooklyn.core.util.ResourceUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
index 72b06e3..99cc83b 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
@@ -18,9 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.File;
 import java.io.Reader;
 import java.util.Set;
@@ -28,6 +25,8 @@ import java.util.Set;
 import org.apache.brooklyn.api.entity.Application;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 import org.apache.brooklyn.core.util.ResourceUtils;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java
index 5a6d7d8..ef9a28a 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java
@@ -19,11 +19,6 @@
 package org.apache.brooklyn.camp.brooklyn;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
 
 import java.io.IOException;
 import java.io.Reader;
@@ -36,11 +31,14 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.api.policy.Policy;
-
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
 import org.apache.brooklyn.core.util.ResourceUtils;
-
 import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
 import org.apache.brooklyn.entity.webapp.JavaWebAppService;
 import org.apache.brooklyn.entity.webapp.WebAppService;
@@ -56,7 +54,9 @@ import brooklyn.entity.basic.Attributes;
 import brooklyn.entity.basic.BrooklynTaskTags;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.Lifecycle;
+
 import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
+
 import brooklyn.test.Asserts;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.exceptions.Exceptions;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsMatchingTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsMatchingTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsMatchingTest.java
index 7e45019..9f03388 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsMatchingTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsMatchingTest.java
@@ -18,12 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.pdp.DeploymentPlan;
-
 import java.io.IOException;
 import java.io.Reader;
 import java.util.Iterator;
@@ -32,6 +26,11 @@ import java.util.Map;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
 import org.apache.brooklyn.core.util.ResourceUtils;
 import org.apache.brooklyn.core.util.task.DeferredSupplier;
 import org.apache.brooklyn.test.entity.LocalManagementContextForTests;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
index 961e2fd..67ec2f6 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
@@ -18,16 +18,15 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.Reader;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.util.ResourceUtils;
 import org.apache.brooklyn.test.EntityTestUtils;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynLauncher.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynLauncher.java b/usage/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynLauncher.java
index 504363a..0c21d90 100644
--- a/usage/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynLauncher.java
+++ b/usage/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynLauncher.java
@@ -47,8 +47,11 @@ import org.apache.brooklyn.api.management.ha.ManagementNodeState;
 import org.apache.brooklyn.api.management.ha.ManagementPlaneSyncRecord;
 import org.apache.brooklyn.api.management.ha.ManagementPlaneSyncRecordPersister;
 import org.apache.brooklyn.api.mementos.BrooklynMementoRawData;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynAssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
 import org.apache.brooklyn.core.management.ha.HighAvailabilityManagerImpl;
 import org.apache.brooklyn.core.management.ha.ManagementPlaneSyncRecordPersisterToObjectStore;
@@ -106,9 +109,6 @@ import brooklyn.util.stream.Streams;
 import brooklyn.util.text.Strings;
 import brooklyn.util.time.Duration;
 import brooklyn.util.time.Time;
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 
 /**
  * Example usage is:

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java b/usage/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
index 461065e..556ac66 100644
--- a/usage/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
+++ b/usage/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
@@ -18,14 +18,14 @@
  */
 package org.apache.brooklyn.launcher.camp;
 
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.spi.PlatformRootSummary;
 import brooklyn.entity.basic.BrooklynShutdownHooks;
 
 import org.apache.brooklyn.launcher.BrooklynLauncher;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherAbstract;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 
 import com.google.common.annotations.Beta;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java
index 830214e..e165ab4 100644
--- a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java
+++ b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java
@@ -18,8 +18,6 @@
  */
 package org.apache.brooklyn.rest.resources;
 
-import io.brooklyn.camp.CampPlatform;
-
 import javax.annotation.Nullable;
 import javax.servlet.ServletContext;
 import javax.ws.rs.core.Context;
@@ -33,6 +31,7 @@ import brooklyn.config.render.RendererHints;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.basic.EntityLocal;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.core.management.ManagementContextInjectable;
 import org.apache.brooklyn.core.util.task.Tasks;
 import org.apache.brooklyn.rest.util.BrooklynRestResourceUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
index d195af6..03a53f0 100644
--- a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
+++ b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
@@ -22,9 +22,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
 import static javax.ws.rs.core.Response.created;
 import static javax.ws.rs.core.Response.status;
 import static javax.ws.rs.core.Response.Status.ACCEPTED;
+
 import brooklyn.entity.basic.EntityPredicates;
 import brooklyn.util.text.Strings;
-import io.brooklyn.camp.spi.AssemblyTemplate;
 
 import java.io.StringReader;
 import java.net.URI;
@@ -59,6 +59,7 @@ import org.apache.brooklyn.api.event.AttributeSensor;
 import org.apache.brooklyn.api.event.Sensor;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.management.entitlement.EntitlementPredicates;
 import org.apache.brooklyn.core.management.entitlement.Entitlements;


[4/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/CampServer.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/CampServer.java b/camp/camp-server/src/main/java/io/brooklyn/camp/CampServer.java
deleted file mode 100644
index 9f538c1..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/CampServer.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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 io.brooklyn.camp;
-
-import io.brooklyn.camp.rest.resource.PlatformRestResource;
-import io.brooklyn.camp.rest.util.DtoFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.EnumSet;
-
-import javax.servlet.DispatcherType;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.net.Networking;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-
-public class CampServer {
-
-    private static final Logger log = LoggerFactory.getLogger(CampServer.class);
-
-    public static final String CAMP_PLATFORM_ATTRIBUTE = CampPlatform.class.getCanonicalName();
-    public static final String DTO_FACTORY = DtoFactory.class.getCanonicalName();
-    
-    private final CampPlatform platform;
-    private final String uriBase;
-    private DtoFactory dtoFactory;
-    
-    WebAppContext webAppContext;
-    Server server;
-    
-    public CampServer(CampPlatform platform, String uriBase) {
-        this.platform = platform;
-        this.uriBase = uriBase;
-    }
-
-    public CampPlatform getPlatform() {
-        return platform;
-    }
-
-    public String getUriBase() {
-        return uriBase;
-    }
-    
-    public WebAppContext getWebAppContext() {
-        return webAppContext;
-    }
-    
-    public synchronized DtoFactory getDtoFactory() {
-        if (dtoFactory!=null) return dtoFactory;
-        dtoFactory = createDtoFactory();
-        return dtoFactory;
-    }
-    
-    protected DtoFactory createDtoFactory() {
-        return new DtoFactory(getPlatform(), getUriBase());
-    }
-    
-    public synchronized CampServer start() {
-        if (webAppContext!=null)
-            throw new IllegalStateException("Already started");
-        
-        webAppContext = new WebAppContext();
-        webAppContext.setContextPath("/");
-        webAppContext.setAttribute(CAMP_PLATFORM_ATTRIBUTE, getPlatform());
-        webAppContext.setAttribute(DTO_FACTORY, getDtoFactory());
-        webAppContext.setWar(
-                // TODO if there is a GUI or other war...
-                //findJsguiWebapp()!=null ? findJsguiWebapp() : 
-                CampServerUtils.createTempWebDirWithIndexHtml("CAMP REST API <p> (no gui available - " +
-                        "rest endpoint at <a href=\""+PlatformRestResource.CAMP_URI_PATH+"\">"+PlatformRestResource.CAMP_URI_PATH+"</a>)"));
-        CampServerUtils.installAsServletFilter(webAppContext);
-        
-        server = CampServerUtils.startServer(webAppContext, "CAMP server");
-        
-        return this;
-    }
-
-    public synchronized void stop() {
-        try {
-            server.stop();
-            server = null;
-            webAppContext.stop();
-            webAppContext = null;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-    public Integer getPort() {
-        if (server==null) return null;
-        return server.getConnectors()[0].getLocalPort();
-    }
-
-    public static class CampServerUtils {
-
-        public static void installAsServletFilter(ServletContextHandler context) {
-            // TODO security
-            //        installBrooklynPropertiesSecurityFilter(context);
-
-            // now set up the REST servlet resources
-            ResourceConfig config = new DefaultResourceConfig();
-            // load all our REST API modules, JSON, and Swagger
-            for (Object r: CampRestResources.getAllResources())
-                config.getSingletons().add(r);
-
-            // configure to match empty path, or any thing which looks like a file path with /assets/ and extension html, css, js, or png
-            // and treat that as static content
-            config.getProperties().put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, "(/?|[^?]*/assets/[^?]+\\.[A-Za-z0-9_]+)");
-
-            // and anything which is not matched as a servlet also falls through (but more expensive than a regex check?)
-            config.getFeatures().put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, true);
-
-            // finally create this as a _filter_ which falls through to a web app or something (optionally)
-            FilterHolder filterHolder = new FilterHolder(new ServletContainer(config));
-            context.addFilter(filterHolder, "/*", EnumSet.allOf(DispatcherType.class));
-        }
-
-        public static Server startServer(ContextHandler context, String summary) {
-            // FIXME port hardcoded
-            int port = Networking.nextAvailablePort(8080);
-            Server server = new Server(port);
-            server.setHandler(context);
-            
-            // use a nice name in the thread pool (otherwise this is exactly the same as Server defaults)
-            QueuedThreadPool threadPool = new QueuedThreadPool();
-            threadPool.setName("camp-jetty-server-"+port+"-"+threadPool.getName());
-            server.setThreadPool(threadPool);
-
-            try {
-                server.start();
-            } catch (Exception e) {
-                throw Exceptions.propagate(e);
-            } 
-            log.info("CAMP REST server started ("+summary+") on");
-            log.info("  http://localhost:"+server.getConnectors()[0].getLocalPort()+"/");
-
-            return server;
-        }
-        
-        /** create a directory with a simple index.html so we have some content being served up */
-        public static String createTempWebDirWithIndexHtml(String indexHtmlContent) {
-            File dir = Files.createTempDir();
-            dir.deleteOnExit();
-            try {
-                Files.write(indexHtmlContent, new File(dir, "index.html"), Charsets.UTF_8);
-            } catch (IOException e) {
-                Exceptions.propagate(e);
-            }
-            return dir.getAbsolutePath();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApiErrorDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApiErrorDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApiErrorDto.java
deleted file mode 100644
index 18b2cba..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApiErrorDto.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Throwables;
-
-/**
- * A simple error message that provides a message and optional details.
- *
- * This class should eventually be replaced with an ErrorMessage object,
- * as described in the CAMP spec.
- */
-public class ApiErrorDto {
-
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    /**
-     * @return An {@link ApiErrorDto.Builder} whose message is initialised to either the throwable's
-     *         message or the throwable's class name if the message is null and whose details are
-     *         initialised to the throwable's stack trace.
-     */
-    public static Builder fromThrowable(Throwable t) {
-        checkNotNull(t, "throwable");
-        String message = Optional.fromNullable(t.getMessage())
-                .or(t.getClass().getName());
-        return builder()
-                .message(message)
-                .details(Throwables.getStackTraceAsString(t));
-    }
-
-    public static class Builder {
-        private String message;
-        private String details;
-
-        public Builder message(String message) {
-            this.message = checkNotNull(message, "message");
-            return this;
-        }
-
-        public Builder details(String details) {
-            this.details = checkNotNull(details, "details");
-            return this;
-        }
-
-        public ApiErrorDto build() {
-            return new ApiErrorDto(message, details);
-        }
-
-        public Builder fromApiErrorDto(ApiErrorDto error) {
-            return this
-                    .message(error.message)
-                    .details(error.details);
-        }
-    }
-
-    private final String message;
-    private final String details;
-
-    public ApiErrorDto(
-            @JsonProperty("message") String message,
-            @JsonProperty("details") String details) {
-        this.message = checkNotNull(message, "message");
-        this.details = details != null ? details : "";
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public String getDetails() {
-        return details;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) return true;
-        if (other == null || getClass() != other.getClass()) return false;
-        ApiErrorDto that = ApiErrorDto.class.cast(other);
-        return Objects.equal(this.message, that.message) &&
-                Objects.equal(this.details, that.details);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(message, details);
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("message", message)
-                .add("details", details)
-                .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentDto.java
deleted file mode 100644
index ae4a68a..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentDto.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.Link;
-import io.brooklyn.camp.spi.PlatformComponent;
-
-public class ApplicationComponentDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.ApplicationComponentDto";
-    static { assert CLASS_NAME.equals(ApplicationComponentDto.class.getCanonicalName()); }
-
-    protected ApplicationComponentDto() {}
-    protected ApplicationComponentDto(DtoFactory dtoFactory, ApplicationComponent x) {
-        super(dtoFactory, x);
-        
-        platformComponents = new ArrayList<LinkDto>();
-        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
-            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
-        }
-        
-        applicationComponents = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
-            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
-        }
-    }
- 
-    private List<LinkDto> platformComponents;
-    private List<LinkDto> applicationComponents;
-
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getPlatformComponents() {
-        return platformComponents;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getApplicationComponents() {
-        return applicationComponents;
-    }
-    
-    // --- building ---
-
-    public static ApplicationComponentDto newInstance(DtoFactory dtoFactory, ApplicationComponent x) {
-        return new ApplicationComponentDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentTemplateDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentTemplateDto.java
deleted file mode 100644
index e3b92f2..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ApplicationComponentTemplateDto.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-
-public class ApplicationComponentTemplateDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.ApplicationComponentTemplateDto";
-    static { assert CLASS_NAME.equals(ApplicationComponentTemplateDto.class.getCanonicalName()); }
-
-    protected ApplicationComponentTemplateDto() {}
-    protected ApplicationComponentTemplateDto(DtoFactory dtoFactory, ApplicationComponentTemplate x) {
-        super(dtoFactory, x);
-        // TODO set addl ACT fields
-    }
- 
-    // TODO add addl ACT fields
-    
-    // --- building ---
-
-    public static ApplicationComponentTemplateDto newInstance(DtoFactory dtoFactory, ApplicationComponentTemplate x) {
-        return new ApplicationComponentTemplateDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyDto.java
deleted file mode 100644
index 9f36ce6..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyDto.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.Link;
-import io.brooklyn.camp.spi.PlatformComponent;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-public class AssemblyDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.AssemblyDto";
-    static { assert CLASS_NAME.equals(AssemblyDto.class.getCanonicalName()); }
-
-    protected AssemblyDto() {}
-    protected AssemblyDto(DtoFactory dtoFactory, Assembly x) {
-        super(dtoFactory, x);
-        
-        platformComponents = new ArrayList<LinkDto>();
-        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
-            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
-        }
-        
-        applicationComponents = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
-            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
-        }
-    }
- 
-    private List<LinkDto> platformComponents;
-    private List<LinkDto> applicationComponents;
-
-    // TODO addl AssemblyTemplate fields
-//  "parameterDefinitionUri": URI,
-//  "pdpUri" : URI ?
-
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getPlatformComponents() {
-        return platformComponents;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getApplicationComponents() {
-        return applicationComponents;
-    }
-    
-    // --- building ---
-
-    public static AssemblyDto newInstance(DtoFactory dtoFactory, Assembly x) {
-        return new AssemblyDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyTemplateDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyTemplateDto.java
deleted file mode 100644
index 3aca985..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/AssemblyTemplateDto.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.Link;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
-public class AssemblyTemplateDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.AssemblyTemplateDto";
-    static { assert CLASS_NAME.equals(AssemblyTemplateDto.class.getCanonicalName()); }
-
-    protected AssemblyTemplateDto() {}
-    protected AssemblyTemplateDto(DtoFactory dtoFactory, AssemblyTemplate x) {
-        super(dtoFactory, x);
-        
-        platformComponentTemplates = new ArrayList<LinkDto>();
-        for (Link<PlatformComponentTemplate> t: x.getPlatformComponentTemplates().links()) {
-            platformComponentTemplates.add(LinkDto.newInstance(dtoFactory, PlatformComponentTemplate.class, t));
-        }
-        
-        applicationComponentTemplates = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponentTemplate> t: x.getApplicationComponentTemplates().links()) {
-            applicationComponentTemplates.add(LinkDto.newInstance(dtoFactory, ApplicationComponentTemplate.class, t));
-        }
-    }
- 
-    private List<LinkDto> platformComponentTemplates;
-    private List<LinkDto> applicationComponentTemplates;
-
-    // TODO addl AssemblyTemplate fields
-//  "parameterDefinitionUri": URI,
-//  "pdpUri" : URI ?
-
-    public List<LinkDto> getPlatformComponentTemplates() {
-        return platformComponentTemplates;
-    }
-    
-    public List<LinkDto> getApplicationComponentTemplates() {
-        return applicationComponentTemplates;
-    }
-    
-    // --- building ---
-
-    public static AssemblyTemplateDto newInstance(DtoFactory dtoFactory, AssemblyTemplate x) {
-        return new AssemblyTemplateDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoBase.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoBase.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoBase.java
deleted file mode 100644
index f846eee..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoBase.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class DtoBase {
-
-    @Override public String toString() { return ToStringBuilder.reflectionToString(this); }
-    @Override public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); }
-    @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoCustomAttributes.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoCustomAttributes.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoCustomAttributes.java
deleted file mode 100644
index 38b9d94..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/DtoCustomAttributes.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.util.Map;
-
-import brooklyn.util.collections.MutableMap;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.google.common.collect.ImmutableMap;
-
-public class DtoCustomAttributes extends DtoBase {
-
-    private Map<String,Object> customAttributes = new MutableMap<String, Object>();
-
-    protected DtoCustomAttributes() {}
-    
-    public DtoCustomAttributes(Map<String,?> customAttributes) {
-        this.customAttributes = customAttributes==null ? ImmutableMap.<String, Object>of() : ImmutableMap.copyOf(customAttributes);
-    }
-    
-    @JsonIgnore
-    public Map<String, Object> getCustomAttributes() {
-        return customAttributes;
-    }
-
-    // --- json ---
-    
-    @JsonInclude(Include.NON_EMPTY)
-    @JsonAnyGetter
-    private Map<String,Object> any() {
-        return customAttributes;
-    }
-    @JsonAnySetter
-    private void set(String name, Object value) {
-        customAttributes.put(name, value);
-    }
-
-    // --- building ---
-
-    protected void newInstanceCustomAttributes(Map<String,?> customAttributes) {
-        if (customAttributes!=null)
-            this.customAttributes.putAll(customAttributes);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/LinkDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/LinkDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/LinkDto.java
deleted file mode 100644
index e6dc964..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/LinkDto.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.Link;
-
-import java.util.Map;
-
-public class LinkDto extends DtoCustomAttributes {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.LinkDto";
-    static { assert CLASS_NAME.equals(LinkDto.class.getCanonicalName()); }
-
-    private String href;
-    private String targetName;
-
-    protected LinkDto() {}
-    
-    public String getHref() {
-        return href;
-    }
-    
-    public String getTargetName() {
-        return targetName;
-    }
-    
-    // --- building ---
-
-    public static LinkDto newInstance(DtoFactory dtoFactory, Class<? extends AbstractResource> targetType, Link<?> x) {
-        return new LinkDto().newInstanceInitialization(dtoFactory, targetType, x);
-    }
-    
-    protected LinkDto newInstanceInitialization(DtoFactory dtoFactory, Class<? extends AbstractResource> targetType, Link<?> x) {
-        targetName = x.getName();
-        
-        href = dtoFactory.uri(targetType, x.getId());
-        return this;
-    }
-
-    public static LinkDto newInstance(String href, String targetName) {
-        LinkDto x = new LinkDto();
-        x.href = href;
-        x.targetName = targetName;
-        return x;
-    }
-    
-    public static LinkDto newInstance(String href, String targetName, Map<String,?> customAttributes) {
-        LinkDto x = newInstance(href, targetName);
-        x.newInstanceCustomAttributes(customAttributes);
-        return x;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentDto.java
deleted file mode 100644
index d9d1c85..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentDto.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.Link;
-import io.brooklyn.camp.spi.PlatformComponent;
-
-public class PlatformComponentDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.PlatformComponentDto";
-    static { assert CLASS_NAME.equals(PlatformComponentDto.class.getCanonicalName()); }
- 
-    protected PlatformComponentDto() {}
-    protected PlatformComponentDto(DtoFactory dtoFactory, PlatformComponent x) {
-        super(dtoFactory, x);
-        setExternalManagementUri(x.getExternalManagementUri());
-        platformComponents = new ArrayList<LinkDto>();
-        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
-            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
-        }
-        
-        applicationComponents = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
-            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
-        }
-    }
- 
-    private List<LinkDto> platformComponents;
-    private List<LinkDto> applicationComponents;
-
-    private String externalManagementUri;
-
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getPlatformComponents() {
-        return platformComponents;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getApplicationComponents() {
-        return applicationComponents;
-    } 
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public String getExternalManagementUri() {
-        return externalManagementUri;
-    }
-    private void setExternalManagementUri(String externalManagementUri) {
-        this.externalManagementUri = externalManagementUri;
-    }
-    
-    // --- building ---
-
-    public static PlatformComponentDto newInstance(DtoFactory dtoFactory, PlatformComponent x) {
-        return new PlatformComponentDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentTemplateDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentTemplateDto.java
deleted file mode 100644
index 252e9f6..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformComponentTemplateDto.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
-public class PlatformComponentTemplateDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.PlatformComponentTemplateDto";
-    static { assert CLASS_NAME.equals(PlatformComponentTemplateDto.class.getCanonicalName()); }
- 
-    protected PlatformComponentTemplateDto() {}
-    protected PlatformComponentTemplateDto(DtoFactory dtoFactory, PlatformComponentTemplate x) {
-        super(dtoFactory, x);
-        // TODO set addl PCT fields
-    }
- 
-    // TODO add addl PCT fields
-    
-    // --- building ---
-
-    public static PlatformComponentTemplateDto newInstance(DtoFactory dtoFactory, PlatformComponentTemplate x) {
-        return new PlatformComponentTemplateDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformDto.java
deleted file mode 100644
index 0daf3ac..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/PlatformDto.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.rest.resource.ApidocRestResource;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.Link;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-public class PlatformDto extends ResourceDto {
-
-    // defined as a constant so can be used in Swagger REST API annotations
-    public static final String CLASS_NAME = "io.brooklyn.camp.dto.PlatformDto";
-    static { assert CLASS_NAME.equals(PlatformDto.class.getCanonicalName()); }
-
-    protected PlatformDto() {}
-    protected PlatformDto(DtoFactory dtoFactory, PlatformRootSummary x) {
-        super(dtoFactory, x);
-        platformComponentTemplates = new ArrayList<LinkDto>();
-        for (Link<PlatformComponentTemplate> t: dtoFactory.getPlatform().platformComponentTemplates().links()) {
-            platformComponentTemplates.add(LinkDto.newInstance(dtoFactory, PlatformComponentTemplate.class, t));
-        }
-        
-        applicationComponentTemplates = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponentTemplate> t: dtoFactory.getPlatform().applicationComponentTemplates().links()) {
-            applicationComponentTemplates.add(LinkDto.newInstance(dtoFactory, ApplicationComponentTemplate.class, t));
-        }
-
-        assemblyTemplates = new ArrayList<LinkDto>();
-        for (Link<AssemblyTemplate> t: dtoFactory.getPlatform().assemblyTemplates().links()) {
-            assemblyTemplates.add(LinkDto.newInstance(dtoFactory, AssemblyTemplate.class, t));
-        }
-
-        platformComponents = new ArrayList<LinkDto>();
-        for (Link<PlatformComponent> t: dtoFactory.getPlatform().platformComponents().links()) {
-            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
-        }
-        
-        applicationComponents = new ArrayList<LinkDto>();
-        for (Link<ApplicationComponent> t: dtoFactory.getPlatform().applicationComponents().links()) {
-            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
-        }
-
-        assemblies = new ArrayList<LinkDto>();
-        for (Link<Assembly> t: dtoFactory.getPlatform().assemblies().links()) {
-            assemblies.add(LinkDto.newInstance(dtoFactory, Assembly.class, t));
-        }
-
-        // TODO set custom fields
-
-        apidoc = LinkDto.newInstance(
-                dtoFactory.getUriFactory().uriOfRestResource(ApidocRestResource.class),
-                "API documentation");
-    }
-
-    // TODO add custom fields
-    private List<LinkDto> assemblyTemplates;
-    private List<LinkDto> platformComponentTemplates;
-    private List<LinkDto> applicationComponentTemplates;
-    private List<LinkDto> assemblies;
-    private List<LinkDto> platformComponents;
-    private List<LinkDto> applicationComponents;
-    
-    // non-CAMP, but useful
-    private LinkDto apidoc;
-    
-    public List<LinkDto> getAssemblyTemplates() {
-        return assemblyTemplates;
-    }
-    
-    public List<LinkDto> getPlatformComponentTemplates() {
-        return platformComponentTemplates;
-    }
-    
-    public List<LinkDto> getApplicationComponentTemplates() {
-        return applicationComponentTemplates;
-    }
-    
-    public List<LinkDto> getAssemblies() {
-        return assemblies;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getPlatformComponents() {
-        return platformComponents;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<LinkDto> getApplicationComponents() {
-        return applicationComponents;
-    }
-    
-    public LinkDto getApidoc() {
-        return apidoc;
-    }
-    
-    // --- building ---
-
-    public static PlatformDto newInstance(DtoFactory dtoFactory, PlatformRootSummary x) {
-        return new PlatformDto(dtoFactory, x);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ResourceDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ResourceDto.java b/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ResourceDto.java
deleted file mode 100644
index 5383cf5..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/dto/ResourceDto.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.commontypes.RepresentationSkew;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.util.Date;
-import java.util.List;
-
-import brooklyn.util.time.Time;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.annotation.JsonSetter;
-import com.fasterxml.jackson.databind.util.ISO8601Utils;
-
-public class ResourceDto extends DtoCustomAttributes {
-
-    protected ResourceDto() {}
-    protected ResourceDto(DtoFactory dtoFactory, AbstractResource x) {
-        type = x.getType();
-        name = x.getName();
-
-        description = x.getDescription();
-        setCreated(x.getCreated());
-        tags = x.getTags();
-        representationSkew = x.getRepresentationSkew();
-        
-        if (x.getCustomAttributes()!=null && !x.getCustomAttributes().isEmpty())
-            newInstanceCustomAttributes(x.getCustomAttributes());
-        
-        uri = dtoFactory.uri(x);
-    }
-    
-    private String uri;
-    private String type;
-    
-    private String name;
-    private String description;
-    private Date created;
-    private List<String> tags;
-    private RepresentationSkew representationSkew;
-
-    public String getUri() {
-        return uri;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-    @JsonInclude(Include.NON_NULL)
-    public String getDescription() {
-        return description;
-    }
-    
-    @JsonGetter("created")
-    public String getCreatedAsString() {
-        return created==null ? null : ISO8601Utils.format(created);
-    }
-    
-    @JsonSetter
-    private void setCreated(Date created) {
-        this.created = Time.dropMilliseconds(created);
-    }
-
-    @JsonIgnore
-    public Date getCreated() {
-        return created;
-    }
-    
-    @JsonInclude(Include.NON_EMPTY)
-    public List<String> getTags() {
-        return tags;
-    }
-    
-    public String getType() {
-        return type;
-    }
-    
-    @JsonInclude(Include.NON_NULL)
-    public RepresentationSkew getRepresentationSkew() {
-        return representationSkew;
-    }
-
-    // --- building ---
-
-    public static ResourceDto newInstance(DtoFactory dtoFactory, AbstractResource x) {
-        return new ResourceDto(dtoFactory, x);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AbstractCampRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AbstractCampRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AbstractCampRestResource.java
deleted file mode 100644
index dcc5c14..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AbstractCampRestResource.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.rest.util.CampRestContext;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.rest.util.WebResourceUtils;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.core.Context;
-
-public abstract class AbstractCampRestResource {
-
-    // can be injected by jersey when not injected manually
-    // (seems there is no way to make this optional so note it _must_ be injected; if needed
-    // see notes on workarounds for test frameworks in original AbstractBrooklynRestResource)
-    @Context ServletContext servletContext;
-    
-    private CampRestContext campRestContext;
-    
-    public synchronized CampRestContext context() {
-        if (campRestContext!=null) return campRestContext;
-        campRestContext = new CampRestContext(servletContext);
-        return campRestContext;
-    }
-    
-    public CampPlatform camp() { return context().camp(); }
-    public DtoFactory dto() { return context().dto(); }
-
-    public static <T extends AbstractResource> T lookup(ResourceLookup<T> list, String id) {
-        T result = list.get(id);
-        if (result==null)
-            throw WebResourceUtils.notFound("No such element: %s", id);
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApidocRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApidocRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApidocRestResource.java
deleted file mode 100644
index 98d73c5..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApidocRestResource.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import javax.ws.rs.Path;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-@Path(ApidocRestResource.API_URI_PATH)
-@Apidoc("Web API Documentation")
-public class ApidocRestResource extends org.apache.brooklyn.rest.apidoc.ApidocResource {
-
-    public static final String API_URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/apidoc";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentRestResource.java
deleted file mode 100644
index e2f26e5..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentRestResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.ApplicationComponentDto;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(ApplicationComponentRestResource.URI_PATH)
-@Apidoc("Application Component resources")
-@Produces("application/json")
-public class ApplicationComponentRestResource extends AbstractCampRestResource {
-
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/application-components";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific application component",
-        responseClass = ApplicationComponentDto.CLASS_NAME)
-    @GET
-    public ApplicationComponentDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().applicationComponents(), id));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentTemplateRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentTemplateRestResource.java
deleted file mode 100644
index 992a579..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/ApplicationComponentTemplateRestResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.ApplicationComponentTemplateDto;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(ApplicationComponentTemplateRestResource.URI_PATH)
-@Apidoc("Application Component Template resources")
-@Produces("application/json")
-public class ApplicationComponentTemplateRestResource extends AbstractCampRestResource {
-
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/application-component-templates";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific application component template",
-        responseClass = ApplicationComponentTemplateDto.CLASS_NAME)
-    @GET
-    public ApplicationComponentTemplateDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().applicationComponentTemplates(), id));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyRestResource.java
deleted file mode 100644
index 721abea..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyRestResource.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.AssemblyDto;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(AssemblyRestResource.URI_PATH)
-@Apidoc("Assembly resources")
-@Produces("application/json")
-public class AssemblyRestResource extends AbstractCampRestResource {
-
-//    private static final Logger log = LoggerFactory.getLogger(AssemblyRestResource.class);
-    
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/assemblies";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific assembly",
-            responseClass = AssemblyDto.CLASS_NAME)
-    @GET
-    public AssemblyDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().assemblies(), id));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyTemplateRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyTemplateRestResource.java
deleted file mode 100644
index 104295c..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/AssemblyTemplateRestResource.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.AssemblyTemplateDto;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
-import java.net.URI;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-import brooklyn.util.exceptions.Exceptions;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(AssemblyTemplateRestResource.URI_PATH)
-@Apidoc("Assembly Template resources")
-@Produces("application/json")
-public class AssemblyTemplateRestResource extends AbstractCampRestResource {
-
-    private static final Logger log = LoggerFactory.getLogger(AssemblyTemplateRestResource.class);
-    
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/assembly-templates";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific assembly template",
-            responseClass = AssemblyTemplateDto.CLASS_NAME)
-    @GET
-    public AssemblyTemplateDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().assemblyTemplates(), id));
-    }
-
-    @Path("/{id}")
-    @ApiOperation(value = "Instantiate a specific assembly template"
-    // TODO AssemblyDto, or location thereto?
-//            , responseClass = AssemblyTemplateDto.CLASS_NAME
-            )
-    @POST
-    public Response post(
-            @Context UriInfo info,
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        try {
-            log.info("CAMP REST instantiating AT "+id);
-            AssemblyTemplate at = lookup(camp().assemblyTemplates(), id);
-            Assembly assembly = at.getInstantiator().newInstance().instantiate(at, camp());
-            // see http://stackoverflow.com/questions/13702481/javax-response-prepends-method-path-when-setting-location-header-path-on-status
-            // for why we have to return absolute path
-            URI assemblyUri = info.getBaseUriBuilder().path( dto().adapt(assembly).getUri() ).build();
-            return Response.created(assemblyUri).build();
-        } catch (Exception e) {
-            log.error("Unable to create AT "+id+": "+e);
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentRestResource.java
deleted file mode 100644
index a2718f6..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentRestResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.PlatformComponentDto;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(PlatformComponentRestResource.URI_PATH)
-@Apidoc("Platform Component resources")
-@Produces("application/json")
-public class PlatformComponentRestResource extends AbstractCampRestResource {
-
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/platform-components";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific platform component",
-            responseClass = PlatformComponentDto.CLASS_NAME)
-    @GET
-    public PlatformComponentDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().platformComponents(), id));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentTemplateRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentTemplateRestResource.java
deleted file mode 100644
index 9d2112d..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformComponentTemplateRestResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.PlatformComponentTemplateDto;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path(PlatformComponentTemplateRestResource.URI_PATH)
-@Apidoc("Platform Component Template resources")
-@Produces("application/json")
-public class PlatformComponentTemplateRestResource extends AbstractCampRestResource {
-
-    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/platform-component-templates";
-
-    @Path("/{id}")
-    @ApiOperation(value = "Get a specific platform component template",
-            responseClass = PlatformComponentTemplateDto.CLASS_NAME)
-    @GET
-    public PlatformComponentTemplateDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().platformComponentTemplates(), id));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformRestResource.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformRestResource.java
deleted file mode 100644
index edf4bc5..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/resource/PlatformRestResource.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.PlatformDto;
-import io.brooklyn.camp.rest.util.WebResourceUtils;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
-import java.io.InputStream;
-import java.io.StringReader;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.brooklyn.rest.apidoc.Apidoc;
-
-import com.wordnik.swagger.core.ApiOperation;
-
-//import io.brooklyn.camp.rest.apidoc.Apidoc;
-
-@Path(PlatformRestResource.CAMP_URI_PATH)
-@Apidoc("Platform (root)")
-@Produces("application/json")
-public class PlatformRestResource extends AbstractCampRestResource {
-
-    private static final Logger log = LoggerFactory.getLogger(PlatformRestResource.class);
-    
-    public static final String CAMP_URI_PATH = "/camp/v11";
-    
-    @ApiOperation(value = "Return the Platform (root) resource",
-            responseClass = PlatformDto.CLASS_NAME)
-    @GET
-    public PlatformDto get() {
-        return dto().adapt(camp().root());
-    }
-    
-    @POST
-    @Consumes({MediaType.APPLICATION_JSON})
-    public Response postJson(@Context UriInfo info, String json) {
-        return postYaml(info, json);
-    }
-
-    @POST
-    @Consumes({"application/x-yaml"})
-    public Response postYaml(@Context UriInfo info, String yaml) {
-        log.debug("YAML pdp:\n"+yaml);
-        AssemblyTemplate template = camp().pdp().registerDeploymentPlan(new StringReader(yaml));
-        return created(info, template);
-    }
-
-    @POST
-    @Consumes({"application/x-tar", "application/x-tgz", "application/x-zip"})
-    public Response postArchive(@Context UriInfo info, InputStream archiveInput) {
-        log.debug("ARCHIVE pdp");
-        AssemblyTemplate template = camp().pdp().registerPdpFromArchive(archiveInput);
-        return created(info, template);
-    }
-
-    protected Response created(UriInfo info, AssemblyTemplate template) {
-        return WebResourceUtils.created(info, dto().adapt(template).getUri());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampJsons.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampJsons.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampJsons.java
deleted file mode 100644
index 1cb39bd..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampJsons.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.util;
-
-import brooklyn.util.exceptions.Exceptions;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-public class CampJsons {
-
-    public static String prettyJson(Object o) {
-        try {
-            ObjectMapper mapper = new ObjectMapper();
-            mapper.enable(SerializationFeature.INDENT_OUTPUT);
-            return mapper.writeValueAsString(o);
-        } catch (JsonProcessingException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestContext.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestContext.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestContext.java
deleted file mode 100644
index 817a621..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestContext.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.util;
-
-import javax.servlet.ServletContext;
-
-import com.google.common.base.Preconditions;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.CampServer;
-
-public class CampRestContext {
-
-    private final ServletContext servletContext;
-    private CampPlatform platform;
-    private DtoFactory dto;
-    
-    public CampRestContext(ServletContext servletContext) {
-        this.servletContext = servletContext;
-    }
-
-    public synchronized CampPlatform camp() {
-        if (platform!=null) return platform;
-        platform = (CampPlatform) servletContext.getAttribute(CampServer.CAMP_PLATFORM_ATTRIBUTE);
-        return Preconditions.checkNotNull(platform, "CAMP platform instance not available from ServletContext");
-    }
-
-    public DtoFactory dto() {
-        if (dto!=null) return dto;
-        dto = (DtoFactory) servletContext.getAttribute(CampServer.DTO_FACTORY);
-        return Preconditions.checkNotNull(dto, "CAMP DTO factory instance not available from ServletContext");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestGuavas.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestGuavas.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestGuavas.java
deleted file mode 100644
index ac475d9..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/CampRestGuavas.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.util;
-
-import io.brooklyn.camp.spi.AbstractResource;
-
-import com.google.common.base.Function;
-
-public class CampRestGuavas {
-
-    public static final Function<AbstractResource,String> IDENTITY_OF_REST_RESOURCE = 
-            new Function<AbstractResource,String>() {
-                public String apply(AbstractResource input) { return input.getId(); }
-            };
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/DtoFactory.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/DtoFactory.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/DtoFactory.java
deleted file mode 100644
index ccb00b9..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/DtoFactory.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.util;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.dto.ApplicationComponentDto;
-import io.brooklyn.camp.dto.ApplicationComponentTemplateDto;
-import io.brooklyn.camp.dto.AssemblyDto;
-import io.brooklyn.camp.dto.AssemblyTemplateDto;
-import io.brooklyn.camp.dto.PlatformComponentDto;
-import io.brooklyn.camp.dto.PlatformComponentTemplateDto;
-import io.brooklyn.camp.dto.PlatformDto;
-import io.brooklyn.camp.rest.resource.AbstractCampRestResource;
-import io.brooklyn.camp.rest.resource.ApplicationComponentRestResource;
-import io.brooklyn.camp.rest.resource.ApplicationComponentTemplateRestResource;
-import io.brooklyn.camp.rest.resource.AssemblyRestResource;
-import io.brooklyn.camp.rest.resource.AssemblyTemplateRestResource;
-import io.brooklyn.camp.rest.resource.PlatformComponentRestResource;
-import io.brooklyn.camp.rest.resource.PlatformComponentTemplateRestResource;
-import io.brooklyn.camp.rest.resource.PlatformRestResource;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
-import java.util.Map;
-
-import javax.ws.rs.Path;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.net.Urls;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-
-public class DtoFactory {
-
-    private CampPlatform platform;
-    private String uriBase;
-    
-    private UriFactory uriFactory;
-
-    public DtoFactory(CampPlatform campPlatform, String uriBase) {
-        this.platform = campPlatform;
-        this.uriBase = uriBase;
-        
-        uriFactory = new UriFactory();
-        uriFactory.registerIdentifiableRestResource(PlatformRootSummary.class, PlatformRestResource.class);
-        uriFactory.registerIdentifiableRestResource(AssemblyTemplate.class, AssemblyTemplateRestResource.class);
-        uriFactory.registerIdentifiableRestResource(PlatformComponentTemplate.class, PlatformComponentTemplateRestResource.class);
-        uriFactory.registerIdentifiableRestResource(ApplicationComponentTemplate.class, ApplicationComponentTemplateRestResource.class);
-        uriFactory.registerIdentifiableRestResource(Assembly.class, AssemblyRestResource.class);
-        uriFactory.registerIdentifiableRestResource(PlatformComponent.class, PlatformComponentRestResource.class);
-        uriFactory.registerIdentifiableRestResource(ApplicationComponent.class, ApplicationComponentRestResource.class);
-    }
-
-    public CampPlatform getPlatform() {
-        return platform;
-    }
-
-    public UriFactory getUriFactory() {
-        return uriFactory;
-    }
-
-    public String uri(AbstractResource x) {
-        return getUriFactory().uri(x);
-    }
-        
-    public String uri(Class<? extends AbstractResource> targetType, String id) {
-        return getUriFactory().uri(targetType, id);
-    }
-
-    public AssemblyTemplateDto adapt(AssemblyTemplate assemblyTemplate) {
-        return AssemblyTemplateDto.newInstance(this, assemblyTemplate);
-    }
-    public PlatformComponentTemplateDto adapt(PlatformComponentTemplate platformComponentTemplate) {
-        return PlatformComponentTemplateDto.newInstance(this, platformComponentTemplate);
-    }
-    public ApplicationComponentTemplateDto adapt(ApplicationComponentTemplate applicationComponentTemplate) {
-        return ApplicationComponentTemplateDto.newInstance(this, applicationComponentTemplate);
-    }
-
-    public AssemblyDto adapt(Assembly assembly) {
-        return AssemblyDto.newInstance(this, assembly);
-    }
-    public PlatformComponentDto adapt(PlatformComponent platformComponent) {
-        return PlatformComponentDto.newInstance(this, platformComponent);
-    }
-    public ApplicationComponentDto adapt(ApplicationComponent applicationComponent) {
-        return ApplicationComponentDto.newInstance(this, applicationComponent);
-    }
-
-    public PlatformDto adapt(PlatformRootSummary root) {
-        return PlatformDto.newInstance(this, root);
-    }
-
-    public class UriFactory {
-        /** registry of generating a URI given an object */
-        Map<Class<?>,Function<Object,String>> registryResource = new MutableMap<Class<?>, Function<Object,String>>();
-        /** registry of generating a URI given an ID */
-        Map<Class<?>,Function<String,String>> registryId = new MutableMap<Class<?>, Function<String,String>>();
-
-        /** registers a function which generates a URI given a type; note that this method cannot be used for links */
-        @SuppressWarnings("unchecked")
-        public synchronized <T> void registerResourceUriFunction(Class<T> type, Function<T,String> fnUri) {
-            registryResource.put(type, (Function<Object, String>) fnUri);
-        }
-
-        /** registers a type to generate a URI which concatenates the given base with the
-         * result of the given function to generate an ID against an object of the given type */
-        public synchronized <T> void registerIdentityFunction(Class<T> type, final String resourceTypeUriBase, final Function<T,String> fnIdentity) {
-            final Function<String,String> fnUriFromId = new Function<String,String>() {
-                public String apply(String id) {
-                    return Urls.mergePaths(resourceTypeUriBase, id);
-                }
-            };
-            registryId.put(type, (Function<String, String>) fnUriFromId);
-            registerResourceUriFunction(type, new Function<T,String>() {
-                public String apply(T input) {
-                    return fnUriFromId.apply(fnIdentity.apply(input));
-                }
-            });
-        }
-
-        /** registers a CAMP Resource type against a RestResource, generating the URI
-         * by concatenating the @Path annotation on the RestResource with the ID of the CAMP resource */
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        public synchronized <T extends AbstractResource> void registerIdentifiableRestResource(Class<T> type, Class<? extends AbstractCampRestResource> restResource) {
-            registerIdentityFunction(type, 
-                    uriOfRestResource(restResource),
-                    (Function) CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
-        }
-        
-        public String uri(Class<? extends AbstractResource> targetType, String id) {
-            return Preconditions.checkNotNull(registryId.get(targetType), 
-                    "No REST ID converter registered for %s (id %s)", targetType, id)
-                    .apply(id);
-        }
-
-        public String uri(AbstractResource x) {
-            return Preconditions.checkNotNull(registryResource.get(x.getClass()), 
-                    "No REST converter registered for %s (%s)", x.getClass(), x)
-                    .apply(x);
-        }
-        
-        public String uriOfRestResource(Class<?> restResourceClass) {
-            return Urls.mergePaths(uriBase, 
-                    Preconditions.checkNotNull(restResourceClass.getAnnotation(Path.class),
-                            "No @Path on type %s", restResourceClass)
-                    .value());
-        }
-            
-
-    }
-
-}



[8/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
BROOKLYN-162 convert camp-base and camp-server to org.apache prefix


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

Branch: refs/heads/master
Commit: 7d782f34ae8fed8c3753f3f637265374af063abb
Parents: f092e18
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Aug 18 12:40:46 2015 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Aug 18 12:40:46 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/camp/AggregatingCampPlatform.java  | 131 ---------
 .../io/brooklyn/camp/BasicCampPlatform.java     | 143 ----------
 .../java/io/brooklyn/camp/CampPlatform.java     |  76 ------
 .../camp/commontypes/RepresentationSkew.java    |  23 --
 .../io/brooklyn/camp/spi/AbstractResource.java  | 197 --------------
 .../brooklyn/camp/spi/ApplicationComponent.java |  93 -------
 .../camp/spi/ApplicationComponentTemplate.java  |  54 ----
 .../java/io/brooklyn/camp/spi/Assembly.java     | 109 --------
 .../io/brooklyn/camp/spi/AssemblyTemplate.java  | 118 ---------
 .../main/java/io/brooklyn/camp/spi/Link.java    |  40 ---
 .../io/brooklyn/camp/spi/PlatformComponent.java | 101 -------
 .../camp/spi/PlatformComponentTemplate.java     |  52 ----
 .../brooklyn/camp/spi/PlatformRootSummary.java  |  70 -----
 .../brooklyn/camp/spi/PlatformTransaction.java  |  46 ----
 .../spi/collection/AbstractResourceLookup.java  |  35 ---
 .../collection/AggregatingResourceLookup.java   |  56 ----
 .../spi/collection/BasicResourceLookup.java     |  71 -----
 .../camp/spi/collection/ResolvableLink.java     |  37 ---
 .../camp/spi/collection/ResourceLookup.java     |  47 ----
 .../AssemblyTemplateInstantiator.java           |  30 ---
 .../BasicAssemblyTemplateInstantiator.java      |  36 ---
 .../java/io/brooklyn/camp/spi/pdp/Artifact.java |  99 -------
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |  65 -----
 .../camp/spi/pdp/ArtifactRequirement.java       |  72 -----
 .../spi/pdp/AssemblyTemplateConstructor.java    | 100 -------
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   | 150 -----------
 .../java/io/brooklyn/camp/spi/pdp/Service.java  |  94 -------
 .../camp/spi/pdp/ServiceCharacteristic.java     |  72 -----
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |  51 ----
 .../brooklyn/camp/spi/resolve/PdpProcessor.java | 188 -------------
 .../camp/spi/resolve/PlanInterpreter.java       | 113 --------
 .../interpret/PlanInterpretationContext.java    | 152 -----------
 .../interpret/PlanInterpretationNode.java       | 263 -------------------
 .../main/java/io/brooklyn/util/yaml/Yamls.java  |  24 --
 .../brooklyn/camp/AggregatingCampPlatform.java  | 130 +++++++++
 .../apache/brooklyn/camp/BasicCampPlatform.java | 142 ++++++++++
 .../org/apache/brooklyn/camp/CampPlatform.java  |  76 ++++++
 .../camp/commontypes/RepresentationSkew.java    |  23 ++
 .../brooklyn/camp/spi/AbstractResource.java     | 197 ++++++++++++++
 .../brooklyn/camp/spi/ApplicationComponent.java |  93 +++++++
 .../camp/spi/ApplicationComponentTemplate.java  |  54 ++++
 .../org/apache/brooklyn/camp/spi/Assembly.java  | 109 ++++++++
 .../brooklyn/camp/spi/AssemblyTemplate.java     | 118 +++++++++
 .../java/org/apache/brooklyn/camp/spi/Link.java |  40 +++
 .../brooklyn/camp/spi/PlatformComponent.java    | 101 +++++++
 .../camp/spi/PlatformComponentTemplate.java     |  52 ++++
 .../brooklyn/camp/spi/PlatformRootSummary.java  |  70 +++++
 .../brooklyn/camp/spi/PlatformTransaction.java  |  46 ++++
 .../spi/collection/AbstractResourceLookup.java  |  35 +++
 .../collection/AggregatingResourceLookup.java   |  56 ++++
 .../spi/collection/BasicResourceLookup.java     |  71 +++++
 .../camp/spi/collection/ResolvableLink.java     |  37 +++
 .../camp/spi/collection/ResourceLookup.java     |  47 ++++
 .../AssemblyTemplateInstantiator.java           |  30 +++
 .../BasicAssemblyTemplateInstantiator.java      |  36 +++
 .../apache/brooklyn/camp/spi/pdp/Artifact.java  |  99 +++++++
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |  65 +++++
 .../camp/spi/pdp/ArtifactRequirement.java       |  72 +++++
 .../spi/pdp/AssemblyTemplateConstructor.java    | 100 +++++++
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   | 150 +++++++++++
 .../apache/brooklyn/camp/spi/pdp/Service.java   |  94 +++++++
 .../camp/spi/pdp/ServiceCharacteristic.java     |  72 +++++
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |  51 ++++
 .../brooklyn/camp/spi/resolve/PdpProcessor.java | 187 +++++++++++++
 .../camp/spi/resolve/PlanInterpreter.java       | 113 ++++++++
 .../interpret/PlanInterpretationContext.java    | 152 +++++++++++
 .../interpret/PlanInterpretationNode.java       | 262 ++++++++++++++++++
 .../apache/brooklyn/camp/util/yaml/Yamls.java   |  24 ++
 .../pdp/DeploymentPlanToyInterpreterTest.java   | 114 --------
 .../io/brooklyn/camp/spi/pdp/PdpYamlTest.java   |  78 ------
 .../web/MockAssemblyTemplateInstantiator.java   |  38 ---
 .../camp/test/mock/web/MockWebPlatform.java     | 131 ---------
 .../test/platform/BasicCampPlatformTest.java    |  87 ------
 .../pdp/DeploymentPlanToyInterpreterTest.java   | 113 ++++++++
 .../brooklyn/camp/spi/pdp/PdpYamlTest.java      |  80 ++++++
 .../web/MockAssemblyTemplateInstantiator.java   |  37 +++
 .../camp/test/mock/web/MockWebPlatform.java     | 132 ++++++++++
 .../test/platform/BasicCampPlatformTest.java    |  86 ++++++
 .../camp/spi/pdp/pdp-single-artifact.yaml       |  27 --
 .../camp/spi/pdp/pdp-single-service.yaml        |  29 --
 .../pdp/yaml-sample-toy-interpreter-result.yaml |  22 --
 .../spi/pdp/yaml-sample-toy-interpreter.yaml    |  28 --
 .../camp/spi/pdp/pdp-single-artifact.yaml       |  27 ++
 .../camp/spi/pdp/pdp-single-service.yaml        |  29 ++
 .../pdp/yaml-sample-toy-interpreter-result.yaml |  22 ++
 .../spi/pdp/yaml-sample-toy-interpreter.yaml    |  28 ++
 .../io/brooklyn/camp/CampRestResources.java     |  70 -----
 .../main/java/io/brooklyn/camp/CampServer.java  | 185 -------------
 .../java/io/brooklyn/camp/dto/ApiErrorDto.java  | 119 ---------
 .../camp/dto/ApplicationComponentDto.java       |  72 -----
 .../dto/ApplicationComponentTemplateDto.java    |  44 ----
 .../java/io/brooklyn/camp/dto/AssemblyDto.java  |  77 ------
 .../brooklyn/camp/dto/AssemblyTemplateDto.java  |  72 -----
 .../main/java/io/brooklyn/camp/dto/DtoBase.java |  31 ---
 .../brooklyn/camp/dto/DtoCustomAttributes.java  |  66 -----
 .../main/java/io/brooklyn/camp/dto/LinkDto.java |  72 -----
 .../brooklyn/camp/dto/PlatformComponentDto.java |  82 ------
 .../camp/dto/PlatformComponentTemplateDto.java  |  44 ----
 .../java/io/brooklyn/camp/dto/PlatformDto.java  | 131 ---------
 .../java/io/brooklyn/camp/dto/ResourceDto.java  | 112 --------
 .../rest/resource/AbstractCampRestResource.java |  56 ----
 .../camp/rest/resource/ApidocRestResource.java  |  31 ---
 .../ApplicationComponentRestResource.java       |  50 ----
 ...pplicationComponentTemplateRestResource.java |  50 ----
 .../rest/resource/AssemblyRestResource.java     |  52 ----
 .../resource/AssemblyTemplateRestResource.java  |  88 -------
 .../resource/PlatformComponentRestResource.java |  50 ----
 .../PlatformComponentTemplateRestResource.java  |  50 ----
 .../rest/resource/PlatformRestResource.java     |  89 -------
 .../io/brooklyn/camp/rest/util/CampJsons.java   |  39 ---
 .../camp/rest/util/CampRestContext.java         |  50 ----
 .../brooklyn/camp/rest/util/CampRestGuavas.java |  32 ---
 .../io/brooklyn/camp/rest/util/DtoFactory.java  | 176 -------------
 .../camp/rest/util/WebResourceUtils.java        |  60 -----
 .../brooklyn/camp/server/dto/ApiErrorDto.java   | 119 +++++++++
 .../server/dto/ApplicationComponentDto.java     |  72 +++++
 .../dto/ApplicationComponentTemplateDto.java    |  44 ++++
 .../brooklyn/camp/server/dto/AssemblyDto.java   |  77 ++++++
 .../camp/server/dto/AssemblyTemplateDto.java    |  72 +++++
 .../brooklyn/camp/server/dto/DtoBase.java       |  31 +++
 .../camp/server/dto/DtoCustomAttributes.java    |  66 +++++
 .../brooklyn/camp/server/dto/LinkDto.java       |  72 +++++
 .../camp/server/dto/PlatformComponentDto.java   |  82 ++++++
 .../dto/PlatformComponentTemplateDto.java       |  44 ++++
 .../brooklyn/camp/server/dto/PlatformDto.java   | 131 +++++++++
 .../brooklyn/camp/server/dto/ResourceDto.java   | 112 ++++++++
 .../camp/server/rest/CampRestResources.java     |  69 +++++
 .../brooklyn/camp/server/rest/CampServer.java   | 185 +++++++++++++
 .../rest/resource/AbstractCampRestResource.java |  56 ++++
 .../rest/resource/ApidocRestResource.java       |  31 +++
 .../ApplicationComponentRestResource.java       |  49 ++++
 ...pplicationComponentTemplateRestResource.java |  49 ++++
 .../rest/resource/AssemblyRestResource.java     |  51 ++++
 .../resource/AssemblyTemplateRestResource.java  |  87 ++++++
 .../resource/PlatformComponentRestResource.java |  49 ++++
 .../PlatformComponentTemplateRestResource.java  |  49 ++++
 .../rest/resource/PlatformRestResource.java     |  87 ++++++
 .../camp/server/rest/util/CampJsons.java        |  39 +++
 .../camp/server/rest/util/CampRestContext.java  |  50 ++++
 .../camp/server/rest/util/CampRestGuavas.java   |  32 +++
 .../camp/server/rest/util/DtoFactory.java       | 176 +++++++++++++
 .../camp/server/rest/util/WebResourceUtils.java |  59 +++++
 .../ApplicationCompomentTemplateDtoTest.java    |  49 ----
 .../java/io/brooklyn/camp/dto/BasicDtoTest.java |  90 -------
 .../java/io/brooklyn/camp/dto/LinkDtoTest.java  |  62 -----
 .../dto/PlatformCompomentTemplateDtoTest.java   |  49 ----
 .../io/brooklyn/camp/dto/ResourceDtoTest.java   |  77 ------
 .../rest/resource/PlatformRestResourceTest.java |  42 ---
 .../test/fixture/AbstractRestResourceTest.java  |  86 ------
 .../camp/test/fixture/InMemoryCamp.java         |  53 ----
 .../ApplicationCompomentTemplateDtoTest.java    |  49 ++++
 .../brooklyn/camp/server/dto/BasicDtoTest.java  |  91 +++++++
 .../brooklyn/camp/server/dto/LinkDtoTest.java   |  63 +++++
 .../dto/PlatformCompomentTemplateDtoTest.java   |  49 ++++
 .../camp/server/dto/ResourceDtoTest.java        |  77 ++++++
 .../rest/resource/PlatformRestResourceTest.java |  43 +++
 .../test/fixture/AbstractRestResourceTest.java  |  85 ++++++
 .../camp/server/test/fixture/InMemoryCamp.java  |  52 ++++
 .../api/AssemblyTemplateSpecInstantiator.java   |   7 +-
 .../brooklyn/config/BrooklynServerConfig.java   |   2 +-
 .../catalog/internal/BasicBrooklynCatalog.java  |  10 +-
 .../internal/EntityManagementUtils.java         |   9 +-
 .../lite/CampPlatformWithJustBrooklynMgmt.java  |   2 +-
 .../brooklyn/camp/lite/CampYamlLiteTest.java    |   9 +-
 .../brooklyn/camp/lite/TestAppAssembly.java     |   3 +-
 .../camp/lite/TestAppAssemblyInstantiator.java  |  15 +-
 .../entity/rebind/RebindCatalogItemTest.java    |   4 +-
 .../camp/brooklyn/BrooklynCampConstants.java    |   4 +-
 .../camp/brooklyn/BrooklynCampPlatform.java     |   7 +-
 .../BrooklynCampPlatformLauncherAbstract.java   |   3 +-
 .../camp/brooklyn/YamlLauncherAbstract.java     |   5 +-
 .../BrooklynAssemblyTemplateInstantiator.java   |  15 +-
 .../BrooklynComponentTemplateResolver.java      |   9 +-
 .../spi/creation/BrooklynEntityMatcher.java     |  11 +-
 .../service/BrooklynServiceTypeResolver.java    |   3 +-
 .../service/CatalogServiceTypeResolver.java     |   3 +-
 .../service/ChefServiceTypeResolver.java        |   3 +-
 .../service/JavaServiceTypeResolver.java        |   3 +-
 .../spi/dsl/BrooklynDslDeferredSupplier.java    |   7 +-
 .../spi/dsl/BrooklynDslInterpreter.java         |   9 +-
 .../lookup/AbstractBrooklynResourceLookup.java  |   7 +-
 .../lookup/AbstractTemplateBrooklynLookup.java  |   7 +-
 .../spi/lookup/AssemblyBrooklynLookup.java      |   7 +-
 .../lookup/AssemblyTemplateBrooklynLookup.java  |   7 +-
 .../lookup/PlatformComponentBrooklynLookup.java |   9 +-
 ...PlatformComponentTemplateBrooklynLookup.java |   7 +-
 .../platform/BrooklynImmutableCampPlatform.java |  25 +-
 .../camp/brooklyn/AbstractYamlRebindTest.java   |   5 +-
 .../camp/brooklyn/AbstractYamlTest.java         |   5 +-
 ...aWebAppWithDslYamlRebindIntegrationTest.java |   5 +-
 .../brooklyn/JavaWebAppsIntegrationTest.java    |  14 +-
 .../camp/brooklyn/JavaWebAppsMatchingTest.java  |  11 +-
 .../brooklyn/ReloadBrooklynPropertiesTest.java  |   7 +-
 .../brooklyn/launcher/BrooklynLauncher.java     |   6 +-
 .../camp/BrooklynCampPlatformLauncher.java      |   4 +-
 .../resources/AbstractBrooklynRestResource.java |   3 +-
 .../rest/resources/ApplicationResource.java     |   3 +-
 197 files changed, 6230 insertions(+), 6272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/AggregatingCampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/AggregatingCampPlatform.java b/camp/camp-base/src/main/java/io/brooklyn/camp/AggregatingCampPlatform.java
deleted file mode 100644
index 4e000c5..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/AggregatingCampPlatform.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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 io.brooklyn.camp;
-
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.PlatformTransaction;
-import io.brooklyn.camp.spi.collection.AggregatingResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-
-/** A {@link CampPlatform} implementation which is empty but allows adding new items,
- * as well as adding other platforms; meant for subclassing only */
-public class AggregatingCampPlatform extends CampPlatform {
-
-    private static final Logger log = LoggerFactory.getLogger(AggregatingCampPlatform.class);
-    
-    protected AggregatingCampPlatform(PlatformRootSummary root) {
-        this(root, new BasicCampPlatform(root));
-    }
-    
-    public AggregatingCampPlatform(PlatformRootSummary root, CampPlatform platformWhereTransactionsOccur) {
-        super(root);
-        log.debug("Creating {} with main platform: {}", this, platformWhereTransactionsOccur);
-        this.mainPlatform = platformWhereTransactionsOccur;
-    }
-    
-    /** platform where additions are made */
-    CampPlatform mainPlatform;
-    List<CampPlatform> otherPlatformsToSearch = new ArrayList<CampPlatform>();
-    
-    protected void addPlatform(CampPlatform platform) {
-        log.debug("Adding child platform to {}: {}", this, platform);
-        otherPlatformsToSearch.add(platform);
-    }
-    
-    protected <T extends AbstractResource> ResourceLookup<T> aggregatingLookup(Function<CampPlatform, ResourceLookup<T>> lookupFunction) {
-        List<ResourceLookup<T>> lookups = new ArrayList<ResourceLookup<T>>();
-        lookups.add(lookupFunction.apply(mainPlatform));
-        for (CampPlatform p: otherPlatformsToSearch)
-            lookups.add(lookupFunction.apply(p));
-        return AggregatingResourceLookup.of(lookups);
-    }
-    
-    public ResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<PlatformComponentTemplate>>() {
-            public ResourceLookup<PlatformComponentTemplate> apply(@Nullable CampPlatform input) {
-                return input.platformComponentTemplates();
-            }
-        });
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<ApplicationComponentTemplate>>() {
-            public ResourceLookup<ApplicationComponentTemplate> apply(@Nullable CampPlatform input) {
-                return input.applicationComponentTemplates();
-            }
-        });
-    }
-
-    public ResourceLookup<AssemblyTemplate> assemblyTemplates() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<AssemblyTemplate>>() {
-            public ResourceLookup<AssemblyTemplate> apply(@Nullable CampPlatform input) {
-                return input.assemblyTemplates();
-            }
-        });
-    }
-    
-    public ResourceLookup<PlatformComponent> platformComponents() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<PlatformComponent>>() {
-            public ResourceLookup<PlatformComponent> apply(@Nullable CampPlatform input) {
-                return input.platformComponents();
-            }
-        });
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponent> applicationComponents() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<ApplicationComponent>>() {
-            public ResourceLookup<ApplicationComponent> apply(@Nullable CampPlatform input) {
-                return input.applicationComponents();
-            }
-        });
-    }
-
-    public ResourceLookup<Assembly> assemblies() {
-        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<Assembly>>() {
-            public ResourceLookup<Assembly> apply(@Nullable CampPlatform input) {
-                return input.assemblies();
-            }
-        });
-    }
-    
-    @Override
-    public PlatformTransaction transaction() {
-        return mainPlatform.transaction();
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/BasicCampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/BasicCampPlatform.java b/camp/camp-base/src/main/java/io/brooklyn/camp/BasicCampPlatform.java
deleted file mode 100644
index 16a3dee..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/BasicCampPlatform.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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 io.brooklyn.camp;
-
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.PlatformTransaction;
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** A {@link CampPlatform} implementation which is empty but allows adding new items */
-public class BasicCampPlatform extends CampPlatform {
-
-    private static final Logger log = LoggerFactory.getLogger(BasicCampPlatform.class);
-    
-    public BasicCampPlatform() {
-        this(PlatformRootSummary.builder().name("CAMP Platform").build());
-    }
-    
-    public BasicCampPlatform(PlatformRootSummary root) {
-        super(root);
-    }
-
-    BasicResourceLookup<PlatformComponentTemplate> platformComponentTemplates = new BasicResourceLookup<PlatformComponentTemplate>();
-    BasicResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates = new BasicResourceLookup<ApplicationComponentTemplate>();
-    BasicResourceLookup<AssemblyTemplate> assemblyTemplates = new BasicResourceLookup<AssemblyTemplate>();
-
-    BasicResourceLookup<PlatformComponent> platformComponents = new BasicResourceLookup<PlatformComponent>();
-    BasicResourceLookup<ApplicationComponent> applicationComponents = new BasicResourceLookup<ApplicationComponent>();
-    BasicResourceLookup<Assembly> assemblies = new BasicResourceLookup<Assembly>();
-
-    public BasicResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
-        return platformComponentTemplates;
-    }
-
-    @Override
-    public BasicResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
-        return applicationComponentTemplates;
-    }
-
-    public BasicResourceLookup<AssemblyTemplate> assemblyTemplates() {
-        return assemblyTemplates;
-    }
-    
-    public BasicResourceLookup<PlatformComponent> platformComponents() {
-        return platformComponents;
-    }
-
-    @Override
-    public BasicResourceLookup<ApplicationComponent> applicationComponents() {
-        return applicationComponents;
-    }
-
-    public BasicResourceLookup<Assembly> assemblies() {
-        return assemblies;
-    }
-    
-    @Override
-    public PlatformTransaction transaction() {
-        return new BasicPlatformTransaction(this);
-    }
-    
-    public static class BasicPlatformTransaction extends PlatformTransaction {
-        private final BasicCampPlatform platform;
-        private final AtomicBoolean committed = new AtomicBoolean(false);
-        
-        public BasicPlatformTransaction(BasicCampPlatform platform) {
-            this.platform = platform;
-        }
-        
-        @Override
-        public void commit() {
-            if (committed.getAndSet(true)) 
-                throw new IllegalStateException("transaction being committed multiple times");
-            
-            for (Object o: additions) {
-                if (o instanceof AssemblyTemplate) {
-                    platform.assemblyTemplates.add((AssemblyTemplate) o);
-                    continue;
-                }
-                if (o instanceof PlatformComponentTemplate) {
-                    platform.platformComponentTemplates.add((PlatformComponentTemplate) o);
-                    continue;
-                }
-                if (o instanceof ApplicationComponentTemplate) {
-                    platform.applicationComponentTemplates.add((ApplicationComponentTemplate) o);
-                    continue;
-                }
-                
-                if (o instanceof Assembly) {
-                    platform.assemblies.add((Assembly) o);
-                    continue;
-                }
-                if (o instanceof PlatformComponent) {
-                    platform.platformComponents.add((PlatformComponent) o);
-                    continue;
-                }
-                if (o instanceof ApplicationComponent) {
-                    platform.applicationComponents.add((ApplicationComponent) o);
-                    continue;
-                }
-
-                throw new UnsupportedOperationException("Object "+o+" of type "+o.getClass()+" cannot be added to "+platform);
-            }
-        }
-        
-        @Override
-        protected void finalize() throws Throwable {
-            if (!committed.get()) {
-                // normal, in the case of errors (which might occur when catalog tries to figure out the right plan format); shouldn't happen otherwise
-                // if we want log.warn visibility of these, then we will have to supply an abandon() method on this interface and ensure that is invoked on errors
-                log.debug("transaction "+this+" was never applied");
-            }
-            super.finalize();
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/CampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/CampPlatform.java b/camp/camp-base/src/main/java/io/brooklyn/camp/CampPlatform.java
deleted file mode 100644
index fc263cb..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/CampPlatform.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 io.brooklyn.camp;
-
-import io.brooklyn.camp.spi.ApplicationComponent;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponent;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-import io.brooklyn.camp.spi.PlatformTransaction;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.resolve.PdpProcessor;
-
-import com.google.common.base.Preconditions;
-
-public abstract class CampPlatform {
-
-    private final PlatformRootSummary root;
-    private final PdpProcessor pdp;
-
-    public CampPlatform(PlatformRootSummary root) {
-        this.root = Preconditions.checkNotNull(root, "root");
-        pdp = createPdpProcessor();
-    }
-
-    // --- root
-    
-    public PlatformRootSummary root() {
-        return root;
-    }
-
-    // --- other aspects
-    
-    public PdpProcessor pdp() {
-        return pdp;
-    }
-
-    
-    // --- required custom implementation hooks
-    
-    public abstract ResourceLookup<PlatformComponentTemplate> platformComponentTemplates();
-    public abstract ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates();
-    public abstract ResourceLookup<AssemblyTemplate> assemblyTemplates();
-
-    public abstract ResourceLookup<PlatformComponent> platformComponents();
-    public abstract ResourceLookup<ApplicationComponent> applicationComponents();
-    public abstract ResourceLookup<Assembly> assemblies();
-
-    /** returns object where changes to a PDP can be made; note all changes must be committed */
-    public abstract PlatformTransaction transaction();
-
-    // --- optional customisation overrides
-    
-    protected PdpProcessor createPdpProcessor() {
-        return new PdpProcessor(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/commontypes/RepresentationSkew.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/commontypes/RepresentationSkew.java b/camp/camp-base/src/main/java/io/brooklyn/camp/commontypes/RepresentationSkew.java
deleted file mode 100644
index 1f9644f..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/commontypes/RepresentationSkew.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 io.brooklyn.camp.commontypes;
-
-public enum RepresentationSkew {
-    CREATING, NONE, DESTROYING, UNKNOWN
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AbstractResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AbstractResource.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AbstractResource.java
deleted file mode 100644
index 5f04e20..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AbstractResource.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import io.brooklyn.camp.commontypes.RepresentationSkew;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.text.Identifiers;
-import brooklyn.util.time.Time;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-/** Superclass of CAMP resource implementation objects.
- * Typically used to hold common state of implementation objects
- * and to populate the DTO's used by the REST API.
- * <p>
- * These class instances are typically created using the 
- * static {@link #builder()} methods they contain. 
- * The resulting instances are typically immutable,
- * so where fields can change callers should use a new builder
- * (or update an underlying data store).
- * <p>
- * This class is not meant to be instantiated directly, as
- * CAMP only uses defined subclasses (ie containing these fields).
- * It is instantiable for testing.
- */
-public class AbstractResource {
-
-    public static final String CAMP_TYPE = "Resource";
-    
-    private String id = Identifiers.makeRandomId(8);
-    private String name;
-    private String type;
-    private String description;
-    private String sourceCode;
-    private Date created = Time.dropMilliseconds(new Date());
-    private List<String> tags = Collections.emptyList();
-    private RepresentationSkew representationSkew;
-    
-    private Map<String,Object> customAttributes = new MutableMap<String, Object>();
-    
-    /** Use {@link #builder()} to create */
-    protected AbstractResource() {}
-    
-    // getters
-
-    public String getId() {
-        return id;
-    }
-    public String getName() {
-        return name;
-    }
-    public String getType() {
-        return type;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public String getSourceCode() {
-        return sourceCode;
-    }
-    public Date getCreated() {
-        return created;
-    }
-    public List<String> getTags() {
-        return tags;
-    }
-    public RepresentationSkew getRepresentationSkew() {
-        return representationSkew;
-    }
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-    
-    // setters
-
-    private void setId(String id) {
-        this.id = id;
-    }
-    private void setName(String name) {
-        this.name = name;
-    }
-    private void setDescription(String description) {
-        this.description = description;
-    }
-    private void setSourceCode(String sourceCode) {
-        this.sourceCode = sourceCode;
-    }
-    private void setCreated(Date created) {
-        // precision beyond seconds breaks equals check
-        this.created = Time.dropMilliseconds(created);
-    }
-    private void setTags(List<String> tags) {
-        this.tags = ImmutableList.copyOf(tags);
-    }
-    private void setType(String type) {
-        this.type = type;
-    }
-    private void setRepresentationSkew(RepresentationSkew representationSkew) {
-        this.representationSkew = representationSkew;
-    }
-    public void setCustomAttribute(String key, Object value) {
-        this.customAttributes.put(key, value);
-    }
-            
-    // builder
-    @SuppressWarnings("rawtypes")
-    public static Builder<? extends AbstractResource,? extends Builder> builder() {
-        return new AbstractResource().new AbstractResourceBuilder(CAMP_TYPE);
-    }
-    
-    /** Builder creates the instance up front to avoid repetition of fields in the builder;
-     * but prevents object leakage until build and prevents changes after build,
-     * so effectively immutable.
-     * <p>
-     * Similarly setters in the class are private so those objects are also typically effectively immutable. */
-    public abstract class Builder<T extends AbstractResource,U extends Builder<T,U>> {
-        
-        private boolean built = false;
-        private String type = null;
-        private boolean initialized = false;
-        
-        protected Builder(String type) {
-            this.type = type;
-        }
-        
-        protected final synchronized void check() {
-            if (built) 
-                throw new IllegalStateException("Builder instance from "+this+" cannot be access after build");
-            if (!initialized) {
-                initialized = true;
-                initialize();
-            }
-        }
-
-        protected void initialize() {
-            if (type!=null) type(type);
-        }
-
-        @SuppressWarnings("unchecked")
-        public synchronized T build() {
-            check();
-            built = true;
-            return (T) AbstractResource.this;
-        }
-        
-        @SuppressWarnings("unchecked")
-        protected U thisBuilder() { return (U)this; }
-        
-        public U type(String x) { check(); AbstractResource.this.setType(x); return thisBuilder(); }
-        public U id(String x) { check(); AbstractResource.this.setId(x); return thisBuilder(); }
-        public U name(String x) { check(); AbstractResource.this.setName(x); return thisBuilder(); }
-        public U description(String x) { check(); AbstractResource.this.setDescription(x); return thisBuilder(); }
-        public U created(Date x) { check(); AbstractResource.this.setCreated(x); return thisBuilder(); }
-        public U tags(List<String> x) { check(); AbstractResource.this.setTags(x); return thisBuilder(); }
-        public U representationSkew(RepresentationSkew x) { check(); AbstractResource.this.setRepresentationSkew(x); return thisBuilder(); }
-        public U customAttribute(String key, Object value) { check(); AbstractResource.this.setCustomAttribute(key, value); return thisBuilder(); }
-        public U sourceCode(String x) { check(); AbstractResource.this.setSourceCode(x); return thisBuilder(); }
-
-//        public String type() { return instance().type; }
-    }
-    
-    @VisibleForTesting
-    protected class AbstractResourceBuilder extends Builder<AbstractResource,AbstractResourceBuilder> {
-        protected AbstractResourceBuilder(String type) {
-            super(type);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return super.toString()+"[id="+getId()+"; type="+getType()+"]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponent.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponent.java
deleted file mode 100644
index 3e956a4..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponent.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-
-
-/** Holds the metadata (name, description, etc) for a PCT
- * as well as fields pointing to behaviour (eg creation of PlatformComponent).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class ApplicationComponent extends AbstractResource {
-
-    public static final String CAMP_TYPE = "ApplicationComponent";
-    static { assert CAMP_TYPE.equals(ApplicationComponent.class.getSimpleName()); }
-    
-    /** Use {@link #builder()} to create */
-    protected ApplicationComponent() {}
-
-    ResourceLookup<ApplicationComponent> applicationComponents;
-    ResourceLookup<PlatformComponent> platformComponents;
-    String externalManagementUri;
-    
-    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
-        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
-    }
-    public ResourceLookup<PlatformComponent> getPlatformComponents() {
-        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
-    }
-
-    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
-        this.applicationComponents = applicationComponents;
-    }
-    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
-        this.platformComponents = platformComponents;
-    }
-    
-    // builder
-    
-    public static Builder<? extends ApplicationComponent> builder() {
-        return new ApplicationComponent().new Builder<ApplicationComponent>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends ApplicationComponent> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-
-        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { ApplicationComponent.this.setApplicationComponents(x); return thisBuilder(); }
-        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { ApplicationComponent.this.setPlatformComponents(x); return thisBuilder(); }
-        
-        public synchronized Builder<T> add(ApplicationComponent x) {
-            if (ApplicationComponent.this.applicationComponents==null) {
-                ApplicationComponent.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
-            }
-            if (!(ApplicationComponent.this.applicationComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+ApplicationComponent.this.applicationComponents);
-            }
-            ((BasicResourceLookup<ApplicationComponent>)ApplicationComponent.this.applicationComponents).add(x);
-            return thisBuilder();
-        }
-        
-        public synchronized Builder<T> add(PlatformComponent x) {
-            if (ApplicationComponent.this.platformComponents==null) {
-                ApplicationComponent.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
-            }
-            if (!(ApplicationComponent.this.platformComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+ApplicationComponent.this.platformComponents);
-            }
-            ((BasicResourceLookup<PlatformComponent>)ApplicationComponent.this.platformComponents).add(x);
-            return thisBuilder();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponentTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponentTemplate.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponentTemplate.java
deleted file mode 100644
index f3212c7..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/ApplicationComponentTemplate.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-
-/** Holds the metadata (name, description, etc) for a PCT
- * as well as fields pointing to behaviour (eg creation of PlatformComponent).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class ApplicationComponentTemplate extends AbstractResource {
-
-    public static final String CAMP_TYPE = "ApplicationComponentTemplate";
-    static { assert CAMP_TYPE.equals(ApplicationComponentTemplate.class.getSimpleName()); }
-    
-    /** Use {@link #builder()} to create */
-    protected ApplicationComponentTemplate() {}
-
-    
-    // no fields beyond basic resource
-    
-    // TODO platform component templates, maybe other act's too ?
-    
-    
-    // builder
-    
-    public static Builder<? extends ApplicationComponentTemplate> builder() {
-        return new ApplicationComponentTemplate().new Builder<ApplicationComponentTemplate>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends ApplicationComponentTemplate> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-//        public Builder<T> foo(String x) { instance().setFoo(x); return thisBuilder(); }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Assembly.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Assembly.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Assembly.java
deleted file mode 100644
index 15cfd51..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Assembly.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-
-
-/** Holds the metadata (name, description, etc) for an AssemblyTemplate
- * as well as fields pointing to behaviour (eg list of ACT's).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class Assembly extends AbstractResource {
-
-    public static final String CAMP_TYPE = "Assembly";
-    static { assert CAMP_TYPE.equals(Assembly.class.getSimpleName()); }
-    
-    /** Use {@link #builder()} to create */
-    protected Assembly() {}
-
-    AssemblyTemplate assemblyTemplate;
-    ResourceLookup<ApplicationComponent> applicationComponents;
-    ResourceLookup<PlatformComponent> platformComponents;
-    
-    // TODO
-//    "parameterDefinitionUri": URI,
-//    "pdpUri" : URI ?
-                    
-    public AssemblyTemplate getAssemblyTemplate() {
-        return assemblyTemplate;
-    }
-    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
-        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
-    }
-    public ResourceLookup<PlatformComponent> getPlatformComponents() {
-        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
-    }
-    
-    private void setAssemblyTemplate(AssemblyTemplate assemblyTemplate) {
-        this.assemblyTemplate = assemblyTemplate;
-    }
-    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
-        this.applicationComponents = applicationComponents;
-    }
-    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
-        this.platformComponents = platformComponents;
-    }
-    
-    // builder
-    
-    public static Builder<? extends Assembly> builder() {
-        return new Assembly().new Builder<Assembly>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends Assembly> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-        public Builder<T> assemblyTemplate(AssemblyTemplate x) { Assembly.this.setAssemblyTemplate(x); return thisBuilder(); }
-        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { Assembly.this.setApplicationComponents(x); return thisBuilder(); }
-        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { Assembly.this.setPlatformComponents(x); return thisBuilder(); }
-        
-        public synchronized Builder<T> add(ApplicationComponent x) {
-            if (Assembly.this.applicationComponents==null) {
-                Assembly.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
-            }
-            if (!(Assembly.this.applicationComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+Assembly.this.applicationComponents);
-            }
-            ((BasicResourceLookup<ApplicationComponent>)Assembly.this.applicationComponents).add(x);
-            return thisBuilder();
-        }
-        
-        public synchronized Builder<T> add(PlatformComponent x) {
-            if (Assembly.this.platformComponents==null) {
-                Assembly.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
-            }
-            if (!(Assembly.this.platformComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+Assembly.this.platformComponents);
-            }
-            ((BasicResourceLookup<PlatformComponent>)Assembly.this.platformComponents).add(x);
-            return thisBuilder();
-        }
-        
-        @Override
-        public synchronized T build() {
-            return super.build();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AssemblyTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AssemblyTemplate.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AssemblyTemplate.java
deleted file mode 100644
index 4779a1c..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/AssemblyTemplate.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import com.google.common.base.Preconditions;
-
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
-
-/** Holds the metadata (name, description, etc) for an AssemblyTemplate
- * as well as fields pointing to behaviour (eg list of ACT's).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class AssemblyTemplate extends AbstractResource {
-
-    public static final String CAMP_TYPE = "AssemblyTemplate";
-    static { assert CAMP_TYPE.equals(AssemblyTemplate.class.getSimpleName()); }
-    
-    Class<? extends AssemblyTemplateInstantiator> instantiator;
-    ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates;
-    ResourceLookup<PlatformComponentTemplate> platformComponentTemplates;
-    
-    // TODO
-//    "parameterDefinitionUri": URI,
-//    "pdpUri" : URI ?
-                    
-    /** Use {@link #builder()} to create */
-    protected AssemblyTemplate() {}
-
-    public Class<? extends AssemblyTemplateInstantiator> getInstantiator() {
-        return instantiator;
-    }
-    public ResourceLookup<ApplicationComponentTemplate> getApplicationComponentTemplates() {
-        return applicationComponentTemplates != null ? applicationComponentTemplates : new EmptyResourceLookup<ApplicationComponentTemplate>();
-    }
-    public ResourceLookup<PlatformComponentTemplate> getPlatformComponentTemplates() {
-        return platformComponentTemplates != null ? platformComponentTemplates : new EmptyResourceLookup<PlatformComponentTemplate>();
-    }
-    
-    private void setInstantiator(Class<? extends AssemblyTemplateInstantiator> instantiator) {
-        this.instantiator = instantiator;
-    }
-    private void setApplicationComponentTemplates(ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates) {
-        this.applicationComponentTemplates = applicationComponentTemplates;
-    }
-    private void setPlatformComponentTemplates(ResourceLookup<PlatformComponentTemplate> platformComponentTemplates) {
-        this.platformComponentTemplates = platformComponentTemplates;
-    }
-    
-    // builder
-    
-    public static Builder<? extends AssemblyTemplate> builder() {
-        return new AssemblyTemplate().new Builder<AssemblyTemplate>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends AssemblyTemplate> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-        public Builder<T> instantiator(Class<? extends AssemblyTemplateInstantiator> x) { AssemblyTemplate.this.setInstantiator(x); return thisBuilder(); }
-        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponentTemplate> x) { AssemblyTemplate.this.setApplicationComponentTemplates(x); return thisBuilder(); }
-        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponentTemplate> x) { AssemblyTemplate.this.setPlatformComponentTemplates(x); return thisBuilder(); }
-
-        /** allows callers to see the partially formed instance when needed, for example to query instantiators;
-         *  could be replaced by specific methods as and when that is preferred */
-        @SuppressWarnings("unchecked")
-        public T peek() { return (T) AssemblyTemplate.this; }
-        
-        public synchronized Builder<T> add(ApplicationComponentTemplate x) {
-            if (AssemblyTemplate.this.applicationComponentTemplates==null) {
-                AssemblyTemplate.this.applicationComponentTemplates = new BasicResourceLookup<ApplicationComponentTemplate>();
-            }
-            if (!(AssemblyTemplate.this.applicationComponentTemplates instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+AssemblyTemplate.this.applicationComponentTemplates);
-            }
-            ((BasicResourceLookup<ApplicationComponentTemplate>)AssemblyTemplate.this.applicationComponentTemplates).add(x);
-            return thisBuilder();
-        }
-        
-        public synchronized Builder<T> add(PlatformComponentTemplate x) {
-            if (AssemblyTemplate.this.platformComponentTemplates==null) {
-                AssemblyTemplate.this.platformComponentTemplates = new BasicResourceLookup<PlatformComponentTemplate>();
-            }
-            if (!(AssemblyTemplate.this.platformComponentTemplates instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+AssemblyTemplate.this.platformComponentTemplates);
-            }
-            ((BasicResourceLookup<PlatformComponentTemplate>)AssemblyTemplate.this.platformComponentTemplates).add(x);
-            return thisBuilder();
-        }
-        
-        @Override
-        public synchronized T build() {
-            Preconditions.checkNotNull(AssemblyTemplate.this.instantiator);
-            return super.build();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Link.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Link.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Link.java
deleted file mode 100644
index d8ee643..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/Link.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-public class Link<T> {
-
-    private final String id;
-    private final String name;
-    
-    public Link(String id, String name) {
-        super();
-        this.id = id;
-        this.name = name;
-    }
-
-    public String getId() {
-        return id;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponent.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponent.java
deleted file mode 100644
index d531174..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponent.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup;
-import io.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-
-
-/** Holds the metadata (name, description, etc) for a PCT
- * as well as fields pointing to behaviour (eg creation of PlatformComponent).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class PlatformComponent extends AbstractResource {
-
-    public static final String CAMP_TYPE = "PlatformComponent";
-    static { assert CAMP_TYPE.equals(PlatformComponent.class.getSimpleName()); }
-    
-    /** Use {@link #builder()} to create */
-    protected PlatformComponent() {}
-
-    ResourceLookup<ApplicationComponent> applicationComponents;
-    ResourceLookup<PlatformComponent> platformComponents;
-    String externalManagementUri;
-    
-    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
-        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
-    }
-    public ResourceLookup<PlatformComponent> getPlatformComponents() {
-        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
-    }
-
-    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
-        this.applicationComponents = applicationComponents;
-    }
-    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
-        this.platformComponents = platformComponents;
-    }
-    
-    public String getExternalManagementUri() {
-        return externalManagementUri;
-    }
-    private void setExternalManagementUri(String externalManagementUri) {
-        this.externalManagementUri = externalManagementUri;
-    }
-    
-    // builder
-    
-    public static Builder<? extends PlatformComponent> builder() {
-        return new PlatformComponent().new Builder<PlatformComponent>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends PlatformComponent> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-        public Builder<T> externalManagementUri(String x) { PlatformComponent.this.setExternalManagementUri(x); return thisBuilder(); }
-        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { PlatformComponent.this.setApplicationComponents(x); return thisBuilder(); }
-        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { PlatformComponent.this.setPlatformComponents(x); return thisBuilder(); }
-        
-        public synchronized Builder<T> add(ApplicationComponent x) {
-            if (PlatformComponent.this.applicationComponents==null) {
-                PlatformComponent.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
-            }
-            if (!(PlatformComponent.this.applicationComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+PlatformComponent.this.applicationComponents);
-            }
-            ((BasicResourceLookup<ApplicationComponent>)PlatformComponent.this.applicationComponents).add(x);
-            return thisBuilder();
-        }
-        
-        public synchronized Builder<T> add(PlatformComponent x) {
-            if (PlatformComponent.this.platformComponents==null) {
-                PlatformComponent.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
-            }
-            if (!(PlatformComponent.this.platformComponents instanceof BasicResourceLookup)) {
-                throw new IllegalStateException("Cannot add to resource lookup "+PlatformComponent.this.platformComponents);
-            }
-            ((BasicResourceLookup<PlatformComponent>)PlatformComponent.this.platformComponents).add(x);
-            return thisBuilder();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponentTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponentTemplate.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponentTemplate.java
deleted file mode 100644
index 7f93f34..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformComponentTemplate.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-
-/** Holds the metadata (name, description, etc) for a PCT
- * as well as fields pointing to behaviour (eg creation of PlatformComponent).
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class PlatformComponentTemplate extends AbstractResource {
-
-    public static final String CAMP_TYPE = "PlatformComponentTemplate";
-    static { assert CAMP_TYPE.equals(PlatformComponentTemplate.class.getSimpleName()); }
-    
-    /** Use {@link #builder()} to create */
-    protected PlatformComponentTemplate() {}
-
-    
-    // no fields beyond basic resource
-    
-    
-    // builder
-    
-    public static Builder<? extends PlatformComponentTemplate> builder() {
-        return new PlatformComponentTemplate().new Builder<PlatformComponentTemplate>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends PlatformComponentTemplate> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-//        public Builder<T> foo(String x) { instance().setFoo(x); return thisBuilder(); }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformRootSummary.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformRootSummary.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformRootSummary.java
deleted file mode 100644
index eb34ff9..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformRootSummary.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-/** Holds the metadata (name, description, etc) for a CampPlatform.
- * Required to initialize a CampPlatform.
- * <p>
- * See {@link AbstractResource} for more general information.
- */
-public class PlatformRootSummary extends AbstractResource {
-
-    public static final String CAMP_TYPE = "Platform";
-    
-    /** Use {@link #builder()} to create */
-    protected PlatformRootSummary() {
-    }
-    
-    // no fields beyond basic resource
-    
-    //TODO:
-    
-    // in the DTO
-    
-//    "supportedFormatsUri": URI, 
-//    "extensionsUri": URI,
-//    "typeDefinitionsUri": URI,
-//    "tags": [ String, + ], ?
-//    "specificationVersion": String[], 
-//    "implementationVersion": String, ? 
-//    "assemblyTemplates": [ Link + ], ? 
-//    "assemblies": [ Link + ], ? 
-//    "platformComponentTemplates": [ Link + ], ? 
-//    "platformComponentCapabilities": [Link + ], ? 
-//    "platformComponents": [ Link + ], ?
-
-    
-    // builder
-    
-    public static Builder<? extends PlatformRootSummary> builder() {
-        return new PlatformRootSummary().new Builder<PlatformRootSummary>(CAMP_TYPE);
-    }
-    
-    public class Builder<T extends PlatformRootSummary> extends AbstractResource.Builder<T,Builder<T>> {
-        
-        protected Builder(String type) { super(type); }
-        
-        protected void initialize() {
-            super.initialize();
-            // TODO a better way not to have an ID here (new subclass BasicIdentifiableResource for other BasicResource instances)
-            id("");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformTransaction.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformTransaction.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformTransaction.java
deleted file mode 100644
index 33ef7c3..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/PlatformTransaction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class PlatformTransaction {
-
-    protected List<Object> additions = new ArrayList<Object>();
-    
-    /** apply the transaction */
-    public abstract void commit();
-    
-    public PlatformTransaction add(AssemblyTemplate at) {
-        additions.add(at);
-        return this;
-    }
-
-    public PlatformTransaction add(ApplicationComponentTemplate act) {
-        additions.add(act);
-        return this;
-    }
-
-    public PlatformTransaction add(PlatformComponentTemplate pct) {
-        additions.add(pct);
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AbstractResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AbstractResourceLookup.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AbstractResourceLookup.java
deleted file mode 100644
index 64005c8..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AbstractResourceLookup.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.collection;
-
-import io.brooklyn.camp.spi.AbstractResource;
-
-public abstract class AbstractResourceLookup<T extends AbstractResource> implements ResourceLookup<T> {
-
-    /** convenience for concrete subclasses */
-    protected ResolvableLink<T> newLink(String id, String name) {
-        return new ResolvableLink<T>(id, name, this);
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return links().isEmpty();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AggregatingResourceLookup.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
deleted file mode 100644
index 3a902ff..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.collection;
-
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AggregatingResourceLookup<T extends AbstractResource> extends AbstractResourceLookup<T> {
-
-    List<ResourceLookup<T>> targets = new ArrayList<ResourceLookup<T>>();
-    
-    public static <T extends AbstractResource> AggregatingResourceLookup<T> of(ResourceLookup<T> ...targets) {
-        AggregatingResourceLookup<T> result = new AggregatingResourceLookup<T>();
-        for (ResourceLookup<T> item: targets) result.targets.add(item);
-        return result;
-    }
-    
-    public static <T extends AbstractResource> AggregatingResourceLookup<T> of(Iterable<ResourceLookup<T>> targets) {
-        AggregatingResourceLookup<T> result = new AggregatingResourceLookup<T>();
-        for (ResourceLookup<T> item: targets) result.targets.add(item);
-        return result;        
-    }
-
-    public T get(String id) {
-        for (ResourceLookup<T> item: targets) {
-            T result = item.get(id);
-            if (result!=null) return result;
-        }
-        return null;
-    }
-
-    public List<ResolvableLink<T>> links() {
-        List<ResolvableLink<T>> result = new ArrayList<ResolvableLink<T>>();
-        for (ResourceLookup<T> item: targets) result.addAll(item.links());
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/BasicResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/BasicResourceLookup.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/BasicResourceLookup.java
deleted file mode 100644
index 12a1972..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/BasicResourceLookup.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.collection;
-
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import brooklyn.util.collections.MutableMap;
-
-public class BasicResourceLookup<T extends AbstractResource> extends AbstractResourceLookup<T> {
-
-    Map<String,T> items = new MutableMap<String,T>();
-    Map<String,ResolvableLink<T>> links = new MutableMap<String,ResolvableLink<T>>();
-    
-    public T get(String id) {
-        return items.get(id);
-    }
-
-    public synchronized List<ResolvableLink<T>> links() {
-        return new ArrayList<ResolvableLink<T>>(links.values());
-    }
-
-    public synchronized void add(T item) {
-        T old = items.put(item.getId(), item);
-        if (old!=null) {
-            items.put(old.getId(), old);
-            throw new IllegalStateException("Already contains item for "+item.getId()+": "+old+" (adding "+item+")");
-        }
-        links.put(item.getId(), newLink(item.getId(), item.getName()));
-    }
-    
-    public synchronized void addAll(T... items) {
-        for (T item: items) add(item);
-    }
-    
-    public synchronized T update(T item) {
-        T old = items.put(item.getId(), item);
-        links.put(item.getId(), newLink(item.getId(), item.getName()));
-        return old;
-    }
-    
-    public synchronized boolean remove(String id) {
-        items.remove(id);
-        return links.remove(id)!=null;
-    }
-    
-    public static <T extends AbstractResource> BasicResourceLookup<T> of(T ...items) {
-        BasicResourceLookup<T> result = new BasicResourceLookup<T>();
-        for (T item: items) result.add(item);
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResolvableLink.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResolvableLink.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResolvableLink.java
deleted file mode 100644
index 1ad5fd3..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResolvableLink.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.collection;
-
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.Link;
-
-public class ResolvableLink<T extends AbstractResource> extends Link<T> {
-    
-    protected final ResourceLookup<T> provider;
-    
-    public ResolvableLink(String id, String name, ResourceLookup<T> provider) {
-        super(id, name);
-        this.provider = provider;
-    }
-
-    public T resolve() {
-        return provider.get(getId());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResourceLookup.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResourceLookup.java
deleted file mode 100644
index 231417f..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/collection/ResourceLookup.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.collection;
-
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-public interface ResourceLookup<T extends AbstractResource> {
-
-    public abstract T get(String id);
-    
-    public abstract List<ResolvableLink<T>> links();
-    
-    public abstract boolean isEmpty();
-
-    public static class EmptyResourceLookup<T extends AbstractResource> implements ResourceLookup<T> {
-        public T get(String id) {
-            throw new NoSuchElementException("no resource: "+id);
-        }
-        public List<ResolvableLink<T>> links() {
-            return Collections.emptyList();
-        }
-        public boolean isEmpty() {
-            return links().isEmpty();
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
deleted file mode 100644
index 55e7c64..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.instantiate;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
-/** instances of this class should have a public no-arg constructor so the class names can be serialized */
-public interface AssemblyTemplateInstantiator {
-
-    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform);
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
deleted file mode 100644
index dbe3acd..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.instantiate;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
-/** A simple instantiator which simply invokes the component's instantiators in parallel */
-public class BasicAssemblyTemplateInstantiator implements AssemblyTemplateInstantiator {
-
-    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
-        // TODO this should build it based on the components
-//        template.getPlatformComponentTemplates().links().iterator().next().resolve();
-        
-        // platforms should set a bunch of instantiators, or else let the ComponentTemplates do this!
-        throw new UnsupportedOperationException("Basic instantiator not yet supported");
-    }
-
-}



[2/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
new file mode 100644
index 0000000..b56e78e
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
@@ -0,0 +1,176 @@
+/*
+ * 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.camp.server.rest.util;
+
+import java.util.Map;
+
+import javax.ws.rs.Path;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentDto;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.AssemblyDto;
+import org.apache.brooklyn.camp.server.dto.AssemblyTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentDto;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformDto;
+import org.apache.brooklyn.camp.server.rest.resource.AbstractCampRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.net.Urls;
+
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+
+public class DtoFactory {
+
+    private CampPlatform platform;
+    private String uriBase;
+    
+    private UriFactory uriFactory;
+
+    public DtoFactory(CampPlatform campPlatform, String uriBase) {
+        this.platform = campPlatform;
+        this.uriBase = uriBase;
+        
+        uriFactory = new UriFactory();
+        uriFactory.registerIdentifiableRestResource(PlatformRootSummary.class, PlatformRestResource.class);
+        uriFactory.registerIdentifiableRestResource(AssemblyTemplate.class, AssemblyTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(PlatformComponentTemplate.class, PlatformComponentTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(ApplicationComponentTemplate.class, ApplicationComponentTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(Assembly.class, AssemblyRestResource.class);
+        uriFactory.registerIdentifiableRestResource(PlatformComponent.class, PlatformComponentRestResource.class);
+        uriFactory.registerIdentifiableRestResource(ApplicationComponent.class, ApplicationComponentRestResource.class);
+    }
+
+    public CampPlatform getPlatform() {
+        return platform;
+    }
+
+    public UriFactory getUriFactory() {
+        return uriFactory;
+    }
+
+    public String uri(AbstractResource x) {
+        return getUriFactory().uri(x);
+    }
+        
+    public String uri(Class<? extends AbstractResource> targetType, String id) {
+        return getUriFactory().uri(targetType, id);
+    }
+
+    public AssemblyTemplateDto adapt(AssemblyTemplate assemblyTemplate) {
+        return AssemblyTemplateDto.newInstance(this, assemblyTemplate);
+    }
+    public PlatformComponentTemplateDto adapt(PlatformComponentTemplate platformComponentTemplate) {
+        return PlatformComponentTemplateDto.newInstance(this, platformComponentTemplate);
+    }
+    public ApplicationComponentTemplateDto adapt(ApplicationComponentTemplate applicationComponentTemplate) {
+        return ApplicationComponentTemplateDto.newInstance(this, applicationComponentTemplate);
+    }
+
+    public AssemblyDto adapt(Assembly assembly) {
+        return AssemblyDto.newInstance(this, assembly);
+    }
+    public PlatformComponentDto adapt(PlatformComponent platformComponent) {
+        return PlatformComponentDto.newInstance(this, platformComponent);
+    }
+    public ApplicationComponentDto adapt(ApplicationComponent applicationComponent) {
+        return ApplicationComponentDto.newInstance(this, applicationComponent);
+    }
+
+    public PlatformDto adapt(PlatformRootSummary root) {
+        return PlatformDto.newInstance(this, root);
+    }
+
+    public class UriFactory {
+        /** registry of generating a URI given an object */
+        Map<Class<?>,Function<Object,String>> registryResource = new MutableMap<Class<?>, Function<Object,String>>();
+        /** registry of generating a URI given an ID */
+        Map<Class<?>,Function<String,String>> registryId = new MutableMap<Class<?>, Function<String,String>>();
+
+        /** registers a function which generates a URI given a type; note that this method cannot be used for links */
+        @SuppressWarnings("unchecked")
+        public synchronized <T> void registerResourceUriFunction(Class<T> type, Function<T,String> fnUri) {
+            registryResource.put(type, (Function<Object, String>) fnUri);
+        }
+
+        /** registers a type to generate a URI which concatenates the given base with the
+         * result of the given function to generate an ID against an object of the given type */
+        public synchronized <T> void registerIdentityFunction(Class<T> type, final String resourceTypeUriBase, final Function<T,String> fnIdentity) {
+            final Function<String,String> fnUriFromId = new Function<String,String>() {
+                public String apply(String id) {
+                    return Urls.mergePaths(resourceTypeUriBase, id);
+                }
+            };
+            registryId.put(type, (Function<String, String>) fnUriFromId);
+            registerResourceUriFunction(type, new Function<T,String>() {
+                public String apply(T input) {
+                    return fnUriFromId.apply(fnIdentity.apply(input));
+                }
+            });
+        }
+
+        /** registers a CAMP Resource type against a RestResource, generating the URI
+         * by concatenating the @Path annotation on the RestResource with the ID of the CAMP resource */
+        @SuppressWarnings({ "unchecked", "rawtypes" })
+        public synchronized <T extends AbstractResource> void registerIdentifiableRestResource(Class<T> type, Class<? extends AbstractCampRestResource> restResource) {
+            registerIdentityFunction(type, 
+                    uriOfRestResource(restResource),
+                    (Function) CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
+        }
+        
+        public String uri(Class<? extends AbstractResource> targetType, String id) {
+            return Preconditions.checkNotNull(registryId.get(targetType), 
+                    "No REST ID converter registered for %s (id %s)", targetType, id)
+                    .apply(id);
+        }
+
+        public String uri(AbstractResource x) {
+            return Preconditions.checkNotNull(registryResource.get(x.getClass()), 
+                    "No REST converter registered for %s (%s)", x.getClass(), x)
+                    .apply(x);
+        }
+        
+        public String uriOfRestResource(Class<?> restResourceClass) {
+            return Urls.mergePaths(uriBase, 
+                    Preconditions.checkNotNull(restResourceClass.getAnnotation(Path.class),
+                            "No @Path on type %s", restResourceClass)
+                    .value());
+        }
+            
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
new file mode 100644
index 0000000..964ae34
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
@@ -0,0 +1,59 @@
+/*
+ * 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.camp.server.rest.util;
+
+import java.net.URI;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.brooklyn.camp.server.dto.ApiErrorDto;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WebResourceUtils {
+
+    private static final Logger log = LoggerFactory.getLogger(WebResourceUtils.class);
+    
+    public static WebApplicationException notFound(String format, Object... args) {
+        String msg = String.format(format, args);
+        if (log.isDebugEnabled()) log.debug("returning 404 notFound("+msg+")");
+        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .entity(ApiErrorDto.builder().message(msg).build()).build());
+    }
+
+    public static WebApplicationException preconditionFailed(String format, Object... args) {
+        String msg = String.format(format, args);
+        if (log.isDebugEnabled()) log.debug("returning 412 preconditionFailed("+msg+")");
+        throw new WebApplicationException(Response.status(Response.Status.PRECONDITION_FAILED)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .entity(ApiErrorDto.builder().message(msg).build()).build());
+    }
+
+    public static Response created(UriInfo info, String resourceUriPath) {
+        // see http://stackoverflow.com/questions/13702481/javax-response-prepends-method-path-when-setting-location-header-path-on-status
+        // for why we have to return absolute path
+        URI resourceUri = info.getBaseUriBuilder().path( resourceUriPath ).build();
+        return Response.created(resourceUri).build();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
deleted file mode 100644
index 0219a04..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class ApplicationCompomentTemplateDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(ApplicationCompomentTemplateDtoTest.class);
-    
-    @Test
-    public void testAppServerPct() {
-        CampPlatform p = MockWebPlatform.newPlatform();
-        DtoFactory f = new DtoFactory(p, "");
-        
-        ApplicationComponentTemplate t = MockWebPlatform.WAR;
-        ApplicationComponentTemplateDto dto = f.adapt(t);
-        
-        log.info("War PCT serialized as: "+BasicDtoTest.tree(dto));
-        Assert.assertEquals(dto.getName(), t.getName());
-        Assert.assertNotNull(dto.getCreatedAsString());
-        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
deleted file mode 100644
index 8e4dc2f..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.exceptions.Exceptions;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/** Tests identity methods and custom attributes for DTO, including Jackson JSON serialization */
-public class BasicDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(BasicDtoTest.class);
-    
-    @Test
-    public void testSimple() throws IOException {
-        DtoCustomAttributes l = new DtoCustomAttributes(null);
-        
-        JsonNode t = tree(l);
-        Assert.assertEquals(t.size(), 0);
-        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
-    }
-
-    @Test
-    public void testCustomAttrs() throws IOException {
-        DtoCustomAttributes l = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        
-        JsonNode t = tree(l);
-        Assert.assertEquals(t.size(), 1);
-        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
-    }
-
-    @Test
-    public void testIdentity() throws IOException {
-        DtoCustomAttributes l1 = new DtoCustomAttributes(null);
-        DtoCustomAttributes l2 = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        DtoCustomAttributes l2o = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        
-        Assert.assertEquals(l1, l1);
-        Assert.assertEquals(l2, l2);
-        Assert.assertEquals(l2, l2o);
-        Assert.assertNotEquals(l1, l2);
-        
-        Assert.assertEquals(l1.hashCode(), l1.hashCode());
-        Assert.assertEquals(l2.hashCode(), l2.hashCode());
-        Assert.assertEquals(l2.hashCode(), l2o.hashCode());
-        Assert.assertNotEquals(l1.hashCode(), l2.hashCode());
-    }
-    
-    public static JsonNode tree(Object l) {
-        try {
-            ObjectMapper m = new ObjectMapper();
-            String s = m.writeValueAsString(l);
-            log.info(l.toString()+" -> "+s);
-            JsonNode t = m.readTree(s);
-            return t;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
deleted file mode 100644
index a26eac1..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import java.io.IOException;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.collections.MutableMap;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Test
-public class LinkDtoTest {
-
-//    private static final Logger log = LoggerFactory.getLogger(LinkDtoTest.class);
-    
-    @Test
-    public void testSimple() throws IOException {
-        LinkDto l = LinkDto.newInstance("http://foo", "Foo");
-        
-        JsonNode t = BasicDtoTest.tree(l);
-        Assert.assertEquals(t.size(), 2);
-        Assert.assertEquals(t.get("href").asText(), l.getHref());
-        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
-        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
-    }
-
-    @Test
-    public void testCustomAttrs() throws IOException {
-        LinkDto l = LinkDto.newInstance("http://foo", "Foo", MutableMap.of("bar", "bee"));
-        
-        JsonNode t = BasicDtoTest.tree(l);
-        Assert.assertEquals(t.size(), 3);
-        Assert.assertEquals(t.get("href").asText(), l.getHref());
-        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
-        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
deleted file mode 100644
index b3bc1ae..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class PlatformCompomentTemplateDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(PlatformCompomentTemplateDtoTest.class);
-    
-    @Test
-    public void testAppServerPct() {
-        CampPlatform p = MockWebPlatform.newPlatform();
-        DtoFactory f = new DtoFactory(p, "");
-        
-        PlatformComponentTemplate t = MockWebPlatform.APPSERVER;
-        PlatformComponentTemplateDto dto = f.adapt(t);
-        
-        log.info("Web PCT serialized as: "+BasicDtoTest.tree(dto));
-        Assert.assertEquals(dto.getName(), t.getName());
-        Assert.assertNotNull(dto.getCreatedAsString());
-        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
deleted file mode 100644
index 24ad1d6..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.commontypes.RepresentationSkew;
-import io.brooklyn.camp.rest.util.CampRestGuavas;
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Test
-public class ResourceDtoTest {
-
-//    private static final Logger log = LoggerFactory.getLogger(ResourceDtoTest.class);
-    
-    CampServer s;
-    AbstractResource rr;
-    ResourceDto r;
-    
-    @SuppressWarnings("unchecked")
-    protected void initSimpleDto() {
-        s = new CampServer(new BasicCampPlatform(), "http://atest/");
-        s.getDtoFactory().getUriFactory().registerIdentityFunction(AbstractResource.class, "basic", CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
-        rr = AbstractResource.builder().name("Name").description("a description").
-                tags(Arrays.asList("tag1", "tag 2")).representationSkew(RepresentationSkew.NONE).build();
-        r = ResourceDto.newInstance(s.getDtoFactory(), rr);
-    }
-    
-    @Test
-    public void testSimpleCreation() throws IOException {
-        initSimpleDto();
-        
-        Assert.assertNotNull(r.getCreatedAsString());
-        Assert.assertEquals(r.getName(), "Name");
-        Assert.assertEquals(r.getDescription(), "a description");
-        Assert.assertEquals(r.getTags(), Arrays.asList("tag1", "tag 2"));
-        Assert.assertEquals(r.getRepresentationSkew(), RepresentationSkew.NONE);
-    }
-    
-    public void testSimpleSerializationAndDeserialization() throws IOException {
-        initSimpleDto();
-        
-        JsonNode t = BasicDtoTest.tree(r);
-        
-//        Assert.assertEquals(t.get("uri").asText(), r.getUri());
-        ResourceDto r2 = new ObjectMapper().readValue(t.toString(), ResourceDto.class);
-        Assert.assertNotNull(r2.getCreated());
-        Assert.assertEquals(r, r2);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
deleted file mode 100644
index b3d5ff0..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.PlatformComponentTemplateDto;
-import io.brooklyn.camp.dto.PlatformDto;
-import io.brooklyn.camp.test.fixture.AbstractRestResourceTest;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class PlatformRestResourceTest extends AbstractRestResourceTest {
-
-    private static final Logger log = LoggerFactory.getLogger(PlatformRestResourceTest.class);
-    
-    @Test
-    public void testPlatformIncludesList() {
-        PlatformDto p = load(PlatformRestResource.CAMP_URI_PATH, PlatformDto.class);
-        PlatformComponentTemplateDto pct = load(p.getPlatformComponentTemplates().get(0).getHref(), PlatformComponentTemplateDto.class);
-        log.debug("Loaded PCT via REST: "+pct);
-        Assert.assertNotNull(pct.getName());
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
deleted file mode 100644
index 7046129..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 io.brooklyn.camp.test.fixture;
-
-import java.net.URL;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.reporters.Files;
-
-import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.net.Urls;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AbstractRestResourceTest {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractRestResourceTest.class);
-    
-    protected BasicCampPlatform platform;
-    protected CampServer server;
-    
-    @BeforeClass
-    public void startServer() {
-        platform = new BasicCampPlatform();
-        populate();
-        
-        // new server
-        server = new CampServer(platform, "").start();
-    }
-    
-    protected void populate() {
-        MockWebPlatform.populate(platform);
-    }
-
-    @AfterClass 
-    public void stopServer() {
-        if (server!=null)
-            server.stop();
-    }
-    
-    public String load(String path) {
-        try {
-            String base = "http://localhost:"+server.getPort();
-            String x = path.startsWith(base) ? path : Urls.mergePaths(base, path);
-            log.debug("Reading from: "+x);
-            String s = Files.streamToString(new URL(x).openStream());
-            log.debug("Result from "+x+": "+s);
-            return s;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-    public <T> T load(String path, Class<T> type) {
-        try {
-            String data = load(path);
-            return new ObjectMapper().readValue(data, type);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java b/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
deleted file mode 100644
index 838e1e0..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 io.brooklyn.camp.test.fixture;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class InMemoryCamp {
-    
-    private static final Logger log = LoggerFactory.getLogger(InMemoryCamp.class);
-
-    
-    public static void main(String[] args) {
-        
-        // new platform with some mock types and some data structures
-        
-            // interface CampComponent
-            // getComponentTemplate() -> operations, links, etc
-        
-            // platformView.getComponent(id) -> returns instance of domain-specific component type
-        BasicCampPlatform p = new BasicCampPlatform();
-        MockWebPlatform.populate(p);
-        
-        // new server
-        CampServer s = new CampServer(p, "").start();
-        
-        log.info("Running at: "+s.getUriBase());
-        // requests against server
-        
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
new file mode 100644
index 0000000..476f23e
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.dto;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class ApplicationCompomentTemplateDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(ApplicationCompomentTemplateDtoTest.class);
+    
+    @Test
+    public void testAppServerPct() {
+        CampPlatform p = MockWebPlatform.newPlatform();
+        DtoFactory f = new DtoFactory(p, "");
+        
+        ApplicationComponentTemplate t = MockWebPlatform.WAR;
+        ApplicationComponentTemplateDto dto = f.adapt(t);
+        
+        log.info("War PCT serialized as: "+BasicDtoTest.tree(dto));
+        Assert.assertEquals(dto.getName(), t.getName());
+        Assert.assertNotNull(dto.getCreatedAsString());
+        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
new file mode 100644
index 0000000..e41d544
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.camp.server.dto;
+
+import java.io.IOException;
+
+import org.apache.brooklyn.camp.server.dto.DtoCustomAttributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/** Tests identity methods and custom attributes for DTO, including Jackson JSON serialization */
+public class BasicDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(BasicDtoTest.class);
+    
+    @Test
+    public void testSimple() throws IOException {
+        DtoCustomAttributes l = new DtoCustomAttributes(null);
+        
+        JsonNode t = tree(l);
+        Assert.assertEquals(t.size(), 0);
+        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
+    }
+
+    @Test
+    public void testCustomAttrs() throws IOException {
+        DtoCustomAttributes l = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        
+        JsonNode t = tree(l);
+        Assert.assertEquals(t.size(), 1);
+        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
+    }
+
+    @Test
+    public void testIdentity() throws IOException {
+        DtoCustomAttributes l1 = new DtoCustomAttributes(null);
+        DtoCustomAttributes l2 = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        DtoCustomAttributes l2o = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        
+        Assert.assertEquals(l1, l1);
+        Assert.assertEquals(l2, l2);
+        Assert.assertEquals(l2, l2o);
+        Assert.assertNotEquals(l1, l2);
+        
+        Assert.assertEquals(l1.hashCode(), l1.hashCode());
+        Assert.assertEquals(l2.hashCode(), l2.hashCode());
+        Assert.assertEquals(l2.hashCode(), l2o.hashCode());
+        Assert.assertNotEquals(l1.hashCode(), l2.hashCode());
+    }
+    
+    public static JsonNode tree(Object l) {
+        try {
+            ObjectMapper m = new ObjectMapper();
+            String s = m.writeValueAsString(l);
+            log.info(l.toString()+" -> "+s);
+            JsonNode t = m.readTree(s);
+            return t;
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
new file mode 100644
index 0000000..de1508d
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.camp.server.dto;
+
+import java.io.IOException;
+
+import org.apache.brooklyn.camp.server.dto.LinkDto;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Test
+public class LinkDtoTest {
+
+//    private static final Logger log = LoggerFactory.getLogger(LinkDtoTest.class);
+    
+    @Test
+    public void testSimple() throws IOException {
+        LinkDto l = LinkDto.newInstance("http://foo", "Foo");
+        
+        JsonNode t = BasicDtoTest.tree(l);
+        Assert.assertEquals(t.size(), 2);
+        Assert.assertEquals(t.get("href").asText(), l.getHref());
+        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
+        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
+    }
+
+    @Test
+    public void testCustomAttrs() throws IOException {
+        LinkDto l = LinkDto.newInstance("http://foo", "Foo", MutableMap.of("bar", "bee"));
+        
+        JsonNode t = BasicDtoTest.tree(l);
+        Assert.assertEquals(t.size(), 3);
+        Assert.assertEquals(t.get("href").asText(), l.getHref());
+        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
+        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
new file mode 100644
index 0000000..eb9f552
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.dto;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PlatformCompomentTemplateDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(PlatformCompomentTemplateDtoTest.class);
+    
+    @Test
+    public void testAppServerPct() {
+        CampPlatform p = MockWebPlatform.newPlatform();
+        DtoFactory f = new DtoFactory(p, "");
+        
+        PlatformComponentTemplate t = MockWebPlatform.APPSERVER;
+        PlatformComponentTemplateDto dto = f.adapt(t);
+        
+        log.info("Web PCT serialized as: "+BasicDtoTest.tree(dto));
+        Assert.assertEquals(dto.getName(), t.getName());
+        Assert.assertNotNull(dto.getCreatedAsString());
+        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
new file mode 100644
index 0000000..dd7a01c
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.camp.server.dto;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.commontypes.RepresentationSkew;
+import org.apache.brooklyn.camp.server.dto.ResourceDto;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.server.rest.util.CampRestGuavas;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Test
+public class ResourceDtoTest {
+
+//    private static final Logger log = LoggerFactory.getLogger(ResourceDtoTest.class);
+    
+    CampServer s;
+    AbstractResource rr;
+    ResourceDto r;
+    
+    @SuppressWarnings("unchecked")
+    protected void initSimpleDto() {
+        s = new CampServer(new BasicCampPlatform(), "http://atest/");
+        s.getDtoFactory().getUriFactory().registerIdentityFunction(AbstractResource.class, "basic", CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
+        rr = AbstractResource.builder().name("Name").description("a description").
+                tags(Arrays.asList("tag1", "tag 2")).representationSkew(RepresentationSkew.NONE).build();
+        r = ResourceDto.newInstance(s.getDtoFactory(), rr);
+    }
+    
+    @Test
+    public void testSimpleCreation() throws IOException {
+        initSimpleDto();
+        
+        Assert.assertNotNull(r.getCreatedAsString());
+        Assert.assertEquals(r.getName(), "Name");
+        Assert.assertEquals(r.getDescription(), "a description");
+        Assert.assertEquals(r.getTags(), Arrays.asList("tag1", "tag 2"));
+        Assert.assertEquals(r.getRepresentationSkew(), RepresentationSkew.NONE);
+    }
+    
+    public void testSimpleSerializationAndDeserialization() throws IOException {
+        initSimpleDto();
+        
+        JsonNode t = BasicDtoTest.tree(r);
+        
+//        Assert.assertEquals(t.get("uri").asText(), r.getUri());
+        ResourceDto r2 = new ObjectMapper().readValue(t.toString(), ResourceDto.class);
+        Assert.assertNotNull(r2.getCreated());
+        Assert.assertEquals(r, r2);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
new file mode 100644
index 0000000..f0d2138
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformDto;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResourceTest;
+import org.apache.brooklyn.camp.server.test.fixture.AbstractRestResourceTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PlatformRestResourceTest extends AbstractRestResourceTest {
+
+    private static final Logger log = LoggerFactory.getLogger(PlatformRestResourceTest.class);
+    
+    @Test
+    public void testPlatformIncludesList() {
+        PlatformDto p = load(PlatformRestResource.CAMP_URI_PATH, PlatformDto.class);
+        PlatformComponentTemplateDto pct = load(p.getPlatformComponentTemplates().get(0).getHref(), PlatformComponentTemplateDto.class);
+        log.debug("Loaded PCT via REST: "+pct);
+        Assert.assertNotNull(pct.getName());
+    }
+        
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
new file mode 100644
index 0000000..c085544
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
@@ -0,0 +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.camp.server.test.fixture;
+
+import java.net.URL;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.reporters.Files;
+
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.net.Urls;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AbstractRestResourceTest {
+
+    private static final Logger log = LoggerFactory.getLogger(AbstractRestResourceTest.class);
+    
+    protected BasicCampPlatform platform;
+    protected CampServer server;
+    
+    @BeforeClass
+    public void startServer() {
+        platform = new BasicCampPlatform();
+        populate();
+        
+        // new server
+        server = new CampServer(platform, "").start();
+    }
+    
+    protected void populate() {
+        MockWebPlatform.populate(platform);
+    }
+
+    @AfterClass 
+    public void stopServer() {
+        if (server!=null)
+            server.stop();
+    }
+    
+    public String load(String path) {
+        try {
+            String base = "http://localhost:"+server.getPort();
+            String x = path.startsWith(base) ? path : Urls.mergePaths(base, path);
+            log.debug("Reading from: "+x);
+            String s = Files.streamToString(new URL(x).openStream());
+            log.debug("Result from "+x+": "+s);
+            return s;
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+    public <T> T load(String path, Class<T> type) {
+        try {
+            String data = load(path);
+            return new ObjectMapper().readValue(data, type);
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
new file mode 100644
index 0000000..114324d
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
@@ -0,0 +1,52 @@
+/*
+ * 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.camp.server.test.fixture;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InMemoryCamp {
+    
+    private static final Logger log = LoggerFactory.getLogger(InMemoryCamp.class);
+
+    
+    public static void main(String[] args) {
+        
+        // new platform with some mock types and some data structures
+        
+            // interface CampComponent
+            // getComponentTemplate() -> operations, links, etc
+        
+            // platformView.getComponent(id) -> returns instance of domain-specific component type
+        BasicCampPlatform p = new BasicCampPlatform();
+        MockWebPlatform.populate(p);
+        
+        // new server
+        CampServer s = new CampServer(p, "").start();
+        
+        log.info("Running at: "+s.getUriBase());
+        // requests against server
+        
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java b/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
index 593202e..a314f9d 100644
--- a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
+++ b/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
@@ -18,14 +18,13 @@
  */
 package brooklyn.camp.brooklyn.api;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.util.Set;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 
 public interface AssemblyTemplateSpecInstantiator extends AssemblyTemplateInstantiator {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
index e884bdd..b92bf76 100644
--- a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
+++ b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
@@ -19,13 +19,13 @@
 package brooklyn.config;
 
 import static brooklyn.entity.basic.ConfigKeys.newStringConfigKey;
-import io.brooklyn.camp.CampPlatform;
 
 import java.io.File;
 import java.net.URI;
 import java.util.Map;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
index 03f77b6..abdd48c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
@@ -20,10 +20,6 @@ package org.apache.brooklyn.core.catalog.internal;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import io.brooklyn.camp.spi.pdp.DeploymentPlan;
 
 import java.lang.reflect.Method;
 import java.util.Collection;
@@ -37,8 +33,8 @@ import javax.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
-
 import org.apache.brooklyn.basic.BrooklynObjectInternal.ConfigurationSupportInternal;
+
 import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
 
 import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec;
@@ -52,6 +48,10 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
 import org.apache.brooklyn.api.policy.Policy;
 import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
 import org.apache.brooklyn.core.management.internal.ManagementContextInternal;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
index b243cda..f21d93a 100644
--- a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
@@ -18,11 +18,6 @@
  */
 package org.apache.brooklyn.core.management.internal;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.io.StringReader;
 import java.util.List;
 import java.util.Set;
@@ -37,6 +32,10 @@ import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;
 import org.apache.brooklyn.core.util.task.TaskBuilder;
 import org.apache.brooklyn.core.util.task.Tasks;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java b/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
index 3fad07e..9fe5910 100644
--- a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
+++ b/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
@@ -19,8 +19,8 @@
 package brooklyn.camp.lite;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.BasicCampPlatform;
 
-import io.brooklyn.camp.BasicCampPlatform;
 import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 import brooklyn.config.BrooklynProperties;
 import brooklyn.config.BrooklynServerConfig;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java b/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
index d6a9ed0..70b3e5f 100644
--- a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
+++ b/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
@@ -26,11 +26,6 @@ import org.apache.brooklyn.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.test.entity.TestApplication;
 import org.apache.brooklyn.test.entity.TestEntity;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.pdp.PdpYamlTest;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -49,6 +44,10 @@ import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.pdp.PdpYamlTest;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.catalog.internal.CatalogDto;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
index d82e564..a48827f 100644
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
+++ b/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
@@ -18,10 +18,9 @@
  */
 package brooklyn.camp.lite;
 
+import org.apache.brooklyn.camp.spi.Assembly;
 import org.apache.brooklyn.test.entity.TestApplication;
 
-import io.brooklyn.camp.spi.Assembly;
-
 public class TestAppAssembly extends Assembly {
 
     private TestApplication brooklynApp;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
index 2fa3415..5e25bde 100644
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
+++ b/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
@@ -18,20 +18,19 @@
  */
 package brooklyn.camp.lite;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
-
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.util.config.ConfigBag;
 import org.apache.brooklyn.test.entity.TestApplication;
 import org.apache.brooklyn.test.entity.TestEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
index 996c656..2643a5d 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
@@ -22,8 +22,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
 
 import java.io.File;
 
@@ -40,6 +38,8 @@ import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.catalog.internal.CatalogDto;
 import org.apache.brooklyn.core.internal.BrooklynFeatureEnablement;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
index 4a2078b..f9a1e96 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
@@ -18,10 +18,10 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.CampPlatform;
-
 import java.util.Set;
 
+import org.apache.brooklyn.camp.CampPlatform;
+
 import brooklyn.config.BrooklynServerConfig;
 import brooklyn.config.ConfigInheritance;
 import brooklyn.config.ConfigKey;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
index e2044c1..fece562 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
@@ -18,15 +18,14 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.AggregatingCampPlatform;
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.ManagementContext.PropertiesReloadListener;
+import org.apache.brooklyn.camp.AggregatingCampPlatform;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityMatcher;
 import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslInterpreter;
 import org.apache.brooklyn.camp.brooklyn.spi.platform.BrooklynImmutableCampPlatform;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
 
 import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 import brooklyn.config.BrooklynProperties;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
index 7adf958..5003ac8 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
@@ -19,10 +19,9 @@
 package org.apache.brooklyn.camp.brooklyn;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
 import com.google.common.annotations.Beta;
 
 /** launcher for {@link BrooklynCampPlatform}, which may or may not start a (web) server depending on children */

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
index 6296339..86eb256 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
@@ -18,9 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.Reader;
 import java.util.Set;
 
@@ -28,6 +25,8 @@ import org.apache.brooklyn.api.entity.Application;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.util.ResourceUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
index 3931a82..eeed738 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
@@ -18,14 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate.Builder;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -46,7 +38,14 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate.Builder;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog.BrooklynLoaderTracker;
 import org.apache.brooklyn.core.management.internal.EntityManagementUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
index 03e3920..d9e7eb2 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
@@ -18,11 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import java.util.Collection;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -46,6 +41,10 @@ import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.service.BrooklynServiceTypeResolver;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.management.ManagementContextInjectable;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
index 409ca1c..e8b6268 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
@@ -18,12 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate.Builder;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
-import io.brooklyn.camp.spi.pdp.Service;
-import io.brooklyn.camp.spi.resolve.PdpMatcher;
-
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +25,11 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate.Builder;
+import org.apache.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+import org.apache.brooklyn.camp.spi.resolve.PdpMatcher;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
index 1f12663..9fd4e3a 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
@@ -18,8 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
@@ -29,6 +27,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityDecorationResolver;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 
 import brooklyn.util.text.Strings;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
index c5d00e9..e374476 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
@@ -18,11 +18,10 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import java.util.Map;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
index fdc9c86..cda6c74 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
@@ -18,14 +18,13 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 
 import brooklyn.entity.chef.ChefConfig;
 import brooklyn.entity.chef.ChefEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
index 26ad322..c630622 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
@@ -18,9 +18,8 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



[9/9] incubator-brooklyn git commit: This closes #837

Posted by al...@apache.org.
This closes #837


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

Branch: refs/heads/master
Commit: 23889db5cfc6a33c871699fd1ac4439d6c58fcde
Parents: f092e18 7d782f3
Author: Aled Sage <al...@gmail.com>
Authored: Tue Aug 18 14:26:06 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Aug 18 14:26:06 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/camp/AggregatingCampPlatform.java  | 131 ---------
 .../io/brooklyn/camp/BasicCampPlatform.java     | 143 ----------
 .../java/io/brooklyn/camp/CampPlatform.java     |  76 ------
 .../camp/commontypes/RepresentationSkew.java    |  23 --
 .../io/brooklyn/camp/spi/AbstractResource.java  | 197 --------------
 .../brooklyn/camp/spi/ApplicationComponent.java |  93 -------
 .../camp/spi/ApplicationComponentTemplate.java  |  54 ----
 .../java/io/brooklyn/camp/spi/Assembly.java     | 109 --------
 .../io/brooklyn/camp/spi/AssemblyTemplate.java  | 118 ---------
 .../main/java/io/brooklyn/camp/spi/Link.java    |  40 ---
 .../io/brooklyn/camp/spi/PlatformComponent.java | 101 -------
 .../camp/spi/PlatformComponentTemplate.java     |  52 ----
 .../brooklyn/camp/spi/PlatformRootSummary.java  |  70 -----
 .../brooklyn/camp/spi/PlatformTransaction.java  |  46 ----
 .../spi/collection/AbstractResourceLookup.java  |  35 ---
 .../collection/AggregatingResourceLookup.java   |  56 ----
 .../spi/collection/BasicResourceLookup.java     |  71 -----
 .../camp/spi/collection/ResolvableLink.java     |  37 ---
 .../camp/spi/collection/ResourceLookup.java     |  47 ----
 .../AssemblyTemplateInstantiator.java           |  30 ---
 .../BasicAssemblyTemplateInstantiator.java      |  36 ---
 .../java/io/brooklyn/camp/spi/pdp/Artifact.java |  99 -------
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |  65 -----
 .../camp/spi/pdp/ArtifactRequirement.java       |  72 -----
 .../spi/pdp/AssemblyTemplateConstructor.java    | 100 -------
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   | 150 -----------
 .../java/io/brooklyn/camp/spi/pdp/Service.java  |  94 -------
 .../camp/spi/pdp/ServiceCharacteristic.java     |  72 -----
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |  51 ----
 .../brooklyn/camp/spi/resolve/PdpProcessor.java | 188 -------------
 .../camp/spi/resolve/PlanInterpreter.java       | 113 --------
 .../interpret/PlanInterpretationContext.java    | 152 -----------
 .../interpret/PlanInterpretationNode.java       | 263 -------------------
 .../main/java/io/brooklyn/util/yaml/Yamls.java  |  24 --
 .../brooklyn/camp/AggregatingCampPlatform.java  | 130 +++++++++
 .../apache/brooklyn/camp/BasicCampPlatform.java | 142 ++++++++++
 .../org/apache/brooklyn/camp/CampPlatform.java  |  76 ++++++
 .../camp/commontypes/RepresentationSkew.java    |  23 ++
 .../brooklyn/camp/spi/AbstractResource.java     | 197 ++++++++++++++
 .../brooklyn/camp/spi/ApplicationComponent.java |  93 +++++++
 .../camp/spi/ApplicationComponentTemplate.java  |  54 ++++
 .../org/apache/brooklyn/camp/spi/Assembly.java  | 109 ++++++++
 .../brooklyn/camp/spi/AssemblyTemplate.java     | 118 +++++++++
 .../java/org/apache/brooklyn/camp/spi/Link.java |  40 +++
 .../brooklyn/camp/spi/PlatformComponent.java    | 101 +++++++
 .../camp/spi/PlatformComponentTemplate.java     |  52 ++++
 .../brooklyn/camp/spi/PlatformRootSummary.java  |  70 +++++
 .../brooklyn/camp/spi/PlatformTransaction.java  |  46 ++++
 .../spi/collection/AbstractResourceLookup.java  |  35 +++
 .../collection/AggregatingResourceLookup.java   |  56 ++++
 .../spi/collection/BasicResourceLookup.java     |  71 +++++
 .../camp/spi/collection/ResolvableLink.java     |  37 +++
 .../camp/spi/collection/ResourceLookup.java     |  47 ++++
 .../AssemblyTemplateInstantiator.java           |  30 +++
 .../BasicAssemblyTemplateInstantiator.java      |  36 +++
 .../apache/brooklyn/camp/spi/pdp/Artifact.java  |  99 +++++++
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |  65 +++++
 .../camp/spi/pdp/ArtifactRequirement.java       |  72 +++++
 .../spi/pdp/AssemblyTemplateConstructor.java    | 100 +++++++
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   | 150 +++++++++++
 .../apache/brooklyn/camp/spi/pdp/Service.java   |  94 +++++++
 .../camp/spi/pdp/ServiceCharacteristic.java     |  72 +++++
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |  51 ++++
 .../brooklyn/camp/spi/resolve/PdpProcessor.java | 187 +++++++++++++
 .../camp/spi/resolve/PlanInterpreter.java       | 113 ++++++++
 .../interpret/PlanInterpretationContext.java    | 152 +++++++++++
 .../interpret/PlanInterpretationNode.java       | 262 ++++++++++++++++++
 .../apache/brooklyn/camp/util/yaml/Yamls.java   |  24 ++
 .../pdp/DeploymentPlanToyInterpreterTest.java   | 114 --------
 .../io/brooklyn/camp/spi/pdp/PdpYamlTest.java   |  78 ------
 .../web/MockAssemblyTemplateInstantiator.java   |  38 ---
 .../camp/test/mock/web/MockWebPlatform.java     | 131 ---------
 .../test/platform/BasicCampPlatformTest.java    |  87 ------
 .../pdp/DeploymentPlanToyInterpreterTest.java   | 113 ++++++++
 .../brooklyn/camp/spi/pdp/PdpYamlTest.java      |  80 ++++++
 .../web/MockAssemblyTemplateInstantiator.java   |  37 +++
 .../camp/test/mock/web/MockWebPlatform.java     | 132 ++++++++++
 .../test/platform/BasicCampPlatformTest.java    |  86 ++++++
 .../camp/spi/pdp/pdp-single-artifact.yaml       |  27 --
 .../camp/spi/pdp/pdp-single-service.yaml        |  29 --
 .../pdp/yaml-sample-toy-interpreter-result.yaml |  22 --
 .../spi/pdp/yaml-sample-toy-interpreter.yaml    |  28 --
 .../camp/spi/pdp/pdp-single-artifact.yaml       |  27 ++
 .../camp/spi/pdp/pdp-single-service.yaml        |  29 ++
 .../pdp/yaml-sample-toy-interpreter-result.yaml |  22 ++
 .../spi/pdp/yaml-sample-toy-interpreter.yaml    |  28 ++
 .../io/brooklyn/camp/CampRestResources.java     |  70 -----
 .../main/java/io/brooklyn/camp/CampServer.java  | 185 -------------
 .../java/io/brooklyn/camp/dto/ApiErrorDto.java  | 119 ---------
 .../camp/dto/ApplicationComponentDto.java       |  72 -----
 .../dto/ApplicationComponentTemplateDto.java    |  44 ----
 .../java/io/brooklyn/camp/dto/AssemblyDto.java  |  77 ------
 .../brooklyn/camp/dto/AssemblyTemplateDto.java  |  72 -----
 .../main/java/io/brooklyn/camp/dto/DtoBase.java |  31 ---
 .../brooklyn/camp/dto/DtoCustomAttributes.java  |  66 -----
 .../main/java/io/brooklyn/camp/dto/LinkDto.java |  72 -----
 .../brooklyn/camp/dto/PlatformComponentDto.java |  82 ------
 .../camp/dto/PlatformComponentTemplateDto.java  |  44 ----
 .../java/io/brooklyn/camp/dto/PlatformDto.java  | 131 ---------
 .../java/io/brooklyn/camp/dto/ResourceDto.java  | 112 --------
 .../rest/resource/AbstractCampRestResource.java |  56 ----
 .../camp/rest/resource/ApidocRestResource.java  |  31 ---
 .../ApplicationComponentRestResource.java       |  50 ----
 ...pplicationComponentTemplateRestResource.java |  50 ----
 .../rest/resource/AssemblyRestResource.java     |  52 ----
 .../resource/AssemblyTemplateRestResource.java  |  88 -------
 .../resource/PlatformComponentRestResource.java |  50 ----
 .../PlatformComponentTemplateRestResource.java  |  50 ----
 .../rest/resource/PlatformRestResource.java     |  89 -------
 .../io/brooklyn/camp/rest/util/CampJsons.java   |  39 ---
 .../camp/rest/util/CampRestContext.java         |  50 ----
 .../brooklyn/camp/rest/util/CampRestGuavas.java |  32 ---
 .../io/brooklyn/camp/rest/util/DtoFactory.java  | 176 -------------
 .../camp/rest/util/WebResourceUtils.java        |  60 -----
 .../brooklyn/camp/server/dto/ApiErrorDto.java   | 119 +++++++++
 .../server/dto/ApplicationComponentDto.java     |  72 +++++
 .../dto/ApplicationComponentTemplateDto.java    |  44 ++++
 .../brooklyn/camp/server/dto/AssemblyDto.java   |  77 ++++++
 .../camp/server/dto/AssemblyTemplateDto.java    |  72 +++++
 .../brooklyn/camp/server/dto/DtoBase.java       |  31 +++
 .../camp/server/dto/DtoCustomAttributes.java    |  66 +++++
 .../brooklyn/camp/server/dto/LinkDto.java       |  72 +++++
 .../camp/server/dto/PlatformComponentDto.java   |  82 ++++++
 .../dto/PlatformComponentTemplateDto.java       |  44 ++++
 .../brooklyn/camp/server/dto/PlatformDto.java   | 131 +++++++++
 .../brooklyn/camp/server/dto/ResourceDto.java   | 112 ++++++++
 .../camp/server/rest/CampRestResources.java     |  69 +++++
 .../brooklyn/camp/server/rest/CampServer.java   | 185 +++++++++++++
 .../rest/resource/AbstractCampRestResource.java |  56 ++++
 .../rest/resource/ApidocRestResource.java       |  31 +++
 .../ApplicationComponentRestResource.java       |  49 ++++
 ...pplicationComponentTemplateRestResource.java |  49 ++++
 .../rest/resource/AssemblyRestResource.java     |  51 ++++
 .../resource/AssemblyTemplateRestResource.java  |  87 ++++++
 .../resource/PlatformComponentRestResource.java |  49 ++++
 .../PlatformComponentTemplateRestResource.java  |  49 ++++
 .../rest/resource/PlatformRestResource.java     |  87 ++++++
 .../camp/server/rest/util/CampJsons.java        |  39 +++
 .../camp/server/rest/util/CampRestContext.java  |  50 ++++
 .../camp/server/rest/util/CampRestGuavas.java   |  32 +++
 .../camp/server/rest/util/DtoFactory.java       | 176 +++++++++++++
 .../camp/server/rest/util/WebResourceUtils.java |  59 +++++
 .../ApplicationCompomentTemplateDtoTest.java    |  49 ----
 .../java/io/brooklyn/camp/dto/BasicDtoTest.java |  90 -------
 .../java/io/brooklyn/camp/dto/LinkDtoTest.java  |  62 -----
 .../dto/PlatformCompomentTemplateDtoTest.java   |  49 ----
 .../io/brooklyn/camp/dto/ResourceDtoTest.java   |  77 ------
 .../rest/resource/PlatformRestResourceTest.java |  42 ---
 .../test/fixture/AbstractRestResourceTest.java  |  86 ------
 .../camp/test/fixture/InMemoryCamp.java         |  53 ----
 .../ApplicationCompomentTemplateDtoTest.java    |  49 ++++
 .../brooklyn/camp/server/dto/BasicDtoTest.java  |  91 +++++++
 .../brooklyn/camp/server/dto/LinkDtoTest.java   |  63 +++++
 .../dto/PlatformCompomentTemplateDtoTest.java   |  49 ++++
 .../camp/server/dto/ResourceDtoTest.java        |  77 ++++++
 .../rest/resource/PlatformRestResourceTest.java |  43 +++
 .../test/fixture/AbstractRestResourceTest.java  |  85 ++++++
 .../camp/server/test/fixture/InMemoryCamp.java  |  52 ++++
 .../api/AssemblyTemplateSpecInstantiator.java   |   7 +-
 .../brooklyn/config/BrooklynServerConfig.java   |   2 +-
 .../catalog/internal/BasicBrooklynCatalog.java  |  10 +-
 .../internal/EntityManagementUtils.java         |   9 +-
 .../lite/CampPlatformWithJustBrooklynMgmt.java  |   2 +-
 .../brooklyn/camp/lite/CampYamlLiteTest.java    |   9 +-
 .../brooklyn/camp/lite/TestAppAssembly.java     |   3 +-
 .../camp/lite/TestAppAssemblyInstantiator.java  |  15 +-
 .../entity/rebind/RebindCatalogItemTest.java    |   4 +-
 .../camp/brooklyn/BrooklynCampConstants.java    |   4 +-
 .../camp/brooklyn/BrooklynCampPlatform.java     |   7 +-
 .../BrooklynCampPlatformLauncherAbstract.java   |   3 +-
 .../camp/brooklyn/YamlLauncherAbstract.java     |   5 +-
 .../BrooklynAssemblyTemplateInstantiator.java   |  15 +-
 .../BrooklynComponentTemplateResolver.java      |   9 +-
 .../spi/creation/BrooklynEntityMatcher.java     |  11 +-
 .../service/BrooklynServiceTypeResolver.java    |   3 +-
 .../service/CatalogServiceTypeResolver.java     |   3 +-
 .../service/ChefServiceTypeResolver.java        |   3 +-
 .../service/JavaServiceTypeResolver.java        |   3 +-
 .../spi/dsl/BrooklynDslDeferredSupplier.java    |   7 +-
 .../spi/dsl/BrooklynDslInterpreter.java         |   9 +-
 .../lookup/AbstractBrooklynResourceLookup.java  |   7 +-
 .../lookup/AbstractTemplateBrooklynLookup.java  |   7 +-
 .../spi/lookup/AssemblyBrooklynLookup.java      |   7 +-
 .../lookup/AssemblyTemplateBrooklynLookup.java  |   7 +-
 .../lookup/PlatformComponentBrooklynLookup.java |   9 +-
 ...PlatformComponentTemplateBrooklynLookup.java |   7 +-
 .../platform/BrooklynImmutableCampPlatform.java |  25 +-
 .../camp/brooklyn/AbstractYamlRebindTest.java   |   5 +-
 .../camp/brooklyn/AbstractYamlTest.java         |   5 +-
 ...aWebAppWithDslYamlRebindIntegrationTest.java |   5 +-
 .../brooklyn/JavaWebAppsIntegrationTest.java    |  14 +-
 .../camp/brooklyn/JavaWebAppsMatchingTest.java  |  11 +-
 .../brooklyn/ReloadBrooklynPropertiesTest.java  |   7 +-
 .../brooklyn/launcher/BrooklynLauncher.java     |   6 +-
 .../camp/BrooklynCampPlatformLauncher.java      |   4 +-
 .../resources/AbstractBrooklynRestResource.java |   3 +-
 .../rest/resources/ApplicationResource.java     |   3 +-
 197 files changed, 6230 insertions(+), 6272 deletions(-)
----------------------------------------------------------------------



[3/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/WebResourceUtils.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/WebResourceUtils.java b/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/WebResourceUtils.java
deleted file mode 100644
index b0c3554..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/rest/util/WebResourceUtils.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 io.brooklyn.camp.rest.util;
-
-import io.brooklyn.camp.dto.ApiErrorDto;
-
-import java.net.URI;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebResourceUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(WebResourceUtils.class);
-    
-    public static WebApplicationException notFound(String format, Object... args) {
-        String msg = String.format(format, args);
-        if (log.isDebugEnabled()) log.debug("returning 404 notFound("+msg+")");
-        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .entity(ApiErrorDto.builder().message(msg).build()).build());
-    }
-
-    public static WebApplicationException preconditionFailed(String format, Object... args) {
-        String msg = String.format(format, args);
-        if (log.isDebugEnabled()) log.debug("returning 412 preconditionFailed("+msg+")");
-        throw new WebApplicationException(Response.status(Response.Status.PRECONDITION_FAILED)
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .entity(ApiErrorDto.builder().message(msg).build()).build());
-    }
-
-    public static Response created(UriInfo info, String resourceUriPath) {
-        // see http://stackoverflow.com/questions/13702481/javax-response-prepends-method-path-when-setting-location-header-path-on-status
-        // for why we have to return absolute path
-        URI resourceUri = info.getBaseUriBuilder().path( resourceUriPath ).build();
-        return Response.created(resourceUri).build();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java
new file mode 100644
index 0000000..a65dbe1
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java
@@ -0,0 +1,119 @@
+/*
+ * 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.camp.server.dto;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Throwables;
+
+/**
+ * A simple error message that provides a message and optional details.
+ *
+ * This class should eventually be replaced with an ErrorMessage object,
+ * as described in the CAMP spec.
+ */
+public class ApiErrorDto {
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * @return An {@link ApiErrorDto.Builder} whose message is initialised to either the throwable's
+     *         message or the throwable's class name if the message is null and whose details are
+     *         initialised to the throwable's stack trace.
+     */
+    public static Builder fromThrowable(Throwable t) {
+        checkNotNull(t, "throwable");
+        String message = Optional.fromNullable(t.getMessage())
+                .or(t.getClass().getName());
+        return builder()
+                .message(message)
+                .details(Throwables.getStackTraceAsString(t));
+    }
+
+    public static class Builder {
+        private String message;
+        private String details;
+
+        public Builder message(String message) {
+            this.message = checkNotNull(message, "message");
+            return this;
+        }
+
+        public Builder details(String details) {
+            this.details = checkNotNull(details, "details");
+            return this;
+        }
+
+        public ApiErrorDto build() {
+            return new ApiErrorDto(message, details);
+        }
+
+        public Builder fromApiErrorDto(ApiErrorDto error) {
+            return this
+                    .message(error.message)
+                    .details(error.details);
+        }
+    }
+
+    private final String message;
+    private final String details;
+
+    public ApiErrorDto(
+            @JsonProperty("message") String message,
+            @JsonProperty("details") String details) {
+        this.message = checkNotNull(message, "message");
+        this.details = details != null ? details : "";
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public String getDetails() {
+        return details;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) return true;
+        if (other == null || getClass() != other.getClass()) return false;
+        ApiErrorDto that = ApiErrorDto.class.cast(other);
+        return Objects.equal(this.message, that.message) &&
+                Objects.equal(this.details, that.details);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(message, details);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this)
+                .add("message", message)
+                .add("details", details)
+                .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
new file mode 100644
index 0000000..f18787b
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
@@ -0,0 +1,72 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.Link;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+public class ApplicationComponentDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.ApplicationComponentDto";
+    static { assert CLASS_NAME.equals(ApplicationComponentDto.class.getCanonicalName()); }
+
+    protected ApplicationComponentDto() {}
+    protected ApplicationComponentDto(DtoFactory dtoFactory, ApplicationComponent x) {
+        super(dtoFactory, x);
+        
+        platformComponents = new ArrayList<LinkDto>();
+        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
+            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
+        }
+        
+        applicationComponents = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
+            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
+        }
+    }
+ 
+    private List<LinkDto> platformComponents;
+    private List<LinkDto> applicationComponents;
+
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getPlatformComponents() {
+        return platformComponents;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getApplicationComponents() {
+        return applicationComponents;
+    }
+    
+    // --- building ---
+
+    public static ApplicationComponentDto newInstance(DtoFactory dtoFactory, ApplicationComponent x) {
+        return new ApplicationComponentDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java
new file mode 100644
index 0000000..b522eb4
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java
@@ -0,0 +1,44 @@
+/*
+ * 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.camp.server.dto;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+
+public class ApplicationComponentTemplateDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto";
+    static { assert CLASS_NAME.equals(ApplicationComponentTemplateDto.class.getCanonicalName()); }
+
+    protected ApplicationComponentTemplateDto() {}
+    protected ApplicationComponentTemplateDto(DtoFactory dtoFactory, ApplicationComponentTemplate x) {
+        super(dtoFactory, x);
+        // TODO set addl ACT fields
+    }
+ 
+    // TODO add addl ACT fields
+    
+    // --- building ---
+
+    public static ApplicationComponentTemplateDto newInstance(DtoFactory dtoFactory, ApplicationComponentTemplate x) {
+        return new ApplicationComponentTemplateDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
new file mode 100644
index 0000000..0e6723e
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
@@ -0,0 +1,77 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.Link;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+public class AssemblyDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.AssemblyDto";
+    static { assert CLASS_NAME.equals(AssemblyDto.class.getCanonicalName()); }
+
+    protected AssemblyDto() {}
+    protected AssemblyDto(DtoFactory dtoFactory, Assembly x) {
+        super(dtoFactory, x);
+        
+        platformComponents = new ArrayList<LinkDto>();
+        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
+            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
+        }
+        
+        applicationComponents = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
+            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
+        }
+    }
+ 
+    private List<LinkDto> platformComponents;
+    private List<LinkDto> applicationComponents;
+
+    // TODO addl AssemblyTemplate fields
+//  "parameterDefinitionUri": URI,
+//  "pdpUri" : URI ?
+
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getPlatformComponents() {
+        return platformComponents;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getApplicationComponents() {
+        return applicationComponents;
+    }
+    
+    // --- building ---
+
+    public static AssemblyDto newInstance(DtoFactory dtoFactory, Assembly x) {
+        return new AssemblyDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
new file mode 100644
index 0000000..6413403
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
@@ -0,0 +1,72 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.Link;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+
+public class AssemblyTemplateDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.AssemblyTemplateDto";
+    static { assert CLASS_NAME.equals(AssemblyTemplateDto.class.getCanonicalName()); }
+
+    protected AssemblyTemplateDto() {}
+    protected AssemblyTemplateDto(DtoFactory dtoFactory, AssemblyTemplate x) {
+        super(dtoFactory, x);
+        
+        platformComponentTemplates = new ArrayList<LinkDto>();
+        for (Link<PlatformComponentTemplate> t: x.getPlatformComponentTemplates().links()) {
+            platformComponentTemplates.add(LinkDto.newInstance(dtoFactory, PlatformComponentTemplate.class, t));
+        }
+        
+        applicationComponentTemplates = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponentTemplate> t: x.getApplicationComponentTemplates().links()) {
+            applicationComponentTemplates.add(LinkDto.newInstance(dtoFactory, ApplicationComponentTemplate.class, t));
+        }
+    }
+ 
+    private List<LinkDto> platformComponentTemplates;
+    private List<LinkDto> applicationComponentTemplates;
+
+    // TODO addl AssemblyTemplate fields
+//  "parameterDefinitionUri": URI,
+//  "pdpUri" : URI ?
+
+    public List<LinkDto> getPlatformComponentTemplates() {
+        return platformComponentTemplates;
+    }
+    
+    public List<LinkDto> getApplicationComponentTemplates() {
+        return applicationComponentTemplates;
+    }
+    
+    // --- building ---
+
+    public static AssemblyTemplateDto newInstance(DtoFactory dtoFactory, AssemblyTemplate x) {
+        return new AssemblyTemplateDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java
new file mode 100644
index 0000000..fbf48ca
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java
@@ -0,0 +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.camp.server.dto;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class DtoBase {
+
+    @Override public String toString() { return ToStringBuilder.reflectionToString(this); }
+    @Override public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); }
+    @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java
new file mode 100644
index 0000000..ad9c5bd
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java
@@ -0,0 +1,66 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.Map;
+
+import brooklyn.util.collections.MutableMap;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.google.common.collect.ImmutableMap;
+
+public class DtoCustomAttributes extends DtoBase {
+
+    private Map<String,Object> customAttributes = new MutableMap<String, Object>();
+
+    protected DtoCustomAttributes() {}
+    
+    public DtoCustomAttributes(Map<String,?> customAttributes) {
+        this.customAttributes = customAttributes==null ? ImmutableMap.<String, Object>of() : ImmutableMap.copyOf(customAttributes);
+    }
+    
+    @JsonIgnore
+    public Map<String, Object> getCustomAttributes() {
+        return customAttributes;
+    }
+
+    // --- json ---
+    
+    @JsonInclude(Include.NON_EMPTY)
+    @JsonAnyGetter
+    private Map<String,Object> any() {
+        return customAttributes;
+    }
+    @JsonAnySetter
+    private void set(String name, Object value) {
+        customAttributes.put(name, value);
+    }
+
+    // --- building ---
+
+    protected void newInstanceCustomAttributes(Map<String,?> customAttributes) {
+        if (customAttributes!=null)
+            this.customAttributes.putAll(customAttributes);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java
new file mode 100644
index 0000000..d12de65
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java
@@ -0,0 +1,72 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.Map;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.Link;
+
+public class LinkDto extends DtoCustomAttributes {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.LinkDto";
+    static { assert CLASS_NAME.equals(LinkDto.class.getCanonicalName()); }
+
+    private String href;
+    private String targetName;
+
+    protected LinkDto() {}
+    
+    public String getHref() {
+        return href;
+    }
+    
+    public String getTargetName() {
+        return targetName;
+    }
+    
+    // --- building ---
+
+    public static LinkDto newInstance(DtoFactory dtoFactory, Class<? extends AbstractResource> targetType, Link<?> x) {
+        return new LinkDto().newInstanceInitialization(dtoFactory, targetType, x);
+    }
+    
+    protected LinkDto newInstanceInitialization(DtoFactory dtoFactory, Class<? extends AbstractResource> targetType, Link<?> x) {
+        targetName = x.getName();
+        
+        href = dtoFactory.uri(targetType, x.getId());
+        return this;
+    }
+
+    public static LinkDto newInstance(String href, String targetName) {
+        LinkDto x = new LinkDto();
+        x.href = href;
+        x.targetName = targetName;
+        return x;
+    }
+    
+    public static LinkDto newInstance(String href, String targetName, Map<String,?> customAttributes) {
+        LinkDto x = newInstance(href, targetName);
+        x.newInstanceCustomAttributes(customAttributes);
+        return x;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java
new file mode 100644
index 0000000..446f9b5
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java
@@ -0,0 +1,82 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.Link;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+public class PlatformComponentDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformComponentDto";
+    static { assert CLASS_NAME.equals(PlatformComponentDto.class.getCanonicalName()); }
+ 
+    protected PlatformComponentDto() {}
+    protected PlatformComponentDto(DtoFactory dtoFactory, PlatformComponent x) {
+        super(dtoFactory, x);
+        setExternalManagementUri(x.getExternalManagementUri());
+        platformComponents = new ArrayList<LinkDto>();
+        for (Link<PlatformComponent> t: x.getPlatformComponents().links()) {
+            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
+        }
+        
+        applicationComponents = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponent> t: x.getApplicationComponents().links()) {
+            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
+        }
+    }
+ 
+    private List<LinkDto> platformComponents;
+    private List<LinkDto> applicationComponents;
+
+    private String externalManagementUri;
+
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getPlatformComponents() {
+        return platformComponents;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getApplicationComponents() {
+        return applicationComponents;
+    } 
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public String getExternalManagementUri() {
+        return externalManagementUri;
+    }
+    private void setExternalManagementUri(String externalManagementUri) {
+        this.externalManagementUri = externalManagementUri;
+    }
+    
+    // --- building ---
+
+    public static PlatformComponentDto newInstance(DtoFactory dtoFactory, PlatformComponent x) {
+        return new PlatformComponentDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java
new file mode 100644
index 0000000..1de7cbf
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java
@@ -0,0 +1,44 @@
+/*
+ * 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.camp.server.dto;
+
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+
+public class PlatformComponentTemplateDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto";
+    static { assert CLASS_NAME.equals(PlatformComponentTemplateDto.class.getCanonicalName()); }
+ 
+    protected PlatformComponentTemplateDto() {}
+    protected PlatformComponentTemplateDto(DtoFactory dtoFactory, PlatformComponentTemplate x) {
+        super(dtoFactory, x);
+        // TODO set addl PCT fields
+    }
+ 
+    // TODO add addl PCT fields
+    
+    // --- building ---
+
+    public static PlatformComponentTemplateDto newInstance(DtoFactory dtoFactory, PlatformComponentTemplate x) {
+        return new PlatformComponentTemplateDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
new file mode 100644
index 0000000..db52964
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
@@ -0,0 +1,131 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.resource.ApidocRestResource;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.Link;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+public class PlatformDto extends ResourceDto {
+
+    // defined as a constant so can be used in Swagger REST API annotations
+    public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformDto";
+    static { assert CLASS_NAME.equals(PlatformDto.class.getCanonicalName()); }
+
+    protected PlatformDto() {}
+    protected PlatformDto(DtoFactory dtoFactory, PlatformRootSummary x) {
+        super(dtoFactory, x);
+        platformComponentTemplates = new ArrayList<LinkDto>();
+        for (Link<PlatformComponentTemplate> t: dtoFactory.getPlatform().platformComponentTemplates().links()) {
+            platformComponentTemplates.add(LinkDto.newInstance(dtoFactory, PlatformComponentTemplate.class, t));
+        }
+        
+        applicationComponentTemplates = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponentTemplate> t: dtoFactory.getPlatform().applicationComponentTemplates().links()) {
+            applicationComponentTemplates.add(LinkDto.newInstance(dtoFactory, ApplicationComponentTemplate.class, t));
+        }
+
+        assemblyTemplates = new ArrayList<LinkDto>();
+        for (Link<AssemblyTemplate> t: dtoFactory.getPlatform().assemblyTemplates().links()) {
+            assemblyTemplates.add(LinkDto.newInstance(dtoFactory, AssemblyTemplate.class, t));
+        }
+
+        platformComponents = new ArrayList<LinkDto>();
+        for (Link<PlatformComponent> t: dtoFactory.getPlatform().platformComponents().links()) {
+            platformComponents.add(LinkDto.newInstance(dtoFactory, PlatformComponent.class, t));
+        }
+        
+        applicationComponents = new ArrayList<LinkDto>();
+        for (Link<ApplicationComponent> t: dtoFactory.getPlatform().applicationComponents().links()) {
+            applicationComponents.add(LinkDto.newInstance(dtoFactory, ApplicationComponent.class, t));
+        }
+
+        assemblies = new ArrayList<LinkDto>();
+        for (Link<Assembly> t: dtoFactory.getPlatform().assemblies().links()) {
+            assemblies.add(LinkDto.newInstance(dtoFactory, Assembly.class, t));
+        }
+
+        // TODO set custom fields
+
+        apidoc = LinkDto.newInstance(
+                dtoFactory.getUriFactory().uriOfRestResource(ApidocRestResource.class),
+                "API documentation");
+    }
+
+    // TODO add custom fields
+    private List<LinkDto> assemblyTemplates;
+    private List<LinkDto> platformComponentTemplates;
+    private List<LinkDto> applicationComponentTemplates;
+    private List<LinkDto> assemblies;
+    private List<LinkDto> platformComponents;
+    private List<LinkDto> applicationComponents;
+    
+    // non-CAMP, but useful
+    private LinkDto apidoc;
+    
+    public List<LinkDto> getAssemblyTemplates() {
+        return assemblyTemplates;
+    }
+    
+    public List<LinkDto> getPlatformComponentTemplates() {
+        return platformComponentTemplates;
+    }
+    
+    public List<LinkDto> getApplicationComponentTemplates() {
+        return applicationComponentTemplates;
+    }
+    
+    public List<LinkDto> getAssemblies() {
+        return assemblies;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getPlatformComponents() {
+        return platformComponents;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<LinkDto> getApplicationComponents() {
+        return applicationComponents;
+    }
+    
+    public LinkDto getApidoc() {
+        return apidoc;
+    }
+    
+    // --- building ---
+
+    public static PlatformDto newInstance(DtoFactory dtoFactory, PlatformRootSummary x) {
+        return new PlatformDto(dtoFactory, x);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
new file mode 100644
index 0000000..83987ff
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
@@ -0,0 +1,112 @@
+/*
+ * 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.camp.server.dto;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.brooklyn.camp.commontypes.RepresentationSkew;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+import brooklyn.util.time.Time;
+
+import com.fasterxml.jackson.annotation.JsonGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.databind.util.ISO8601Utils;
+
+public class ResourceDto extends DtoCustomAttributes {
+
+    protected ResourceDto() {}
+    protected ResourceDto(DtoFactory dtoFactory, AbstractResource x) {
+        type = x.getType();
+        name = x.getName();
+
+        description = x.getDescription();
+        setCreated(x.getCreated());
+        tags = x.getTags();
+        representationSkew = x.getRepresentationSkew();
+        
+        if (x.getCustomAttributes()!=null && !x.getCustomAttributes().isEmpty())
+            newInstanceCustomAttributes(x.getCustomAttributes());
+        
+        uri = dtoFactory.uri(x);
+    }
+    
+    private String uri;
+    private String type;
+    
+    private String name;
+    private String description;
+    private Date created;
+    private List<String> tags;
+    private RepresentationSkew representationSkew;
+
+    public String getUri() {
+        return uri;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    @JsonInclude(Include.NON_NULL)
+    public String getDescription() {
+        return description;
+    }
+    
+    @JsonGetter("created")
+    public String getCreatedAsString() {
+        return created==null ? null : ISO8601Utils.format(created);
+    }
+    
+    @JsonSetter
+    private void setCreated(Date created) {
+        this.created = Time.dropMilliseconds(created);
+    }
+
+    @JsonIgnore
+    public Date getCreated() {
+        return created;
+    }
+    
+    @JsonInclude(Include.NON_EMPTY)
+    public List<String> getTags() {
+        return tags;
+    }
+    
+    public String getType() {
+        return type;
+    }
+    
+    @JsonInclude(Include.NON_NULL)
+    public RepresentationSkew getRepresentationSkew() {
+        return representationSkew;
+    }
+
+    // --- building ---
+
+    public static ResourceDto newInstance(DtoFactory dtoFactory, AbstractResource x) {
+        return new ResourceDto(dtoFactory, x);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
new file mode 100644
index 0000000..2d3030c
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
@@ -0,0 +1,69 @@
+/*
+ * 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.camp.server.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.server.rest.resource.AbstractCampRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApidocRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.rest.apidoc.ApidocHelpMessageBodyWriter;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+import com.google.common.collect.Iterables;
+
+public class CampRestResources {
+
+    public static Iterable<AbstractCampRestResource> getCampRestResources() {
+        List<AbstractCampRestResource> resources = new ArrayList<AbstractCampRestResource>();
+        resources.add(new PlatformRestResource());
+        resources.add(new AssemblyTemplateRestResource());
+        resources.add(new PlatformComponentTemplateRestResource());
+        resources.add(new ApplicationComponentTemplateRestResource());
+        resources.add(new AssemblyRestResource());
+        resources.add(new PlatformComponentRestResource());
+        resources.add(new ApplicationComponentRestResource());
+        return resources;
+    }
+
+    public static Iterable<Object> getApidocResources() {
+        List<Object> resources = new ArrayList<Object>();
+        resources.add(new ApidocHelpMessageBodyWriter());
+        resources.add(new ApidocRestResource());
+        return resources;
+    }
+
+    public static Iterable<Object> getMiscResources() {
+        List<Object> resources = new ArrayList<Object>();
+        resources.add(new JacksonJsonProvider());
+        return resources;
+    }
+
+    public static Iterable<Object> getAllResources() {
+        return Iterables.concat(getCampRestResources(), getApidocResources(), getMiscResources());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
new file mode 100644
index 0000000..1ad931b
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
@@ -0,0 +1,185 @@
+/*
+ * 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.camp.server.rest;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.EnumSet;
+
+import javax.servlet.DispatcherType;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.net.Networking;
+
+import com.google.common.base.Charsets;
+import com.google.common.io.Files;
+import com.sun.jersey.api.core.DefaultResourceConfig;
+import com.sun.jersey.api.core.ResourceConfig;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+
+public class CampServer {
+
+    private static final Logger log = LoggerFactory.getLogger(CampServer.class);
+
+    public static final String CAMP_PLATFORM_ATTRIBUTE = CampPlatform.class.getCanonicalName();
+    public static final String DTO_FACTORY = DtoFactory.class.getCanonicalName();
+    
+    private final CampPlatform platform;
+    private final String uriBase;
+    private DtoFactory dtoFactory;
+    
+    WebAppContext webAppContext;
+    Server server;
+    
+    public CampServer(CampPlatform platform, String uriBase) {
+        this.platform = platform;
+        this.uriBase = uriBase;
+    }
+
+    public CampPlatform getPlatform() {
+        return platform;
+    }
+
+    public String getUriBase() {
+        return uriBase;
+    }
+    
+    public WebAppContext getWebAppContext() {
+        return webAppContext;
+    }
+    
+    public synchronized DtoFactory getDtoFactory() {
+        if (dtoFactory!=null) return dtoFactory;
+        dtoFactory = createDtoFactory();
+        return dtoFactory;
+    }
+    
+    protected DtoFactory createDtoFactory() {
+        return new DtoFactory(getPlatform(), getUriBase());
+    }
+    
+    public synchronized CampServer start() {
+        if (webAppContext!=null)
+            throw new IllegalStateException("Already started");
+        
+        webAppContext = new WebAppContext();
+        webAppContext.setContextPath("/");
+        webAppContext.setAttribute(CAMP_PLATFORM_ATTRIBUTE, getPlatform());
+        webAppContext.setAttribute(DTO_FACTORY, getDtoFactory());
+        webAppContext.setWar(
+                // TODO if there is a GUI or other war...
+                //findJsguiWebapp()!=null ? findJsguiWebapp() : 
+                CampServerUtils.createTempWebDirWithIndexHtml("CAMP REST API <p> (no gui available - " +
+                        "rest endpoint at <a href=\""+PlatformRestResource.CAMP_URI_PATH+"\">"+PlatformRestResource.CAMP_URI_PATH+"</a>)"));
+        CampServerUtils.installAsServletFilter(webAppContext);
+        
+        server = CampServerUtils.startServer(webAppContext, "CAMP server");
+        
+        return this;
+    }
+
+    public synchronized void stop() {
+        try {
+            server.stop();
+            server = null;
+            webAppContext.stop();
+            webAppContext = null;
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+    public Integer getPort() {
+        if (server==null) return null;
+        return server.getConnectors()[0].getLocalPort();
+    }
+
+    public static class CampServerUtils {
+
+        public static void installAsServletFilter(ServletContextHandler context) {
+            // TODO security
+            //        installBrooklynPropertiesSecurityFilter(context);
+
+            // now set up the REST servlet resources
+            ResourceConfig config = new DefaultResourceConfig();
+            // load all our REST API modules, JSON, and Swagger
+            for (Object r: CampRestResources.getAllResources())
+                config.getSingletons().add(r);
+
+            // configure to match empty path, or any thing which looks like a file path with /assets/ and extension html, css, js, or png
+            // and treat that as static content
+            config.getProperties().put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, "(/?|[^?]*/assets/[^?]+\\.[A-Za-z0-9_]+)");
+
+            // and anything which is not matched as a servlet also falls through (but more expensive than a regex check?)
+            config.getFeatures().put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, true);
+
+            // finally create this as a _filter_ which falls through to a web app or something (optionally)
+            FilterHolder filterHolder = new FilterHolder(new ServletContainer(config));
+            context.addFilter(filterHolder, "/*", EnumSet.allOf(DispatcherType.class));
+        }
+
+        public static Server startServer(ContextHandler context, String summary) {
+            // FIXME port hardcoded
+            int port = Networking.nextAvailablePort(8080);
+            Server server = new Server(port);
+            server.setHandler(context);
+            
+            // use a nice name in the thread pool (otherwise this is exactly the same as Server defaults)
+            QueuedThreadPool threadPool = new QueuedThreadPool();
+            threadPool.setName("camp-jetty-server-"+port+"-"+threadPool.getName());
+            server.setThreadPool(threadPool);
+
+            try {
+                server.start();
+            } catch (Exception e) {
+                throw Exceptions.propagate(e);
+            } 
+            log.info("CAMP REST server started ("+summary+") on");
+            log.info("  http://localhost:"+server.getConnectors()[0].getLocalPort()+"/");
+
+            return server;
+        }
+        
+        /** create a directory with a simple index.html so we have some content being served up */
+        public static String createTempWebDirWithIndexHtml(String indexHtmlContent) {
+            File dir = Files.createTempDir();
+            dir.deleteOnExit();
+            try {
+                Files.write(indexHtmlContent, new File(dir, "index.html"), Charsets.UTF_8);
+            } catch (IOException e) {
+                Exceptions.propagate(e);
+            }
+            return dir.getAbsolutePath();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java
new file mode 100644
index 0000000..ed8a09c
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java
@@ -0,0 +1,56 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.core.Context;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.rest.util.CampRestContext;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.server.rest.util.WebResourceUtils;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+
+public abstract class AbstractCampRestResource {
+
+    // can be injected by jersey when not injected manually
+    // (seems there is no way to make this optional so note it _must_ be injected; if needed
+    // see notes on workarounds for test frameworks in original AbstractBrooklynRestResource)
+    @Context ServletContext servletContext;
+    
+    private CampRestContext campRestContext;
+    
+    public synchronized CampRestContext context() {
+        if (campRestContext!=null) return campRestContext;
+        campRestContext = new CampRestContext(servletContext);
+        return campRestContext;
+    }
+    
+    public CampPlatform camp() { return context().camp(); }
+    public DtoFactory dto() { return context().dto(); }
+
+    public static <T extends AbstractResource> T lookup(ResourceLookup<T> list, String id) {
+        T result = list.get(id);
+        if (result==null)
+            throw WebResourceUtils.notFound("No such element: %s", id);
+        return result;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java
new file mode 100644
index 0000000..398ad17
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java
@@ -0,0 +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.camp.server.rest.resource;
+
+import javax.ws.rs.Path;
+
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+@Path(ApidocRestResource.API_URI_PATH)
+@Apidoc("Web API Documentation")
+public class ApidocRestResource extends org.apache.brooklyn.rest.apidoc.ApidocResource {
+
+    public static final String API_URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/apidoc";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java
new file mode 100644
index 0000000..8d2f8d1
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentDto;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(ApplicationComponentRestResource.URI_PATH)
+@Apidoc("Application Component resources")
+@Produces("application/json")
+public class ApplicationComponentRestResource extends AbstractCampRestResource {
+
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/application-components";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific application component",
+        responseClass = ApplicationComponentDto.CLASS_NAME)
+    @GET
+    public ApplicationComponentDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().applicationComponents(), id));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java
new file mode 100644
index 0000000..3ce76e7
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(ApplicationComponentTemplateRestResource.URI_PATH)
+@Apidoc("Application Component Template resources")
+@Produces("application/json")
+public class ApplicationComponentTemplateRestResource extends AbstractCampRestResource {
+
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/application-component-templates";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific application component template",
+        responseClass = ApplicationComponentTemplateDto.CLASS_NAME)
+    @GET
+    public ApplicationComponentTemplateDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().applicationComponentTemplates(), id));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java
new file mode 100644
index 0000000..100bbf9
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java
@@ -0,0 +1,51 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.apache.brooklyn.camp.server.dto.AssemblyDto;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(AssemblyRestResource.URI_PATH)
+@Apidoc("Assembly resources")
+@Produces("application/json")
+public class AssemblyRestResource extends AbstractCampRestResource {
+
+//    private static final Logger log = LoggerFactory.getLogger(AssemblyRestResource.class);
+    
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/assemblies";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific assembly",
+            responseClass = AssemblyDto.CLASS_NAME)
+    @GET
+    public AssemblyDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().assemblies(), id));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java
new file mode 100644
index 0000000..f4a1c91
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java
@@ -0,0 +1,87 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import java.net.URI;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.brooklyn.camp.server.dto.AssemblyTemplateDto;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import brooklyn.util.exceptions.Exceptions;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(AssemblyTemplateRestResource.URI_PATH)
+@Apidoc("Assembly Template resources")
+@Produces("application/json")
+public class AssemblyTemplateRestResource extends AbstractCampRestResource {
+
+    private static final Logger log = LoggerFactory.getLogger(AssemblyTemplateRestResource.class);
+    
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/assembly-templates";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific assembly template",
+            responseClass = AssemblyTemplateDto.CLASS_NAME)
+    @GET
+    public AssemblyTemplateDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().assemblyTemplates(), id));
+    }
+
+    @Path("/{id}")
+    @ApiOperation(value = "Instantiate a specific assembly template"
+    // TODO AssemblyDto, or location thereto?
+//            , responseClass = AssemblyTemplateDto.CLASS_NAME
+            )
+    @POST
+    public Response post(
+            @Context UriInfo info,
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        try {
+            log.info("CAMP REST instantiating AT "+id);
+            AssemblyTemplate at = lookup(camp().assemblyTemplates(), id);
+            Assembly assembly = at.getInstantiator().newInstance().instantiate(at, camp());
+            // see http://stackoverflow.com/questions/13702481/javax-response-prepends-method-path-when-setting-location-header-path-on-status
+            // for why we have to return absolute path
+            URI assemblyUri = info.getBaseUriBuilder().path( dto().adapt(assembly).getUri() ).build();
+            return Response.created(assemblyUri).build();
+        } catch (Exception e) {
+            log.error("Unable to create AT "+id+": "+e);
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java
new file mode 100644
index 0000000..9bc725b
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.apache.brooklyn.camp.server.dto.PlatformComponentDto;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(PlatformComponentRestResource.URI_PATH)
+@Apidoc("Platform Component resources")
+@Produces("application/json")
+public class PlatformComponentRestResource extends AbstractCampRestResource {
+
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/platform-components";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific platform component",
+            responseClass = PlatformComponentDto.CLASS_NAME)
+    @GET
+    public PlatformComponentDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().platformComponents(), id));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java
new file mode 100644
index 0000000..c3686be
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+import com.wordnik.swagger.core.ApiParam;
+
+@Path(PlatformComponentTemplateRestResource.URI_PATH)
+@Apidoc("Platform Component Template resources")
+@Produces("application/json")
+public class PlatformComponentTemplateRestResource extends AbstractCampRestResource {
+
+    public static final String URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/platform-component-templates";
+
+    @Path("/{id}")
+    @ApiOperation(value = "Get a specific platform component template",
+            responseClass = PlatformComponentTemplateDto.CLASS_NAME)
+    @GET
+    public PlatformComponentTemplateDto get(
+            @ApiParam(value = "ID of item being retrieved", required = true)
+            @PathParam("id") String id) {
+        return dto().adapt(lookup(camp().platformComponentTemplates(), id));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java
new file mode 100644
index 0000000..16dfa25
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java
@@ -0,0 +1,87 @@
+/*
+ * 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.camp.server.rest.resource;
+
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.brooklyn.camp.server.dto.PlatformDto;
+import org.apache.brooklyn.camp.server.rest.util.WebResourceUtils;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.rest.apidoc.Apidoc;
+
+import com.wordnik.swagger.core.ApiOperation;
+
+//import io.brooklyn.camp.rest.apidoc.Apidoc;
+
+@Path(PlatformRestResource.CAMP_URI_PATH)
+@Apidoc("Platform (root)")
+@Produces("application/json")
+public class PlatformRestResource extends AbstractCampRestResource {
+
+    private static final Logger log = LoggerFactory.getLogger(PlatformRestResource.class);
+    
+    public static final String CAMP_URI_PATH = "/camp/v11";
+    
+    @ApiOperation(value = "Return the Platform (root) resource",
+            responseClass = PlatformDto.CLASS_NAME)
+    @GET
+    public PlatformDto get() {
+        return dto().adapt(camp().root());
+    }
+    
+    @POST
+    @Consumes({MediaType.APPLICATION_JSON})
+    public Response postJson(@Context UriInfo info, String json) {
+        return postYaml(info, json);
+    }
+
+    @POST
+    @Consumes({"application/x-yaml"})
+    public Response postYaml(@Context UriInfo info, String yaml) {
+        log.debug("YAML pdp:\n"+yaml);
+        AssemblyTemplate template = camp().pdp().registerDeploymentPlan(new StringReader(yaml));
+        return created(info, template);
+    }
+
+    @POST
+    @Consumes({"application/x-tar", "application/x-tgz", "application/x-zip"})
+    public Response postArchive(@Context UriInfo info, InputStream archiveInput) {
+        log.debug("ARCHIVE pdp");
+        AssemblyTemplate template = camp().pdp().registerPdpFromArchive(archiveInput);
+        return created(info, template);
+    }
+
+    protected Response created(UriInfo info, AssemblyTemplate template) {
+        return WebResourceUtils.created(info, dto().adapt(template).getUri());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java
new file mode 100644
index 0000000..7c67d81
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java
@@ -0,0 +1,39 @@
+/*
+ * 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.camp.server.rest.util;
+
+import brooklyn.util.exceptions.Exceptions;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class CampJsons {
+
+    public static String prettyJson(Object o) {
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.enable(SerializationFeature.INDENT_OUTPUT);
+            return mapper.writeValueAsString(o);
+        } catch (JsonProcessingException e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java
new file mode 100644
index 0000000..66d6cf8
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java
@@ -0,0 +1,50 @@
+/*
+ * 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.camp.server.rest.util;
+
+import javax.servlet.ServletContext;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+
+import com.google.common.base.Preconditions;
+
+public class CampRestContext {
+
+    private final ServletContext servletContext;
+    private CampPlatform platform;
+    private DtoFactory dto;
+    
+    public CampRestContext(ServletContext servletContext) {
+        this.servletContext = servletContext;
+    }
+
+    public synchronized CampPlatform camp() {
+        if (platform!=null) return platform;
+        platform = (CampPlatform) servletContext.getAttribute(CampServer.CAMP_PLATFORM_ATTRIBUTE);
+        return Preconditions.checkNotNull(platform, "CAMP platform instance not available from ServletContext");
+    }
+
+    public DtoFactory dto() {
+        if (dto!=null) return dto;
+        dto = (DtoFactory) servletContext.getAttribute(CampServer.DTO_FACTORY);
+        return Preconditions.checkNotNull(dto, "CAMP DTO factory instance not available from ServletContext");
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java
new file mode 100644
index 0000000..22758a4
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java
@@ -0,0 +1,32 @@
+/*
+ * 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.camp.server.rest.util;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+import com.google.common.base.Function;
+
+public class CampRestGuavas {
+
+    public static final Function<AbstractResource,String> IDENTITY_OF_REST_RESOURCE = 
+            new Function<AbstractResource,String>() {
+                public String apply(AbstractResource input) { return input.getId(); }
+            };
+
+}



[7/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Artifact.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Artifact.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Artifact.java
deleted file mode 100644
index 697a3ba..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Artifact.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.yaml.Yamls;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class Artifact {
-
-    String name;
-    String description;
-    String artifactType;
-    
-    ArtifactContent content;
-    List<ArtifactRequirement> requirements;
-    
-    Map<String,Object> customAttributes;
-    
-    @SuppressWarnings("unchecked")
-    public static Artifact of(Map<String, Object> artifact) {
-        Map<String,Object> fields = MutableMap.copyOf(artifact);
-        
-        Artifact result = new Artifact();
-        result.name = (String) fields.remove("name");
-        result.description = (String) fields.remove("description");
-        result.artifactType = (String) (String) Yamls.removeMultinameAttribute(fields, "artifactType", "type");
-        
-        result.content = ArtifactContent.of( fields.remove("content") );
-        
-        result.requirements = new ArrayList<ArtifactRequirement>();
-        Object reqs = fields.remove("requirements");
-        if (reqs instanceof Iterable) {
-            for (Object req: (Iterable<Object>)reqs) {
-                if (req instanceof Map) {
-                    result.requirements.add(ArtifactRequirement.of((Map<String,Object>) req));
-                } else {
-                    throw new IllegalArgumentException("requirement should be a map, not "+req.getClass());
-                }
-            }
-        } else if (reqs!=null) {
-            // TODO "map" short form
-            throw new IllegalArgumentException("artifacts body should be iterable, not "+reqs.getClass());
-        }
-        
-        result.customAttributes = fields;
-        
-        return result;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public String getArtifactType() {
-        return artifactType;
-    }
-    public ArtifactContent getContent() {
-        return content;
-    }
-    public List<ArtifactRequirement> getRequirements() {
-        return ImmutableList.copyOf(requirements);
-    }
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-    
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactContent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactContent.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactContent.java
deleted file mode 100644
index e6d1b05..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactContent.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-
-import com.google.common.collect.ImmutableMap;
-
-public class ArtifactContent {
-
-    String href;
-    Map<String,Object> customAttributes;
-    
-    public static ArtifactContent of(Object spec) {
-        if (spec==null) return null;
-        
-        ArtifactContent result = new ArtifactContent();
-        if (spec instanceof String) {
-            result.href = (String)spec;
-        } else if (spec instanceof Map) {
-            @SuppressWarnings("unchecked")
-            Map<String,Object> attrs = MutableMap.copyOf( (Map<String,Object>) spec );
-            result.href = (String) attrs.remove("href");
-            result.customAttributes = attrs;            
-        } else {
-            throw new IllegalArgumentException("artifact content should be map or string, not "+spec.getClass());
-        }
-        
-        return result;
-    }
-
-    public String getHref() {
-        return href;
-    }
-    
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactRequirement.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactRequirement.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactRequirement.java
deleted file mode 100644
index da9936a..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ArtifactRequirement.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.yaml.Yamls;
-
-import com.google.common.collect.ImmutableMap;
-
-public class ArtifactRequirement {
-
-    String name;
-    String description;
-    String requirementType;
-    
-    Map<String,Object> customAttributes;
-    
-    public static ArtifactRequirement of(Map<String, Object> req) {
-        Map<String,Object> attrs = MutableMap.copyOf(req);
-        
-        ArtifactRequirement result = new ArtifactRequirement();
-        result.name = (String) attrs.remove("name");
-        result.description = (String) attrs.remove("description");
-        result.requirementType = (String) (String) Yamls.removeMultinameAttribute(attrs, "requirementType", "type");
-        
-        // TODO fulfillment
-        
-        result.customAttributes = attrs;
-        
-        return result;
-    }
-
-    public String getName() {
-        return name;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public String getRequirementType() {
-        return requirementType;
-    }
-    
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-    
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
deleted file mode 100644
index c535754..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate.Builder;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformTransaction;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
-public class AssemblyTemplateConstructor {
-
-    private final Builder<? extends AssemblyTemplate> builder;
-    private final CampPlatform campPlatform;
-    protected PlatformTransaction transaction;
-
-    public AssemblyTemplateConstructor(CampPlatform campPlatform) {
-        this.campPlatform = campPlatform;
-        this.builder = AssemblyTemplate.builder();
-        this.transaction = this.campPlatform.transaction();
-    }
-    
-    /** records all the templates to the underlying platform */
-    public AssemblyTemplate commit() {
-        checkState();
-        AssemblyTemplate at = builder.build();
-        transaction.add(at).commit();
-        transaction = null;
-        return at;
-    }
-
-    public void name(String name) {
-        checkState();
-        builder.name(name);
-    }
-
-    public void description(String description) {
-        checkState();
-        builder.description(description);
-    }
-
-
-    public void sourceCode(String sourceCode) {
-        checkState();
-        builder.sourceCode(sourceCode);
-    }
-
-    public void addCustomAttributes(Map<String, Object> attrs) {
-        for (Map.Entry<String, Object> attr : attrs.entrySet())
-            builder.customAttribute(attr.getKey(), attr.getValue());
-    }
-
-    public void instantiator(Class<? extends AssemblyTemplateInstantiator> instantiator) {
-        checkState();
-        builder.instantiator(instantiator);
-    }
-    
-    public Class<? extends AssemblyTemplateInstantiator> getInstantiator() {
-        checkState();
-        return builder.peek().getInstantiator();
-    }
-    
-    public void add(ApplicationComponentTemplate act) {
-        checkState();
-        builder.add(act);
-        transaction.add(act);
-    }
-
-    public void add(PlatformComponentTemplate pct) {
-        checkState();
-        builder.add(pct);
-        transaction.add(pct);
-    }
-
-    protected void checkState() {
-        if (transaction == null)
-            throw new IllegalStateException("transaction already committed");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/DeploymentPlan.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/DeploymentPlan.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/DeploymentPlan.java
deleted file mode 100644
index df2d895..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/DeploymentPlan.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.guava.Maybe;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class DeploymentPlan {
-
-    String name;
-    String origin;
-    String description;
-    String sourceCode;
-    
-    List<Artifact> artifacts;
-    List<Service> services;
-    Map<String,Object> customAttributes;
-
-    @Deprecated /** @deprecated since 0.7.0; supply source code also, for reference */
-    public static DeploymentPlan of(Map<String,Object> root) {
-        return of(root, null);
-    }
-    @SuppressWarnings("unchecked")
-    public static DeploymentPlan of(Map<String,Object> root, String optionalSourceCode) {
-        Map<String,Object> attrs = MutableMap.copyOf(root);
-        
-        DeploymentPlan result = new DeploymentPlan();
-        result.name = (String) attrs.remove("name");
-        result.description = (String) attrs.remove("description");
-        result.origin = (String) attrs.remove("origin");
-        result.sourceCode = optionalSourceCode;
-        // TODO version
-        
-        result.services = new ArrayList<Service>();
-        Object services = attrs.remove("services");
-        if (services instanceof Iterable) {
-            for (Object service: (Iterable<Object>)services) {
-                if (service instanceof Map) {
-                    result.services.add(Service.of((Map<String,Object>) service));
-                } else {
-                    throw new IllegalArgumentException("service should be map, not "+service.getClass());
-                }
-            }
-        } else if (services!=null) {
-            // TODO "map" short form
-            throw new IllegalArgumentException("artifacts body should be iterable, not "+services.getClass());
-        }
-        
-        result.artifacts = new ArrayList<Artifact>();
-        Object artifacts = attrs.remove("artifacts");
-        if (artifacts instanceof Iterable) {
-            for (Object artifact: (Iterable<Object>)artifacts) {
-                if (artifact instanceof Map) {
-                    result.artifacts.add(Artifact.of((Map<String,Object>) artifact));
-                } else {
-                    throw new IllegalArgumentException("artifact should be map, not "+artifact.getClass());
-                }
-            }
-        } else if (artifacts!=null) {
-            // TODO "map" short form
-            throw new IllegalArgumentException("artifacts body should be iterable, not "+artifacts.getClass());
-        }
-        
-        result.customAttributes = attrs;
-        
-        return result;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public String getOrigin() {
-        return origin;
-    }
-
-    public String getSourceCode() {
-        return sourceCode;
-    }
-    
-    public List<Artifact> getArtifacts() {
-        return ImmutableList.copyOf(artifacts);
-    }
-
-    public List<Service> getServices() {
-        return ImmutableList.copyOf(services);
-    }
-
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-
-    /**
-     * Returns a present {@link Maybe} of the custom attribute with the given name if the attribute is
-     * non-null and is an instance of the given type. Otherwise returns absent.
-     * <p/>
-     * Does not remove the attribute from the custom attribute map.
-     */
-    @SuppressWarnings("unchecked")
-    public <T> Maybe<T> getCustomAttribute(String attributeName, Class<T> type, boolean throwIfTypeMismatch) {
-        Object attribute = customAttributes.get(attributeName);
-        if (attribute == null) {
-            return Maybe.absent("Custom attributes does not contain " + attributeName);
-        } else if (!type.isAssignableFrom(attribute.getClass())) {
-            String message = "Custom attribute " + attributeName + " is not of expected type: " +
-                    "expected=" + type.getName() + " actual=" + attribute.getClass().getName();
-            if (throwIfTypeMismatch) {
-                throw new IllegalArgumentException(message);
-            }
-            return Maybe.absent(message);
-        } else {
-            return Maybe.of((T) attribute);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Service.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Service.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Service.java
deleted file mode 100644
index dbd55b3..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/Service.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.yaml.Yamls;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class Service {
-
-    String name;
-    String description;
-    String serviceType;
-    
-    List<ServiceCharacteristic> characteristics;
-    
-    Map<String,Object> customAttributes;
-    
-    @SuppressWarnings("unchecked")
-    public static Service of(Map<String, Object> service) {
-        Map<String,Object> fields = MutableMap.copyOf(service);
-        
-        Service result = new Service();
-        result.name = (String) fields.remove("name");
-        result.description = (String) fields.remove("description");
-        // FIXME _type needed in lots of places
-        result.serviceType = (String) Yamls.removeMultinameAttribute(fields, "service_type", "serviceType", "type");
-        
-        result.characteristics = new ArrayList<ServiceCharacteristic>();
-        Object chars = fields.remove("characteristics");
-        if (chars instanceof Iterable) {
-            for (Object req: (Iterable<Object>)chars) {
-                if (req instanceof Map) {
-                    result.characteristics.add(ServiceCharacteristic.of((Map<String,Object>) req));
-                } else {
-                    throw new IllegalArgumentException("characteristics should be a map, not "+req.getClass());
-                }
-            }
-        } else if (chars!=null) {
-            // TODO "map" short form
-            throw new IllegalArgumentException("services body should be iterable, not "+chars.getClass());
-        }
-        
-        result.customAttributes = fields;
-        
-        return result;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public String getServiceType() {
-        return serviceType;
-    }
-    public List<ServiceCharacteristic> getCharacteristics() {
-        return ImmutableList.copyOf(characteristics);
-    }
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-    
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ServiceCharacteristic.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
deleted file mode 100644
index 8b27e2a..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.yaml.Yamls;
-
-import com.google.common.collect.ImmutableMap;
-
-public class ServiceCharacteristic {
-
-    String name;
-    String description;
-    String characteristicType;
-    
-    Map<String,Object> customAttributes;
-    
-    public static ServiceCharacteristic of(Map<String, Object> req) {
-        Map<String,Object> attrs = MutableMap.copyOf(req);
-        
-        ServiceCharacteristic result = new ServiceCharacteristic();
-        result.name = (String) attrs.remove("name");
-        result.description = (String) attrs.remove("description");
-        result.characteristicType = (String) Yamls.removeMultinameAttribute(attrs, "characteristicType", "type");
-        
-        // TODO fulfillment
-        
-        result.customAttributes = attrs;
-        
-        return result;
-    }
-
-    public String getName() {
-        return name;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public String getCharacteristicType() {
-        return characteristicType;
-    }
-    
-    public Map<String, Object> getCustomAttributes() {
-        return ImmutableMap.copyOf(customAttributes);
-    }
-    
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpMatcher.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpMatcher.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpMatcher.java
deleted file mode 100644
index 94c8691..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpMatcher.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.resolve;
-
-import io.brooklyn.camp.spi.pdp.Artifact;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
-import io.brooklyn.camp.spi.pdp.Service;
-
-/** Matchers build up the AssemblyTemplate by matching against items in the deployment plan */
-public interface PdpMatcher {
-
-    boolean accepts(Object deploymentPlanItem);
-    boolean apply(Object deploymentPlanItem, AssemblyTemplateConstructor atc);
-
-    public abstract class ArtifactMatcher implements PdpMatcher {
-        private String artifactType;
-        public ArtifactMatcher(String artifactType) {
-            this.artifactType = artifactType;
-        }
-        public boolean accepts(Object art) {
-            return (art instanceof Artifact) && this.artifactType.equals( ((Artifact)art).getArtifactType() );
-        }
-    }
-    
-    public abstract class ServiceMatcher implements PdpMatcher {
-        private String serviceType;
-        public ServiceMatcher(String serviceType) {
-            this.serviceType = serviceType;
-        }
-        public boolean accepts(Object svc) {
-            return (svc instanceof Service) && this.serviceType.equals( ((Service)svc).getServiceType() );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpProcessor.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpProcessor.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpProcessor.java
deleted file mode 100644
index e4bc537..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PdpProcessor.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.resolve;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
-import io.brooklyn.camp.spi.pdp.Artifact;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
-import io.brooklyn.camp.spi.pdp.DeploymentPlan;
-import io.brooklyn.camp.spi.pdp.Service;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationContext;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.ArchiveStreamFactory;
-import org.yaml.snakeyaml.error.YAMLException;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.stream.Streams;
-import brooklyn.util.yaml.Yamls;
-
-import com.google.common.annotations.VisibleForTesting;
-
-public class PdpProcessor {
-
-    final CampPlatform campPlatform;
-    
-    final List<PdpMatcher> matchers = new ArrayList<PdpMatcher>();
-    final List<PlanInterpreter> interpreters = new ArrayList<PlanInterpreter>();
-    
-    public PdpProcessor(CampPlatform campPlatform) {
-        this.campPlatform = campPlatform;
-    }
-
-    public DeploymentPlan parseDeploymentPlan(Reader yaml) {
-        return parseDeploymentPlan(Streams.readFully(yaml));
-    }
-    
-    @SuppressWarnings("unchecked")
-    public DeploymentPlan parseDeploymentPlan(String yaml) {
-        Iterable<Object> template = Yamls.parseAll(yaml);
-        
-        Map<String, Object> dpRootUninterpreted = null;
-        try {
-            dpRootUninterpreted = Yamls.getAs(template, Map.class);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            throw new YAMLException("Plan not in acceptable format: "+(e.getMessage()!=null ? e.getMessage() : ""+e), e);
-        }
-        Map<String, Object> dpRootInterpreted = applyInterpreters(dpRootUninterpreted);
-        
-        return DeploymentPlan.of(dpRootInterpreted, yaml);
-    }
-    
-    /** create and return an AssemblyTemplate based on the given DP (yaml) */
-    public AssemblyTemplate registerDeploymentPlan(Reader yaml) {
-        DeploymentPlan plan = parseDeploymentPlan(yaml);
-        return registerDeploymentPlan(plan);
-    }
-
-    /** applies matchers to the given deployment plan to create an assembly template */
-    public AssemblyTemplate registerDeploymentPlan(DeploymentPlan plan) {
-        AssemblyTemplateConstructor atc = new AssemblyTemplateConstructor(campPlatform);
-        
-        if (plan.getName()!=null) atc.name(plan.getName());
-        if (plan.getDescription()!=null) atc.description(plan.getDescription());
-        if (plan.getSourceCode()!=null) atc.sourceCode(plan.getSourceCode());
-        // nothing done with origin just now...
-        
-        if (plan.getServices()!=null) {
-            for (Service svc: plan.getServices()) {
-                applyMatchers(svc, atc);
-            }
-        }
-
-        if (plan.getArtifacts()!=null) {
-            for (Artifact art: plan.getArtifacts()) {
-                applyMatchers(art, atc);
-            }
-        }
-
-        Map<String, Object> attrs = plan.getCustomAttributes();
-        if (attrs!=null && !attrs.isEmpty()) {
-            Map<String, Object> customAttrs = attrs;
-            if (customAttrs.containsKey("id")) {
-                // id shouldn't be leaking to entities, see InternalEntityFactory.createEntityAndDescendantsUninitialized.
-                // If set it will go through to the spec because AbstractBrooklynObject has @SetFromFlag("id") on the id property.
-                // Follows logic in BrooklynEntityMatcher.apply(...).
-                customAttrs = MutableMap.copyOf(attrs);
-                customAttrs.put("planId", customAttrs.remove("id"));
-            }
-            atc.addCustomAttributes(customAttrs);
-        }
-        
-        if (atc.getInstantiator()==null)
-            // set a default instantiator which just invokes the component's instantiators
-            // (or throws unsupported exceptions, currently!)
-            atc.instantiator(BasicAssemblyTemplateInstantiator.class);
-
-        return atc.commit();
-    }
-    
-    public AssemblyTemplate registerPdpFromArchive(InputStream archiveInput) {
-        try {
-            ArchiveInputStream input = new ArchiveStreamFactory()
-                .createArchiveInputStream(archiveInput);
-            
-            while (true) {
-                ArchiveEntry entry = input.getNextEntry();
-                if (entry==null) break;
-                // TODO unpack entry, create a space on disk holding the archive ?
-            }
-
-            // use yaml...
-            throw new UnsupportedOperationException("in progress");
-            
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-
-    // ----------------------------
-    
-    public void addMatcher(PdpMatcher m) {
-        // TODO a list is a crude way to do matching ... but good enough to start
-        matchers.add(m);
-    }
-
-    public List<PdpMatcher> getMatchers() {
-        return matchers;
-    }
-
-
-    protected void applyMatchers(Object deploymentPlanItem, AssemblyTemplateConstructor atc) {
-        for (PdpMatcher matcher: getMatchers()) {
-            if (matcher.accepts(deploymentPlanItem)) {
-                // TODO first accepting is a crude way to do matching ... but good enough to start
-                if (matcher.apply(deploymentPlanItem, atc))
-                    return;
-            }
-        }
-        throw new UnsupportedOperationException("Deployment plan item "+deploymentPlanItem+" cannot be matched");
-    }
-
-    // ----------------------------
-
-    public void addInterpreter(PlanInterpreter interpreter) {
-        interpreters.add(interpreter);
-    }
-    
-    /** returns a DeploymentPlan object which is the result of running the interpretation
-     * (with all interpreters) against the supplied deployment plan YAML object,
-     * essentially a post-parse processing step before matching */
-    @SuppressWarnings("unchecked")
-    @VisibleForTesting
-    public Map<String, Object> applyInterpreters(Map<String, Object> originalDeploymentPlan) {
-        PlanInterpretationNode interpretation = new PlanInterpretationNode(
-                new PlanInterpretationContext(originalDeploymentPlan, interpreters));
-        return (Map<String, Object>) interpretation.getNewValue();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PlanInterpreter.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PlanInterpreter.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PlanInterpreter.java
deleted file mode 100644
index 402de34..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/PlanInterpreter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.resolve;
-
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
-
-import java.util.List;
-import java.util.Map;
-
-/** Interpreters modify the deployment plan, in a depth-first evaluation,
- * typically by looking for items which begin with "$namespace:"
- * <p>
- * Most common usages simple need to supply {@link #applyYamlPrimitive(PlanInterpretationNode)} which can invoke
- * {@link PlanInterpretationNode#setNewValue(Object)} to change.
- * The {@link PlanInterpreterAdapter} makes this easy by supplying all methods but that.
- * <p>
- * For more sophisticated usages, to act on entire maps or lists,
- * there are a number of other hook functions, described below.
- *  */
-public interface PlanInterpreter {
-
-    /** guard to prevent any apply calls when an Interpreter is not interested in a node */
-    boolean isInterestedIn(PlanInterpretationNode node);
-    
-    /** provides an opportunity for an interpreter to change the value at a node,
-     * using {@link PlanInterpretationNode#get()} and {@link PlanInterpretationNode#setNewValue(Object)} */
-    void applyYamlPrimitive(PlanInterpretationNode node);
-
-    /** invoked at a Map node in a YAML tree, before any conversion to mapOut.
-     * mapIn is initially a copy of {@link PlanInterpretationNode#get()}, but it is mutable,
-     * and any mutations are passed to subsequent interpreters and used for recursion.
-     * <p>
-     * the return value indicates whether to recurse into the item.
-     * if any interpreters return false, the node is not recursed. 
-     * (callers may use {@link PlanInterpretationNode#setNewValue(Object)} to set a custom return value.) */
-    boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn);
-
-    /** invoked at a Map node in a YAML tree, after {@link #applyMapBefore(PlanInterpretationNode, Map)},
-     * and after recursing into the value and then key arguments supplied here,
-     * but before inserting it into the mapOut for this node. 
-     * <p>
-     * the return value indicates whether to add this key-value to the mapOut.
-     * if any interpreters return false, the entry is not added. 
-     * (callers may modify mapOut to add/change values, or may modify key/value directly.) */
-    boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
-                            PlanInterpretationNode key, PlanInterpretationNode value);
-
-    /** invoked at a Map node in a YAML tree, after all entries have been passed to all interpreters' 
-     * {@link #applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode)}.
-     * mapOut can be modified yet further. */
-    void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut);
-
-    /** as {@link #applyMapBefore(PlanInterpretationNode, Map)} but for lists */
-    boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn);
-
-    /** as {@link #applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode) but for lists */
-    boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut,
-                            PlanInterpretationNode value);
-
-    /** as {@link #applyMapAfter(PlanInterpretationNode, Map, Map)} but for lists  */
-    void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut);
-
-    
-    public abstract static class PlanInterpreterAdapter implements PlanInterpreter {
-
-        @Override
-        public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
-            return true;
-        }
-
-        @Override
-        public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
-                                PlanInterpretationNode key, PlanInterpretationNode value) {
-            return true;
-        }
-
-        @Override
-        public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
-        }
-
-        @Override
-        public boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn) {
-            return true;
-        }
-
-        @Override
-        public boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut,
-                                PlanInterpretationNode value) {
-            return true;
-        }
-
-        @Override
-        public void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut) {
-        }
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
deleted file mode 100644
index 3c1abc8..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.resolve.interpret;
-
-import io.brooklyn.camp.spi.resolve.PlanInterpreter;
-
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class PlanInterpretationContext {
-
-    private final Map<String,Object> originalDeploymentPlan;
-    private final List<PlanInterpreter> interpreters;
-    private final PlanInterpreter allInterpreter;
-
-    public PlanInterpretationContext(Map<String,Object> originalDeploymentPlan, List<PlanInterpreter> interpreters) {
-        super();
-        this.originalDeploymentPlan = ImmutableMap.copyOf(originalDeploymentPlan);
-        this.interpreters = ImmutableList.copyOf(interpreters);
-        this.allInterpreter = new PlanInterpreter() {
-            @Override
-            public boolean isInterestedIn(PlanInterpretationNode node) {
-                return true;
-            }
-            
-            @Override
-            public void applyYamlPrimitive(PlanInterpretationNode node) {
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) {
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(node)) {
-                        i.applyYamlPrimitive(node);
-                    }
-                }
-            }
-
-            @Override
-            public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
-                boolean result = true;
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) {
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(node)) {
-                        boolean ri= i.applyMapBefore(node, mapIn);
-                        result &= ri;
-                    }
-                }
-                return result;
-            }
-
-            @Override
-            public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut, 
-                                    PlanInterpretationNode key, PlanInterpretationNode value) {
-                boolean result = true;
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(key)) {
-                        boolean ri = i.applyMapEntry(node, mapIn, mapOut, key, value);
-                        result &= ri;
-                    }
-                }
-                return result;
-            }
-
-            @Override
-            public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(node)) {
-                        i.applyMapAfter(node, mapIn, mapOut);
-                    }
-                }
-            }
-
-            @Override
-            public boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn) {
-                boolean result = true;
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(node)) {
-                        boolean ri = i.applyListBefore(node, listIn);
-                        result &= ri;
-                    }
-                }
-                return result;
-            }
-
-            @Override
-            public boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut, 
-                                    PlanInterpretationNode value) {
-                boolean result = true;
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(value)) {
-                        boolean ri = i.applyListEntry(node, listIn, listOut, value);
-                        result &= ri;
-                    }
-                }
-                return result;
-            }
-
-            @Override
-            public void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut) {
-                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
-                    if (node.isExcluded())
-                        break;
-                    if (i.isInterestedIn(node)) {
-                        i.applyListAfter(node, listIn, listOut);
-                    }
-                }
-            }
-
-        };
-    }
-
-    /** returns an interpreter which recurses through all interpreters */
-    PlanInterpreter getAllInterpreter() {
-        return allInterpreter;
-    }
-
-    public Map<String,Object> getOriginalDeploymentPlan() {
-        return originalDeploymentPlan;
-    }
-
-    public List<PlanInterpreter> getInterpreters() {
-        return interpreters;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java b/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
deleted file mode 100644
index 681df6b..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.resolve.interpret;
-
-import io.brooklyn.camp.spi.resolve.PlanInterpreter;
-
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.util.collections.MutableList;
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.text.StringPredicates;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-/** Helper class for {@link PlanInterpreter} instances, doing the recursive work */
-public class PlanInterpretationNode {
-
-    private static final Logger log = LoggerFactory.getLogger(PlanInterpretationNode.class);
-    
-    public enum Role { MAP_KEY, MAP_VALUE, LIST_ENTRY, YAML_PRIMITIVE }
-
-    protected final PlanInterpretationNode parent;
-    protected final Role roleInParent;
-    protected final Object originalValue;
-    protected final PlanInterpretationContext context;
-    protected Object newValue = null;
-    protected Boolean changed = null;
-    protected boolean excluded = false;
-    protected boolean immutable = false;
-
-    /** creates a root node with {@link #apply()} called */
-    public PlanInterpretationNode(PlanInterpretationContext context) {
-        this.parent = null;
-        this.roleInParent = null;
-        this.originalValue = context.getOriginalDeploymentPlan();
-        this.context = context;
-        apply();
-    }
-
-    /** internal use: creates an internal node on which {@link #apply()} has *not* been called */
-    protected PlanInterpretationNode(PlanInterpretationNode parent, Role roleInParent, Object originalItem) {
-        this.parent = parent;
-        this.roleInParent = roleInParent;
-        this.originalValue = originalItem;
-        this.context = parent.getContext();
-    }
-
-    public PlanInterpretationContext getContext() {
-        return context;
-    }
-
-    public PlanInterpretationNode getParent() {
-        return parent;
-    }
-    
-    public Role getRoleInParent() {
-        return roleInParent;
-    }
-    
-    protected void apply() {
-        if (changed!=null) throw new IllegalStateException("can only be applied once");
-
-        if (!excluded) {
-            if (originalValue instanceof Map) {
-                applyToMap();
-                immutable();
-            } else if (originalValue instanceof Iterable) {
-                applyToIterable();
-                immutable();
-            } else {
-                applyToYamlPrimitive();
-            }
-        }
-        
-        if (changed==null) changed = false;
-    }
-
-    /** convenience for interpreters, tests if nodes are not excluded, and if not:
-     * for string nodes, true iff the current value equals the given target;
-     * for nodes which are currently maps or lists,
-     * true iff not excluded and the value contains such an entry (key, in the case of map)
-     **/
-    public boolean matchesLiteral(String target) {
-        if (isExcluded()) return false; 
-        if (getNewValue() instanceof CharSequence)
-            return getNewValue().toString().equals(target);
-        if (getNewValue() instanceof Map)
-            return ((Map<?,?>)getOriginalValue()).containsKey(target);
-        if (getNewValue() instanceof Iterable)
-            return Iterables.contains((Iterable<?>)getOriginalValue(), target);
-        return false;
-    }
-
-    /** convenience for interpreters, tests if nodes are not excluded, and if not:
-     * for string nodes, true iff the current value starts with the given prefix;
-     * for nodes which are currently maps or lists,
-     * true iff not excluded and the value contains such an entry (key, in the case of map) */
-    public boolean matchesPrefix(String prefix) {
-        if (isExcluded()) return false; 
-        if (getNewValue() instanceof CharSequence)
-            return getNewValue().toString().startsWith(prefix);
-        if (getNewValue() instanceof Map)
-            return Iterables.tryFind(((Map<?,?>)getNewValue()).keySet(), StringPredicates.isStringStartingWith(prefix)).isPresent();
-        if (getNewValue() instanceof Iterable)
-            return Iterables.tryFind((Iterable<?>)getNewValue(), StringPredicates.isStringStartingWith(prefix)).isPresent();
-        return false;
-    }
-    
-    // TODO matchesRegex ?
-
-    public Object getOriginalValue() {
-        return originalValue;
-    }
-
-    public Object getNewValue() {
-        if (changed==null || !isChanged()) return originalValue;
-        return newValue;
-    }
-
-    public boolean isChanged() {
-        if (changed==null) throw new IllegalStateException("not yet applied");
-        return changed;
-    }
-
-    public boolean isExcluded() {
-        return excluded;
-    }
-    
-    /** indicates that a node should no longer be translated */
-    public PlanInterpretationNode exclude() {
-        this.excluded = true;
-        return this;
-    }
-    
-    public PlanInterpretationNode setNewValue(Object newItem) {
-        if (immutable)
-            throw new IllegalStateException("Node "+this+" has been set immutable");
-        this.newValue = newItem;
-        this.changed = true;
-        return this;
-    }
-
-    protected PlanInterpretationNode newPlanInterpretation(PlanInterpretationNode parent, Role roleInParent, Object item) {
-        return new PlanInterpretationNode(parent, roleInParent, item);
-    }
-
-    protected void applyToMap() {
-        Map<Object, Object> input = MutableMap.<Object,Object>copyOf((Map<?,?>)originalValue);
-        Map<Object, Object> result = MutableMap.<Object,Object>of();
-        newValue = result;
-
-        // first do a "whole-node" application
-        if (getContext().getAllInterpreter().applyMapBefore(this, input)) {
-
-            for (Map.Entry<Object,Object> entry: input.entrySet()) {
-                // then recurse in to this node and do various in-the-node applications
-                PlanInterpretationNode value = newPlanInterpretation(this, Role.MAP_VALUE, entry.getValue());
-                value.apply();
-
-                PlanInterpretationNode key = newPlanInterpretation(this, Role.MAP_KEY, entry.getKey());
-                key.apply();
-
-                if (key.isChanged() || value.isChanged()) 
-                    changed = true;
-
-                if (getContext().getAllInterpreter().applyMapEntry(this, input, result, key, value))
-                    result.put(key.getNewValue(), value.getNewValue());
-                else
-                    changed = true;
-            }
-
-            // finally try applying to this node again
-            getContext().getAllInterpreter().applyMapAfter(this, input, result);
-        }
-
-        if (changed==null) changed = false;
-    }
-
-    protected void applyToIterable() {
-        MutableList<Object> input = MutableList.copyOf((Iterable<?>)originalValue);
-        MutableList<Object> result = new MutableList<Object>();
-        newValue = result;
-
-        // first do a "whole-node" application
-        if (getContext().getAllInterpreter().applyListBefore(this, input)) {
-
-            for (Object entry: input) {
-                // then recurse in to this node and do various in-the-node applications
-                PlanInterpretationNode value = newPlanInterpretation(this, Role.LIST_ENTRY, entry);
-                value.apply();
-
-                if (value.isChanged()) 
-                    changed = true;
-
-                if (getContext().getAllInterpreter().applyListEntry(this, input, result, value))
-                    result.add(value.getNewValue());
-            }
-
-            // finally try applying to this node again
-            getContext().getAllInterpreter().applyListAfter(this, input, result);
-        }
-
-        if (changed==null) changed = false;
-    }
-
-    protected void applyToYamlPrimitive() {
-        getContext().getAllInterpreter().applyYamlPrimitive(this);
-    }
-
-    public void immutable() {
-        if (!isChanged()) {
-            if (!testCollectionImmutable(getNewValue())) {
-                // results of Yaml parse are not typically immutable,
-                // so force them to be changed so result of interpretation is immutable
-                changed = true;
-                setNewValue(immutable(getNewValue()));
-            }
-        } else {
-            setNewValue(immutable(getNewValue()));
-        }
-        checkImmutable(getNewValue());
-        immutable = true;
-    }
-    
-    private void checkImmutable(Object in) {
-        if (!testCollectionImmutable(in))
-            log.warn("Node original value "+in+" at "+this+" should be immutable");
-    }
-    
-    private static boolean testCollectionImmutable(Object in) {
-        if (in instanceof Map) return (in instanceof ImmutableMap);
-        if (in instanceof Iterable) return (in instanceof ImmutableList);
-        return true;
-    }
-
-    private static Object immutable(Object in) {
-        if (in instanceof Map) return ImmutableMap.copyOf((Map<?,?>)in);
-        if (in instanceof Iterable) return ImmutableList.copyOf((Iterable<?>)in);
-        return in;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/io/brooklyn/util/yaml/Yamls.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/io/brooklyn/util/yaml/Yamls.java b/camp/camp-base/src/main/java/io/brooklyn/util/yaml/Yamls.java
deleted file mode 100644
index 44974f0..0000000
--- a/camp/camp-base/src/main/java/io/brooklyn/util/yaml/Yamls.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 io.brooklyn.util.yaml;
-
-/** @deprecated since 0.7.0 use {@link brooklyn.util.yaml.Yamls} */
-@Deprecated
-public class Yamls extends brooklyn.util.yaml.Yamls {
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
new file mode 100644
index 0000000..137e927
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
@@ -0,0 +1,130 @@
+/*
+ * 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.camp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.PlatformTransaction;
+import org.apache.brooklyn.camp.spi.collection.AggregatingResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+
+/** A {@link CampPlatform} implementation which is empty but allows adding new items,
+ * as well as adding other platforms; meant for subclassing only */
+public class AggregatingCampPlatform extends CampPlatform {
+
+    private static final Logger log = LoggerFactory.getLogger(AggregatingCampPlatform.class);
+    
+    protected AggregatingCampPlatform(PlatformRootSummary root) {
+        this(root, new BasicCampPlatform(root));
+    }
+    
+    public AggregatingCampPlatform(PlatformRootSummary root, CampPlatform platformWhereTransactionsOccur) {
+        super(root);
+        log.debug("Creating {} with main platform: {}", this, platformWhereTransactionsOccur);
+        this.mainPlatform = platformWhereTransactionsOccur;
+    }
+    
+    /** platform where additions are made */
+    CampPlatform mainPlatform;
+    List<CampPlatform> otherPlatformsToSearch = new ArrayList<CampPlatform>();
+    
+    protected void addPlatform(CampPlatform platform) {
+        log.debug("Adding child platform to {}: {}", this, platform);
+        otherPlatformsToSearch.add(platform);
+    }
+    
+    protected <T extends AbstractResource> ResourceLookup<T> aggregatingLookup(Function<CampPlatform, ResourceLookup<T>> lookupFunction) {
+        List<ResourceLookup<T>> lookups = new ArrayList<ResourceLookup<T>>();
+        lookups.add(lookupFunction.apply(mainPlatform));
+        for (CampPlatform p: otherPlatformsToSearch)
+            lookups.add(lookupFunction.apply(p));
+        return AggregatingResourceLookup.of(lookups);
+    }
+    
+    public ResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<PlatformComponentTemplate>>() {
+            public ResourceLookup<PlatformComponentTemplate> apply(@Nullable CampPlatform input) {
+                return input.platformComponentTemplates();
+            }
+        });
+    }
+
+    @Override
+    public ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<ApplicationComponentTemplate>>() {
+            public ResourceLookup<ApplicationComponentTemplate> apply(@Nullable CampPlatform input) {
+                return input.applicationComponentTemplates();
+            }
+        });
+    }
+
+    public ResourceLookup<AssemblyTemplate> assemblyTemplates() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<AssemblyTemplate>>() {
+            public ResourceLookup<AssemblyTemplate> apply(@Nullable CampPlatform input) {
+                return input.assemblyTemplates();
+            }
+        });
+    }
+    
+    public ResourceLookup<PlatformComponent> platformComponents() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<PlatformComponent>>() {
+            public ResourceLookup<PlatformComponent> apply(@Nullable CampPlatform input) {
+                return input.platformComponents();
+            }
+        });
+    }
+
+    @Override
+    public ResourceLookup<ApplicationComponent> applicationComponents() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<ApplicationComponent>>() {
+            public ResourceLookup<ApplicationComponent> apply(@Nullable CampPlatform input) {
+                return input.applicationComponents();
+            }
+        });
+    }
+
+    public ResourceLookup<Assembly> assemblies() {
+        return aggregatingLookup(new Function<CampPlatform, ResourceLookup<Assembly>>() {
+            public ResourceLookup<Assembly> apply(@Nullable CampPlatform input) {
+                return input.assemblies();
+            }
+        });
+    }
+    
+    @Override
+    public PlatformTransaction transaction() {
+        return mainPlatform.transaction();
+    }
+        
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
new file mode 100644
index 0000000..34fc6a2
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
@@ -0,0 +1,142 @@
+/*
+ * 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.camp;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.PlatformTransaction;
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** A {@link CampPlatform} implementation which is empty but allows adding new items */
+public class BasicCampPlatform extends CampPlatform {
+
+    private static final Logger log = LoggerFactory.getLogger(BasicCampPlatform.class);
+    
+    public BasicCampPlatform() {
+        this(PlatformRootSummary.builder().name("CAMP Platform").build());
+    }
+    
+    public BasicCampPlatform(PlatformRootSummary root) {
+        super(root);
+    }
+
+    BasicResourceLookup<PlatformComponentTemplate> platformComponentTemplates = new BasicResourceLookup<PlatformComponentTemplate>();
+    BasicResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates = new BasicResourceLookup<ApplicationComponentTemplate>();
+    BasicResourceLookup<AssemblyTemplate> assemblyTemplates = new BasicResourceLookup<AssemblyTemplate>();
+
+    BasicResourceLookup<PlatformComponent> platformComponents = new BasicResourceLookup<PlatformComponent>();
+    BasicResourceLookup<ApplicationComponent> applicationComponents = new BasicResourceLookup<ApplicationComponent>();
+    BasicResourceLookup<Assembly> assemblies = new BasicResourceLookup<Assembly>();
+
+    public BasicResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
+        return platformComponentTemplates;
+    }
+
+    @Override
+    public BasicResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
+        return applicationComponentTemplates;
+    }
+
+    public BasicResourceLookup<AssemblyTemplate> assemblyTemplates() {
+        return assemblyTemplates;
+    }
+    
+    public BasicResourceLookup<PlatformComponent> platformComponents() {
+        return platformComponents;
+    }
+
+    @Override
+    public BasicResourceLookup<ApplicationComponent> applicationComponents() {
+        return applicationComponents;
+    }
+
+    public BasicResourceLookup<Assembly> assemblies() {
+        return assemblies;
+    }
+    
+    @Override
+    public PlatformTransaction transaction() {
+        return new BasicPlatformTransaction(this);
+    }
+    
+    public static class BasicPlatformTransaction extends PlatformTransaction {
+        private final BasicCampPlatform platform;
+        private final AtomicBoolean committed = new AtomicBoolean(false);
+        
+        public BasicPlatformTransaction(BasicCampPlatform platform) {
+            this.platform = platform;
+        }
+        
+        @Override
+        public void commit() {
+            if (committed.getAndSet(true)) 
+                throw new IllegalStateException("transaction being committed multiple times");
+            
+            for (Object o: additions) {
+                if (o instanceof AssemblyTemplate) {
+                    platform.assemblyTemplates.add((AssemblyTemplate) o);
+                    continue;
+                }
+                if (o instanceof PlatformComponentTemplate) {
+                    platform.platformComponentTemplates.add((PlatformComponentTemplate) o);
+                    continue;
+                }
+                if (o instanceof ApplicationComponentTemplate) {
+                    platform.applicationComponentTemplates.add((ApplicationComponentTemplate) o);
+                    continue;
+                }
+                
+                if (o instanceof Assembly) {
+                    platform.assemblies.add((Assembly) o);
+                    continue;
+                }
+                if (o instanceof PlatformComponent) {
+                    platform.platformComponents.add((PlatformComponent) o);
+                    continue;
+                }
+                if (o instanceof ApplicationComponent) {
+                    platform.applicationComponents.add((ApplicationComponent) o);
+                    continue;
+                }
+
+                throw new UnsupportedOperationException("Object "+o+" of type "+o.getClass()+" cannot be added to "+platform);
+            }
+        }
+        
+        @Override
+        protected void finalize() throws Throwable {
+            if (!committed.get()) {
+                // normal, in the case of errors (which might occur when catalog tries to figure out the right plan format); shouldn't happen otherwise
+                // if we want log.warn visibility of these, then we will have to supply an abandon() method on this interface and ensure that is invoked on errors
+                log.debug("transaction "+this+" was never applied");
+            }
+            super.finalize();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java
new file mode 100644
index 0000000..817dae8
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java
@@ -0,0 +1,76 @@
+/*
+ * 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.camp;
+
+import org.apache.brooklyn.camp.spi.ApplicationComponent;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponent;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
+import org.apache.brooklyn.camp.spi.PlatformTransaction;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.resolve.PdpProcessor;
+
+import com.google.common.base.Preconditions;
+
+public abstract class CampPlatform {
+
+    private final PlatformRootSummary root;
+    private final PdpProcessor pdp;
+
+    public CampPlatform(PlatformRootSummary root) {
+        this.root = Preconditions.checkNotNull(root, "root");
+        pdp = createPdpProcessor();
+    }
+
+    // --- root
+    
+    public PlatformRootSummary root() {
+        return root;
+    }
+
+    // --- other aspects
+    
+    public PdpProcessor pdp() {
+        return pdp;
+    }
+
+    
+    // --- required custom implementation hooks
+    
+    public abstract ResourceLookup<PlatformComponentTemplate> platformComponentTemplates();
+    public abstract ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates();
+    public abstract ResourceLookup<AssemblyTemplate> assemblyTemplates();
+
+    public abstract ResourceLookup<PlatformComponent> platformComponents();
+    public abstract ResourceLookup<ApplicationComponent> applicationComponents();
+    public abstract ResourceLookup<Assembly> assemblies();
+
+    /** returns object where changes to a PDP can be made; note all changes must be committed */
+    public abstract PlatformTransaction transaction();
+
+    // --- optional customisation overrides
+    
+    protected PdpProcessor createPdpProcessor() {
+        return new PdpProcessor(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java
new file mode 100644
index 0000000..01cece9
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java
@@ -0,0 +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.camp.commontypes;
+
+public enum RepresentationSkew {
+    CREATING, NONE, DESTROYING, UNKNOWN
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java
new file mode 100644
index 0000000..0a01d45
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java
@@ -0,0 +1,197 @@
+/*
+ * 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.camp.spi;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.camp.commontypes.RepresentationSkew;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.text.Identifiers;
+import brooklyn.util.time.Time;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/** Superclass of CAMP resource implementation objects.
+ * Typically used to hold common state of implementation objects
+ * and to populate the DTO's used by the REST API.
+ * <p>
+ * These class instances are typically created using the 
+ * static {@link #builder()} methods they contain. 
+ * The resulting instances are typically immutable,
+ * so where fields can change callers should use a new builder
+ * (or update an underlying data store).
+ * <p>
+ * This class is not meant to be instantiated directly, as
+ * CAMP only uses defined subclasses (ie containing these fields).
+ * It is instantiable for testing.
+ */
+public class AbstractResource {
+
+    public static final String CAMP_TYPE = "Resource";
+    
+    private String id = Identifiers.makeRandomId(8);
+    private String name;
+    private String type;
+    private String description;
+    private String sourceCode;
+    private Date created = Time.dropMilliseconds(new Date());
+    private List<String> tags = Collections.emptyList();
+    private RepresentationSkew representationSkew;
+    
+    private Map<String,Object> customAttributes = new MutableMap<String, Object>();
+    
+    /** Use {@link #builder()} to create */
+    protected AbstractResource() {}
+    
+    // getters
+
+    public String getId() {
+        return id;
+    }
+    public String getName() {
+        return name;
+    }
+    public String getType() {
+        return type;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public String getSourceCode() {
+        return sourceCode;
+    }
+    public Date getCreated() {
+        return created;
+    }
+    public List<String> getTags() {
+        return tags;
+    }
+    public RepresentationSkew getRepresentationSkew() {
+        return representationSkew;
+    }
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+    
+    // setters
+
+    private void setId(String id) {
+        this.id = id;
+    }
+    private void setName(String name) {
+        this.name = name;
+    }
+    private void setDescription(String description) {
+        this.description = description;
+    }
+    private void setSourceCode(String sourceCode) {
+        this.sourceCode = sourceCode;
+    }
+    private void setCreated(Date created) {
+        // precision beyond seconds breaks equals check
+        this.created = Time.dropMilliseconds(created);
+    }
+    private void setTags(List<String> tags) {
+        this.tags = ImmutableList.copyOf(tags);
+    }
+    private void setType(String type) {
+        this.type = type;
+    }
+    private void setRepresentationSkew(RepresentationSkew representationSkew) {
+        this.representationSkew = representationSkew;
+    }
+    public void setCustomAttribute(String key, Object value) {
+        this.customAttributes.put(key, value);
+    }
+            
+    // builder
+    @SuppressWarnings("rawtypes")
+    public static Builder<? extends AbstractResource,? extends Builder> builder() {
+        return new AbstractResource().new AbstractResourceBuilder(CAMP_TYPE);
+    }
+    
+    /** Builder creates the instance up front to avoid repetition of fields in the builder;
+     * but prevents object leakage until build and prevents changes after build,
+     * so effectively immutable.
+     * <p>
+     * Similarly setters in the class are private so those objects are also typically effectively immutable. */
+    public abstract class Builder<T extends AbstractResource,U extends Builder<T,U>> {
+        
+        private boolean built = false;
+        private String type = null;
+        private boolean initialized = false;
+        
+        protected Builder(String type) {
+            this.type = type;
+        }
+        
+        protected final synchronized void check() {
+            if (built) 
+                throw new IllegalStateException("Builder instance from "+this+" cannot be access after build");
+            if (!initialized) {
+                initialized = true;
+                initialize();
+            }
+        }
+
+        protected void initialize() {
+            if (type!=null) type(type);
+        }
+
+        @SuppressWarnings("unchecked")
+        public synchronized T build() {
+            check();
+            built = true;
+            return (T) AbstractResource.this;
+        }
+        
+        @SuppressWarnings("unchecked")
+        protected U thisBuilder() { return (U)this; }
+        
+        public U type(String x) { check(); AbstractResource.this.setType(x); return thisBuilder(); }
+        public U id(String x) { check(); AbstractResource.this.setId(x); return thisBuilder(); }
+        public U name(String x) { check(); AbstractResource.this.setName(x); return thisBuilder(); }
+        public U description(String x) { check(); AbstractResource.this.setDescription(x); return thisBuilder(); }
+        public U created(Date x) { check(); AbstractResource.this.setCreated(x); return thisBuilder(); }
+        public U tags(List<String> x) { check(); AbstractResource.this.setTags(x); return thisBuilder(); }
+        public U representationSkew(RepresentationSkew x) { check(); AbstractResource.this.setRepresentationSkew(x); return thisBuilder(); }
+        public U customAttribute(String key, Object value) { check(); AbstractResource.this.setCustomAttribute(key, value); return thisBuilder(); }
+        public U sourceCode(String x) { check(); AbstractResource.this.setSourceCode(x); return thisBuilder(); }
+
+//        public String type() { return instance().type; }
+    }
+    
+    @VisibleForTesting
+    protected class AbstractResourceBuilder extends Builder<AbstractResource,AbstractResourceBuilder> {
+        protected AbstractResourceBuilder(String type) {
+            super(type);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return super.toString()+"[id="+getId()+"; type="+getType()+"]";
+    }
+}


[6/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java
new file mode 100644
index 0000000..6ece4d0
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java
@@ -0,0 +1,93 @@
+/*
+ * 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.camp.spi;
+
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
+
+
+/** Holds the metadata (name, description, etc) for a PCT
+ * as well as fields pointing to behaviour (eg creation of PlatformComponent).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class ApplicationComponent extends AbstractResource {
+
+    public static final String CAMP_TYPE = "ApplicationComponent";
+    static { assert CAMP_TYPE.equals(ApplicationComponent.class.getSimpleName()); }
+    
+    /** Use {@link #builder()} to create */
+    protected ApplicationComponent() {}
+
+    ResourceLookup<ApplicationComponent> applicationComponents;
+    ResourceLookup<PlatformComponent> platformComponents;
+    String externalManagementUri;
+    
+    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
+        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
+    }
+    public ResourceLookup<PlatformComponent> getPlatformComponents() {
+        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
+    }
+
+    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
+        this.applicationComponents = applicationComponents;
+    }
+    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
+        this.platformComponents = platformComponents;
+    }
+    
+    // builder
+    
+    public static Builder<? extends ApplicationComponent> builder() {
+        return new ApplicationComponent().new Builder<ApplicationComponent>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends ApplicationComponent> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+
+        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { ApplicationComponent.this.setApplicationComponents(x); return thisBuilder(); }
+        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { ApplicationComponent.this.setPlatformComponents(x); return thisBuilder(); }
+        
+        public synchronized Builder<T> add(ApplicationComponent x) {
+            if (ApplicationComponent.this.applicationComponents==null) {
+                ApplicationComponent.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
+            }
+            if (!(ApplicationComponent.this.applicationComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+ApplicationComponent.this.applicationComponents);
+            }
+            ((BasicResourceLookup<ApplicationComponent>)ApplicationComponent.this.applicationComponents).add(x);
+            return thisBuilder();
+        }
+        
+        public synchronized Builder<T> add(PlatformComponent x) {
+            if (ApplicationComponent.this.platformComponents==null) {
+                ApplicationComponent.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
+            }
+            if (!(ApplicationComponent.this.platformComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+ApplicationComponent.this.platformComponents);
+            }
+            ((BasicResourceLookup<PlatformComponent>)ApplicationComponent.this.platformComponents).add(x);
+            return thisBuilder();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java
new file mode 100644
index 0000000..bd9d69d
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java
@@ -0,0 +1,54 @@
+/*
+ * 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.camp.spi;
+
+
+/** Holds the metadata (name, description, etc) for a PCT
+ * as well as fields pointing to behaviour (eg creation of PlatformComponent).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class ApplicationComponentTemplate extends AbstractResource {
+
+    public static final String CAMP_TYPE = "ApplicationComponentTemplate";
+    static { assert CAMP_TYPE.equals(ApplicationComponentTemplate.class.getSimpleName()); }
+    
+    /** Use {@link #builder()} to create */
+    protected ApplicationComponentTemplate() {}
+
+    
+    // no fields beyond basic resource
+    
+    // TODO platform component templates, maybe other act's too ?
+    
+    
+    // builder
+    
+    public static Builder<? extends ApplicationComponentTemplate> builder() {
+        return new ApplicationComponentTemplate().new Builder<ApplicationComponentTemplate>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends ApplicationComponentTemplate> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+//        public Builder<T> foo(String x) { instance().setFoo(x); return thisBuilder(); }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java
new file mode 100644
index 0000000..58b3064
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java
@@ -0,0 +1,109 @@
+/*
+ * 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.camp.spi;
+
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
+
+
+/** Holds the metadata (name, description, etc) for an AssemblyTemplate
+ * as well as fields pointing to behaviour (eg list of ACT's).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class Assembly extends AbstractResource {
+
+    public static final String CAMP_TYPE = "Assembly";
+    static { assert CAMP_TYPE.equals(Assembly.class.getSimpleName()); }
+    
+    /** Use {@link #builder()} to create */
+    protected Assembly() {}
+
+    AssemblyTemplate assemblyTemplate;
+    ResourceLookup<ApplicationComponent> applicationComponents;
+    ResourceLookup<PlatformComponent> platformComponents;
+    
+    // TODO
+//    "parameterDefinitionUri": URI,
+//    "pdpUri" : URI ?
+                    
+    public AssemblyTemplate getAssemblyTemplate() {
+        return assemblyTemplate;
+    }
+    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
+        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
+    }
+    public ResourceLookup<PlatformComponent> getPlatformComponents() {
+        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
+    }
+    
+    private void setAssemblyTemplate(AssemblyTemplate assemblyTemplate) {
+        this.assemblyTemplate = assemblyTemplate;
+    }
+    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
+        this.applicationComponents = applicationComponents;
+    }
+    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
+        this.platformComponents = platformComponents;
+    }
+    
+    // builder
+    
+    public static Builder<? extends Assembly> builder() {
+        return new Assembly().new Builder<Assembly>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends Assembly> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+        public Builder<T> assemblyTemplate(AssemblyTemplate x) { Assembly.this.setAssemblyTemplate(x); return thisBuilder(); }
+        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { Assembly.this.setApplicationComponents(x); return thisBuilder(); }
+        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { Assembly.this.setPlatformComponents(x); return thisBuilder(); }
+        
+        public synchronized Builder<T> add(ApplicationComponent x) {
+            if (Assembly.this.applicationComponents==null) {
+                Assembly.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
+            }
+            if (!(Assembly.this.applicationComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+Assembly.this.applicationComponents);
+            }
+            ((BasicResourceLookup<ApplicationComponent>)Assembly.this.applicationComponents).add(x);
+            return thisBuilder();
+        }
+        
+        public synchronized Builder<T> add(PlatformComponent x) {
+            if (Assembly.this.platformComponents==null) {
+                Assembly.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
+            }
+            if (!(Assembly.this.platformComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+Assembly.this.platformComponents);
+            }
+            ((BasicResourceLookup<PlatformComponent>)Assembly.this.platformComponents).add(x);
+            return thisBuilder();
+        }
+        
+        @Override
+        public synchronized T build() {
+            return super.build();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java
new file mode 100644
index 0000000..423c3b4
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java
@@ -0,0 +1,118 @@
+/*
+ * 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.camp.spi;
+
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+
+import com.google.common.base.Preconditions;
+
+
+/** Holds the metadata (name, description, etc) for an AssemblyTemplate
+ * as well as fields pointing to behaviour (eg list of ACT's).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class AssemblyTemplate extends AbstractResource {
+
+    public static final String CAMP_TYPE = "AssemblyTemplate";
+    static { assert CAMP_TYPE.equals(AssemblyTemplate.class.getSimpleName()); }
+    
+    Class<? extends AssemblyTemplateInstantiator> instantiator;
+    ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates;
+    ResourceLookup<PlatformComponentTemplate> platformComponentTemplates;
+    
+    // TODO
+//    "parameterDefinitionUri": URI,
+//    "pdpUri" : URI ?
+                    
+    /** Use {@link #builder()} to create */
+    protected AssemblyTemplate() {}
+
+    public Class<? extends AssemblyTemplateInstantiator> getInstantiator() {
+        return instantiator;
+    }
+    public ResourceLookup<ApplicationComponentTemplate> getApplicationComponentTemplates() {
+        return applicationComponentTemplates != null ? applicationComponentTemplates : new EmptyResourceLookup<ApplicationComponentTemplate>();
+    }
+    public ResourceLookup<PlatformComponentTemplate> getPlatformComponentTemplates() {
+        return platformComponentTemplates != null ? platformComponentTemplates : new EmptyResourceLookup<PlatformComponentTemplate>();
+    }
+    
+    private void setInstantiator(Class<? extends AssemblyTemplateInstantiator> instantiator) {
+        this.instantiator = instantiator;
+    }
+    private void setApplicationComponentTemplates(ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates) {
+        this.applicationComponentTemplates = applicationComponentTemplates;
+    }
+    private void setPlatformComponentTemplates(ResourceLookup<PlatformComponentTemplate> platformComponentTemplates) {
+        this.platformComponentTemplates = platformComponentTemplates;
+    }
+    
+    // builder
+    
+    public static Builder<? extends AssemblyTemplate> builder() {
+        return new AssemblyTemplate().new Builder<AssemblyTemplate>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends AssemblyTemplate> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+        public Builder<T> instantiator(Class<? extends AssemblyTemplateInstantiator> x) { AssemblyTemplate.this.setInstantiator(x); return thisBuilder(); }
+        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponentTemplate> x) { AssemblyTemplate.this.setApplicationComponentTemplates(x); return thisBuilder(); }
+        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponentTemplate> x) { AssemblyTemplate.this.setPlatformComponentTemplates(x); return thisBuilder(); }
+
+        /** allows callers to see the partially formed instance when needed, for example to query instantiators;
+         *  could be replaced by specific methods as and when that is preferred */
+        @SuppressWarnings("unchecked")
+        public T peek() { return (T) AssemblyTemplate.this; }
+        
+        public synchronized Builder<T> add(ApplicationComponentTemplate x) {
+            if (AssemblyTemplate.this.applicationComponentTemplates==null) {
+                AssemblyTemplate.this.applicationComponentTemplates = new BasicResourceLookup<ApplicationComponentTemplate>();
+            }
+            if (!(AssemblyTemplate.this.applicationComponentTemplates instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+AssemblyTemplate.this.applicationComponentTemplates);
+            }
+            ((BasicResourceLookup<ApplicationComponentTemplate>)AssemblyTemplate.this.applicationComponentTemplates).add(x);
+            return thisBuilder();
+        }
+        
+        public synchronized Builder<T> add(PlatformComponentTemplate x) {
+            if (AssemblyTemplate.this.platformComponentTemplates==null) {
+                AssemblyTemplate.this.platformComponentTemplates = new BasicResourceLookup<PlatformComponentTemplate>();
+            }
+            if (!(AssemblyTemplate.this.platformComponentTemplates instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+AssemblyTemplate.this.platformComponentTemplates);
+            }
+            ((BasicResourceLookup<PlatformComponentTemplate>)AssemblyTemplate.this.platformComponentTemplates).add(x);
+            return thisBuilder();
+        }
+        
+        @Override
+        public synchronized T build() {
+            Preconditions.checkNotNull(AssemblyTemplate.this.instantiator);
+            return super.build();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java
new file mode 100644
index 0000000..00a22b6
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java
@@ -0,0 +1,40 @@
+/*
+ * 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.camp.spi;
+
+public class Link<T> {
+
+    private final String id;
+    private final String name;
+    
+    public Link(String id, String name) {
+        super();
+        this.id = id;
+        this.name = name;
+    }
+
+    public String getId() {
+        return id;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java
new file mode 100644
index 0000000..fa5eddb
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java
@@ -0,0 +1,101 @@
+/*
+ * 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.camp.spi;
+
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
+
+
+/** Holds the metadata (name, description, etc) for a PCT
+ * as well as fields pointing to behaviour (eg creation of PlatformComponent).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class PlatformComponent extends AbstractResource {
+
+    public static final String CAMP_TYPE = "PlatformComponent";
+    static { assert CAMP_TYPE.equals(PlatformComponent.class.getSimpleName()); }
+    
+    /** Use {@link #builder()} to create */
+    protected PlatformComponent() {}
+
+    ResourceLookup<ApplicationComponent> applicationComponents;
+    ResourceLookup<PlatformComponent> platformComponents;
+    String externalManagementUri;
+    
+    public ResourceLookup<ApplicationComponent> getApplicationComponents() {
+        return applicationComponents != null ? applicationComponents : new EmptyResourceLookup<ApplicationComponent>();
+    }
+    public ResourceLookup<PlatformComponent> getPlatformComponents() {
+        return platformComponents != null ? platformComponents : new EmptyResourceLookup<PlatformComponent>();
+    }
+
+    private void setApplicationComponents(ResourceLookup<ApplicationComponent> applicationComponents) {
+        this.applicationComponents = applicationComponents;
+    }
+    private void setPlatformComponents(ResourceLookup<PlatformComponent> platformComponents) {
+        this.platformComponents = platformComponents;
+    }
+    
+    public String getExternalManagementUri() {
+        return externalManagementUri;
+    }
+    private void setExternalManagementUri(String externalManagementUri) {
+        this.externalManagementUri = externalManagementUri;
+    }
+    
+    // builder
+    
+    public static Builder<? extends PlatformComponent> builder() {
+        return new PlatformComponent().new Builder<PlatformComponent>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends PlatformComponent> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+        public Builder<T> externalManagementUri(String x) { PlatformComponent.this.setExternalManagementUri(x); return thisBuilder(); }
+        public Builder<T> applicationComponentTemplates(ResourceLookup<ApplicationComponent> x) { PlatformComponent.this.setApplicationComponents(x); return thisBuilder(); }
+        public Builder<T> platformComponentTemplates(ResourceLookup<PlatformComponent> x) { PlatformComponent.this.setPlatformComponents(x); return thisBuilder(); }
+        
+        public synchronized Builder<T> add(ApplicationComponent x) {
+            if (PlatformComponent.this.applicationComponents==null) {
+                PlatformComponent.this.applicationComponents = new BasicResourceLookup<ApplicationComponent>();
+            }
+            if (!(PlatformComponent.this.applicationComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+PlatformComponent.this.applicationComponents);
+            }
+            ((BasicResourceLookup<ApplicationComponent>)PlatformComponent.this.applicationComponents).add(x);
+            return thisBuilder();
+        }
+        
+        public synchronized Builder<T> add(PlatformComponent x) {
+            if (PlatformComponent.this.platformComponents==null) {
+                PlatformComponent.this.platformComponents = new BasicResourceLookup<PlatformComponent>();
+            }
+            if (!(PlatformComponent.this.platformComponents instanceof BasicResourceLookup)) {
+                throw new IllegalStateException("Cannot add to resource lookup "+PlatformComponent.this.platformComponents);
+            }
+            ((BasicResourceLookup<PlatformComponent>)PlatformComponent.this.platformComponents).add(x);
+            return thisBuilder();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java
new file mode 100644
index 0000000..2377519
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java
@@ -0,0 +1,52 @@
+/*
+ * 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.camp.spi;
+
+
+/** Holds the metadata (name, description, etc) for a PCT
+ * as well as fields pointing to behaviour (eg creation of PlatformComponent).
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class PlatformComponentTemplate extends AbstractResource {
+
+    public static final String CAMP_TYPE = "PlatformComponentTemplate";
+    static { assert CAMP_TYPE.equals(PlatformComponentTemplate.class.getSimpleName()); }
+    
+    /** Use {@link #builder()} to create */
+    protected PlatformComponentTemplate() {}
+
+    
+    // no fields beyond basic resource
+    
+    
+    // builder
+    
+    public static Builder<? extends PlatformComponentTemplate> builder() {
+        return new PlatformComponentTemplate().new Builder<PlatformComponentTemplate>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends PlatformComponentTemplate> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+//        public Builder<T> foo(String x) { instance().setFoo(x); return thisBuilder(); }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java
new file mode 100644
index 0000000..d8713df
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java
@@ -0,0 +1,70 @@
+/*
+ * 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.camp.spi;
+
+/** Holds the metadata (name, description, etc) for a CampPlatform.
+ * Required to initialize a CampPlatform.
+ * <p>
+ * See {@link AbstractResource} for more general information.
+ */
+public class PlatformRootSummary extends AbstractResource {
+
+    public static final String CAMP_TYPE = "Platform";
+    
+    /** Use {@link #builder()} to create */
+    protected PlatformRootSummary() {
+    }
+    
+    // no fields beyond basic resource
+    
+    //TODO:
+    
+    // in the DTO
+    
+//    "supportedFormatsUri": URI, 
+//    "extensionsUri": URI,
+//    "typeDefinitionsUri": URI,
+//    "tags": [ String, + ], ?
+//    "specificationVersion": String[], 
+//    "implementationVersion": String, ? 
+//    "assemblyTemplates": [ Link + ], ? 
+//    "assemblies": [ Link + ], ? 
+//    "platformComponentTemplates": [ Link + ], ? 
+//    "platformComponentCapabilities": [Link + ], ? 
+//    "platformComponents": [ Link + ], ?
+
+    
+    // builder
+    
+    public static Builder<? extends PlatformRootSummary> builder() {
+        return new PlatformRootSummary().new Builder<PlatformRootSummary>(CAMP_TYPE);
+    }
+    
+    public class Builder<T extends PlatformRootSummary> extends AbstractResource.Builder<T,Builder<T>> {
+        
+        protected Builder(String type) { super(type); }
+        
+        protected void initialize() {
+            super.initialize();
+            // TODO a better way not to have an ID here (new subclass BasicIdentifiableResource for other BasicResource instances)
+            id("");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java
new file mode 100644
index 0000000..ae54beb
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java
@@ -0,0 +1,46 @@
+/*
+ * 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.camp.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class PlatformTransaction {
+
+    protected List<Object> additions = new ArrayList<Object>();
+    
+    /** apply the transaction */
+    public abstract void commit();
+    
+    public PlatformTransaction add(AssemblyTemplate at) {
+        additions.add(at);
+        return this;
+    }
+
+    public PlatformTransaction add(ApplicationComponentTemplate act) {
+        additions.add(act);
+        return this;
+    }
+
+    public PlatformTransaction add(PlatformComponentTemplate pct) {
+        additions.add(pct);
+        return this;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java
new file mode 100644
index 0000000..1709087
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java
@@ -0,0 +1,35 @@
+/*
+ * 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.camp.spi.collection;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+public abstract class AbstractResourceLookup<T extends AbstractResource> implements ResourceLookup<T> {
+
+    /** convenience for concrete subclasses */
+    protected ResolvableLink<T> newLink(String id, String name) {
+        return new ResolvableLink<T>(id, name, this);
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return links().isEmpty();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
new file mode 100644
index 0000000..700aafb
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
@@ -0,0 +1,56 @@
+/*
+ * 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.camp.spi.collection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+public class AggregatingResourceLookup<T extends AbstractResource> extends AbstractResourceLookup<T> {
+
+    List<ResourceLookup<T>> targets = new ArrayList<ResourceLookup<T>>();
+    
+    public static <T extends AbstractResource> AggregatingResourceLookup<T> of(ResourceLookup<T> ...targets) {
+        AggregatingResourceLookup<T> result = new AggregatingResourceLookup<T>();
+        for (ResourceLookup<T> item: targets) result.targets.add(item);
+        return result;
+    }
+    
+    public static <T extends AbstractResource> AggregatingResourceLookup<T> of(Iterable<ResourceLookup<T>> targets) {
+        AggregatingResourceLookup<T> result = new AggregatingResourceLookup<T>();
+        for (ResourceLookup<T> item: targets) result.targets.add(item);
+        return result;        
+    }
+
+    public T get(String id) {
+        for (ResourceLookup<T> item: targets) {
+            T result = item.get(id);
+            if (result!=null) return result;
+        }
+        return null;
+    }
+
+    public List<ResolvableLink<T>> links() {
+        List<ResolvableLink<T>> result = new ArrayList<ResolvableLink<T>>();
+        for (ResourceLookup<T> item: targets) result.addAll(item.links());
+        return result;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java
new file mode 100644
index 0000000..38405c2
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java
@@ -0,0 +1,71 @@
+/*
+ * 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.camp.spi.collection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+import brooklyn.util.collections.MutableMap;
+
+public class BasicResourceLookup<T extends AbstractResource> extends AbstractResourceLookup<T> {
+
+    Map<String,T> items = new MutableMap<String,T>();
+    Map<String,ResolvableLink<T>> links = new MutableMap<String,ResolvableLink<T>>();
+    
+    public T get(String id) {
+        return items.get(id);
+    }
+
+    public synchronized List<ResolvableLink<T>> links() {
+        return new ArrayList<ResolvableLink<T>>(links.values());
+    }
+
+    public synchronized void add(T item) {
+        T old = items.put(item.getId(), item);
+        if (old!=null) {
+            items.put(old.getId(), old);
+            throw new IllegalStateException("Already contains item for "+item.getId()+": "+old+" (adding "+item+")");
+        }
+        links.put(item.getId(), newLink(item.getId(), item.getName()));
+    }
+    
+    public synchronized void addAll(T... items) {
+        for (T item: items) add(item);
+    }
+    
+    public synchronized T update(T item) {
+        T old = items.put(item.getId(), item);
+        links.put(item.getId(), newLink(item.getId(), item.getName()));
+        return old;
+    }
+    
+    public synchronized boolean remove(String id) {
+        items.remove(id);
+        return links.remove(id)!=null;
+    }
+    
+    public static <T extends AbstractResource> BasicResourceLookup<T> of(T ...items) {
+        BasicResourceLookup<T> result = new BasicResourceLookup<T>();
+        for (T item: items) result.add(item);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java
new file mode 100644
index 0000000..81fea30
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java
@@ -0,0 +1,37 @@
+/*
+ * 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.camp.spi.collection;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.Link;
+
+public class ResolvableLink<T extends AbstractResource> extends Link<T> {
+    
+    protected final ResourceLookup<T> provider;
+    
+    public ResolvableLink(String id, String name, ResourceLookup<T> provider) {
+        super(id, name);
+        this.provider = provider;
+    }
+
+    public T resolve() {
+        return provider.get(getId());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java
new file mode 100644
index 0000000..7fc5a71
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java
@@ -0,0 +1,47 @@
+/*
+ * 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.camp.spi.collection;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.apache.brooklyn.camp.spi.AbstractResource;
+
+public interface ResourceLookup<T extends AbstractResource> {
+
+    public abstract T get(String id);
+    
+    public abstract List<ResolvableLink<T>> links();
+    
+    public abstract boolean isEmpty();
+
+    public static class EmptyResourceLookup<T extends AbstractResource> implements ResourceLookup<T> {
+        public T get(String id) {
+            throw new NoSuchElementException("no resource: "+id);
+        }
+        public List<ResolvableLink<T>> links() {
+            return Collections.emptyList();
+        }
+        public boolean isEmpty() {
+            return links().isEmpty();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
new file mode 100644
index 0000000..5c0d9d6
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
@@ -0,0 +1,30 @@
+/*
+ * 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.camp.spi.instantiate;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+
+/** instances of this class should have a public no-arg constructor so the class names can be serialized */
+public interface AssemblyTemplateInstantiator {
+
+    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
new file mode 100644
index 0000000..28eac3a
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
@@ -0,0 +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.camp.spi.instantiate;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+
+/** A simple instantiator which simply invokes the component's instantiators in parallel */
+public class BasicAssemblyTemplateInstantiator implements AssemblyTemplateInstantiator {
+
+    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
+        // TODO this should build it based on the components
+//        template.getPlatformComponentTemplates().links().iterator().next().resolve();
+        
+        // platforms should set a bunch of instantiators, or else let the ComponentTemplates do this!
+        throw new UnsupportedOperationException("Basic instantiator not yet supported");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
new file mode 100644
index 0000000..5ea2a6a
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
@@ -0,0 +1,99 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.yaml.Yamls;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class Artifact {
+
+    String name;
+    String description;
+    String artifactType;
+    
+    ArtifactContent content;
+    List<ArtifactRequirement> requirements;
+    
+    Map<String,Object> customAttributes;
+    
+    @SuppressWarnings("unchecked")
+    public static Artifact of(Map<String, Object> artifact) {
+        Map<String,Object> fields = MutableMap.copyOf(artifact);
+        
+        Artifact result = new Artifact();
+        result.name = (String) fields.remove("name");
+        result.description = (String) fields.remove("description");
+        result.artifactType = (String) (String) Yamls.removeMultinameAttribute(fields, "artifactType", "type");
+        
+        result.content = ArtifactContent.of( fields.remove("content") );
+        
+        result.requirements = new ArrayList<ArtifactRequirement>();
+        Object reqs = fields.remove("requirements");
+        if (reqs instanceof Iterable) {
+            for (Object req: (Iterable<Object>)reqs) {
+                if (req instanceof Map) {
+                    result.requirements.add(ArtifactRequirement.of((Map<String,Object>) req));
+                } else {
+                    throw new IllegalArgumentException("requirement should be a map, not "+req.getClass());
+                }
+            }
+        } else if (reqs!=null) {
+            // TODO "map" short form
+            throw new IllegalArgumentException("artifacts body should be iterable, not "+reqs.getClass());
+        }
+        
+        result.customAttributes = fields;
+        
+        return result;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public String getArtifactType() {
+        return artifactType;
+    }
+    public ArtifactContent getContent() {
+        return content;
+    }
+    public List<ArtifactRequirement> getRequirements() {
+        return ImmutableList.copyOf(requirements);
+    }
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+    
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
new file mode 100644
index 0000000..e1f093f
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
@@ -0,0 +1,65 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+
+import com.google.common.collect.ImmutableMap;
+
+public class ArtifactContent {
+
+    String href;
+    Map<String,Object> customAttributes;
+    
+    public static ArtifactContent of(Object spec) {
+        if (spec==null) return null;
+        
+        ArtifactContent result = new ArtifactContent();
+        if (spec instanceof String) {
+            result.href = (String)spec;
+        } else if (spec instanceof Map) {
+            @SuppressWarnings("unchecked")
+            Map<String,Object> attrs = MutableMap.copyOf( (Map<String,Object>) spec );
+            result.href = (String) attrs.remove("href");
+            result.customAttributes = attrs;            
+        } else {
+            throw new IllegalArgumentException("artifact content should be map or string, not "+spec.getClass());
+        }
+        
+        return result;
+    }
+
+    public String getHref() {
+        return href;
+    }
+    
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java
new file mode 100644
index 0000000..10ad72c
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java
@@ -0,0 +1,72 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.yaml.Yamls;
+
+import com.google.common.collect.ImmutableMap;
+
+public class ArtifactRequirement {
+
+    String name;
+    String description;
+    String requirementType;
+    
+    Map<String,Object> customAttributes;
+    
+    public static ArtifactRequirement of(Map<String, Object> req) {
+        Map<String,Object> attrs = MutableMap.copyOf(req);
+        
+        ArtifactRequirement result = new ArtifactRequirement();
+        result.name = (String) attrs.remove("name");
+        result.description = (String) attrs.remove("description");
+        result.requirementType = (String) (String) Yamls.removeMultinameAttribute(attrs, "requirementType", "type");
+        
+        // TODO fulfillment
+        
+        result.customAttributes = attrs;
+        
+        return result;
+    }
+
+    public String getName() {
+        return name;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public String getRequirementType() {
+        return requirementType;
+    }
+    
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+    
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
new file mode 100644
index 0000000..a5814fc
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
@@ -0,0 +1,100 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.Map;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformTransaction;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate.Builder;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+
+public class AssemblyTemplateConstructor {
+
+    private final Builder<? extends AssemblyTemplate> builder;
+    private final CampPlatform campPlatform;
+    protected PlatformTransaction transaction;
+
+    public AssemblyTemplateConstructor(CampPlatform campPlatform) {
+        this.campPlatform = campPlatform;
+        this.builder = AssemblyTemplate.builder();
+        this.transaction = this.campPlatform.transaction();
+    }
+    
+    /** records all the templates to the underlying platform */
+    public AssemblyTemplate commit() {
+        checkState();
+        AssemblyTemplate at = builder.build();
+        transaction.add(at).commit();
+        transaction = null;
+        return at;
+    }
+
+    public void name(String name) {
+        checkState();
+        builder.name(name);
+    }
+
+    public void description(String description) {
+        checkState();
+        builder.description(description);
+    }
+
+
+    public void sourceCode(String sourceCode) {
+        checkState();
+        builder.sourceCode(sourceCode);
+    }
+
+    public void addCustomAttributes(Map<String, Object> attrs) {
+        for (Map.Entry<String, Object> attr : attrs.entrySet())
+            builder.customAttribute(attr.getKey(), attr.getValue());
+    }
+
+    public void instantiator(Class<? extends AssemblyTemplateInstantiator> instantiator) {
+        checkState();
+        builder.instantiator(instantiator);
+    }
+    
+    public Class<? extends AssemblyTemplateInstantiator> getInstantiator() {
+        checkState();
+        return builder.peek().getInstantiator();
+    }
+    
+    public void add(ApplicationComponentTemplate act) {
+        checkState();
+        builder.add(act);
+        transaction.add(act);
+    }
+
+    public void add(PlatformComponentTemplate pct) {
+        checkState();
+        builder.add(pct);
+        transaction.add(pct);
+    }
+
+    protected void checkState() {
+        if (transaction == null)
+            throw new IllegalStateException("transaction already committed");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
new file mode 100644
index 0000000..499a4ee
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
@@ -0,0 +1,150 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.guava.Maybe;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class DeploymentPlan {
+
+    String name;
+    String origin;
+    String description;
+    String sourceCode;
+    
+    List<Artifact> artifacts;
+    List<Service> services;
+    Map<String,Object> customAttributes;
+
+    @Deprecated /** @deprecated since 0.7.0; supply source code also, for reference */
+    public static DeploymentPlan of(Map<String,Object> root) {
+        return of(root, null);
+    }
+    @SuppressWarnings("unchecked")
+    public static DeploymentPlan of(Map<String,Object> root, String optionalSourceCode) {
+        Map<String,Object> attrs = MutableMap.copyOf(root);
+        
+        DeploymentPlan result = new DeploymentPlan();
+        result.name = (String) attrs.remove("name");
+        result.description = (String) attrs.remove("description");
+        result.origin = (String) attrs.remove("origin");
+        result.sourceCode = optionalSourceCode;
+        // TODO version
+        
+        result.services = new ArrayList<Service>();
+        Object services = attrs.remove("services");
+        if (services instanceof Iterable) {
+            for (Object service: (Iterable<Object>)services) {
+                if (service instanceof Map) {
+                    result.services.add(Service.of((Map<String,Object>) service));
+                } else {
+                    throw new IllegalArgumentException("service should be map, not "+service.getClass());
+                }
+            }
+        } else if (services!=null) {
+            // TODO "map" short form
+            throw new IllegalArgumentException("artifacts body should be iterable, not "+services.getClass());
+        }
+        
+        result.artifacts = new ArrayList<Artifact>();
+        Object artifacts = attrs.remove("artifacts");
+        if (artifacts instanceof Iterable) {
+            for (Object artifact: (Iterable<Object>)artifacts) {
+                if (artifact instanceof Map) {
+                    result.artifacts.add(Artifact.of((Map<String,Object>) artifact));
+                } else {
+                    throw new IllegalArgumentException("artifact should be map, not "+artifact.getClass());
+                }
+            }
+        } else if (artifacts!=null) {
+            // TODO "map" short form
+            throw new IllegalArgumentException("artifacts body should be iterable, not "+artifacts.getClass());
+        }
+        
+        result.customAttributes = attrs;
+        
+        return result;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getOrigin() {
+        return origin;
+    }
+
+    public String getSourceCode() {
+        return sourceCode;
+    }
+    
+    public List<Artifact> getArtifacts() {
+        return ImmutableList.copyOf(artifacts);
+    }
+
+    public List<Service> getServices() {
+        return ImmutableList.copyOf(services);
+    }
+
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+
+    /**
+     * Returns a present {@link Maybe} of the custom attribute with the given name if the attribute is
+     * non-null and is an instance of the given type. Otherwise returns absent.
+     * <p/>
+     * Does not remove the attribute from the custom attribute map.
+     */
+    @SuppressWarnings("unchecked")
+    public <T> Maybe<T> getCustomAttribute(String attributeName, Class<T> type, boolean throwIfTypeMismatch) {
+        Object attribute = customAttributes.get(attributeName);
+        if (attribute == null) {
+            return Maybe.absent("Custom attributes does not contain " + attributeName);
+        } else if (!type.isAssignableFrom(attribute.getClass())) {
+            String message = "Custom attribute " + attributeName + " is not of expected type: " +
+                    "expected=" + type.getName() + " actual=" + attribute.getClass().getName();
+            if (throwIfTypeMismatch) {
+                throw new IllegalArgumentException(message);
+            }
+            return Maybe.absent(message);
+        } else {
+            return Maybe.of((T) attribute);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java
new file mode 100644
index 0000000..8c05143
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java
@@ -0,0 +1,94 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.yaml.Yamls;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class Service {
+
+    String name;
+    String description;
+    String serviceType;
+    
+    List<ServiceCharacteristic> characteristics;
+    
+    Map<String,Object> customAttributes;
+    
+    @SuppressWarnings("unchecked")
+    public static Service of(Map<String, Object> service) {
+        Map<String,Object> fields = MutableMap.copyOf(service);
+        
+        Service result = new Service();
+        result.name = (String) fields.remove("name");
+        result.description = (String) fields.remove("description");
+        // FIXME _type needed in lots of places
+        result.serviceType = (String) Yamls.removeMultinameAttribute(fields, "service_type", "serviceType", "type");
+        
+        result.characteristics = new ArrayList<ServiceCharacteristic>();
+        Object chars = fields.remove("characteristics");
+        if (chars instanceof Iterable) {
+            for (Object req: (Iterable<Object>)chars) {
+                if (req instanceof Map) {
+                    result.characteristics.add(ServiceCharacteristic.of((Map<String,Object>) req));
+                } else {
+                    throw new IllegalArgumentException("characteristics should be a map, not "+req.getClass());
+                }
+            }
+        } else if (chars!=null) {
+            // TODO "map" short form
+            throw new IllegalArgumentException("services body should be iterable, not "+chars.getClass());
+        }
+        
+        result.customAttributes = fields;
+        
+        return result;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public String getServiceType() {
+        return serviceType;
+    }
+    public List<ServiceCharacteristic> getCharacteristics() {
+        return ImmutableList.copyOf(characteristics);
+    }
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+    
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
new file mode 100644
index 0000000..bf8009b
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
@@ -0,0 +1,72 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.yaml.Yamls;
+
+import com.google.common.collect.ImmutableMap;
+
+public class ServiceCharacteristic {
+
+    String name;
+    String description;
+    String characteristicType;
+    
+    Map<String,Object> customAttributes;
+    
+    public static ServiceCharacteristic of(Map<String, Object> req) {
+        Map<String,Object> attrs = MutableMap.copyOf(req);
+        
+        ServiceCharacteristic result = new ServiceCharacteristic();
+        result.name = (String) attrs.remove("name");
+        result.description = (String) attrs.remove("description");
+        result.characteristicType = (String) Yamls.removeMultinameAttribute(attrs, "characteristicType", "type");
+        
+        // TODO fulfillment
+        
+        result.customAttributes = attrs;
+        
+        return result;
+    }
+
+    public String getName() {
+        return name;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public String getCharacteristicType() {
+        return characteristicType;
+    }
+    
+    public Map<String, Object> getCustomAttributes() {
+        return ImmutableMap.copyOf(customAttributes);
+    }
+    
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java
new file mode 100644
index 0000000..a574b71
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java
@@ -0,0 +1,51 @@
+/*
+ * 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.camp.spi.resolve;
+
+import org.apache.brooklyn.camp.spi.pdp.Artifact;
+import org.apache.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+
+/** Matchers build up the AssemblyTemplate by matching against items in the deployment plan */
+public interface PdpMatcher {
+
+    boolean accepts(Object deploymentPlanItem);
+    boolean apply(Object deploymentPlanItem, AssemblyTemplateConstructor atc);
+
+    public abstract class ArtifactMatcher implements PdpMatcher {
+        private String artifactType;
+        public ArtifactMatcher(String artifactType) {
+            this.artifactType = artifactType;
+        }
+        public boolean accepts(Object art) {
+            return (art instanceof Artifact) && this.artifactType.equals( ((Artifact)art).getArtifactType() );
+        }
+    }
+    
+    public abstract class ServiceMatcher implements PdpMatcher {
+        private String serviceType;
+        public ServiceMatcher(String serviceType) {
+            this.serviceType = serviceType;
+        }
+        public boolean accepts(Object svc) {
+            return (svc instanceof Service) && this.serviceType.equals( ((Service)svc).getServiceType() );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
new file mode 100644
index 0000000..2763d93
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
@@ -0,0 +1,187 @@
+/*
+ * 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.camp.spi.resolve;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.pdp.Artifact;
+import org.apache.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
+import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationContext;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
+import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveInputStream;
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.yaml.snakeyaml.error.YAMLException;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.stream.Streams;
+import brooklyn.util.yaml.Yamls;
+
+import com.google.common.annotations.VisibleForTesting;
+
+public class PdpProcessor {
+
+    final CampPlatform campPlatform;
+    
+    final List<PdpMatcher> matchers = new ArrayList<PdpMatcher>();
+    final List<PlanInterpreter> interpreters = new ArrayList<PlanInterpreter>();
+    
+    public PdpProcessor(CampPlatform campPlatform) {
+        this.campPlatform = campPlatform;
+    }
+
+    public DeploymentPlan parseDeploymentPlan(Reader yaml) {
+        return parseDeploymentPlan(Streams.readFully(yaml));
+    }
+    
+    @SuppressWarnings("unchecked")
+    public DeploymentPlan parseDeploymentPlan(String yaml) {
+        Iterable<Object> template = Yamls.parseAll(yaml);
+        
+        Map<String, Object> dpRootUninterpreted = null;
+        try {
+            dpRootUninterpreted = Yamls.getAs(template, Map.class);
+        } catch (Exception e) {
+            Exceptions.propagateIfFatal(e);
+            throw new YAMLException("Plan not in acceptable format: "+(e.getMessage()!=null ? e.getMessage() : ""+e), e);
+        }
+        Map<String, Object> dpRootInterpreted = applyInterpreters(dpRootUninterpreted);
+        
+        return DeploymentPlan.of(dpRootInterpreted, yaml);
+    }
+    
+    /** create and return an AssemblyTemplate based on the given DP (yaml) */
+    public AssemblyTemplate registerDeploymentPlan(Reader yaml) {
+        DeploymentPlan plan = parseDeploymentPlan(yaml);
+        return registerDeploymentPlan(plan);
+    }
+
+    /** applies matchers to the given deployment plan to create an assembly template */
+    public AssemblyTemplate registerDeploymentPlan(DeploymentPlan plan) {
+        AssemblyTemplateConstructor atc = new AssemblyTemplateConstructor(campPlatform);
+        
+        if (plan.getName()!=null) atc.name(plan.getName());
+        if (plan.getDescription()!=null) atc.description(plan.getDescription());
+        if (plan.getSourceCode()!=null) atc.sourceCode(plan.getSourceCode());
+        // nothing done with origin just now...
+        
+        if (plan.getServices()!=null) {
+            for (Service svc: plan.getServices()) {
+                applyMatchers(svc, atc);
+            }
+        }
+
+        if (plan.getArtifacts()!=null) {
+            for (Artifact art: plan.getArtifacts()) {
+                applyMatchers(art, atc);
+            }
+        }
+
+        Map<String, Object> attrs = plan.getCustomAttributes();
+        if (attrs!=null && !attrs.isEmpty()) {
+            Map<String, Object> customAttrs = attrs;
+            if (customAttrs.containsKey("id")) {
+                // id shouldn't be leaking to entities, see InternalEntityFactory.createEntityAndDescendantsUninitialized.
+                // If set it will go through to the spec because AbstractBrooklynObject has @SetFromFlag("id") on the id property.
+                // Follows logic in BrooklynEntityMatcher.apply(...).
+                customAttrs = MutableMap.copyOf(attrs);
+                customAttrs.put("planId", customAttrs.remove("id"));
+            }
+            atc.addCustomAttributes(customAttrs);
+        }
+        
+        if (atc.getInstantiator()==null)
+            // set a default instantiator which just invokes the component's instantiators
+            // (or throws unsupported exceptions, currently!)
+            atc.instantiator(BasicAssemblyTemplateInstantiator.class);
+
+        return atc.commit();
+    }
+    
+    public AssemblyTemplate registerPdpFromArchive(InputStream archiveInput) {
+        try {
+            ArchiveInputStream input = new ArchiveStreamFactory()
+                .createArchiveInputStream(archiveInput);
+            
+            while (true) {
+                ArchiveEntry entry = input.getNextEntry();
+                if (entry==null) break;
+                // TODO unpack entry, create a space on disk holding the archive ?
+            }
+
+            // use yaml...
+            throw new UnsupportedOperationException("in progress");
+            
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+
+
+    // ----------------------------
+    
+    public void addMatcher(PdpMatcher m) {
+        // TODO a list is a crude way to do matching ... but good enough to start
+        matchers.add(m);
+    }
+
+    public List<PdpMatcher> getMatchers() {
+        return matchers;
+    }
+
+
+    protected void applyMatchers(Object deploymentPlanItem, AssemblyTemplateConstructor atc) {
+        for (PdpMatcher matcher: getMatchers()) {
+            if (matcher.accepts(deploymentPlanItem)) {
+                // TODO first accepting is a crude way to do matching ... but good enough to start
+                if (matcher.apply(deploymentPlanItem, atc))
+                    return;
+            }
+        }
+        throw new UnsupportedOperationException("Deployment plan item "+deploymentPlanItem+" cannot be matched");
+    }
+
+    // ----------------------------
+
+    public void addInterpreter(PlanInterpreter interpreter) {
+        interpreters.add(interpreter);
+    }
+    
+    /** returns a DeploymentPlan object which is the result of running the interpretation
+     * (with all interpreters) against the supplied deployment plan YAML object,
+     * essentially a post-parse processing step before matching */
+    @SuppressWarnings("unchecked")
+    @VisibleForTesting
+    public Map<String, Object> applyInterpreters(Map<String, Object> originalDeploymentPlan) {
+        PlanInterpretationNode interpretation = new PlanInterpretationNode(
+                new PlanInterpretationContext(originalDeploymentPlan, interpreters));
+        return (Map<String, Object>) interpretation.getNewValue();
+    }
+    
+}



[5/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java
new file mode 100644
index 0000000..dbf20cc
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java
@@ -0,0 +1,113 @@
+/*
+ * 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.camp.spi.resolve;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
+
+/** Interpreters modify the deployment plan, in a depth-first evaluation,
+ * typically by looking for items which begin with "$namespace:"
+ * <p>
+ * Most common usages simple need to supply {@link #applyYamlPrimitive(PlanInterpretationNode)} which can invoke
+ * {@link PlanInterpretationNode#setNewValue(Object)} to change.
+ * The {@link PlanInterpreterAdapter} makes this easy by supplying all methods but that.
+ * <p>
+ * For more sophisticated usages, to act on entire maps or lists,
+ * there are a number of other hook functions, described below.
+ *  */
+public interface PlanInterpreter {
+
+    /** guard to prevent any apply calls when an Interpreter is not interested in a node */
+    boolean isInterestedIn(PlanInterpretationNode node);
+    
+    /** provides an opportunity for an interpreter to change the value at a node,
+     * using {@link PlanInterpretationNode#get()} and {@link PlanInterpretationNode#setNewValue(Object)} */
+    void applyYamlPrimitive(PlanInterpretationNode node);
+
+    /** invoked at a Map node in a YAML tree, before any conversion to mapOut.
+     * mapIn is initially a copy of {@link PlanInterpretationNode#get()}, but it is mutable,
+     * and any mutations are passed to subsequent interpreters and used for recursion.
+     * <p>
+     * the return value indicates whether to recurse into the item.
+     * if any interpreters return false, the node is not recursed. 
+     * (callers may use {@link PlanInterpretationNode#setNewValue(Object)} to set a custom return value.) */
+    boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn);
+
+    /** invoked at a Map node in a YAML tree, after {@link #applyMapBefore(PlanInterpretationNode, Map)},
+     * and after recursing into the value and then key arguments supplied here,
+     * but before inserting it into the mapOut for this node. 
+     * <p>
+     * the return value indicates whether to add this key-value to the mapOut.
+     * if any interpreters return false, the entry is not added. 
+     * (callers may modify mapOut to add/change values, or may modify key/value directly.) */
+    boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
+                            PlanInterpretationNode key, PlanInterpretationNode value);
+
+    /** invoked at a Map node in a YAML tree, after all entries have been passed to all interpreters' 
+     * {@link #applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode)}.
+     * mapOut can be modified yet further. */
+    void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut);
+
+    /** as {@link #applyMapBefore(PlanInterpretationNode, Map)} but for lists */
+    boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn);
+
+    /** as {@link #applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode) but for lists */
+    boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut,
+                            PlanInterpretationNode value);
+
+    /** as {@link #applyMapAfter(PlanInterpretationNode, Map, Map)} but for lists  */
+    void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut);
+
+    
+    public abstract static class PlanInterpreterAdapter implements PlanInterpreter {
+
+        @Override
+        public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
+            return true;
+        }
+
+        @Override
+        public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
+                                PlanInterpretationNode key, PlanInterpretationNode value) {
+            return true;
+        }
+
+        @Override
+        public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
+        }
+
+        @Override
+        public boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn) {
+            return true;
+        }
+
+        @Override
+        public boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut,
+                                PlanInterpretationNode value) {
+            return true;
+        }
+
+        @Override
+        public void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut) {
+        }
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
new file mode 100644
index 0000000..08053cb
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
@@ -0,0 +1,152 @@
+/*
+ * 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.camp.spi.resolve.interpret;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class PlanInterpretationContext {
+
+    private final Map<String,Object> originalDeploymentPlan;
+    private final List<PlanInterpreter> interpreters;
+    private final PlanInterpreter allInterpreter;
+
+    public PlanInterpretationContext(Map<String,Object> originalDeploymentPlan, List<PlanInterpreter> interpreters) {
+        super();
+        this.originalDeploymentPlan = ImmutableMap.copyOf(originalDeploymentPlan);
+        this.interpreters = ImmutableList.copyOf(interpreters);
+        this.allInterpreter = new PlanInterpreter() {
+            @Override
+            public boolean isInterestedIn(PlanInterpretationNode node) {
+                return true;
+            }
+            
+            @Override
+            public void applyYamlPrimitive(PlanInterpretationNode node) {
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) {
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(node)) {
+                        i.applyYamlPrimitive(node);
+                    }
+                }
+            }
+
+            @Override
+            public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
+                boolean result = true;
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) {
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(node)) {
+                        boolean ri= i.applyMapBefore(node, mapIn);
+                        result &= ri;
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut, 
+                                    PlanInterpretationNode key, PlanInterpretationNode value) {
+                boolean result = true;
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(key)) {
+                        boolean ri = i.applyMapEntry(node, mapIn, mapOut, key, value);
+                        result &= ri;
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(node)) {
+                        i.applyMapAfter(node, mapIn, mapOut);
+                    }
+                }
+            }
+
+            @Override
+            public boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn) {
+                boolean result = true;
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(node)) {
+                        boolean ri = i.applyListBefore(node, listIn);
+                        result &= ri;
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut, 
+                                    PlanInterpretationNode value) {
+                boolean result = true;
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(value)) {
+                        boolean ri = i.applyListEntry(node, listIn, listOut, value);
+                        result &= ri;
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut) {
+                for (PlanInterpreter i: PlanInterpretationContext.this.interpreters) { 
+                    if (node.isExcluded())
+                        break;
+                    if (i.isInterestedIn(node)) {
+                        i.applyListAfter(node, listIn, listOut);
+                    }
+                }
+            }
+
+        };
+    }
+
+    /** returns an interpreter which recurses through all interpreters */
+    PlanInterpreter getAllInterpreter() {
+        return allInterpreter;
+    }
+
+    public Map<String,Object> getOriginalDeploymentPlan() {
+        return originalDeploymentPlan;
+    }
+
+    public List<PlanInterpreter> getInterpreters() {
+        return interpreters;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
new file mode 100644
index 0000000..43428ed
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
@@ -0,0 +1,262 @@
+/*
+ * 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.camp.spi.resolve.interpret;
+
+import java.util.Map;
+
+import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.text.StringPredicates;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/** Helper class for {@link PlanInterpreter} instances, doing the recursive work */
+public class PlanInterpretationNode {
+
+    private static final Logger log = LoggerFactory.getLogger(PlanInterpretationNode.class);
+    
+    public enum Role { MAP_KEY, MAP_VALUE, LIST_ENTRY, YAML_PRIMITIVE }
+
+    protected final PlanInterpretationNode parent;
+    protected final Role roleInParent;
+    protected final Object originalValue;
+    protected final PlanInterpretationContext context;
+    protected Object newValue = null;
+    protected Boolean changed = null;
+    protected boolean excluded = false;
+    protected boolean immutable = false;
+
+    /** creates a root node with {@link #apply()} called */
+    public PlanInterpretationNode(PlanInterpretationContext context) {
+        this.parent = null;
+        this.roleInParent = null;
+        this.originalValue = context.getOriginalDeploymentPlan();
+        this.context = context;
+        apply();
+    }
+
+    /** internal use: creates an internal node on which {@link #apply()} has *not* been called */
+    protected PlanInterpretationNode(PlanInterpretationNode parent, Role roleInParent, Object originalItem) {
+        this.parent = parent;
+        this.roleInParent = roleInParent;
+        this.originalValue = originalItem;
+        this.context = parent.getContext();
+    }
+
+    public PlanInterpretationContext getContext() {
+        return context;
+    }
+
+    public PlanInterpretationNode getParent() {
+        return parent;
+    }
+    
+    public Role getRoleInParent() {
+        return roleInParent;
+    }
+    
+    protected void apply() {
+        if (changed!=null) throw new IllegalStateException("can only be applied once");
+
+        if (!excluded) {
+            if (originalValue instanceof Map) {
+                applyToMap();
+                immutable();
+            } else if (originalValue instanceof Iterable) {
+                applyToIterable();
+                immutable();
+            } else {
+                applyToYamlPrimitive();
+            }
+        }
+        
+        if (changed==null) changed = false;
+    }
+
+    /** convenience for interpreters, tests if nodes are not excluded, and if not:
+     * for string nodes, true iff the current value equals the given target;
+     * for nodes which are currently maps or lists,
+     * true iff not excluded and the value contains such an entry (key, in the case of map)
+     **/
+    public boolean matchesLiteral(String target) {
+        if (isExcluded()) return false; 
+        if (getNewValue() instanceof CharSequence)
+            return getNewValue().toString().equals(target);
+        if (getNewValue() instanceof Map)
+            return ((Map<?,?>)getOriginalValue()).containsKey(target);
+        if (getNewValue() instanceof Iterable)
+            return Iterables.contains((Iterable<?>)getOriginalValue(), target);
+        return false;
+    }
+
+    /** convenience for interpreters, tests if nodes are not excluded, and if not:
+     * for string nodes, true iff the current value starts with the given prefix;
+     * for nodes which are currently maps or lists,
+     * true iff not excluded and the value contains such an entry (key, in the case of map) */
+    public boolean matchesPrefix(String prefix) {
+        if (isExcluded()) return false; 
+        if (getNewValue() instanceof CharSequence)
+            return getNewValue().toString().startsWith(prefix);
+        if (getNewValue() instanceof Map)
+            return Iterables.tryFind(((Map<?,?>)getNewValue()).keySet(), StringPredicates.isStringStartingWith(prefix)).isPresent();
+        if (getNewValue() instanceof Iterable)
+            return Iterables.tryFind((Iterable<?>)getNewValue(), StringPredicates.isStringStartingWith(prefix)).isPresent();
+        return false;
+    }
+    
+    // TODO matchesRegex ?
+
+    public Object getOriginalValue() {
+        return originalValue;
+    }
+
+    public Object getNewValue() {
+        if (changed==null || !isChanged()) return originalValue;
+        return newValue;
+    }
+
+    public boolean isChanged() {
+        if (changed==null) throw new IllegalStateException("not yet applied");
+        return changed;
+    }
+
+    public boolean isExcluded() {
+        return excluded;
+    }
+    
+    /** indicates that a node should no longer be translated */
+    public PlanInterpretationNode exclude() {
+        this.excluded = true;
+        return this;
+    }
+    
+    public PlanInterpretationNode setNewValue(Object newItem) {
+        if (immutable)
+            throw new IllegalStateException("Node "+this+" has been set immutable");
+        this.newValue = newItem;
+        this.changed = true;
+        return this;
+    }
+
+    protected PlanInterpretationNode newPlanInterpretation(PlanInterpretationNode parent, Role roleInParent, Object item) {
+        return new PlanInterpretationNode(parent, roleInParent, item);
+    }
+
+    protected void applyToMap() {
+        Map<Object, Object> input = MutableMap.<Object,Object>copyOf((Map<?,?>)originalValue);
+        Map<Object, Object> result = MutableMap.<Object,Object>of();
+        newValue = result;
+
+        // first do a "whole-node" application
+        if (getContext().getAllInterpreter().applyMapBefore(this, input)) {
+
+            for (Map.Entry<Object,Object> entry: input.entrySet()) {
+                // then recurse in to this node and do various in-the-node applications
+                PlanInterpretationNode value = newPlanInterpretation(this, Role.MAP_VALUE, entry.getValue());
+                value.apply();
+
+                PlanInterpretationNode key = newPlanInterpretation(this, Role.MAP_KEY, entry.getKey());
+                key.apply();
+
+                if (key.isChanged() || value.isChanged()) 
+                    changed = true;
+
+                if (getContext().getAllInterpreter().applyMapEntry(this, input, result, key, value))
+                    result.put(key.getNewValue(), value.getNewValue());
+                else
+                    changed = true;
+            }
+
+            // finally try applying to this node again
+            getContext().getAllInterpreter().applyMapAfter(this, input, result);
+        }
+
+        if (changed==null) changed = false;
+    }
+
+    protected void applyToIterable() {
+        MutableList<Object> input = MutableList.copyOf((Iterable<?>)originalValue);
+        MutableList<Object> result = new MutableList<Object>();
+        newValue = result;
+
+        // first do a "whole-node" application
+        if (getContext().getAllInterpreter().applyListBefore(this, input)) {
+
+            for (Object entry: input) {
+                // then recurse in to this node and do various in-the-node applications
+                PlanInterpretationNode value = newPlanInterpretation(this, Role.LIST_ENTRY, entry);
+                value.apply();
+
+                if (value.isChanged()) 
+                    changed = true;
+
+                if (getContext().getAllInterpreter().applyListEntry(this, input, result, value))
+                    result.add(value.getNewValue());
+            }
+
+            // finally try applying to this node again
+            getContext().getAllInterpreter().applyListAfter(this, input, result);
+        }
+
+        if (changed==null) changed = false;
+    }
+
+    protected void applyToYamlPrimitive() {
+        getContext().getAllInterpreter().applyYamlPrimitive(this);
+    }
+
+    public void immutable() {
+        if (!isChanged()) {
+            if (!testCollectionImmutable(getNewValue())) {
+                // results of Yaml parse are not typically immutable,
+                // so force them to be changed so result of interpretation is immutable
+                changed = true;
+                setNewValue(immutable(getNewValue()));
+            }
+        } else {
+            setNewValue(immutable(getNewValue()));
+        }
+        checkImmutable(getNewValue());
+        immutable = true;
+    }
+    
+    private void checkImmutable(Object in) {
+        if (!testCollectionImmutable(in))
+            log.warn("Node original value "+in+" at "+this+" should be immutable");
+    }
+    
+    private static boolean testCollectionImmutable(Object in) {
+        if (in instanceof Map) return (in instanceof ImmutableMap);
+        if (in instanceof Iterable) return (in instanceof ImmutableList);
+        return true;
+    }
+
+    private static Object immutable(Object in) {
+        if (in instanceof Map) return ImmutableMap.copyOf((Map<?,?>)in);
+        if (in instanceof Iterable) return ImmutableList.copyOf((Iterable<?>)in);
+        return in;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/main/java/org/apache/brooklyn/camp/util/yaml/Yamls.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/main/java/org/apache/brooklyn/camp/util/yaml/Yamls.java b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/util/yaml/Yamls.java
new file mode 100644
index 0000000..1c2c379
--- /dev/null
+++ b/camp/camp-base/src/main/java/org/apache/brooklyn/camp/util/yaml/Yamls.java
@@ -0,0 +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.camp.util.yaml;
+
+/** @deprecated since 0.7.0 use {@link brooklyn.util.yaml.Yamls} */
+@Deprecated
+public class Yamls extends brooklyn.util.yaml.Yamls {
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java b/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
deleted file mode 100644
index 29f8abf..0000000
--- a/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.spi.resolve.PlanInterpreter.PlanInterpreterAdapter;
-import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
-
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.stream.Streams;
-import brooklyn.util.text.Strings;
-import brooklyn.util.yaml.Yamls;
-
-@Test
-public class DeploymentPlanToyInterpreterTest {
-
-    private static final Logger log = LoggerFactory.getLogger(DeploymentPlanToyInterpreterTest.class);
-    
-    /**
-     * Allows testing:
-     * 
-     * $sample:foo becomes "bar"
-     * $sample:caps:x capitalises the argument x
-     * $sample:ignore as key causes key-value to be dropped (and value 0 for good measure)
-     * $sample:reset causes containing map or list to be cleared at that point
-     * $sample:remove as key causes argument as map to be dropped
-     */
-    public static class ToyInterpreter extends PlanInterpreterAdapter {
-        
-        @Override
-        public boolean isInterestedIn(PlanInterpretationNode node) {
-            return node.matchesPrefix("$sample:");
-        }
-        
-        @Override
-        public void applyYamlPrimitive(PlanInterpretationNode node) {
-            if (node.matchesLiteral("$sample:foo")) node.setNewValue("bar").exclude();
-            if (node.matchesPrefix("$sample:caps:")) {
-                node.setNewValue(Strings.removeFromStart(node.getNewValue().toString(), "$sample:caps:").toUpperCase()).exclude();
-            }
-        }
-
-        @Override
-        public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
-            if (node.matchesLiteral("$sample:ignore"))
-                // replace
-                mapIn.put("$sample:ignore", 0);
-            return super.applyMapBefore(node, mapIn);
-        }
-        
-        @Override
-        public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
-                                PlanInterpretationNode key, PlanInterpretationNode value) {
-            if (key.matchesLiteral("$sample:ignore")) {
-                Assert.assertEquals(value.getNewValue(), 0);
-                return false;
-            }
-            if (key.matchesLiteral("$sample:reset")) {
-                mapOut.clear();
-                return false;
-            }
-            
-            return super.applyMapEntry(node, mapIn, mapOut, key, value);
-        }
-
-        @SuppressWarnings("rawtypes")
-        @Override
-        public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
-            if (mapOut.containsKey("$sample:remove")) {
-                Map toRemove = (Map) mapOut.get("$sample:remove");
-                for (Object vv: toRemove.keySet()) mapOut.remove(vv);
-                mapOut.remove("$sample:remove");
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void testToyInterpreter() {
-        @SuppressWarnings("rawtypes")
-        Map y1 = Yamls.getAs( Yamls.parseAll( Streams.reader(getClass().getResourceAsStream("yaml-sample-toy-interpreter.yaml"))), Map.class );
-        log.info("pre-interpreter have: "+y1);
-        
-        BasicCampPlatform p = new BasicCampPlatform();
-        p.pdp().addInterpreter(new ToyInterpreter());
-        Map<String, Object> y2 = p.pdp().applyInterpreters(y1);
-        log.info("interpreter gives: "+y2);
-        
-        Map<String, Object> y3 = Yamls.getAs( Yamls.parseAll( Streams.reader(getClass().getResourceAsStream("yaml-sample-toy-interpreter-result.yaml"))), Map.class );
-        Assert.assertEquals(y2, y3);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/PdpYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/PdpYamlTest.java b/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/PdpYamlTest.java
deleted file mode 100644
index 70170d7..0000000
--- a/camp/camp-base/src/test/java/io/brooklyn/camp/spi/pdp/PdpYamlTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 io.brooklyn.camp.spi.pdp;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.stream.Streams;
-
-public class PdpYamlTest {
-
-    private static final Logger log = LoggerFactory.getLogger(PdpYamlTest.class);
-    
-    @Test
-    public void testSimpleYamlArtifactParse() throws IOException {
-        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
-        Reader input = Streams.reader(getClass().getResourceAsStream("pdp-single-artifact.yaml"));
-        DeploymentPlan plan = platform.pdp().parseDeploymentPlan(input);
-        log.info("DP is:\n"+plan.toString());
-        Assert.assertEquals(plan.getName(), "sample");
-        Assert.assertEquals(plan.getArtifacts().size(), 1);
-        Assert.assertEquals(plan.getServices().size(), 0);
-        
-        Artifact artifact1 = plan.getArtifacts().iterator().next();
-        Assert.assertEquals(artifact1.getName(), "sample WAR");
-    }
-    
-    @Test
-    public void testSimpleYamlServiceParse() throws IOException {
-        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
-        Reader input = Streams.reader(getClass().getResourceAsStream("pdp-single-service.yaml"));
-        DeploymentPlan plan = platform.pdp().parseDeploymentPlan(input);
-        log.info("DP is:\n"+plan.toString());
-        Assert.assertEquals(plan.getName(), "sample");
-        Assert.assertEquals(plan.getArtifacts().size(), 0);
-        Assert.assertEquals(plan.getServices().size(), 1);
-        
-        Service service1 = plan.getServices().iterator().next();
-        Assert.assertEquals(service1.getName(), "Hello WAR");
-    }
-    
-    @Test
-    public void testSimpleYamlMatch() throws IOException {
-        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
-        Reader input = new InputStreamReader(getClass().getResourceAsStream("pdp-single-artifact.yaml"));
-        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-        log.info("AT is:\n"+at.toString());
-        Assert.assertEquals(at.getApplicationComponentTemplates().links().size(), 1);
-        Assert.assertEquals(at.getName(), "sample");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java b/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
deleted file mode 100644
index 1d2628d..0000000
--- a/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 io.brooklyn.camp.test.mock.web;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MockAssemblyTemplateInstantiator implements AssemblyTemplateInstantiator {
-
-    private static final Logger log = LoggerFactory.getLogger(MockAssemblyTemplateInstantiator.class);
-    
-    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
-        log.debug("Ignoring request to instantiate "+template);
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockWebPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockWebPlatform.java b/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockWebPlatform.java
deleted file mode 100644
index 1e76380..0000000
--- a/camp/camp-base/src/test/java/io/brooklyn/camp/test/mock/web/MockWebPlatform.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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 io.brooklyn.camp.test.mock.web;
-
-import javax.annotation.Nullable;
-
-import brooklyn.util.guava.Maybe;
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.BasicResourceLookup;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import io.brooklyn.camp.spi.pdp.Artifact;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
-import io.brooklyn.camp.spi.pdp.Service;
-import io.brooklyn.camp.spi.resolve.PdpMatcher;
-
-public class MockWebPlatform {
-
-    public static final ApplicationComponentTemplate WAR = 
-            ApplicationComponentTemplate.builder()
-                .name("io.camp.mock:WAR")
-                .description("Mock WAR")
-                .build();
-
-    public static final PlatformComponentTemplate APPSERVER = 
-            PlatformComponentTemplate.builder()
-                .name("io.camp.mock:AppServer")
-                .description("Mock Application Server")
-                .build();
-
-    public static final PlatformComponentTemplate DATABASE = 
-            PlatformComponentTemplate.builder()
-                .name("io.camp.mock:Database")
-                .description("Mock Database")
-                .build();
-
-    public static final AssemblyTemplate ASSEMBLY1 =
-            AssemblyTemplate.builder()
-                .name("WebAppAssembly1")
-                .description("Mock Web App Assembly Template")
-                .applicationComponentTemplates(BasicResourceLookup.of(WAR))
-                .instantiator(MockAssemblyTemplateInstantiator.class)
-                .build();
-
-    public static final PdpMatcher WAR_GETS_WAR_MATCHER = new PdpMatcher.ArtifactMatcher("com.java:WAR") {
-        public boolean apply(Object art, AssemblyTemplateConstructor atc) {
-            ApplicationComponentTemplate act = ApplicationComponentTemplate.builder()
-                    .name( ((Artifact)art).getName() )
-                    .description( ((Artifact)art).getDescription() )
-                    .customAttribute("implementation", WAR.getName())
-                    .customAttribute("artifactType", ((Artifact)art).getArtifactType())
-                    .build();
-
-            // TODO requirements, etc
-            
-            atc.add(act);
-            
-            return true;
-        }
-    };
-
-    public static final PdpMatcher newLiteralServiceTypeToPlatformComponentTemplateMatcher(final BasicCampPlatform platform, @Nullable final Class<? extends AssemblyTemplateInstantiator> instantiator) {
-        return new PdpMatcher() {
-            public boolean apply(Object item, AssemblyTemplateConstructor atc) {
-                if (!(item instanceof Service)) return false;
-                Service svc = (Service)item;
-                String type = svc.getServiceType();
-                
-                for (ResolvableLink<PlatformComponentTemplate> t: platform.platformComponentTemplates().links()) {
-                    if (type.equals(t.getName())) {
-                        PlatformComponentTemplate pct = PlatformComponentTemplate.builder()
-                            .name(svc.getName())
-                            .customAttribute("serviceType", type)
-                            .description(Maybe.fromNullable(svc.getDescription()).or(t.resolve().getDescription()))
-                            .build();
-                        if (atc!=null) {
-                            atc.add(pct);
-                            if (instantiator!=null)
-                                atc.instantiator(instantiator);
-                        }
-                        return true;
-                    }
-                }
-                return false;
-            }
-
-            @Override
-            public boolean accepts(Object deploymentPlanItem) {
-                return apply(deploymentPlanItem, null);
-            }
-        };
-    }
-    
-    public static <T extends BasicCampPlatform> T populate(T platform) {
-        return populate(platform, null);
-    }
-    public static <T extends BasicCampPlatform> T populate(T platform, @Nullable Class<? extends AssemblyTemplateInstantiator> instantiator) {
-        platform.platformComponentTemplates().addAll(APPSERVER, DATABASE);
-        platform.applicationComponentTemplates().add(WAR);
-        platform.assemblyTemplates().add(ASSEMBLY1);
-        
-        platform.pdp().addMatcher(WAR_GETS_WAR_MATCHER);
-        platform.pdp().addMatcher(newLiteralServiceTypeToPlatformComponentTemplateMatcher(platform, instantiator));
-        
-        return platform;
-    }
-
-    public static BasicCampPlatform newPlatform() {
-        return MockWebPlatform.populate(new BasicCampPlatform());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/io/brooklyn/camp/test/platform/BasicCampPlatformTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/io/brooklyn/camp/test/platform/BasicCampPlatformTest.java b/camp/camp-base/src/test/java/io/brooklyn/camp/test/platform/BasicCampPlatformTest.java
deleted file mode 100644
index d92bece..0000000
--- a/camp/camp-base/src/test/java/io/brooklyn/camp/test/platform/BasicCampPlatformTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 io.brooklyn.camp.test.platform;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class BasicCampPlatformTest {
-
-    @Test
-    public void testEmptyPlatform() {
-        BasicCampPlatform p = new BasicCampPlatform();
-        assertResourceFieldsNotNull(p.root());
-        Assert.assertEquals(p.platformComponentTemplates().links().size(), 0);
-    }        
-
-    @Test
-    public void testWebPctSetup() {
-        BasicCampPlatform p = new BasicCampPlatform();
-        p.platformComponentTemplates().add(MockWebPlatform.APPSERVER);
-        
-        assertResourceFieldsNotNull(p.root());
-        
-        Assert.assertEquals(p.platformComponentTemplates().links().size(), 1);
-        ResolvableLink<PlatformComponentTemplate> l = p.platformComponentTemplates().links().get(0);
-        assertLinkFieldsNotNull(l);
-        Assert.assertEquals(l.getName(), "io.camp.mock:AppServer");
-        
-        PlatformComponentTemplate pct = l.resolve();
-        assertResourceFieldsNotNull(pct);
-    }        
-
-    @Test
-    public void testWarActSetup() {
-        BasicCampPlatform p = new BasicCampPlatform();
-        p.applicationComponentTemplates().add(MockWebPlatform.WAR);
-        
-        assertResourceFieldsNotNull(p.root());
-        
-        Assert.assertEquals(p.platformComponentTemplates().links().size(), 0);
-        Assert.assertEquals(p.applicationComponentTemplates().links().size(), 1);
-        ResolvableLink<ApplicationComponentTemplate> l = p.applicationComponentTemplates().links().get(0);
-        assertLinkFieldsNotNull(l);
-        Assert.assertEquals(l.getName(), "io.camp.mock:WAR");
-        
-        ApplicationComponentTemplate act = l.resolve();
-        assertResourceFieldsNotNull(act);
-    }        
-
-
-    public static void assertLinkFieldsNotNull(ResolvableLink<?> x) {
-        Assert.assertNotNull(x.getId());
-        Assert.assertNotNull(x.getName());
-    }
-
-    public static void assertResourceFieldsNotNull(AbstractResource x) {
-        Assert.assertNotNull(x.getId());
-        Assert.assertNotNull(x.getType());
-        Assert.assertNotNull(x.getCreated());
-        Assert.assertNotNull(x.getName());
-        Assert.assertNotNull(x.getTags());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
new file mode 100644
index 0000000..c87641f
--- /dev/null
+++ b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.util.Map;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter.PlanInterpreterAdapter;
+import org.apache.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.stream.Streams;
+import brooklyn.util.text.Strings;
+import brooklyn.util.yaml.Yamls;
+
+@Test
+public class DeploymentPlanToyInterpreterTest {
+
+    private static final Logger log = LoggerFactory.getLogger(DeploymentPlanToyInterpreterTest.class);
+    
+    /**
+     * Allows testing:
+     * 
+     * $sample:foo becomes "bar"
+     * $sample:caps:x capitalises the argument x
+     * $sample:ignore as key causes key-value to be dropped (and value 0 for good measure)
+     * $sample:reset causes containing map or list to be cleared at that point
+     * $sample:remove as key causes argument as map to be dropped
+     */
+    public static class ToyInterpreter extends PlanInterpreterAdapter {
+        
+        @Override
+        public boolean isInterestedIn(PlanInterpretationNode node) {
+            return node.matchesPrefix("$sample:");
+        }
+        
+        @Override
+        public void applyYamlPrimitive(PlanInterpretationNode node) {
+            if (node.matchesLiteral("$sample:foo")) node.setNewValue("bar").exclude();
+            if (node.matchesPrefix("$sample:caps:")) {
+                node.setNewValue(Strings.removeFromStart(node.getNewValue().toString(), "$sample:caps:").toUpperCase()).exclude();
+            }
+        }
+
+        @Override
+        public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) {
+            if (node.matchesLiteral("$sample:ignore"))
+                // replace
+                mapIn.put("$sample:ignore", 0);
+            return super.applyMapBefore(node, mapIn);
+        }
+        
+        @Override
+        public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
+                                PlanInterpretationNode key, PlanInterpretationNode value) {
+            if (key.matchesLiteral("$sample:ignore")) {
+                Assert.assertEquals(value.getNewValue(), 0);
+                return false;
+            }
+            if (key.matchesLiteral("$sample:reset")) {
+                mapOut.clear();
+                return false;
+            }
+            
+            return super.applyMapEntry(node, mapIn, mapOut, key, value);
+        }
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) {
+            if (mapOut.containsKey("$sample:remove")) {
+                Map toRemove = (Map) mapOut.get("$sample:remove");
+                for (Object vv: toRemove.keySet()) mapOut.remove(vv);
+                mapOut.remove("$sample:remove");
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testToyInterpreter() {
+        @SuppressWarnings("rawtypes")
+        Map y1 = Yamls.getAs( Yamls.parseAll( Streams.reader(getClass().getResourceAsStream("yaml-sample-toy-interpreter.yaml"))), Map.class );
+        log.info("pre-interpreter have: "+y1);
+        
+        BasicCampPlatform p = new BasicCampPlatform();
+        p.pdp().addInterpreter(new ToyInterpreter());
+        Map<String, Object> y2 = p.pdp().applyInterpreters(y1);
+        log.info("interpreter gives: "+y2);
+        
+        Map<String, Object> y3 = Yamls.getAs( Yamls.parseAll( Streams.reader(getClass().getResourceAsStream("yaml-sample-toy-interpreter-result.yaml"))), Map.class );
+        Assert.assertEquals(y2, y3);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
new file mode 100644
index 0000000..8cb88e0
--- /dev/null
+++ b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.camp.spi.pdp;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.pdp.Artifact;
+import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.stream.Streams;
+
+public class PdpYamlTest {
+
+    private static final Logger log = LoggerFactory.getLogger(PdpYamlTest.class);
+    
+    @Test
+    public void testSimpleYamlArtifactParse() throws IOException {
+        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
+        Reader input = Streams.reader(getClass().getResourceAsStream("pdp-single-artifact.yaml"));
+        DeploymentPlan plan = platform.pdp().parseDeploymentPlan(input);
+        log.info("DP is:\n"+plan.toString());
+        Assert.assertEquals(plan.getName(), "sample");
+        Assert.assertEquals(plan.getArtifacts().size(), 1);
+        Assert.assertEquals(plan.getServices().size(), 0);
+        
+        Artifact artifact1 = plan.getArtifacts().iterator().next();
+        Assert.assertEquals(artifact1.getName(), "sample WAR");
+    }
+    
+    @Test
+    public void testSimpleYamlServiceParse() throws IOException {
+        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
+        Reader input = Streams.reader(getClass().getResourceAsStream("pdp-single-service.yaml"));
+        DeploymentPlan plan = platform.pdp().parseDeploymentPlan(input);
+        log.info("DP is:\n"+plan.toString());
+        Assert.assertEquals(plan.getName(), "sample");
+        Assert.assertEquals(plan.getArtifacts().size(), 0);
+        Assert.assertEquals(plan.getServices().size(), 1);
+        
+        Service service1 = plan.getServices().iterator().next();
+        Assert.assertEquals(service1.getName(), "Hello WAR");
+    }
+    
+    @Test
+    public void testSimpleYamlMatch() throws IOException {
+        BasicCampPlatform platform = MockWebPlatform.populate(new BasicCampPlatform());
+        Reader input = new InputStreamReader(getClass().getResourceAsStream("pdp-single-artifact.yaml"));
+        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
+        log.info("AT is:\n"+at.toString());
+        Assert.assertEquals(at.getApplicationComponentTemplates().links().size(), 1);
+        Assert.assertEquals(at.getName(), "sample");
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
new file mode 100644
index 0000000..a358eed
--- /dev/null
+++ b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
@@ -0,0 +1,37 @@
+/*
+ * 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.camp.test.mock.web;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MockAssemblyTemplateInstantiator implements AssemblyTemplateInstantiator {
+
+    private static final Logger log = LoggerFactory.getLogger(MockAssemblyTemplateInstantiator.class);
+    
+    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
+        log.debug("Ignoring request to instantiate "+template);
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java
new file mode 100644
index 0000000..29aabd3
--- /dev/null
+++ b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java
@@ -0,0 +1,132 @@
+/*
+ * 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.camp.test.mock.web;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.pdp.Artifact;
+import org.apache.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+import org.apache.brooklyn.camp.spi.resolve.PdpMatcher;
+
+import brooklyn.util.guava.Maybe;
+
+public class MockWebPlatform {
+
+    public static final ApplicationComponentTemplate WAR = 
+            ApplicationComponentTemplate.builder()
+                .name("io.camp.mock:WAR")
+                .description("Mock WAR")
+                .build();
+
+    public static final PlatformComponentTemplate APPSERVER = 
+            PlatformComponentTemplate.builder()
+                .name("io.camp.mock:AppServer")
+                .description("Mock Application Server")
+                .build();
+
+    public static final PlatformComponentTemplate DATABASE = 
+            PlatformComponentTemplate.builder()
+                .name("io.camp.mock:Database")
+                .description("Mock Database")
+                .build();
+
+    public static final AssemblyTemplate ASSEMBLY1 =
+            AssemblyTemplate.builder()
+                .name("WebAppAssembly1")
+                .description("Mock Web App Assembly Template")
+                .applicationComponentTemplates(BasicResourceLookup.of(WAR))
+                .instantiator(MockAssemblyTemplateInstantiator.class)
+                .build();
+
+    public static final PdpMatcher WAR_GETS_WAR_MATCHER = new PdpMatcher.ArtifactMatcher("com.java:WAR") {
+        public boolean apply(Object art, AssemblyTemplateConstructor atc) {
+            ApplicationComponentTemplate act = ApplicationComponentTemplate.builder()
+                    .name( ((Artifact)art).getName() )
+                    .description( ((Artifact)art).getDescription() )
+                    .customAttribute("implementation", WAR.getName())
+                    .customAttribute("artifactType", ((Artifact)art).getArtifactType())
+                    .build();
+
+            // TODO requirements, etc
+            
+            atc.add(act);
+            
+            return true;
+        }
+    };
+
+    public static final PdpMatcher newLiteralServiceTypeToPlatformComponentTemplateMatcher(final BasicCampPlatform platform, @Nullable final Class<? extends AssemblyTemplateInstantiator> instantiator) {
+        return new PdpMatcher() {
+            public boolean apply(Object item, AssemblyTemplateConstructor atc) {
+                if (!(item instanceof Service)) return false;
+                Service svc = (Service)item;
+                String type = svc.getServiceType();
+                
+                for (ResolvableLink<PlatformComponentTemplate> t: platform.platformComponentTemplates().links()) {
+                    if (type.equals(t.getName())) {
+                        PlatformComponentTemplate pct = PlatformComponentTemplate.builder()
+                            .name(svc.getName())
+                            .customAttribute("serviceType", type)
+                            .description(Maybe.fromNullable(svc.getDescription()).or(t.resolve().getDescription()))
+                            .build();
+                        if (atc!=null) {
+                            atc.add(pct);
+                            if (instantiator!=null)
+                                atc.instantiator(instantiator);
+                        }
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+            @Override
+            public boolean accepts(Object deploymentPlanItem) {
+                return apply(deploymentPlanItem, null);
+            }
+        };
+    }
+    
+    public static <T extends BasicCampPlatform> T populate(T platform) {
+        return populate(platform, null);
+    }
+    public static <T extends BasicCampPlatform> T populate(T platform, @Nullable Class<? extends AssemblyTemplateInstantiator> instantiator) {
+        platform.platformComponentTemplates().addAll(APPSERVER, DATABASE);
+        platform.applicationComponentTemplates().add(WAR);
+        platform.assemblyTemplates().add(ASSEMBLY1);
+        
+        platform.pdp().addMatcher(WAR_GETS_WAR_MATCHER);
+        platform.pdp().addMatcher(newLiteralServiceTypeToPlatformComponentTemplateMatcher(platform, instantiator));
+        
+        return platform;
+    }
+
+    public static BasicCampPlatform newPlatform() {
+        return MockWebPlatform.populate(new BasicCampPlatform());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java
new file mode 100644
index 0000000..ccebaa6
--- /dev/null
+++ b/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.camp.test.platform;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class BasicCampPlatformTest {
+
+    @Test
+    public void testEmptyPlatform() {
+        BasicCampPlatform p = new BasicCampPlatform();
+        assertResourceFieldsNotNull(p.root());
+        Assert.assertEquals(p.platformComponentTemplates().links().size(), 0);
+    }        
+
+    @Test
+    public void testWebPctSetup() {
+        BasicCampPlatform p = new BasicCampPlatform();
+        p.platformComponentTemplates().add(MockWebPlatform.APPSERVER);
+        
+        assertResourceFieldsNotNull(p.root());
+        
+        Assert.assertEquals(p.platformComponentTemplates().links().size(), 1);
+        ResolvableLink<PlatformComponentTemplate> l = p.platformComponentTemplates().links().get(0);
+        assertLinkFieldsNotNull(l);
+        Assert.assertEquals(l.getName(), "io.camp.mock:AppServer");
+        
+        PlatformComponentTemplate pct = l.resolve();
+        assertResourceFieldsNotNull(pct);
+    }        
+
+    @Test
+    public void testWarActSetup() {
+        BasicCampPlatform p = new BasicCampPlatform();
+        p.applicationComponentTemplates().add(MockWebPlatform.WAR);
+        
+        assertResourceFieldsNotNull(p.root());
+        
+        Assert.assertEquals(p.platformComponentTemplates().links().size(), 0);
+        Assert.assertEquals(p.applicationComponentTemplates().links().size(), 1);
+        ResolvableLink<ApplicationComponentTemplate> l = p.applicationComponentTemplates().links().get(0);
+        assertLinkFieldsNotNull(l);
+        Assert.assertEquals(l.getName(), "io.camp.mock:WAR");
+        
+        ApplicationComponentTemplate act = l.resolve();
+        assertResourceFieldsNotNull(act);
+    }        
+
+
+    public static void assertLinkFieldsNotNull(ResolvableLink<?> x) {
+        Assert.assertNotNull(x.getId());
+        Assert.assertNotNull(x.getName());
+    }
+
+    public static void assertResourceFieldsNotNull(AbstractResource x) {
+        Assert.assertNotNull(x.getId());
+        Assert.assertNotNull(x.getType());
+        Assert.assertNotNull(x.getCreated());
+        Assert.assertNotNull(x.getName());
+        Assert.assertNotNull(x.getTags());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml b/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
deleted file mode 100644
index 0b4518b..0000000
--- a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# 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.
-#
-name: sample
-description: Tomcat sample JSP and servlet application.
-origin: http://www.oracle.com/nCAMP/Hand
-artifacts:
-  -
-    type: com.java:WAR
-    content: { href: sample.war }
-    name: sample WAR
-    description: Tomcat sample WAR file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-service.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-service.yaml b/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-service.yaml
deleted file mode 100644
index fe052d6..0000000
--- a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/pdp-single-service.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-name: sample
-description: Tomcat sample JSP and servlet application.
-origin: http://www.oracle.com/nCAMP/Hand
-services:
-  -
-    type: brooklyn:WebAppCluster
-    name: Hello WAR
-    wars:
-        /: hello.war
-    controller.spec:
-        port: 80

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml b/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
deleted file mode 100644
index 71b0ba8..0000000
--- a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-keep: 1
-mess:
-  a: bar
-  b: [ c, D ]

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml b/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
deleted file mode 100644
index 8aa01d2..0000000
--- a/camp/camp-base/src/test/resources/io/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-$sample:ignore: 1
-keep: 1
-mess:
-  2: z
-  $sample:reset: 
-  $sample:ignore: z
-  a: $sample:foo
-  b: [ c, "$sample:caps:d" ]
-  3: $sample:caps:x
-  $sample:remove: {3: X}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
new file mode 100644
index 0000000..0b4518b
--- /dev/null
+++ b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+name: sample
+description: Tomcat sample JSP and servlet application.
+origin: http://www.oracle.com/nCAMP/Hand
+artifacts:
+  -
+    type: com.java:WAR
+    content: { href: sample.war }
+    name: sample WAR
+    description: Tomcat sample WAR file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml
new file mode 100644
index 0000000..fe052d6
--- /dev/null
+++ b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+name: sample
+description: Tomcat sample JSP and servlet application.
+origin: http://www.oracle.com/nCAMP/Hand
+services:
+  -
+    type: brooklyn:WebAppCluster
+    name: Hello WAR
+    wars:
+        /: hello.war
+    controller.spec:
+        port: 80

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
new file mode 100644
index 0000000..71b0ba8
--- /dev/null
+++ b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+keep: 1
+mess:
+  a: bar
+  b: [ c, D ]

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
new file mode 100644
index 0000000..8aa01d2
--- /dev/null
+++ b/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+$sample:ignore: 1
+keep: 1
+mess:
+  2: z
+  $sample:reset: 
+  $sample:ignore: z
+  a: $sample:foo
+  b: [ c, "$sample:caps:d" ]
+  3: $sample:caps:x
+  $sample:remove: {3: X}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/io/brooklyn/camp/CampRestResources.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/io/brooklyn/camp/CampRestResources.java b/camp/camp-server/src/main/java/io/brooklyn/camp/CampRestResources.java
deleted file mode 100644
index 830f646..0000000
--- a/camp/camp-server/src/main/java/io/brooklyn/camp/CampRestResources.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 io.brooklyn.camp;
-
-import io.brooklyn.camp.rest.resource.AbstractCampRestResource;
-import io.brooklyn.camp.rest.resource.ApidocRestResource;
-import io.brooklyn.camp.rest.resource.ApplicationComponentRestResource;
-import io.brooklyn.camp.rest.resource.ApplicationComponentTemplateRestResource;
-import io.brooklyn.camp.rest.resource.AssemblyRestResource;
-import io.brooklyn.camp.rest.resource.AssemblyTemplateRestResource;
-import io.brooklyn.camp.rest.resource.PlatformComponentRestResource;
-import io.brooklyn.camp.rest.resource.PlatformComponentTemplateRestResource;
-import io.brooklyn.camp.rest.resource.PlatformRestResource;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.rest.apidoc.ApidocHelpMessageBodyWriter;
-
-import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-import com.google.common.collect.Iterables;
-
-public class CampRestResources {
-
-    public static Iterable<AbstractCampRestResource> getCampRestResources() {
-        List<AbstractCampRestResource> resources = new ArrayList<AbstractCampRestResource>();
-        resources.add(new PlatformRestResource());
-        resources.add(new AssemblyTemplateRestResource());
-        resources.add(new PlatformComponentTemplateRestResource());
-        resources.add(new ApplicationComponentTemplateRestResource());
-        resources.add(new AssemblyRestResource());
-        resources.add(new PlatformComponentRestResource());
-        resources.add(new ApplicationComponentRestResource());
-        return resources;
-    }
-
-    public static Iterable<Object> getApidocResources() {
-        List<Object> resources = new ArrayList<Object>();
-        resources.add(new ApidocHelpMessageBodyWriter());
-        resources.add(new ApidocRestResource());
-        return resources;
-    }
-
-    public static Iterable<Object> getMiscResources() {
-        List<Object> resources = new ArrayList<Object>();
-        resources.add(new JacksonJsonProvider());
-        return resources;
-    }
-
-    public static Iterable<Object> getAllResources() {
-        return Iterables.concat(getCampRestResources(), getApidocResources(), getMiscResources());
-    }
-
-}