You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:51:22 UTC

[40/51] [abbrv] [partial] brooklyn-server git commit: move subdir from incubator up a level as it is promoted to its own repo (first non-incubator commit!)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Assembly.java
deleted file mode 100644
index 58b3064..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AssemblyTemplate.java
deleted file mode 100644
index 423c3b4..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/Link.java
deleted file mode 100644
index 00a22b6..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponent.java
deleted file mode 100644
index fa5eddb..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformComponentTemplate.java
deleted file mode 100644
index 2377519..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformRootSummary.java
deleted file mode 100644
index d8713df..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/PlatformTransaction.java
deleted file mode 100644
index ae54beb..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AbstractResourceLookup.java
deleted file mode 100644
index 1709087..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
deleted file mode 100644
index fe05a0c..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/AggregatingResourceLookup.java
+++ /dev/null
@@ -1,57 +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 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>>();
-    
-    @SafeVarargs
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/BasicResourceLookup.java
deleted file mode 100644
index f1d3176..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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 org.apache.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(@SuppressWarnings("unchecked") 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;
-    }
-    
-    @SafeVarargs
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResolvableLink.java
deleted file mode 100644
index 81fea30..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/collection/ResourceLookup.java
deleted file mode 100644
index 7fc5a71..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/AssemblyTemplateInstantiator.java
deleted file mode 100644
index 5c0d9d6..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/instantiate/BasicAssemblyTemplateInstantiator.java
deleted file mode 100644
index 82751c3..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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("No instantiator could be found which understands the submitted plan. Basic instantiator not yet supported.");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
deleted file mode 100644
index e462f45..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Artifact.java
+++ /dev/null
@@ -1,98 +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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
deleted file mode 100644
index 8817a23..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactContent.java
+++ /dev/null
@@ -1,64 +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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.java
deleted file mode 100644
index 6b97a46..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ArtifactRequirement.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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/AssemblyTemplateConstructor.java
deleted file mode 100644
index a5814fc..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
deleted file mode 100644
index 7ad3164..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlan.java
+++ /dev/null
@@ -1,147 +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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-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 MutableList.copyOf(artifacts).asUnmodifiable();
-    }
-
-    public List<Service> getServices() {
-        return MutableList.copyOf(services).asUnmodifiable();
-    }
-
-    public Map<String, Object> getCustomAttributes() {
-        return MutableMap.copyOf(customAttributes).asUnmodifiable();
-    }
-
-    /**
-     * 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/Service.java
deleted file mode 100644
index 7bc310f..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-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, ToStringStyle.SHORT_PREFIX_STYLE);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.java
deleted file mode 100644
index 5ab12e1..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/pdp/ServiceCharacteristic.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 org.apache.brooklyn.camp.spi.pdp;
-
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpMatcher.java
deleted file mode 100644
index a574b71..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
deleted file mode 100644
index ae42ee7..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PdpProcessor.java
+++ /dev/null
@@ -1,186 +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 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.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.yaml.Yamls;
-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 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 IllegalArgumentException("Deployment plan item cannot be matched. Please check your YAML. Item: "+deploymentPlanItem);
-    }
-
-    // ----------------------------
-
-    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, ?> originalDeploymentPlan) {
-        PlanInterpretationNode interpretation = new PlanInterpretationNode(
-                new PlanInterpretationContext(originalDeploymentPlan, interpreters));
-        return (Map<String, Object>) interpretation.getNewValue();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/PlanInterpreter.java
deleted file mode 100644
index dbf20cc..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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) {
-        }
-        
-    }
-}