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:50:43 UTC

[01/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!)

Repository: brooklyn-server
Updated Branches:
  refs/heads/master [created] d03f254ba


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionMode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionMode.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionMode.java
deleted file mode 100644
index 08f111b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionMode.java
+++ /dev/null
@@ -1,127 +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.core.mgmt.internal;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Records details of a management transition, specifically the {@link BrooklynObjectManagementMode} before and after,
- * and allows easy checking of various aspects of that.
- * <p>
- * This helps make code readable and keep correct logic if we expand/change the management modes.
- */
-public class ManagementTransitionMode {
-
-    private static final Logger log = LoggerFactory.getLogger(ManagementTransitionMode.class);
-    
-    private final BrooklynObjectManagementMode modeBefore, modeAfter;
-
-    private ManagementTransitionMode(BrooklynObjectManagementMode modeBefore, BrooklynObjectManagementMode modeAfter) {
-        this.modeBefore = modeBefore;
-        this.modeAfter = modeAfter;
-    }
-    
-    public static ManagementTransitionMode transitioning(BrooklynObjectManagementMode modeBefore, BrooklynObjectManagementMode modeAfter) {
-        return new ManagementTransitionMode(Preconditions.checkNotNull(modeBefore, "modeBefore"), Preconditions.checkNotNull(modeAfter, "modeAfter"));
-    }
-
-    @Deprecated /** @deprecated since 0.9.0 - used to mark places where we aren't sure, remove once we are satisfied */
-    public static ManagementTransitionMode guessing(BrooklynObjectManagementMode modeBefore, BrooklynObjectManagementMode modeAfter) {
-        return transitioning(modeBefore, modeAfter);
-    }
-
-    /** @return the mode this object was previously managed as */
-    public BrooklynObjectManagementMode getModeBefore() {
-        return modeBefore;
-    }
-    
-    /** @return the mode this object is now being managed as */
-    public BrooklynObjectManagementMode getModeAfter() {
-        return modeAfter;
-    }
-    
-    /** This management node was previously not loaded here, 
-     * either it did not exist (and is just being created) or it was in persisted state but
-     * not loaded at this node. */
-    public boolean wasNotLoaded() {
-        return getModeBefore()==BrooklynObjectManagementMode.NONEXISTENT || getModeBefore()==BrooklynObjectManagementMode.UNMANAGED_PERSISTED;
-    }
-
-    /** This management node is now not going to be loaded here, either it is being destroyed
-     * (not known anywhere, not even persisted) or simply forgotten here */
-    public boolean isNoLongerLoaded() {
-        return getModeAfter()==BrooklynObjectManagementMode.NONEXISTENT || getModeAfter()==BrooklynObjectManagementMode.UNMANAGED_PERSISTED;
-    }
-
-    /** This management node was the master for the given object */
-    public boolean wasPrimary() {
-        return getModeBefore()==BrooklynObjectManagementMode.MANAGED_PRIMARY;
-    }
-
-    /** This management node is now the master for the given object */
-    public boolean isPrimary() {
-        return getModeAfter()==BrooklynObjectManagementMode.MANAGED_PRIMARY;
-    }
-
-    /** Object was previously loaded as read-only at this management node;
-     * active management was occurring elsewhere (or not at all)
-     */
-    public boolean wasReadOnly() {
-        return getModeBefore()==BrooklynObjectManagementMode.LOADED_READ_ONLY;
-    }
-    
-    /** Object is now being loaded as read-only at this management node;
-     * expect active management to be occurring elsewhere
-     */
-    public boolean isReadOnly() {
-        return getModeAfter()==BrooklynObjectManagementMode.LOADED_READ_ONLY;
-    }
-    
-    /** Object is being created:
-     * previously did not exist (not even in persisted state);
-     * implies that we are the active manager creating it,
-     * i.e. {@link #getModeAfter()} should indicate {@link BrooklynObjectManagementMode#MANAGED_PRIMARY}.
-     * (if we're read-only and the manager has just created it, 
-     * {@link #getModeBefore()} should indicate {@link BrooklynObjectManagementMode#UNMANAGED_PERSISTED})
-     */
-    public boolean isCreating() {
-        if (getModeBefore()!=BrooklynObjectManagementMode.NONEXISTENT)
-            return false;
-        
-        if (getModeAfter()==BrooklynObjectManagementMode.LOADED_READ_ONLY) {
-            log.warn("isCreating set on RO object; highly irregular!");
-        }
-        return true;
-    }
-
-    /** Object is being destroyed:
-     * either destroyed elsewhere and we're catching up (in read-only mode),
-     * or we've been the active manager and are destroying it */
-    public boolean isDestroying() {
-        return getModeAfter()==BrooklynObjectManagementMode.NONEXISTENT;
-    }
-    
-    @Override
-    public String toString() {
-        return ManagementTransitionMode.class.getSimpleName()+"["+getModeBefore()+"->"+getModeAfter()+"]";
-    }
-}
\ No newline at end of file


[20/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/MethodEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/MethodEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/MethodEffector.java
deleted file mode 100644
index ad53adb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/MethodEffector.java
+++ /dev/null
@@ -1,180 +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.core.effector;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.annotation.EffectorParam;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.groovy.GroovyJavaMethods;
-import org.codehaus.groovy.runtime.MethodClosure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-
-/** concrete class for providing an Effector implementation that gets its information from annotations on a method;
- * see Effector*Test for usage example.
- * <p>
- * note that the method must be on an interface in order for it to be remoted, with the current implementation.
- * see comments in {@link #call(Entity, Map)} for more details.
- */
-public class MethodEffector<T> extends AbstractEffector<T> {
-
-    private static final long serialVersionUID = 6989688364011965968L;
-    private static final Logger log = LoggerFactory.getLogger(MethodEffector.class);
-    
-    @SuppressWarnings("rawtypes")
-    public static Effector<?> create(Method m) {
-        return new MethodEffector(m);
-    }
-    
-    protected static class AnnotationsOnMethod {
-        final Class<?> clazz;
-        final String name;
-        final String description;
-        final Class<?> returnType;
-        final List<ParameterType<?>> parameters;
-
-        public AnnotationsOnMethod(Class<?> clazz, String methodName) {
-            this(clazz, inferBestMethod(clazz, methodName));
-        }
-
-        public AnnotationsOnMethod(Class<?> clazz, Method method) {
-            this.clazz = clazz;
-            this.name = method.getName();
-            this.returnType = method.getReturnType();
-
-            // Get the description
-            org.apache.brooklyn.core.annotation.Effector effectorAnnotation = method.getAnnotation(org.apache.brooklyn.core.annotation.Effector.class);
-            description = (effectorAnnotation != null) ? effectorAnnotation.description() : null;
-
-            // Get the parameters
-            parameters = Lists.newArrayList();
-            int numParameters = method.getParameterTypes().length;
-            for (int i = 0; i < numParameters; i++) {
-                parameters.add(toParameterType(method, i));
-            }
-        }
-
-        @SuppressWarnings({ "rawtypes", "unchecked" })
-        protected static ParameterType<?> toParameterType(Method method, int paramIndex) {
-            Annotation[] anns = method.getParameterAnnotations()[paramIndex];
-            Class<?> type = method.getParameterTypes()[paramIndex];
-            EffectorParam paramAnnotation = findAnnotation(anns, EffectorParam.class);
-
-            // TODO if blank, could do "param"+(i+1); would that be better?
-            // TODO this will now give "" if name is blank, rather than previously null. Is that ok?!
-            String name = (paramAnnotation != null) ? paramAnnotation.name() : null;
-
-            String paramDescription = (paramAnnotation == null || EffectorParam.MAGIC_STRING_MEANING_NULL.equals(paramAnnotation.description())) ? null : paramAnnotation.description();
-            String description = (paramDescription != null) ? paramDescription : null;
-
-            String paramDefaultValue = (paramAnnotation == null || EffectorParam.MAGIC_STRING_MEANING_NULL.equals(paramAnnotation.defaultValue())) ? null : paramAnnotation.defaultValue();
-            Object defaultValue = (paramDefaultValue != null) ? TypeCoercions.coerce(paramDefaultValue, type) : null;
-
-            return new BasicParameterType(name, type, description, defaultValue);
-        }
-        
-        @SuppressWarnings("unchecked")
-        protected static <T extends Annotation> T findAnnotation(Annotation[] anns, Class<T> type) {
-            for (Annotation ann : anns) {
-                if (type.isInstance(ann)) return (T) ann;
-            }
-            return null;
-        }
-        
-        protected static Method inferBestMethod(Class<?> clazz, String methodName) {
-            Method best = null;
-            for (Method it : clazz.getMethods()) { 
-                if (it.getName().equals(methodName)) {
-                    if (best==null || best.getParameterTypes().length < it.getParameterTypes().length) best=it;
-                }
-            }
-            if (best==null) {
-                throw new IllegalStateException("Cannot find method "+methodName+" on "+clazz.getCanonicalName());
-            }
-            return best;
-        }
-    }
-
-    /** Defines a new effector whose details are supplied as annotations on the given type and method name */
-    public MethodEffector(Class<?> whereEffectorDefined, String methodName) {
-        this(new AnnotationsOnMethod(whereEffectorDefined, methodName), null);
-    }
-
-    public MethodEffector(Method method) {
-        this(new AnnotationsOnMethod(method.getDeclaringClass(), method), null);
-    }
-
-    public MethodEffector(MethodClosure mc) {
-        this(new AnnotationsOnMethod((Class<?>)mc.getDelegate(), mc.getMethod()), null);
-    }
-
-    @SuppressWarnings("unchecked")
-    protected MethodEffector(AnnotationsOnMethod anns, String description) {
-        super(anns.name, (Class<T>)anns.returnType, anns.parameters, GroovyJavaMethods.<String>elvis(description, anns.description));
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public T call(Entity entity, Map parameters) {
-        Object[] parametersArray = EffectorUtils.prepareArgsForEffector(this, parameters);
-        if (entity instanceof AbstractEntity) {
-            return EffectorUtils.invokeMethodEffector(entity, this, parametersArray);
-        } else {
-            // we are dealing with a proxy here
-            // this implementation invokes the method on the proxy
-            // (requiring it to be on the interface)
-            // and letting the proxy deal with the remoting / runAtEntity;
-            // alternatively we could create the task here and pass it to runAtEntity;
-            // the latter may allow us to simplify/remove a lot of the stuff from 
-            // EffectorUtils and possibly Effectors and Entities
-            
-            // TODO Should really find method with right signature, rather than just the right args.
-            // TODO prepareArgs can miss things out that have "default values"! Code below will probably fail if that happens.
-            Method[] methods = entity.getClass().getMethods();
-            for (Method method : methods) {
-                if (method.getName().equals(getName())) {
-                    if (parametersArray.length == method.getParameterTypes().length) {
-                        try {
-                            return (T) method.invoke(entity, parametersArray);
-                        } catch (Exception e) {
-                            // exception handled by the proxy invocation (which leads to EffectorUtils.invokeEffectorMethod...)
-                            throw Exceptions.propagate(e);
-                        }
-                    }
-                }
-            }
-            String msg = "Could not find method for effector "+getName()+" with "+parametersArray.length+" parameters on "+entity;
-            log.warn(msg+" (throwing); available methods are: "+Arrays.toString(methods));
-            throw new IllegalStateException(msg);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshCommandEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshCommandEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshCommandEffector.java
deleted file mode 100644
index b22f717..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshCommandEffector.java
+++ /dev/null
@@ -1,102 +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.core.effector.ssh;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.AddEffector;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder;
-import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
-import org.apache.brooklyn.core.sensor.ssh.SshCommandSensor;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.base.Preconditions;
-
-public final class SshCommandEffector extends AddEffector {
-    
-    public static final ConfigKey<String> EFFECTOR_COMMAND = ConfigKeys.newStringConfigKey("command");
-    public static final ConfigKey<String> EFFECTOR_EXECUTION_DIR = SshCommandSensor.SENSOR_EXECUTION_DIR;
-    
-    public SshCommandEffector(ConfigBag params) {
-        super(newEffectorBuilder(params).build());
-    }
-    
-    public SshCommandEffector(Map<String,String> params) {
-        this(ConfigBag.newInstance(params));
-    }
-
-    public static EffectorBuilder<String> newEffectorBuilder(ConfigBag params) {
-        EffectorBuilder<String> eff = AddEffector.newEffectorBuilder(String.class, params);
-        eff.impl(new Body(eff.buildAbstract(), params));
-        return eff;
-    }
-
-
-    protected static class Body extends EffectorBody<String> {
-        private final Effector<?> effector;
-        private final String command;
-        private final String executionDir;
-
-        public Body(Effector<?> eff, ConfigBag params) {
-            this.effector = eff;
-            this.command = Preconditions.checkNotNull(params.get(EFFECTOR_COMMAND), "command must be supplied when defining this effector");
-            this.executionDir = params.get(EFFECTOR_EXECUTION_DIR);
-            // TODO could take a custom "env" aka effectorShellEnv
-        }
-
-        @Override
-        public String call(ConfigBag params) {
-            String command = this.command;
-            
-            command = SshCommandSensor.makeCommandExecutingInDirectory(command, executionDir, entity());
-            
-            MutableMap<String, String> env = MutableMap.of();
-            // first set all declared parameters, including default values
-            for (ParameterType<?> param: effector.getParameters()) {
-                env.addIfNotNull(param.getName(), Strings.toString( params.get(Effectors.asConfigKey(param)) ));
-            }
-            
-            // then set things from the entities defined shell environment, if applicable
-            env.putAll(Strings.toStringMap(entity().getConfig(BrooklynConfigKeys.SHELL_ENVIRONMENT), ""));
-            
-            // if we wanted to resolve the surrounding environment in real time -- see above
-//            Map<String,Object> paramsResolved = (Map<String, Object>) Tasks.resolveDeepValue(effectorShellEnv, Map.class, entity().getExecutionContext());
-            
-            // finally set the parameters we've been passed; this will repeat declared parameters but to no harm,
-            // it may pick up additional values (could be a flag defining whether this is permitted or not)
-            env.putAll(Strings.toStringMap(params.getAllConfig()));
-            
-            SshEffectorTasks.SshEffectorTaskFactory<String> t = SshEffectorTasks.ssh(command)
-                .requiringZeroAndReturningStdout()
-                .summary("effector "+effector.getName())
-                .environmentVariables(env);
-            return queue(t).get();
-        }
-        
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshEffectorTasks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshEffectorTasks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshEffectorTasks.java
deleted file mode 100644
index a8e427c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ssh/SshEffectorTasks.java
+++ /dev/null
@@ -1,342 +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.core.effector.ssh;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.ConfigUtils;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.EffectorTasks;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.internal.ssh.SshTool;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.core.task.ssh.SshFetchTaskFactory;
-import org.apache.brooklyn.util.core.task.ssh.SshFetchTaskWrapper;
-import org.apache.brooklyn.util.core.task.ssh.SshPutTaskFactory;
-import org.apache.brooklyn.util.core.task.ssh.SshPutTaskWrapper;
-import org.apache.brooklyn.util.core.task.ssh.SshTasks;
-import org.apache.brooklyn.util.core.task.ssh.internal.AbstractSshExecTaskFactory;
-import org.apache.brooklyn.util.core.task.ssh.internal.PlainSshExecTaskFactory;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskFactory;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.ssh.BashCommands;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-/**
- * Conveniences for generating {@link Task} instances to perform SSH activities.
- * <p>
- * If the {@link SshMachineLocation machine} is not specified directly it
- * will be inferred from the {@link Entity} context of either the {@link Effector}
- * or the current {@link Task}.
- * 
- * @see SshTasks
- * @since 0.6.0
- */
-@Beta
-public class SshEffectorTasks {
-
-    private static final Logger log = LoggerFactory.getLogger(SshEffectorTasks.class);
-    
-    public static final ConfigKey<Boolean> IGNORE_ENTITY_SSH_FLAGS = ConfigKeys.newBooleanConfigKey("ignoreEntitySshFlags",
-        "Whether to ignore any ssh flags (behaviour constraints) set on the entity or location " +
-        "where this is running, using only flags explicitly specified", false);
-    
-    /**
-     * Like {@link EffectorBody} but providing conveniences when in an entity with a single machine location.
-     */
-    public abstract static class SshEffectorBody<T> extends EffectorBody<T> {
-        
-        /** convenience for accessing the machine */
-        public SshMachineLocation machine() {
-            return EffectorTasks.getSshMachine(entity());
-        }
-
-        /** convenience for generating an {@link PlainSshExecTaskFactory} which can be further customised if desired, and then (it must be explicitly) queued */
-        public ProcessTaskFactory<Integer> ssh(String ...commands) {
-            return new SshEffectorTaskFactory<Integer>(commands).machine(machine());
-        }
-    }
-
-    /** variant of {@link PlainSshExecTaskFactory} which fulfills the {@link EffectorTaskFactory} signature so can be used directly as an impl for an effector,
-     * also injects the machine automatically; can also be used outwith effector contexts, and machine is still injected if it is
-     * run from inside a task at an entity with a single SshMachineLocation */
-    public static class SshEffectorTaskFactory<RET> extends AbstractSshExecTaskFactory<SshEffectorTaskFactory<RET>,RET> implements EffectorTaskFactory<RET> {
-
-        public SshEffectorTaskFactory(String ...commands) {
-            super(commands);
-        }
-        public SshEffectorTaskFactory(SshMachineLocation machine, String ...commands) {
-            super(machine, commands);
-        }
-        @Override
-        public ProcessTaskWrapper<RET> newTask(Entity entity, Effector<RET> effector, ConfigBag parameters) {
-            markDirty();
-            if (summary==null) summary(effector.getName()+" (ssh)");
-            machine(EffectorTasks.getSshMachine(entity));
-            return newTask();
-        }
-        @Override
-        public synchronized ProcessTaskWrapper<RET> newTask() {
-            Entity entity = BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-            if (machine==null) {
-                if (log.isDebugEnabled())
-                    log.debug("Using an ssh task not in an effector without any machine; will attempt to infer the machine: "+this);
-                if (entity!=null)
-                    machine(EffectorTasks.getSshMachine(entity));
-            }
-            applySshFlags(getConfig(), entity, getMachine());
-            return super.newTask();
-        }
-        
-        @Override
-        public <T2> SshEffectorTaskFactory<T2> returning(ScriptReturnType type) {
-            return (SshEffectorTaskFactory<T2>) super.<T2>returning(type);
-        }
-
-        @Override
-        public SshEffectorTaskFactory<Boolean> returningIsExitCodeZero() {
-            return (SshEffectorTaskFactory<Boolean>) super.returningIsExitCodeZero();
-        }
-
-        public SshEffectorTaskFactory<String> requiringZeroAndReturningStdout() {
-            return (SshEffectorTaskFactory<String>) super.requiringZeroAndReturningStdout();
-        }
-        
-        public <RET2> SshEffectorTaskFactory<RET2> returning(Function<ProcessTaskWrapper<?>, RET2> resultTransformation) {
-            return (SshEffectorTaskFactory<RET2>) super.returning(resultTransformation);
-        }
-    }
-    
-    public static class SshPutEffectorTaskFactory extends SshPutTaskFactory implements EffectorTaskFactory<Void> {
-        public SshPutEffectorTaskFactory(String remoteFile) {
-            super(remoteFile);
-        }
-        public SshPutEffectorTaskFactory(SshMachineLocation machine, String remoteFile) {
-            super(machine, remoteFile);
-        }
-        @Override
-        public SshPutTaskWrapper newTask(Entity entity, Effector<Void> effector, ConfigBag parameters) {
-            machine(EffectorTasks.getSshMachine(entity));
-            applySshFlags(getConfig(), entity, getMachine());
-            return super.newTask();
-        }
-        @Override
-        public SshPutTaskWrapper newTask() {
-            Entity entity = BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-            if (machine==null) {
-                if (log.isDebugEnabled())
-                    log.debug("Using an ssh put task not in an effector without any machine; will attempt to infer the machine: "+this);
-                if (entity!=null) {
-                    machine(EffectorTasks.getSshMachine(entity));
-                }
-
-            }
-            applySshFlags(getConfig(), entity, getMachine());
-            return super.newTask();
-        }
-    }
-
-    public static class SshFetchEffectorTaskFactory extends SshFetchTaskFactory implements EffectorTaskFactory<String> {
-        public SshFetchEffectorTaskFactory(String remoteFile) {
-            super(remoteFile);
-        }
-        public SshFetchEffectorTaskFactory(SshMachineLocation machine, String remoteFile) {
-            super(machine, remoteFile);
-        }
-        @Override
-        public SshFetchTaskWrapper newTask(Entity entity, Effector<String> effector, ConfigBag parameters) {
-            machine(EffectorTasks.getSshMachine(entity));
-            applySshFlags(getConfig(), entity, getMachine());
-            return super.newTask();
-        }
-        @Override
-        public SshFetchTaskWrapper newTask() {
-            Entity entity = BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-            if (machine==null) {
-                if (log.isDebugEnabled())
-                    log.debug("Using an ssh fetch task not in an effector without any machine; will attempt to infer the machine: "+this);
-                if (entity!=null)
-                    machine(EffectorTasks.getSshMachine(entity));
-            }
-            applySshFlags(getConfig(), entity, getMachine());
-            return super.newTask();
-        }
-    }
-
-    /**
-     * @since 0.9.0
-     */
-    public static SshEffectorTaskFactory<Integer> ssh(SshMachineLocation machine, String ...commands) {
-        return new SshEffectorTaskFactory<Integer>(machine, commands);
-    }
-
-    public static SshEffectorTaskFactory<Integer> ssh(String ...commands) {
-        return new SshEffectorTaskFactory<Integer>(commands);
-    }
-
-    public static SshEffectorTaskFactory<Integer> ssh(List<String> commands) {
-        return ssh(commands.toArray(new String[commands.size()]));
-    }
-
-    public static SshPutTaskFactory put(String remoteFile) {
-        return new SshPutEffectorTaskFactory(remoteFile);
-    }
-
-    public static SshFetchEffectorTaskFactory fetch(String remoteFile) {
-        return new SshFetchEffectorTaskFactory(remoteFile);
-    }
-
-    /** task which returns 0 if pid is running */
-    public static SshEffectorTaskFactory<Integer> codePidRunning(Integer pid) {
-        return ssh("ps -p "+pid).summary("PID "+pid+" is-running check (exit code)").allowingNonZeroExitCode();
-    }
-    
-    /** task which fails if the given PID is not running */
-    public static SshEffectorTaskFactory<?> requirePidRunning(Integer pid) {
-        return codePidRunning(pid).summary("PID "+pid+" is-running check (required)").requiringExitCodeZero("Process with PID "+pid+" is required to be running");
-    }
-
-    /** as {@link #codePidRunning(Integer)} but returning boolean */
-    public static SshEffectorTaskFactory<Boolean> isPidRunning(Integer pid) {
-        return codePidRunning(pid).summary("PID "+pid+" is-running check (boolean)").returning(new Function<ProcessTaskWrapper<?>, Boolean>() {
-            public Boolean apply(@Nullable ProcessTaskWrapper<?> input) { return Integer.valueOf(0).equals(input.getExitCode()); }
-        });
-    }
-
-
-    /** task which returns 0 if pid in the given file is running;
-     * method accepts wildcards so long as they match a single file on the remote end
-     * <p>
-     * returns 1 if no matching file, 
-     * 1 if matching file but no matching process,
-     * and 2 if 2+ matching files */
-    public static SshEffectorTaskFactory<Integer> codePidFromFileRunning(final String pidFile) {
-        return ssh(BashCommands.chain(
-                // this fails, but isn't an error
-                BashCommands.requireTest("-f "+pidFile, "The PID file "+pidFile+" does not exist."),
-                // this fails and logs an error picked up later
-                BashCommands.requireTest("`ls "+pidFile+" | wc -w` -eq 1", "ERROR: there are multiple matching PID files"),
-                // this fails and logs an error picked up later
-                BashCommands.require("cat "+pidFile, "ERROR: the PID file "+pidFile+" cannot be read (permissions?)."),
-                // finally check the process
-                "ps -p `cat "+pidFile+"`")).summary("PID file "+pidFile+" is-running check (exit code)")
-                .allowingNonZeroExitCode()
-                .addCompletionListener(new Function<ProcessTaskWrapper<?>,Void>() {
-                    public Void apply(ProcessTaskWrapper<?> input) {
-                        if (input.getStderr().contains("ERROR:"))
-                            throw new IllegalStateException("Invalid or inaccessible PID filespec: "+pidFile);
-                        return null;
-                    }
-                });
-    }
-    
-    /** task which fails if the pid in the given file is not running (or if there is no such PID file);
-     * method accepts wildcards so long as they match a single file on the remote end (fails if 0 or 2+ matching files) */
-    public static SshEffectorTaskFactory<?> requirePidFromFileRunning(String pidFile) {
-        return codePidFromFileRunning(pidFile)
-                .summary("PID file "+pidFile+" is-running check (required)")
-                .requiringExitCodeZero("Process with PID from file "+pidFile+" is required to be running");
-    }
-
-    /** as {@link #codePidFromFileRunning(String)} but returning boolean */
-    public static SshEffectorTaskFactory<Boolean> isPidFromFileRunning(String pidFile) {
-        return codePidFromFileRunning(pidFile).summary("PID file "+pidFile+" is-running check (boolean)").
-                returning(new Function<ProcessTaskWrapper<?>, Boolean>() {
-                    public Boolean apply(@Nullable ProcessTaskWrapper<?> input) { return ((Integer)0).equals(input.getExitCode()); }
-                });
-    }
-
-    /** extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) 
-     * as declared on the entity, and inserts them in a map using the unprefixed state, for ssh.
-     * <p>
-     * currently this is computed for each call, which may be wasteful, but it is reliable in the face of config changes.
-     * we could cache the Map.  note that we do _not_ cache (or even own) the SshTool; 
-     * the SshTool is created or re-used by the SshMachineLocation making use of these properties */
-    @Beta
-    public static Map<String, Object> getSshFlags(Entity entity, Location optionalLocation) {
-        ConfigBag allConfig = ConfigBag.newInstance();
-        
-        StringConfigMap globalConfig = ((EntityInternal)entity).getManagementContext().getConfig();
-        allConfig.putAll(globalConfig.getAllConfig());
-        
-        if (optionalLocation!=null)
-            allConfig.putAll(((LocationInternal)optionalLocation).config().getBag());
-        
-        allConfig.putAll(((EntityInternal)entity).getAllConfig());
-        
-        Map<String, Object> result = Maps.newLinkedHashMap();
-        for (String keyS : allConfig.getAllConfig().keySet()) {
-            if (keyS.startsWith(SshTool.BROOKLYN_CONFIG_KEY_PREFIX)) {
-                ConfigKey<?> key = ConfigKeys.newConfigKey(Object.class, keyS);
-                
-                Object val = allConfig.getStringKey(keyS);
-                
-                /*
-                 * NOV 2013 changing this to rely on config above being inserted in the right order,
-                 * so entity config will be preferred over location, and location over global.
-                 * If that is consistent then remove the lines below.
-                 * (We can also accept null entity and so combine with SshTasks.getSshFlags.)
-                 */
-                
-//                // have to use raw config to test whether the config is set
-//                Object val = ((EntityInternal)entity).getConfigMap().getRawConfig(key);
-//                if (val!=null) {
-//                    val = entity.getConfig(key);
-//                } else {
-//                    val = globalConfig.getRawConfig(key);
-//                    if (val!=null) val = globalConfig.getConfig(key);
-//                }
-//                if (val!=null) {
-                    result.put(ConfigUtils.unprefixedKey(SshTool.BROOKLYN_CONFIG_KEY_PREFIX, key).getName(), val);
-//                }
-            }
-        }
-        return result;
-    }
-
-    private static void applySshFlags(ConfigBag config, Entity entity, Location machine) {
-        if (entity!=null) {
-            if (!config.get(IGNORE_ENTITY_SSH_FLAGS)) {
-                config.putIfAbsent(getSshFlags(entity, machine));
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/AbstractEnricher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/AbstractEnricher.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/AbstractEnricher.java
deleted file mode 100644
index 5471c78..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/AbstractEnricher.java
+++ /dev/null
@@ -1,121 +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.core.enricher;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EnricherMemento;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherType;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.rebind.BasicEnricherRebindSupport;
-import org.apache.brooklyn.core.objs.AbstractEntityAdjunct;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Maps;
-
-/**
-* Base {@link Enricher} implementation; all enrichers should extend this or its children
-*/
-public abstract class AbstractEnricher extends AbstractEntityAdjunct implements Enricher {
-
-    public static final ConfigKey<Boolean> SUPPRESS_DUPLICATES = ConfigKeys.newBooleanConfigKey("enricher.suppressDuplicates",
-        "Whether duplicate values published by this enricher should be suppressed");
-
-    private final EnricherDynamicType enricherType;
-    protected Boolean suppressDuplicates;
-
-    public AbstractEnricher() {
-        this(Maps.newLinkedHashMap());
-    }
-    
-    public AbstractEnricher(Map<?,?> flags) {
-        super(flags);
-        
-        enricherType = new EnricherDynamicType(this);
-        
-        if (isLegacyConstruction() && !isLegacyNoConstructionInit()) {
-            init();
-        }
-    }
-
-    @Override
-    public RebindSupport<EnricherMemento> getRebindSupport() {
-        return new BasicEnricherRebindSupport(this);
-    }
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    public RelationSupportInternal<Enricher> relations() {
-        return (RelationSupportInternal<Enricher>) super.relations();
-    }
-    
-    @Override
-    public EnricherType getEnricherType() {
-        return enricherType.getSnapshot();
-    }
-
-    @Override
-    public void setEntity(EntityLocal entity) {
-        super.setEntity(entity);
-        Boolean suppressDuplicates = getConfig(SUPPRESS_DUPLICATES);
-        if (suppressDuplicates!=null) 
-            this.suppressDuplicates = suppressDuplicates;
-    }
-    
-    @Override
-    protected void onChanged() {
-        requestPersist();
-    }
-
-    @Override
-    protected <T> void emit(Sensor<T> sensor, Object val) {
-        checkState(entity != null, "entity must first be set");
-        if (val == Entities.UNCHANGED) {
-            return;
-        }
-        if (val == Entities.REMOVE) {
-            ((EntityInternal)entity).removeAttribute((AttributeSensor<T>) sensor);
-            return;
-        }
-        
-        T newVal = TypeCoercions.coerce(val, sensor.getTypeToken());
-        if (sensor instanceof AttributeSensor) {
-            if (Boolean.TRUE.equals(suppressDuplicates)) {
-                T oldValue = entity.getAttribute((AttributeSensor<T>)sensor);
-                if (Objects.equal(oldValue, newVal))
-                    return;
-            }
-            entity.sensors().set((AttributeSensor<T>)sensor, newVal);
-        } else { 
-            entity.sensors().emit(sensor, newVal);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherDynamicType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherDynamicType.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherDynamicType.java
deleted file mode 100644
index b6a0b23..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherDynamicType.java
+++ /dev/null
@@ -1,43 +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.core.enricher;
-
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherType;
-import org.apache.brooklyn.core.objs.BrooklynDynamicType;
-
-public class EnricherDynamicType extends BrooklynDynamicType<Enricher, AbstractEnricher> {
-
-    public EnricherDynamicType(Class<? extends Enricher> type) {
-        super(type);
-    }
-
-    public EnricherDynamicType(AbstractEnricher enricher) {
-        super(enricher);
-    }
-    
-    public EnricherType getSnapshot() {
-        return (EnricherType) super.getSnapshot();
-    }
-
-    @Override
-    protected EnricherTypeSnapshot newSnapshot() {
-        return new EnricherTypeSnapshot(name, value(configKeys));
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherTypeSnapshot.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherTypeSnapshot.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherTypeSnapshot.java
deleted file mode 100644
index 240d884..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/enricher/EnricherTypeSnapshot.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 org.apache.brooklyn.core.enricher;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.sensor.EnricherType;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.objs.BrooklynTypeSnapshot;
-
-public class EnricherTypeSnapshot extends BrooklynTypeSnapshot implements EnricherType {
-    private static final long serialVersionUID = 4670930188951106009L;
-    
-    EnricherTypeSnapshot(String name, Map<String, ConfigKey<?>> configKeys) {
-        super(name, configKeys);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        return (obj instanceof EnricherTypeSnapshot) && super.equals(obj);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
deleted file mode 100644
index 3fd4b05..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
+++ /dev/null
@@ -1,267 +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.core.entity;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceProblemsLogic;
-import org.apache.brooklyn.core.entity.trait.StartableMethods;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Time;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Users can extend this to define the entities in their application, and the relationships between
- * those entities. Users should override the {@link #init()} method, and in there should create 
- * their entities.
- */
-public abstract class AbstractApplication extends AbstractEntity implements StartableApplication {
-    
-    private static final Logger log = LoggerFactory.getLogger(AbstractApplication.class);
-    
-    /**
-     * The default name to use for this app, if not explicitly overridden by the top-level app.
-     * Necessary to avoid the app being wrapped in another layer of "BasicApplication" on deployment.
-     * Previously, the catalog item gave an explicit name (rathe rthan this defaultDisplayName), which
-     * meant that if the user chose a different name then AMP would automatically wrap this app so
-     * that both names would be presented.
-     */
-    public static final ConfigKey<String> DEFAULT_DISPLAY_NAME = ConfigKeys.newStringConfigKey("defaultDisplayName");
-
-    private volatile Application application;
-
-    public AbstractApplication() {
-    }
-
-    public void init() { 
-        super.init();
-        if (Strings.isNonBlank(getConfig(DEFAULT_DISPLAY_NAME))) {
-            setDefaultDisplayName(getConfig(DEFAULT_DISPLAY_NAME));
-        }
-        initApp();
-    }
-    
-    protected void initApp() {}
-    
-    /**
-     * 
-     * @deprecated since 0.6; use EntitySpec so no-arg constructor
-     */
-    @Deprecated
-    public AbstractApplication(Map properties) {
-        super(properties);
-    }
-
-    /** 
-     * Constructor for when application is nested inside another application
-     * 
-     * @deprecated Nesting applications is not currently supported
-     */
-    @Deprecated
-    public AbstractApplication(Map properties, Entity parent) {
-        super(properties, parent);
-    }
-
-    @Override
-    public Application getApplication() {
-        if (application!=null) {
-            if (application.getId().equals(getId()))
-                return (Application) getProxyIfAvailable();
-            return application;
-        }
-        if (getParent()==null) return (Application)getProxyIfAvailable();
-        return getParent().getApplication();
-    }
-    
-    @Override
-    protected synchronized void setApplication(Application app) {
-        if (app.getId().equals(getId())) {
-            application = getProxy()!=null ? (Application)getProxy() : app;
-        } else {
-            application = app;
-
-            // Alex, Mar 2013: added some checks; 
-            // i *think* these conditions should not happen, 
-            // and so should throw but don't want to break things (yet)
-            if (getParent()==null) {
-                log.warn("Setting application of "+this+" to "+app+", but "+this+" is not parented");
-            } else if (getParent().getApplicationId().equals(app.getParent())) {
-                log.warn("Setting application of "+this+" to "+app+", but parent "+getParent()+" has different app "+getParent().getApplication());
-            }
-        }
-        super.setApplication(app);
-    }
-    
-    @Override
-    public AbstractApplication setParent(Entity parent) {
-        super.setParent(parent);
-        return this;
-    }
-    
-    /** as {@link AbstractEntity#initEnrichers()} but also adding default service not-up and problem indicators from children */
-    @Override
-    protected void initEnrichers() {
-        super.initEnrichers();
-        
-        // default app logic; easily overridable by adding a different enricher with the same tag
-        ServiceStateLogic.newEnricherFromChildren().checkChildrenAndMembers().addTo(this);
-        ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application created but not yet started, at "+Time.makeDateString());
-    }
-    
-    /**
-     * Default start will start all Startable children (child.start(Collection<? extends Location>)),
-     * calling preStart(locations) first and postStart(locations) afterwards.
-     */
-    @Override
-    public void start(Collection<? extends Location> locations) {
-        this.addLocations(locations);
-        // 2016-01: only pass locations passed to us, as per ML discussion
-        Collection<? extends Location> locationsToUse = locations==null ? ImmutableSet.<Location>of() : locations;
-        ServiceProblemsLogic.clearProblemsIndicator(this, START);
-        ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application starting");
-        setExpectedStateAndRecordLifecycleEvent(Lifecycle.STARTING);
-        try {
-            preStart(locationsToUse);
-            // if there are other items which should block service_up, they should be done in preStart
-            ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL);
-            
-            doStart(locationsToUse);
-            postStart(locationsToUse);
-        } catch (Exception e) {
-            // TODO should probably remember these problems then clear?  if so, do it here ... or on all effectors?
-//            ServiceProblemsLogic.updateProblemsIndicator(this, START, e);
-            
-            recordApplicationEvent(Lifecycle.ON_FIRE);
-            // no need to log here; the effector invocation should do that
-            throw Exceptions.propagate(e);
-        } finally {
-            ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING);
-        }
-
-        setExpectedStateAndRecordLifecycleEvent(Lifecycle.RUNNING);
-
-        logApplicationLifecycle("Started");
-    }
-
-    protected void logApplicationLifecycle(String message) {
-        log.info(message+" application " + this);
-    }
-    
-    protected void doStart(Collection<? extends Location> locations) {
-        StartableMethods.start(this, locations);        
-    }
-
-    /**
-     * Default is no-op. Subclasses can override.
-     * */
-    public void preStart(Collection<? extends Location> locations) {
-        //no-op
-    }
-
-    /**
-     * Default is no-op. Subclasses can override.
-     * */
-    public void postStart(Collection<? extends Location> locations) {
-        //no-op
-    }
-
-    /**
-     * Default stop will stop all Startable children
-     */
-    @Override
-    public void stop() {
-        logApplicationLifecycle("Stopping");
-
-        ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application stopping");
-        sensors().set(SERVICE_UP, false);
-        setExpectedStateAndRecordLifecycleEvent(Lifecycle.STOPPING);
-        try {
-            doStop();
-        } catch (Exception e) {
-            setExpectedStateAndRecordLifecycleEvent(Lifecycle.ON_FIRE);
-            log.warn("Error stopping application " + this + " (rethrowing): "+e);
-            throw Exceptions.propagate(e);
-        }
-        ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application stopped");
-        setExpectedStateAndRecordLifecycleEvent(Lifecycle.STOPPED);
-
-        if (getParent()==null) {
-            synchronized (this) {
-                //TODO review mgmt destroy lifecycle
-                //  we don't necessarily want to forget all about the app on stop, 
-                //since operator may be interested in things recently stopped;
-                //but that could be handled by the impl at management
-                //(keeping recently unmanaged things)  
-                //  however unmanaging must be done last, _after_ we stop children and set attributes 
-                getEntityManager().unmanage(this);
-            }
-        }
-
-        logApplicationLifecycle("Stopped");
-    }
-
-    protected void doStop() {
-        StartableMethods.stop(this);
-    }
-
-    /** default impl invokes restart on all children simultaneously */
-    @Override
-    public void restart() {
-        StartableMethods.restart(this);
-    }
-
-    @Override
-    public void onManagementStopped() {
-        super.onManagementStopped();
-        if (getManagementContext().isRunning()) {
-            recordApplicationEvent(Lifecycle.DESTROYED);
-        }
-    }
-
-    protected void setExpectedStateAndRecordLifecycleEvent(Lifecycle state) {
-        ServiceStateLogic.setExpectedState(this, state);
-        recordApplicationEvent(state);
-    }
-
-    protected void recordApplicationEvent(Lifecycle state) {
-        try {
-            ((ManagementContextInternal)getManagementContext()).getUsageManager().recordApplicationEvent(this, state);
-        } catch (RuntimeInterruptedException e) {
-            throw e;
-        } catch (RuntimeException e) {
-            if (getManagementContext().isRunning()) {
-                log.warn("Problem recording application event '"+state+"' for "+this, e);
-            }
-        }
-    }
-}


[35/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/BrooklynYamlTypeInstantiatorTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/BrooklynYamlTypeInstantiatorTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/BrooklynYamlTypeInstantiatorTest.java
deleted file mode 100644
index c76731b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/BrooklynYamlTypeInstantiatorTest.java
+++ /dev/null
@@ -1,74 +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.brooklyn;
-
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynYamlTypeInstantiator;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynYamlTypeInstantiator.Factory;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynYamlTypeInstantiator.InstantiatorFromKey;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.time.Duration;
-
-public class BrooklynYamlTypeInstantiatorTest extends AbstractYamlTest {
-
-    protected BrooklynClassLoadingContext loader() {
-        return JavaBrooklynClassLoadingContext.create(mgmt());
-    }
-    
-    @Test
-    public void testLoadPolicySpecProgrammatically() {
-        Factory loader = new BrooklynYamlTypeInstantiator.Factory(loader(), "test:"+JavaClassNames.niceClassAndMethod());
-        InstantiatorFromKey decoL = loader.from(MutableMap.of("some_type", ServiceRestarter.class.getName())).prefix("some");
-        
-        Assert.assertTrue(decoL.getConfigMap().isEmpty());
-        Assert.assertEquals(decoL.getTypeName().get(), ServiceRestarter.class.getName());
-        Assert.assertEquals(decoL.getType(), ServiceRestarter.class);
-        
-        Object sl1 = decoL.newInstance();
-        Assert.assertTrue(sl1 instanceof ServiceRestarter);
-        
-        Policy sl2 = decoL.newInstance(Policy.class);
-        Assert.assertTrue(sl2 instanceof ServiceRestarter);
-    }
-    
-    @Test
-    public void testLoadPolicySpecWithBrooklynConfig() {
-        Factory loader = new BrooklynYamlTypeInstantiator.Factory(loader(), "test:"+JavaClassNames.niceClassAndMethod());
-        InstantiatorFromKey decoL = loader.from(MutableMap.of("some_type", ServiceRestarter.class.getName(),
-            "brooklyn.config", MutableMap.of("failOnRecurringFailuresInThisDuration", Duration.seconds(42)))).prefix("some");
-        Policy sl2 = decoL.newInstance(Policy.class);
-        Assert.assertEquals(sl2.getConfig(ServiceRestarter.FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION).toSeconds(), 42);
-    }
-
-    @Test(groups = "WIP")
-    public void testLoadPolicySpecWithFlag() {
-        Factory loader = new BrooklynYamlTypeInstantiator.Factory(loader(), "test:"+JavaClassNames.niceClassAndMethod());
-        InstantiatorFromKey decoL = loader.from(MutableMap.of("some_type", ServiceRestarter.class.getName(),
-            "failOnRecurringFailuresInThisDuration", Duration.seconds(42))).prefix("some");
-        Policy sl2 = decoL.newInstance(Policy.class);
-        Assert.assertEquals(sl2.getConfig(ServiceRestarter.FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION).toSeconds(), 42);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
deleted file mode 100644
index ff89c25..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
+++ /dev/null
@@ -1,281 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import java.io.StringReader;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.location.LocationPredicates;
-import org.apache.brooklyn.core.location.Machines;
-import org.apache.brooklyn.core.location.access.PortForwardManager;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.entity.software.base.DoNothingSoftwareProcess;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.api.client.repackaged.com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.net.HostAndPort;
-
-import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.net.UserAndHostAndPort;
-
-public class ByonLocationsYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(ByonLocationsYamlTest.class);
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testByonSpec() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location: byon(user=myuser,mykey=myval,hosts=\"1.1.1.1\")",
-                "services:",
-                "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        FixedListMachineProvisioningLocation<SshMachineLocation> loc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(app.getLocations(), 0);
-        
-        Set<SshMachineLocation> machines = loc.getAvailable();
-        SshMachineLocation machine = Iterables.getOnlyElement(machines);
-        assertMachine(machine, UserAndHostAndPort.fromParts("myuser", "1.1.1.1",  22), ImmutableMap.of("mykey", "myval"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testByonMachine() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - ssh: 1.1.1.1:8022",
-                "      privateAddresses: [10.0.0.1]",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval",
-                "services:",
-                "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        FixedListMachineProvisioningLocation<SshMachineLocation> loc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(app.getLocations(), 0);
-        
-        Set<SshMachineLocation> machines = loc.getAvailable();
-        SshMachineLocation machine = Iterables.getOnlyElement(machines);
-        assertMachine(machine, UserAndHostAndPort.fromParts("myuser", "1.1.1.1",  8022), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval"));
-        assertEquals(machine.getPrivateAddresses(), ImmutableSet.of("10.0.0.1"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testByonWindowsMachine() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - winrm: 1.1.1.1:8985",
-                "      privateAddresses: [10.0.0.1]",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval",
-                "      osFamily: windows",
-                "services:",
-                "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        FixedListMachineProvisioningLocation<WinRmMachineLocation> loc = (FixedListMachineProvisioningLocation<WinRmMachineLocation>) Iterables.get(app.getLocations(), 0);
-        
-        Set<WinRmMachineLocation> machines = loc.getAvailable();
-        WinRmMachineLocation machine = Iterables.getOnlyElement(machines);
-        assertMachine(machine, UserAndHostAndPort.fromParts("myuser", "1.1.1.1",  8985), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval"));
-        assertEquals(machine.getPrivateAddresses(), ImmutableSet.of("10.0.0.1"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testByonMultiMachine() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - ssh: 1.1.1.1:8022",
-                "      privateAddresses: [10.0.0.1]",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval1",
-                "    - ssh: 1.1.1.2:8022",
-                "      privateAddresses: [10.0.0.2]",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval2",
-                "    - winrm: 1.1.1.3:8985",
-                "      privateAddresses: [10.0.0.3]",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval3",
-                "      osFamily: windows",
-                "services:",
-                "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
-        
-        Set<MachineLocation> machines = loc.getAvailable();
-        assertEquals(machines.size(), 3, "machines="+machines);
-        SshMachineLocation machine1 = (SshMachineLocation) Iterables.find(machines, LocationPredicates.configEqualTo(ConfigKeys.newStringConfigKey("mykey"), "myval1"));
-        SshMachineLocation machine2 = (SshMachineLocation) Iterables.find(machines, LocationPredicates.configEqualTo(ConfigKeys.newStringConfigKey("mykey"), "myval2"));
-        WinRmMachineLocation machine3 = (WinRmMachineLocation) Iterables.find(machines, Predicates.instanceOf(WinRmMachineLocation.class));
-
-        assertMachine(machine1, UserAndHostAndPort.fromParts("myuser", "1.1.1.1",  8022), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval1"));
-        assertEquals(machine1.getPrivateAddresses(), ImmutableSet.of("10.0.0.1"));
-
-        assertMachine(machine2, UserAndHostAndPort.fromParts("myuser", "1.1.1.2",  8022), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval2"));
-        assertEquals(machine2.getPrivateAddresses(), ImmutableSet.of("10.0.0.2"));
-
-        assertMachine(machine3, UserAndHostAndPort.fromParts("myuser", "1.1.1.3",  8985), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval3"));
-        assertEquals(machine3.getPrivateAddresses(), ImmutableSet.of("10.0.0.3"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testByonPortMapping() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - ssh: 1.1.1.1:22",
-                "      privateAddresses: [10.0.0.1]",
-                "      tcpPortMappings: {22: \"83.222.229.1:12001\", 8080: \"83.222.229.1:12002\"}",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval1",
-                "    - winrm: 1.1.1.2:8985",
-                "      privateAddresses: [10.0.0.2]",
-                "      tcpPortMappings: {8985: \"83.222.229.2:12003\", 8080: \"83.222.229.2:12004\"}",
-                "      password: mypassword",
-                "      user: myuser",
-                "      mykey: myval2",
-                "      osFamily: windows",
-                "services:",
-                "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
-
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
-        PortForwardManager pfm = (PortForwardManager) mgmt().getLocationRegistry().resolve("portForwardManager(scope=global)");
-        
-        Set<MachineLocation> machines = loc.getAvailable();
-        assertEquals(machines.size(), 2, "machines="+machines);
-        SshMachineLocation machine1 = (SshMachineLocation) Iterables.find(machines, LocationPredicates.configEqualTo(ConfigKeys.newStringConfigKey("mykey"), "myval1"));
-        WinRmMachineLocation machine2 = (WinRmMachineLocation) Iterables.find(machines, Predicates.instanceOf(WinRmMachineLocation.class));
-
-        assertMachine(machine1, UserAndHostAndPort.fromParts("myuser", "83.222.229.1", 12001), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval1"));
-        assertEquals(machine1.getPrivateAddresses(), ImmutableSet.of("10.0.0.1"));
-        assertEquals(pfm.lookup(machine1, 22), HostAndPort.fromParts("83.222.229.1", 12001));
-        assertEquals(pfm.lookup(machine1, 8080), HostAndPort.fromParts("83.222.229.1", 12002));
-        assertNull(pfm.lookup(machine1, 12345));
-        
-        assertMachine(machine2, UserAndHostAndPort.fromParts("myuser", "83.222.229.2",  12003), ImmutableMap.of(
-                SshMachineLocation.PASSWORD.getName(), "mypassword",
-                "mykey", "myval2"));
-        assertEquals(machine2.getPrivateAddresses(), ImmutableSet.of("10.0.0.2"));
-        assertEquals(pfm.lookup(machine2, 8985), HostAndPort.fromParts("83.222.229.2", 12003));
-        assertEquals(pfm.lookup(machine2, 8080), HostAndPort.fromParts("83.222.229.2", 12004));
-        assertNull(pfm.lookup(machine2, 12345));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testPassesInboundPortsToMachineAndRemovesOnceMachineReleased() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - ssh: 1.1.1.1:22",
-                "      password: mypassword",
-                "      user: myuser",
-                "services:",
-                "- type: org.apache.brooklyn.entity.software.base.DoNothingSoftwareProcess",
-                "  brooklyn.config:",
-                "    requiredOpenLoginPorts: [22, 1024]");
-
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        DoNothingSoftwareProcess entity = (DoNothingSoftwareProcess) Iterables.find(Entities.descendants(app), Predicates.instanceOf(DoNothingSoftwareProcess.class));
-        FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
-        
-        // Machine should have been given the inbound-ports
-        SshMachineLocation machine = Machines.findUniqueMachineLocation(entity.getLocations(), SshMachineLocation.class).get();
-        Asserts.assertEqualsIgnoringOrder((Iterable<?>)machine.config().get(CloudLocationConfig.INBOUND_PORTS), ImmutableList.of(22, 1024));
-        
-        // Stop the entity; should release the machine
-        entity.stop();
-        MachineLocation availableMachine = Iterables.getOnlyElement(loc.getAvailable());
-        assertEquals(availableMachine, machine);
-        assertNull(machine.config().get(CloudLocationConfig.INBOUND_PORTS));
-    }
-
-    private void assertMachine(SshMachineLocation machine, UserAndHostAndPort conn, Map<String, ?> config) {
-        assertEquals(machine.getAddress().getHostAddress(), conn.getHostAndPort().getHostText());
-        assertEquals(machine.getPort(), conn.getHostAndPort().getPort());
-        assertEquals(machine.getUser(), conn.getUser());
-        for (Map.Entry<String, ?> entry : config.entrySet()) {
-            Object actualVal = machine.getConfig(ConfigKeys.newConfigKey(Object.class, entry.getKey()));
-            assertEquals(actualVal, entry.getValue());
-        }
-    }
-    
-    private void assertMachine(WinRmMachineLocation machine, UserAndHostAndPort conn, Map<String, ?> config) {
-        assertEquals(machine.getAddress().getHostAddress(), conn.getHostAndPort().getHostText());
-        assertEquals(machine.getConfig(WinRmMachineLocation.WINRM_PORT), (Integer) conn.getHostAndPort().getPort());
-        assertEquals(machine.getUser(), conn.getUser());
-        for (Map.Entry<String, ?> entry : config.entrySet()) {
-            Object actualVal = machine.getConfig(ConfigKeys.newConfigKey(Object.class, entry.getKey()));
-            assertEquals(actualVal, entry.getValue());
-        }
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DependentConfigPollingYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DependentConfigPollingYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DependentConfigPollingYamlTest.java
deleted file mode 100644
index 10df5f0..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DependentConfigPollingYamlTest.java
+++ /dev/null
@@ -1,117 +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.brooklyn;
-
-import static org.testng.Assert.assertTrue;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-@Test
-public class DependentConfigPollingYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(DependentConfigPollingYamlTest.class);
-    
-    private ExecutorService executor;
-
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() {
-        super.setUp();
-        executor = Executors.newCachedThreadPool();
-    }
-            
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() {
-        if (executor != null) executor.shutdownNow();
-        super.tearDown();
-    }
-            
-    // Test for BROOKLYN-214. Previously, the brief Tasks.resolving would cause a thread to be
-    // leaked. This was because it would call into BrooklynDslDeferredSupplier.get, which would
-    // wait on a synchronized block and thus not be interruptible - the thread would be consumed
-    // forever, until the attributeWhenReady returned true!
-    //
-    // Integration test, because takes several seconds.
-    @Test(groups="Integration")
-    public void testResolveAttributeWhenReadyWithTimeoutDoesNotLeaveThreadRunning() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity",
-                "  id: myentity",
-                "  brooklyn.config:",
-                "    test.confName: $brooklyn:entity(\"myentity\").attributeWhenReady(\"mysensor\")");
-        
-        final Entity app = createAndStartApplication(yaml);
-        final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-
-        // Cause a thread to block, getting the config - previousy (before fixing 214) this would be in
-        // the synchronized block if BrooklynDslDeferredSupplier.get().
-        // The sleep is to ensure we really did get into the locking code.
-        executor.submit(new Callable<Object>() {
-            public Object call() {
-                return entity.config().get(TestEntity.CONF_NAME);
-            }});
-        Thread.sleep(100);
-        
-        // Try to resolve the value many times, each in its own task, but with a short timeout for each.
-        final int numIterations = 20;
-        final int preNumThreads = Thread.activeCount();
-        
-        for (int i = 0; i < numIterations; i++) {
-            // Same as RestValueResolver.getImmediateValue
-            Tasks.resolving(entity.config().getRaw(TestEntity.CONF_NAME).get())
-                    .as(Object.class)
-                    .defaultValue("UNRESOLVED")
-                    .timeout(Duration.millis(100))
-                    .context(entity)
-                    .swallowExceptions()
-                    .get();
-        }
-
-        // Confirm we haven't left threads behind.
-        Asserts.succeedsEventually(new Runnable() {
-            public void run() {
-                int postNumThreads = Thread.activeCount();
-                String msg = "pre="+preNumThreads+"; post="+postNumThreads+"; iterations="+numIterations;
-                log.info(msg);
-                assertTrue(postNumThreads < preNumThreads + (numIterations / 2), msg);
-            }});
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
deleted file mode 100644
index 354e0a0..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
+++ /dev/null
@@ -1,515 +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.brooklyn;
-
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.ha.MementoCopyMode;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoRawData;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.io.Files;
-
-@Test
-public class DslAndRebindYamlTest extends AbstractYamlTest {
-
-    private static final Logger log = LoggerFactory.getLogger(DslAndRebindYamlTest.class);
-
-    protected ClassLoader classLoader = getClass().getClassLoader();
-    protected File mementoDir;
-    protected Set<ManagementContext> mgmtContexts = MutableSet.of();
-    protected ExecutorService executor;
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        if (mementoDir != null) throw new IllegalStateException("already created mgmt context");
-        mementoDir = Files.createTempDir();
-        mementoDir.deleteOnExit();
-        LocalManagementContext mgmt = RebindTestUtils.newPersistingManagementContext(mementoDir, classLoader, 1);
-        mgmtContexts.add(mgmt);
-        return mgmt;
-    }
-
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() {
-    	super.setUp();
-        executor = Executors.newSingleThreadExecutor();
-    }
-    
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() {
-    	if (executor != null) executor.shutdownNow();
-        for (ManagementContext mgmt : mgmtContexts) Entities.destroyAll(mgmt);
-        super.tearDown();
-        mementoDir = null;
-        mgmtContexts.clear();
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-    public Application rebind(Application app) throws Exception {
-        RebindTestUtils.waitForPersisted(app);
-        Application result = RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
-        mgmtContexts.add(result.getManagementContext());
-        return result;
-    }
-
-
-    protected Entity setupAndCheckTestEntityInBasicYamlWith(String... extras) throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", extras));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-
-        return entity;
-    }
-
-    public static <T> T getConfigInTask(final Entity entity, final ConfigKey<T> key) {
-        return Entities.submit(entity, Tasks.<T>builder().body(new Callable<T>() {
-            @Override
-            public T call() throws Exception {
-                return entity.getConfig(key);
-            }
-        }).build()).getUnchecked();
-    }
-
-    protected <T> Future<T> getConfigInTaskAsync(final Entity entity, final ConfigKey<T> key) {
-	    // Wait for the attribute to be ready in a new Task
-	    Callable<T> configGetter = new Callable<T>() {
-	        @Override
-	        public T call() throws Exception {
-	            T s = getConfigInTask(entity, key);
-	            getLogger().info("getConfig {}={}", key, s);
-	            return s;
-	        }
-	    };
-	    return executor.submit(configGetter);
-    }
-
-    @Test
-    public void testDslAttributeWhenReady() throws Exception {
-        Entity testEntity = entityWithAttributeWhenReady();
-        ((EntityInternal) testEntity).sensors().set(Sensors.newStringSensor("foo"), "bar");
-        Assert.assertEquals(getConfigInTask(testEntity, TestEntity.CONF_NAME), "bar");
-    }
-
-    @Test
-    public void testDslAttributeWhenReadyRebindWhenResolved() throws Exception {
-        Entity testEntity = entityWithAttributeWhenReady();
-        ((EntityInternal) testEntity).sensors().set(Sensors.newStringSensor("foo"), "bar");
-        
-        Application app2 = rebind(testEntity.getApplication());
-        Entity e2 = Iterables.getOnlyElement(app2.getChildren());
-
-        Assert.assertEquals(getConfigInTask(e2, TestEntity.CONF_NAME), "bar");
-    }
-
-    @Test
-    public void testDslAttributeWhenReadyWhenNotYetResolved() throws Exception {
-        Entity testEntity = entityWithAttributeWhenReady();
-        
-        Application app2 = rebind(testEntity.getApplication());
-        Entity e2 = Iterables.getOnlyElement(app2.getChildren());
-
-        // Wait for the attribute to be ready in a new Task
-        Future<String> stringFuture = getConfigInTaskAsync(e2, TestEntity.CONF_NAME);
-
-        // Check that the Task is still waiting for attribute to be ready
-        Assert.assertFalse(stringFuture.isDone());
-
-        // Set the sensor; expect that to complete
-        e2.sensors().set(Sensors.newStringSensor("foo"), "bar");
-        String s = stringFuture.get(10, TimeUnit.SECONDS); // Timeout just for sanity
-        Assert.assertEquals(s, "bar");
-    }
-
-    @Test
-    public void testDslAttributeWhenReadyPersistedAsDeferredSupplier() throws Exception {
-    	doDslAttributeWhenReadyPersistedAsDeferredSupplier(false);
-    }
-    
-    @Test
-    public void testDslAttributeWhenReadyPersistedWithoutLeakingResolvedValue() throws Exception {
-    	doDslAttributeWhenReadyPersistedAsDeferredSupplier(true);
-    }
-    
-    protected void doDslAttributeWhenReadyPersistedAsDeferredSupplier(boolean resolvedBeforeRebind) throws Exception {
-        Entity testEntity = entityWithAttributeWhenReady();
-        
-        if (resolvedBeforeRebind) {
-        	testEntity.sensors().set(Sensors.newStringSensor("foo"), "bar");
-        	Assert.assertEquals(getConfigInTask(testEntity, TestEntity.CONF_NAME), "bar");
-        }
-        
-        // Persist and rebind
-        Application app2 = rebind(testEntity.getApplication());
-        Entity e2 = Iterables.getOnlyElement(app2.getChildren());
-
-        Maybe<Object> maybe = ((EntityInternal) e2).config().getLocalRaw(TestEntity.CONF_NAME);
-        Assert.assertTrue(maybe.isPresentAndNonNull());
-        Assert.assertTrue(BrooklynDslDeferredSupplier.class.isInstance(maybe.get()));
-        BrooklynDslDeferredSupplier<?> deferredSupplier = (BrooklynDslDeferredSupplier<?>) maybe.get();
-        Assert.assertEquals(deferredSupplier.toString(), "$brooklyn:entity(\"x\").attributeWhenReady(\"foo\")");
-
-        // Assert the persisted state itself is as expected, and not too big
-        BrooklynMementoRawData raw = BrooklynPersistenceUtils.newStateMemento(app2.getManagementContext(), MementoCopyMode.LOCAL);
-        String persistedStateForE2 = raw.getEntities().get(e2.getId());
-        Matcher matcher = Pattern.compile(".*\\<test.confName\\>(.*)\\<\\/test.confName\\>.*", Pattern.DOTALL)
-                .matcher(persistedStateForE2);
-        Assert.assertTrue(matcher.find());
-        String testConfNamePersistedState = matcher.group(1);
-
-        Assert.assertNotNull(testConfNamePersistedState);
-        // should be about 200 chars long, something like:
-        //
-        //      <test.confName>
-        //        <org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent_-AttributeWhenReady>
-        //          <component>
-        //            <componentId>x</componentId>
-        //            <scope>GLOBAL</scope>
-        //          </component>
-        //          <sensorName>foo</sensorName>
-        //        </org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent_-AttributeWhenReady>
-        //      </test.confName>
-
-        Assert.assertTrue(testConfNamePersistedState.length() < 400, "persisted state too long: " + testConfNamePersistedState);
-        
-        Assert.assertFalse(testConfNamePersistedState.contains("bar"), "value 'bar' leaked in persisted state");
-    }
-
-    @Test
-    public void testDslAttributeWhenReadyInEntitySpecWhenNotYetResolved() throws Exception {
-    	doDslAttributeWhenReadyInEntitySpec(false);
-    }
-    
-    @Test
-    public void testDslAttributeWhenReadyInEntitySpecWhenAlreadyResolved() throws Exception {
-    	doDslAttributeWhenReadyInEntitySpec(true);
-    }
-    
-    protected void doDslAttributeWhenReadyInEntitySpec(boolean resolvedBeforeRebind) throws Exception {
-        String yaml = "location: localhost\n" +
-                "name: Test Cluster\n" +
-                "services:\n" +
-                "- type: org.apache.brooklyn.entity.group.DynamicCluster\n" +
-                "  id: test-cluster\n" +
-                "  initialSize: 0\n" +
-                "  memberSpec:\n" +
-                "    $brooklyn:entitySpec:\n" +
-                "      type: org.apache.brooklyn.core.test.entity.TestEntity\n" +
-                "      brooklyn.config:\n" +
-                "        test.confName: $brooklyn:component(\"test-cluster\").attributeWhenReady(\"sensor\")";
-
-        final Entity testEntity = createAndStartApplication(yaml);
-        DynamicCluster cluster = (DynamicCluster) Iterables.getOnlyElement(testEntity.getApplication().getChildren());
-        cluster.resize(1);
-        Assert.assertEquals(cluster.getMembers().size(), 1);
-
-        if (resolvedBeforeRebind) {
-            cluster.sensors().set(Sensors.newStringSensor("sensor"), "bar");
-        }
-
-        // Persist and rebind
-        Application app2 = rebind(cluster.getApplication());
-        DynamicCluster cluster2 = (DynamicCluster) Iterables.getOnlyElement(app2.getApplication().getChildren());
-
-        // Assert the persisted state itself is as expected, and not too big
-        BrooklynMementoRawData raw = BrooklynPersistenceUtils.newStateMemento(app2.getManagementContext(), MementoCopyMode.LOCAL);
-        String persistedStateForE2 = raw.getEntities().get(cluster2.getId());
-        String expectedTag = "org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent_-AttributeWhenReady";
-        Matcher matcher = Pattern.compile(".*\\<"+expectedTag+"\\>(.*)\\<\\/"+expectedTag+"\\>.*", Pattern.DOTALL)
-                .matcher(persistedStateForE2);
-        Assert.assertTrue(matcher.find(), persistedStateForE2);
-        String testConfNamePersistedState = matcher.group(1);
-        Assert.assertNotNull(testConfNamePersistedState);
-
-        // Can re-size to create a new member entity
-        cluster2.resize(2);
-        Assert.assertEquals(cluster2.getMembers().size(), 2);
-        
-        // Both the existing and the new member should have the DeferredSupplier config
-        for (Entity member : Iterables.filter(cluster2.getChildren(), TestEntity.class)) {
-	        Maybe<Object> maybe = ((EntityInternal)member).config().getLocalRaw(TestEntity.CONF_NAME);
-	        Assert.assertTrue(maybe.isPresentAndNonNull());
-	        BrooklynDslDeferredSupplier<?> deferredSupplier = (BrooklynDslDeferredSupplier<?>) maybe.get();
-	        Assert.assertEquals(deferredSupplier.toString(), "$brooklyn:entity(\"test-cluster\").attributeWhenReady(\"sensor\")");
-        }
-        
-        if (resolvedBeforeRebind) {
-            // All members should resolve their config
-            for (Entity member : Iterables.filter(cluster2.getChildren(), TestEntity.class)) {
-		        String val = getConfigInTask(member, TestEntity.CONF_NAME);
-		        Assert.assertEquals(val, "bar");
-            }
-        } else {
-        	List<Future<String>> futures = Lists.newArrayList();
-        	
-            // All members should have unresolved values
-            for (Entity member : Iterables.filter(cluster2.getChildren(), TestEntity.class)) {
-		        // Wait for the attribute to be ready in a new Task
-		        Future<String> stringFuture = getConfigInTaskAsync(member, TestEntity.CONF_NAME);
-		        futures.add(stringFuture);
-		        
-		        // Check that the Task is still waiting for attribute to be ready
-		        Thread.sleep(100);
-		        Assert.assertFalse(stringFuture.isDone());
-            }
-            
-            // After setting the sensor, all those values should now resolve
-	        cluster2.sensors().set(Sensors.newStringSensor("sensor"), "bar");
-	        
-	        for (Future<String> future : futures) {
-		        String s = future.get(10, TimeUnit.SECONDS); // Timeout just for sanity
-		        Assert.assertEquals(s, "bar");
-            }
-        }
-    }
-
-    private Entity entityWithAttributeWhenReady() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.confName: $brooklyn:component(\"x\").attributeWhenReady(\"foo\")");
-    }
-
-    private void doTestOnEntityWithSensor(Entity testEntity, Sensor<?> expectedSensor) throws Exception {
-        doTestOnEntityWithSensor(testEntity, expectedSensor, true);
-    }
-
-    private void doTestOnEntityWithSensor(Entity testEntity, Sensor<?> expectedSensor, boolean inTask) throws Exception {
-        @SuppressWarnings("rawtypes")
-        ConfigKey<Sensor> configKey = ConfigKeys.newConfigKey(Sensor.class, "test.sensor");
-        Sensor<?> s;
-        s = inTask ? getConfigInTask(testEntity, configKey) : testEntity.getConfig(configKey);
-        Assert.assertEquals(s, expectedSensor);
-        Application app2 = rebind(testEntity.getApplication());
-        Entity te2 = Iterables.getOnlyElement(app2.getChildren());
-        s = inTask ? getConfigInTask(te2, configKey) : te2.getConfig(configKey);
-        Assert.assertEquals(s, expectedSensor);
-    }
-
-    @Test
-    public void testDslSensorFromClass() throws Exception {
-        doTestOnEntityWithSensor(entityWithSensorFromClass(), Attributes.SERVICE_UP);
-        // without context it can still find it
-        doTestOnEntityWithSensor(entityWithSensorFromClass(), Attributes.SERVICE_UP, false);
-    }
-
-    @Test
-    public void testDslSensorLocal() throws Exception {
-        doTestOnEntityWithSensor(entityWithSensorLocal(), TestEntity.SEQUENCE);
-        // here without context it makes one up, so type info (and description etc) not present;
-        // but context is needed to submit the DslDeferredSupplier object, so this would fail
-//        doTestOnEntityWithSensor(entityWithSensorAdHoc(), Sensors.newSensor(Object.class, TestEntity.SEQUENCE.getName()), false);
-    }
-
-    @Test
-    public void testDslSensorAdHoc() throws Exception {
-        doTestOnEntityWithSensor(entityWithSensorAdHoc(), Sensors.newSensor(Object.class, "sensor.foo"));
-        // here context has no impact, but it is needed to submit the DslDeferredSupplier object so this would fail
-//        doTestOnEntityWithSensor(entityWithSensorAdHoc(), Sensors.newSensor(Object.class, "sensor.foo"), false);
-    }
-
-    private Entity entityWithSensorFromClass() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.sensor: $brooklyn:sensor(\"" + Attributes.class.getName() + "\", \"" + Attributes.SERVICE_UP.getName() + "\")");
-    }
-
-    private Entity entityWithSensorLocal() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.sensor: $brooklyn:sensor(\"" + TestEntity.SEQUENCE.getName() + "\")");
-    }
-
-    private Entity entityWithSensorAdHoc() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.sensor: $brooklyn:sensor(\"sensor.foo\")");
-    }
-
-
-    @Test
-    public void testDslConfigFromRoot() throws Exception {
-        Entity testEntity = entityWithConfigFromRoot();
-        Assert.assertEquals(getConfigInTask(testEntity, TestEntity.CONF_NAME), "bar");
-    }
-
-    @Test
-    public void testDslConfigFromRootRebind() throws Exception {
-        Entity testEntity = entityWithConfigFromRoot();
-        Application app2 = rebind(testEntity.getApplication());
-        Entity e2 = Iterables.getOnlyElement(app2.getChildren());
-
-        Assert.assertEquals(getConfigInTask(e2, TestEntity.CONF_NAME), "bar");
-    }
-
-    private Entity entityWithConfigFromRoot() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.confName: $brooklyn:component(\"x\").config(\"foo\")",
-                "brooklyn.config:",
-                "  foo: bar");
-    }
-
-
-    @Test
-    public void testDslFormatString() throws Exception {
-        Entity testEntity = entityWithFormatString();
-        Assert.assertEquals(getConfigInTask(testEntity, TestEntity.CONF_NAME), "hello world");
-    }
-
-    @Test
-    public void testDslFormatStringRebind() throws Exception {
-        Entity testEntity = entityWithFormatString();
-        Application app2 = rebind(testEntity.getApplication());
-        Entity e2 = Iterables.getOnlyElement(app2.getChildren());
-
-        Assert.assertEquals(getConfigInTask(e2, TestEntity.CONF_NAME), "hello world");
-    }
-
-    private Entity entityWithFormatString() throws Exception {
-        return setupAndCheckTestEntityInBasicYamlWith(
-                "  id: x",
-                "  brooklyn.config:",
-                "    test.confName: $brooklyn:formatString(\"hello %s\", \"world\")");
-    }
-
-
-    /*
-        - type: org.apache.brooklyn.enricher.stock.Transformer
-          brooklyn.config:
-            enricher.sourceSensor: $brooklyn:sensor("mongodb.server.replicaSet.primary.endpoint")
-            enricher.targetSensor: $brooklyn:sensor("justtheport")
-            enricher.transformation: $brooklyn:function.regexReplacement("^.*:", "")
-        - type: org.apache.brooklyn.enricher.stock.Transformer
-          brooklyn.config:
-            enricher.sourceSensor: $brooklyn:sensor("mongodb.server.replicaSet.primary.endpoint")
-            enricher.targetSensor: $brooklyn:sensor("directport")
-            enricher.targetValue: $brooklyn:regexReplacement($brooklyn:attributeWhenReady("mongodb.server.replicaSet.primary.endpoint"), "^.*:", "foo")
-     */
-
-    @Test
-    public void testRegexReplacementWithStrings() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-                "  brooklyn.config:",
-                "    test.regex.config: $brooklyn:regexReplacement(\"somefooname\", \"foo\", \"bar\")"
-        );
-        Assert.assertEquals("somebarname", testEntity.getConfig(ConfigKeys.newStringConfigKey("test.regex.config")));
-    }
-
-    @Test
-    public void testRegexReplacementWithAttributeWhenReady() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-                "  brooklyn.config:",
-                "    test.regex.config: $brooklyn:regexReplacement($brooklyn:attributeWhenReady(\"test.regex.source\"), $brooklyn:attributeWhenReady(\"test.regex.pattern\"), $brooklyn:attributeWhenReady(\"test.regex.replacement\"))"
-        );
-        testEntity.sensors().set(Sensors.newStringSensor("test.regex.source"), "somefooname");
-        testEntity.sensors().set(Sensors.newStringSensor("test.regex.pattern"), "foo");
-        testEntity.sensors().set(Sensors.newStringSensor("test.regex.replacement"), "bar");
-
-        Assert.assertEquals("somebarname", testEntity.getConfig(ConfigKeys.newStringConfigKey("test.regex.config")));
-    }
-
-    @Test
-    public void testRegexReplacementFunctionWithStrings() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-                "  brooklyn.enrichers:",
-                "  - type: org.apache.brooklyn.enricher.stock.Transformer",
-                "    brooklyn.config:",
-                "      enricher.sourceSensor: $brooklyn:sensor(\"test.name\")",
-                "      enricher.targetSensor: $brooklyn:sensor(\"test.name.transformed\")",
-                "      enricher.transformation: $brooklyn:function.regexReplacement(\"foo\", \"bar\")"
-        );
-        testEntity.sensors().set(TestEntity.NAME, "somefooname");
-        AttributeSensor<String> transformedSensor = Sensors.newStringSensor("test.name.transformed");
-        EntityAsserts.assertAttributeEqualsEventually(testEntity, transformedSensor, "somebarname");
-    }
-
-    @Test
-    public void testRegexReplacementFunctionWithAttributeWhenReady() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-                "  brooklyn.enrichers:",
-                "  - type: org.apache.brooklyn.enricher.stock.Transformer",
-                "    brooklyn.config:",
-                "      enricher.sourceSensor: $brooklyn:sensor(\"test.name\")",
-                "      enricher.targetSensor: $brooklyn:sensor(\"test.name.transformed\")",
-                "      enricher.transformation: $brooklyn:function.regexReplacement($brooklyn:attributeWhenReady(\"test.pattern\"), $brooklyn:attributeWhenReady(\"test.replacement\"))"
-        );
-        testEntity.sensors().set(Sensors.newStringSensor("test.pattern"), "foo");
-        testEntity.sensors().set(Sensors.newStringSensor("test.replacement"), "bar");
-        testEntity.sensors().set(TestEntity.NAME, "somefooname");
-        AttributeSensor<String> transformedSensor = Sensors.newStringSensor("test.name.transformed");
-        EntityAsserts.assertAttributeEqualsEventually(testEntity, transformedSensor, "somebarname");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
deleted file mode 100644
index 0554917..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
+++ /dev/null
@@ -1,124 +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.brooklyn;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.apache.brooklyn.util.collections.Jsonya;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test
-public class EmptySoftwareProcessYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(EnrichersYamlTest.class);
-
-    @Test(groups="Integration")
-    public void testProvisioningProperties() throws Exception {
-        Entity app = createAndStartApplication(
-            "location: localhost",
-            "services:",
-            "- type: "+EmptySoftwareProcess.class.getName(),
-            "  provisioning.properties:",
-            "    minRam: 16384");
-        waitForApplicationTasks(app);
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        
-        EmptySoftwareProcess entity = (EmptySoftwareProcess) app.getChildren().iterator().next();
-        Map<String, Object> pp = entity.getConfig(EmptySoftwareProcess.PROVISIONING_PROPERTIES);
-        Assert.assertEquals(pp.get("minRam"), 16384);
-    }
-
-    @Test(groups="Integration")
-    public void testProvisioningPropertiesViaJsonya() throws Exception {
-        Entity app = createAndStartApplication(
-            Jsonya.newInstance()
-                .put("location", "localhost")
-                .at("services").list()
-                .put("type", EmptySoftwareProcess.class.getName())
-                .at("provisioning.properties").put("minRam", 16384)
-                .root().toString());
-        waitForApplicationTasks(app);
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        
-        EmptySoftwareProcess entity = (EmptySoftwareProcess) app.getChildren().iterator().next();
-        Map<String, Object> pp = entity.getConfig(EmptySoftwareProcess.PROVISIONING_PROPERTIES);
-        Assert.assertEquals(pp.get("minRam"), 16384);
-    }
-
-    // for https://github.com/brooklyncentral/brooklyn/issues/1377
-    @Test(groups="Integration")
-    public void testWithAppAndEntityLocations() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: "+EmptySoftwareProcess.class.getName(),
-                "  location: localhost:(name=localhost on entity)",
-                "location: byon:(hosts=\"127.0.0.1\", name=loopback on app)");
-        waitForApplicationTasks(app);
-        Entities.dumpInfo(app);
-        
-        Assert.assertEquals(app.getLocations().size(), 1);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        
-        Location appLocation = app.getLocations().iterator().next();
-        Assert.assertEquals(appLocation.getDisplayName(), "loopback on app");
-        
-        Assert.assertEquals(entity.getLocations().size(), 2);
-        Iterator<Location> entityLocationIterator = entity.getLocations().iterator();
-        Assert.assertEquals(entityLocationIterator.next().getDisplayName(), "localhost on entity");
-        Location actualMachine = entityLocationIterator.next();
-        Assert.assertTrue(actualMachine instanceof SshMachineLocation, "wrong location: "+actualMachine);
-        // TODO this, below, probably should be 'localhost on entity', see #1377
-        Assert.assertEquals(actualMachine.getParent().getDisplayName(), "localhost on entity");
-    }
-    
-    @Test(groups="Integration")
-    public void testNoSshing() throws Exception {
-        Entity app = createAndStartApplication(
-                "location: byon:(hosts=\"1.2.3.4\")",
-                "services:",
-                "- type: "+EmptySoftwareProcess.class.getName(),
-                "  brooklyn.config:",
-                "    sshMonitoring.enabled: false",
-                "    "+BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION.getName()+": true");
-        waitForApplicationTasks(app);
-
-        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptySoftwareProcess.class));
-        EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-        EntityAsserts.assertAttributeEqualsContinually(entity, Attributes.SERVICE_UP, true);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
deleted file mode 100644
index 77043c7..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.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.brooklyn;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAsserts;
-import org.apache.brooklyn.entity.software.base.EmptyWindowsProcess;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-@Test
-public class EmptyWindowsProcessYamlTest extends AbstractYamlTest {
-
-    @Test(groups="Integration")
-    public void testNoWinrm() throws Exception {
-        Entity app = createAndStartApplication(
-                "location: byon:(hosts=\"1.2.3.4\",osFamily=windows)",
-                "services:",
-                "- type: "+EmptyWindowsProcess.class.getName(),
-                "  brooklyn.config:",
-                "    winrmMonitoring.enabled: false");
-        waitForApplicationTasks(app);
-
-        EmptyWindowsProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptyWindowsProcess.class));
-        EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-        EntityAsserts.assertAttributeEqualsContinually(entity, Attributes.SERVICE_UP, true);
-        
-        Iterables.find(entity.getLocations(), Predicates.instanceOf(WinRmMachineLocation.class));
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersYamlTest.java
deleted file mode 100644
index cf9f204..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersYamlTest.java
+++ /dev/null
@@ -1,256 +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.brooklyn;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAdjuncts;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.test.policy.TestEnricher;
-import org.apache.brooklyn.enricher.stock.Propagator;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-@Test
-public class EnrichersYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(EnrichersYamlTest.class);
-
-    @Test
-    public void testWithAppEnricher() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-app-with-enricher.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-app-with-enricher");
-        
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        
-        Assert.assertEquals(EntityAdjuncts.getNonSystemEnrichers(app).size(), 1);
-        final Enricher enricher = EntityAdjuncts.getNonSystemEnrichers(app).iterator().next();
-        Assert.assertTrue(enricher instanceof TestEnricher, "enricher="+enricher);
-        Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_NAME), "Name from YAML");
-        Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_FROM_FUNCTION), "$brooklyn: is a fun place");
-        
-        Entity target = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() {
-            public Entity call() {
-                return enricher.getConfig(TestEnricher.TARGET_ENTITY);
-            }}).get();
-        Assert.assertNotNull(target);
-        Assert.assertEquals(target.getDisplayName(), "testentity");
-        Assert.assertEquals(target, app.getChildren().iterator().next());
-        Entity targetFromFlag = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() {
-            public Entity call() {
-                return enricher.getConfig(TestEnricher.TARGET_ENTITY_FROM_FLAG);
-            }}).get();
-        Assert.assertEquals(targetFromFlag, target);
-        Map<?, ?> leftoverProperties = ((TestEnricher) enricher).getLeftoverProperties();
-        Assert.assertEquals(leftoverProperties.get("enricherLiteralValue1"), "Hello");
-        Assert.assertEquals(leftoverProperties.get("enricherLiteralValue2"), "World");
-        Assert.assertEquals(leftoverProperties.size(), 2);
-    }
-    
-    @Test
-    public void testWithEntityEnricher() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("test-entity-with-enricher.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-entity-with-enricher");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertEquals(EntityAdjuncts.getNonSystemEnrichers(app).size(), 0);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        final Entity child = app.getChildren().iterator().next();
-        Asserts.eventually(new Supplier<Integer>() {
-            @Override
-            public Integer get() {
-                return EntityAdjuncts.getNonSystemEnrichers(child).size();
-            }
-        }, Predicates.<Integer> equalTo(1));        
-        final Enricher enricher = EntityAdjuncts.getNonSystemEnrichers(child).iterator().next();
-        Assert.assertNotNull(enricher);
-        Assert.assertTrue(enricher instanceof TestEnricher, "enricher=" + enricher + "; type=" + enricher.getClass());
-        Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_NAME), "Name from YAML");
-        Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_FROM_FUNCTION), "$brooklyn: is a fun place");
-        
-        Assert.assertEquals(((TestEnricher) enricher).getLeftoverProperties(),
-                ImmutableMap.of("enricherLiteralValue1", "Hello", "enricherLiteralValue2", "World"));
-    }
-    
-    @Test
-    public void testPropagatingEnricher() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-propagating-enricher.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-propagating-enricher");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        TestEntity entity = (TestEntity)app.getChildren().iterator().next();
-        entity.sensors().set(TestEntity.NAME, "New Name");
-        Asserts.eventually(Entities.attributeSupplier(app, TestEntity.NAME), Predicates.<String>equalTo("New Name"));
-    }
-    
-    @Test
-    public void testPropogateChildSensor() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",
-                    "  brooklyn.config:",
-                    "    test.confName: parent entity",
-                    "  id: parentId",
-                    "  brooklyn.enrichers:",
-                    "  - enricherType: org.apache.brooklyn.enricher.stock.Propagator",
-                    "    brooklyn.config:",
-                    "      enricher.producer: $brooklyn:component(\"childId\")",
-                    "      enricher.propagating.propagatingAll: true",
-                    "  brooklyn.children:",
-                    "  - serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-                    "    id: childId",
-                    "    brooklyn.config:",
-                    "      test.confName: Child Name"));
-        waitForApplicationTasks(app);
-        
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        final Entity parentEntity = app.getChildren().iterator().next();
-        Assert.assertTrue(parentEntity instanceof TestEntity, "Expected parent entity to be TestEntity, found:" + parentEntity);
-        Assert.assertEquals(parentEntity.getChildren().size(), 1);
-        Entity childEntity = parentEntity.getChildren().iterator().next();
-        Assert.assertTrue(childEntity instanceof TestEntity, "Expected child entity to be TestEntity, found:" + childEntity);
-        Asserts.eventually(new Supplier<Integer>() {
-            @Override
-            public Integer get() {
-                return EntityAdjuncts.getNonSystemEnrichers(parentEntity).size();
-            }
-        }, Predicates.<Integer>equalTo(1));
-        Enricher enricher = EntityAdjuncts.getNonSystemEnrichers(parentEntity).iterator().next();
-        Asserts.assertTrue(enricher instanceof Propagator, "Expected enricher to be Propagator, found:" + enricher);
-        final Propagator propagator = (Propagator)enricher;
-        Entity producer = ((EntityInternal)parentEntity).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() {
-            public Entity call() {
-                return propagator.getConfig(Propagator.PRODUCER);
-            }}).get();
-        Assert.assertEquals(producer, childEntity);
-        Asserts.assertTrue(Boolean.valueOf(propagator.getConfig(Propagator.PROPAGATING_ALL)), "Expected Propagator.PROPAGATING_ALL to be true");
-        ((TestEntity)childEntity).sensors().set(TestEntity.NAME, "New Name");
-        Asserts.eventually(Entities.attributeSupplier(parentEntity, TestEntity.NAME), Predicates.<String>equalTo("New Name"));
-    }
-    
-    @Test
-    public void testMultipleEnricherReferences() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("test-referencing-enrichers.yaml"));
-        waitForApplicationTasks(app);
-        
-        Entity entity1 = null, entity2 = null, child1 = null, child2 = null, grandchild1 = null, grandchild2 = null;
-        
-        Assert.assertEquals(app.getChildren().size(), 2);
-        for (Entity child : app.getChildren()) {
-            if (child.getDisplayName().equals("entity 1"))
-                entity1 = child;
-            if (child.getDisplayName().equals("entity 2"))
-                entity2 = child;
-        }
-        Assert.assertNotNull(entity1);
-        Assert.assertNotNull(entity2);
-        
-        Assert.assertEquals(entity1.getChildren().size(), 2);
-        for (Entity child : entity1.getChildren()) {
-            if (child.getDisplayName().equals("child 1"))
-                child1 = child;
-            if (child.getDisplayName().equals("child 2"))
-                child2 = child;
-        }
-        Assert.assertNotNull(child1);
-        Assert.assertNotNull(child2);
-        
-        Assert.assertEquals(child1.getChildren().size(), 2);
-        for (Entity child : child1.getChildren()) {
-            if (child.getDisplayName().equals("grandchild 1"))
-               grandchild1 = child;
-            if (child.getDisplayName().equals("grandchild 2"))
-                grandchild2 = child;
-        }
-        Assert.assertNotNull(grandchild1);
-        Assert.assertNotNull(grandchild2);
-        
-        ImmutableSet<Enricher> enrichers = new ImmutableSet.Builder<Enricher>()
-                .add(getEnricher(app))
-                .add(getEnricher(entity1))
-                .add(getEnricher(entity2))
-                .add(getEnricher(child1))
-                .add(getEnricher(child2))
-                .add(getEnricher(grandchild1))
-                .add(getEnricher(grandchild2))
-                .build();
-        
-        Map<ConfigKey<Entity>, Entity> keyToEntity = new ImmutableMap.Builder<ConfigKey<Entity>, Entity>()
-                .put(TestReferencingEnricher.TEST_APPLICATION, app)
-                .put(TestReferencingEnricher.TEST_ENTITY_1, entity1)
-                .put(TestReferencingEnricher.TEST_ENTITY_2, entity2)
-                .put(TestReferencingEnricher.TEST_CHILD_1, child1)
-                .put(TestReferencingEnricher.TEST_CHILD_2, child2)
-                .put(TestReferencingEnricher.TEST_GRANDCHILD_1, grandchild1)
-                .put(TestReferencingEnricher.TEST_GRANDCHILD_2, grandchild2)
-                .build();
-        
-        for (Enricher enricher : enrichers)
-            checkReferences(enricher, keyToEntity);
-    }
-    
-    private void checkReferences(final Enricher enricher, Map<ConfigKey<Entity>, Entity> keyToEntity) throws Exception {
-        for (final ConfigKey<Entity> key : keyToEntity.keySet()) {
-            final Entity entity = keyToEntity.get(key); // Grab an entity whose execution context we can use
-            Entity fromConfig = ((EntityInternal)entity).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() {
-                @Override
-                public Entity call() throws Exception {
-                    return (Entity) enricher.getConfig(key);
-                }
-            }).get();
-            Assert.assertEquals(fromConfig, keyToEntity.get(key));
-        }
-    }
-    
-    private Enricher getEnricher(Entity entity) {
-        List<Enricher> enrichers = EntityAdjuncts.getNonSystemEnrichers(entity);
-        Assert.assertEquals(enrichers.size(), 1, "Wrong number of enrichers: "+enrichers);
-        Enricher enricher = enrichers.iterator().next();
-        Assert.assertTrue(enricher instanceof TestReferencingEnricher, "Wrong enricher: "+enricher);
-        return enricher;
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-    
-}


[03/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityChangeListener.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityChangeListener.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityChangeListener.java
deleted file mode 100644
index b7f53a4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityChangeListener.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 org.apache.brooklyn.core.mgmt.internal;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.config.ConfigKey;
-
-public interface EntityChangeListener {
-
-    // TODO for testing only!
-    public static final EntityChangeListener NOOP = new EntityChangeListener() {
-        @Override public void onChanged() {}
-        @Override public void onAttributeChanged(AttributeSensor<?> attribute) {}
-        @Override public void onConfigChanged(ConfigKey<?> key) {}
-        @Override public void onLocationsChanged() {}
-        @Override public void onMembersChanged() {}
-        @Override public void onTagsChanged() {}
-        @Override public void onChildrenChanged() {}
-        @Override public void onPolicyAdded(Policy policy) {}
-        @Override public void onPolicyRemoved(Policy policy) {}
-        @Override public void onEnricherAdded(Enricher enricher) {}
-        @Override public void onEnricherRemoved(Enricher enricher) {}
-        @Override public void onFeedAdded(Feed feed) {}
-        @Override public void onFeedRemoved(Feed feed) {}
-        @Override public void onEffectorStarting(Effector<?> effector, Object parameters) {}
-        @Override public void onEffectorCompleted(Effector<?> effector) {}
-    };
-    
-    void onChanged();
-
-    void onAttributeChanged(AttributeSensor<?> attribute);
-
-    void onConfigChanged(ConfigKey<?> key);
-
-    void onLocationsChanged();
-    
-    void onTagsChanged();
-
-    void onMembersChanged();
-
-    void onChildrenChanged();
-
-    void onPolicyAdded(Policy policy);
-
-    void onPolicyRemoved(Policy policy);
-
-    void onEnricherAdded(Enricher enricher);
-
-    void onEnricherRemoved(Enricher enricher);
-
-    void onFeedAdded(Feed feed);
-
-    void onFeedRemoved(Feed feed);
-
-    void onEffectorStarting(Effector<?> effector, Object parameters);
-    
-    void onEffectorCompleted(Effector<?> effector);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagementSupport.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagementSupport.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagementSupport.java
deleted file mode 100644
index 3811542..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagementSupport.java
+++ /dev/null
@@ -1,480 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument;
-import org.apache.brooklyn.core.mgmt.internal.NonDeploymentManagementContext.NonDeploymentManagementContextMode;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Stopwatch;
-
-/**
- * Encapsulates management activities at an entity.
- * <p>
- * On entity deployment, ManagementContext.manage(entity) causes
- * <p>
- * * onManagementStarting(ManagementContext)
- * * onManagementStartingSubscriptions()
- * * onManagementStartingSensorEmissions()
- * * onManagementStartingExecutions()
- * * onManagementStarted() - when all the above is said and done
- * * onManagementStartingHere();
- * <p>
- * on unmanage it hits onManagementStoppingHere() then onManagementStopping().
- * <p>
- * When an entity's management migrates, it invokes onManagementStoppingHere() at the old location,
- * then onManagementStartingHere() at the new location.
- */
-public class EntityManagementSupport {
-
-    private static final Logger log = LoggerFactory.getLogger(EntityManagementSupport.class);
-    
-    public EntityManagementSupport(AbstractEntity entity) {
-        this.entity = entity;
-        nonDeploymentManagementContext = new NonDeploymentManagementContext(entity, NonDeploymentManagementContextMode.PRE_MANAGEMENT);
-    }
-
-    protected transient AbstractEntity entity;
-    NonDeploymentManagementContext nonDeploymentManagementContext;
-    
-    protected transient ManagementContext initialManagementContext;
-    protected transient ManagementContext managementContext;
-    protected transient SubscriptionContext subscriptionContext;
-    protected transient ExecutionContext executionContext;
-    
-    protected final AtomicBoolean managementContextUsable = new AtomicBoolean(false);
-    protected final AtomicBoolean currentlyDeployed = new AtomicBoolean(false);
-    protected final AtomicBoolean everDeployed = new AtomicBoolean(false);
-    protected Boolean readOnly = null;
-    protected final AtomicBoolean managementFailed = new AtomicBoolean(false);
-    
-    private volatile EntityChangeListener entityChangeListener = EntityChangeListener.NOOP;
-
-    /**
-     * Whether this entity is managed (i.e. "onManagementStarting" has been called, so the framework knows about it,
-     * and it has not been unmanaged).
-     */
-    public boolean isDeployed() {
-        return currentlyDeployed.get();
-    }
-
-    public boolean isNoLongerManaged() {
-        return wasDeployed() && !isDeployed();
-    }
-
-    /** whether entity has ever been deployed (managed) */
-    public boolean wasDeployed() {
-        return everDeployed.get();
-    }
-    
-    @Beta
-    public void setReadOnly(boolean isReadOnly) {
-        if (isDeployed())
-            throw new IllegalStateException("Cannot set read only after deployment");
-        this.readOnly = isReadOnly;
-    }
-
-    /** Whether the entity and its adjuncts should be treated as read-only;
-     * may be null briefly when initializing if RO status is unknown. */
-    @Beta
-    public Boolean isReadOnlyRaw() {
-        return readOnly;
-    }
-
-    /** Whether the entity and its adjuncts should be treated as read-only;
-     * error if initializing and RO status is unknown. */
-    @Beta
-    public boolean isReadOnly() {
-        Preconditions.checkNotNull(readOnly, "Read-only status of %s not yet known", entity);
-        return readOnly;
-    }
-
-    /**
-     * Whether the entity's management lifecycle is complete (i.e. both "onManagementStarting" and "onManagementStarted" have
-     * been called, and it is has not been unmanaged). 
-     */
-    public boolean isFullyManaged() {
-        return (nonDeploymentManagementContext == null) && currentlyDeployed.get();
-    }
-
-    public synchronized void setManagementContext(ManagementContextInternal val) {
-        if (initialManagementContext != null) {
-            throw new IllegalStateException("Initial management context is already set for "+entity+"; cannot change");
-        }
-        if (managementContext != null && !managementContext.equals(val)) {
-            throw new IllegalStateException("Management context is already set for "+entity+"; cannot change");
-        }
-        
-        this.initialManagementContext = checkNotNull(val, "managementContext");
-        if (nonDeploymentManagementContext != null) {
-            nonDeploymentManagementContext.setManagementContext(val);
-        }
-    }
-    
-    public void onRebind(ManagementTransitionInfo info) {
-        nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_REBINDING);
-    }
-    
-    public void onManagementStarting(ManagementTransitionInfo info) {
-        try {
-            synchronized (this) {
-                boolean alreadyManaging = isDeployed();
-                
-                if (alreadyManaging) {
-                    log.warn("Already managed: "+entity+" ("+nonDeploymentManagementContext+"); onManagementStarting is no-op");
-                } else if (nonDeploymentManagementContext == null || !nonDeploymentManagementContext.getMode().isPreManaged()) {
-                    throw new IllegalStateException("Not in expected pre-managed state: "+entity+" ("+nonDeploymentManagementContext+")");
-                }
-                if (managementContext != null && !managementContext.equals(info.getManagementContext())) {
-                    throw new IllegalStateException("Already has management context: "+managementContext+"; can't set "+info.getManagementContext());
-                }
-                if (initialManagementContext != null && !initialManagementContext.equals(info.getManagementContext())) {
-                    throw new IllegalStateException("Already has different initial management context: "+initialManagementContext+"; can't set "+info.getManagementContext());
-                }
-                if (alreadyManaging) {
-                    return;
-                }
-                
-                this.managementContext = info.getManagementContext();
-                nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_STARTING);
-                
-                if (!isReadOnly()) {
-                    nonDeploymentManagementContext.getSubscriptionManager().setDelegate((AbstractSubscriptionManager) managementContext.getSubscriptionManager());
-                    nonDeploymentManagementContext.getSubscriptionManager().startDelegatingForSubscribing();
-                }
-    
-                managementContextUsable.set(true);
-                currentlyDeployed.set(true);
-                everDeployed.set(true);
-                
-                entityChangeListener = new EntityChangeListenerImpl();
-            }
-            
-            /*
-             * TODO framework starting events - phase 1, including rebind
-             *  - establish hierarchy (child, groups, etc; construction if necessary on rebind)
-             *  - set location
-             *  - set local config values
-             *  - set saved sensor values
-             *  - register subscriptions -- BUT nothing is allowed to execute
-             *  [these operations may be done before we invoke starting also; above can happen in any order;
-             *  sensor _publications_ and executor submissions are queued]
-             *  then:  set the management context and the entity is "managed" from the perspective of external viewers (ManagementContext.isManaged(entity) returns true)
-             */
-            
-            if (!isReadOnly()) {
-                entity.onManagementStarting();
-            }
-        } catch (Throwable t) {
-            managementFailed.set(true);
-            throw Exceptions.propagate(t);
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    public void onManagementStarted(ManagementTransitionInfo info) {
-        try {
-            synchronized (this) {
-                boolean alreadyManaged = isFullyManaged();
-                
-                if (alreadyManaged) {
-                    log.warn("Already managed: "+entity+" ("+nonDeploymentManagementContext+"); onManagementStarted is no-op");
-                } else if (nonDeploymentManagementContext == null || nonDeploymentManagementContext.getMode() != NonDeploymentManagementContextMode.MANAGEMENT_STARTING) {
-                    throw new IllegalStateException("Not in expected \"management starting\" state: "+entity+" ("+nonDeploymentManagementContext+")");
-                }
-                if (managementContext != info.getManagementContext()) {
-                    throw new IllegalStateException("Already has management context: "+managementContext+"; can't set "+info.getManagementContext());
-                }
-                if (alreadyManaged) {
-                    return;
-                }
-                
-                nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_STARTED);
-                
-                /*
-                 * - set derived/inherited config values
-                 * - publish all queued sensors
-                 * - start all queued executions (e.g. subscription delivery)
-                 * [above happens in exactly this order, at each entity]
-                 * then: the entity internally knows it fully managed (ManagementSupport.isManaged() returns true -- though not sure we need that);
-                 * subsequent sensor events and executions occur directly (no queueing)
-                 */
-                
-                if (!isReadOnly()) {
-                    nonDeploymentManagementContext.getSubscriptionManager().startDelegatingForPublishing();
-                }
-                
-                // TODO more of the above
-                // TODO custom started activities
-                // (elaborate or remove ^^^ ? -AH, Sept 2014)
-            }
-            
-            if (!isReadOnly()) {
-                entity.onManagementBecomingMaster();
-                entity.onManagementStarted();
-            }
-            
-            synchronized (this) {
-                nonDeploymentManagementContext = null;
-            }
-        } catch (Throwable t) {
-            managementFailed.set(true);
-            throw Exceptions.propagate(t);
-        }
-    }
-    
-    @SuppressWarnings("deprecation")
-    public void onManagementStopping(ManagementTransitionInfo info) {
-        synchronized (this) {
-            if (managementContext != info.getManagementContext()) {
-                throw new IllegalStateException("onManagementStopping encountered different management context for "+entity+
-                    (!wasDeployed() ? " (wasn't deployed)" : !isDeployed() ? " (no longer deployed)" : "")+
-                    ": "+managementContext+"; expected "+info.getManagementContext()+" (may be a pre-registered entity which was never properly managed)");
-            }
-            Stopwatch startTime = Stopwatch.createStarted();
-            while (!managementFailed.get() && nonDeploymentManagementContext!=null && 
-                    nonDeploymentManagementContext.getMode()==NonDeploymentManagementContextMode.MANAGEMENT_STARTING) {
-                // still becoming managed
-                try {
-                    if (startTime.elapsed(TimeUnit.SECONDS) > 30) {
-                        // emergency fix, 30s timeout for management starting
-                        log.error("Management stopping event "+info+" in "+this+" timed out waiting for start; proceeding to stopping");
-                        break;
-                    }
-                    wait(100);
-                } catch (InterruptedException e) {
-                    Exceptions.propagate(e);
-                }
-            }
-            if (nonDeploymentManagementContext==null) {
-                nonDeploymentManagementContext = new NonDeploymentManagementContext(entity, NonDeploymentManagementContextMode.MANAGEMENT_STOPPING);
-            } else {
-                // already stopped? or not started?
-                nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_STOPPING);
-            }
-        }
-        // TODO custom stopping activities
-        // TODO framework stopping events - no more sensors, executions, etc
-        // (elaborate or remove ^^^ ? -AH, Sept 2014)
-        
-        if (!isReadOnly() && info.getMode().isDestroying()) {
-            // if we support remote parent of local child, the following call will need to be properly remoted
-            if (entity.getParent()!=null) entity.getParent().removeChild(entity.getProxyIfAvailable());
-        }
-        // new subscriptions will be queued / not allowed
-        nonDeploymentManagementContext.getSubscriptionManager().stopDelegatingForSubscribing();
-        // new publications will be queued / not allowed
-        nonDeploymentManagementContext.getSubscriptionManager().stopDelegatingForPublishing();
-        
-        if (!isReadOnly()) {
-            entity.onManagementNoLongerMaster();
-            entity.onManagementStopped();
-        }
-    }
-    
-    public void onManagementStopped(ManagementTransitionInfo info) {
-        synchronized (this) {
-            if (managementContext == null && nonDeploymentManagementContext.getMode() == NonDeploymentManagementContextMode.MANAGEMENT_STOPPED) {
-                return;
-            }
-            if (managementContext != info.getManagementContext()) {
-                throw new IllegalStateException("Has different management context: "+managementContext+"; expected "+info.getManagementContext());
-            }
-            getSubscriptionContext().unsubscribeAll();
-            entityChangeListener = EntityChangeListener.NOOP;
-            managementContextUsable.set(false);
-            currentlyDeployed.set(false);
-            executionContext = null;
-            subscriptionContext = null;
-        }
-        
-        // TODO framework stopped activities, e.g. serialize state ?
-        entity.invalidateReferences();
-        
-        synchronized (this) {
-            managementContext = null;
-            nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_STOPPED);
-        }
-    }
-
-    @VisibleForTesting
-    @Beta
-    public boolean isManagementContextReal() {
-        return managementContextUsable.get();
-    }
-    
-    public synchronized ManagementContext getManagementContext() {
-        return (managementContextUsable.get()) ? managementContext : nonDeploymentManagementContext;
-    }    
-    
-    public synchronized ExecutionContext getExecutionContext() {
-        if (executionContext!=null) return executionContext;
-        if (managementContextUsable.get()) {
-            executionContext = managementContext.getExecutionContext(entity);
-            return executionContext;
-        }
-        return nonDeploymentManagementContext.getExecutionContext(entity);
-    }
-    public synchronized SubscriptionContext getSubscriptionContext() {
-        if (subscriptionContext!=null) return subscriptionContext;
-        if (managementContextUsable.get()) {
-            subscriptionContext = managementContext.getSubscriptionContext(entity);
-            return subscriptionContext;
-        }
-        return nonDeploymentManagementContext.getSubscriptionContext(entity);
-    }
-    public synchronized EntitlementManager getEntitlementManager() {
-        return getManagementContext().getEntitlementManager();
-    }
-
-    public void attemptLegacyAutodeployment(String effectorName) {
-        synchronized (this) {
-            if (managementContext != null) {
-                log.warn("Autodeployment suggested but not required for " + entity + "." + effectorName);
-                return;
-            }
-            if (entity instanceof Application) {
-                log.warn("Autodeployment with new management context triggered for " + entity + "." + effectorName + " -- will not be supported in future. Explicit manage call required.");
-                if (initialManagementContext != null) {
-                    initialManagementContext.getEntityManager().manage(entity);
-                } else {
-                    Entities.startManagement(entity);
-                }
-                return;
-            }
-        }
-        if ("start".equals(effectorName)) {
-            Entity e=entity;
-            if (e.getParent()!=null && ((EntityInternal)e.getParent()).getManagementSupport().isDeployed()) { 
-                log.warn("Autodeployment in parent's management context triggered for "+entity+"."+effectorName+" -- will not be supported in future. Explicit manage call required.");
-                ((EntityInternal)e.getParent()).getManagementContext().getEntityManager().manage(entity);
-                return;
-            }
-        }
-        log.warn("Autodeployment not available for "+entity+"."+effectorName);
-    }
-    
-    public EntityChangeListener getEntityChangeListener() {
-        return entityChangeListener;
-    }
-    
-    private class EntityChangeListenerImpl implements EntityChangeListener {
-        @Override
-        public void onChanged() {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onChildrenChanged() {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onLocationsChanged() {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onTagsChanged() {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onMembersChanged() {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onPolicyAdded(Policy policy) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onManaged(policy);
-        }
-        @Override
-        public void onEnricherAdded(Enricher enricher) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onManaged(enricher);
-        }
-        @Override
-        public void onFeedAdded(Feed feed) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onManaged(feed);
-        }
-        @Override
-        public void onPolicyRemoved(Policy policy) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onUnmanaged(policy);
-        }
-        @Override
-        public void onEnricherRemoved(Enricher enricher) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onUnmanaged(enricher);
-        }
-        @Override
-        public void onFeedRemoved(Feed feed) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-            getManagementContext().getRebindManager().getChangeListener().onUnmanaged(feed);
-        }
-        @Override
-        public void onAttributeChanged(AttributeSensor<?> attribute) {
-            // TODO Could make this more efficient by inspecting the attribute to decide if needs persisted
-            // immediately, or not important, or transient (e.g. do we really need to persist 
-            // request-per-second count for rebind purposes?!)
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onConfigChanged(ConfigKey<?> key) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-        @Override
-        public void onEffectorStarting(Effector<?> effector, Object parameters) {
-            Entitlements.checkEntitled(getEntitlementManager(), Entitlements.INVOKE_EFFECTOR, EntityAndItem.of(entity, StringAndArgument.of(effector.getName(), parameters)));
-        }
-        @Override
-        public void onEffectorCompleted(Effector<?> effector) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(entity);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return super.toString()+"["+(entity==null ? "null" : entity.getId())+"]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagerInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagerInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagerInternal.java
deleted file mode 100644
index 7bad213..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EntityManagerInternal.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 org.apache.brooklyn.core.mgmt.internal;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.EntityManager;
-
-public interface EntityManagerInternal extends EntityManager, BrooklynObjectManagerInternal<Entity> {
-
-    /** gets all entities currently known to the application, including entities that are not yet managed */
-    Iterable<Entity> getAllEntitiesInApplication(Application application);
-
-    public Iterable<String> getEntityIds();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ExternalConfigSupplierRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ExternalConfigSupplierRegistry.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ExternalConfigSupplierRegistry.java
deleted file mode 100644
index 81f0ee3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ExternalConfigSupplierRegistry.java
+++ /dev/null
@@ -1,45 +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.core.mgmt.internal;
-
-import org.apache.brooklyn.core.config.external.ExternalConfigSupplier;
-
-import com.google.common.annotations.Beta;
-
-
-/**
- * Permits a number of {@link ExternalConfigSupplier} instances to be registered, each with a unique name, for future
- * (deferred) lookup of configuration values.
- *
- * @since 0.8.0
- */
-@Beta
-public interface ExternalConfigSupplierRegistry {
-
-    void addProvider(String name, ExternalConfigSupplier provider);
-    void removeProvider(String name);
-
-    /**
-     * Searches the named {@link ExternalConfigSupplier} for the config value associated with the specified key.
-     * Quietly returns <code>null</code> if no config exists for the specified key.
-     * Throws {@link IllegalArgumentException} if no {@link ExternalConfigSupplier} exists for the passed name.
-     */
-    public String getConfig(String providerName, String key);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/GroovyObservablesPropertyChangeToCollectionChangeAdapter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/GroovyObservablesPropertyChangeToCollectionChangeAdapter.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/GroovyObservablesPropertyChangeToCollectionChangeAdapter.java
deleted file mode 100644
index cd13e1c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/GroovyObservablesPropertyChangeToCollectionChangeAdapter.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 org.apache.brooklyn.core.mgmt.internal;
-
-import groovy.util.ObservableList;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-public class GroovyObservablesPropertyChangeToCollectionChangeAdapter implements PropertyChangeListener {
-    @SuppressWarnings("rawtypes")
-    private final CollectionChangeListener delegate;
-
-    public GroovyObservablesPropertyChangeToCollectionChangeAdapter(@SuppressWarnings("rawtypes") CollectionChangeListener delegate) {
-        this.delegate = delegate;
-    }
-
-    @SuppressWarnings("unchecked")
-    public void propertyChange(PropertyChangeEvent evt) {
-        if (evt instanceof ObservableList.ElementAddedEvent) {
-            delegate.onItemAdded(evt.getNewValue());
-        } else if (evt instanceof ObservableList.ElementRemovedEvent) {
-            delegate.onItemRemoved(evt.getOldValue());
-        } else if (evt instanceof ObservableList.ElementUpdatedEvent) {
-            delegate.onItemRemoved(evt.getOldValue());
-            delegate.onItemAdded(evt.getNewValue());
-        } else if (evt instanceof ObservableList.ElementClearedEvent) {
-            for (Object value : ((ObservableList.ElementClearedEvent) evt).getValues()) {
-                delegate.onItemAdded(value);
-            }
-        } else if(evt instanceof ObservableList.MultiElementAddedEvent ) {
-            for(Object value: ((ObservableList.MultiElementAddedEvent)evt).getValues()){
-                delegate.onItemAdded(value);
-            }
-        }
-    }
-
-    public int hashCode() {
-        return delegate.hashCode();
-    }
-
-    public boolean equals(Object other) {
-        if (other instanceof GroovyObservablesPropertyChangeToCollectionChangeAdapter)
-            return delegate.equals(((GroovyObservablesPropertyChangeToCollectionChangeAdapter) other).delegate);
-        if (other instanceof CollectionChangeListener)
-            return delegate.equals(other);
-        return false;
-    }
-} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalAccessManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalAccessManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalAccessManager.java
deleted file mode 100644
index 1780972..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalAccessManager.java
+++ /dev/null
@@ -1,111 +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.core.mgmt.internal;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.AccessController;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public class LocalAccessManager implements AccessManager {
-
-    private volatile boolean locationProvisioningAllowed = true;
-    private volatile boolean locationManagementAllowed = true;
-    private volatile boolean entityManagementAllowed = true;
-
-    private final AtomicReference<AccessControllerImpl> controller = new AtomicReference<AccessControllerImpl>();
-
-    public LocalAccessManager() {
-        updateAccessController();
-    }
-
-    @Override
-    public AccessController getAccessController() {
-        return controller.get();
-    }
-    
-    @Override
-    public boolean isLocationProvisioningAllowed() {
-        return locationProvisioningAllowed;
-    }
-
-    @Override
-    public boolean isLocationManagementAllowed() {
-        return locationManagementAllowed;
-    }
-
-    @Override
-    public boolean isEntityManagementAllowed() {
-        return entityManagementAllowed;
-    }
-
-    @Override
-    public void setLocationProvisioningAllowed(boolean allowed) {
-        locationProvisioningAllowed = allowed;
-        updateAccessController();
-    }
-
-    @Override
-    public void setLocationManagementAllowed(boolean allowed) {
-        locationManagementAllowed = allowed;
-        updateAccessController();
-    }
-
-    @Override
-    public void setEntityManagementAllowed(boolean allowed) {
-        entityManagementAllowed = allowed;
-        updateAccessController();
-    }
-
-    private void updateAccessController() {
-        controller.set(new AccessControllerImpl(locationProvisioningAllowed, locationManagementAllowed, entityManagementAllowed));
-    }
-    
-    private static class AccessControllerImpl implements AccessController {
-        private final boolean locationProvisioningAllowed;
-        private final boolean locationManagementAllowed;
-        private final boolean entityManagementAllowed;
-        
-        public AccessControllerImpl(boolean locationProvisioningAllowed, boolean locationManagementAllowed, 
-                boolean entityManagementAllowed) {
-            this.locationProvisioningAllowed = locationProvisioningAllowed;
-            this.locationManagementAllowed = locationManagementAllowed;
-            this.entityManagementAllowed = entityManagementAllowed;
-        }
-
-        @Override
-        public Response canProvisionLocation(Location provisioner) {
-            return (locationProvisioningAllowed ? Response.allowed() : Response.disallowed("location provisioning disabled"));
-        }
-        
-        @Override
-        public Response canManageLocation(Location loc) {
-            return (locationManagementAllowed ? Response.allowed() : Response.disallowed("location management disabled"));
-        }
-        
-        @Override
-        public Response canManageEntity(Entity entity) {
-            return (entityManagementAllowed ? Response.allowed() : Response.disallowed("entity management disabled"));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
deleted file mode 100644
index aaa12d5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
+++ /dev/null
@@ -1,820 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import groovy.util.ObservableList;
-
-import java.lang.reflect.Proxy;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.entity.EntityTypeRegistry;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.AccessController;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.core.BrooklynLogging;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.objs.BasicEntityTypeRegistry;
-import org.apache.brooklyn.core.objs.proxy.EntityProxy;
-import org.apache.brooklyn.core.objs.proxy.EntityProxyImpl;
-import org.apache.brooklyn.core.objs.proxy.InternalEntityFactory;
-import org.apache.brooklyn.core.objs.proxy.InternalPolicyFactory;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.collections.SetFromLiveMap;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.time.CountdownTimer;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public class LocalEntityManager implements EntityManagerInternal {
-
-    private static final Logger log = LoggerFactory.getLogger(LocalEntityManager.class);
-
-    private final LocalManagementContext managementContext;
-    private final BasicEntityTypeRegistry entityTypeRegistry;
-    private final InternalEntityFactory entityFactory;
-    private final InternalPolicyFactory policyFactory;
-    
-    /** Entities that have been created, but have not yet begun to be managed */
-    protected final Map<String,Entity> preRegisteredEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
-
-    /** Entities that are in the process of being managed, but where management is not yet complete */
-    protected final Map<String,Entity> preManagedEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
-    
-    /** Proxies of the managed entities */
-    protected final ConcurrentMap<String,Entity> entityProxiesById = Maps.newConcurrentMap();
-    
-    /** Real managed entities */
-    protected final Map<String,Entity> entitiesById = Maps.newLinkedHashMap();
-    
-    /** Management mode for each entity */
-    protected final Map<String,ManagementTransitionMode> entityModesById = Collections.synchronizedMap(Maps.<String,ManagementTransitionMode>newLinkedHashMap());
-
-    /** Proxies of the managed entities */
-    protected final ObservableList entities = new ObservableList();
-    
-    /** Proxies of the managed entities that are applications */
-    protected final Set<Application> applications = Sets.newConcurrentHashSet();
-
-    private final BrooklynStorage storage;
-    private final Map<String,String> entityTypes;
-    private final Set<String> applicationIds;
-
-    public LocalEntityManager(LocalManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-        this.storage = managementContext.getStorage();
-        this.entityTypeRegistry = new BasicEntityTypeRegistry();
-        this.policyFactory = new InternalPolicyFactory(managementContext);
-        this.entityFactory = new InternalEntityFactory(managementContext, entityTypeRegistry, policyFactory);
-        
-        entityTypes = storage.getMap("entities");
-        applicationIds = SetFromLiveMap.create(storage.<String,Boolean>getMap("applications"));
-    }
-
-    public InternalEntityFactory getEntityFactory() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return entityFactory;
-    }
-
-    public InternalPolicyFactory getPolicyFactory() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return policyFactory;
-    }
-
-    @Override
-    public EntityTypeRegistry getEntityTypeRegistry() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return entityTypeRegistry;
-    }
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    public <T extends Entity> T createEntity(EntitySpec<T> spec) {
-        try {
-            T entity = entityFactory.createEntity(spec);
-            Entity proxy = ((AbstractEntity)entity).getProxy();
-            checkNotNull(proxy, "proxy for entity %s, spec %s", entity, spec);
-            
-            manage(entity);
-            
-            return (T) proxy;
-        } catch (Throwable e) {
-            log.warn("Failed to create entity using spec "+spec+" (rethrowing)", e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    public <T extends Entity> T createEntity(Map<?,?> config, Class<T> type) {
-        return createEntity(EntitySpec.create(config, type));
-    }
-
-    @Override
-    public <T extends Policy> T createPolicy(PolicySpec<T> spec) {
-        try {
-            return policyFactory.createPolicy(spec);
-        } catch (Throwable e) {
-            log.warn("Failed to create policy using spec "+spec+" (rethrowing)", e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    public <T extends Enricher> T createEnricher(EnricherSpec<T> spec) {
-        try {
-            return policyFactory.createEnricher(spec);
-        } catch (Throwable e) {
-            log.warn("Failed to create enricher using spec "+spec+" (rethrowing)", e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    public Collection<Entity> getEntities() {
-        return ImmutableList.copyOf(entityProxiesById.values());
-    }
-    
-    @Override
-    public Collection<String> getEntityIds() {
-        return ImmutableList.copyOf(entityProxiesById.keySet());
-    }
-    
-    @Override
-    public Collection<Entity> getEntitiesInApplication(Application application) {
-        Predicate<Entity> predicate = EntityPredicates.applicationIdEqualTo(application.getId());
-        return ImmutableList.copyOf(Iterables.filter(entityProxiesById.values(), predicate));
-    }
-
-    @Override
-    public Collection<Entity> findEntities(Predicate<? super Entity> filter) {
-        return ImmutableList.copyOf(Iterables.filter(entityProxiesById.values(), filter));
-    }
-    
-    @Override
-    public Collection<Entity> findEntitiesInApplication(Application application, Predicate<? super Entity> filter) {
-        Predicate<Entity> predicate = Predicates.and(EntityPredicates.applicationIdEqualTo(application.getId()), filter);
-        return ImmutableList.copyOf(Iterables.filter(entityProxiesById.values(), predicate));
-    }
-
-    @Override
-    public Iterable<Entity> getAllEntitiesInApplication(Application application) {
-        Predicate<Entity> predicate = EntityPredicates.applicationIdEqualTo(application.getId());
-        Iterable<Entity> allentities = Iterables.concat(preRegisteredEntitiesById.values(), preManagedEntitiesById.values(), entityProxiesById.values());
-        Iterable<Entity> result = Iterables.filter(allentities, predicate);
-        return ImmutableSet.copyOf(Iterables.transform(result, new Function<Entity, Entity>() {
-            @Override public Entity apply(Entity input) {
-                return Entities.proxy(input);
-            }}));
-    }
-
-    @Override
-    public Entity getEntity(String id) {
-        return entityProxiesById.get(id);
-    }
-    
-    Collection<Application> getApplications() {
-        return ImmutableList.copyOf(applications);
-    }
-    
-    @Override
-    public boolean isManaged(Entity e) {
-        return (isRunning() && getEntity(e.getId()) != null);
-    }
-    
-    boolean isPreRegistered(Entity e) {
-        return preRegisteredEntitiesById.containsKey(e.getId());
-    }
-    
-    void prePreManage(Entity entity) {
-        if (isPreRegistered(entity)) {
-            log.warn(""+this+" redundant call to pre-pre-manage entity "+entity+"; skipping", 
-                    new Exception("source of duplicate pre-pre-manage of "+entity));
-            return;
-        }
-        preRegisteredEntitiesById.put(entity.getId(), entity);
-    }
-    
-    @Override
-    public ManagementTransitionMode getLastManagementTransitionMode(String itemId) {
-        return entityModesById.get(itemId);
-    }
-    
-    @Override
-    public void setManagementTransitionMode(Entity item, ManagementTransitionMode mode) {
-        entityModesById.put(item.getId(), mode);
-    }
-    
-    // TODO synchronization issues here. We guard with isManaged(), but if another thread executing 
-    // concurrently then the managed'ness could be set after our check but before we do 
-    // onManagementStarting etc. However, we can't just synchronize because we're calling alien code 
-    // (the user might override entity.onManagementStarting etc).
-    // 
-    // TODO We need to do some check about isPreManaged - i.e. is there another thread (or is this a
-    // re-entrant call) where the entity is not yet full managed (i.e. isManaged==false) but we're in
-    // the middle of managing it.
-    // 
-    // TODO Also see LocalLocationManager.manage(Entity), if fixing things here
-    @Override
-    public void manage(Entity e) {
-        if (isManaged(e)) {
-            log.warn(""+this+" redundant call to start management of entity (and descendants of) "+e+"; skipping", 
-                    new Exception("source of duplicate management of "+e));
-            return;
-        }
-        manageRecursive(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY));
-    }
-
-    @Override
-    public void manageRebindedRoot(Entity item) {
-        ManagementTransitionMode mode = getLastManagementTransitionMode(item.getId());
-        Preconditions.checkNotNull(mode, "Mode not set for rebinding %s", item);
-        manageRecursive(item, mode);
-    }
-    
-    protected void checkManagementAllowed(Entity item) {
-        AccessController.Response access = managementContext.getAccessController().canManageEntity(item);
-        if (!access.isAllowed()) {
-            throw new IllegalStateException("Access controller forbids management of "+item+": "+access.getMsg());
-        }
-    }
-    
-    /* TODO we sloppily use "recursive" to ensure ordering of parent-first in many places
-     * (which may not be necessary but seems like a good idea),
-     * and also to collect many entities when doing a big rebind,
-     * ensuring all have #manageNonRecursive called before calling #onManagementStarted.
-     * 
-     * it would be better to have a manageAll(Map<Entity,ManagementTransitionMode> items)
-     * method which did that in two phases, allowing us to selectively rebind, 
-     * esp when we come to want supporting different modes and different brooklyn nodes.
-     * 
-     * the impl of manageAll could sort them with parents before children,
-     * (and manageRecursive could simply populate a map and delegate to manageAll).
-     * 
-     * manageRebindRoot would then go, and the (few) callers would construct the map.
-     * 
-     * similarly we might want an unmanageAll(), 
-     * although possibly all unmanagement should be recursive, if we assume an entity's ancestors are always at least proxied
-     * (and the non-recursive RO path here could maybe be dropped)
-     */
-    
-    /** Applies management lifecycle callbacks (onManagementStarting, for all beforehand, then onManagementStopped, for all after) */
-    protected void manageRecursive(Entity e, final ManagementTransitionMode initialMode) {
-        checkManagementAllowed(e);
-
-        final List<EntityInternal> allEntities = Lists.newArrayList();
-        Predicate<EntityInternal> manageEntity = new Predicate<EntityInternal>() { public boolean apply(EntityInternal it) {
-            ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId());
-            if (mode==null) {
-                setManagementTransitionMode(it, mode = initialMode);
-            }
-            
-            Boolean isReadOnlyFromEntity = it.getManagementSupport().isReadOnlyRaw();
-            if (isReadOnlyFromEntity==null) {
-                if (mode.isReadOnly()) {
-                    // should have been marked by rebinder
-                    log.warn("Read-only entity "+it+" not marked as such on call to manage; marking and continuing");
-                }
-                it.getManagementSupport().setReadOnly(mode.isReadOnly());
-            } else {
-                if (!isReadOnlyFromEntity.equals(mode.isReadOnly())) {
-                    log.warn("Read-only status at entity "+it+" ("+isReadOnlyFromEntity+") not consistent with management mode "+mode);
-                }
-            }
-            
-            if (it.getManagementSupport().isDeployed()) {
-                if (mode.wasNotLoaded()) {
-                    // silently bail out
-                    return false;
-                } else {
-                    if (mode.wasPrimary() && mode.isPrimary()) {
-                        // active partial rebind; continue
-                    } else if (mode.wasReadOnly() && mode.isReadOnly()) {
-                        // reload in RO mode
-                    } else {
-                        // on initial non-RO rebind, should not have any deployed instances
-                        log.warn("Already deployed "+it+" when managing "+mode+"/"+initialMode+"; ignoring this and all descendants");
-                        return false;
-                    }
-                }
-            }
-            
-            // check RO status is consistent
-            boolean isNowReadOnly = Boolean.TRUE.equals( ((EntityInternal)it).getManagementSupport().isReadOnly() );
-            if (mode.isReadOnly()!=isNowReadOnly) {
-                throw new IllegalStateException("Read-only status mismatch for "+it+": "+mode+" / RO="+isNowReadOnly);
-            }
-
-            allEntities.add(it);
-            preManageNonRecursive(it, mode);
-            it.getManagementSupport().onManagementStarting( new ManagementTransitionInfo(managementContext, mode) ); 
-            return manageNonRecursive(it, mode);
-        } };
-        boolean isRecursive = true;
-        if (initialMode.wasPrimary() && initialMode.isPrimary()) {
-            // already managed, so this shouldn't be recursive 
-            // (in ActivePartialRebind we cheat, calling in to this method then skipping recursion).
-            // it also falls through to here when doing a redundant promotion,
-            // in that case we *should* be recursive; determine by checking whether a child exists and is preregistered.
-            // the TODO above removing manageRebindRoot in favour of explicit mgmt list would clean this up a lot!
-            Entity aChild = Iterables.getFirst(e.getChildren(), null);
-            if (aChild!=null && isPreRegistered(aChild)) {
-                log.debug("Managing "+e+" in mode "+initialMode+", doing this recursively because a child is preregistered");
-            } else {
-                log.debug("Managing "+e+" but skipping recursion, as mode is "+initialMode);
-                isRecursive = false;
-            }
-        }
-        if (!isRecursive) {
-            manageEntity.apply( (EntityInternal)e );
-        } else {
-            recursively(e, manageEntity);
-        }
-        
-        for (EntityInternal it : allEntities) {
-            if (!it.getManagementSupport().isFullyManaged()) {
-                ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId());
-                ManagementTransitionInfo info = new ManagementTransitionInfo(managementContext, mode);
-                
-                it.getManagementSupport().onManagementStarted(info);
-                managementContext.getRebindManager().getChangeListener().onManaged(it);
-            }
-        }
-    }
-
-    @Override
-    public void unmanage(final Entity e) {
-        // TODO don't want to guess; should we inspect state of e ?  or maybe it doesn't matter ?
-        unmanage(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.MANAGED_PRIMARY, BrooklynObjectManagementMode.NONEXISTENT));
-    }
-    
-    public void unmanage(final Entity e, final ManagementTransitionMode mode) {
-        unmanage(e, mode, false);
-    }
-    
-    private void unmanage(final Entity e, ManagementTransitionMode mode, boolean hasBeenReplaced) {
-        if (shouldSkipUnmanagement(e)) return;
-        final ManagementTransitionInfo info = new ManagementTransitionInfo(managementContext, mode);
-        
-        if (hasBeenReplaced) {
-            // we are unmanaging an old instance after having replaced it
-            // don't unmanage or even clear its fields, because there might be references to it
-            
-            if (mode.wasReadOnly()) {
-                // if coming *from* read only; nothing needed
-            } else {
-                if (!mode.wasPrimary()) {
-                    log.warn("Unexpected mode "+mode+" for unmanage-replace "+e+" (applying anyway)");
-                }
-                // migrating away or in-place active partial rebind:
-                ((EntityInternal)e).getManagementSupport().onManagementStopping(info);
-                stopTasks(e);
-                ((EntityInternal)e).getManagementSupport().onManagementStopped(info);
-            }
-            // do not remove from maps below, bail out now
-            return;
-            
-        } else if (mode.wasReadOnly() && mode.isNoLongerLoaded()) {
-            // we are unmanaging an instance (secondary); either stopping here or primary destroyed elsewhere
-            ((EntityInternal)e).getManagementSupport().onManagementStopping(info);
-            unmanageNonRecursive(e);
-            stopTasks(e);
-            ((EntityInternal)e).getManagementSupport().onManagementStopped(info);
-            managementContext.getRebindManager().getChangeListener().onUnmanaged(e);
-            if (managementContext.getGarbageCollector() != null) managementContext.getGarbageCollector().onUnmanaged(e);
-            
-        } else if (mode.wasPrimary() && mode.isNoLongerLoaded()) {
-            // unmanaging a primary; currently this is done recursively
-            
-            /* TODO tidy up when it is recursive and when it isn't; if something is being unloaded or destroyed,
-             * that probably *is* recursive, but the old mode might be different if in some cases things are read-only.
-             * or maybe nothing needs to be recursive, we just make sure the callers (e.g. HighAvailabilityModeImpl.clearManagedItems)
-             * call in a good order
-             * 
-             * see notes above about recursive/manage/All/unmanageAll
-             */
-            
-            // Need to store all child entities as onManagementStopping removes a child from the parent entity
-            final List<EntityInternal> allEntities =  Lists.newArrayList();        
-            recursively(e, new Predicate<EntityInternal>() { public boolean apply(EntityInternal it) {
-                if (shouldSkipUnmanagement(it)) return false;
-                allEntities.add(it);
-                it.getManagementSupport().onManagementStopping(info);
-                return true;
-            } });
-
-            for (EntityInternal it : allEntities) {
-                if (shouldSkipUnmanagement(it)) continue;
-                unmanageNonRecursive(it);
-                stopTasks(it);
-            }
-            for (EntityInternal it : allEntities) {
-                it.getManagementSupport().onManagementStopped(info);
-                managementContext.getRebindManager().getChangeListener().onUnmanaged(it);
-                if (managementContext.getGarbageCollector() != null) managementContext.getGarbageCollector().onUnmanaged(e);
-            }
-            
-        } else {
-            log.warn("Invalid mode for unmanage: "+mode+" on "+e+" (ignoring)");
-        }
-        
-        preRegisteredEntitiesById.remove(e.getId());
-        preManagedEntitiesById.remove(e.getId());
-        entityProxiesById.remove(e.getId());
-        entitiesById.remove(e.getId());
-        entityModesById.remove(e.getId());
-    }
-    
-    private void stopTasks(Entity entity) {
-        stopTasks(entity, null);
-    }
-    
-    /** stops all tasks (apart from any current one or its descendants) on this entity,
-     * optionally -- if a timeout is given -- waiting for completion and warning on incomplete tasks */
-    @Beta
-    public void stopTasks(Entity entity, @Nullable Duration timeout) {
-        CountdownTimer timeleft = timeout==null ? null : timeout.countdownTimer();
-        // try forcibly interrupting tasks on managed entities
-        Collection<Exception> exceptions = MutableSet.of();
-        try {
-            Set<Task<?>> tasksCancelled = MutableSet.of();
-            for (Task<?> t: managementContext.getExecutionContext(entity).getTasks()) {
-                if (entity.equals(BrooklynTaskTags.getContextEntity(Tasks.current())) && hasTaskAsAncestor(t, Tasks.current())) {
-                    // don't cancel if we are running inside a task on the target entity and
-                    // the task being considered is one we have submitted -- e.g. on "stop" don't cancel ourselves!
-                    // but if our current task is from another entity we probably do want to cancel them (we are probably invoking unmanage)
-                    continue;
-                }
-                
-                if (!t.isDone()) {
-                    try {
-                        log.debug("Cancelling "+t+" on "+entity);
-                        tasksCancelled.add(t);
-                        t.cancel(true);
-                    } catch (Exception e) {
-                        Exceptions.propagateIfFatal(e);
-                        log.debug("Error cancelling "+t+" on "+entity+" (will warn when all tasks are cancelled): "+e, e);
-                        exceptions.add(e);
-                    }
-                }
-            }
-            
-            if (timeleft!=null) {
-                Set<Task<?>> tasksIncomplete = MutableSet.of();
-                // go through all tasks, not just cancelled ones, in case there are previously cancelled ones which are not complete
-                for (Task<?> t: managementContext.getExecutionContext(entity).getTasks()) {
-                    if (hasTaskAsAncestor(t, Tasks.current()))
-                        continue;
-                    if (!Tasks.blockUntilInternalTasksEnded(t, timeleft.getDurationRemaining())) {
-                        tasksIncomplete.add(t);
-                    }
-                }
-                if (!tasksIncomplete.isEmpty()) {
-                    log.warn("Incomplete tasks when stopping "+entity+": "+tasksIncomplete);
-                }
-                if (log.isTraceEnabled())
-                    log.trace("Cancelled "+tasksCancelled+" tasks for "+entity+", with "+
-                            timeleft.getDurationRemaining()+" remaining (of "+timeout+"): "+tasksCancelled);
-            } else {
-                if (log.isTraceEnabled())
-                    log.trace("Cancelled "+tasksCancelled+" tasks for "+entity+": "+tasksCancelled);
-            }
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.warn("Error inspecting tasks to cancel on unmanagement: "+e, e);
-        }
-        if (!exceptions.isEmpty())
-            log.warn("Error when cancelling tasks for "+entity+" on unmanagement: "+Exceptions.create(exceptions));
-    }
-
-    private boolean hasTaskAsAncestor(Task<?> t, Task<?> potentialAncestor) {
-        if (t==null || potentialAncestor==null) return false;
-        if (t.equals(potentialAncestor)) return true;
-        return hasTaskAsAncestor(t.getSubmittedByTask(), potentialAncestor);
-    }
-
-    /**
-     * activates management when effector invoked, warning unless context is acceptable
-     * (currently only acceptable context is "start")
-     */
-    void manageIfNecessary(Entity entity, Object context) {
-        if (!isRunning()) {
-            return; // TODO Still a race for terminate being called, and then isManaged below returning false
-        } else if (((EntityInternal)entity).getManagementSupport().wasDeployed()) {
-            return;
-        } else if (isManaged(entity)) {
-            return;
-        } else if (isPreManaged(entity)) {
-            return;
-        } else if (Boolean.TRUE.equals(((EntityInternal)entity).getManagementSupport().isReadOnly())) {
-            return;
-        } else {
-            Entity rootUnmanaged = entity;
-            while (true) {
-                Entity candidateUnmanagedParent = rootUnmanaged.getParent();
-                if (candidateUnmanagedParent == null || isManaged(candidateUnmanagedParent) || isPreManaged(candidateUnmanagedParent))
-                    break;
-                rootUnmanaged = candidateUnmanagedParent;
-            }
-            if (context == Startable.START.getName())
-                log.info("Activating local management for {} on start", rootUnmanaged);
-            else
-                log.warn("Activating local management for {} due to effector invocation on {}: {}", new Object[]{rootUnmanaged, entity, context});
-            manage(rootUnmanaged);
-        }
-    }
-
-    private void recursively(Entity e, Predicate<EntityInternal> action) {
-        Entity otherPreregistered = preRegisteredEntitiesById.get(e.getId());
-        if (otherPreregistered!=null) {
-            // if something has been pre-registered, prefer it
-            // (e.g. if we recursing through children, we might have a proxy from previous iteration;
-            // the most recent will have been pre-registered)
-            e = otherPreregistered;
-        }
-            
-        boolean success = action.apply( (EntityInternal)e );
-        if (!success) {
-            return; // Don't manage children if action false/unnecessary for parent
-        }
-        for (Entity child : e.getChildren()) {
-            recursively(child, action);
-        }
-    }
-
-    /**
-     * Whether the entity is in the process of being managed.
-     */
-    private synchronized boolean isPreManaged(Entity e) {
-        return preManagedEntitiesById.containsKey(e.getId());
-    }
-
-    /**
-     * Should ensure that the entity is now known about, but should not be accessible from other entities yet.
-     * 
-     * Records that the given entity is about to be managed (used for answering {@link #isPreManaged(Entity)}.
-     * Note that refs to the given entity are stored in a a weak hashmap so if the subsequent management
-     * attempt fails then this reference to the entity will eventually be discarded (if no-one else holds 
-     * a reference).
-     */
-    private synchronized boolean preManageNonRecursive(Entity e, ManagementTransitionMode mode) {
-        Entity realE = toRealEntity(e);
-        
-        Object old = preManagedEntitiesById.put(e.getId(), realE);
-        preRegisteredEntitiesById.remove(e.getId());
-        
-        if (old!=null && mode.wasNotLoaded()) {
-            if (old.equals(e)) {
-                log.warn("{} redundant call to pre-start management of entity {}, mode {}; ignoring", new Object[] { this, e, mode });
-            } else {
-                throw new IllegalStateException("call to pre-manage entity "+e+" ("+mode+") but different entity "+old+" already known under that id at "+this);
-            }
-            return false;
-        } else {
-            if (log.isTraceEnabled()) log.trace("{} pre-start management of entity {}, mode {}", 
-                new Object[] { this, e, mode });
-            return true;
-        }
-    }
-
-    /**
-     * Should ensure that the entity is now managed somewhere, and known about in all the lists.
-     * Returns true if the entity has now become managed; false if it was already managed (anything else throws exception)
-     */
-    private synchronized boolean manageNonRecursive(Entity e, ManagementTransitionMode mode) {
-        Entity old = entitiesById.get(e.getId());
-        
-        if (old!=null && mode.wasNotLoaded()) {
-            if (old.equals(e)) {
-                log.warn("{} redundant call to start management of entity {}; ignoring", this, e);
-            } else {
-                throw new IllegalStateException("call to manage entity "+e+" ("+mode+") but different entity "+old+" already known under that id at "+this);
-            }
-            return false;
-        }
-
-        BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(e),
-            "{} starting management of entity {}", this, e);
-        Entity realE = toRealEntity(e);
-        
-        Entity oldProxy = entityProxiesById.get(e.getId());
-        Entity proxyE;
-        if (oldProxy!=null) {
-            if (mode.wasNotLoaded()) {
-                throw new IllegalStateException("call to manage entity "+e+" from unloaded state ("+mode+") but already had proxy "+oldProxy+" already known under that id at "+this);
-            }
-            // make the old proxy point at this new delegate
-            // (some other tricks done in the call below)
-            ((EntityProxyImpl)(Proxy.getInvocationHandler(oldProxy))).resetDelegate(oldProxy, oldProxy, realE);
-            proxyE = oldProxy;
-        } else {
-            proxyE = toProxyEntityIfAvailable(e);
-        }
-        entityProxiesById.put(e.getId(), proxyE);
-        entityTypes.put(e.getId(), realE.getClass().getName());
-        entitiesById.put(e.getId(), realE);
-
-        preManagedEntitiesById.remove(e.getId());
-        if ((e instanceof Application) && (e.getParent()==null)) {
-            applications.add((Application)proxyE);
-            applicationIds.add(e.getId());
-        }
-        if (!entities.contains(proxyE)) 
-            entities.add(proxyE);
-        
-        if (old!=null && old!=e) {
-            // passing the transition info will ensure the right shutdown steps invoked for old instance
-            unmanage(old, mode, true);
-        }
-        
-        return true;
-    }
-
-    /**
-     * Should ensure that the entity is no longer managed anywhere, remove from all lists.
-     * Returns true if the entity has been removed from management; if it was not previously managed (anything else throws exception) 
-     */
-    private boolean unmanageNonRecursive(Entity e) {
-        /*
-         * When method is synchronized, hit deadlock: 
-         * 1. thread called unmanage() on a member of a group, so we got the lock and called group.removeMember;
-         *    this ties to synchronize on AbstractGroupImpl.members 
-         * 2. another thread was doing AbstractGroupImpl.addMember, which is synchronized on AbstractGroupImpl.members;
-         *    it tries to call Entities.manage(child) which calls LocalEntityManager.getEntity(), which is
-         *    synchronized on this.
-         * 
-         * We MUST NOT call alien code from within the management framework while holding locks. 
-         * The AbstractGroup.removeMember is effectively alien because a user could override it, and because
-         * it is entity specific.
-         * 
-         * TODO Does getting then removing from groups risk this entity being added to other groups while 
-         * this is happening? Should abstractEntity.onManagementStopped or some such remove the entity
-         * from its groups?
-         */
-        
-        if (!getLastManagementTransitionMode(e.getId()).isReadOnly()) {
-            e.clearParent();
-            for (Group group : e.groups()) {
-                if (!Entities.isNoLongerManaged(group)) group.removeMember(e);
-            }
-            if (e instanceof Group) {
-                Collection<Entity> members = ((Group)e).getMembers();
-                for (Entity member : members) {
-                    if (!Entities.isNoLongerManaged(member)) member.removeGroup((Group)e);
-                }
-            }
-        } else {
-            log.debug("No relations being updated on unmanage of read only {}", e);
-        }
-
-        synchronized (this) {
-            Entity proxyE = toProxyEntityIfAvailable(e);
-            if (e instanceof Application) {
-                applications.remove(proxyE);
-                applicationIds.remove(e.getId());
-            }
-
-            entities.remove(proxyE);
-            entityProxiesById.remove(e.getId());
-            entityModesById.remove(e.getId());
-            Object old = entitiesById.remove(e.getId());
-
-            entityTypes.remove(e.getId());
-            if (old==null) {
-                log.warn("{} call to stop management of unknown entity (already unmanaged?) {}; ignoring", this, e);
-                return false;
-            } else if (!old.equals(e)) {
-                // shouldn't happen...
-                log.error("{} call to stop management of entity {} removed different entity {}", new Object[] { this, e, old });
-                return true;
-            } else {
-                if (log.isDebugEnabled()) log.debug("{} stopped management of entity {}", this, e);
-                return true;
-            }
-        }
-    }
-
-    void addEntitySetListener(CollectionChangeListener<Entity> listener) {
-        //must notify listener in a different thread to avoid deadlock (issue #378)
-        AsyncCollectionChangeAdapter<Entity> wrappedListener = new AsyncCollectionChangeAdapter<Entity>(managementContext.getExecutionManager(), listener);
-        entities.addPropertyChangeListener(new GroovyObservablesPropertyChangeToCollectionChangeAdapter(wrappedListener));
-    }
-
-    void removeEntitySetListener(CollectionChangeListener<Entity> listener) {
-        AsyncCollectionChangeAdapter<Entity> wrappedListener = new AsyncCollectionChangeAdapter<Entity>(managementContext.getExecutionManager(), listener);
-        entities.removePropertyChangeListener(new GroovyObservablesPropertyChangeToCollectionChangeAdapter(wrappedListener));
-    }
-    
-    private boolean shouldSkipUnmanagement(Entity e) {
-        if (e==null) {
-            log.warn(""+this+" call to unmanage null entity; skipping",  
-                new IllegalStateException("source of null unmanagement call to "+this));
-            return true;
-        }
-        if (!isManaged(e)) {
-            log.warn("{} call to stop management of unknown entity (already unmanaged?) {}; skipping, and all descendants", this, e);
-            return true;
-        }
-        return false;
-    }
-    
-    private Entity toProxyEntityIfAvailable(Entity e) {
-        checkNotNull(e, "entity");
-        
-        if (e instanceof EntityProxy) {
-            return e;
-        } else if (e instanceof AbstractEntity) {
-            Entity result = ((AbstractEntity)e).getProxy();
-            return (result == null) ? e : result;
-        } else {
-            // If we don't already know about the proxy, then use the real thing; presumably it's 
-            // the legacy way of creating the entity so didn't get a preManage() call
-
-            return e;
-        }
-    }
-    
-    private Entity toRealEntity(Entity e) {
-        checkNotNull(e, "entity");
-        
-        if (e instanceof AbstractEntity) {
-            return e;
-        } else {
-            Entity result = toRealEntityOrNull(e.getId());
-            if (result == null) {
-                throw new IllegalStateException("No concrete entity known for entity "+e+" ("+e.getId()+", "+e.getEntityType().getName()+")");
-            }
-            return result;
-        }
-    }
-
-    public boolean isKnownEntityId(String id) {
-        return entitiesById.containsKey(id) || preManagedEntitiesById.containsKey(id) || preRegisteredEntitiesById.containsKey(id);
-    }
-    
-    private Entity toRealEntityOrNull(String id) {
-        Entity result;
-        // prefer the preRegistered and preManaged entities, during hot proxying, they should be newer
-        result = preRegisteredEntitiesById.get(id);
-        if (result==null)
-            result = preManagedEntitiesById.get(id);
-        if (result==null)
-            entitiesById.get(id);
-        return result;
-    }
-    
-    private boolean isRunning() {
-        return managementContext.isRunning();
-    }
-
-}


[29/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssemblyInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssemblyInstantiator.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssemblyInstantiator.java
deleted file mode 100644
index 91dfb0e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssemblyInstantiator.java
+++ /dev/null
@@ -1,96 +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.brooklyn.test.lite;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-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.mgmt.HasBrooklynManagementContext;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import com.google.common.collect.ImmutableList;
-
-/** simple illustrative instantiator which always makes a {@link TestApplication}, populated with {@link TestEntity} children,
- * all setting {@link TestEntity#CONF_NAME} for the name in the plan and in the service specs
- * <p>
- * the "real" instantiator for brooklyn is in brooklyn-camp project, not visible here, so let's have something we can test */
-public class TestAppAssemblyInstantiator extends BasicAssemblyTemplateInstantiator implements AssemblyTemplateSpecInstantiator {
-
-    @Override
-    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
-        if (!(platform instanceof HasBrooklynManagementContext)) {
-            throw new IllegalStateException("Instantiator can only be used with CAMP platforms with a Brooklyn management context");
-        }
-        ManagementContext mgmt = ((HasBrooklynManagementContext)platform).getBrooklynManagementContext();
-        
-        TestApplication app = (TestApplication) mgmt.getEntityManager().createEntity( createApplicationSpec(template, platform, null, MutableSet.<String>of()) );
-
-        return new TestAppAssembly(app);
-    }
-
-    @Override
-    public EntitySpec<? extends Application> createApplicationSpec(AssemblyTemplate template, CampPlatform platform,
-        BrooklynClassLoadingContext loader, Set<String> encounteredCatalogTypes) {
-        EntitySpec<TestApplication> app = EntitySpec.create(TestApplication.class)
-            .configure(TestEntity.CONF_NAME, template.getName())
-            .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", template.getType(), "desc", template.getDescription()));
-        applyBrooklynConfig(template, app);
-        
-        for (ResolvableLink<PlatformComponentTemplate> t: template.getPlatformComponentTemplates().links()) {
-            EntitySpec<TestEntity> spec = EntitySpec.create(TestEntity.class)
-                .configure(TestEntity.CONF_NAME, t.getName())
-                .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", t.resolve().getType(), "desc", t.resolve().getDescription()));
-            applyBrooklynConfig(t.resolve(), app);
-            app.child(spec);
-        }
-        
-        return app;
-    }
-
-    @SuppressWarnings("rawtypes")
-    private void applyBrooklynConfig(AbstractResource template, EntitySpec<TestApplication> app) {
-        Object bc = template.getCustomAttributes().get("brooklyn.config");
-        if (bc instanceof Map)
-            app.configure(ConfigBag.newInstance().putAll((Map)bc).getAllConfigAsConfigKeyMap());
-    }
-
-    @Override
-    public List<EntitySpec<?>> createServiceSpecs(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes) {
-        EntitySpec<?> createApplicationSpec = createApplicationSpec(template, platform, itemLoader, encounteredCatalogTypes);
-        return ImmutableList.<EntitySpec<?>>of(createApplicationSpec);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/EmptySoftwareProcessWithPassword.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/EmptySoftwareProcessWithPassword.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/EmptySoftwareProcessWithPassword.yaml
deleted file mode 100644
index abb301d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/EmptySoftwareProcessWithPassword.yaml
+++ /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.
-#
-
-name: example-with-CreatePasswordSensor
-description: |
-  Creates an emptyService and then attaches a password to it
-origin: https://github.com/apache/incubator-brooklyn
-location: localhost
-services:
-- type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
-  brooklyn.initializers:
-  - type: org.apache.brooklyn.core.sensor.password.CreatePasswordSensor
-    brooklyn.config:
-      name: test.password.1
-      password.length: 15
-  - type: org.apache.brooklyn.core.sensor.password.CreatePasswordSensor
-    brooklyn.config:
-      name: test.password.2
-      password.chars: abc
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/META-INF/services/org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/META-INF/services/org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver b/brooklyn-server/camp/camp-brooklyn/src/test/resources/META-INF/services/org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver
deleted file mode 100644
index 3bba7fb..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/META-INF/services/org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver
+++ /dev/null
@@ -1,19 +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.
-#
-org.apache.brooklyn.camp.brooklyn.spi.creation.service.TestServiceTypeResolver
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/example-with-function.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/example-with-function.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/example-with-function.yaml
deleted file mode 100644
index 918db2b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/example-with-function.yaml
+++ /dev/null
@@ -1,34 +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: example-with-function
-description: |
-  Tests a variety of simple functional expressions
-origin: https://github.com/apache/incubator-brooklyn
-location: localhost
-services:
-- serviceType: org.apache.brooklyn.entity.webapp.jboss.JBoss7Server
-  brooklyn.config:
-    # test the various ways to use literals, either a function
-    literalValue1: '$brooklyn:literal("$brooklyn: is a fun place")' 
-    literalValue2: "$brooklyn:literal(\"$brooklyn: is a fun place\")" 
-    literalValue3: >
-      $brooklyn:literal("$brooklyn: is a fun place")
-    literalValue4: "$brooklyn:formatString(\"%s: is a fun place\", \"$brooklyn\")" 
-    # function whose value is used as a key
-    $brooklyn:literal("$brooklyn:1"): key to the city 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function-2.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function-2.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function-2.yaml
deleted file mode 100644
index 1f02444..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function-2.yaml
+++ /dev/null
@@ -1,41 +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: java-cluster-db-example
-location: localhost
-services:
-- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
-  name: My Web
-  brooklyn.config:
-    wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0-M2/brooklyn-example-hello-world-sql-webapp-0.6.0-M2.war
-    http.port: 9280+
-    proxy.http.port: 9210+
-    java.sysprops: 
-      brooklyn.example.db.url: 
-        # alternate syntax
-        $brooklyn:formatString:
-        - jdbc:%s%s?user=%s\&password=%s
-        - $brooklyn:component("db").attributeWhenReady("datastore.url")
-        - visitors
-        - brooklyn
-        - br00k11n
-- serviceType: org.apache.brooklyn.entity.database.mysql.MySqlNode
-  name: My DB
-  id: db
-  brooklyn.config:
-    datastore.creation.script.url: classpath://visitors-creation-script.sql

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function.yaml
deleted file mode 100644
index 0f15729..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/java-web-app-and-db-with-function.yaml
+++ /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.
-#
-name: java-cluster-db-example
-services:
-- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
-  name: My Web
-  location: localhost
-  brooklyn.config:
-    wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.7.0-M1/brooklyn-example-hello-world-sql-webapp-0.7.0-M1.war
-    http.port: 9280+
-    proxy.http.port: 9210+
-    java.sysprops: 
-      brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s&password=%s",
-         component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n")
-- serviceType: org.apache.brooklyn.entity.database.mysql.MySqlNode
-  id: db
-  name: My DB
-  location: localhost
-  brooklyn.config:
-    datastore.creation.script.url: classpath://visitors-creation-script.sql

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/mysql-chef.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/mysql-chef.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/mysql-chef.yaml
deleted file mode 100644
index 36fdeb2..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/mysql-chef.yaml
+++ /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.
-#
-name: chef-mysql-sample
-services:
-- type: chef:mysql
-  id: db
-  
-  cookbook_urls:
-    # only needed for chef solo; URL can be local to brooklyn, or github, etc...
-    mysql: https://github.com/opscode-cookbooks/mysql/archive/v4.0.12.tar.gz
-    openssl: https://github.com/opscode-cookbooks/openssl/archive/v1.1.0.tar.gz
-    build-essential: https://github.com/opscode-cookbooks/build-essential/archive/v1.4.4.tar.gz
-    # NB: this also supports new style community url links, assuming TGZ and directory name,
-    # (eg https://community.opscode.com/cookbooks/mysql/download) but github versioned links
-    # are recommended because they point to a specific released version and explicit archive type
-  
-  launch_run_list: [ "mysql::server" ]
-  launch_attributes:
-    mysql:
-      # these attrs are required by the mysql cookbook under node['mysql']
-      server_root_password: $brooklyn:component("db").config("mysql.password")
-      server_repl_password: $brooklyn:component("db").config("mysql.password")
-      server_debian_password: $brooklyn:component("db").config("mysql.password")
-      # many others are attrs are supported by the cookbook and can be passed here...
-      
-  # how to determine if the process is running and how to kill it
-  # (supported options are `service_name` and `pid_file`; normally you should just pick one.
-  # here we use the pid_file because the service_name varies, mysql on centos, mysqld on ubuntu!)
-  #service_name: mysqld
-  pid_file: /var/run/mysqld/mysqld.pid
-    
-brooklyn.config:
-  mysql.password: p4ssw0rd

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entities-osgi-catalog-scan.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entities-osgi-catalog-scan.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entities-osgi-catalog-scan.yaml
deleted file mode 100644
index 1a79465..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entities-osgi-catalog-scan.yaml
+++ /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.
-#
-
-# test case which demonstrates osgi bundles can be scanned, *if* expand classpath is true
-
-brooklyn.catalog:
-  items:
-  - scanJavaAnnotations: true
-    version: 2.0.test_java
-    libraries:
-    - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
-    - classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar
-  - item:
-      id: more-entity
-      type: org.apache.brooklyn.test.osgi.entities.more.MoreEntity
-      version: 2.0.test

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-called-v1-osgi-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-called-v1-osgi-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-called-v1-osgi-catalog.yaml
deleted file mode 100644
index 20e56eb..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-called-v1-osgi-catalog.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.
-#
-services:
-- type: org.apache.brooklyn.test.osgi.entities.more.MoreEntity
-
-brooklyn.catalog:
-  id: more-entity-v1
-  version: 1.0
-  # see OsgiTestResources
-  libraries:
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-osgi-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-osgi-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-osgi-catalog.yaml
deleted file mode 100644
index 6a3ecd6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-osgi-catalog.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.
-#
-services:
-- type: org.apache.brooklyn.test.osgi.entities.more.MoreEntity
-
-brooklyn.catalog:
-  id: more-entity
-  version: 1.0
-  # see OsgiTestResources
-  libraries:
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-with-policy-osgi-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-with-policy-osgi-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-with-policy-osgi-catalog.yaml
deleted file mode 100644
index 2de00d8..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v1-with-policy-osgi-catalog.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.
-#
-services:
-- type: org.apache.brooklyn.test.osgi.entities.more.MoreEntity
-  brooklyn.policies:
-  - type: simple-policy:1.0
-
-brooklyn.catalog:
-  id: more-entity
-  version: 1.0
-  # see OsgiTestResources
-  libraries:
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v2-osgi-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v2-osgi-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v2-osgi-catalog.yaml
deleted file mode 100644
index 8033d03..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-entity-v2-osgi-catalog.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.
-#
-services:
-- type: org.apache.brooklyn.test.osgi.entities.more.MoreEntity
-
-brooklyn.catalog:
-  id: more-entity
-  version: 1.0
-  # see OsgiTestResources
-  libraries:
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-policies-osgi-catalog-scan.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-policies-osgi-catalog-scan.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-policies-osgi-catalog-scan.yaml
deleted file mode 100644
index 02002e3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/more-policies-osgi-catalog-scan.yaml
+++ /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.
-#
-
-# test case which demonstrates osgi bundles can be scanned, *if* expand classpath is true
-
-brooklyn.catalog:
-  items:
-  - scanJavaAnnotations: true
-    version: 2.0.test_java
-    libraries:
-    - classpath:/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
-    - classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar
-  - item:
-      id: more-policy
-      type: org.apache.brooklyn.test.osgi.entities.more.MorePolicy
-      version: 2.0.test

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/simple-policy-osgi-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/simple-policy-osgi-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/simple-policy-osgi-catalog.yaml
deleted file mode 100644
index 01a5db7..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/catalog/simple-policy-osgi-catalog.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.
-#
-brooklyn.policies:
-- type: org.apache.brooklyn.test.osgi.entities.SimplePolicy
-
-brooklyn.catalog:
-  id: simple-policy
-  version: 1.0
-  # see OsgiTestResources
-  libraries:
-  - classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoArg.bat
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoArg.bat b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoArg.bat
deleted file mode 100644
index dd77ba6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoArg.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM     http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-@ECHO OFF
-echo %1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat
deleted file mode 100644
index 33f7b7e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM     http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-echo ${config['myarg']}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1 b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1
deleted file mode 100644
index c2535ea..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1
+++ /dev/null
@@ -1,18 +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.
-
-Write-Host ${config['myarg']}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1 b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1
deleted file mode 100644
index 3a2d33d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1
+++ /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.
-
-param(
-  [string]$myarg
-)
-
-Write-Host $myarg 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.bat
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.bat b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.bat
deleted file mode 100644
index 2a926b6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM     http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-EXIT /B 0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.ps1
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.ps1 b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.ps1
deleted file mode 100644
index fe0e1f1..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit0.ps1
+++ /dev/null
@@ -1,18 +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.
-
-exit 0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.bat
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.bat b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.bat
deleted file mode 100644
index f8b79b9..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM     http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-EXIT /B 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.ps1
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.ps1 b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.ps1
deleted file mode 100644
index a7fc049..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/exit1.ps1
+++ /dev/null
@@ -1,19 +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.
-
-Write-Host single line file gives exit code 0 from PyWinRM
-exit 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/test/lite/test-app-service-blueprint.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/test/lite/test-app-service-blueprint.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/test/lite/test-app-service-blueprint.yaml
deleted file mode 100644
index c0bb607..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/org/apache/brooklyn/camp/brooklyn/test/lite/test-app-service-blueprint.yaml
+++ /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.
-#
-name: sample
-description: Tomcat sample JSP and servlet application.
-origin: http://www.oracle.com/nCAMP/Hand
-services:
-  -
-    type: io.camp.mock:AppServer
-    name: Hello WAR
-    wars:
-        /: hello.war
-    controller.spec:
-        port: 80
-
-brooklyn.catalog:
-  name: catalog-name
-  type: io.camp.mock.MyApplication
-  version: 0.9
-  libraries:
-  - name: org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-entities
-    version: 0.1.0
-    url: classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/osgi-catalog.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/osgi-catalog.xml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/osgi-catalog.xml
deleted file mode 100644
index 0586f3b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/osgi-catalog.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-
-<catalog>
-    <name>OSGi catalogue</name>
-    <template name="Osgi App" type="org.apache.brooklyn.test.osgi.entities.SimpleApplication">
-        <symbolicName>OsgiApp</symbolicName>
-        <libraries>
-            <bundle>${osgi-entities-path}</bundle>
-        </libraries>
-    </template>
-</catalog>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/postgresql-chef.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/postgresql-chef.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/postgresql-chef.yaml
deleted file mode 100644
index 4c6694e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/postgresql-chef.yaml
+++ /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.
-#
-name: postgresql-chef
-location: localhost
-services:
-- type: ChefComponent
-  pid.file: /var/run/postgresql/*.pid
-  service: postgresql
-  chef:
-    converge:
-    - postgresql::server
-    attributes:
-      postgresql:
-        config:
-          port: 5432
-          listen_addresses: *
-        pg_hba:
-        - type: host
-          db: all
-          user: all
-          addr: 0.0.0.0/0
-          method: md5

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/same-server-entity-test.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/same-server-entity-test.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/same-server-entity-test.yaml
deleted file mode 100644
index 9e9a768..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/same-server-entity-test.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.
-#
-name: SameServerEntityYamlTest
-location: localhost
-services:
-- serviceType: org.apache.brooklyn.entity.software.base.SameServerEntity
-  name: Entities
-  brooklyn.children:
-  - serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-    name: a
-  - serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-    name: b
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/simple-catalog.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/simple-catalog.xml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/simple-catalog.xml
deleted file mode 100644
index 8b73ffa..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/simple-catalog.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-
-<catalog>
-    <name>Simple catalogue</name>
-    <template name="Basic App" type="org.apache.brooklyn.entity.stock.BasicApplication" />
-    <template name="Basic App" type="org.apache.brooklyn.entity.stock.BasicApplication" version="2.0" />
-    <template name="Basic App" type="org.apache.brooklyn.entity.stock.BasicApplication">
-        <symbolicName>BasicApp</symbolicName>
-    </template>
-    <template name="Basic App" type="org.apache.brooklyn.entity.stock.BasicApplication" version="2.0">
-        <symbolicName>BasicApp</symbolicName>
-    </template>
-    <template name="Custom App" type="org.apache.brooklyn.entity.stock.BasicApplication">
-        <symbolicName>org.apache.brooklyn.camp.brooklyn.catalog.TestBasicApp</symbolicName>
-        <!-- Tests that "java:" prefix won't load an old-style catalog item with the same id -->
-    </template>
-    <template name="Osgi App" type="org.apache.brooklyn.test.osgi.entities.SimpleApplication">
-        <symbolicName>OsgiApp</symbolicName>
-        <libraries>
-            <bundle>${osgi-entities-path}</bundle>
-        </libraries>
-    </template>
-    <catalog>
-        <template name="Simple App" type="org.apache.brooklyn.test.osgi.entities.SimpleApplication" />
-        <classpath>
-            <entry>${osgi-entities-path}</entry>
-        </classpath>
-    </catalog>
-</catalog>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-enricher.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-enricher.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-enricher.yaml
deleted file mode 100644
index 6760410..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-enricher.yaml
+++ /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.
-#
-name: test-app-with-enricher
-description: TestEntity with Enricher at application-level using Brooklyn
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- type: org.apache.brooklyn.entity.stock.BasicEntity
-  id: be1
-  name: testentity
-  brooklyn.config:
-    serviceLiteralValue1: Foo
-    serviceLiteralValue2: Bar
-brooklyn.enrichers:
-- type: org.apache.brooklyn.core.test.policy.TestEnricher
-  brooklyn.config:
-    test.targetEntity: $brooklyn:component("be1")
-    test.targetEntity.from.flag: $brooklyn:component("be1")
-    enricherLiteralValue1: Hello
-    enricherLiteralValue2: World
-    test.confName: Name from YAML
-    test.confFromFunction:  "$brooklyn:formatString(\"%s: is a fun place\", \"$brooklyn\")" 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-policy.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-policy.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-policy.yaml
deleted file mode 100644
index 2ac75ee..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-app-with-policy.yaml
+++ /dev/null
@@ -1,34 +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: test-app-with-policy
-description: TestEntity with Policy at application-level using Brooklyn
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-  name: testentity
-  brooklyn.config:
-    serviceLiteralValue1: Foo
-    serviceLiteralValue2: Bar
-brooklyn.policies:
-- policyType: org.apache.brooklyn.core.test.policy.TestPolicy
-  brooklyn.config:
-    policyLiteralValue1: Hello
-    policyLiteralValue2: World
-    test.confName: Name from YAML
-    test.confFromFunction:  "$brooklyn:formatString(\"%s: is a fun place\", \"$brooklyn\")" 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-cluster-with-member-spec.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-cluster-with-member-spec.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-cluster-with-member-spec.yaml
deleted file mode 100644
index 69bace1..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-cluster-with-member-spec.yaml
+++ /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.
-#
-name: test-app-with-enricher
-description: Cluster of TestEntitys with member spec
-origin: https://github.com/apache/incubator-brooklyn
-location: localhost
-services:
-- type: org.apache.brooklyn.entity.group.DynamicCluster
-  id: test-entity-cluster
-  name: TestEntityCluster
-  initialSize: 2
-  memberSpec:
-    $brooklyn:entitySpec:
-      type: org.apache.brooklyn.core.test.entity.TestEntity
-      brooklyn.config:
-        test.confName: yamlTest

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-basic-template.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-basic-template.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-basic-template.yaml
deleted file mode 100644
index 7ace993..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-basic-template.yaml
+++ /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.
-#
-name: test-entity-basic-template
-description: TestEntity with templated brooklyn.config and additional config (such as services)
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- type: org.apache.brooklyn.core.test.entity.TestEntity
-  name: testentity
-# should have nothing below here as the test appends things underneath

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-reference-map-template.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-reference-map-template.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-reference-map-template.yaml
deleted file mode 100644
index c6f7b4d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-reference-map-template.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.
-#
-name: test-entity-reference-map-template
-description: TestEntity with templated brooklyn.config and additional config (such as services)
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-  id: one
-- serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-  id: two
-- serviceType: org.apache.brooklyn.core.test.entity.TestEntity
-  name: testentity
-# should have nothing below here as the test appends things underneath

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-enricher.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-enricher.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-enricher.yaml
deleted file mode 100644
index 6b1061e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-enricher.yaml
+++ /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.
-#
-name: test-entity-with-enricher
-description: TestEntity with Enricher at entity-level using Brooklyn
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-  name: testentity
-  foo: bar
-  brooklyn.config:
-    serviceLiteralValue1: Foo
-    serviceLiteralValue2: Bar
-  brooklyn.enrichers:
-  - enricherType: org.apache.brooklyn.core.test.policy.TestEnricher
-    brooklyn.config:
-      enricherLiteralValue1: Hello
-      enricherLiteralValue2: World
-      test.confName: Name from YAML
-      test.confFromFunction:  "$brooklyn:formatString(\"%s: is a fun place\", \"$brooklyn\")"
-      test.attributeSensor: $brooklyn:sensor("org.apache.brooklyn.core.test.entity.TestEntity", "test.name")

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-init-config.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-init-config.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-init-config.yaml
deleted file mode 100644
index 006350d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-init-config.yaml
+++ /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.
-#
-name: test-entity-with-init-config
-description: Creates a TestEntityWithInitConfig entity that references a 2nd test entity during its init()
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.core.test.entity.TestEntity
-  id: te1
-  name: testentity
-  brooklyn.config:
-    test.name: Name of the test entity
-- serviceType: org.apache.brooklyn.camp.brooklyn.TestEntityWithInitConfig 
-  name: testentity with init config
-  brooklyn.config:
-    test.entity: $brooklyn:component("te1") # This entity will be accessed in TestEntityWithInitConfig.init()

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-policy.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-policy.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-policy.yaml
deleted file mode 100644
index b93f521..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-entity-with-policy.yaml
+++ /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.
-#
-name: test-entity-with-policy
-description: TestEntity with Policy at entity-level using Brooklyn
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.entity.stock.BasicEntity
-  name: testentity
-  foo: bar
-  brooklyn.config:
-    serviceLiteralValue1: Foo
-    serviceLiteralValue2: Bar
-  brooklyn.policies:
-  - policyType: org.apache.brooklyn.core.test.policy.TestPolicy
-    brooklyn.config:
-      policyLiteralValue1: Hello
-      policyLiteralValue2: World
-      test.confName: Name from YAML
-      test.confFromFunction:  "$brooklyn:formatString(\"%s: is a fun place\", \"$brooklyn\")"
-      test.attributeSensor: $brooklyn:sensor("org.apache.brooklyn.core.test.entity.TestEntity", "test.name")

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-java-web-app-spec-and-db-with-function.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-java-web-app-spec-and-db-with-function.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-java-web-app-spec-and-db-with-function.yaml
deleted file mode 100644
index f51f4d7..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-java-web-app-spec-and-db-with-function.yaml
+++ /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.
-#
-name: java-cluster-db-example
-location: localhost
-services:
-- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
-  name: My Web
-  brooklyn.config:
-    proxy.http.port: 9210+
-    http.port: 9280+
-  memberSpec:
-    $brooklyn:entitySpec:
-      type: org.apache.brooklyn.entity.webapp.jboss.JBoss7Server
-      brooklyn.config:
-        wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
-        java.sysprops: 
-          brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s",
-             component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n")
-- serviceType: org.apache.brooklyn.entity.database.mysql.MySqlNode
-  id: db
-  name: My DB
-  brooklyn.config:
-    datastore.creation.script.url: classpath://visitors-creation-script.sql

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-propagating-enricher.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-propagating-enricher.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-propagating-enricher.yaml
deleted file mode 100644
index 1973851..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-propagating-enricher.yaml
+++ /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.
-#
-name: test-propagating-enricher
-description: TestEntity with Propagating Enricher at application-level using Brooklyn
-origin: https://github.com/apache/incubator-brooklyn
-services:
-- serviceType: org.apache.brooklyn.core.test.entity.TestEntity
-  id: te1
-  name: testentity
-  brooklyn.config:
-    test.confName: Name from YAML
-brooklyn.enrichers:
-- enricherType: org.apache.brooklyn.enricher.stock.Propagator
-  brooklyn.config:
-    enricher.producer: $brooklyn:component("te1")
-    enricher.propagating.propagatingAll: true

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-enrichers.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-enrichers.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-enrichers.yaml
deleted file mode 100644
index f1d6a24..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-enrichers.yaml
+++ /dev/null
@@ -1,133 +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.
-#
-# Creates an application with the following structure, with each entity (including the application) having 
-# an enricher with references to all other entities (including itself and the app) via config keys
-#
-#                              app
-#                         (app enricher)
-#                               |
-#                        -------|-------
-#                        |             |
-#                     entity1       entity2
-#                  (e1 enricher) (e2 enricher)
-#                        |
-#                 -------|-------
-#                 |             |
-#               child1        child2
-#            (c1 enricher) (c2 enricher)
-#                 |
-#          -------|-------
-#          |             |
-#       gchild1       gchild2
-#    (g1 enricher) (g2 enricher) 
-name: test-referencing-enrichers
-description: Test multi-layer application with each entity having an enricher referencing all other entities
-origin: https://github.com/apache/incubator-brooklyn
-id: app1
-brooklyn.enrichers:
-  - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
-services:
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e1
-  name: entity 1
-  brooklyn.enrichers:
-  - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
-  brooklyn.children:
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c1
-      name: child 1
-      brooklyn.enrichers:
-      - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-        brooklyn.config:
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2")
-      brooklyn.children:
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc1
-        name: grandchild 1
-        brooklyn.enrichers:
-        - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-          brooklyn.config:
-            test.reference.app: $brooklyn:component("app1")
-            test.reference.entity1: $brooklyn:component("e1")
-            test.reference.entity2: $brooklyn:component("e2")
-            test.reference.child1: $brooklyn:component("c1")
-            test.reference.child2: $brooklyn:component("c2")
-            test.reference.grandchild1: $brooklyn:component("gc1")
-            test.reference.grandchild2: $brooklyn:component("gc2")
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc2
-        name: grandchild 2
-        brooklyn.enrichers:
-        - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-          brooklyn.config:
-            test.reference.app: $brooklyn:component("app1")
-            test.reference.entity1: $brooklyn:component("e1")
-            test.reference.entity2: $brooklyn:component("e2")
-            test.reference.child1: $brooklyn:component("c1")
-            test.reference.child2: $brooklyn:component("c2")
-            test.reference.grandchild1: $brooklyn:component("gc1")
-            test.reference.grandchild2: $brooklyn:component("gc2") 
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c2
-      name: child 2
-      brooklyn.enrichers:
-      - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-        brooklyn.config:
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2")
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e2
-  name: entity 2
-  brooklyn.enrichers:
-  - enricherType: org.apache.brooklyn.camp.brooklyn.TestReferencingEnricher
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-entities.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-entities.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-entities.yaml
deleted file mode 100644
index c87a8de..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-entities.yaml
+++ /dev/null
@@ -1,136 +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.
-#
-# Creates an application with the following structure, with each entity (including the application) having 
-# references to all other entities (including itself and the app) via config keys
-#
-#                        app
-#                         |
-#                    -----|-----
-#                    |         |
-#                 entity1   entity2
-#                    |
-#               -----|-----
-#               |         |
-#             child1     child2
-#               |
-#          -----|-----
-#          |         |
-#       gchild1   gchild2       
-name: test-referencing-entities
-description: Test multi-layer application with each entity referencing all other entities
-origin: https://github.com/apache/incubator-brooklyn
-id: app1
-brooklyn.config:
-  test.reference.root: $brooklyn:root()
-  test.reference.scope_root: $brooklyn:scopeRoot()
-  test.reference.app: $brooklyn:component("app1")
-  test.reference.entity1: $brooklyn:entity("e1")
-  test.reference.entity1a: $brooklyn:config("test.reference.entity1")
-  test.reference.entity2: $brooklyn:component("e2")
-  test.reference.child1: $brooklyn:component("c1")
-  test.reference.child2: $brooklyn:component("c2")
-  test.reference.grandchild1: $brooklyn:component("gc1")
-  test.reference.grandchild2: $brooklyn:component("gc2")
-  test.reference.bogus: $brooklyn:child("c1")
-services:
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e1
-  name: entity 1
-  brooklyn.config:
-    test.reference.root: $brooklyn:root()
-    test.reference.scope_root: $brooklyn:scopeRoot()
-    test.reference.app: $brooklyn:component("parent", "ignored")
-    test.reference.entity1: $brooklyn:component("this", "ignored")
-    test.reference.entity1a: $brooklyn:ancestor("app1").child("e1")
-    test.reference.entity2: $brooklyn:component("e2")
-    test.reference.child1: $brooklyn:component("child", "c1")
-    test.reference.child2: $brooklyn:component("c2")
-    test.reference.grandchild1: $brooklyn:component("gc1")
-    test.reference.grandchild2: $brooklyn:component("gc2")
-    test.reference.bogus: $brooklyn:descendant("app1")
-  brooklyn.children:
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c1
-      name: child 1
-      brooklyn.config:
-        self: $brooklyn:entity("c1")
-        test.reference.root: $brooklyn:root()
-        test.reference.scope_root: $brooklyn:scopeRoot()
-        test.reference.app: $brooklyn:parent().parent()
-        test.reference.entity1: $brooklyn:parent()
-        test.reference.entity1a: $brooklyn:entity("e1").parent().child("e1")
-        test.reference.entity2: $brooklyn:component("e2")
-        test.reference.child1: $brooklyn:config("self")
-        test.reference.child2: $brooklyn:component("c2")
-        test.reference.grandchild1: $brooklyn:component("gc1")
-        test.reference.grandchild2: $brooklyn:component("gc2")
-        test.reference.bogus: $brooklyn:component("bogus")
-      brooklyn.children:
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc1
-        name: grandchild 1
-        brooklyn.config:
-          test.reference.root: $brooklyn:root()
-          test.reference.scope_root: $brooklyn:scopeRoot()
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2")
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc2
-        name: grandchild 2
-        brooklyn.config:
-          test.reference.root: $brooklyn:root()
-          test.reference.scope_root: $brooklyn:scopeRoot()
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2") 
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c2
-      name: child 2
-      brooklyn.config:
-        test.reference.root: $brooklyn:root()
-        test.reference.scope_root: $brooklyn:scopeRoot()
-        test.reference.app: $brooklyn:parent().parent().descendant("app1")
-        test.reference.entity1: $brooklyn:component("e1")
-        test.reference.entity2: $brooklyn:component("e2")
-        test.reference.child1: $brooklyn:component("c1")
-        test.reference.child2: $brooklyn:component("c2")
-        test.reference.grandchild1: $brooklyn:component("gc1")
-        test.reference.grandchild2: $brooklyn:component("gc2")
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e2
-  name: entity 2
-  brooklyn.config:
-    test.reference.root: $brooklyn:root()
-    test.reference.scope_root: $brooklyn:scopeRoot()
-    test.reference.app: $brooklyn:component("app1")
-    test.reference.entity1: $brooklyn:component("e1")
-    test.reference.entity2: $brooklyn:component("e2")
-    test.reference.child1: $brooklyn:component("c1")
-    test.reference.child2: $brooklyn:component("c2")
-    test.reference.grandchild1: $brooklyn:component("gc1")
-    test.reference.grandchild2: $brooklyn:component("gc2")
\ No newline at end of file


[07/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/EntityManagementUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/EntityManagementUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/EntityManagementUtils.java
deleted file mode 100644
index 2f37e7c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/EntityManagementUtils.java
+++ /dev/null
@@ -1,332 +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.core.mgmt;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityFunctions;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.TaskBuilder;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.util.concurrent.Runnables;
-
-/** Utility methods for working with entities and applications */
-public class EntityManagementUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(EntityManagementUtils.class);
-
-    /**
-     * A marker config value which indicates that an {@link Application} entity was created automatically,
-     * needed because a plan might give multiple top-level entities or a non-Application top-level entity,
-     * in a context where Brooklyn requires an {@link Application} at the root.
-     * <p>
-     * Typically when such a wrapper app wraps another {@link Application}
-     * (or where we are looking for a single {@link Entity}, or a list to add, and they are so wrapped)
-     * it will be unwrapped. 
-     * See {@link #newWrapperApp()} and {@link #unwrapApplication(EntitySpec)}.
-     */
-    public static final ConfigKey<Boolean> WRAPPER_APP_MARKER = ConfigKeys.newBooleanConfigKey("brooklyn.wrapper_app");
-
-    /** creates an application from the given app spec, managed by the given management context */
-    public static <T extends Application> T createUnstarted(ManagementContext mgmt, EntitySpec<T> spec) {
-        T app = mgmt.getEntityManager().createEntity(spec);
-        return app;
-    }
-
-    /** as {@link #createUnstarted(ManagementContext, EntitySpec)} but for a string plan (e.g. camp yaml) */
-    public static Application createUnstarted(ManagementContext mgmt, String plan) {
-        EntitySpec<? extends Application> spec = createEntitySpecForApplication(mgmt, plan);
-        return createUnstarted(mgmt, spec);
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static EntitySpec<? extends Application> createEntitySpecForApplication(ManagementContext mgmt, final String plan) {
-        return mgmt.getTypeRegistry().createSpecFromPlan(null, plan, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class);
-    }
-
-    @Deprecated /** @deprecated since 0.9.0; use {@link BrooklynTypeRegistry#createSpec(RegisteredType, org.apache.brooklyn.api.typereg.RegisteredTypeConstraint, Class)} */
-    // not used in Brooklyn
-    public static <T,SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec(ManagementContext mgmt, CatalogItem<T, SpecT> item) {
-        return createCatalogSpec(mgmt, item, ImmutableSet.<String>of());
-    }
-
-    @Deprecated /** @deprecated since 0.9.0; use {@link BrooklynTypeRegistry#createSpec(RegisteredType, org.apache.brooklyn.api.typereg.RegisteredTypeConstraint, Class)} */
-    // not used in Brooklyn
-    public static <T,SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec(ManagementContext mgmt, final CatalogItem<T, SpecT> item, final Set<String> encounteredTypes) {
-        return BasicBrooklynCatalog.internalCreateSpecLegacy(mgmt, item, encounteredTypes, true);
-    }
-
-    /** container for operation which creates something and which wants to return both
-     * the items created and any pending create/start task */
-    public static class CreationResult<T,U> {
-        private final T thing;
-        @Nullable private final Task<U> task;
-        public CreationResult(T thing, Task<U> task) {
-            super();
-            this.thing = thing;
-            this.task = task;
-        }
-        
-        protected static <T,U> CreationResult<T,U> of(T thing, @Nullable Task<U> task) {
-            return new CreationResult<T,U>(thing, task);
-        }
-        
-        /** returns the thing/things created */
-        @Nullable public T get() { return thing; }
-        /** associated task, ie the one doing the creation/starting */
-        public Task<U> task() { return task; }
-        public CreationResult<T,U> blockUntilComplete(Duration timeout) { if (task!=null) task.blockUntilEnded(timeout); return this; }
-        public CreationResult<T,U> blockUntilComplete() { if (task!=null) task.blockUntilEnded(); return this; }
-    }
-
-    public static <T extends Application> CreationResult<T,Void> createStarting(ManagementContext mgmt, EntitySpec<T> appSpec) {
-        return start(createUnstarted(mgmt, appSpec));
-    }
-
-    public static CreationResult<? extends Application,Void> createStarting(ManagementContext mgmt, String appSpec) {
-        return start(createUnstarted(mgmt, appSpec));
-    }
-
-    public static <T extends Application> CreationResult<T,Void> start(T app) {
-        Task<Void> task = Entities.invokeEffector(app, app, Startable.START,
-            // locations already set in the entities themselves;
-            // TODO make it so that this arg does not have to be supplied to START !
-            MutableMap.of("locations", MutableList.of()));
-        return CreationResult.of(app, task);
-    }
-    
-    public static CreationResult<List<Entity>, List<String>> addChildren(final Entity parent, String yaml, Boolean start) {
-        if (Boolean.FALSE.equals(start))
-            return CreationResult.of(addChildrenUnstarted(parent, yaml), null);
-        return addChildrenStarting(parent, yaml);
-    }
-    
-    /** adds entities from the given yaml, under the given parent; but does not start them */
-    public static List<Entity> addChildrenUnstarted(final Entity parent, String yaml) {
-        log.debug("Creating child of "+parent+" from yaml:\n{}", yaml);
-
-        ManagementContext mgmt = parent.getApplication().getManagementContext();
-
-        EntitySpec<? extends Application> specA = createEntitySpecForApplication(mgmt, yaml);
-
-        // see whether we can promote children
-        List<EntitySpec<?>> specs = MutableList.of();
-        if (!canUnwrapEntity(specA)) {
-            // if not promoting, set a nice name if needed
-            if (Strings.isEmpty(specA.getDisplayName())) {
-                int size = specA.getChildren().size();
-                String childrenCountString = size+" "+(size!=1 ? "children" : "child");
-                specA.displayName("Dynamically added "+childrenCountString);
-            }
-        }
-        
-        specs.add(unwrapEntity(specA));
-
-        final List<Entity> children = MutableList.of();
-        for (EntitySpec<?> spec: specs) {
-            Entity child = (Entity)parent.addChild(spec);
-            children.add(child);
-        }
-
-        return children;
-    }
-
-    public static CreationResult<List<Entity>,List<String>> addChildrenStarting(final Entity parent, String yaml) {
-        final List<Entity> children = addChildrenUnstarted(parent, yaml);
-        String childrenCountString;
-
-        int size = children.size();
-        childrenCountString = size+" "+(size!=1 ? "children" : "child"); 
-
-        TaskBuilder<List<String>> taskM = Tasks.<List<String>>builder().displayName("add children")
-            .dynamic(true)
-            .tag(BrooklynTaskTags.NON_TRANSIENT_TASK_TAG)
-            .body(new Callable<List<String>>() {
-                @Override public List<String> call() throws Exception {
-                    return ImmutableList.copyOf(Iterables.transform(children, EntityFunctions.id()));
-                }})
-                .description("Add and start "+childrenCountString);
-
-        TaskBuilder<?> taskS = Tasks.builder().parallel(true).displayName("add (parallel)").description("Start each new entity");
-
-        // autostart if requested
-        for (Entity child: children) {
-            if (child instanceof Startable) {
-                taskS.add(Effectors.invocation(child, Startable.START, ImmutableMap.of("locations", ImmutableList.of())));
-            } else {
-                // include a task, just to give feedback in the GUI
-                taskS.add(Tasks.builder().displayName("create").description("Skipping start (not a Startable Entity)")
-                    .body(Runnables.doNothing())
-                    .tag(BrooklynTaskTags.tagForTargetEntity(child))
-                    .build());
-            }
-        }
-        taskM.add(taskS.build());
-        Task<List<String>> task = Entities.submit(parent, taskM.build());
-
-        return CreationResult.of(children, task);
-    }
-    
-    /** Unwraps a single {@link Entity} if appropriate. See {@link #WRAPPER_APP_MARKER}.
-     * Also see {@link #canUnwrapEntity(EntitySpec)} to test whether it will unwrap. */
-    public static EntitySpec<? extends Entity> unwrapEntity(EntitySpec<? extends Entity> wrapperApplication) {
-        if (!canUnwrapEntity(wrapperApplication)) {
-            return wrapperApplication;
-        }
-        EntitySpec<?> wrappedEntity = Iterables.getOnlyElement(wrapperApplication.getChildren());
-        @SuppressWarnings("unchecked")
-        EntitySpec<? extends Application> wrapperApplicationTyped = (EntitySpec<? extends Application>) wrapperApplication;
-        EntityManagementUtils.mergeWrapperParentSpecToChildEntity(wrapperApplicationTyped, wrappedEntity);
-        return wrappedEntity;
-    }
-    
-    /** Unwraps a wrapped {@link Application} if appropriate.
-     * This is like {@link #canUnwrapEntity(EntitySpec)} with an additional check that the wrapped child is an {@link Application}. 
-     * See {@link #WRAPPER_APP_MARKER} for an overview. 
-     * Also see {@link #canUnwrapApplication(EntitySpec)} to test whether it will unwrap. */
-    public static EntitySpec<? extends Application> unwrapApplication(EntitySpec<? extends Application> wrapperApplication) {
-        if (!canUnwrapApplication(wrapperApplication)) {
-            return wrapperApplication;
-        }
-        @SuppressWarnings("unchecked")
-        EntitySpec<? extends Application> wrappedApplication = (EntitySpec<? extends Application>) unwrapEntity(wrapperApplication);
-        return wrappedApplication;
-    }
-    
-    /** Modifies the child so it includes the inessential setup of its parent,
-     * for use when unwrapping specific children, but a name or other item may have been set on the parent.
-     * See {@link #WRAPPER_APP_MARKER}. */
-    private static void mergeWrapperParentSpecToChildEntity(EntitySpec<? extends Application> wrapperParent, EntitySpec<?> wrappedChild) {
-        if (Strings.isNonEmpty(wrapperParent.getDisplayName())) {
-            wrappedChild.displayName(wrapperParent.getDisplayName());
-        }
-        
-        wrappedChild.locations(wrapperParent.getLocations());
-        
-        if (!wrapperParent.getParameters().isEmpty())
-            wrappedChild.parametersReplace(wrapperParent.getParameters());
-
-        // prefer the wrapper ID (change in 2016-01); see notes on the catalogItemIdIfNotNull method
-        wrappedChild.catalogItemIdIfNotNull(wrapperParent.getCatalogItemId());
-
-        // NB: this clobber's child config wherever they conflict; might prefer to deeply merge maps etc
-        // (or maybe even prevent the merge in these cases; 
-        // not sure there is a compelling reason to have config on a pure-wrapper parent)
-        Map<ConfigKey<?>, Object> configWithoutWrapperMarker = Maps.filterKeys(wrapperParent.getConfig(), Predicates.not(Predicates.<ConfigKey<?>>equalTo(EntityManagementUtils.WRAPPER_APP_MARKER)));
-        wrappedChild.configure(configWithoutWrapperMarker);
-        wrappedChild.configure(wrapperParent.getFlags());
-        
-        // copying tags to all entities may be something the caller wants to control,
-        // e.g. if we're adding multiple, the caller might not want to copy the parent
-        // (the BrooklynTags.YAML_SPEC tag will include the parents source including siblings),
-        // but OTOH they might because otherwise the parent's tags might get lost.
-        // also if we are unwrapping multiple registry references we will get the YAML_SPEC for each;
-        // putting the parent's tags first however causes the preferred (outer) one to be retrieved first.
-        wrappedChild.tagsReplace(MutableList.copyOf(wrapperParent.getTags()).appendAll(wrappedChild.getTags()));
-    }
-
-    public static EntitySpec<? extends Application> newWrapperApp() {
-        return EntitySpec.create(BasicApplication.class).configure(WRAPPER_APP_MARKER, true);
-    }
-    
-    /** As {@link #canUnwrapEntity(EntitySpec)}
-     * but additionally requiring that the wrapped item is an {@link Application},
-     * for use when the context requires an {@link Application} ie a root of a spec.
-     * @see #WRAPPER_APP_MARKER */
-    public static boolean canUnwrapApplication(EntitySpec<? extends Application> wrapperApplication) {
-        if (!canUnwrapEntity(wrapperApplication)) return false;
-
-        EntitySpec<?> childSpec = Iterables.getOnlyElement(wrapperApplication.getChildren());
-        return (childSpec.getType()!=null && Application.class.isAssignableFrom(childSpec.getType()));
-    }
-    /** @deprecated since 0.9.0 use {@link #canUnwrapApplication(EntitySpec)} */ @Deprecated
-    public static boolean canPromoteWrappedApplication(EntitySpec<? extends Application> app) {
-        return canUnwrapApplication(app);
-    }
-    
-    /** Returns true if the spec is for a wrapper app with no important settings, wrapping a single child entity. 
-     * for use when adding from a plan specifying multiple entities but there is nothing significant at the application level,
-     * and the context would like to flatten it to remove the wrapper yielding just a single entity.
-     * (but note the result is not necessarily an {@link Application}; 
-     * see {@link #canUnwrapApplication(EntitySpec)} if that is required).
-     * <p>
-     * Note callers will normally use one of {@link #unwrapEntity(EntitySpec)} or {@link #unwrapApplication(EntitySpec)}.
-     * 
-     * @see #WRAPPER_APP_MARKER for an overview */
-    public static boolean canUnwrapEntity(EntitySpec<? extends Entity> spec) {
-        return isWrapperApp(spec) && hasSingleChild(spec) &&
-            // these "brooklyn.*" items on the app rather than the child absolutely prevent unwrapping
-            // as their semantics could well be different whether they are on the parent or the child
-            spec.getEnrichers().isEmpty() &&
-            spec.getEnricherSpecs().isEmpty() &&
-            spec.getInitializers().isEmpty() &&
-            spec.getPolicies().isEmpty() &&
-            spec.getPolicySpecs().isEmpty() &&
-            // these items prevent merge only if they are defined at both levels
-            (spec.getLocations().isEmpty() || Iterables.getOnlyElement(spec.getChildren()).getLocations().isEmpty())
-            // TODO what should we do with parameters? currently clobbers due to EntitySpec.parameters(...) behaviour.
-//            && (spec.getParameters().isEmpty() || Iterables.getOnlyElement(spec.getChildren()).getParameters().isEmpty())
-            ;
-    }
-    /** @deprecated since 0.9.0 use {@link #canUnwrapEntity(EntitySpec)} */ @Deprecated
-    public static boolean canPromoteChildrenInWrappedApplication(EntitySpec<? extends Application> spec) {
-        return canUnwrapEntity(spec);
-    }
-
-    public static boolean isWrapperApp(EntitySpec<?> spec) {
-        return Boolean.TRUE.equals(spec.getConfig().get(EntityManagementUtils.WRAPPER_APP_MARKER));
-    }
-
-    private static boolean hasSingleChild(EntitySpec<?> spec) {
-        return spec.getChildren().size() == 1;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/HasBrooklynManagementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/HasBrooklynManagementContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/HasBrooklynManagementContext.java
deleted file mode 100644
index 2048c9e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/HasBrooklynManagementContext.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 org.apache.brooklyn.core.mgmt;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-/**
- * Provides a generic way to obtain a {@link ManagementContext}, which things can implement. 
- * The intent is to reduce coupling between components by only referring to this interface.
- */
-public interface HasBrooklynManagementContext {
-
-    public ManagementContext getBrooklynManagementContext();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ManagementContextInjectable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ManagementContextInjectable.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ManagementContextInjectable.java
deleted file mode 100644
index 8d0a6a5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ManagementContextInjectable.java
+++ /dev/null
@@ -1,33 +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.core.mgmt;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-/**
- * Provides a way for the {@link ManagementContext} to be injected directly.
- */
-public interface ManagementContextInjectable {
-
-    /**
-     * Sets the {@link ManagementContext} reference.
-     */
-    public void setManagementContext(ManagementContext managementContext);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/AbstractBrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/AbstractBrooklynClassLoadingContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/AbstractBrooklynClassLoadingContext.java
deleted file mode 100644
index 8003948..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/AbstractBrooklynClassLoadingContext.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.apache.brooklyn.core.mgmt.classloading;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.base.Objects;
-
-/*
- * 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.
- */
-@SuppressWarnings("deprecation")
-public abstract class AbstractBrooklynClassLoadingContext implements BrooklynClassLoadingContext,
-    org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContext {
-
-    protected final ManagementContext mgmt;
-
-    public AbstractBrooklynClassLoadingContext(ManagementContext mgmt) {
-        this.mgmt = mgmt;
-    }
-
-    @Override
-    public ManagementContext getManagementContext() {
-        return mgmt;
-    }
-    
-    @Override
-    public Class<?> loadClass(String className) {
-        return tryLoadClass(className).get();
-    }
-
-    @Override
-    // this is the only one left for subclasses
-    public abstract Maybe<Class<?>> tryLoadClass(String className);
-
-    @Override
-    public <T> Class<? extends T> loadClass(String className, @Nullable Class<T> supertype) {
-        return tryLoadClass(className, supertype).get();
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public <T> Maybe<Class<? extends T>> tryLoadClass(String className, @Nullable Class<T> supertype) {
-        Maybe<Class<?>> result = tryLoadClass(className);
-        if (result.isAbsent()) return (Maybe)result;
-        Class<?> clazz = result.get();
-        if (supertype==null || supertype.isAssignableFrom(clazz)) return (Maybe)result;
-        throw new ClassCastException(className+" is not an instance of "+supertype);
-    }
-
-    @Override
-    public abstract String toString();
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(mgmt);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof BrooklynClassLoadingContext)) return false;
-        if (!Objects.equal(mgmt, ((BrooklynClassLoadingContext)obj).getManagementContext())) return false;
-        return true;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContext.java
deleted file mode 100644
index b6a5e50..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContext.java
+++ /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.
- */
-package org.apache.brooklyn.core.mgmt.classloading;
-
-
-/** 
- * @deprecated since 0.9.0; moved to API package; use the super-interface
- * {@link org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext}
- */
-@Deprecated
-public interface BrooklynClassLoadingContext extends org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContextSequential.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContextSequential.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContextSequential.java
deleted file mode 100644
index 530039a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/BrooklynClassLoadingContextSequential.java
+++ /dev/null
@@ -1,135 +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.core.mgmt.classloading;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public final class BrooklynClassLoadingContextSequential extends AbstractBrooklynClassLoadingContext {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynClassLoadingContextSequential.class);
-    
-    private final List<BrooklynClassLoadingContext> primaries = MutableList.<BrooklynClassLoadingContext>of();
-    // secondaries used to put java classloader last
-    private final Set<BrooklynClassLoadingContext> secondaries = MutableSet.<BrooklynClassLoadingContext>of();
-
-    public BrooklynClassLoadingContextSequential(ManagementContext mgmt, BrooklynClassLoadingContext ...targets) {
-        super(mgmt);
-        for (BrooklynClassLoadingContext target: targets)
-            add(target);
-    }
-    
-    public void add(BrooklynClassLoadingContext target) {
-        if (target instanceof BrooklynClassLoadingContextSequential) {
-            for (BrooklynClassLoadingContext targetN: ((BrooklynClassLoadingContextSequential)target).primaries )
-                add(targetN);
-            for (BrooklynClassLoadingContext targetN: ((BrooklynClassLoadingContextSequential)target).secondaries )
-                addSecondary(targetN);
-        } else {
-            this.primaries.add( target );
-        }
-    }
-
-    public void addSecondary(BrooklynClassLoadingContext target) {
-        if (!(target instanceof JavaBrooklynClassLoadingContext)) {
-            // support for legacy catalog classloader only
-            log.warn("Only Java classloaders should be secondary");
-        }
-        this.secondaries.add( target );
-    }
-    
-    public Maybe<Class<?>> tryLoadClass(String className) {
-        List<Throwable> errors = MutableList.of();
-        for (BrooklynClassLoadingContext target: primaries) {
-            Maybe<Class<?>> clazz = target.tryLoadClass(className);
-            if (clazz.isPresent())
-                return clazz;
-            errors.add( ((Maybe.Absent<?>)clazz).getException() );
-        }
-        boolean noPrimaryErrors = errors.isEmpty();
-        for (BrooklynClassLoadingContext target: secondaries) {
-            Maybe<Class<?>> clazz = target.tryLoadClass(className);
-            if (clazz.isPresent())
-                return clazz;
-            if (noPrimaryErrors)
-                errors.add( ((Maybe.Absent<?>)clazz).getException() );
-        }
-
-        return Maybe.absent(Exceptions.create("Unable to load "+className+" from "+primaries, errors));
-    }
-
-    @Override
-    public URL getResource(String resourceInThatDir) {
-        for (BrooklynClassLoadingContext target: primaries) {
-            URL result = target.getResource(resourceInThatDir);
-            if (result!=null) return result;
-        }
-        for (BrooklynClassLoadingContext target: secondaries) {
-            URL result = target.getResource(resourceInThatDir);
-            if (result!=null) return result;
-        }
-        return null;
-    }
-
-    @Override
-    public Iterable<URL> getResources(String name) {
-        List<Iterable<URL>> resources = Lists.newArrayList();
-        for (BrooklynClassLoadingContext target : primaries) {
-            resources.add(target.getResources(name));
-        }
-        for (BrooklynClassLoadingContext target : secondaries) {
-            resources.add(target.getResources(name));
-        }
-        return Iterables.concat(resources);
-    }
-
-    @Override
-    public String toString() {
-        return "classload:"+primaries+";"+secondaries;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(super.hashCode(), primaries, secondaries);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (!super.equals(obj)) return false;
-        if (!(obj instanceof BrooklynClassLoadingContextSequential)) return false;
-        if (!Objects.equal(primaries, ((BrooklynClassLoadingContextSequential)obj).primaries)) return false;
-        if (!Objects.equal(secondaries, ((BrooklynClassLoadingContextSequential)obj).secondaries)) return false;
-        return true;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromBrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromBrooklynClassLoadingContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromBrooklynClassLoadingContext.java
deleted file mode 100644
index f36e2ac..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromBrooklynClassLoadingContext.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 org.apache.brooklyn.core.mgmt.classloading;
-
-import java.net.URL;
-
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-
-public class ClassLoaderFromBrooklynClassLoadingContext extends ClassLoader {
-
-    /** Constructs a {@link ClassLoader} which delegates to the given {@link BrooklynClassLoadingContext} */
-    public static ClassLoader of(BrooklynClassLoadingContext clc) {
-        return new ClassLoaderFromBrooklynClassLoadingContext(clc);
-    }
-    
-    protected final BrooklynClassLoadingContext clc;
-
-    protected ClassLoaderFromBrooklynClassLoadingContext(BrooklynClassLoadingContext clc) {
-        this.clc = clc;
-    }
-    
-    @Override
-    public Class<?> findClass(String className) throws ClassNotFoundException {
-        Class<?> result = clc.loadClass(className);
-        if (result!=null) return result;
-        
-        // last resort. see comment in XStream CompositeClassLoader
-        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-        if (contextClassLoader != null) {
-            result = contextClassLoader.loadClass(className);
-            if (result!=null) return result;
-        }
-        return null;
-    }
-    
-    @Override
-    protected URL findResource(String name) {
-        URL result = clc.getResource(name);
-        if (result!=null) return result;
-        
-        // last resort. see comment in XStream CompositeClassLoader
-        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-        if (contextClassLoader != null) {
-            result = contextClassLoader.getResource(name);
-            if (result!=null) return result;
-        }
-        return null;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/JavaBrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/JavaBrooklynClassLoadingContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/JavaBrooklynClassLoadingContext.java
deleted file mode 100644
index 064ba03..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/JavaBrooklynClassLoadingContext.java
+++ /dev/null
@@ -1,133 +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.core.mgmt.classloading;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-
-public class JavaBrooklynClassLoadingContext extends AbstractBrooklynClassLoadingContext {
-
-    private static final Logger LOG = LoggerFactory.getLogger(JavaBrooklynClassLoadingContext.class);
-
-    // on deserialization this loader is replaced with the catalog's root loader;
-    // may cause problems for non-osgi catalog items, but that's a reasonable trade-off,
-    // should this be serialized (e.g. in SpecialFlagsTransformer) in such a case!
-    private final transient ClassLoader loader;
-
-    /**
-     * @deprecated since 0.7.0 only for legacy catalog items which provide a non-osgi loader; see {@link #newDefault(ManagementContext)}
-     */ @Deprecated
-    public static JavaBrooklynClassLoadingContext create(ClassLoader loader) {
-        return new JavaBrooklynClassLoadingContext(null, checkNotNull(loader, "loader"));
-    }
-    
-    /**
-     * At least one of mgmt or loader must not be null.
-     * @deprecated since 0.7.0 only for legacy catalog items which provide a non-osgi loader; see {@link #newDefault(ManagementContext)}
-     */ @Deprecated
-    public static JavaBrooklynClassLoadingContext create(ManagementContext mgmt, ClassLoader loader) {
-        checkState(mgmt != null || loader != null, "mgmt and loader must not both be null");
-        return new JavaBrooklynClassLoadingContext(mgmt, loader);
-    }
-    
-    public static JavaBrooklynClassLoadingContext create(ManagementContext mgmt) {
-        return new JavaBrooklynClassLoadingContext(checkNotNull(mgmt, "mgmt"), null);
-    }
-
-    @Deprecated /** @deprecated since 0.7.0 use {@link #create(ManagementContext)} */
-    public static JavaBrooklynClassLoadingContext newDefault(ManagementContext mgmt) {
-        return new JavaBrooklynClassLoadingContext(checkNotNull(mgmt, "mgmt"), null);
-    }
-
-    @Deprecated /** @deprecated since 0.7.0 will become private; use one of the static methods to instantiate */
-    public JavaBrooklynClassLoadingContext(ManagementContext mgmt, ClassLoader loader) {
-        super(mgmt);
-        this.loader = loader;
-    }
-    
-    private ClassLoader getClassLoader() {
-        if (loader != null) return loader;
-        if (mgmt!=null) return mgmt.getCatalogClassLoader();
-        return JavaBrooklynClassLoadingContext.class.getClassLoader();
-    }
-    
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public Maybe<Class<?>> tryLoadClass(String className) {
-        try {
-            className = DeserializingClassRenamesProvider.findMappedName(className);
-            return (Maybe) Maybe.of(getClassLoader().loadClass(className));
-        } catch (NoClassDefFoundError e) {
-            String msg = "Invalid linkage in (transitive dependencies of) class "+className+": "+e.toString();
-            LOG.debug(msg);
-            return Maybe.absent(msg, e);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            return Maybe.absent("Invalid class: "+className, e);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "java:"+getClassLoader();
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(super.hashCode(), getClassLoader());
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (!super.equals(obj)) return false;
-        if (!(obj instanceof JavaBrooklynClassLoadingContext)) return false;
-        if (!Objects.equal(getClassLoader(), ((JavaBrooklynClassLoadingContext)obj).getClassLoader())) return false;
-        return true;
-    }
-
-    @Override
-    public URL getResource(String name) {
-        return getClassLoader().getResource(name);
-    }
-
-    @Override
-    public Iterable<URL> getResources(String name) {
-        Enumeration<URL> resources;
-        try {
-            resources = getClassLoader().getResources(name);
-        } catch (IOException e) {
-            throw Exceptions.propagate(e);
-        }
-        return Collections.list(resources);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/OsgiBrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/OsgiBrooklynClassLoadingContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/OsgiBrooklynClassLoadingContext.java
deleted file mode 100644
index 524f7b5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/OsgiBrooklynClassLoadingContext.java
+++ /dev/null
@@ -1,144 +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.core.mgmt.classloading;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.base.Objects;
-
-public class OsgiBrooklynClassLoadingContext extends AbstractBrooklynClassLoadingContext {
-
-    private final String catalogItemId;
-    private boolean hasBundles = false;
-    private transient Collection<? extends OsgiBundleWithUrl> _bundles;
-
-    public OsgiBrooklynClassLoadingContext(ManagementContext mgmt, String catalogItemId, Collection<? extends OsgiBundleWithUrl> bundles) {
-        super(mgmt);
-        this._bundles = bundles;
-        this.hasBundles = bundles!=null && !bundles.isEmpty();
-        this.catalogItemId = catalogItemId;
-    }
-
-    public Collection<? extends OsgiBundleWithUrl> getBundles() {
-        if (_bundles!=null || !hasBundles) return _bundles;
-        RegisteredType item = mgmt.getTypeRegistry().get(catalogItemId);
-        if (item==null) {
-            throw new IllegalStateException("Catalog item not found for "+catalogItemId+"; cannot create loading context");
-        }
-        _bundles = item.getLibraries();
-        return _bundles;
-    }
-    
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Maybe<Class<?>> tryLoadClass(String className) {
-        Maybe<Class<Object>> clazz = null;
-        Maybe<OsgiManager> osgi = null;
-        if (mgmt!=null) {
-            osgi = ((ManagementContextInternal)mgmt).getOsgiManager();
-            if (osgi.isPresent() && getBundles()!=null && !getBundles().isEmpty()) {
-                if (!Entitlements.isEntitled(mgmt.getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, catalogItemId))
-                    return Maybe.absent("Not entitled to use this catalog entry");
-                
-                clazz = osgi.get().tryResolveClass(className, getBundles());
-                if (clazz.isPresent())
-                    return (Maybe)clazz;
-            }
-        }
-        
-        if (clazz!=null) { 
-            // if OSGi bundles were defined and failed, then use its error message
-            return (Maybe)clazz;
-        }
-        // else determine best message
-        if (mgmt==null) return Maybe.absent("No mgmt context available for loading "+className);
-        if (osgi!=null && osgi.isAbsent()) return Maybe.absent("OSGi not available on mgmt for loading "+className);
-        if (!hasBundles)
-            return Maybe.absent("No bundles available for loading "+className);
-        return Maybe.absent("Inconsistent state ("+mgmt+"/"+osgi+"/"+getBundles()+" loading "+className);
-    }
-
-    @Override
-    public String toString() {
-        return "OSGi:"+catalogItemId+"["+getBundles()+"]";
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(super.hashCode(), getBundles(), catalogItemId);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (!super.equals(obj)) return false;
-        if (!(obj instanceof OsgiBrooklynClassLoadingContext)) return false;
-
-        OsgiBrooklynClassLoadingContext other = (OsgiBrooklynClassLoadingContext)obj;
-        if (!catalogItemId.equals(other.catalogItemId)) return false;
-        if (!Objects.equal(getBundles(), other.getBundles())) return false;
-        return true;
-    }
-
-    @Override
-    public URL getResource(String name) {
-        if (mgmt != null && isEntitledToSeeCatalogItem()) {
-            Maybe<OsgiManager> osgi = ((ManagementContextInternal) mgmt).getOsgiManager();
-            if (osgi.isPresent() && hasBundles) {
-                return osgi.get().getResource(name, getBundles());
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public Iterable<URL> getResources(String name) {
-        if (mgmt != null && isEntitledToSeeCatalogItem()) {
-            Maybe<OsgiManager> osgi = ((ManagementContextInternal) mgmt).getOsgiManager();
-            if (osgi.isPresent() && hasBundles) {
-                return osgi.get().getResources(name, getBundles());
-            }
-        }
-        return Collections.emptyList();
-    }
-
-    public String getCatalogItemId() {
-        return catalogItemId;
-    }
-
-    /**
-     * @return true if the current entitlement context may {@link Entitlements#SEE_CATALOG_ITEM see}
-     * {@link #getCatalogItemId}.
-     */
-    private boolean isEntitledToSeeCatalogItem() {
-        return Entitlements.isEntitled(mgmt.getEntitlementManager(),
-                Entitlements.SEE_CATALOG_ITEM,
-                catalogItemId);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/BasicEntitlementClassDefinition.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/BasicEntitlementClassDefinition.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/BasicEntitlementClassDefinition.java
deleted file mode 100644
index ed93fc7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/BasicEntitlementClassDefinition.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 org.apache.brooklyn.core.mgmt.entitlement;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-
-import com.google.common.base.Objects;
-import com.google.common.reflect.TypeToken;
-
-
-public class BasicEntitlementClassDefinition<T> implements EntitlementClass<T> {
-
-    private final String identifier;
-    private final TypeToken<T> argumentType;
-
-    public BasicEntitlementClassDefinition(String identifier, TypeToken<T> argumentType) {
-        this.identifier = identifier;
-        this.argumentType = argumentType;
-    }
-    
-    public BasicEntitlementClassDefinition(String identifier, Class<T> argumentType) {
-        this.identifier = identifier;
-        this.argumentType = TypeToken.of(argumentType);
-    }
-    
-    @Override
-    public String entitlementClassIdentifier() {
-        return identifier;
-    }
-
-    @Override
-    public TypeToken<T> entitlementClassArgumentType() {
-        return argumentType;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("identitifier", identifier).add("argumentType", argumentType).toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementManagerAdapter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementManagerAdapter.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementManagerAdapter.java
deleted file mode 100644
index b722a00..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementManagerAdapter.java
+++ /dev/null
@@ -1,133 +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.core.mgmt.entitlement;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntitlementClassesHandler;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-
-/**
- * provides an easy entry point to supplying entitlements, by providing the dispatch and defining the additional methods
- * which have to be supplied.
- * <p>
- * note that this class may change as versions change, deliberately breaking backwards compatibility
- * to ensure all permissions are used.
- * <p>
- * @since 0.7.0 */
-@Beta
-public abstract class EntitlementManagerAdapter implements EntitlementManager {
-
-    private static final Logger log = LoggerFactory.getLogger(EntitlementManagerAdapter.class);
-    
-    protected class Handler implements EntitlementClassesHandler<Boolean> {
-        final EntitlementContext context;
-        protected Handler(EntitlementContext context) {
-            this.context = context;
-        }
-        
-        @Override
-        public Boolean handleSeeCatalogItem(String catalogItemId) {
-            return isEntitledToSeeCatalogItem(context, catalogItemId);
-        }
-        @Override
-        public Boolean handleAddCatalogItem(Object catalogItemBeingAdded) {
-            return isEntitledToAddCatalogItem(context, catalogItemBeingAdded);
-        }
-        @Override
-        public Boolean handleModifyCatalogItem(StringAndArgument catalogItemIdAndModification) {
-            return isEntitledToModifyCatalogItem(context, catalogItemIdAndModification==null ? null : catalogItemIdAndModification.getString(),
-                catalogItemIdAndModification==null ? null : catalogItemIdAndModification.getArgument());
-        }
-        
-        @Override
-        public Boolean handleSeeEntity(Entity entity) {
-            return isEntitledToSeeEntity(context, entity);
-        }
-        @Override
-        public Boolean handleSeeSensor(EntityAndItem<String> sensorInfo) {
-            return isEntitledToSeeSensor(context, sensorInfo.getEntity(), sensorInfo.getItem());
-        }
-        @Override
-        public Boolean handleInvokeEffector(EntityAndItem<StringAndArgument> effectorInfo) {
-            StringAndArgument item = effectorInfo.getItem();
-            return isEntitledToInvokeEffector(context, effectorInfo.getEntity(), item==null ? null : item.getString(), item==null ? null : item.getArgument());
-        }
-        @Override
-        public Boolean handleModifyEntity(Entity entity) {
-            return isEntitledToModifyEntity(context, entity);
-        }
-
-        @Override
-        public Boolean handleDeployApplication(Object app) {
-            return isEntitledToDeployApplication(context, app);
-        }
-
-        @Override
-        public Boolean handleSeeAllServerInfo() {
-            return isEntitledToSeeAllServerInfo(context);
-        }
-
-        @Override
-        public Boolean handleSeeServerStatus() {
-            return isEntitledToSeeServerStatus(context);
-        }
-
-        @Override
-        public Boolean handleRoot() {
-            return isEntitledToRoot(context);
-        }
-    }
-    
-    @Override
-    public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> entitlementClass, T entitlementClassArgument) {
-        if (log.isTraceEnabled()) {
-            log.trace("Checking entitlement of "+context+" to "+entitlementClass+" "+entitlementClassArgument);
-        }
-        
-        if (isEntitledToRoot( context )) return true;
-        
-        Handler handler = new Handler(context);
-        return Entitlements.EntitlementClassesEnum.of(entitlementClass).handle(
-            handler, entitlementClassArgument);
-    }
-
-    protected abstract boolean isEntitledToSeeCatalogItem(EntitlementContext context, String catalogItemId);
-    /** passes item to be added, either yaml, or possibly null if any addition allowed (eg when resetting) */
-    protected abstract boolean isEntitledToAddCatalogItem(EntitlementContext context, Object catalogItemBeingAdded);
-    /** passes item being modified, as ID and description of modification, both possibly null if any modification is allowed (eg when resetting) */
-    protected abstract boolean isEntitledToModifyCatalogItem(EntitlementContext context, String catalogItemId, Object catalogItemModification);
-    protected abstract boolean isEntitledToSeeSensor(EntitlementContext context, Entity entity, String sensorName);
-    protected abstract boolean isEntitledToSeeEntity(EntitlementContext context, Entity entity);
-    /** arguments might be null, a map, or a list, depending how/where invoked */
-    protected abstract boolean isEntitledToInvokeEffector(EntitlementContext context, Entity entity, String effectorName, Object arguments);
-    protected abstract boolean isEntitledToModifyEntity(EntitlementContext context, Entity entity);
-    protected abstract boolean isEntitledToDeployApplication(EntitlementContext context, Object app);
-    protected abstract boolean isEntitledToSeeAllServerInfo(EntitlementContext context);
-    protected abstract boolean isEntitledToSeeServerStatus(EntitlementContext context);
-    protected abstract boolean isEntitledToRoot(EntitlementContext context);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementPredicates.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementPredicates.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementPredicates.java
deleted file mode 100644
index 3d2e981..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementPredicates.java
+++ /dev/null
@@ -1,61 +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.core.mgmt.entitlement;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-
-import com.google.common.base.Predicate;
-
-public class EntitlementPredicates {
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<T> isEntitledOld(final EntitlementManager entitlementManager, final EntitlementClass<T> entitlementClass) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<T>() {
-            @Override
-            public boolean apply(@Nullable T t) {
-                return Entitlements.isEntitled(entitlementManager, entitlementClass, t);
-            }
-        };
-    }
-
-    public static <T> Predicate<T> isEntitled(final EntitlementManager entitlementManager, final EntitlementClass<T> entitlementClass) {
-        return new IsEntitled<>(checkNotNull(entitlementManager, "entitlementManager"), checkNotNull(entitlementClass, "entitlementClass"));
-    }
-
-    protected static class IsEntitled<T> implements Predicate<T> {
-        private final EntitlementManager entitlementManager;
-        private final EntitlementClass<T> entitlementClass;
-        
-        protected IsEntitled(final EntitlementManager entitlementManager, final EntitlementClass<T> entitlementClass) {
-            this.entitlementManager = checkNotNull(entitlementManager, "entitlementManager");
-            this.entitlementClass = checkNotNull(entitlementClass, "entitlementClass");
-        }
-        @Override
-        public boolean apply(@Nullable T t) {
-            return Entitlements.isEntitled(entitlementManager, entitlementClass, t);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/Entitlements.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/Entitlements.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/Entitlements.java
deleted file mode 100644
index 6c281fc..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/Entitlements.java
+++ /dev/null
@@ -1,418 +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.core.mgmt.entitlement;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.Sanitizer;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.TypeToken;
-
-/** @since 0.7.0 */
-@Beta
-public class Entitlements {
-
-    private static final Logger log = LoggerFactory.getLogger(Entitlements.class);
-    
-    // ------------------- individual permissions
-    
-    public static EntitlementClass<String> SEE_CATALOG_ITEM = new BasicEntitlementClassDefinition<String>("catalog.see", String.class); 
-    public static EntitlementClass<Object> ADD_CATALOG_ITEM = new BasicEntitlementClassDefinition<Object>("catalog.add", Object.class); 
-    public static EntitlementClass<StringAndArgument> MODIFY_CATALOG_ITEM = new BasicEntitlementClassDefinition<StringAndArgument>("catalog.modify", StringAndArgument.class); 
-    
-    public static EntitlementClass<Entity> SEE_ENTITY = new BasicEntitlementClassDefinition<Entity>("entity.see", Entity.class);
-    public static EntitlementClass<EntityAndItem<String>> SEE_SENSOR = new BasicEntitlementClassDefinition<EntityAndItem<String>>("sensor.see", EntityAndItem. typeToken(String.class));
-    // string is effector name; argument may be a map or a list, depending how the args were supplied
-    public static EntitlementClass<EntityAndItem<StringAndArgument>> INVOKE_EFFECTOR = new BasicEntitlementClassDefinition<EntityAndItem<StringAndArgument>>("effector.invoke", EntityAndItem.typeToken(StringAndArgument.class));
-    public static EntitlementClass<Entity> MODIFY_ENTITY = new BasicEntitlementClassDefinition<Entity>("entity.modify", Entity.class);
-    
-    /** the permission to deploy an application, where parameter is some representation of the app to be deployed (spec instance or yaml plan) */
-    public static EntitlementClass<Object> DEPLOY_APPLICATION = new BasicEntitlementClassDefinition<Object>("app.deploy", Object.class);
-
-    /** catch-all for catalog, locations, scripting, usage, etc - exporting persistence, shutting down, etc;
-     * this is significantly more powerful than {@link #SERVER_STATUS}.
-     * NB: this may be refactored and deprecated in future */
-    public static EntitlementClass<Void> SEE_ALL_SERVER_INFO = new BasicEntitlementClassDefinition<Void>("server.info.all.see", Void.class);
-
-    /** permission to see general server status info: basically HA status; not nearly as much as {@link #SEE_ALL_SERVER_INFO} */
-    public static EntitlementClass<Void> SERVER_STATUS = new BasicEntitlementClassDefinition<Void>("server.status", Void.class);
-    
-    /** permission to run untrusted code or embedded scripts at the server; 
-     * secondary check required for any operation which could potentially grant root-level access */ 
-    public static EntitlementClass<Void> ROOT = new BasicEntitlementClassDefinition<Void>("root", Void.class);
-
-    @SuppressWarnings("unchecked")
-    public static enum EntitlementClassesEnum {
-        ENTITLEMENT_SEE_CATALOG_ITEM(SEE_CATALOG_ITEM) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleSeeCatalogItem((String)argument); } },
-        ENTITLEMENT_ADD_CATALOG_ITEM(ADD_CATALOG_ITEM) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleAddCatalogItem(argument); } },
-        ENTITLEMENT_MODIFY_CATALOG_ITEM(MODIFY_CATALOG_ITEM) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleModifyCatalogItem((StringAndArgument)argument); } },
-        
-        ENTITLEMENT_SEE_ENTITY(SEE_ENTITY) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleSeeEntity((Entity)argument); } },
-        ENTITLEMENT_SEE_SENSOR(SEE_SENSOR) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleSeeSensor((EntityAndItem<String>)argument); } },
-        ENTITLEMENT_INVOKE_EFFECTOR(INVOKE_EFFECTOR) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleInvokeEffector((EntityAndItem<StringAndArgument>)argument); } },
-        ENTITLEMENT_MODIFY_ENTITY(MODIFY_ENTITY) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleModifyEntity((Entity)argument); } },
-        
-        ENTITLEMENT_DEPLOY_APPLICATION(DEPLOY_APPLICATION) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleDeployApplication(argument); } },
-        
-        ENTITLEMENT_SEE_ALL_SERVER_INFO(SEE_ALL_SERVER_INFO) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleSeeAllServerInfo(); } },
-        ENTITLEMENT_SERVER_STATUS(SERVER_STATUS) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleSeeServerStatus(); } },
-        ENTITLEMENT_ROOT(ROOT) { public <T> T handle(EntitlementClassesHandler<T> handler, Object argument) { return handler.handleRoot(); } },
-        ;
-        
-        private EntitlementClass<?> entitlementClass;
-
-        private EntitlementClassesEnum(EntitlementClass<?> specificClass) {
-            this.entitlementClass = specificClass;
-        }
-        public EntitlementClass<?> getEntitlementClass() {
-            return entitlementClass;
-        }
-
-        public abstract <T> T handle(EntitlementClassesHandler<T> handler, Object argument);
-        
-        public static EntitlementClassesEnum of(EntitlementClass<?> entitlementClass) {
-            for (EntitlementClassesEnum x: values()) {
-                if (entitlementClass.equals(x.getEntitlementClass())) return x;
-            }
-            return null;
-        }
-    }
-    
-    public interface EntitlementClassesHandler<T> {
-        public T handleSeeCatalogItem(String catalogItemId);
-        public T handleSeeServerStatus();
-        public T handleAddCatalogItem(Object catalogItemBeingAdded);
-        public T handleModifyCatalogItem(StringAndArgument catalogItemIdAndModification);
-        public T handleSeeEntity(Entity entity);
-        public T handleSeeSensor(EntityAndItem<String> sensorInfo);
-        public T handleInvokeEffector(EntityAndItem<StringAndArgument> effectorInfo);
-        public T handleModifyEntity(Entity entity);
-        public T handleDeployApplication(Object app);
-        public T handleSeeAllServerInfo();
-        public T handleRoot();
-    }
-    
-    protected static class Pair<T1,T2> {
-        protected final T1 p1;
-        protected final T2 p2;
-        protected Pair(T1 p1, T2 p2) { this.p1 = p1; this.p2 = p2; }
-    }
-    public static class EntityAndItem<T> extends Pair<Entity,T> {
-        public static <TT> TypeToken<EntityAndItem<TT>> typeToken(Class<TT> type) {
-            return new TypeToken<Entitlements.EntityAndItem<TT>>() {
-                private static final long serialVersionUID = -738154831809025407L;
-            };
-        }
-        public EntityAndItem(Entity entity, T item) { super (entity, item); }
-        public Entity getEntity() { return p1; }
-        public T getItem() { return p2; }
-        public static <T> EntityAndItem<T> of(Entity entity, T item) {
-            return new EntityAndItem<T>(entity, item);
-        }
-    }
-    
-    public static class StringAndArgument extends Pair<String,Object> {
-        public StringAndArgument(String string, Object argument) { super(string, argument); }
-        public String getString() { return p1; }
-        public Object getArgument() { return p2; }
-        public static StringAndArgument of(String string, Object argument) {
-            return new StringAndArgument(string, argument);
-        }
-    }
-
-    /** 
-     * These lifecycle operations are currently treated as effectors. This may change in the future.
-     * @since 0.7.0 */
-    @Beta
-    public static class LifecycleEffectors {
-        public static final String DELETE = "delete";
-    }
-    
-    // ------------- permission sets -------------
-    
-    /** always ALLOW access to everything */
-    public static EntitlementManager root() {
-        return new EntitlementManager() {
-            @Override
-            public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> permission, T typeArgument) {
-                return true;
-            }
-            @Override
-            public String toString() {
-                return "Entitlements.root";
-            }
-        };
-    }
-
-    /** always DENY access to anything which requires entitlements */
-    public static EntitlementManager minimal() {
-        return new EntitlementManager() {
-            @Override
-            public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> permission, T typeArgument) {
-                return false;
-            }
-            @Override
-            public String toString() {
-                return "Entitlements.minimal";
-            }
-        };
-    }
-
-    public static class FineGrainedEntitlements {
-    
-        private static final Joiner COMMA_JOINER = Joiner.on(',');
-
-        public static EntitlementManager anyOf(final EntitlementManager... checkers) {
-            return anyOf(Arrays.asList(checkers));
-        }
-        
-        public static EntitlementManager anyOf(final Iterable<? extends EntitlementManager> checkers) {
-            return new EntitlementManager() {
-                @Override
-                public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> permission, T typeArgument) {
-                    for (EntitlementManager checker: checkers)
-                        if (checker.isEntitled(context, permission, typeArgument))
-                            return true;
-                    return false;
-                }
-                @Override
-                public String toString() {
-                    return "Entitlements.anyOf(" + COMMA_JOINER.join(checkers) + ")";
-                }
-            };
-        }
-        
-        public static EntitlementManager allOf(final EntitlementManager... checkers) {
-            return allOf(Arrays.asList(checkers));
-        }
-        
-        public static EntitlementManager allOf(final Iterable<? extends EntitlementManager> checkers) {
-            return new EntitlementManager() {
-                @Override
-                public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> permission, T typeArgument) {
-                    for (EntitlementManager checker: checkers)
-                        if (checker.isEntitled(context, permission, typeArgument))
-                            return true;
-                    return false;
-                }
-                @Override
-                public String toString() {
-                    return "Entitlements.allOf(" + COMMA_JOINER.join(checkers) + ")";
-                }
-            };
-        }
-
-        public static <U> EntitlementManager allowing(EntitlementClass<U> permission, Predicate<U> test) {
-            return new SinglePermissionEntitlementChecker<U>(permission, test);
-        }
-
-        public static <U> EntitlementManager allowing(EntitlementClass<U> permission) {
-            return new SinglePermissionEntitlementChecker<U>(permission, Predicates.<U>alwaysTrue());
-        }
-
-        public static class SinglePermissionEntitlementChecker<U> implements EntitlementManager {
-            final EntitlementClass<U> permission;
-            final Predicate<U> test;
-            
-            protected SinglePermissionEntitlementChecker(EntitlementClass<U> permission, Predicate<U> test) {
-                this.permission = permission;
-                this.test = test;
-            }
-            
-            @SuppressWarnings("unchecked")
-            @Override
-            public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> permission, T typeArgument) {
-                if (!Objects.equal(this.permission, permission)) return false;
-                return test.apply((U)typeArgument);
-            }
-            @Override
-            public String toString() {
-                return "Entitlements.allowing(" + permission + " -> " + test + ")";
-            }
-        }
-        public static EntitlementManager seeNonSecretSensors() {
-            return allowing(SEE_SENSOR, new Predicate<EntityAndItem<String>>() {
-                @Override
-                public boolean apply(EntityAndItem<String> input) {
-                    if (input == null) return false;
-                    return !Sanitizer.IS_SECRET_PREDICATE.apply(input.getItem());
-                }
-                @Override
-                public String toString() {
-                    return "Predicates.nonSecret";
-                }
-            });
-        }
-        
-    }
-    
-    /** allow read-only */
-    public static EntitlementManager readOnly() {
-        return FineGrainedEntitlements.anyOf(
-            FineGrainedEntitlements.allowing(SEE_ENTITY),
-            FineGrainedEntitlements.seeNonSecretSensors()
-        );
-    }
-
-    /** allow healthcheck */
-    public static EntitlementManager serverStatusOnly() {
-        return FineGrainedEntitlements.allowing(SERVER_STATUS);
-    }
-
-    // ------------- lookup conveniences -------------
-
-    private static class PerThreadEntitlementContextHolder {
-        public static final ThreadLocal<EntitlementContext> perThreadEntitlementsContextHolder = new ThreadLocal<EntitlementContext>();
-    }
-
-    /** 
-     * Finds the currently applicable {@link EntitlementContext} by examining the current thread
-     * then by investigating the current task, its submitter, etc. */
-    // NOTE: entitlements are propagated to tasks whenever they are created, as tags
-    // (see BrooklynTaskTags.tagForEntitlement and BasicExecutionContext.submitInternal).
-    // It might be cheaper to only do this lookup, not to propagate as tags, and to ensure
-    // all entitlement operations are wrapped in a task at source; but currently we do not
-    // do that so we need at least to set entitlement on the outermost task.
-    // Setting it on tasks submitted by a task is not strictly necessary (i.e. in BasicExecutionContext)
-    // but seems cheap enough, and means checking entitlements is fast, if we choose to do that more often.
-    public static EntitlementContext getEntitlementContext() {
-        EntitlementContext context;
-        context = PerThreadEntitlementContextHolder.perThreadEntitlementsContextHolder.get();
-        if (context!=null) return context;
-        
-        Task<?> task = Tasks.current();
-        while (task!=null) {
-            context = BrooklynTaskTags.getEntitlement(task);
-            if (context!=null) return context;
-            task = task.getSubmittedByTask();
-        }
-        
-        // no entitlements set -- assume entitlements not used, or system internal
-        return null;
-    }
-
-    public static void setEntitlementContext(EntitlementContext context) {
-        EntitlementContext oldContext = PerThreadEntitlementContextHolder.perThreadEntitlementsContextHolder.get();
-        if (oldContext!=null && context!=null) {
-            log.warn("Changing entitlement context from "+oldContext+" to "+context+"; context should have been reset or extended, not replaced");
-            log.debug("Trace for entitlement context duplicate overwrite", new Throwable("Trace for entitlement context overwrite"));
-        }
-        PerThreadEntitlementContextHolder.perThreadEntitlementsContextHolder.set(context);
-    }
-    
-    public static void clearEntitlementContext() {
-        PerThreadEntitlementContextHolder.perThreadEntitlementsContextHolder.set(null);
-    }
-    
-    public static <T> boolean isEntitled(EntitlementManager checker, EntitlementClass<T> permission, T typeArgument) {
-        return checker.isEntitled(getEntitlementContext(), permission, typeArgument);
-    }
-
-    /** throws {@link NotEntitledException} if entitlement not available for current {@link #getEntitlementContext()} */
-    public static <T> void checkEntitled(EntitlementManager checker, EntitlementClass<T> permission, T typeArgument) {
-        if (!isEntitled(checker, permission, typeArgument)) {
-            throw new NotEntitledException(getEntitlementContext(), permission, typeArgument);
-        }
-    }
-    /** throws {@link NotEntitledException} if entitlement not available for current {@link #getEntitlementContext()} 
-     * @since 0.7.0
-     * @deprecated since 0.7.0, use {@link #checkEntitled(EntitlementManager, EntitlementClass, Object)};
-     * kept briefly because there is some downstream usage*/
-    public static <T> void requireEntitled(EntitlementManager checker, EntitlementClass<T> permission, T typeArgument) {
-        checkEntitled(checker, permission, typeArgument);
-    }
-    
-    // ----------------- initialization ----------------
-
-    public final static String ENTITLEMENTS_CONFIG_PREFIX = "brooklyn.entitlements";
-    
-    public static ConfigKey<String> GLOBAL_ENTITLEMENT_MANAGER = ConfigKeys.newStringConfigKey(ENTITLEMENTS_CONFIG_PREFIX+".global", 
-        "Class for entitlements in effect globally; "
-        + "short names 'minimal', 'readonly', or 'root' are permitted here, with the default 'root' giving full access to all declared users; "
-        + "or supply the name of an "+EntitlementManager.class+" class to instantiate, taking a 1-arg BrooklynProperties constructor or a 0-arg constructor",
-        "root");
-    
-    public static EntitlementManager newManager(ManagementContext mgmt, BrooklynProperties brooklynProperties) {
-        return newGlobalManager(mgmt, brooklynProperties);
-    }
-    private static EntitlementManager newGlobalManager(ManagementContext mgmt, BrooklynProperties brooklynProperties) {
-        return load(mgmt, brooklynProperties, brooklynProperties.getConfig(GLOBAL_ENTITLEMENT_MANAGER));
-    }
-    
-    public static EntitlementManager load(@Nullable ManagementContext mgmt, BrooklynProperties brooklynProperties, String type) {
-        if ("root".equalsIgnoreCase(type)) return root();
-        if ("readonly".equalsIgnoreCase(type) || "read_only".equalsIgnoreCase(type)) return readOnly();
-        if ("minimal".equalsIgnoreCase(type)) return minimal();
-        if (Strings.isNonBlank(type)) {
-            try {
-                ClassLoader cl = mgmt==null ? null : ((ManagementContextInternal)mgmt).getCatalogClassLoader();
-                if (cl==null) cl = Entitlements.class.getClassLoader();
-                Class<?> clazz = cl.loadClass(DeserializingClassRenamesProvider.findMappedName(type));
-                return (EntitlementManager) instantiate(clazz, ImmutableList.of(
-                        new Object[] {mgmt, brooklynProperties},
-                        new Object[] {mgmt},
-                        new Object[] {brooklynProperties},
-                        new Object[0]));
-            } catch (Exception e) { 
-                throw Exceptions.propagate(e); 
-            }
-        }
-        throw new IllegalStateException("Invalid entitlement manager specified: '"+type+"'");
-    }
-    
-    private static Object instantiate(Class<?> clazz, List<Object[]> constructorArgOptions) {
-        try {
-            for (Object[] constructorArgOption : constructorArgOptions) {
-                Optional<?> result = Reflections.invokeConstructorWithArgs(clazz, constructorArgOption);
-                if (result.isPresent()) return result.get();
-            }
-        } catch (Exception e) { 
-            throw Exceptions.propagate(e); 
-        }
-        throw new IllegalStateException("No matching constructor to instantiate "+clazz);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/NotEntitledException.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/NotEntitledException.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/NotEntitledException.java
deleted file mode 100644
index 76ae278..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/NotEntitledException.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 org.apache.brooklyn.core.mgmt.entitlement;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-
-
-public class NotEntitledException extends RuntimeException {
-
-    private static final long serialVersionUID = -4001882260980589181L;
-    
-    EntitlementContext entitlementContext;
-    EntitlementClass<?> permission;
-    Object typeArgument;
-    
-    public <T> NotEntitledException(EntitlementContext entitlementContext, EntitlementClass<T> permission, T typeArgument) {
-        this.entitlementContext = entitlementContext;
-        this.permission = permission;
-        this.typeArgument = typeArgument;
-    }
-    
-    @Override
-    public String toString() {
-        return super.toString()+"["+entitlementContext+":"+permission+(typeArgument!=null ? "("+typeArgument+")" : "")+"]";
-    }
-
-}


[26/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynLogging.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynLogging.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynLogging.java
deleted file mode 100644
index db9eb52..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynLogging.java
+++ /dev/null
@@ -1,73 +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.core;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.slf4j.Logger;
-
-/** contains common logging categories */
-public class BrooklynLogging {
-
-    public static final String SSH_IO = "brooklyn.SSH";
-
-    public static final String REST = "brooklyn.REST";
-
-    /** For convenience here, since SLF4J does not define such an enum */
-    public static enum LoggingLevel { ERROR, WARN, INFO, DEBUG, TRACE }
-
-    /** As methods on {@link Logger} but taking the level as an argument */
-    public static final void log(Logger logger, LoggingLevel level, String message, Object... args) {
-        switch (level) {
-        case ERROR: logger.error(message, args); break;
-        case WARN: logger.warn(message, args); break;
-        case INFO: logger.info(message, args); break;
-        case DEBUG: logger.debug(message, args); break;
-        case TRACE: logger.trace(message, args); break;
-        }
-    }
-
-    /** As methods on {@link Logger} but taking the level as an argument */
-    public static final void log(Logger logger, LoggingLevel level, String message, Throwable t) {
-        switch (level) {
-        case ERROR: logger.error(message, t); break;
-        case WARN: logger.warn(message, t); break;
-        case INFO: logger.info(message, t); break;
-        case DEBUG: logger.debug(message, t); break;
-        case TRACE: logger.trace(message, t); break;
-        }
-    }
-
-    /** returns one of three log levels depending on the read-only status of the entity;
-     * unknown should only be the case very early in the management cycle */
-    public static LoggingLevel levelDependingIfReadOnly(Entity entity, LoggingLevel levelIfWriting, LoggingLevel levelIfReadOnly, LoggingLevel levelIfUnknown) {
-        if (entity==null) return levelIfUnknown;
-        Boolean ro = ((EntityInternal)entity).getManagementSupport().isReadOnlyRaw();
-        if (ro==null) return levelIfUnknown;
-        if (ro) return levelIfReadOnly;
-        return levelIfWriting;
-    }
-
-    /** as {@link #levelDependendingIfReadOnly(Entity)} with {@link LoggingLevel#DEBUG} as the default,
-     * but {@link LoggingLevel#TRACE} for read-only */
-    public static LoggingLevel levelDebugOrTraceIfReadOnly(Entity entity) {
-        return levelDependingIfReadOnly(entity, LoggingLevel.DEBUG, LoggingLevel.TRACE, LoggingLevel.DEBUG);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
deleted file mode 100644
index 3e0a1a7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
+++ /dev/null
@@ -1,450 +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.core;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.jar.Attributes;
-
-import javax.annotation.Nullable;
-
-import org.osgi.framework.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.mgmt.classloading.OsgiBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.rt.felix.ManifestHelper;
-import org.apache.brooklyn.util.core.osgi.Osgis;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.text.Strings;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.FrameworkUtil;
-
-/**
- * Wraps the version of Brooklyn.
- * <p>
- * Also retrieves the SHA-1 from any OSGi bundle, and checks that the maven and osgi versions match.
- */
-public class BrooklynVersion {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynVersion.class);
-
-    private static final String MVN_VERSION_RESOURCE_FILE = "META-INF/maven/org.apache.brooklyn/brooklyn-core/pom.properties";
-    private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
-    private static final String BROOKLYN_CORE_SYMBOLIC_NAME = "org.apache.brooklyn.core";
-
-    private static final String MVN_VERSION_PROPERTY_NAME = "version";
-    private static final String OSGI_VERSION_PROPERTY_NAME = Attributes.Name.IMPLEMENTATION_VERSION.toString();
-    private static final String OSGI_SHA1_PROPERTY_NAME = "Implementation-SHA-1";
-    // may be useful:
-//    private static final String OSGI_BRANCH_PROPERTY_NAME = "Implementation-Branch";
-
-    private final static String VERSION_FROM_STATIC = "0.9.0-SNAPSHOT"; // BROOKLYN_VERSION
-    private static final AtomicReference<Boolean> IS_DEV_ENV = new AtomicReference<Boolean>();
-
-    private static final String BROOKLYN_FEATURE_PREFIX = "Brooklyn-Feature-";
-
-    public static final BrooklynVersion INSTANCE = new BrooklynVersion();
-
-    private final Properties versionProperties = new Properties();
-
-    private BrooklynVersion() {
-        // we read the maven pom metadata and osgi metadata and make sure it's sensible
-        // everything is put into a single map for now (good enough, but should be cleaned up)
-        readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader());
-        readPropertiesFromOsgiResource();
-        // TODO there is also build-metadata.properties used in ServerResource /v1/server/version endpoint
-        // see comments on that about folding it into this class instead
-
-        checkVersions();
-    }
-
-    public void checkVersions() {
-        String mvnVersion = getVersionFromMavenProperties();
-        if (mvnVersion != null && !VERSION_FROM_STATIC.equals(mvnVersion)) {
-            throw new IllegalStateException("Version error: maven " + mvnVersion + " / code " + VERSION_FROM_STATIC);
-        }
-
-        String osgiVersion = versionProperties.getProperty(OSGI_VERSION_PROPERTY_NAME);
-        // TODO does the OSGi version include other slightly differ gubbins/style ?
-        if (osgiVersion != null && !VERSION_FROM_STATIC.equals(osgiVersion)) {
-            throw new IllegalStateException("Version error: osgi " + osgiVersion + " / code " + VERSION_FROM_STATIC);
-        }
-    }
-
-    /**
-     * Returns version as inferred from classpath/osgi, if possible, or 0.0.0-SNAPSHOT.
-     * See also {@link #getVersionFromMavenProperties()} and {@link #getVersionFromOsgiManifest()}.
-     *
-     * @deprecated since 0.7.0, in favour of the more specific methods (and does anyone need that default value?)
-     */
-    @Deprecated
-    public String getVersionFromClasspath() {
-        String v = getVersionFromMavenProperties();
-        if (Strings.isNonBlank(v)) return v;
-        v = getVersionFromOsgiManifest();
-        if (Strings.isNonBlank(v)) return v;
-        return "0.0.0-SNAPSHOT";
-    }
-
-    @Nullable
-    public String getVersionFromMavenProperties() {
-        return versionProperties.getProperty(MVN_VERSION_PROPERTY_NAME);
-    }
-
-    @Nullable
-    public String getVersionFromOsgiManifest() {
-        return versionProperties.getProperty(OSGI_VERSION_PROPERTY_NAME);
-    }
-
-    @Nullable
-    /** SHA1 of the last commit to brooklyn at the time this build was made.
-     * For SNAPSHOT builds of course there may have been further non-committed changes. */
-    public String getSha1FromOsgiManifest() {
-        return versionProperties.getProperty(OSGI_SHA1_PROPERTY_NAME);
-    }
-
-    public String getVersion() {
-        return VERSION_FROM_STATIC;
-    }
-
-    public boolean isSnapshot() {
-        return (getVersion().indexOf("-SNAPSHOT") >= 0);
-    }
-
-    private void readPropertiesFromMavenResource(ClassLoader resourceLoader) {
-        InputStream versionStream = null;
-        try {
-            versionStream = resourceLoader.getResourceAsStream(MVN_VERSION_RESOURCE_FILE);
-            if (versionStream == null) {
-                if (isDevelopmentEnvironment()) {
-                    // allowed for dev env
-                    log.trace("No maven resource file " + MVN_VERSION_RESOURCE_FILE + " available");
-                } else {
-                    log.warn("No maven resource file " + MVN_VERSION_RESOURCE_FILE + " available");
-                }
-                return;
-            }
-            versionProperties.load(checkNotNull(versionStream));
-        } catch (IOException e) {
-            log.warn("Error reading maven resource file " + MVN_VERSION_RESOURCE_FILE + ": " + e, e);
-        } finally {
-            Streams.closeQuietly(versionStream);
-        }
-    }
-
-    /**
-     * Reads main attributes properties from brooklyn-core's bundle manifest.
-     */
-    private void readPropertiesFromOsgiResource() {
-        if (Osgis.isBrooklynInsideFramework()) {
-            Dictionary<String, String> headers = FrameworkUtil.getBundle(BrooklynVersion.class).getHeaders();
-            for (Enumeration<String> keys = headers.keys(); keys.hasMoreElements();) {
-                String key = keys.nextElement();
-                versionProperties.put(key, headers.get(key));
-            }
-        } else {
-            Enumeration<URL> paths;
-            try {
-                paths = BrooklynVersion.class.getClassLoader().getResources(MANIFEST_PATH);
-            } catch (IOException e) {
-                // shouldn't happen
-                throw Exceptions.propagate(e);
-            }
-            while (paths.hasMoreElements()) {
-                URL u = paths.nextElement();
-                InputStream us = null;
-                try {
-                    us = u.openStream();
-                    ManifestHelper mh = ManifestHelper.forManifest(us);
-                    if (BROOKLYN_CORE_SYMBOLIC_NAME.equals(mh.getSymbolicName())) {
-                        Attributes attrs = mh.getManifest().getMainAttributes();
-                        for (Object key : attrs.keySet()) {
-                            // key is an Attribute.Name; toString converts to string
-                            versionProperties.put(key.toString(), attrs.getValue(key.toString()));
-                        }
-                        return;
-                    }
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.warn("Error reading OSGi manifest from " + u + " when determining version properties: " + e, e);
-                } finally {
-                    Streams.closeQuietly(us);
-                }
-            }
-            if (isDevelopmentEnvironment()) {
-                // allowed for dev env
-                log.trace("No OSGi manifest available to determine version properties");
-            } else {
-                log.warn("No OSGi manifest available to determine version properties");
-            }
-        }
-    }
-
-    /**
-     * Returns whether this is a Brooklyn dev environment,
-     * specifically core/target/classes/ is on the classpath for the org.apache.brooklyn.core project.
-     * <p/>
-     * In a packaged or library build of Brooklyn (normal usage) this should return false,
-     * and all OSGi components should be available.
-     * <p/>
-     * There is no longer any way to force this,
-     * such as the old BrooklynDevelopmentMode class;
-     * but that could easily be added if required (eg as a system property).
-     */
-    public static boolean isDevelopmentEnvironment() {
-        Boolean isDevEnv = IS_DEV_ENV.get();
-        if (isDevEnv != null) return isDevEnv;
-        synchronized (IS_DEV_ENV) {
-            isDevEnv = computeIsDevelopmentEnvironment();
-            IS_DEV_ENV.set(isDevEnv);
-            return isDevEnv;
-        }
-    }
-
-    private static boolean computeIsDevelopmentEnvironment() {
-        Enumeration<URL> paths;
-        try {
-            paths = BrooklynVersion.class.getClassLoader().getResources("org/apache/brooklyn/core/BrooklynVersion.class");
-        } catch (IOException e) {
-            // shouldn't happen
-            throw Exceptions.propagate(e);
-        }
-        while (paths.hasMoreElements()) {
-            URL u = paths.nextElement();
-            // running fram a classes directory (including coverage-classes for cobertura) triggers dev env
-            if (u.getPath().endsWith("org/apache/brooklyn/core/BrooklynVersion.class")) {
-                try {
-                    log.debug("Brooklyn dev/src environment detected: BrooklynVersion class is at: " + u);
-                    return true;
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.warn("Error reading manifest to determine whether this is a development environment: " + e, e);
-                }
-            }
-        }
-        return false;
-    }
-
-    public void logSummary() {
-        log.debug("Brooklyn version " + getVersion() + " (git SHA1 " + getSha1FromOsgiManifest() + ")");
-    }
-
-    /**
-     * @deprecated since 0.7.0, redundant with {@link #get()}
-     */
-    @Deprecated
-    public static String getVersionFromStatic() {
-        return VERSION_FROM_STATIC;
-    }
-
-    public static String get() {
-        return INSTANCE.getVersion();
-    }
-
-    /**
-     * @param mgmt The context to search for features.
-     * @return An iterable containing all features found in the management context's classpath and catalogue.
-     */
-    public static Iterable<BrooklynFeature> getFeatures(ManagementContext mgmt) {
-        if (Osgis.isBrooklynInsideFramework()) {
-            List<Bundle> bundles = Arrays.asList(
-                    FrameworkUtil.getBundle(BrooklynVersion.class)
-                            .getBundleContext()
-                            .getBundles()
-            );
-
-            Maybe<OsgiManager> osgi = ((ManagementContextInternal)mgmt).getOsgiManager();
-            for (CatalogItem<?, ?> catalogItem : mgmt.getCatalog().getCatalogItems()) {
-                if (osgi.isPresentAndNonNull()) {
-                    for (CatalogItem.CatalogBundle catalogBundle : catalogItem.getLibraries()) {
-                        Maybe<Bundle> osgiBundle = osgi.get().findBundle(catalogBundle);
-                        if (osgiBundle.isPresentAndNonNull()) {
-                            bundles.add(osgiBundle.get());
-                        }
-                    }
-                }
-
-            }
-
-            // Set over list in case a bundle is reported more than once (e.g. from classpath and from OSGi).
-            // Not sure of validity of this approach over just reporting duplicates.
-            ImmutableSet.Builder<BrooklynFeature> features = ImmutableSet.builder();
-            for(Bundle bundle : bundles) {
-                Optional<BrooklynFeature> fs = BrooklynFeature.newFeature(bundle.getHeaders());
-                if (fs.isPresent()) {
-                    features.add(fs.get());
-                }
-            }
-            return features.build();
-        } else {
-            Iterable<URL> manifests = ResourceUtils.create(mgmt).getResources(MANIFEST_PATH);
-
-            for (CatalogItem<?, ?> catalogItem : mgmt.getCatalog().getCatalogItems()) {
-                OsgiBrooklynClassLoadingContext osgiContext = new OsgiBrooklynClassLoadingContext(
-                        mgmt, catalogItem.getCatalogItemId(), catalogItem.getLibraries());
-                manifests = Iterables.concat(manifests, osgiContext.getResources(MANIFEST_PATH));
-            }
-
-            // Set over list in case a bundle is reported more than once (e.g. from classpath and from OSGi).
-            // Not sure of validity of this approach over just reporting duplicates.
-            ImmutableSet.Builder<BrooklynFeature> features = ImmutableSet.builder();
-            for (URL manifest : manifests) {
-                ManifestHelper mh = null;
-                try {
-                    mh = ManifestHelper.forManifest(manifest);
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.debug("Error reading OSGi manifest from " + manifest + " when determining version properties: " + e, e);
-                }
-                if (mh == null) continue;
-                Attributes attrs = mh.getManifest().getMainAttributes();
-                Optional<BrooklynFeature> fs = BrooklynFeature.newFeature(attrs);
-                if (fs.isPresent()) {
-                    features.add(fs.get());
-                }
-            }
-            return features.build();
-        }
-    }
-
-    public static class BrooklynFeature {
-        private final String name;
-        private final String symbolicName;
-        private final String version;
-        private final String lastModified;
-        private final Map<String, String> additionalData;
-
-        BrooklynFeature(String name, String symbolicName, String version, String lastModified, Map<String, String> additionalData) {
-            this.symbolicName = checkNotNull(symbolicName, "symbolicName");
-            this.name = name;
-            this.version = version;
-            this.lastModified = lastModified;
-            this.additionalData = ImmutableMap.copyOf(additionalData);
-        }
-
-        private static Optional<BrooklynFeature> newFeature(Attributes attrs) {
-            // unfortunately Attributes is a Map<Object,Object>
-            Dictionary<String,String> headers = new Hashtable<>();
-            for (Map.Entry<Object, Object> entry : attrs.entrySet()) {
-                headers.put(entry.getKey().toString(), entry.getValue().toString());
-            }
-            return newFeature(headers);
-        }
-
-        /** @return Present if any attribute name begins with {@link #BROOKLYN_FEATURE_PREFIX}, absent otherwise. */
-        private static Optional<BrooklynFeature> newFeature(Dictionary<String,String> headers) {
-            Map<String, String> additionalData = Maps.newHashMap();
-            for (Enumeration<String> keys = headers.keys(); keys.hasMoreElements();) {
-                String key = keys.nextElement();
-                if (key.startsWith(BROOKLYN_FEATURE_PREFIX)) {
-                    String value = headers.get(key);
-                    if (!Strings.isBlank(value)) {
-                        additionalData.put(key, value);
-                    }
-                }
-            }
-            if (additionalData.isEmpty()) {
-                return Optional.absent();
-            }
-
-            // Name is special cased as it a useful way to indicate a feature without
-            String nameKey = BROOKLYN_FEATURE_PREFIX + "Name";
-            String name = Optional.fromNullable(additionalData.remove(nameKey))
-                    .or(Optional.fromNullable(Constants.BUNDLE_NAME))
-                    .or(headers.get(Constants.BUNDLE_SYMBOLICNAME));
-
-            return Optional.of(new BrooklynFeature(
-                    name,
-                    headers.get(Constants.BUNDLE_SYMBOLICNAME),
-                    headers.get(Constants.BUNDLE_VERSION),
-                    headers.get("Bnd-LastModified"),
-                    additionalData));
-        }
-
-        public String getLastModified() {
-            return lastModified;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public String getSymbolicName() {
-            return symbolicName;
-        }
-
-        public String getVersion() {
-            return version;
-        }
-
-        /** @return an unmodifiable map */
-        public Map<String, String> getAdditionalData() {
-            return additionalData;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "{" + symbolicName + (version != null ? ":" + version : "") + "}";
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(symbolicName, version);
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (this == other) return true;
-            if (other == null || getClass() != other.getClass()) return false;
-            BrooklynFeature that = (BrooklynFeature) other;
-            if (!symbolicName.equals(that.symbolicName)) {
-                return false;
-            } else if (version != null ? !version.equals(that.version) : that.version != null) {
-                return false;
-            }
-            return true;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/Effector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/Effector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/Effector.java
deleted file mode 100644
index b7fc0e3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/Effector.java
+++ /dev/null
@@ -1,33 +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.core.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks a method as being an effector. Provides runtime to meta-data about that effector.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.PARAMETER, ElementType.METHOD})
-public @interface Effector {
-    String description() default "";
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/EffectorParam.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/EffectorParam.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/EffectorParam.java
deleted file mode 100644
index 8fdf79b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/annotation/EffectorParam.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 org.apache.brooklyn.core.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-//FIXME Move to brooklyn.entity.effector?
-
-/**
- * Gives meta-data about a parameter of the effector.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.PARAMETER)
-public @interface EffectorParam {
-    String name();
-    String description() default MAGIC_STRING_MEANING_NULL;
-    String defaultValue() default MAGIC_STRING_MEANING_NULL;
-    boolean nullable() default true;
-    
-    /** Cannot use null as a default (e.g. for defaultValue); therefore define a magic string to mean that
-    /* so can tell when no-one has set it. */
-    public static final String MAGIC_STRING_MEANING_NULL = "null default value; do not mis-use! 3U=Hhfkr8wuov]WO";
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
deleted file mode 100644
index dd2e54b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogLoadMode.java
+++ /dev/null
@@ -1,73 +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.core.catalog;
-
-import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
-import org.apache.brooklyn.core.mgmt.persist.PersistMode;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.slf4j.LoggerFactory;
-
-/** @deprecated since 0.7.0 replaced by {@link CatalogInitialization} */
-@Deprecated
-public enum CatalogLoadMode {
-    /**
-     * The server will load its initial catalog from the URL configured in
-     * {@link BrooklynServerConfig#BROOKLYN_CATALOG_URL} and will
-     * disregard existing persisted state.
-     */
-    LOAD_BROOKLYN_CATALOG_URL,
-
-    /**
-     * The server will load its initial catalog from previously persisted state,
-     * and will behave as {@link #LOAD_BROOKLYN_CATALOG_URL} if no state exists.
-     */
-    LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE,
-
-    /**
-     * The server will load its initial catalog from previously persisted state.
-     * The catalog will be empty if no previous state exists.
-     */
-    LOAD_PERSISTED_STATE;
-
-    /**
-     * @return A catalog load mode suitable for the given persistence mode:
-     * <ul>
-     * <li>disabled: {@link #LOAD_BROOKLYN_CATALOG_URL}</li>
-     * <li>rebind: {@link #LOAD_PERSISTED_STATE}</li>
-     * <li>auto or clean: {@link #LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE}</li>
-     * </ul>
-     */
-    public static CatalogLoadMode forPersistMode(PersistMode m) {
-        // Clean case relies on the persistence directory being cleaned and rebind manager
-        // believing the store to be empty.
-        switch (m) {
-        case DISABLED:
-            return LOAD_BROOKLYN_CATALOG_URL;
-        case AUTO:
-        case CLEAN:
-            return LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE;
-        case REBIND:
-            return LOAD_PERSISTED_STATE;
-        default:
-            LoggerFactory.getLogger(CatalogLoadMode.class)
-                    .warn("Unhandled persistence mode {}. Catalog defaulting to {}", m.name(), LOAD_BROOKLYN_CATALOG_URL.name());
-            return LOAD_BROOKLYN_CATALOG_URL;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogPredicates.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogPredicates.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogPredicates.java
deleted file mode 100644
index 8d5ea9e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/CatalogPredicates.java
+++ /dev/null
@@ -1,319 +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.core.catalog;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-
-public class CatalogPredicates {
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> isCatalogItemType(final CatalogItemType ciType) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && item.getCatalogItemType()==ciType;
-            }
-        };
-        return new CatalogItemTypeEqualTo<T, SpecT>(ciType);
-    }
-
-    /**
-     * @since 0.8.0
-     */
-    private static class CatalogItemTypeEqualTo<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final CatalogItemType ciType;
-        
-        public CatalogItemTypeEqualTo(final CatalogItemType ciType) {
-            this.ciType = ciType;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && item.getCatalogItemType()==ciType;
-        }
-    }
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> deprecated(final boolean deprecated) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && item.isDeprecated() == deprecated;
-            }
-        };
-        return new DeprecatedEqualTo<T, SpecT>(deprecated);
-    }
-
-    /**
-     * @since 0.8.0
-     */
-    private static class DeprecatedEqualTo<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final boolean deprecated;
-        
-        public DeprecatedEqualTo(boolean deprecated) {
-            this.deprecated = deprecated;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && item.isDeprecated() == deprecated;
-        }
-    }
-
-    /**
-     * @since 0.8.0
-     */
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> disabled(boolean disabled) {
-        return new DisabledEqualTo<T, SpecT>(disabled);
-    }
-
-    /**
-     * @since 0.8.0
-     */
-    private static class DisabledEqualTo<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final boolean disabled;
-        
-        public DisabledEqualTo(boolean disabled) {
-            this.disabled = disabled;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && item.isDisabled() == disabled;
-        }
-    }
-
-    public static final Predicate<CatalogItem<Application,EntitySpec<? extends Application>>> IS_TEMPLATE = 
-            CatalogPredicates.<Application,EntitySpec<? extends Application>>isCatalogItemType(CatalogItemType.TEMPLATE);
-    public static final Predicate<CatalogItem<Entity,EntitySpec<?>>> IS_ENTITY = 
-            CatalogPredicates.<Entity,EntitySpec<?>>isCatalogItemType(CatalogItemType.ENTITY);
-    public static final Predicate<CatalogItem<Policy,PolicySpec<?>>> IS_POLICY = 
-            CatalogPredicates.<Policy,PolicySpec<?>>isCatalogItemType(CatalogItemType.POLICY);
-    public static final Predicate<CatalogItem<Location,LocationSpec<?>>> IS_LOCATION = 
-            CatalogPredicates.<Location,LocationSpec<?>>isCatalogItemType(CatalogItemType.LOCATION);
-    
-    // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-    @SuppressWarnings("unused")
-    private static final Function<CatalogItem<?,?>,String> ID_OF_ITEM_TRANSFORMER_ANONYMOUS = new Function<CatalogItem<?,?>, String>() {
-        @Override @Nullable
-        public String apply(@Nullable CatalogItem<?,?> input) {
-            if (input==null) return null;
-            return input.getId();
-        }
-    };
-
-    // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-    public static final Function<CatalogItem<?,?>,String> ID_OF_ITEM_TRANSFORMER = new IdOfItemTransformer();
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class IdOfItemTransformer implements Function<CatalogItem<?,?>,String> {
-        @Override @Nullable
-        public String apply(@Nullable CatalogItem<?,?> input) {
-            if (input==null) return null;
-            return input.getId();
-        }
-    };
-
-    /** @deprecated since 0.7.0 use {@link #displayName(Predicate)} */
-    @Deprecated
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> name(final Predicate<? super String> filter) {
-        return displayName(filter);
-    }
-
-    /**
-     * @since 0.7.0
-     */
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> displayName(final Predicate<? super String> filter) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && filter.apply(item.getDisplayName());
-            }
-        };
-        return new DisplayNameMatches<T,SpecT>(filter);
-    }
-
-    /**
-     * @since 0.8.0
-     */
-    private static class DisplayNameMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final Predicate<? super String> filter;
-        
-        public DisplayNameMatches(Predicate<? super String> filter) {
-            this.filter = filter;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && filter.apply(item.getDisplayName());
-        }
-    }
-
-    @Deprecated
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> registeredTypeName(final Predicate<? super String> filter) {
-        return symbolicName(filter);
-    }
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> symbolicName(final Predicate<? super String> filter) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && filter.apply(item.getSymbolicName());
-            }
-        };
-        return new SymbolicNameMatches<T,SpecT>(filter);
-    }
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class SymbolicNameMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final Predicate<? super String> filter;
-        
-        public SymbolicNameMatches(Predicate<? super String> filter) {
-            this.filter = filter;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && filter.apply(item.getSymbolicName());
-        }
-    }
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> javaType(final Predicate<? super String> filter) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && filter.apply(item.getJavaType());
-            }
-        };
-        return new JavaTypeMatches<T, SpecT>(filter);
-    }
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class JavaTypeMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final Predicate<? super String> filter;
-        
-        public JavaTypeMatches(Predicate<? super String> filter) {
-            this.filter = filter;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && filter.apply(item.getJavaType());
-        }
-    }
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> xml(final Predicate<? super String> filter) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && filter.apply(item.toXmlString());
-            }
-        };
-        return new XmlMatches<T,SpecT>(filter);
-    }
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class XmlMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final Predicate<? super String> filter;
-        
-        public XmlMatches(Predicate<? super String> filter) {
-            this.filter = filter;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && filter.apply(item.toXmlString());
-        }
-    }
-
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> entitledToSee(final ManagementContext mgmt) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return (item != null) && 
-                    Entitlements.isEntitled(mgmt.getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, item.getCatalogItemId());
-            }
-        };
-        return new EntitledToSee<T, SpecT>(mgmt);
-    }
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class EntitledToSee<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final ManagementContext mgmt;
-        
-        public EntitledToSee(ManagementContext mgmt) {
-            this.mgmt = mgmt;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return (item != null) && 
-                    Entitlements.isEntitled(mgmt.getEntitlementManager(), Entitlements.SEE_CATALOG_ITEM, item.getCatalogItemId());
-        }
-    }
- 
-    public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> isBestVersion(final ManagementContext mgmt) {
-        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted state
-        new Predicate<CatalogItem<T,SpecT>>() {
-            @Override
-            public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-                return CatalogUtils.isBestVersion(mgmt, item);
-            }
-        };
-        return new IsBestVersion<T, SpecT>(mgmt);
-    }
-    
-    /**
-     * @since 0.8.0
-     */
-    private static class IsBestVersion<T,SpecT> implements Predicate<CatalogItem<T,SpecT>> {
-        private final ManagementContext mgmt;
-        
-        public IsBestVersion(ManagementContext mgmt) {
-            this.mgmt = mgmt;
-        }
-        @Override
-        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
-            return CatalogUtils.isBestVersion(mgmt, item);
-        }
-    }
-}
\ No newline at end of file


[22/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ListConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ListConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ListConfigKey.java
deleted file mode 100644
index 06a29bd..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ListConfigKey.java
+++ /dev/null
@@ -1,128 +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.core.config;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.core.config.internal.AbstractCollectionConfigKey;
-import org.apache.brooklyn.core.internal.storage.impl.ConcurrentMapAcceptingNullVals;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** A config key representing a list of values. 
- * If a value is set on this key, it is _added_ to the list.
- * (With a warning is issued if a collection is passed in.)
- * If a value is set against an equivalent *untyped* key which *is* a collection,
- * it will be treated as a list upon discovery and used as a base to which subkey values are appended.
- * If a value is discovered against this key which is not a map or collection,
- * it is ignored.
- * <p>
- * To add all items in a collection, to add a collection as a single element, 
- * to clear the list, or to set a collection (clearing first), 
- * use the relevant {@link ListModification} in {@link ListModifications}.
- * <p>  
- * Specific values can be added in a replaceable way by referring to a subkey.
- * 
- * @deprecated since 0.6; use SetConfigKey. 
- * The ListConfigKey does not guarantee order when subkeys are used,
- * due to distribution and the use of the {@link ConcurrentMapAcceptingNullVals} 
- * as a backing store.
- * However the class will likely be kept around with tests for the time being
- * as we would like to repair this.
- */
-//TODO Create interface
-@Deprecated
-public class ListConfigKey<V> extends AbstractCollectionConfigKey<List<? extends V>,List<Object>,V> {
-
-    private static final long serialVersionUID = 751024268729803210L;
-    @SuppressWarnings("unused")
-    private static final Logger log = LoggerFactory.getLogger(ListConfigKey.class);
-    
-    public ListConfigKey(Class<V> subType, String name) {
-        this(subType, name, name, null);
-    }
-
-    public ListConfigKey(Class<V> subType, String name, String description) {
-        this(subType, name, description, null);
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public ListConfigKey(Class<V> subType, String name, String description, List<? extends V> defaultValue) {
-        super((Class)List.class, subType, name, description, (List<V>)defaultValue);
-    }
-
-    @Override
-    protected List<Object> merge(boolean unmodifiable, Iterable<?>... sets) {
-        MutableList<Object> result = MutableList.of();
-        for (Iterable<?> set: sets) result.addAll(set);
-        if (unmodifiable) return result.asUnmodifiable();
-        return result;
-    }
-
-    public interface ListModification<T> extends StructuredModification<ListConfigKey<T>>, List<T> {
-    }
-    
-    public static class ListModifications extends StructuredModifications {
-        /** when passed as a value to a ListConfigKey, causes each of these items to be added.
-         * if you have just one, no need to wrap in a mod. */
-        // to prevent confusion (e.g. if a list is passed) we require two objects here.
-        public static final <T> ListModification<T> add(final T o1, final T o2, final T ...oo) {
-            List<T> l = new ArrayList<T>();
-            l.add(o1); l.add(o2);
-            for (T o: oo) l.add(o);
-            return new ListModificationBase<T>(l, false);
-        }
-        /** when passed as a value to a ListConfigKey, causes each of these items to be added */
-        public static final <T> ListModification<T> addAll(final Collection<T> items) { 
-            return new ListModificationBase<T>(items, false);
-        }
-        /** when passed as a value to a ListConfigKey, causes the items to be added as a single element in the list */
-        public static final <T> ListModification<T> addItem(final T item) {
-            return new ListModificationBase<T>(Collections.singletonList(item), false);
-        }
-        /** when passed as a value to a ListConfigKey, causes the list to be cleared and these items added */
-        public static final <T> ListModification<T> set(final Collection<T> items) { 
-            return new ListModificationBase<T>(items, true);
-        }
-    }
-
-    public static class ListModificationBase<T> extends ArrayList<T> implements ListModification<T> {
-        private static final long serialVersionUID = 7131812294560446235L;
-        private final boolean clearFirst;
-        public ListModificationBase(Collection<T> delegate, boolean clearFirst) {
-            super(delegate);
-            this.clearFirst = clearFirst;
-        }
-        @SuppressWarnings({ "rawtypes", "unchecked" })
-        @Override
-        public Object applyToKeyInMap(ListConfigKey<T> key, Map target) {
-            if (clearFirst) {
-                StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing();
-                clearing.applyToKeyInMap(key, target);
-            }
-            for (T o: this) target.put(key.subKey(), o);
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/MapConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/MapConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/MapConfigKey.java
deleted file mode 100644
index 96216ff..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/MapConfigKey.java
+++ /dev/null
@@ -1,206 +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.core.config;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.internal.AbstractStructuredConfigKey;
-import org.apache.brooklyn.util.collections.Jsonya;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Maps;
-
-/** A config key which represents a map, where contents can be accessed directly via subkeys.
- * Items added directly to the map must be of type map, and can be updated by:
- * <ul>
- * <li>Putting individual subkeys ({@link SubElementConfigKey})
- * <li>Passing an an appropriate {@link MapModification} from {@link MapModifications}
- *      to clear, clear-and-set, or update
- * <li>Setting a value against a dot-extension of the key
- *     (e.g. setting <code>a.map.subkey=1</code> will cause getConfig(a.map[type=MapConfigKey])
- *     to return {subkey=1}; but note the above are preferred where possible)  
- * <li>Setting a map directly against the MapConfigKey (but note that the above are preferred where possible)
- * </ul>
- */
-//TODO Create interface
-public class MapConfigKey<V> extends AbstractStructuredConfigKey<Map<String,V>,Map<String,Object>,V> {
-    
-    private static final long serialVersionUID = -6126481503795562602L;
-    private static final Logger log = LoggerFactory.getLogger(MapConfigKey.class);
-    
-    public MapConfigKey(Class<V> subType, String name) {
-        this(subType, name, name, null);
-    }
-
-    public MapConfigKey(Class<V> subType, String name, String description) {
-        this(subType, name, description, null);
-    }
-
-    // TODO it isn't clear whether defaultValue is an initialValue, or a value to use when map is empty
-    // probably the latter, currently ... but maybe better to say that map configs are never null, 
-    // and defaultValue is really an initial value?
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public MapConfigKey(Class<V> subType, String name, String description, Map<String, V> defaultValue) {
-        super((Class)Map.class, subType, name, description, defaultValue);
-    }
-
-    public ConfigKey<V> subKey(String subName) {
-        return super.subKey(subName);
-    }
-    public ConfigKey<V> subKey(String subName, String description) {
-        return super.subKey(subName, description);
-    }   
-
-    @SuppressWarnings("unchecked")
-    @Override
-    protected Map<String, Object> extractValueMatchingThisKey(Object potentialBase, ExecutionContext exec, boolean coerce) throws InterruptedException, ExecutionException {
-        if (coerce) {
-            potentialBase = resolveValue(potentialBase, exec);
-        }
-
-        if (potentialBase==null) return null;
-        if (potentialBase instanceof Map<?,?>) {
-            return Maps.<String,Object>newLinkedHashMap( (Map<String,Object>) potentialBase);
-        }
-        log.warn("Unable to extract "+getName()+" as Map; it is "+potentialBase.getClass().getName()+" "+potentialBase);
-        return null;
-    }
-    
-    @Override
-    protected Map<String, Object> merge(Map<String, Object> base, Map<String, Object> subkeys, boolean unmodifiable) {
-        Map<String, Object> result = MutableMap.copyOf(base).add(subkeys);
-        if (unmodifiable) result = Collections.unmodifiableMap(result);
-        return result;
-    }
-    
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public Object applyValueToMap(Object value, Map target) {
-        if (value == null)
-            return null;
-        if (value instanceof StructuredModification)
-            return ((StructuredModification)value).applyToKeyInMap(this, target);
-        if (value instanceof Map.Entry)
-            return applyEntryValueToMap((Map.Entry)value, target);
-        if (!(value instanceof Map)) 
-            throw new IllegalArgumentException("Cannot set non-map entries "+value+" on "+this);
-        
-        Map result = new MutableMap();
-        for (Object entry: ((Map)value).entrySet()) {
-            Map.Entry entryT = (Map.Entry)entry;
-            result.put(entryT.getKey(), applyEntryValueToMap(entryT, target));
-        }
-        if (((Map)value).isEmpty() && !isSet(target))
-            target.put(this, MutableMap.of());
-        return result;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected Object applyEntryValueToMap(Entry value, Map target) {
-        Object k = value.getKey();
-        if (acceptsSubkeyStronglyTyped(k)) {
-            // do nothing
-        } else if (k instanceof ConfigKey<?>) {
-            k = subKey( ((ConfigKey<?>)k).getName() );
-        } else if (k instanceof String) {
-            k = subKey((String)k);
-        } else {
-            // supplier or other unexpected value
-            if (k instanceof Supplier) {
-                Object mapAtRoot = target.get(this);
-                if (mapAtRoot==null) {
-                    mapAtRoot = new LinkedHashMap();
-                    target.put(this, mapAtRoot);
-                }
-                // TODO above is not thread-safe, and below is assuming synching on map 
-                // is the best way to prevent CME's, which is often but not always true
-                if (mapAtRoot instanceof Map) {
-                    if (mapAtRoot instanceof ConcurrentMap) {
-                        return ((Map)mapAtRoot).put(k, value.getValue());
-                    } else {
-                        synchronized (mapAtRoot) {
-                            return ((Map)mapAtRoot).put(k, value.getValue());
-                        }
-                    }
-                }
-            }
-            log.warn("Unexpected subkey "+k+" being inserted into "+this+"; ignoring");
-            k = null;
-        }
-        if (k!=null)
-            return target.put(k, value.getValue());
-        else 
-            return null;
-    }
-
-    public interface MapModification<V> extends StructuredModification<MapConfigKey<V>>, Map<String,V> {
-    }
-    
-    public static class MapModifications extends StructuredModifications {
-        /** when passed as a value to a MapConfigKey, causes each of these items to be put 
-         * (this Mod is redundant as no other value is really sensible) */
-        public static final <V> MapModification<V> put(final Map<String,V> itemsToPutInMapReplacing) { 
-            return new MapModificationBase<V>(itemsToPutInMapReplacing, false);
-        }
-        /** when passed as a value to a MapConfigKey, causes the map to be cleared and these items added */
-        public static final <V> MapModification<V> set(final Map<String,V> itemsToPutInMapAfterClearing) {
-            return new MapModificationBase<V>(itemsToPutInMapAfterClearing, true);
-        }
-        /** when passed as a value to a MapConfigKey, causes the items to be added to the underlying map
-         * using {@link Jsonya} add semantics (combining maps and lists) */
-        public static final <V> MapModification<V> add(final Map<String,V> itemsToAdd) {
-            return new MapModificationBase<V>(itemsToAdd, false /* ignored */) {
-                private static final long serialVersionUID = 1L;
-                @SuppressWarnings("rawtypes")
-                @Override
-                public Object applyToKeyInMap(MapConfigKey<V> key, Map target) {
-                    return key.applyValueToMap(Jsonya.of(key.rawValue(target)).add(this).getRootMap(), target);
-                }
-            };
-        }
-    }
-
-    public static class MapModificationBase<V> extends LinkedHashMap<String,V> implements MapModification<V> {
-        private static final long serialVersionUID = -1670820613292286486L;
-        private final boolean clearFirst;
-        public MapModificationBase(Map<String,V> delegate, boolean clearFirst) {
-            super(delegate);
-            this.clearFirst = clearFirst;
-        }
-        @SuppressWarnings({ "rawtypes" })
-        @Override
-        public Object applyToKeyInMap(MapConfigKey<V> key, Map target) {
-            if (clearFirst) {
-                StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing();
-                clearing.applyToKeyInMap(key, target);
-            }
-            return key.applyValueToMap(new LinkedHashMap<String,V>(this), target);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
deleted file mode 100644
index 59ca6af..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
+++ /dev/null
@@ -1,172 +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.core.config;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public final class Sanitizer {
-
-    /**
-     * Names that, if they appear anywhere in an attribute/config/field
-     * indicates that it may be private, so should not be logged etc.
-     */
-    public static final List<String> SECRET_NAMES = ImmutableList.of(
-            "password", 
-            "passwd", 
-            "credential", 
-            "secret", 
-            "private",
-            "access.cert", 
-            "access.key");
-
-    public static final Predicate<Object> IS_SECRET_PREDICATE = new IsSecretPredicate();
-
-    private static class IsSecretPredicate implements Predicate<Object> {
-        @Override
-        public boolean apply(Object name) {
-            String lowerName = name.toString().toLowerCase();
-            for (String secretName : SECRET_NAMES) {
-                if (lowerName.contains(secretName))
-                    return true;
-            }
-            return false;
-        }
-    };
-
-    /**
-     * Kept only in case this anonymous inner class has made it into any persisted state.
-     * 
-     * @deprecated since 0.7.0
-     */
-    @Deprecated
-    @SuppressWarnings("unused")
-    private static final Predicate<Object> IS_SECRET_PREDICATE_DEPRECATED = new Predicate<Object>() {
-        @Override
-        public boolean apply(Object name) {
-            String lowerName = name.toString().toLowerCase();
-            for (String secretName : SECRET_NAMES) {
-                if (lowerName.contains(secretName))
-                    return true;
-            }
-            return false;
-        }
-    };
-
-    public static Sanitizer newInstance(Predicate<Object> sanitizingNeededCheck) {
-        return new Sanitizer(sanitizingNeededCheck);
-    }
-    
-    public static Sanitizer newInstance(){
-        return newInstance(IS_SECRET_PREDICATE);
-    }
-
-    public static Map<String, Object> sanitize(ConfigBag input) {
-        return sanitize(input.getAllConfig());
-    }
-
-    public static <K> Map<K, Object> sanitize(Map<K, ?> input) {
-        return sanitize(input, Sets.newHashSet());
-    }
-
-    static <K> Map<K, Object> sanitize(Map<K, ?> input, Set<Object> visited) {
-        return newInstance().apply(input, visited);
-    }
-    
-    private Predicate<Object> predicate;
-
-    private Sanitizer(Predicate<Object> sanitizingNeededCheck) {
-        predicate = sanitizingNeededCheck;
-    }
-
-    public <K> Map<K, Object> apply(Map<K, ?> input) {
-        return apply(input, Sets.newHashSet());
-    }
-
-    private <K> Map<K, Object> apply(Map<K, ?> input, Set<Object> visited) {
-        Map<K, Object> result = Maps.newLinkedHashMap();
-        for (Map.Entry<K, ?> e : input.entrySet()) {
-            if (predicate.apply(e.getKey())){
-                result.put(e.getKey(), "xxxxxxxx");
-                continue;
-            } 
-            
-            // need to compare object reference, not equality since we may miss some.
-            // not a perfect identifier, but very low probability of collision.
-            if (visited.contains(System.identityHashCode(e.getValue()))) {
-                result.put(e.getKey(), e.getValue());
-                continue;
-            }
-
-            visited.add(System.identityHashCode(e.getValue()));
-            if (e.getValue() instanceof Map) {
-                result.put(e.getKey(), apply((Map<?, ?>) e.getValue(), visited));
-            } else if (e.getValue() instanceof List) {
-                result.put(e.getKey(), applyList((List<?>) e.getValue(), visited));
-            } else if (e.getValue() instanceof Set) {
-                result.put(e.getKey(), applySet((Set<?>) e.getValue(), visited));
-            } else {
-                result.put(e.getKey(), e.getValue());
-            }
-        }
-        return result;
-    }
-    
-    private List<Object> applyIterable(Iterable<?> input, Set<Object> visited){
-        List<Object> result = Lists.newArrayList();
-        for(Object o : input){
-            if(visited.contains(System.identityHashCode(o))){
-                result.add(o);
-                continue;
-            }
-
-            visited.add(System.identityHashCode(o));
-            if (o instanceof Map) {
-                result.add(apply((Map<?, ?>) o, visited));
-            } else if (o instanceof List) {
-                result.add(applyList((List<?>) o, visited));
-            } else if (o instanceof Set) {
-                result.add(applySet((Set<?>) o, visited));
-            } else {
-                result.add(o);
-            }
-
-        }
-        return result;
-    }
-    
-    private List<Object> applyList(List<?> input, Set<Object> visited) {
-       return applyIterable(input, visited);
-    }
-    
-    private Set<Object> applySet(Set<?> input, Set<Object> visited) {
-        Set<Object> result = Sets.newLinkedHashSet();
-        result.addAll(applyIterable(input, visited));
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SetConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SetConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SetConfigKey.java
deleted file mode 100644
index f199c38..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SetConfigKey.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 org.apache.brooklyn.core.config;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.core.config.internal.AbstractCollectionConfigKey;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** A config key representing a set of values. 
- * If a value is set using this *typed* key, it is _added_ to the set
- * (with a warning issued if a collection is passed in).
- * If a value is set against an equivalent *untyped* key which *is* a collection,
- * it will be treated as a set upon discovery and used as a base to which subkey values are added.
- * If a value is discovered against this key which is not a map or collection,
- * it is ignored.
- * <p>
- * To add all items in a collection, to add a collection as a single element, 
- * to clear the list, or to set a collection (clearing first), 
- * use the relevant {@link SetModification} in {@link SetModifications}.
- * <p>  
- * Specific values can be added in a replaceable way by referring to a subkey.
- */
-//TODO Create interface
-public class SetConfigKey<V> extends AbstractCollectionConfigKey<Set<? extends V>, Set<Object>, V> {
-
-    private static final long serialVersionUID = 751024268729803210L;
-    @SuppressWarnings("unused")
-    private static final Logger log = LoggerFactory.getLogger(SetConfigKey.class);
-
-    public SetConfigKey(Class<V> subType, String name) {
-        this(subType, name, name, null);
-    }
-
-    public SetConfigKey(Class<V> subType, String name, String description) {
-        this(subType, name, description, null);
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public SetConfigKey(Class<V> subType, String name, String description, Set<? extends V> defaultValue) {
-        super((Class)Set.class, subType, name, description, defaultValue);
-    }
-
-    @Override
-    protected Set<Object> merge(boolean unmodifiable, Iterable<?>... sets) {
-        MutableSet<Object> result = MutableSet.of();
-        for (Iterable<?> set: sets) result.addAll(set);
-        if (unmodifiable) return result.asUnmodifiable();
-        return result;
-    }
-    
-    public interface SetModification<T> extends StructuredModification<SetConfigKey<T>>, Set<T> {
-    }
-    
-    public static class SetModifications extends StructuredModifications {
-        /** when passed as a value to a SetConfigKey, causes each of these items to be added.
-         * if you have just one, no need to wrap in a mod. */
-        // to prevent confusion (e.g. if a set is passed) we require two objects here.
-        public static final <T> SetModification<T> add(final T o1, final T o2, final T ...oo) {
-            Set<T> l = new LinkedHashSet<T>();
-            l.add(o1); l.add(o2);
-            for (T o: oo) l.add(o);
-            return new SetModificationBase<T>(l, false);
-        }
-        /** when passed as a value to a SetConfigKey, causes each of these items to be added */
-        public static final <T> SetModification<T> addAll(final Collection<T> items) { 
-            return new SetModificationBase<T>(items, false);
-        }
-        /** when passed as a value to a SetConfigKey, causes the items to be added as a single element in the set */
-        public static final <T> SetModification<T> addItem(final T item) {
-            return new SetModificationBase<T>(Collections.singleton(item), false);
-        }
-        /** when passed as a value to a SetConfigKey, causes the set to be cleared and these items added */
-        public static final <T> SetModification<T> set(final Collection<T> items) { 
-            return new SetModificationBase<T>(items, true);
-        }
-    }
-
-    public static class SetModificationBase<T> extends LinkedHashSet<T> implements SetModification<T> {
-        private static final long serialVersionUID = 2715025591272457705L;
-        private final boolean clearFirst;
-        public SetModificationBase(Collection<T> delegate, boolean clearFirst) {
-            super(delegate);
-            this.clearFirst = clearFirst;
-        }
-        @SuppressWarnings({ "rawtypes", "unchecked" })
-        @Override
-        public Object applyToKeyInMap(SetConfigKey<T> key, Map target) {
-            if (clearFirst) {
-                StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing();
-                clearing.applyToKeyInMap(key, target);
-            }
-            for (T o: this) target.put(key.subKey(), o);
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/StructuredConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/StructuredConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/StructuredConfigKey.java
deleted file mode 100644
index 7384b45..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/StructuredConfigKey.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 org.apache.brooklyn.core.config;
-
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-public interface StructuredConfigKey {
-    
-    /** for internal use */
-    Object applyValueToMap(Object value, @SuppressWarnings("rawtypes") Map target);
-    
-    boolean acceptsKeyMatch(Object contender);
-    boolean acceptsSubkey(Object contender);
-    boolean acceptsSubkeyStronglyTyped(Object contender);
-
-    public static class StructuredModifications {
-        /** when passed as a value to a StructuredConfigKey, causes the structure to be cleared */
-        @SuppressWarnings("unchecked")
-        public static final <U extends StructuredConfigKey,T extends StructuredModification<U>> T clearing() {
-            return (T) new StructuredModification<U>() {
-                @SuppressWarnings("rawtypes")
-                @Override
-                public Object applyToKeyInMap(U key, Map target) {
-                    Set keysToRemove = new LinkedHashSet();
-                    for (Object k : target.keySet()) {
-                        if (key.acceptsKeyMatch(k) || key.acceptsSubkey(k))
-                            keysToRemove.add(k);
-                    }
-                    for (Object k : keysToRemove) {
-                        target.remove(k);
-                    }
-                    return null;
-                }
-            };
-        }
-    }
-    
-    public interface StructuredModification<T extends StructuredConfigKey> {
-        Object applyToKeyInMap(T key, @SuppressWarnings("rawtypes") Map target);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SubElementConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SubElementConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SubElementConfigKey.java
deleted file mode 100644
index 1c0b525..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/SubElementConfigKey.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 org.apache.brooklyn.core.config;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-
-@SuppressWarnings("rawtypes")
-public class SubElementConfigKey<T> extends BasicConfigKey<T> {
-    
-    private static final long serialVersionUID = -1587240876351450665L;
-    
-    public final ConfigKey parent;
-
-    public SubElementConfigKey(ConfigKey parent, Class<T> type, String name) {
-        this(parent, type, name, name, null);
-    }
-    public SubElementConfigKey(ConfigKey parent, Class<T> type, String name, String description) {
-        this(parent, type, name, description, null);
-    }
-    public SubElementConfigKey(ConfigKey parent, Class<T> type, String name, String description, T defaultValue) {
-        super(type, name, description, defaultValue);
-        this.parent = parent;
-    }
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    public T extractValue(Map vals, ExecutionContext exec) {
-        if (vals.containsKey(this)) return super.extractValue(vals, exec);
-        if (parent instanceof StructuredConfigKey) {
-            // look for subkey in map at parent, in the event that the parent was set as an unstructured key
-            Object parentVals = vals.get(parent);
-            if (parentVals instanceof Map) {
-                String subName = getName().substring(parent.getName().length()+1);
-                if ( ((Map) parentVals).containsKey(subName) ) {
-                    try {
-                        return (T) resolveValue( ((Map) parentVals).get(subName), exec );
-                    } catch (Exception e) { throw Exceptions.propagate(e); }
-                }
-            }
-        }
-        return null;
-    }
-    
-    @Override
-    public boolean isSet(Map<?,?> vals) {
-        if (super.isSet(vals)) return true;
-        if (parent instanceof StructuredConfigKey) {
-            // look for subkey in map at parent, in the event that the parent was set as an unstructured key
-            Object parentVals = vals.get(parent);
-            if (parentVals instanceof Map) {
-                String subName = getName().substring(parent.getName().length()+1);
-                if ( ((Map) parentVals).containsKey(subName) ) return true;
-            }
-        }
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/WrappedConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/WrappedConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/WrappedConfigKey.java
deleted file mode 100644
index 0f09ccd..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/WrappedConfigKey.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 org.apache.brooklyn.core.config;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-
-import com.google.common.base.Preconditions;
-
-public class WrappedConfigKey<T> implements HasConfigKey<T> {
-
-    private final ConfigKey<T> key;
-    
-    public WrappedConfigKey(ConfigKey<T> key) {
-        this.key = Preconditions.checkNotNull(key);
-    }
-
-    @Override
-    public ConfigKey<T> getConfigKey() {
-        return key;
-    }
-
-    @Override
-    public String toString() {
-        return key.toString()+"(wrapped)";
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/AbstractExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/AbstractExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/AbstractExternalConfigSupplier.java
deleted file mode 100644
index 18b25eb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/AbstractExternalConfigSupplier.java
+++ /dev/null
@@ -1,45 +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.core.config.external;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-
-/**
- * Default superclass for all {@link ExternalConfigSupplier} implementations.
- */
-abstract public class AbstractExternalConfigSupplier implements ExternalConfigSupplier {
-
-    private final ManagementContext managementContext;
-    private final String name;
-
-    protected AbstractExternalConfigSupplier(ManagementContext managementContext, String name) {
-        this.managementContext = managementContext;
-        this.name = name;
-    }
-
-    public ManagementContext getManagementContext() {
-        return managementContext;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/ExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/ExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/ExternalConfigSupplier.java
deleted file mode 100644
index c43f7ed..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/ExternalConfigSupplier.java
+++ /dev/null
@@ -1,34 +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.core.config.external;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provider of "externalised" entity configuration that is resolved at runtime.
- *
- * @since 0.8.0
- */
-@Beta
-public interface ExternalConfigSupplier {
-
-    String getName();
-    String get(String key);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/InPlaceExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/InPlaceExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/InPlaceExternalConfigSupplier.java
deleted file mode 100644
index a5445e9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/InPlaceExternalConfigSupplier.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.core.config.external;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-
-/**
- * Instances are populated via sub-keys specified directly in the <tt>brooklyn.properties</tt> file:
- *
- * <pre>
- * brooklyn.external.foo = brooklyn.management.config.external.InPlaceConfigSupplier
- * brooklyn.external.foo.key1 = value1
- * brooklyn.external.foo.key2 = value2
- * </pre>
- *
- * This will instantiate an <code>InPlaceExternalConfigSupplier</code> populated with values for <code>key1</code>
- * and <code>key2</code>. Note that the <code>brooklyn.external.&lt;name&gt;</code> prefix is stripped.
- */
-public class InPlaceExternalConfigSupplier extends AbstractExternalConfigSupplier {
-
-    private final Map<String, String> config;
-
-    public InPlaceExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) {
-        super(managementContext, name);
-        this.config = config;
-    }
-
-    public String get(String key) {
-        return config.get(key);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/PropertiesFileExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/PropertiesFileExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/PropertiesFileExternalConfigSupplier.java
deleted file mode 100644
index f76cdf6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/PropertiesFileExternalConfigSupplier.java
+++ /dev/null
@@ -1,68 +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.core.config.external;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.stream.Streams;
-
-
-/**
- * Instances are populated from a plain java properties file named in the passed <code>config</code> map
- * under the <code>propertiesUrl</code> key:
- *
- * <pre>
- * brooklyn.external.foo = brooklyn.management.config.external.PropertiesFileExternalConfigSupplier
- * brooklyn.external.foo.propertiesUrl = http://brooklyn.example.com/config/foo.properties
- * </pre>
- */
-public class PropertiesFileExternalConfigSupplier extends AbstractExternalConfigSupplier {
-
-    public static final String PROPERTIES_URL = "propertiesUrl";
-
-    private final Properties properties;
-
-    public PropertiesFileExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) throws IOException {
-        super(managementContext, name);
-        this.properties = loadProperties(config.get(PROPERTIES_URL));
-    }
-
-    public String get(String key) {
-        return properties.getProperty(key);
-    }
-
-    private static Properties loadProperties(String propertiesUrl) throws IOException {
-        InputStream is = null;
-        try {
-            is = new URL(propertiesUrl).openStream();
-            Properties p = new Properties();
-            p.load(is);
-            return p;
-
-        } finally {
-            Streams.closeQuietly(is);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultAppIdExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultAppIdExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultAppIdExternalConfigSupplier.java
deleted file mode 100644
index c71d57a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultAppIdExternalConfigSupplier.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 org.apache.brooklyn.core.config.external.vault;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.gson.JsonObject;
-
-public class VaultAppIdExternalConfigSupplier extends VaultExternalConfigSupplier {
-
-    private static final Logger LOG = LoggerFactory.getLogger(VaultAppIdExternalConfigSupplier.class);
-
-    public VaultAppIdExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) {
-        super(managementContext, name, config);
-    }
-
-    protected String initAndLogIn(Map<String, String> config) {
-        List<String> errors = Lists.newArrayListWithCapacity(1);
-        String appId = config.get("appId");
-        if (Strings.isBlank(appId)) errors.add("missing configuration 'appId'");
-        if (!errors.isEmpty()) {
-            String message = String.format("Problem configuration Vault external config supplier '%s': %s",
-                    name, Joiner.on(System.lineSeparator()).join(errors));
-            throw new IllegalArgumentException(message);
-        }
-
-        String userId = getUserId(config);
-
-        LOG.info("Config supplier named {} using Vault at {} appID {} userID {} path {}", new Object[] {
-                name, endpoint, appId, userId, path });
-
-        String path = "v1/auth/app-id/login";
-        ImmutableMap<String, String> requestData = ImmutableMap.of("app_id", appId, "user_id", userId);
-        ImmutableMap<String, String> headers = MINIMAL_HEADERS;
-        JsonObject response = apiPost(path, headers, requestData);
-        return response.getAsJsonObject("auth").get("client_token").getAsString();
-    }
-
-    private String getUserId(Map<String, String> config) {
-        String userId = config.get("userId");
-        if (Strings.isBlank(userId))
-            userId = getUserIdFromMacAddress();
-        return userId;
-    }
-
-    private static String getUserIdFromMacAddress() {
-        byte[] mac;
-        try {
-            InetAddress ip = InetAddress.getLocalHost();
-            NetworkInterface network = NetworkInterface.getByInetAddress(ip);
-            mac = network.getHardwareAddress();
-        } catch (Throwable t) {
-            throw Exceptions.propagate(t);
-        }
-        StringBuilder sb = new StringBuilder();
-        for (byte aMac : mac) {
-            sb.append(String.format("%02x", aMac));
-        }
-        return sb.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultExternalConfigSupplier.java
deleted file mode 100644
index f58dbc5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultExternalConfigSupplier.java
+++ /dev/null
@@ -1,133 +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.core.config.external.vault;
-
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.config.external.AbstractExternalConfigSupplier;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.http.HttpTool;
-import org.apache.brooklyn.util.http.HttpToolResponse;
-import org.apache.brooklyn.util.net.Urls;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.http.client.HttpClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-public abstract class VaultExternalConfigSupplier extends AbstractExternalConfigSupplier {
-    public static final String CHARSET_NAME = "UTF-8";
-    public static final ImmutableMap<String, String> MINIMAL_HEADERS = ImmutableMap.of(
-            "Content-Type", "application/json; charset=" + CHARSET_NAME,
-            "Accept", "application/json",
-            "Accept-Charset", CHARSET_NAME);
-    private static final Logger LOG = LoggerFactory.getLogger(VaultExternalConfigSupplier.class);
-    protected final Map<String, String> config;
-    protected final String name;
-    protected final HttpClient httpClient;
-    protected final Gson gson;
-    protected final String endpoint;
-    protected final String path;
-    protected final String token;
-    protected final ImmutableMap<String, String> headersWithToken;
-
-    public VaultExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) {
-        super(managementContext, name);
-        this.config = config;
-        this.name = name;
-        httpClient = HttpTool.httpClientBuilder().build();
-        gson = new GsonBuilder().create();
-
-        List<String> errors = Lists.newArrayListWithCapacity(2);
-        endpoint = config.get("endpoint");
-        if (Strings.isBlank(endpoint)) errors.add("missing configuration 'endpoint'");
-        path = config.get("path");
-        if (Strings.isBlank(path)) errors.add("missing configuration 'path'");
-        if (!errors.isEmpty()) {
-            String message = String.format("Problem configuration Vault external config supplier '%s': %s",
-                    name, Joiner.on(System.lineSeparator()).join(errors));
-            throw new IllegalArgumentException(message);
-        }
-
-        token = initAndLogIn(config);
-        headersWithToken = ImmutableMap.<String, String>builder()
-                .putAll(MINIMAL_HEADERS)
-                .put("X-Vault-Token", token)
-                .build();
-    }
-
-    protected abstract String initAndLogIn(Map<String, String> config);
-
-    @Override
-    public String get(String key) {
-        JsonObject response = apiGet(Urls.mergePaths("v1", path), headersWithToken);
-        return response.getAsJsonObject("data").get(key).getAsString();
-    }
-
-    protected JsonObject apiGet(String path, ImmutableMap<String, String> headers) {
-        try {
-            String uri = Urls.mergePaths(endpoint, path);
-            LOG.debug("Vault request - GET: {}", uri);
-            LOG.debug("Vault request - headers: {}", headers.toString());
-            HttpToolResponse response = HttpTool.httpGet(httpClient, Urls.toUri(uri), headers);
-            LOG.debug("Vault response - code: {} {}", new Object[]{Integer.toString(response.getResponseCode()), response.getReasonPhrase()});
-            LOG.debug("Vault response - headers: {}", response.getHeaderLists().toString());
-            String responseBody = new String(response.getContent(), CHARSET_NAME);
-            LOG.debug("Vault response - body: {}", responseBody);
-            if (HttpTool.isStatusCodeHealthy(response.getResponseCode())) {
-                return gson.fromJson(responseBody, JsonObject.class);
-            } else {
-                throw new IllegalStateException("HTTP request returned error");
-            }
-        } catch (UnsupportedEncodingException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    protected JsonObject apiPost(String path, ImmutableMap<String, String> headers, ImmutableMap<String, String> requestData) {
-        try {
-            String body = gson.toJson(requestData);
-            String uri = Urls.mergePaths(endpoint, path);
-            LOG.debug("Vault request - POST: {}", uri);
-            LOG.debug("Vault request - headers: {}", headers.toString());
-            LOG.debug("Vault request - body: {}", body);
-            HttpToolResponse response = HttpTool.httpPost(httpClient, Urls.toUri(uri), headers, body.getBytes(CHARSET_NAME));
-            LOG.debug("Vault response - code: {} {}", new Object[]{Integer.toString(response.getResponseCode()), response.getReasonPhrase()});
-            LOG.debug("Vault response - headers: {}", response.getHeaderLists().toString());
-            String responseBody = new String(response.getContent(), CHARSET_NAME);
-            LOG.debug("Vault response - body: {}", responseBody);
-            if (HttpTool.isStatusCodeHealthy(response.getResponseCode())) {
-                return gson.fromJson(responseBody, JsonObject.class);
-            } else {
-                throw new IllegalStateException("HTTP request returned error");
-            }
-        } catch (UnsupportedEncodingException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultTokenExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultTokenExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultTokenExternalConfigSupplier.java
deleted file mode 100644
index d17aad5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultTokenExternalConfigSupplier.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 org.apache.brooklyn.core.config.external.vault;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.text.Strings;
-
-public class VaultTokenExternalConfigSupplier extends VaultExternalConfigSupplier {
-    public VaultTokenExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) {
-        super(managementContext, name, config);
-    }
-
-    @Override
-    protected String initAndLogIn(Map<String, String> config) {
-        String tokenProperty = config.get("token");
-        checkArgument(Strings.isNonBlank(tokenProperty), "property not set: token");
-        return tokenProperty;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultUserPassExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultUserPassExternalConfigSupplier.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultUserPassExternalConfigSupplier.java
deleted file mode 100644
index 15a8576..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/external/vault/VaultUserPassExternalConfigSupplier.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 org.apache.brooklyn.core.config.external.vault;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.gson.JsonObject;
-
-public class VaultUserPassExternalConfigSupplier extends VaultExternalConfigSupplier {
-    public VaultUserPassExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config) {
-        super(managementContext, name, config);
-    }
-
-    @Override
-    protected String initAndLogIn(Map<String, String> config) {
-        List<String> errors = Lists.newArrayListWithCapacity(2);
-        String username = config.get("username");
-        if (Strings.isBlank(username)) errors.add("missing configuration 'username'");
-        String password = config.get("password");
-        if (Strings.isBlank(username)) errors.add("missing configuration 'password'");
-        if (!errors.isEmpty()) {
-            String message = String.format("Problem configuration Vault external config supplier '%s': %s",
-                    name, Joiner.on(System.lineSeparator()).join(errors));
-            throw new IllegalArgumentException(message);
-        }
-
-        String path = "v1/auth/userpass/login/" + username;
-        ImmutableMap<String, String> requestData = ImmutableMap.of("password", password);
-        ImmutableMap<String, String> headers = MINIMAL_HEADERS;
-        JsonObject response = apiPost(path, headers, requestData);
-        return response.getAsJsonObject("auth").get("client_token").getAsString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractCollectionConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractCollectionConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractCollectionConfigKey.java
deleted file mode 100644
index cc536e8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractCollectionConfigKey.java
+++ /dev/null
@@ -1,120 +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.core.config.internal;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.SubElementConfigKey;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Iterables;
-
-public abstract class AbstractCollectionConfigKey<T, RawT extends Collection<Object>, V> extends AbstractStructuredConfigKey<T, RawT, V> {
-
-    private static final long serialVersionUID = 8225955960120637643L;
-    private static final Logger log = LoggerFactory.getLogger(AbstractCollectionConfigKey.class);
-    
-    public AbstractCollectionConfigKey(Class<T> type, Class<V> subType, String name, String description, T defaultValue) {
-        super(type, subType, name, description, defaultValue);
-    }
-
-    public ConfigKey<V> subKey() {
-        String subName = Identifiers.makeRandomId(8);
-        return new SubElementConfigKey<V>(this, subType, getName()+"."+subName, "element of "+getName()+", uid "+subName, null);
-    }
-
-    protected abstract RawT merge(boolean unmodifiable, Iterable<?> ...items);
-
-    @Override
-    protected RawT merge(RawT base, Map<String, Object> subkeys, boolean unmodifiable) {
-        return merge(unmodifiable, base, subkeys.values());
-    }
-
-    @Override
-    protected RawT extractValueMatchingThisKey(Object potentialBase, ExecutionContext exec, boolean coerce) throws InterruptedException, ExecutionException {
-        if (coerce) {
-            potentialBase = resolveValue(potentialBase, exec);
-        }
-
-        if (potentialBase==null) return null;
-        if (potentialBase instanceof Map<?,?>) {
-            return merge(false, ((Map<?,?>) potentialBase).values() );
-        } else if (potentialBase instanceof Collection<?>) {
-            return merge(false, (Collection<?>) potentialBase );
-        }
-        log.warn("Unable to extract "+getName()+" as Collection; it is "+potentialBase.getClass().getName()+" "+potentialBase);
-        return null;
-    }
-
-    @SuppressWarnings({ "rawtypes" })
-    @Override
-    public Object applyValueToMap(Object value, Map target) {
-        return applyValueToMap(value, target, false);
-    }
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected Object applyValueToMap(Object value, Map target, boolean isInCollection) {
-        if (value instanceof StructuredModification) {
-            return ((StructuredModification)value).applyToKeyInMap(this, target);
-        } else if ((value instanceof Iterable) && (!isInCollection)) {
-            // collections set _here_ (not in subkeys) get added
-            boolean isSet = isSet(target);
-            if (isSet) {
-                String warning = "Discouraged undecorated setting of a collection to in-use StructuredConfigKey "+this+": use SetModification.{set,add}. " +
-                    "Defaulting to 'add'. Look at debug logging for call stack.";
-                log.warn(warning);
-                if (log.isDebugEnabled())
-                    log.debug("Trace for: "+warning, new Throwable("Trace for: "+warning));
-            }
-            Iterable<?> valueI = (Iterable<?>)value;
-            for (Object v: valueI) { 
-                // don't continue to recurse into these collections, however
-                applyValueToMap(v, target, true);
-            }
-            if (Iterables.isEmpty(valueI) && !isSet) {
-                target.put(this, MutableSet.of());
-            }
-            return null;
-        } else if (value instanceof TaskAdaptable) {
-            boolean isSet = isSet(target);
-            if (isSet) {
-                String warning = "Discouraged undecorated setting of a task to in-use StructuredConfigKey "+this+": use SetModification.{set,add}. " +
-                    "Defaulting to 'add'. Look at debug logging for call stack.";
-                log.warn(warning);
-                if (log.isDebugEnabled())
-                    log.debug("Trace for: "+warning, new Throwable("Trace for: "+warning));
-            }
-            // just add to set, using anonymous key
-            target.put(subKey(), value);
-            return null;
-        } else {
-            // just add to set, using anonymous key
-            target.put(subKey(), value);
-            return null;
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
deleted file mode 100644
index fd02fc1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
+++ /dev/null
@@ -1,110 +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.core.config.internal;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.Future;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigMap;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.config.StructuredConfigKey;
-import org.apache.brooklyn.core.entity.internal.ConfigMapViewWithStringKeys;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractConfigMapImpl implements ConfigMap {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigMapImpl.class);
-    
-    protected final ConfigMapViewWithStringKeys mapViewWithStringKeys = new ConfigMapViewWithStringKeys(this);
-    
-    /**
-     * Map of configuration information that is defined at start-up time for the entity. These
-     * configuration parameters are shared and made accessible to the "children" of this
-     * entity.
-     */
-    protected Map<ConfigKey<?>,Object> ownConfig = Collections.synchronizedMap(new LinkedHashMap<ConfigKey<?>, Object>());
-
-    public <T> T getConfig(ConfigKey<T> key) {
-        return getConfig(key, null);
-    }
-    
-    public <T> T getConfig(HasConfigKey<T> key) {
-        return getConfig(key.getConfigKey(), null);
-    }
-    
-    public <T> T getConfig(HasConfigKey<T> key, T defaultValue) {
-        return getConfig(key.getConfigKey(), defaultValue);
-    }
-    
-    @Override @Deprecated
-    public Object getRawConfig(ConfigKey<?> key) {
-        return getConfigRaw(key, true).orNull();
-    }
-    
-    protected Object coerceConfigVal(ConfigKey<?> key, Object v) {
-        Object val;
-        if ((v instanceof Future) || (v instanceof DeferredSupplier)) {
-            // no coercion for these (coerce on exit)
-            val = v;
-        } else if (key instanceof StructuredConfigKey) {
-            // no coercion for these structures (they decide what to do)
-            val = v;
-        } else if ((v instanceof Map || v instanceof Iterable) && key.getType().isInstance(v)) {
-            // don't do coercion on put for these, if the key type is compatible, 
-            // because that will force resolution deeply
-            val = v;
-        } else {
-            try {
-                // try to coerce on input, to detect errors sooner
-                val = TypeCoercions.coerce(v, key.getTypeToken());
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Cannot coerce or set "+v+" to "+key, e);
-                // if can't coerce, we could just log as below and *throw* the error when we retrieve the config
-                // but for now, fail fast (above), because we haven't encountered strong use cases
-                // where we want to do coercion on retrieval, except for the exceptions above
-//                Exceptions.propagateIfFatal(e);
-//                LOG.warn("Cannot coerce or set "+v+" to "+key+" (ignoring): "+e, e);
-//                val = v;
-            }
-        }
-        return val;
-    }
-
-    
-    @Override
-    public Map<String,Object> asMapWithStringKeys() {
-        return mapViewWithStringKeys;
-    }
-
-    @Override
-    public int size() {
-        return ownConfig.size();
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return ownConfig.isEmpty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractStructuredConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractStructuredConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractStructuredConfigKey.java
deleted file mode 100644
index 8c7c610..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractStructuredConfigKey.java
+++ /dev/null
@@ -1,139 +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.core.config.internal;
-
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.config.StructuredConfigKey;
-import org.apache.brooklyn.core.config.SubElementConfigKey;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-
-import com.google.common.collect.Maps;
-
-public abstract class AbstractStructuredConfigKey<T,RawT,V> extends BasicConfigKey<T> implements StructuredConfigKey {
-
-    private static final long serialVersionUID = 7806267541029428561L;
-
-    public final Class<V> subType;
-
-    public AbstractStructuredConfigKey(Class<T> type, Class<V> subType, String name, String description, T defaultValue) {
-        super(type, name, description, defaultValue);
-        this.subType = subType;
-    }
-
-    protected ConfigKey<V> subKey(String subName) {
-        return subKey(subName, "sub-element of " + getName() + ", named " + subName);
-    }
-    // it is not possible to supply default values
-    protected ConfigKey<V> subKey(String subName, String description) {
-        return new SubElementConfigKey<V>(this, subType, getName() + "." + subName, description, null);
-    }   
-
-    protected static String getKeyName(Object contender) {
-        if (contender==null) return null;
-        if (contender instanceof ConfigKey) return ((ConfigKey<?>)contender).getName();
-        return contender.toString();
-    }
-    
-    public boolean acceptsKeyMatch(Object contender) {
-        return (getName().equalsIgnoreCase(getKeyName(contender)));
-    }
-    
-    public boolean acceptsSubkey(Object contender) {
-        return contender!=null && getKeyName(contender).startsWith(getName()+".");        
-    }
-    
-    public String extractSubKeyName(Object o) {
-        String name = getKeyName(o);
-        assert name.startsWith(getName()+".");
-        return name.substring(getName().length() + 1);
-    }
-
-    @Override
-    public boolean acceptsSubkeyStronglyTyped(Object contender) {
-        return (contender instanceof SubElementConfigKey) && 
-            acceptsKeyMatch( ((SubElementConfigKey<?>) contender).parent );
-    }
-    
-    @Override
-    public boolean isSet(Map<?, ?> vals) {
-        if (vals.containsKey(this))
-            return true;
-        for (Object contender : vals.keySet()) {
-            if (acceptsKeyMatch(contender) || acceptsSubkey(contender)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    protected RawT extractValue(Map<?,?> vals, ExecutionContext exec, boolean coerce, boolean unmodifiable) {
-        RawT base = null; 
-        Map<String,Object> subkeys = Maps.newLinkedHashMap();
-        for (Map.Entry<?,?> entry : vals.entrySet()) {
-            Object k = entry.getKey();
-            // we don't resolve the key above because this map is the root map;
-            // deferred values as keys must be at an explicit config key entry
-            
-            if (acceptsKeyMatch(k)) {
-                try {
-                    base = extractValueMatchingThisKey(entry.getValue(), exec, coerce);
-                } catch (Exception e) { throw Exceptions.propagate(e); }
-            }
-            
-            if (acceptsSubkey(k)) {
-                String subKeyName = extractSubKeyName(k);
-                Object value;
-                if (coerce) {
-                    @SuppressWarnings("unchecked")
-                    SubElementConfigKey<V> kk = k instanceof SubElementConfigKey<?> ? 
-                        (SubElementConfigKey<V>) k : (SubElementConfigKey<V>) subKey(subKeyName);
-                    value = kk.extractValue(vals, exec);
-                } else {
-                    value = vals.get(k);
-                }
-                subkeys.put(subKeyName, value);
-            }
-        }
-        return merge(base, subkeys, unmodifiable);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public T extractValue(Map<?,?> vals, ExecutionContext exec) {
-        return (T) extractValue(vals, exec, true, true);
-    }
-
-    /** returns the entries in the map against this config key and any sub-config-keys, without resolving
-     * (like {@link #extractValue(Map, ExecutionContext)} but without resolving/coercing;
-     * useful because values in this "map" are actually stored against {@link SubElementConfigKey}s */
-    public RawT rawValue(Map<?,?> vals) {
-        return extractValue(vals, null, false, false);
-    }
-
-    /** returns value against *this* key, if it is of an acceptable type (ignoring subkeys which are added on top) */
-    protected abstract RawT extractValueMatchingThisKey(Object potentialBase, ExecutionContext exec, boolean coerce) throws InterruptedException, ExecutionException;
-    
-    protected abstract RawT merge(RawT base, Map<String, Object> subkeys, boolean unmodifiable);
-    
-}


[41/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java
deleted file mode 100644
index a139d5d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.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 org.apache.brooklyn.api.policy;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-
-/**
- * Gives details of a policy to be created. It describes the policy's configuration, and is
- * reusable to create multiple policies with the same configuration.
- * 
- * To create a PolicySpec, it is strongly encouraged to use {@code create(...)} methods.
- * 
- * @param <T> The type of policy to be created
- * 
- * @author aled
- */
-public class PolicySpec<T extends Policy> extends AbstractBrooklynObjectSpec<T,PolicySpec<T>> {
-
-    private final static long serialVersionUID = 1L;
-
-
-    /**
-     * Creates a new {@link PolicySpec} instance for a policy of the given type. The returned 
-     * {@link PolicySpec} can then be customized.
-     * 
-     * @param type A {@link Policy} class
-     */
-    public static <T extends Policy> PolicySpec<T> create(Class<T> type) {
-        return new PolicySpec<T>(type);
-    }
-    
-    /**
-     * Creates a new {@link PolicySpec} instance with the given config, for a policy of the given type.
-     * 
-     * This is primarily for groovy code; equivalent to {@code PolicySpec.create(type).configure(config)}.
-     * 
-     * @param config The spec's configuration (see {@link PolicySpec#configure(Map)}).
-     * @param type   A {@link Policy} class
-     */
-    public static <T extends Policy> PolicySpec<T> create(Map<?,?> config, Class<T> type) {
-        return PolicySpec.create(type).configure(config);
-    }
-    
-    protected PolicySpec(Class<T> type) {
-        super(type);
-    }
-    
-    protected void checkValidType(Class<? extends T> type) {
-        checkIsImplementation(type, Policy.class);
-        checkIsNewStyleImplementation(type);
-    }
-    
-    public PolicySpec<T> uniqueTag(String uniqueTag) {
-        flags.put("uniqueTag", uniqueTag);
-        return this;
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java
deleted file mode 100644
index 2ba99c6..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.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.api.policy;
-
-import org.apache.brooklyn.api.objs.BrooklynType;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Gives type information for a {@link Policy}. It is immutable.
- * 
- * For policies that can support config keys etc being added on-the-fly,
- * then this PolicyType will be a snapshot and subsequent snapshots will
- * include the changes.
- * 
- * @since 0.5
- */
-@Beta
-public interface PolicyType extends BrooklynType {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java
deleted file mode 100644
index 54162f2..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.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 org.apache.brooklyn.api.relations;
-
-import org.apache.brooklyn.api.relations.RelationshipType;
-
-
-public interface RelationshipType<SourceType,TargetType> {
-
-    public String getRelationshipTypeName();
-    public Class<SourceType> getSourceType();
-    public Class<TargetType> getTargetType();
-    
-    public String getSourceName();
-    public String getSourceNamePlural();
-
-    public String getTargetName();
-    public String getTargetNamePlural();
-
-    public RelationshipType<TargetType,SourceType> getInverseRelationshipType();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java
deleted file mode 100644
index e200920..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.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.api.sensor;
-
-import com.google.common.annotations.Beta;
-
-/**
- * The interface implemented by attribute sensors.
- */
-public interface AttributeSensor<T> extends Sensor<T> {
-    
-    /**
-     * @since 0.7.0
-     */
-    @Beta
-    public enum SensorPersistenceMode {
-        /**
-         * Indicates that this sensor should be persisted, and its value should be read from
-         * persisted state on rebind.
-         */
-        REQUIRED,
-        
-        /**
-         * Indicates that this sensor should not be persisted; therefore its value for any entity
-         * will be null immediately after rebind.
-         */
-        NONE;
-    }
-    
-    /**
-     * The persistence mode of this sensor, to determine its behaviour for rebind.
-     * 
-     * @since 0.7.0
-     */
-    SensorPersistenceMode getPersistenceMode();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
deleted file mode 100644
index 3fde2a5..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
+++ /dev/null
@@ -1,61 +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.api.sensor;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EnricherMemento;
-import org.apache.brooklyn.api.objs.Configurable;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.api.policy.Policy;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Publishes metrics for an entity, e.g. aggregating information from other sensors/entities.
- *
- * Has some similarities to {@link Policy}. However, enrichers specifically do not invoke
- * effectors and should only function to publish new metrics.
- */
-public interface Enricher extends EntityAdjunct, Rebindable, Configurable {
-    /**
-     * A unique id for this enricher.
-     */
-    @Override
-    String getId();
-
-    /**
-     * Information about the type of this entity; analogous to Java's object.getClass.
-     */
-    @Beta
-    EnricherType getEnricherType();
-
-    /**
-     * Users are strongly discouraged from calling or overriding this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    RebindSupport<EnricherMemento> getRebindSupport();
-
-    @Override
-    RelationSupport<Enricher> relations();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
deleted file mode 100644
index ae50e2d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
+++ /dev/null
@@ -1,140 +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.api.sensor;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-
-/**
- * Gives details of an enricher to be created. It describes the enricher's configuration, and is
- * reusable to create multiple enrichers with the same configuration.
- * 
- * To create an EnricherSpec, it is strongly encouraged to use {@code create(...)} methods.
- * 
- * @param <T> The type of enricher to be created
- * 
- * @author aled
- */
-public class EnricherSpec<T extends Enricher> extends AbstractBrooklynObjectSpec<T,EnricherSpec<T>> {
-
-    private static final long serialVersionUID = -6012873926010992062L;
-
-    /**
-     * Creates a new {@link EnricherSpec} instance for an enricher of the given type. The returned 
-     * {@link EnricherSpec} can then be customized.
-     * 
-     * @param type A {@link Enricher} class
-     */
-    public static <T extends Enricher> EnricherSpec<T> create(Class<? extends T> type) {
-        return new EnricherSpec<T>(type);
-    }
-    
-    /**
-     * Creates a new {@link EnricherSpec} instance with the given config, for an enricher of the given type.
-     * 
-     * This is primarily for groovy code; equivalent to {@code EnricherSpec.create(type).configure(config)}.
-     * 
-     * @param config The spec's configuration (see {@link EnricherSpec#configure(Map)}).
-     * @param type   An {@link Enricher} class
-     */
-    public static <T extends Enricher> EnricherSpec<T> create(Map<?,?> config, Class<? extends T> type) {
-        return EnricherSpec.create(type).configure(config);
-    }
-    
-    protected EnricherSpec(Class<? extends T> type) {
-        super(type);
-    }
-    
-    protected void checkValidType(Class<? extends T> type) {
-        checkIsImplementation(type, Enricher.class);
-        checkIsNewStyleImplementation(type);
-    }
-    
-    public EnricherSpec<T> uniqueTag(String uniqueTag) {
-        flags.put("uniqueTag", uniqueTag);
-        return this;
-    }
-    
-    public abstract static class ExtensibleEnricherSpec<T extends Enricher,K extends ExtensibleEnricherSpec<T,K>> extends EnricherSpec<T> {
-        private static final long serialVersionUID = -3649347642882809739L;
-        
-        protected ExtensibleEnricherSpec(Class<? extends T> type) {
-            super(type);
-        }
-
-        @SuppressWarnings("unchecked")
-        protected K self() {
-            // we override the AbstractBrooklynObjectSpec method -- it's a different K here because
-            // EnricherSpec does not contain a parametrisable generic return type (Self)
-            return (K) this;
-        }
-        
-        @Override
-        public K uniqueTag(String uniqueTag) {
-            super.uniqueTag(uniqueTag);
-            return self();
-        }
-
-        @Override
-        public K configure(Map<?, ?> val) {
-            super.configure(val);
-            return self();
-        }
-
-        @Override
-        public K configure(CharSequence key, Object val) {
-            super.configure(key, val);
-            return self();
-        }
-
-        @Override
-        public <V> K configure(ConfigKey<V> key, V val) {
-            super.configure(key, val);
-            return self();
-        }
-
-        @Override
-        public <V> K configureIfNotNull(ConfigKey<V> key, V val) {
-            super.configureIfNotNull(key, val);
-            return self();
-        }
-
-        @Override
-        public <V> K configure(ConfigKey<V> key, Task<? extends V> val) {
-            super.configure(key, val);
-            return self();
-        }
-
-        @Override
-        public <V> K configure(HasConfigKey<V> key, V val) {
-            super.configure(key, val);
-            return self();
-        }
-
-        @Override
-        public <V> K configure(HasConfigKey<V> key, Task<? extends V> val) {
-            super.configure(key, val);
-            return self();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java
deleted file mode 100644
index e8aff97..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.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.api.sensor;
-
-import org.apache.brooklyn.api.objs.BrooklynType;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Gives type information for an {@link Enricher}. It is immutable.
- * 
- * For enrichers that can support config keys etc being added on-the-fly,
- * then this EnricherType will be a snapshot and subsequent snapshots will
- * include the changes.
- * 
- * @since 0.6
- */
-@Beta
-public interface EnricherType extends BrooklynType {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
deleted file mode 100644
index d50e092..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
+++ /dev/null
@@ -1,74 +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.api.sensor;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * A sensor feed.
- * These generally poll or subscribe to get sensor values for an entity.
- * They make it easy to poll over http, jmx, etc.
- * 
- * Assumes:
- *   <ul>
- *     <li>There will not be concurrent calls to start and stop.
- *     <li>There will only be one call to start and that will be done immediately after construction,
- *         in the same thread.
- *     <li>Once stopped, the feed will not be re-started.
- *   </ul>
- */
-@Beta
-public interface Feed extends EntityAdjunct, Rebindable {
-
-    /** 
-     * True if everything has been _started_ (or it is starting) but not stopped,
-     * even if it is suspended; see also {@link #isActive()}
-     */
-    boolean isActivated();
-    
-    void start();
-
-    /** suspends this feed (stops the poller, or indicates that the feed should start in a state where the poller is stopped) */
-    void suspend();
-
-    boolean isSuspended();
-
-    /** resumes this feed if it has been suspended and not stopped */
-    void resume();
-    
-    void stop();
-
-    /**
-     * Users are strongly discouraged from calling or overriding this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    RebindSupport<FeedMemento> getRebindSupport();
-    
-    @Override
-    RelationSupport<Feed> relations();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java
deleted file mode 100644
index e658028..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.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 org.apache.brooklyn.api.sensor;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-import com.google.common.reflect.TypeToken;
-
-/**
- * The interface implemented by concrete sensors.
- * 
- * A sensor is a container for a piece of data of a particular type, and exists in a hierarchical namespace.
- * The name of the sensor is described as a set of tokens separated by dots.
- * 
- * @see SensorEvent
- */
-public interface Sensor<T> extends Serializable {
-    /**
-     * Returns the Java {@link Class} for the sensor data.
-     * <p>
-     * This returns a "super" of T only in the case where T is generified, 
-     * and in such cases it returns the Class instance for the unadorned T ---
-     * i.e. for List&lt;String&gt; this returns Class<List> ---
-     * this is of course because there is no actual Class&lt;List&lt;String&gt;&gt; instance.
-     */
-    Class<? super T> getType();
-    
-    /**
-     * Returns the Guava TypeToken (including generics info)
-     */
-    TypeToken<T> getTypeToken();
-    
-    /**
-     * Returns the type of the sensor data, as a {@link String} representation of the class name.
-     * (Useful for contexts where Type is not accessible.)
-     */
-    String getTypeName();
-
-    /**
-     * Returns the name of the sensor, in a dot-separated namespace.
-     */
-    String getName();
-    
-    /**
-     * Returns the constituent parts of the sensor name as a {@link List}.
-     */
-    List<String> getNameParts();
- 
-    /**
-     * Returns the description of the sensor, for display.
-     */
-    String getDescription();
- 
-    /**
-     * Create a new {@link SensorEvent} object for a specific {@link Entity} and data point.
-     */
-    SensorEvent<T> newEvent(Entity entity, T value);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java
deleted file mode 100644
index 02a7fef..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.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.api.sensor;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * A tuple representing a piece of data from a {@link Sensor} on an {@link Entity}.
- */
-public interface SensorEvent<T> {
-    /**
-     * The {@link Entity} where the data originated.
-     */
-    Entity getSource();
- 
-    /**
-     * The {@link Sensor} describing the data.
-     */
-    Sensor<T> getSensor();
- 
-    /**
-     * The value for the {@link Sensor} data.
-     */
-    T getValue();
-
-    /**
-     * The time this data was published, as a UTC time in milliseconds (e.g. as returned
-     * by {@link System#currentTimeMillis()}.
-     */
-    long getTimestamp();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java
deleted file mode 100644
index 65fe81c..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.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.api.sensor;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * A listener for {@link SensorEvent}s on an {@link Entity}.
- */
-public interface SensorEventListener<T> {
-    
-    public static final SensorEventListener<Object> NOOP = new SensorEventListener<Object>() {
-        @Override public void onEvent(SensorEvent<Object> event) {
-        }
-    };
-    
-    /**
-     * The {@link SensorEvent} handler method.
-     */
-    void onEvent(SensorEvent<T> event);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java
deleted file mode 100644
index 17a7fb3..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.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 org.apache.brooklyn.api.typereg;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Predicate;
-
-
-public interface BrooklynTypeRegistry {
-
-    public enum RegisteredTypeKind {
-        /** a registered type which will create an {@link AbstractBrooklynObjectSpec} (e.g. {@link EntitySpec}) 
-         * for the type registered (e.g. the {@link Entity} instance) */
-        SPEC,
-        /** a registered type which will create the java type described */
-        BEAN 
-        // note: additional kinds should have the visitor in core/RegisteredTypeKindVisitor updated
-        // to flush out all places which want to implement support for all kinds 
-    }
-    
-    Iterable<RegisteredType> getAll();
-    Iterable<RegisteredType> getMatching(Predicate<? super RegisteredType> filter);
-
-    /** @return The item matching the given given 
-     * {@link RegisteredType#getSymbolicName() symbolicName} 
-     * and optionally {@link RegisteredType#getVersion()},
-     * taking the best version if the version is null or a default marker,
-     * returning null if no matches are found. */
-    RegisteredType get(String symbolicName, String version);
-    /** as {@link #get(String, String)} but the given string here 
-     * is allowed to match any of:
-     * <li>the given string as an ID including version (<code>"name:version"</code>) 
-     * <li>the symbolic name unversioned, or
-     * <li>an alias */
-    RegisteredType get(String symbolicNameWithOptionalVersion);
-
-    /** as {@link #get(String)} but further filtering for the additional context */
-    public RegisteredType get(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context);
-    /** returns a wrapper of the result of {@link #get(String, RegisteredTypeLoadingContext)} 
-     * including a detailed message if absent */
-    public Maybe<RegisteredType> getMaybe(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context);
-
-    // NB the seemingly more correct generics <T,SpecT extends AbstractBrooklynObjectSpec<T,SpecT>> 
-    // cause compile errors, not in Eclipse, but in maven (?) 
-    // TODO do these belong here, or in a separate master TypePlanTransformer ?  see also BrooklynTypePlanTransformer
-    @Beta
-    <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpec(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType);
-    @Beta
-    <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpecFromPlan(@Nullable String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType);
-    @Beta
-    <T> T createBean(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<T> optionalResultSuperType);
-    @Beta
-    <T> T createBeanFromPlan(String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalConstraint, @Nullable Class<T> optionalBeanSuperType);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java
deleted file mode 100644
index e8b278b..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.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.api.typereg;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public interface OsgiBundleWithUrl {
-    
-    public String getSymbolicName();
-    public String getVersion();
-    
-    /** where this bundle can be downloaded; typically required unless we are guaranteed the bundle will be manually installed */
-    public String getUrl();
-    
-    /** @return true if we have a name and version for this bundle;
-     * false if not, e.g. if we only know the URL and we haven't loaded it yet */
-    public boolean isNameResolved();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
deleted file mode 100644
index 29b64d3..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
+++ /dev/null
@@ -1,96 +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.api.typereg;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.Identifiable;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind;
-
-import com.google.common.annotations.Beta;
-
-public interface RegisteredType extends Identifiable {
-    
-    @Override String getId();
-    
-    RegisteredTypeKind getKind();
-    
-    String getSymbolicName();
-    String getVersion();
-
-    Collection<OsgiBundleWithUrl> getLibraries();
-
-    String getDisplayName();
-    String getDescription();
-    String getIconUrl();
-
-    /** @return all declared supertypes or super-interfaces of this registered type,
-     * consisting of a collection of {@link Class} or {@link RegisteredType}
-     * <p>
-     * This should normally include at least one {@link Class} object:
-     * For beans, this should include the java type that the {@link BrooklynTypeRegistry} will create. 
-     * For specs, this should refer to the {@link BrooklynObject} type that the created spec will point at 
-     * (e.g. the concrete {@link Entity}, not the {@link EntitySpec}).
-     * <p>
-     * This may not necessarily return the most specific java class or classes;
-     * such as if the concrete type is private and callers should know only about a particular public interface,
-     * or if precise type details are unavailable and all that is known at creation is some higher level interface/supertype
-     * (e.g. this may return {@link Entity} even though the spec points at a specific subclass,
-     * for instance because the YAML has not yet been parsed or OSGi bundles downloaded).
-     * <p>
-     * This may include other registered types such as marker interfaces.
-     */
-    @Beta
-    Set<Object> getSuperTypes();
-
-    /**
-     * @return True if the item has been deprecated (i.e. its use is discouraged)
-     */
-    boolean isDeprecated();
-    
-    /**
-     * @return True if the item has been disabled (i.e. its use is forbidden, except for pre-existing apps)
-     */
-    boolean isDisabled();
-
-    /** Alias words defined for this type */
-    Set<String> getAliases();
-
-    /** Tags attached to this item */
-    Set<Object> getTags();
-    
-    /** @return implementation details, so that the framework can find a suitable {@link BrooklynTypePlanTransformer} 
-     * which can then use this object to instantiate this type */
-    TypeImplementationPlan getPlan();
-    
-    public interface TypeImplementationPlan {
-        /** hint which {@link BrooklynTypePlanTransformer} instance(s) can be used, if known;
-         * this may be null if the relevant transformer was not declared when created,
-         * but in general we should look to determine the kind as early as possible 
-         * and use that to retrieve the appropriate such transformer */
-        String getPlanFormat();
-        /** data for the implementation; may be more specific */
-        Object getPlanData();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java
deleted file mode 100644
index d37666e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.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 org.apache.brooklyn.api.typereg;
-
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind;
-
-public interface RegisteredTypeLoadingContext {
-    
-    /** The kind required, if specified. */
-    @Nullable public RegisteredTypeKind getExpectedKind();
-    
-    /** A java super-type or interface that should be filtered for; 
-     * for specs, this refers to the target type, not the spec 
-     * (eg {@link Entity} not {@link EntitySpec}). 
-     * If nothing is specified, this returns {@link Object}'s class. */
-    @Nonnull public Class<?> getExpectedJavaSuperType();
-    
-    /** encountered types, so that during resolution, 
-     * if we have already attempted to resolve a given type,
-     * the instantiator can avoid recursive cycles */
-    @Nonnull public Set<String> getAlreadyEncounteredTypes();
-    
-    /** A loader to use, supplying additional search paths */
-    @Nullable public BrooklynClassLoadingContext getLoader();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/README.md
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/README.md b/brooklyn-server/camp/README.md
deleted file mode 100644
index 225e18e..0000000
--- a/brooklyn-server/camp/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-OASIS CAMP Server
-=================
-
-The projects in this directory provide the necessary components for a server which 
-speaks the CAMP REST API and which understands the CAMP YAML plan language.
-
-It is not dependent on Brooklyn (apart from utils) and does not expose any
-types.  The brooklyn-camp project provides the links for Brooklyn entities
-to be available through the CAMP REST API, and for Brooklyn to deploy blueprints
-described using the CAMP YAML.
-
-The projects in this directory are designed so they could be used to build
-other CAMP servers not based on Brooklyn, if desired.
-
-These projects are part of the Apache Software Foundation Brooklyn project
-(https://brooklyn.incubator.apache.org) and released under the Apache License 2.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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/notes.txt
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/notes.txt b/brooklyn-server/camp/camp-base/notes.txt
deleted file mode 100644
index f18b5d3..0000000
--- a/brooklyn-server/camp/camp-base/notes.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-
-DONE
-
-SOME of these (for PCT's and ACT's)
-* dto classes and endpoints (jersey resources) to have a rest server
-* impl classes (abstract or composable?) which can make dto's
-* connect impl classes to brooklyn
-
-TODO
-
-* remaining classes
-* PDP formation
-
-
-
-
-
-
-THOUGHTS
-
-* get camp.io
-* project for camp-ops, camp-samp-le-server
-
-
-
-
-
-
-COMPARISON
-
-CAMP
-*   platform offers PlatformComponentTemplates (e.g. elasttic AppServer cluster) which a user can
-    stitch together in an AssemblyTemplate to create an Assembly which is their application;
-    user can also supply ApplicationComponentTemplate and ApplicationComponent instances
-    (e.g. WAR files) for use in assemblies;
-    and Requirements and Capabilities can be defined to e.g. indicate that a 3-tier app
-    Template requires a WAR file and a schema (from the user) and PlatformComponents
-    where these will run (from the platform) which get resolved at real-time 
-    with as little or as much guidance from the user as desired;
-    relies on conventions on types and tags (ie not specified in spec, yet) to facilitate re-use;
-*   defines REST API for interacting with these, and uploading assemblies and app components
-    (not platform components)
-*   example
-
-TOSCA
-    ServiceTemplate is the basic idea
-    Types
-        NodeType
-        RelationshipType
-    TopologyTemplate
-        NodeTemplate
-        RelationshipTemplate
-        GroupTemplate
-    internal elements
-        Artifacts:
-            "deployment artifacts" for creating nodes, 
-            "implementation artifacts" for operations)
-        Container capabilities / requirements
-        Properties, operations, scripts, constraints
-        Policies
-    Plans
-        Plan
-
-END
-
-
-----
-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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/pom.xml b/brooklyn-server/camp/camp-base/pom.xml
deleted file mode 100644
index 063f665..0000000
--- a/brooklyn-server/camp/camp-base/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <artifactId>camp-base</artifactId>
-
-    <name>CAMP Base</name>
-    <description>
-        Core base classes for CAMP server implementation
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn.camp</groupId>
-        <artifactId>camp-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-compress</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-        </dependency>
-        
-            <!-- just for logging, not exported -->
-            <!-- 
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-logback-xml</artifactId>
-            <version>${project.version}</version>
-            <optional>true</optional>
-            <scope>tests</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${project.version}</version>
-            <optional>true</optional>
-            <scope>tests</scope>
-        </dependency>
-             -->
-        
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
deleted file mode 100644
index 137e927..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/AggregatingCampPlatform.java
+++ /dev/null
@@ -1,130 +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;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
deleted file mode 100644
index 34fc6a2..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/BasicCampPlatform.java
+++ /dev/null
@@ -1,142 +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;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/CampPlatform.java
deleted file mode 100644
index 817dae8..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/commontypes/RepresentationSkew.java
deleted file mode 100644
index 01cece9..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 org.apache.brooklyn.camp.commontypes;
-
-public enum RepresentationSkew {
-    CREATING, NONE, DESTROYING, UNKNOWN
-}

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/AbstractResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java
deleted file mode 100644
index c24eab1..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/AbstractResource.java
+++ /dev/null
@@ -1,195 +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.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.camp.commontypes.RepresentationSkew;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.apache.brooklyn.util.time.Time;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableList;
-
-/** 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 MutableMap.copyOf(customAttributes).asUnmodifiable();
-    }
-    
-    // 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponent.java
deleted file mode 100644
index 6ece4d0..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/ApplicationComponentTemplate.java
deleted file mode 100644
index bd9d69d..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 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(); }
-    }
-
-}


[42/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java
deleted file mode 100644
index d928da0..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.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.api.mgmt.rebind;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Gives access to things that are being currently rebinding. This is used during a
- * rebind to wire everything back together again, e.g. to find the necessary entity 
- * instances even before they are available through 
- * {@code managementContext.getEntityManager().getEnties()}.
- * <p>
- * Users are not expected to implement this class. It is for use by {@link Rebindable} 
- * instances, and will generally be created by the {@link RebindManager}.
- * <p>
- */
-@Beta
-public interface RebindContext {
-
-    /** Returns an unmodifiable view of all objects by ID */ 
-    Map<String,BrooklynObject> getAllBrooklynObjects();
-    
-    Class<?> loadClass(String typeName) throws ClassNotFoundException;
-    
-    RebindExceptionHandler getExceptionHandler();
-    
-    boolean isReadOnly(BrooklynObject item);
-    
-    LookupContext lookup();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java
deleted file mode 100644
index 574a680..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.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 org.apache.brooklyn.api.mgmt.rebind;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-
-import com.google.common.annotations.Beta;
-import org.apache.brooklyn.config.ConfigKey;
-
-/**
- * Handler called on all exceptions to do with rebind.
- * A handler instance is linked to a single rebind pass;
- * it should not be invoked after {@link #onDone()}.
- * <p>
- * {@link #onStart()} must be invoked before the run.
- * {@link #onDone()} must be invoked after a successful run, and it may throw.
- * <p>
- * Implementations may propagate errors or may catch them until {@link #onDone()} is invoked,
- * and that may throw or report elsewhere, as appropriate.
- * 
- * @author aled
- */
-@Beta
-public interface RebindExceptionHandler {
-
-    void onLoadMementoFailed(BrooklynObjectType type, String msg, Exception e);
-    
-    /**
-     * @return the entity to use in place of the missing one, or null (if hasn't thrown an exception)
-     */
-    Entity onDanglingEntityRef(String id);
-
-    /**
-     * @return the location to use in place of the missing one, or null (if hasn't thrown an exception)
-     */
-    Location onDanglingLocationRef(String id);
-
-    /**
-     * @return the policy to use in place of the missing one, or null (if hasn't thrown an exception)
-     */
-    Policy onDanglingPolicyRef(String id);
-
-    /**
-     * @return the enricher to use in place of the missing one, or null (if hasn't thrown an exception)
-     */
-    Enricher onDanglingEnricherRef(String id);
-
-    /**
-     * @return the feed to use in place of the missing one, or null (if hasn't thrown an exception)
-     */
-    Feed onDanglingFeedRef(String id);
-    
-    /**
-     * @return the catalog item to use in place of the missing one
-     */
-    CatalogItem<?, ?> onDanglingCatalogItemRef(String id);
-
-    /**
-     * @return the item to use in place of the missing one
-     */
-    BrooklynObject onDanglingUntypedItemRef(String id);
-
-    void onCreateFailed(BrooklynObjectType type, String id, String instanceType, Exception e);
-
-    void onNotFound(BrooklynObjectType type, String id);
-
-    void onRebindFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
-
-    void onAddConfigFailed(EntityMemento type, ConfigKey<?> value, Exception e);
-
-    void onAddPolicyFailed(EntityLocal entity, Policy policy, Exception e);
-
-    void onAddEnricherFailed(EntityLocal entity, Enricher enricher, Exception e);
-
-    void onAddFeedFailed(EntityLocal entity, Feed feed, Exception e);
-
-    void onManageFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
-
-    /** invoked for any high-level, unexpected, or otherwise uncaught failure;
-     * may be invoked on catching above errors */
-    RuntimeException onFailed(Exception e);
-
-    /** invoked before the rebind pass */
-    void onStart(RebindContext context);
-    
-    /** invoked after the complete rebind pass, always on success and possibly on failure */
-    void onDone();
-    
-    List<Exception> getExceptions();
-    List<String> getWarnings();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java
deleted file mode 100644
index c1441db..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java
+++ /dev/null
@@ -1,132 +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.api.mgmt.rebind;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeoutException;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoRawData;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Manages the persisting of brooklyn's state, and recreating that state, e.g. on
- * brooklyn restart.
- * 
- * Users are not expected to implement this class, or to call methods on it directly.
- */
-public interface RebindManager {
-    
-    // FIXME Should we be calling managementContext.getRebindManager().rebind, using a
-    // new empty instance of managementContext?
-    //
-    // Or is that a risky API because you could call it on a non-empty managementContext?
-    
-    public enum RebindFailureMode {
-        FAIL_FAST,
-        FAIL_AT_END,
-        CONTINUE;
-    }
-    
-    public void setPersister(BrooklynMementoPersister persister);
-
-    public void setPersister(BrooklynMementoPersister persister, PersistenceExceptionHandler exceptionHandler);
-
-    @VisibleForTesting
-    public BrooklynMementoPersister getPersister();
-
-    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
-    public List<Application> rebind();
-    
-    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
-    public List<Application> rebind(ClassLoader classLoader);
-    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
-    public List<Application> rebind(ClassLoader classLoader, RebindExceptionHandler exceptionHandler);
-    /** Causes this management context to rebind, loading data from the given backing store.
-     * use wisely, as this can cause local entities to be completely lost, or will throw in many other situations.
-     * in general it may be invoked for a new node becoming {@link ManagementNodeState#MASTER} 
-     * or periodically for a node in {@link ManagementNodeState#HOT_STANDBY} or {@link ManagementNodeState#HOT_BACKUP}. */
-    @Beta
-    public List<Application> rebind(ClassLoader classLoader, RebindExceptionHandler exceptionHandler, ManagementNodeState mode);
-
-    public BrooklynMementoRawData retrieveMementoRawData();
-
-    public ChangeListener getChangeListener();
-
-    /**
-     * Starts the background persisting of state
-     * (if persister is set; otherwise will start persisting as soon as persister is set). 
-     * Until this is called, no data will be persisted although entities can be rebinded.
-     */
-    public void startPersistence();
-
-    /** Stops the background persistence of state. 
-     * Waits for any current persistence to complete. */
-    public void stopPersistence();
-
-    /**
-     * Perform an initial load of state read-only and starts a background process 
-     * reading (mirroring) state periodically.
-     */
-    public void startReadOnly(ManagementNodeState mode);
-    /** Stops the background reading (mirroring) of state. 
-     * Interrupts any current activity and waits for it to cease. */
-    public void stopReadOnly();
-    
-    /** Starts the appropriate background processes, {@link #startPersistence()} if {@link ManagementNodeState#MASTER},
-     * {@link #startReadOnly()} if {@link ManagementNodeState#HOT_STANDBY} or {@link ManagementNodeState#HOT_BACKUP} */
-    public void start();
-    /** Stops the appropriate background processes, {@link #stopPersistence()} or {@link #stopReadOnly()},
-     * waiting for activity there to cease (interrupting in the case of {@link #stopReadOnly()}). */
-    public void stop();
-    
-    @VisibleForTesting
-    /** waits for any needed or pending writes to complete */
-    public void waitForPendingComplete(Duration duration, boolean canTrigger) throws InterruptedException, TimeoutException;
-    /** Forcibly performs persistence, in the foreground 
-     * @deprecated since 0.7.0; use {@link #forcePersistNow(boolean, PersistenceExceptionHandler)}, 
-     * default parameter here is false to mean incremental, with null/default exception handler */
-    @VisibleForTesting
-    public void forcePersistNow();
-    /** Forcibly performs persistence, in the foreground, either full (all entities) or incremental;
-     * if no exception handler specified, the default one from the persister is used.
-     * <p>
-     * Note that full persistence does *not* delete items; incremental should normally be sufficient.
-     * (A clear then full persistence would have the same effect, but that is risky in a production
-     * setting if the process fails after the clear!) */
-    @VisibleForTesting
-    public void forcePersistNow(boolean full, @Nullable PersistenceExceptionHandler exceptionHandler);
-    
-    /** Whether the management state has changed to a state where a rebind is needed
-     * but we are still awaiting the first run; 
-     * ie state is master or hot, but list of apps is not yet accurate */
-    public boolean isAwaitingInitialRebind();
-
-    /** Metrics about rebind, last success, etc. */
-    public Map<String,Object> getMetrics();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java
deleted file mode 100644
index 2e8fdbf..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.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.api.mgmt.rebind;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
-
-/**
- * Supporter instance for behaviour related to rebinding a given entity/location/policy.
- * 
- * For example, the brooklyn framework may call {@code entity.getRebindSupport().getMemento()}
- * and persist this using a {@link BrooklynMementoPersister}. Later (e.g. after a brooklyn
- * restart) a new entity instance may be created and populated by the framework calling 
- * {@code entity.getRebindSupport().reconstruct(rebindContext, memento)}.
- * 
- * @author aled
- */
-public interface RebindSupport<T extends Memento> {
-
-    /**
-     * Creates a memento representing this entity's current state. This is useful for when restarting brooklyn.
-     */
-    T getMemento();
-
-    /**
-     * Reconstructs this entity, given a memento of its state. Sets the internal state 
-     * (including id and config keys), and sets the parent/children/locations of this entity.
-     * 
-     * Implementations should be very careful to not invoke or inspect these other entities/locations,
-     * as they may also be being reconstructed at this time.
-     * 
-     * Called during rebind, after creation and before the call to start management.
-     */
-    void reconstruct(RebindContext rebindContext, T memento);
-
-    void addPolicies(RebindContext rebindContext, T Memento);
-    
-    void addEnrichers(RebindContext rebindContext, T Memento);
-    
-    void addFeeds(RebindContext rebindContext, T Memento);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java
deleted file mode 100644
index 301e8e0..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.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.api.mgmt.rebind;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Indicates that this can be recreated, e.g. after a brooklyn restart, and by
- * using a {@link Memento} it can repopulate the brooklyn objects. The purpose
- * of the rebind is to reconstruct and reconnect the brooklyn objects, including
- * binding them to external resources.
- * 
- * Users are strongly discouraged to call or use this interface.
- * It is for internal use only, relating to persisting/rebinding entities.
- * This interface may change (or be removed) in a future release without notice.
- */
-@Beta
-public interface Rebindable {
-
-    public RebindSupport<?> getRebindSupport();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java
deleted file mode 100644
index 1c66c70..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.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.api.mgmt.rebind.mementos;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Represents an entire persisted Brooklyn management context, with all its entities and locations.
- * 
- * The referential integrity of this memento is not guaranteed. For example, an entity memento might
- * reference a child entity that does not exist. This is an inevitable consequence of not using a
- * stop-the-world persistence strategy, and is essential for a distributed brooklyn to be performant.
- * 
- * Code using this memento should be tolerant of such inconsistencies (e.g. log a warning about the 
- * missing entity, and then ignore dangling references when constructing the entities/locations, so
- * that code will not subsequently get NPEs when iterating over children for example).
- * 
- * @author aled
- */
-public interface BrooklynMemento extends Serializable {
-
-    public EntityMemento getEntityMemento(String id);
-    public LocationMemento getLocationMemento(String id);
-    public PolicyMemento getPolicyMemento(String id);
-    public EnricherMemento getEnricherMemento(String id);
-    public FeedMemento getFeedMemento(String id);
-    public CatalogItemMemento getCatalogItemMemento(String id);
-
-    public Collection<String> getApplicationIds();
-    public Collection<String> getTopLevelLocationIds();
-
-    public Collection<String> getEntityIds();
-    public Collection<String> getLocationIds();
-    public Collection<String> getPolicyIds();
-    public Collection<String> getEnricherIds();
-    public Collection<String> getFeedIds();
-    public Collection<String> getCatalogItemIds();
-
-    public Map<String, EntityMemento> getEntityMementos();
-    public Map<String, LocationMemento> getLocationMementos();
-    public Map<String, PolicyMemento> getPolicyMementos();
-    public Map<String, EnricherMemento> getEnricherMementos();
-    public Map<String, FeedMemento> getFeedMementos();
-    public Map<String, CatalogItemMemento> getCatalogItemMementos();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
deleted file mode 100644
index 2efc6f6..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
+++ /dev/null
@@ -1,58 +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.api.mgmt.rebind.mementos;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.objs.Identifiable;
-
-/**
- * Represents a manifest of the entities etc in the overall memento.
- * 
- * @author aled
- */
-public interface BrooklynMementoManifest extends Serializable {
-    public interface EntityMementoManifest extends Identifiable{
-        public String getId();
-        public String getType();
-        public String getParent();
-        public String getCatalogItemId();
-    }
-
-    public Map<String, EntityMementoManifest> getEntityIdToManifest();
-
-    public Map<String, String> getLocationIdToType();
-
-    public Map<String, String> getPolicyIdToType();
-
-    public Map<String, String> getEnricherIdToType();
-
-    public Map<String, String> getFeedIdToType();
-    
-    public CatalogItemMemento getCatalogItemMemento(String id);
-
-    public Collection<String> getCatalogItemIds();
-
-    public Map<String, CatalogItemMemento> getCatalogItemMementos();
-
-    public boolean isEmpty();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
deleted file mode 100644
index 03673fd..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
+++ /dev/null
@@ -1,138 +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.api.mgmt.rebind.mementos;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.TimeoutException;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.PersistenceExceptionHandler;
-import org.apache.brooklyn.api.mgmt.rebind.RebindExceptionHandler;
-import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Controls the persisting and reading back of mementos. Used by {@link RebindManager} 
- * to support brooklyn restart.
- */
-public interface BrooklynMementoPersister {
-
-    public static interface LookupContext {
-        ManagementContext lookupManagementContext();
-        Entity lookupEntity(String id);
-        Location lookupLocation(String id);
-        Policy lookupPolicy(String id);
-        Enricher lookupEnricher(String id);
-        Feed lookupFeed(String id);
-        CatalogItem<?, ?> lookupCatalogItem(String id);
-        
-        /** retrieve the item with the given ID, optionally ensuring it is of the indicated type; null if not found */
-        BrooklynObject lookup(@Nullable BrooklynObjectType type, String objectId);
-        /** like {@link #lookup(BrooklynObjectType, String)} but doesn't record an exception if not found */
-        BrooklynObject peek(@Nullable BrooklynObjectType type, String objectId);
-    }
-    
-    /**
-     * Loads raw data contents of the mementos.
-     * <p>
-     * Some classes (esp deprecated ones) may return null here,
-     * meaning that the {@link #loadMementoManifest(BrooklynMementoRawData, RebindExceptionHandler)}
-     * and {@link #loadMemento(BrooklynMementoRawData, LookupContext, RebindExceptionHandler)} methods
-     * will populate the raw data via another source.
-     */
-    BrooklynMementoRawData loadMementoRawData(RebindExceptionHandler exceptionHandler);
-
-    /**
-     * Loads minimal manifest information (almost entirely *not* deserialized).
-     * Implementations should load the raw data if {@link BrooklynMementoRawData} is not supplied,
-     * but callers are encouraged to supply that for optimal performance.
-     */
-    BrooklynMementoManifest loadMementoManifest(@Nullable BrooklynMementoRawData mementoData, RebindExceptionHandler exceptionHandler) throws IOException;
-
-     /**
-      * Retrieves the memento class, containing deserialized objects (but not the {@link BrooklynObject} class).
-      * Implementations should load the raw data if {@link BrooklynMementoRawData} is not supplied,
-      * but callers are encouraged to supply that for optimal performance.
-      * <p>
-      * Note that this method is *not* thread safe.
-      */
-    BrooklynMemento loadMemento(@Nullable BrooklynMementoRawData mementoData, LookupContext lookupContext, RebindExceptionHandler exceptionHandler) throws IOException;
-
-    /** applies a full checkpoint (write) of all state */  
-    void checkpoint(BrooklynMementoRawData newMemento, PersistenceExceptionHandler exceptionHandler);
-    /** applies a partial write of state delta */  
-    void delta(Delta delta, PersistenceExceptionHandler exceptionHandler);
-    /** inserts an additional delta to be written on the next delta request */
-    @Beta
-    void queueDelta(Delta delta);
-
-    void enableWriteAccess();
-    void disableWriteAccess(boolean graceful);
-    /** permanently shuts down all access to the remote store */
-    void stop(boolean graceful);
-
-    @VisibleForTesting
-    void waitForWritesCompleted(Duration timeout) throws InterruptedException, TimeoutException;
-
-    String getBackingStoreDescription();
-    
-    /** All methods on this interface are unmodifiable by the caller. Sub-interfaces may introduce modifiers. */
-    // NB: the type-specific methods aren't actually used anymore; we could remove them to simplify the impl (and use a multiset there)
-    public interface Delta {
-        Collection<LocationMemento> locations();
-        Collection<EntityMemento> entities();
-        Collection<PolicyMemento> policies();
-        Collection<EnricherMemento> enrichers();
-        Collection<FeedMemento> feeds();
-        Collection<CatalogItemMemento> catalogItems();
-        
-        Collection<String> removedLocationIds();
-        Collection<String> removedEntityIds();
-        Collection<String> removedPolicyIds();
-        Collection<String> removedEnricherIds();
-        Collection<String> removedFeedIds();
-        Collection<String> removedCatalogItemIds();
-        
-        Collection<? extends Memento> getObjectsOfType(BrooklynObjectType type);
-        Collection<String> getRemovedIdsOfType(BrooklynObjectType type);
-    }
-    
-    @Beta
-    public interface MutableDelta extends Delta {
-        void add(BrooklynObjectType type, Memento memento);
-        void addAll(BrooklynObjectType type, Iterable<? extends Memento> memento);
-        void removed(BrooklynObjectType type, Set<String> removedIdsOfType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java
deleted file mode 100644
index 804304d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.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 org.apache.brooklyn.api.mgmt.rebind.mementos;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Maps;
-
-/**
- * Represents the raw persisted data.
- */
-@Beta
-public class BrooklynMementoRawData {
-
-    // TODO Should this be on an interface?
-    // The file-based (or object-store based) structure for storing data may well change; is this representation sufficient?
-
-    public static Builder builder() {
-        return new Builder();
-    }
-    
-    public static class Builder {
-        protected String brooklynVersion;
-        protected final Map<String, String> entities = Maps.newConcurrentMap();
-        protected final Map<String, String> locations = Maps.newConcurrentMap();
-        protected final Map<String, String> policies = Maps.newConcurrentMap();
-        protected final Map<String, String> enrichers = Maps.newConcurrentMap();
-        protected final Map<String, String> feeds = Maps.newConcurrentMap();
-        protected final Map<String, String> catalogItems = Maps.newConcurrentMap();
-        
-        public Builder brooklynVersion(String val) {
-            brooklynVersion = val; return this;
-        }
-        public Builder entity(String id, String val) {
-            entities.put(id, val); return this;
-        }
-        public Builder entities(Map<String, String> vals) {
-            entities.putAll(vals); return this;
-        }
-        public Builder location(String id, String val) {
-            locations.put(id, val); return this;
-        }
-        public Builder locations(Map<String, String> vals) {
-            locations.putAll(vals); return this;
-        }
-        public Builder policy(String id, String val) {
-            policies.put(id, val); return this;
-        }
-        public Builder policies(Map<String, String> vals) {
-            policies.putAll(vals); return this;
-        }
-        public Builder enricher(String id, String val) {
-            enrichers.put(id, val); return this;
-        }
-        public Builder enrichers(Map<String, String> vals) {
-            enrichers.putAll(vals); return this;
-        }
-        public Builder feed(String id, String val) {
-            feeds.put(id, val); return this;
-        }
-        public Builder feeds(Map<String, String> vals) {
-            feeds.putAll(vals); return this;
-        }
-        public Builder catalogItem(String id, String val) {
-            catalogItems.put(id, val); return this;
-        }
-        public Builder catalogItems(Map<String, String> vals) {
-            catalogItems.putAll(vals); return this;
-        }
-        
-        public Builder put(BrooklynObjectType type, String id, String val) {
-            switch (type) {
-            case ENTITY: return entity(id, val);
-            case LOCATION: return location(id, val);
-            case POLICY: return policy(id, val);
-            case ENRICHER: return enricher(id, val);
-            case FEED: return feed(id, val);
-            case CATALOG_ITEM: return catalogItem(id, val);
-            case UNKNOWN:
-            default:
-                throw new IllegalArgumentException(type+" not supported");
-            }
-        }
-        public Builder putAll(BrooklynObjectType type, Map<String,String> vals) {
-            switch (type) {
-            case ENTITY: return entities(vals);
-            case LOCATION: return locations(vals);
-            case POLICY: return policies(vals);
-            case ENRICHER: return enrichers(vals);
-            case FEED: return feeds(vals);
-            case CATALOG_ITEM: return catalogItems(vals);
-            case UNKNOWN:
-            default:
-                throw new IllegalArgumentException(type+" not supported");
-            }
-        }
-
-        public BrooklynMementoRawData build() {
-            return new BrooklynMementoRawData(this);
-        }
-    }
-
-    private final Map<String, String> entities;
-    private final Map<String, String> locations;
-    private final Map<String, String> policies;
-    private final Map<String, String> enrichers;
-    private final Map<String, String> feeds;
-    private final Map<String, String> catalogItems;
-    
-    private BrooklynMementoRawData(Builder builder) {
-        entities = builder.entities;
-        locations = builder.locations;
-        policies = builder.policies;
-        enrichers = builder.enrichers;
-        feeds = builder.feeds;
-        catalogItems = builder.catalogItems;
-    }
-
-    public Map<String, String> getEntities() {
-        return Collections.unmodifiableMap(entities);
-    }
-
-    public Map<String, String> getLocations() {
-        return Collections.unmodifiableMap(locations);
-    }
-
-    public Map<String, String> getPolicies() {
-        return Collections.unmodifiableMap(policies);
-    }
-
-    public Map<String, String> getEnrichers() {
-        return Collections.unmodifiableMap(enrichers);
-    }
-    
-    public Map<String, String> getFeeds() {
-        return Collections.unmodifiableMap(feeds);
-    }
-    
-    public Map<String, String> getCatalogItems() {
-        return Collections.unmodifiableMap(catalogItems);
-    }
-    
-    // to handle reset catalog
-    @Beta
-    public void clearCatalogItems() {
-        catalogItems.clear();
-    }
-    
-    public boolean isEmpty() {
-        return entities.isEmpty() && locations.isEmpty() && policies.isEmpty() && enrichers.isEmpty() && feeds.isEmpty() && catalogItems.isEmpty();
-    }
-    
-    public Map<String, String> getObjectsOfType(BrooklynObjectType type) {
-        switch (type) {
-        case ENTITY: return getEntities();
-        case LOCATION: return getLocations();
-        case POLICY: return getPolicies();
-        case ENRICHER: return getEnrichers();
-        case FEED: return getFeeds();
-        case CATALOG_ITEM: return getCatalogItems();
-        default:
-            throw new IllegalArgumentException("Type "+type+" not supported");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
deleted file mode 100644
index 57fbb8d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.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 org.apache.brooklyn.api.mgmt.rebind.mementos;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.objs.SpecParameter;
-
-public interface CatalogItemMemento extends Memento {
-
-    String getDescription();
-
-    String getSymbolicName();
-
-    String getIconUrl();
-
-    String getVersion();
-
-    String getPlanYaml();
-
-    String getJavaType();
-
-    List<SpecParameter<?>> getParameters();
-
-    Collection<CatalogItem.CatalogBundle> getLibraries();
-
-    CatalogItem.CatalogItemType getCatalogItemType();
-
-    Class<?> getCatalogItemJavaType();
-
-    Class<?> getSpecType();
-
-    boolean isDeprecated();
-
-    boolean isDisabled();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
deleted file mode 100644
index c6b7e8c..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
+++ /dev/null
@@ -1,33 +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.api.mgmt.rebind.mementos;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-
-/**
- * Represents the state of an enricher, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- */
-public interface EnricherMemento extends Memento {
-
-    Map<String, Object> getConfig();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java
deleted file mode 100644
index 4c74695..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java
+++ /dev/null
@@ -1,80 +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.api.mgmt.rebind.mementos;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-
-/**
- * Represents the state of an entity, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- * 
- * @author aled
- */
-public interface EntityMemento extends Memento, TreeNode {
-
-    /** all dynamic effectors (ie differences between those registered on the entity type */ 
-    public List<Effector<?>> getEffectors();
-
-    public Map<ConfigKey<?>, Object> getConfig();
-
-    /** true if the entity is top-level (parentless) and an application
-     * (there may be parentless "orphaned" entities, for which this is false,
-     * and "application" instances nested inside other apps, for which this is again)
-     */
-    public boolean isTopLevelApp();
-    
-    public Map<String, Object> getConfigUnmatched();
-    
-    public Map<AttributeSensor<?>, Object> getAttributes();
-
-    /**
-     * The ids of the member entities, if this is a Group; otherwise empty.
-     * 
-     * @see Group.getMembers()
-     */
-    public List<String> getMembers();
-    
-    /**
-     * The ids of the locations for this entity.
-     */
-    public List<String> getLocations();
-
-    /**
-     * The ids of the policies of this entity.
-     */
-    public Collection<String> getPolicies();
-
-    /**
-     * The ids of the enrichers of this entity.
-     */
-    public Collection<String> getEnrichers();
-
-    /**
-     * The ids of the sensor feeds attached to this entity.
-     */
-    public Collection<String> getFeeds();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
deleted file mode 100644
index 52424c3..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
+++ /dev/null
@@ -1,33 +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.api.mgmt.rebind.mementos;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-
-/**
- * Represents the state of a feed, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- */
-public interface FeedMemento extends Memento {
-
-    Map<String, Object> getConfig();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java
deleted file mode 100644
index 016db01..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.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 org.apache.brooklyn.api.mgmt.rebind.mementos;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-
-/**
- * Represents the state of a location, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- * 
- * @author aled
- */
-public interface LocationMemento extends TreeNode, Memento {
-
-    Map<String, Object> getLocationConfig();
-    Set<String> getLocationConfigUnused();
-    String getLocationConfigDescription();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java
deleted file mode 100644
index 5911f28..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java
+++ /dev/null
@@ -1,85 +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.api.mgmt.rebind.mementos;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-
-/**
- * Represents the internal state of something in brooklyn, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- * 
- * @author aled
- */
-public interface Memento extends Serializable {
-
-    /**
-     * The version of brooklyn used when this memento was generated.
-     */
-    String getBrooklynVersion();
-    
-    String getId();
-    
-    public String getType();
-    
-    public String getCatalogItemId();
-    
-    public String getDisplayName();
-    
-    /**
-     * A (weakly-typed) property set for this memento.
-     * These can be used to avoid sub-classing the entity memento, but developers can sub-class to get strong typing if desired.
-     * 
-     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather than requiring "custom fields"
-     */
-    @Deprecated
-    public Object getCustomField(String name);
-
-    /**
-     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather than requiring "custom fields"
-     */
-    @Deprecated
-    public Map<String, ? extends Object> getCustomFields();
-    
-    public String toVerboseString();
-    
-    public void injectTypeClass(Class<?> clazz);
-    
-    /**
-     * Returns the injected type class, or null if not injected.
-     * <p>
-     * This is useful for ensuring the correct classloader is used (e.g. for {@link EntityMemento} 
-     * previously calling {@code EntityTypes.getDefinedSensors(getType())}. 
-     */
-    public Class<?> getTypeClass();
-
-    public Collection<Object> getTags();
-    
-    public Map<String,Set<String>> getRelations();
-    
-    /** Null for {@link Entity}, but important for adjuncts; see {@link EntityAdjunct#getUniqueTag()} */
-    public String getUniqueTag();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java
deleted file mode 100644
index bfec7af..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.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.api.mgmt.rebind.mementos;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-
-/**
- * Represents the state of an policy, so that it can be reconstructed (e.g. after restarting brooklyn).
- * 
- * @see RebindSupport
- * 
- * @author aled
- */
-public interface PolicyMemento extends Memento {
-
-    Map<String, Object> getConfig();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
deleted file mode 100644
index cde6a34..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
+++ /dev/null
@@ -1,48 +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.api.mgmt.rebind.mementos;
-
-import java.util.List;
-
-/**
- * A simple tree structure, where a node references a parent and children using their ids.
- * 
- * e.g. could be used to represent the entity hierarchy within mementos, where the 
- * String is the id of parent/child entities.
- * 
- * @author aled
- */
-public interface TreeNode {
-
-    /**
-     * The id of this node in the tree. This id will be used by the parent's getChildren(), 
-     * and by each child's getParent().
-     */
-    String getId();
-    
-    /**
-     * The id of the parent entity, or null if none.
-     */
-    String getParent();
-    
-    /**
-     * The ids of the children.
-     */
-    List<String> getChildren();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
deleted file mode 100644
index b42bc58..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
+++ /dev/null
@@ -1,169 +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.api.objs;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.relations.RelationshipType;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Super-type of entity, location, policy and enricher.
- */
-public interface BrooklynObject extends Identifiable, Configurable {
-    
-    /**
-     * A display name; recommended to be a concise single-line description.
-     */
-    String getDisplayName();
-
-    /**
-     * The catalog item ID this object was loaded from.
-     * <p>
-     * This can be used to understand the appropriate classloading context,
-     * such as for versioning purposes, as well as meta-information such as 
-     * branding (maybe you can even get an icon) and 
-     * potentially things like resource lifecycle (if a software version is being sunsetted).
-     * <p>
-     * In some cases this may be set heuristically from context and so may not be accurate.
-     * Callers can set an explicit catalog item ID if inferencing is not correct.
-     */
-    String getCatalogItemId();
-    
-    /** 
-     * Tags are arbitrary objects which can be attached to an entity for subsequent reference.
-     * They must not be null (as {@link ImmutableMap} may be used under the covers; also there is little point!);
-     * and they should be amenable to our persistence (on-disk serialization) and our JSON serialization in the REST API.
-     */
-    TagSupport tags();
-
-    /**
-     * Subscriptions are the mechanism for receiving notifications of sensor-events (e.g. attribute-changed) from 
-     * other entities.
-     */
-    SubscriptionSupport subscriptions();
-
-    /**
-     * Relations specify a typed, directed connection between two entities.
-     * Generic type is overridden in sub-interfaces.
-     */
-    public RelationSupport<?> relations();
-    
-    public interface TagSupport {
-        /**
-         * @return An immutable copy of the set of tags on this entity. 
-         * Note {@link #containsTag(Object)} will be more efficient,
-         * and {@link #addTag(Object)} and {@link #removeTag(Object)} will not work on the returned set.
-         */
-        @Nonnull Set<Object> getTags();
-        
-        boolean containsTag(@Nonnull Object tag);
-        
-        boolean addTag(@Nonnull Object tag);
-        
-        boolean addTags(@Nonnull Iterable<?> tags);
-        
-        boolean removeTag(@Nonnull Object tag);
-    }
-    
-    @Beta
-    public interface SubscriptionSupport {
-        /**
-         * Allow us to subscribe to data from a {@link Sensor} on another entity.
-         * 
-         * @return a subscription id which can be used to unsubscribe
-         *
-         * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
-         */
-        @Beta
-        <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
-     
-        /**
-         * Allow us to subscribe to data from a {@link Sensor} on another entity.
-         * 
-         * @return a subscription id which can be used to unsubscribe
-         *
-         * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
-         */
-        @Beta
-        <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-        /** @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
-        @Beta
-        <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
-     
-        /** @see SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener) */
-        @Beta
-        <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-        /**
-         * Unsubscribes from the given producer.
-         *
-         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-         */
-        @Beta
-        boolean unsubscribe(Entity producer);
-
-        /**
-         * Unsubscribes the given handle.
-         *
-         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-         */
-        @Beta
-        boolean unsubscribe(Entity producer, SubscriptionHandle handle);
-        
-        /**
-         * Unsubscribes the given handle.
-         * 
-         * It is (currently) more efficient to also pass in the producer -
-         * see {@link SubscriptionSupport#unsubscribe(Entity, SubscriptionHandle)} 
-         */
-        boolean unsubscribe(SubscriptionHandle handle);
-    }
-    
-    public interface RelationSupport<T extends BrooklynObject> {
-        /** Adds a relationship of the given type from this object pointing at the given target, 
-         * and ensures that the inverse relationship (if there is one) is present at the target pointing back at this object. 
-         */
-        public <U extends BrooklynObject> void add(RelationshipType<? super T,? super U> relationship, U target);
-        
-        /** Removes any and all relationships of the given type from this object pointing at the given target,
-         * and ensures that the inverse relationships (if there are one) are also removed. 
-         */
-        public <U extends BrooklynObject> void remove(RelationshipType<? super T,? super U> relationship, U target);
-        
-        /** @return the {@link RelationshipType}s originating from this object */
-        public Set<RelationshipType<? super T,? extends BrooklynObject>> getRelationshipTypes();
-        
-        /** @return the {@link BrooklynObject}s which are targets of the given {@link RelationshipType} */
-        public <U extends BrooklynObject> Set<U> getRelations(RelationshipType<? super T,U> relationshipType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
deleted file mode 100644
index e0ef84c..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
+++ /dev/null
@@ -1,79 +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.api.objs;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.sensor.Feed;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.CaseFormat;
-
-@Beta
-public enum BrooklynObjectType {
-    // these are correctly type-checked by i can't tell how to get java not to warn!
-    @SuppressWarnings("unchecked") ENTITY(Entity.class, EntitySpec.class, "entities"),
-    @SuppressWarnings("unchecked") LOCATION(Location.class, LocationSpec.class, "locations"),
-    @SuppressWarnings("unchecked") POLICY(Policy.class, PolicySpec.class, "policies"),
-    @SuppressWarnings("unchecked") ENRICHER(Enricher.class, EnricherSpec.class, "enrichers"),
-    FEED(Feed.class, null, "feeds"),
-    CATALOG_ITEM(CatalogItem.class, null, "catalog"),
-    UNKNOWN(null, null, "unknown");
-    
-    private final Class<? extends BrooklynObject> interfaceType;
-    private final Class<? extends AbstractBrooklynObjectSpec<?,?>> specType;
-    private final String subPathName;
-    
-    <T extends BrooklynObject,K extends AbstractBrooklynObjectSpec<T,K>> BrooklynObjectType(Class<T> interfaceType, Class<K> specType, String subPathName) {
-        this.interfaceType = interfaceType;
-        this.specType = specType;
-        this.subPathName = subPathName;
-    }
-    public String toCamelCase() {
-        return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, this.name());
-    }
-
-    public String getSubPathName() {
-        return subPathName;
-    }
-    
-    public Class<? extends BrooklynObject> getInterfaceType() {
-        return interfaceType;
-    }
-    
-    public Class<? extends AbstractBrooklynObjectSpec<?, ?>> getSpecType() {
-        return specType;
-    }
-    
-    public static BrooklynObjectType of(BrooklynObject instance) {
-        for (BrooklynObjectType t: values()) {
-            if (t.getInterfaceType()!=null && t.getInterfaceType().isInstance(instance))
-                return t;
-        }
-        return UNKNOWN;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java
deleted file mode 100644
index 72d0be9..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.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.api.objs;
-
-import java.io.Serializable;
-import java.util.Set;
-
-import org.apache.brooklyn.config.ConfigKey;
-
-/**
- * Gives type information for a {@link BrooklynObject}. It is an immutable snapshot.
- * 
- * It reflects a given brooklyn object at the time the snapshot was created: if anything
- * were added or removed on-the-fly then those changes will be included in subsequent
- * snapshots. Therefore instances of a given class could have different {@link BrooklynType}s.
- */
-// TODO rename as BrooklynObjectSignature or BrooklynObjectMetadata;
-// or (perhaps better and easier to retire deprecated usage, if that is required?)
-// introduce new mechanism for storing accessing this information
-public interface BrooklynType extends Serializable {
-
-    /**
-     * The type name of this entity (normally the fully qualified class name).
-     */
-    String getName();
-    
-    /**
-     * The simple type name of this entity (normally the unqualified class name).
-     */
-    String getSimpleName();
-
-    /**
-     * ConfigKeys available on this entity.
-     */
-    Set<ConfigKey<?>> getConfigKeys();
-    
-    /**
-     * The ConfigKey with the given name, or null if not found.
-     */
-    ConfigKey<?> getConfigKey(String name);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java
deleted file mode 100644
index d7f2935..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.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.api.objs;
-
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Something that has mutable config, such as an entity or policy.
- * 
- * @author aled
- */
-public interface Configurable {
-
-    // FIXME Moved from core project to api project, as part of moving EntityLocal.
-    // (though maybe it's fine here?)
-
-    /**
-     * @return the old value, or null if there was not one
-     * @deprecated since 0.7.0; use {@link ConfigurationSupport#set(ConfigKey, Object)}, such as {@code config().set(key, val)} 
-     */
-    @Deprecated
-    public <T> T setConfig(ConfigKey<T> key, T val);
-
-    /**
-     * Convenience for calling {@link ConfigurationSupport#get(ConfigKey)},
-     * via code like {@code config().get(key)}.
-     * 
-     * @since 0.9.0
-     */
-    <T> T getConfig(ConfigKey<T> key);
-
-    ConfigurationSupport config();
-    
-    @Beta
-    public interface ConfigurationSupport {
-
-        /**
-         * Gets the given configuration value for this entity, in the following order of precedence:
-         * <ol>
-         *   <li> value (including null) explicitly set on the entity
-         *   <li> value (including null) explicitly set on an ancestor (inherited)
-         *   <li> a default value (including null) on the best equivalent static key of the same name declared on the entity
-         *        (where best equivalence is defined as preferring a config key which extends another, 
-         *        as computed in EntityDynamicType.getConfigKeys)
-         *   <li> a default value (including null) on the key itself
-         *   <li> null
-         * </ol>
-         */
-        <T> T get(ConfigKey<T> key);
-        
-        /**
-         * @see {@link #getConfig(ConfigKey)}
-         */
-        <T> T get(HasConfigKey<T> key);
-
-        /**
-         * Sets the config to the given value.
-         */
-        <T> T set(ConfigKey<T> key, T val);
-        
-        /**
-         * @see {@link #setConfig(HasConfigKey, Object)}
-         */
-        <T> T set(HasConfigKey<T> key, T val);
-        
-        /**
-         * Sets the config to the value returned by the task.
-         * 
-         * Returns immediately without blocking; subsequent calls to {@link #getConfig(ConfigKey)} 
-         * will execute the task, and block until the task completes.
-         * 
-         * @see {@link #setConfig(ConfigKey, Object)}
-         */
-        <T> T set(ConfigKey<T> key, Task<T> val);
-        
-        /**
-         * @see {@link #setConfig(ConfigKey, Task)}
-         */
-        <T> T set(HasConfigKey<T> key, Task<T> val);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java
deleted file mode 100644
index 674d7f2..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.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 org.apache.brooklyn.api.objs;
-
-import javax.annotation.Nullable;
-
-/**
- * EntityAdjuncts are supplementary logic that can be attached to Entities, 
- * such as providing sensor enrichment or event-driven policy behavior
- */
-public interface EntityAdjunct extends BrooklynObject {
-    /**
-     * A unique id for this adjunct, typically created by the system with no meaning
-     */
-    @Override
-    String getId();
-
-    /**
-     * Whether the adjunct is destroyed
-     */
-    boolean isDestroyed();
-    
-    /**
-     * Whether the adjunct is available/active, ie started and not stopped or interrupted
-     */
-    boolean isRunning();
-    
-    /**
-     * An optional tag used to identify adjuncts with a specific purpose, typically created by the caller.
-     * This is used to prevent multiple instances with the same purpose from being created,
-     * and to access and customize adjuncts so created.
-     * <p>
-     * This will be included in the call to {@link #getTags()}.
-     */
-    @Nullable String getUniqueTag();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
deleted file mode 100644
index 3d13337..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
+++ /dev/null
@@ -1,26 +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.api.objs;
-
-public interface HasShortName {
-
-    /** gets a short name, for human-friendly identification e.g. inside the name of a VM */
-    String getShortName();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java
deleted file mode 100644
index bf4b042..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.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 org.apache.brooklyn.api.objs;
-
-public interface Identifiable {
-
-    String getId();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java
deleted file mode 100644
index fd7047e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.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 org.apache.brooklyn.api.objs;
-
-import java.io.Serializable;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-
-/** A wrapper around a {@link ConfigKey} which will be added to an {@link Entity},
- * providing additional information for rendering in a UI */
-public interface SpecParameter<T> extends Serializable {
-    /** Short name, to be used in UI */
-    String getLabel();
-    /** Whether visible by default in UI, not all inputs may be visible at once */
-    boolean isPinned();
-    /** All config key info for this spec parameter;
-     * this is the config key which is added to the defined type */
-    ConfigKey<T> getConfigKey();
-    /** An optional sensor which may also be added to the defined type */
-    @Nullable AttributeSensor<?> getSensor();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java
deleted file mode 100644
index 5b1e2fa..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java
+++ /dev/null
@@ -1,80 +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.api.policy;
-
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.PolicyMemento;
-import org.apache.brooklyn.api.objs.Configurable;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.config.ConfigKey;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Policies implement actions and thus must be suspendable; policies should continue to evaluate their sensors
- * and indicate their desired planned action even if they aren't invoking them
- */
-public interface Policy extends EntityAdjunct, Rebindable, Configurable {
-    /**
-     * A unique id for this policy.
-     */
-    @Override
-    String getId();
-
-    /**
-     * Information about the type of this entity; analogous to Java's object.getClass.
-     */
-    @Beta
-    PolicyType getPolicyType();
-
-    /**
-     * Resume the policy
-     */
-    void resume();
-
-    /**
-     * Suspend the policy
-     */
-    void suspend();
-    
-    /**
-     * Whether the policy is suspended
-     */
-    boolean isSuspended();
-    
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().set(key, val)}
-     */
-    @Deprecated
-    <T> T setConfig(ConfigKey<T> key, T val);
-    
-    /**
-     * Users are strongly discouraged from calling or overriding this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    RebindSupport<PolicyMemento> getRebindSupport();
-    
-    @Override
-    RelationSupport<Policy> relations();
-    
-}


[16/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
deleted file mode 100644
index c4f383d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
+++ /dev/null
@@ -1,81 +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.core.entity;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.util.collections.CollectionFunctionals;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-/** Generally useful tasks related to entities */
-public class EntityTasks {
-
-    /** creates an (unsubmitted) task which waits for the attribute to satisfy the given predicate,
-     * returning false if it times out or becomes unmanaged */
-    public static <T> Task<Boolean> testingAttributeEventually(Entity entity, AttributeSensor<T> sensor, Predicate<T> condition, Duration timeout) {
-        return DependentConfiguration.builder().attributeWhenReady(entity, sensor)
-            .readiness(condition)
-            .postProcess(Functions.constant(true))
-            .timeout(timeout)
-            .onTimeoutReturn(false)
-            .onUnmanagedReturn(false)
-            .build();
-    }
-
-    /** creates an (unsubmitted) task which waits for the attribute to satisfy the given predicate,
-     * throwing if it times out or becomes unmanaged */
-    public static <T> Task<Boolean> requiringAttributeEventually(Entity entity, AttributeSensor<T> sensor, Predicate<T> condition, Duration timeout) {
-        return DependentConfiguration.builder().attributeWhenReady(entity, sensor)
-            .readiness(condition)
-            .postProcess(Functions.constant(true))
-            .timeout(timeout)
-            .onTimeoutThrow()
-            .onUnmanagedThrow()
-            .build();
-    }
-
-    /** as {@link #testingAttributeEventually(Entity, AttributeSensor, Predicate, Duration) for multiple entities */
-    public static <T> Task<Boolean> testingAttributeEventually(Iterable<Entity> entities, AttributeSensor<T> sensor, Predicate<T> condition, Duration timeout) {
-        return DependentConfiguration.builder().attributeWhenReadyFromMultiple(entities, sensor, condition)
-            .postProcess(Functions.constant(true))
-            .timeout(timeout)
-            .onTimeoutReturn(false)
-            .onUnmanagedReturn(false)
-            .postProcessFromMultiple(CollectionFunctionals.all(Predicates.equalTo(true)))
-            .build();
-    }
-    
-    /** as {@link #requiringAttributeEventually(Entity, AttributeSensor, Predicate, Duration) for multiple entities */
-    public static <T> Task<Boolean> requiringAttributeEventually(Iterable<Entity> entities, AttributeSensor<T> sensor, Predicate<T> condition, Duration timeout) {
-        return DependentConfiguration.builder().attributeWhenReadyFromMultiple(entities, sensor, condition)
-            .postProcess(Functions.constant(true))
-            .timeout(timeout)
-            .onTimeoutThrow()
-            .onUnmanagedThrow()
-            .postProcessFromMultiple(CollectionFunctionals.all(Predicates.equalTo(true)))
-            .build();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
deleted file mode 100644
index ef5c710..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
+++ /dev/null
@@ -1,126 +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.core.entity;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.EntityType;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.objs.BrooklynTypeSnapshot;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-public class EntityTypeSnapshot extends BrooklynTypeSnapshot implements EntityType {
-    private static final long serialVersionUID = 4670930188951106009L;
-    
-    private final Map<String, Sensor<?>> sensors;
-    private final Set<Effector<?>> effectors;
-    private final Set<Sensor<?>> sensorsSet;
-
-    EntityTypeSnapshot(String name, Map<String, ConfigKey<?>> configKeys, Map<String, Sensor<?>> sensors, Collection<Effector<?>> effectors) {
-        super(name, configKeys);
-        this.sensors = ImmutableMap.copyOf(sensors);
-        this.effectors = ImmutableSet.copyOf(effectors);
-        this.sensorsSet = ImmutableSet.copyOf(this.sensors.values());
-    }
-
-    @Override
-    public Set<Sensor<?>> getSensors() {
-        return sensorsSet;
-    }
-    
-    @Override
-    public Set<Effector<?>> getEffectors() {
-        return effectors;
-    }
-
-    @Override
-    public Maybe<Effector<?>> getEffectorByName(String name) {
-        for (Effector<?> contender : effectors) {
-            if (name.equals(contender.getName()))
-                return Maybe.<Effector<?>>of(contender);
-        }
-        return Maybe.<Effector<?>>absent("No effector matching '"+name+"'");        
-    }
-    
-    @Override
-    public Effector<?> getEffector(String name, Class<?>... parameterTypes) {
-        // TODO Could index for more efficient lookup (e.g. by name in a MultiMap, or using name+parameterTypes as a key)
-        // TODO Looks for exact match; could go for what would be valid to call (i.e. if parameterType is sub-class of ParameterType.getParameterClass then ok)
-        // TODO Could take into account ParameterType.getDefaultValue() for what can be omitted
-        
-        effectorLoop : for (Effector<?> contender : effectors) {
-            if (name.equals(contender.getName())) {
-                List<ParameterType<?>> contenderParameters = contender.getParameters();
-                if (parameterTypes.length == contenderParameters.size()) {
-                    for (int i = 0; i < parameterTypes.length; i++) {
-                        if (parameterTypes[i] != contenderParameters.get(i).getParameterClass()) {
-                            continue effectorLoop;
-                        }
-                    }
-                    return contender;
-                }
-            }
-        }
-        throw new NoSuchElementException("No matching effector "+name+"("+Joiner.on(", ").join(parameterTypes)+") on entity "+getName());
-    }
-
-    @Override
-    public Sensor<?> getSensor(String name) {
-        return sensors.get(name);
-    }
-
-    @Override
-    public boolean hasSensor(String name) {
-        return sensors.containsKey(name);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(super.hashCode(), sensors, effectors);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (!(obj instanceof EntityTypeSnapshot)) return false;
-        EntityTypeSnapshot o = (EntityTypeSnapshot) obj;
-        
-        return super.equals(obj) && Objects.equal(sensors, o.sensors) && Objects.equal(effectors, o.effectors);
-    }
-    
-    @Override
-    protected ToStringHelper toStringHelper() {
-        return super.toStringHelper()
-                .add("sensors", sensors)
-                .add("effectors", effectors);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypes.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypes.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypes.java
deleted file mode 100644
index ebedb65..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypes.java
+++ /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.
- */
-package org.apache.brooklyn.core.entity;
-
-import org.apache.brooklyn.core.objs.BrooklynTypes;
-
-/**
- * @deprecated since 0.7.0; use {@link BrooklynTypes}
- */
-@Deprecated
-public class EntityTypes extends BrooklynTypes {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/StartableApplication.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/StartableApplication.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/StartableApplication.java
deleted file mode 100644
index c0e27c0..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/StartableApplication.java
+++ /dev/null
@@ -1,25 +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.core.entity;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.core.entity.trait.Startable;
-
-public interface StartableApplication extends Application, Startable {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/BasicEntityDriverManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/BasicEntityDriverManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/BasicEntityDriverManager.java
deleted file mode 100644
index b7c3bd5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/BasicEntityDriverManager.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 org.apache.brooklyn.core.entity.drivers;
-
-import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.EntityDriverManager;
-import org.apache.brooklyn.api.location.Location;
-
-import com.google.common.annotations.Beta;
-
-public class BasicEntityDriverManager implements EntityDriverManager {
-
-    private final RegistryEntityDriverFactory registry;
-    private final ReflectiveEntityDriverFactory reflective;
-    
-    public BasicEntityDriverManager() {
-        registry = new RegistryEntityDriverFactory();
-        reflective = new ReflectiveEntityDriverFactory();
-    }
-    
-    /** driver override mechanism; experimental @since 0.7.0 */
-    @Beta
-    public ReflectiveEntityDriverFactory getReflectiveDriverFactory() {
-        return reflective;
-    }
-    
-    public <D extends EntityDriver> void registerDriver(Class<D> driverInterface, Class<? extends Location> locationClazz, Class<? extends D> driverClazz) {
-        registry.registerDriver(driverInterface, locationClazz, driverClazz);
-    }
-    
-    @Override
-    public <D extends EntityDriver> D build(DriverDependentEntity<D> entity, Location location){
-        if (registry.hasDriver(entity, location)) {
-            return registry.build(entity, location);
-        } else {
-            return reflective.build(entity, location);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
deleted file mode 100644
index f9cf5a7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
+++ /dev/null
@@ -1,281 +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.core.entity.drivers;
-
-import java.lang.reflect.Constructor;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.location.Location;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.paas.PaasLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.ReferenceWithError;
-import org.apache.brooklyn.util.text.Strings;
-
-/**
- * Follows a class naming convention: the driver interface typically ends in "Driver", and the implementation 
- * must match the driver interface name but with a suffix like "SshDriver" instead of "Driver".
- * Other rules can be added using {@link #addRule(String, DriverInferenceRule)} or
- * {@link #addClassFullNameMapping(String, String)}.
- * <p>
- * Reflectively instantiates and returns the driver, based on the location passed in,
- * in {@link #build(DriverDependentEntity, Location)}.
- * 
- * @author Peter Veentjer, Alex Heneveld
- */
-public class ReflectiveEntityDriverFactory {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ReflectiveEntityDriverFactory.class);
-
-    /** Rules, keyed by a unique identifier.  Executed in order of most-recently added first. */
-    protected final Map<String,DriverInferenceRule> rules = MutableMap.of();
-    
-    public ReflectiveEntityDriverFactory() {
-        addRule(DriverInferenceForSshLocation.DEFAULT_IDENTIFIER, new DriverInferenceForSshLocation());
-        addRule(DriverInferenceForPaasLocation.DEFAULT_IDENTIFIER, new DriverInferenceForPaasLocation());
-        addRule(DriverInferenceForWinRmLocation.DEFAULT_IDENTIFIER, new DriverInferenceForWinRmLocation());
-    }
-    
-    public interface DriverInferenceRule {
-        public <D extends EntityDriver> ReferenceWithError<Class<? extends D>> resolve(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location);
-    }
-
-    public static abstract class AbstractDriverInferenceRule implements DriverInferenceRule {
-
-        @Override
-        public <D extends EntityDriver> ReferenceWithError<Class<? extends D>> resolve(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            try {
-                String newName = inferDriverClassName(entity, driverInterface, location);
-                if (newName==null) return null;
-
-                return loadDriverClass(newName, entity, driverInterface);
-                
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                return ReferenceWithError.newInstanceThrowingError(null, e);
-            }
-        }
-
-        public abstract <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location);
-
-        protected <D extends EntityDriver> ReferenceWithError<Class<? extends D>> loadDriverClass(String className, DriverDependentEntity<D> entity, Class<D> driverInterface) {
-            ReferenceWithError<Class<? extends D>> r1 = loadClass(className, entity.getClass().getClassLoader());
-            if (!r1.hasError()) return r1;
-            ReferenceWithError<Class<? extends D>> r2 = loadClass(className, driverInterface.getClass().getClassLoader());
-            if (!r2.hasError()) return r2;
-            return r1;
-        }
-
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        protected <D extends EntityDriver> ReferenceWithError<Class<? extends D>> loadClass(String className, ClassLoader classLoader) {
-            try {
-                return (ReferenceWithError<Class<? extends D>>)(ReferenceWithError) ReferenceWithError.newInstanceWithoutError((Class<? extends EntityDriver>)classLoader.loadClass(className));
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                return ReferenceWithError.newInstanceThrowingError(null, e);
-            }
-        }
-    }
-    
-    public static abstract class AbstractDriverInferenceRenamingInferenceRule extends AbstractDriverInferenceRule {
-
-        protected final String expectedPattern;
-        protected final String replacement;
-
-        public AbstractDriverInferenceRenamingInferenceRule(String expectedPattern, String replacement) {
-            this.expectedPattern = expectedPattern;
-            this.replacement = replacement;
-        }
-        
-        public String getIdentifier() {
-            return getClass().getName()+"["+expectedPattern+"]";
-        }
-        
-        @Override
-        public String toString() {
-            return getClass().getName()+"["+expectedPattern+"->"+replacement+"]";
-        }
-    }
-    
-    public static class DriverInferenceByRenamingClassFullName extends AbstractDriverInferenceRenamingInferenceRule {
-
-        public DriverInferenceByRenamingClassFullName(String expectedClassFullName, String newClassFullName) {
-            super(expectedClassFullName, newClassFullName);
-        }
-        
-        @Override
-        public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            if (driverInterface.getName().equals(expectedPattern)) {
-                return replacement;
-            }
-            return null;
-        }
-    }
-    
-    public static class DriverInferenceByRenamingClassSimpleName extends AbstractDriverInferenceRenamingInferenceRule {
-
-        public DriverInferenceByRenamingClassSimpleName(String expectedClassSimpleName, String newClassSimpleName) {
-            super(expectedClassSimpleName, newClassSimpleName);
-        }
-        
-        @Override
-        public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            if (driverInterface.getSimpleName().equals(expectedPattern)) { 
-                // i'd like to do away with drivers altogether, but if people *really* need to use this and suppress the warning,
-                // they can use the full class rename
-                LOG.warn("Using discouraged driver simple class rename to find "+replacement+" for "+expectedPattern+"; it is recommended to set getDriverInterface() or newDriver() appropriately");
-                return Strings.removeFromEnd(driverInterface.getName(), expectedPattern)+replacement;
-            }
-            return null;
-        }
-    }
-    
-    public static class DriverInferenceForSshLocation extends AbstractDriverInferenceRule {
-
-        public static final String DEFAULT_IDENTIFIER = "ssh-location-driver-inference-rule";
-
-        @Override
-        public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            String driverInterfaceName = driverInterface.getName();
-            if (!(location instanceof SshMachineLocation)) return null;
-            if (!driverInterfaceName.endsWith("Driver")) {
-                throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect SshDriver class name", driverInterfaceName));
-            }
-            return Strings.removeFromEnd(driverInterfaceName, "Driver")+"SshDriver";
-        }
-    }
-
-    public static class DriverInferenceForPaasLocation extends AbstractDriverInferenceRule {
-
-        public static final String DEFAULT_IDENTIFIER = "paas-location-driver-inference-rule";
-
-        @Override
-        public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            String driverInterfaceName = driverInterface.getName();
-            if (!(location instanceof PaasLocation)) return null;
-            if (!driverInterfaceName.endsWith("Driver")) {
-                throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect PaasDriver class name", driverInterfaceName));
-            }
-            return Strings.removeFromEnd(driverInterfaceName, "Driver") + ((PaasLocation) location).getPaasProviderName() + "Driver";
-        }
-    }
-
-    public static class DriverInferenceForWinRmLocation extends AbstractDriverInferenceRule {
-
-        public static final String DEFAULT_IDENTIFIER = "winrm-location-driver-inference-rule";
-
-        @Override
-        public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
-            String driverInterfaceName = driverInterface.getName();
-            // TODO: use a proper registry later on
-            try {
-                if (!Class.forName("org.apache.brooklyn.location.winrm.WinRmMachineLocation").isInstance(location)) return null;
-            } catch (ClassNotFoundException ex) {
-                return null;
-            }
-            if (!driverInterfaceName.endsWith("Driver")) {
-                throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect WinRmDriver class name", driverInterfaceName));
-            }
-            return Strings.removeFromEnd(driverInterfaceName, "Driver")+"WinRmDriver";
-        }
-    }
-
-    /** adds a rule; possibly replacing an old one if one exists with the given identifier. the new rule is added after all previous ones.
-     * @return the replaced rule, or null if there was no old rule */
-    public DriverInferenceRule addRule(String identifier, DriverInferenceRule rule) {
-        DriverInferenceRule oldRule = rules.remove(identifier);
-        rules.put(identifier, rule);
-        LOG.debug("Added driver mapping rule "+rule);
-        return oldRule;
-    }
-
-    public DriverInferenceRule addClassFullNameMapping(String expectedClassFullName, String newClassFullName) {
-        DriverInferenceByRenamingClassFullName rule = new DriverInferenceByRenamingClassFullName(expectedClassFullName, newClassFullName);
-        return addRule(rule.getIdentifier(), rule);
-    }
-
-    public DriverInferenceRule addClassSimpleNameMapping(String expectedClassSimpleName, String newClassSimpleName) {
-        DriverInferenceByRenamingClassSimpleName rule = new DriverInferenceByRenamingClassSimpleName(expectedClassSimpleName, newClassSimpleName);
-        return addRule(rule.getIdentifier(), rule);
-    }
-
-    public <D extends EntityDriver> D build(DriverDependentEntity<D> entity, Location location){
-        Class<D> driverInterface = entity.getDriverInterface();
-        Class<? extends D> driverClass = null;
-        List<Throwable> exceptions = MutableList.of();
-        if (driverInterface.isInterface()) {
-            List<DriverInferenceRule> ruleListInExecutionOrder = MutableList.copyOf(rules.values());
-            Collections.reverse(ruleListInExecutionOrder);
-            // above puts rules in order with most recently added first
-            for (DriverInferenceRule rule: ruleListInExecutionOrder) {
-                ReferenceWithError<Class<? extends D>> clazzR = rule.resolve(entity, driverInterface, location);
-                if (clazzR!=null) {
-                    if (!clazzR.hasError()) {
-                        Class<? extends D> clazz = clazzR.get();
-                        if (clazz!=null) {
-                            driverClass = clazz;
-                            break;
-                        }
-                    } else {
-                        exceptions.add(clazzR.getError());
-                    }
-                }
-            }
-        } else {
-            driverClass = driverInterface;
-        }
-        LOG.debug("Driver for "+driverInterface.getName()+" in "+location+" is: "+driverClass);
-
-        if (driverClass==null) {
-            if (exceptions.isEmpty())
-                throw new RuntimeException("No drivers could be found for "+driverInterface.getName()+"; "
-                    + "currently only SshMachineLocation is supported for autodetection (location "+location+")");
-            else throw Exceptions.create("No drivers could be loaded for "+driverInterface.getName()+" in "+location, exceptions);
-        }
-
-        try {
-            Constructor<? extends D> constructor = getConstructor(driverClass);
-            constructor.setAccessible(true);
-            return constructor.newInstance(entity, location);
-        } catch (Exception e) {
-            LOG.warn("Unable to instantiate "+driverClass+" (rethrowing): "+e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private <D extends EntityDriver> Constructor<D> getConstructor(Class<D> driverClass) {
-        for (Constructor<?> constructor : driverClass.getConstructors()) {
-            if (constructor.getParameterTypes().length == 2) {
-                return (Constructor<D>) constructor;
-            }
-        }
-
-        throw new RuntimeException(String.format("Class [%s] has no constructor with 2 arguments", driverClass.getName()));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/RegistryEntityDriverFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/RegistryEntityDriverFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/RegistryEntityDriverFactory.java
deleted file mode 100644
index d2dd125..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/RegistryEntityDriverFactory.java
+++ /dev/null
@@ -1,127 +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.core.entity.drivers;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.EntityDriverManager;
-import org.apache.brooklyn.api.location.Location;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Throwables;
-
-/**
- * A registry of driver classes, keyed off the driver-interface + location type it is for.
- * 
- * @author Aled Sage
- */
-public class RegistryEntityDriverFactory implements EntityDriverManager {
-
-    private final Map<DriverLocationTuple, Class<? extends EntityDriver>> registry = new LinkedHashMap<DriverLocationTuple, Class<? extends EntityDriver>>();
-
-    @Override
-    public <D extends EntityDriver> D build(DriverDependentEntity<D> entity, Location location) {
-        Class<? extends D> driverClass = lookupDriver(entity.getDriverInterface(), location);
-        return newDriverInstance(driverClass, entity, location);
-    }
-
-    public boolean hasDriver(DriverDependentEntity<?> entity, Location location) {
-        return lookupDriver(entity.getDriverInterface(), location) != null;
-    }
-
-    public <D extends EntityDriver> void registerDriver(Class<D> driverInterface, Class<? extends Location> locationClazz, Class<? extends D> driverClazz) {
-        synchronized (registry) {
-            registry.put(new DriverLocationTuple(driverInterface, locationClazz), driverClazz);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private <D extends EntityDriver> Class<? extends D> lookupDriver(Class<D> driverInterface, Location location) {
-        synchronized (registry) {
-            for (DriverLocationTuple contender : registry.keySet()) {
-                if (contender.matches(driverInterface, location)) {
-                    return (Class<? extends D>) registry.get(contender);
-                }
-            }
-        }
-        return null;
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private <D> Constructor<D> getConstructor(Class<? extends D> driverClass) {
-        for (Constructor constructor : driverClass.getConstructors()) {
-            if (constructor.getParameterTypes().length == 2) {
-                return constructor;
-            }
-        }
-
-        //TODO:
-        throw new RuntimeException(String.format("Class [%s] has no constructor with 2 arguments",driverClass.getName()));
-    }
-
-    private <D> D newDriverInstance(Class<D> driverClass, Entity entity, Location location) {
-        Constructor<D> constructor = getConstructor(driverClass);
-        try {
-            constructor.setAccessible(true);
-            return constructor.newInstance(entity, location);
-        } catch (InstantiationException e) {
-            throw Throwables.propagate(e);
-        } catch (IllegalAccessException e) {
-            throw Throwables.propagate(e);
-        } catch (InvocationTargetException e) {
-            throw Throwables.propagate(e);
-        }
-    }
-
-    private static class DriverLocationTuple {
-        private final Class<? extends EntityDriver> driverInterface;
-        private final Class<? extends Location> locationClazz;
-        
-        public DriverLocationTuple(Class<? extends EntityDriver> driverInterface, Class<? extends Location> locationClazz) {
-            this.driverInterface = checkNotNull(driverInterface, "driver interface");
-            this.locationClazz = checkNotNull(locationClazz, "location class");
-        }
-        
-        public boolean matches(Class<? extends EntityDriver> driver, Location location) {
-            return driverInterface.isAssignableFrom(driver) && locationClazz.isInstance(location);
-        }
-        
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(driverInterface, locationClazz);
-        }
-        
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof DriverLocationTuple)) {
-                return false;
-            }
-            DriverLocationTuple o = (DriverLocationTuple) other;
-            return driverInterface.equals(o.driverInterface) && locationClazz.equals(o.locationClazz);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadRequirement.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadRequirement.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadRequirement.java
deleted file mode 100644
index 0a1106b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadRequirement.java
+++ /dev/null
@@ -1,85 +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.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableMap;
-
-public class BasicDownloadRequirement implements DownloadRequirement {
-
-    private final EntityDriver entityDriver;
-    private final String addonName;
-    private final Map<String, ?> properties;
-
-    /**
-     * Copies the given DownloadRequirement, but overriding the original properties with the given additional properties.
-     */
-    public static BasicDownloadRequirement copy(DownloadRequirement req, Map<String,?> additionalProperties) {
-        Map<String,?> props = MutableMap.<String,Object>builder().putAll(req.getProperties()).putAll(additionalProperties).build();
-        if (req.getAddonName() == null) {
-            return new BasicDownloadRequirement(req.getEntityDriver(), props);
-        } else {
-            return new BasicDownloadRequirement(req.getEntityDriver(), req.getAddonName(), props);
-        }
-    }
-
-    public BasicDownloadRequirement(EntityDriver driver) {
-        this(driver, ImmutableMap.<String,Object>of());
-    }
-    
-    public BasicDownloadRequirement(EntityDriver driver, Map<String, ?> properties) {
-        this.entityDriver = checkNotNull(driver, "entityDriver");
-        this.addonName = null;
-        this.properties = checkNotNull(properties, "properties");
-    }
-    
-    public BasicDownloadRequirement(EntityDriver entityDriver, String addonName, Map<String, ?> properties) {
-        this.entityDriver = checkNotNull(entityDriver, "entityDriver");
-        this.addonName = checkNotNull(addonName, "addonName");
-        this.properties = checkNotNull(properties, "properties");
-    }
-
-    @Override
-    public EntityDriver getEntityDriver() {
-        return entityDriver;
-    }
-
-    @Override
-    public String getAddonName() {
-        return addonName;
-    }
-
-    @Override
-    public Map<String, ?> getProperties() {
-        return properties;
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("driver", entityDriver).add("addon", addonName).omitNullValues().toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadResolver.java
deleted file mode 100644
index aed8f0b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadResolver.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 org.apache.brooklyn.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolver;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-
-public class BasicDownloadResolver implements DownloadResolver {
-
-    private final List<String> targets;
-    private final String filename;
-    private final String unpackDirectoryName;
-
-    public BasicDownloadResolver(Iterable<String> targets, String filename) {
-        this(targets, filename, null);
-    }
-    
-    public BasicDownloadResolver(Iterable<String> targets, String filename, String unpackDirectoryName) {
-        this.targets = ImmutableList.copyOf(checkNotNull(targets, "targets"));
-        this.filename = checkNotNull(filename, "filename");
-        this.unpackDirectoryName = unpackDirectoryName;
-    }
-    
-    @Override
-    public List<String> getTargets() {
-        return targets;
-    }
-
-    @Override
-    public String getFilename() {
-        return filename;
-    }
-
-    @Override
-    public String getUnpackedDirectoryName(String defaultVal) {
-        return unpackDirectoryName == null ? defaultVal : unpackDirectoryName;
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("targets", targets).add("filename", filename)
-                .add("unpackDirName", unpackDirectoryName).omitNullValues().toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadTargets.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadTargets.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadTargets.java
deleted file mode 100644
index d8e6599..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadTargets.java
+++ /dev/null
@@ -1,121 +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.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.util.collections.MutableList;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-public class BasicDownloadTargets implements DownloadTargets {
-
-    private static final DownloadTargets EMPTY = builder().build();
-    
-    public static DownloadTargets empty() {
-        return EMPTY;
-    }
-    
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        private List<String> primaries = Lists.newArrayList();
-        private List<String> fallbacks = Lists.newArrayList();
-        private boolean canContinueResolving = true;
-        
-        public Builder addAll(DownloadTargets other) {
-            addPrimaries(other.getPrimaryLocations());
-            addFallbacks(other.getFallbackLocations());
-            return this;
-        }
-        
-        public Builder addPrimary(String val) {
-            checkNotNull(val, "val");
-            if (!primaries.contains(val)) primaries.add(val);
-            return this;
-        }
-
-        public Builder addPrimaries(Iterable<String> vals) {
-            for (String val : checkNotNull(vals, "vals")) {
-                addPrimary(val);
-            }
-            return this;
-        }
-
-        public Builder addFallback(String val) {
-            checkNotNull(val, "val");
-            if (!fallbacks.contains(val)) fallbacks.add(val);
-            return this;
-        }
-
-        public Builder addFallbacks(Iterable<String> vals) {
-            for (String val : checkNotNull(vals, "vals")) {
-                addFallback(val);
-            }
-            return this;
-        }
-
-        public Builder canContinueResolving(boolean val) {
-            canContinueResolving = val;
-            return this;
-        }
-        
-        public BasicDownloadTargets build() {
-            return new BasicDownloadTargets(this);
-        }
-    }
-
-    private final List<String> primaries;
-    private final List<String> fallbacks;
-    private final boolean canContinueResolving;
-    
-    protected BasicDownloadTargets(Builder builder) {
-        primaries = ImmutableList.copyOf(builder.primaries);
-        fallbacks = MutableList.<String>builder().addAll(builder.fallbacks).removeAll(builder.primaries).build().asUnmodifiable();
-        canContinueResolving = builder.canContinueResolving;
-    }
-
-    @Override
-    public List<String> getPrimaryLocations() {
-        return primaries;
-    }
-
-    @Override
-    public List<String> getFallbackLocations() {
-        return fallbacks;
-    }
-
-    @Override
-    public boolean canContinueResolving() {
-        return canContinueResolving;
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("primaries", primaries).add("fallbacks", fallbacks)
-                .add("canContinueResolving", canContinueResolving).toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadsManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadsManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadsManager.java
deleted file mode 100644
index 72e8f15..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/BasicDownloadsManager.java
+++ /dev/null
@@ -1,161 +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.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class BasicDownloadsManager implements DownloadResolverManager {
-
-    private final List<Function<? super DownloadRequirement, ? extends DownloadTargets>> producers = Lists.newCopyOnWriteArrayList();
-
-    private final List<Function<? super DownloadRequirement, String>> filenameProducers = Lists.newCopyOnWriteArrayList();
-
-    /**
-     * The default is (in-order) to:
-     * <ol>
-     *   <li>Use the local repo, if any (defaulting to $HOME/.brooklyn/repository)
-     *   <li>Use brooklyn properties for any download overrides defined there (see {@link DownloadProducerFromProperties}
-     *   <li>Use the entity's Attributes.DOWNLOAD_URL
-     *   <li>Use the cloudsoft fallback repo
-     * </ol>
-     * @param config
-     */
-    public static BasicDownloadsManager newDefault(StringConfigMap config) {
-        BasicDownloadsManager result = new BasicDownloadsManager();
-        
-        // In-order, will look up: local repo, overrides defined in the properties, and then 
-        // the entity's attribute to get the download URL
-        DownloadProducerFromLocalRepo localRepoProducer = new DownloadProducerFromLocalRepo(config);
-        DownloadProducerFromProperties propertiesProducer = new DownloadProducerFromProperties(config);
-        DownloadProducerFromUrlAttribute attributeProducer = new DownloadProducerFromUrlAttribute();
-        DownloadProducerFromCloudsoftRepo cloudsoftRepoProducer = new DownloadProducerFromCloudsoftRepo(config);
-        
-        result.registerProducer(localRepoProducer);
-        result.registerProducer(propertiesProducer);
-        result.registerProducer(attributeProducer);
-        result.registerProducer(cloudsoftRepoProducer);
-        
-        result.registerFilenameProducer(FilenameProducers.fromFilenameProperty());
-        result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(propertiesProducer));
-        result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(attributeProducer));
-        
-        return result;
-    }
-    
-    public static BasicDownloadsManager newEmpty() {
-        return new BasicDownloadsManager();
-    }
-    
-    @Override
-    public void registerPrimaryProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> producer) {
-        producers.add(0, checkNotNull(producer, "resolver"));
-    }
-
-    @Override
-    public void registerProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> producer) {
-        producers.add(checkNotNull(producer, "resolver"));
-    }
-
-    @Override
-    public void registerFilenameProducer(Function<? super DownloadRequirement, String> producer) {
-        filenameProducers.add(checkNotNull(producer, "producer"));
-    }
-
-    @Override
-    public DownloadResolver newDownloader(EntityDriver driver) {
-        return newDownloader(new BasicDownloadRequirement(driver));
-    }
-
-    @Override
-    public DownloadResolver newDownloader(EntityDriver driver, Map<String, ?> properties) {
-        return newDownloader(new BasicDownloadRequirement(driver, properties));
-    }
-
-    @Override
-    public DownloadResolver newDownloader(EntityDriver driver, String addonName, Map<String, ?> addonProperties) {
-        return newDownloader(new BasicDownloadRequirement(driver, addonName, addonProperties));
-    }
-
-    private DownloadResolver newDownloader(DownloadRequirement req) {
-        // Infer filename
-        String filename = null;
-        for (Function<? super DownloadRequirement, String> filenameProducer : filenameProducers) {
-            filename = filenameProducer.apply(req);
-            if (!Strings.isBlank(filename)) break;
-        }
-        
-        // If a filename-producer has given us the filename, then augment the DownloadRequirement with that
-        // (so that local-repo substitutions etc can use that explicit filename)
-        DownloadRequirement wrappedReq;
-        if (filename == null) {
-            wrappedReq = req;
-        } else {
-            wrappedReq = BasicDownloadRequirement.copy(req, ImmutableMap.of("filename", filename));
-        }
-        
-        // Get ordered download targets to be tried
-        List<String> primaries = Lists.newArrayList();
-        List<String> fallbacks = Lists.newArrayList();
-        for (Function<? super DownloadRequirement, ? extends DownloadTargets> producer : producers) {
-            DownloadTargets vals = producer.apply(wrappedReq);
-            primaries.addAll(vals.getPrimaryLocations());
-            fallbacks.addAll(vals.getFallbackLocations());
-            if (!vals.canContinueResolving()) {
-                break;
-            }
-        }
-
-        Set<String> result = Sets.newLinkedHashSet();
-        result.addAll(primaries);
-        result.addAll(fallbacks);
-
-        if (result.isEmpty()) {
-            throw new IllegalArgumentException("No downloads matched for "+req);
-        }
-        
-        // If filename-producers didn't give any explicit filename, then infer from download results
-        if (filename == null) {
-            for (String target : result) {
-                filename = FilenameProducers.inferFilename(target);
-                if (!Strings.isBlank(filename)) break;
-            }
-        }
-        if (Strings.isBlank(filename)) {
-            throw new IllegalArgumentException("No filenames matched for "+req+" (targets "+result+")");
-        }
-        
-        // And return the result
-        return new BasicDownloadResolver(result, filename);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromCloudsoftRepo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromCloudsoftRepo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromCloudsoftRepo.java
deleted file mode 100644
index 715fe96..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromCloudsoftRepo.java
+++ /dev/null
@@ -1,83 +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.core.entity.drivers.downloads;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-
-public class DownloadProducerFromCloudsoftRepo implements Function<DownloadRequirement, DownloadTargets> {
-    
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(DownloadProducerFromCloudsoftRepo.class);
-
-    public static final ConfigKey<String> CLOUDSOFT_REPO_URL = BasicConfigKey.builder(String.class)
-            .name(DownloadProducerFromProperties.DOWNLOAD_CONF_PREFIX+"repo.cloudsoft.url")
-            .description("Whether to use the cloudsoft repo for downloading entities, during installs")
-            .defaultValue("http://downloads.cloudsoftcorp.com/brooklyn/repository")
-            .build();
-
-    public static final ConfigKey<Boolean> CLOUDSOFT_REPO_ENABLED = BasicConfigKey.builder(Boolean.class)
-            .name(DownloadProducerFromProperties.DOWNLOAD_CONF_PREFIX+"repo.cloudsoft.enabled")
-            .description("Whether to use the cloudsoft repo for downloading entities, during installs")
-            .defaultValue(true)
-            .build();
-    
-    public static final String CLOUDSOFT_REPO_URL_PATTERN = "%s/"+
-            "${simpletype}/${version}/"+
-            "<#if filename??>"+
-                "${filename}" +
-            "<#else>"+
-              "<#if addon??>"+
-                "${simpletype?lower_case}-${addon?lower_case}-${addonversion?lower_case}.${fileSuffix!\"tar.gz\"}"+
-              "<#else>"+
-                  "${simpletype?lower_case}-${version?lower_case}.${fileSuffix!\"tar.gz\"}"+
-              "</#if>"+
-            "</#if>";
-
-
-    private final StringConfigMap config;
-
-    public DownloadProducerFromCloudsoftRepo(StringConfigMap config) {
-        this.config = config;
-    }
-    
-    public DownloadTargets apply(DownloadRequirement req) {
-        Boolean enabled = config.getConfig(CLOUDSOFT_REPO_ENABLED);
-        String baseUrl = config.getConfig(CLOUDSOFT_REPO_URL);
-        String url = String.format(CLOUDSOFT_REPO_URL_PATTERN, baseUrl);
-        
-        if (enabled) {
-            Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req);
-            String result = DownloadSubstituters.substitute(url, subs);
-            return BasicDownloadTargets.builder().addPrimary(result).build();
-            
-        } else {
-            return BasicDownloadTargets.empty();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromLocalRepo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromLocalRepo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromLocalRepo.java
deleted file mode 100644
index 8de8ae8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromLocalRepo.java
+++ /dev/null
@@ -1,84 +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.core.entity.drivers.downloads;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-
-public class DownloadProducerFromLocalRepo implements Function<DownloadRequirement, DownloadTargets> {
-    
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(DownloadProducerFromLocalRepo.class);
-
-    public static final ConfigKey<String> LOCAL_REPO_PATH = BasicConfigKey.builder(String.class)
-            .name(DownloadProducerFromProperties.DOWNLOAD_CONF_PREFIX+"repo.local.path")
-            .description("Fully qualified path of the local repo")
-            .defaultValue("$HOME/.brooklyn/repository")
-            .build();
-
-    public static final ConfigKey<Boolean> LOCAL_REPO_ENABLED = BasicConfigKey.builder(Boolean.class)
-            .name(DownloadProducerFromProperties.DOWNLOAD_CONF_PREFIX+"repo.local.enabled")
-            .description("Whether to use the local repo for downloading entities, during installs")
-            .defaultValue(true)
-            .build();
-
-    // TODO explain why this is this in lower_case!  it's surprising
-    public static final String LOCAL_REPO_URL_PATTERN = "file://%s/"+
-            "${simpletype}/${version}/"+
-            "<#if filename??>"+
-                "${filename}" +
-            "<#else>"+
-              "<#if addon??>"+
-                "${simpletype?lower_case}-${addon?lower_case}-${addonversion?lower_case}.${fileSuffix!\"tar.gz\"}"+
-              "<#else>"+
-                  "${simpletype?lower_case}-${version?lower_case}.${fileSuffix!\"tar.gz\"}"+
-              "</#if>"+
-            "</#if>";
-
-
-    private final StringConfigMap config;
-
-    public DownloadProducerFromLocalRepo(StringConfigMap config) {
-        this.config = config;
-    }
-    
-    public DownloadTargets apply(DownloadRequirement req) {
-        Boolean enabled = config.getConfig(LOCAL_REPO_ENABLED);
-        String path = config.getConfig(LOCAL_REPO_PATH);
-        String url = String.format(LOCAL_REPO_URL_PATTERN, path);
-        
-        if (enabled) {
-            Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req);
-            String result = DownloadSubstituters.substitute(url, subs);
-            return BasicDownloadTargets.builder().addPrimary(result).build();
-            
-        } else {
-            return BasicDownloadTargets.empty();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromProperties.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromProperties.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromProperties.java
deleted file mode 100644
index a5b3204..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromProperties.java
+++ /dev/null
@@ -1,344 +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.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * Based on the contents of brooklyn properties, sets up rules for resolving where to
- * download artifacts from, for installing entities. 
- * 
- * By default, these rules override the DOWNLOAD_URL defined on the entities in code.
- * Global properties can be specified that apply to all entities. Entity-specific properties
- * can also be specified (which override the global properties for that entity type).
- * 
- * Below is an example of realistic configuration for an enterprise who have an in-house 
- * repository that must be used for everything, rather than going out to the public internet. 
- * <pre>
- * {@code
- * // FIXME Check format for including addonname- only if addonname is non-null?
- * // FIXME Use this in a testng test case
- * brooklyn.downloads.all.url=http://downloads.acme.com/brookyn/repository/${simpletype}/${simpletype}-${addon?? addon-}${version}.${fileSuffix!.tar.gz}
- * }
- * </pre>
- * 
- * To illustrate the features and variations one can use, below is an example of global 
- * properties that can be specified. The semicolon-separated list of URLs will be tried  in-order
- * until one succeeds. The fallback url says to use that if all other URLs fail (or no others are
- * specified). 
- * <pre>
- * {@code
- * brooklyn.downloads.all.url=http://myurl1/${simpletype}-${version}.tar.gz; http://myurl2/${simpletype}-${version}.tar.gz
- * brooklyn.downloads.all.fallbackurl=http://myurl3/${simpletype}-${version}.tar.gz
- * }
- * </pre>
- * 
- * Similarly, entity-specific properties can be defined. All "global properties" will also apply
- * to this entity type, unless explicitly overridden.
- * <pre>
- * {@code
- * brooklyn.downloads.entity.tomcatserver.url=http://mytomcaturl1/tomcat-${version}.tar.gz
- * brooklyn.downloads.entity.tomcatserver.fallbackurl=http://myurl2/tomcat-${version}.tar.gz
- * }
- * </pre>
- * 
- * Downloads for entity-specific add-ons can also be defined. All "global properties" will also apply
- * to this entity type, unless explicitly overridden.
- * <pre>
- * {@code
- * brooklyn.downloads.entity.nginxcontroller.addon.stickymodule.url=http://myurl1/nginx-stickymodule-${version}.tar.gz
- * brooklyn.downloads.entity.nginxcontroller.addon.stickymodule.fallbackurl=http://myurl2/nginx-stickymodule-${version}.tar.gz
- * }
- * </pre>
- * 
- * If no explicit URLs are supplied, then by default it will use the DOWNLOAD_URL attribute
- * of the entity  (if supplied), followed by the fallbackurl if that fails. 
- * 
- * A URL can be a "template", where things of the form ${version} will be substituted for the value
- * of "version" provided for that entity. The freemarker template engine is used to convert URLs 
- * (see <a href="http://freemarker.org">http://freemarker.org</a>). For example, one could use the URL:
- * <pre>
- * {@code
- * http://repo.acme.com/${simpletype}-${version}.${fileSuffix!tar.gz}
- * }
- * </pre>
- * The following substitutions are available automatically for a template:
- * <ul>
- *   <li>entity: the {@link Entity} instance
- *   <li>driver: the {@link EntityDriver} instance being used for the Entity
- *   <li>simpletype: the unqualified name of the entity type
- *   <li>type: the fully qualified name of the entity type
- *   <li>addon: the name of the entity add-on, or null if it's the core entity artifact
- *   <li>version: the version number of the entity to be installed (or of the add-on)
- * </ul>
- */
-public class DownloadProducerFromProperties implements Function<DownloadRequirement, DownloadTargets> {
-    
-    /* FIXME: expose config for canContinueResolving.
-     * ... then it uses only the overrides in the properties file. This, in combination with
-     * setting something like {@code brooklyn.downloads.all.url=http://acme.com/repo/${simpletype}/${simpletype}-${version}.tar.gz},
-     * allows an enterprise to ensure that entities never go to the public internet during installation.
-     * 
-     * But also need to override things like nginx downlaod url for the stick module and pcre.
-     */
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(DownloadProducerFromProperties.class);
-
-    public static final String DOWNLOAD_CONF_PREFIX = "brooklyn.downloads.";
-
-    private final StringConfigMap config;
-
-    public DownloadProducerFromProperties(StringConfigMap config) {
-        this.config = config;
-    }
-    
-    public DownloadTargets apply(DownloadRequirement downloadRequirement) {
-        List<Rule> rules = generateRules();
-        BasicDownloadTargets.Builder result = BasicDownloadTargets.builder();
-        for (Rule rule : rules) {
-            if (rule.matches(downloadRequirement.getEntityDriver(), downloadRequirement.getAddonName())) {
-                result.addAll(rule.resolve(downloadRequirement));
-            }
-        }
-        
-        return result.build();
-    }
-    
-    /**
-     * Produces a set of URL-generating rules, based on the brooklyn properties. These
-     * rules will be applied in-order until one of them returns a non-empty result.
-     */
-    private List<Rule> generateRules() {
-        List<Rule> result = Lists.newArrayList();
-        Map<String, String> subconfig = filterAndStripPrefix(config.asMapWithStringKeys(), DOWNLOAD_CONF_PREFIX);
-
-        // If exists, use things like:
-        //   brooklyn.downloads.all.fallbackurl=...
-        //   brooklyn.downloads.all.url=...
-        // But only if not overridden by more entity-specify value
-        Map<String, String> forall = filterAndStripPrefix(subconfig, "all.");
-        String fallbackUrlForAll = forall.get("fallbackurl");
-        String urlForAll = forall.get("url");
-        
-        // If exists, use things like:
-        //   brooklyn.downloads.entity.JBoss7Server.url=...
-        Map<String, String> forSpecificEntities = filterAndStripPrefix(subconfig, "entity.");
-        Map<String, Map<String,String>> splitBySpecificEntity = splitByPrefix(forSpecificEntities);
-        for (Map.Entry<String, Map<String,String>> entry : splitBySpecificEntity.entrySet()) {
-            String entityType = entry.getKey();
-            Map<String, String> forentity = entry.getValue();
-            String urlForEntity = forentity.get("url");
-            if (urlForEntity == null) urlForEntity = urlForAll;
-            String fallbackUrlForEntity = forentity.get("fallbackurl");
-            if (fallbackUrlForEntity == null) fallbackUrlForEntity = fallbackUrlForAll;
-            
-            result.add(new EntitySpecificRule(entityType, urlForEntity, fallbackUrlForEntity));
-            
-            // If exists, use things like:
-            //   brooklyn.downloads.entity.nginxcontroller.addon.stickymodule.url=...
-            Map<String, String> forSpecificAddons = filterAndStripPrefix(forentity, "addon.");
-            Map<String, Map<String,String>> splitBySpecificAddon = splitByPrefix(forSpecificAddons);
-            for (Map.Entry<String, Map<String,String>> entry2 : splitBySpecificAddon.entrySet()) {
-                String addonName = entry2.getKey();
-                Map<String, String> foraddon = entry2.getValue();
-                String urlForAddon = foraddon.get("url");
-                if (urlForAddon == null) urlForAddon = urlForEntity;
-                String fallbackUrlForAddon = foraddon.get("fallbackurl");
-                if (fallbackUrlForEntity == null) fallbackUrlForAddon = fallbackUrlForEntity;
-                
-                result.add(new EntityAddonSpecificRule(entityType, addonName, urlForAddon, fallbackUrlForAddon));
-            }
-        }
-
-        if (!forall.isEmpty()) {
-            result.add(new UniversalRule(urlForAll, fallbackUrlForAll));
-        }
-        
-        return result;
-    }
-
-    /**
-     * Returns a sub-map of config for keys that started with the given prefix, but where the returned
-     * map's keys do not include the prefix.
-     */
-    private static Map<String,String> filterAndStripPrefix(Map<String,?> config, String prefix) {
-        Map<String,String> result = Maps.newLinkedHashMap();
-        for (Map.Entry<String,?> entry : config.entrySet()) {
-            String key = entry.getKey();
-            if (key.startsWith(prefix)) {
-                Object value = entry.getValue();
-                result.put(key.substring(prefix.length()), (value == null) ? null : value.toString());
-            }
-        }
-        return result;
-    }
-    
-    /**
-     * Splits the map up into multiple maps, using the key's prefix up to the first dot to 
-     * tell which map to include it in. This prefix is used as the key in the map-of-maps, and
-     * is omitted in the contained map.
-     * 
-     * For example, given [a.b:v1, a.c:v2, d.e:v3], it will return [ a:[b:v1, c:v2], d:[e:v3] ]
-     */
-    private static Map<String,Map<String,String>> splitByPrefix(Map<String,String> config) {
-        Map<String,Map<String,String>> result = Maps.newLinkedHashMap();
-        
-        for (Map.Entry<String,String> entry : config.entrySet()) {
-            String key = entry.getKey();
-            String keysuffix = key.substring(key.indexOf(".")+1);
-            String keyprefix = key.substring(0, key.length()-keysuffix.length()-1);
-            String value = entry.getValue();
-            
-            Map<String,String> submap = result.get(keyprefix);
-            if (submap == null) {
-                submap = Maps.newLinkedHashMap();
-                result.put(keyprefix, submap);
-            }
-            submap.put(keysuffix, value);
-        }
-        return result;
-    }
-    
-    /**
-     * Resolves the download url, given an EntityDriver, with the following rules:
-     * <ol>
-     *   <li>If url is not null, split and trim it on ";" and use
-     *   <li>If url is null, retrive entity's Attributes.DOWNLOAD_URL and use if non-null
-     *   <li>If fallbackUrl is not null, split and trim it on ";" and use
-     * <ol>
-     * 
-     * For each of the resulting Strings, transforms them (using freemarker syntax for
-     * substitutions). Returns the list.
-     */
-    private static abstract class Rule {
-        private final String url;
-        private final String fallbackUrl;
-        
-        Rule(String url, String fallbackUrl) {
-            this.url = url;
-            this.fallbackUrl = fallbackUrl;
-        }
-        
-        abstract boolean matches(EntityDriver driver, String addon);
-        
-        DownloadTargets resolve(DownloadRequirement req) {
-            EntityDriver driver = req.getEntityDriver();
-            
-            List<String> primaries = Lists.newArrayList();
-            List<String> fallbacks = Lists.newArrayList();
-            if (Strings.isEmpty(url)) {
-                String defaulturl = driver.getEntity().getAttribute(Attributes.DOWNLOAD_URL);
-                if (defaulturl != null) primaries.add(defaulturl);
-            } else {
-                String[] parts = url.split(";");
-                for (String part : parts) {
-                    if (!part.isEmpty()) primaries.add(part.trim());
-                }
-            }
-            if (fallbackUrl != null) {
-                String[] parts = fallbackUrl.split(";");
-                for (String part : parts) {
-                    if (!part.isEmpty()) fallbacks.add(part.trim());
-                }
-            }
-
-            BasicDownloadTargets.Builder result = BasicDownloadTargets.builder();
-            for (String baseurl : primaries) {
-                result.addPrimary(DownloadSubstituters.substitute(req, baseurl));
-            }
-            for (String baseurl : fallbacks) {
-                result.addFallback(DownloadSubstituters.substitute(req, baseurl));
-            }
-            return result.build();
-        }
-    }
-
-    /**
-     * Rule for generating URLs that applies to all entities, if a more specific rule 
-     * did not exist or failed to find a match.
-     */
-    private static class UniversalRule extends Rule {
-        UniversalRule(String url, String fallbackUrl) {
-            super(url, fallbackUrl);
-        }
-        
-        @Override
-        boolean matches(EntityDriver driver, String addon) {
-            return true;
-        }
-    }
-    
-    /**
-     * Rule for generating URLs that applies to only the entity of the given type.
-     */
-    private static class EntitySpecificRule extends Rule {
-        private final String entityType;
-
-        EntitySpecificRule(String entityType, String url, String fallbackUrl) {
-            super(url, fallbackUrl);
-            this.entityType = checkNotNull(entityType, "entityType");
-        }
-        
-        @Override
-        boolean matches(EntityDriver driver, String addon) {
-            String actualType = driver.getEntity().getEntityType().getName();
-            String actualSimpleType = actualType.substring(actualType.lastIndexOf(".")+1);
-            return addon == null && entityType.equalsIgnoreCase(actualSimpleType);
-        }
-    }
-    
-    /**
-     * Rule for generating URLs that applies to only the entity of the given type.
-     */
-    private static class EntityAddonSpecificRule extends Rule {
-        private final String entityType;
-        private final String addonName;
-
-        EntityAddonSpecificRule(String entityType, String addonName, String url, String fallbackUrl) {
-            super(url, fallbackUrl);
-            this.entityType = checkNotNull(entityType, "entityType");
-            this.addonName = checkNotNull(addonName, "addonName");
-        }
-        
-        @Override
-        boolean matches(EntityDriver driver, String addon) {
-            String actualType = driver.getEntity().getEntityType().getName();
-            String actualSimpleType = actualType.substring(actualType.lastIndexOf(".")+1);
-            return addonName.equals(addon) && entityType.equalsIgnoreCase(actualSimpleType);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromUrlAttribute.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromUrlAttribute.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromUrlAttribute.java
deleted file mode 100644
index aa7b842..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadProducerFromUrlAttribute.java
+++ /dev/null
@@ -1,63 +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.core.entity.drivers.downloads;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.core.entity.Attributes;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-/**
- * Retrieves the DOWNLOAD_URL or DOWNLOAD_ADDON_URLS attribute of a given entity, and performs the
- * template substitutions to generate the download URL.
- * 
- * @author aled
- */
-public class DownloadProducerFromUrlAttribute extends DownloadSubstituters.Substituter implements Function<DownloadRequirement, DownloadTargets> {
-    public DownloadProducerFromUrlAttribute() {
-        super(
-            new Function<DownloadRequirement, String>() {
-                @Override public String apply(DownloadRequirement input) {
-                    if (input.getAddonName() == null) {
-                        return input.getEntityDriver().getEntity().getAttribute(Attributes.DOWNLOAD_URL);
-                    } else {
-                        String addon = input.getAddonName();
-                        Map<String, String> addonUrls = input.getEntityDriver().getEntity().getAttribute(Attributes.DOWNLOAD_ADDON_URLS);
-                        return (addonUrls != null) ? addonUrls.get(addon) : null;
-                    }
-                }
-            },
-            new Function<DownloadRequirement, Map<String,?>>() {
-                @Override public Map<String,?> apply(DownloadRequirement input) {
-                    Map<String,Object> result = Maps.newLinkedHashMap();
-                    if (input.getAddonName() == null) {
-                        result.putAll(DownloadSubstituters.getBasicEntitySubstitutions(input.getEntityDriver()));
-                    } else {
-                        result.putAll(DownloadSubstituters.getBasicAddonSubstitutions(input.getEntityDriver(), input.getAddonName()));
-                    }
-                    result.putAll(input.getProperties());
-                    return result;
-                }
-            });
-    }
-}


[24/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDo.java
deleted file mode 100644
index f30803e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDo.java
+++ /dev/null
@@ -1,364 +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.core.catalog.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.AggregateClassLoader;
-import org.apache.brooklyn.util.net.Urls;
-import org.apache.brooklyn.util.time.CountdownTimer;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-
-public class CatalogDo {
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogDo.class);
-    
-    volatile boolean isLoaded = false;
-    final CatalogDto dto;
-    ManagementContext mgmt = null;
-    CatalogDo parent = null;
-    
-    List<CatalogDo> childrenCatalogs = new ArrayList<CatalogDo>();
-    CatalogClasspathDo classpath;
-    private Map<String, CatalogItemDo<?,?>> cacheById;
-
-    AggregateClassLoader childrenClassLoader = AggregateClassLoader.newInstanceWithNoLoaders();
-    ClassLoader recursiveClassLoader;
-
-    protected CatalogDo(CatalogDto dto) {
-        this.dto = Preconditions.checkNotNull(dto);
-    }
-    
-    public CatalogDo(ManagementContext mgmt, CatalogDto dto) {
-        this(dto);
-        this.mgmt = mgmt;
-    }
-
-    boolean isLoaded() {
-        return isLoaded;
-    }
-
-    /** Calls {@link #load(CatalogDo)} with a null parent. */
-    public CatalogDo load() {
-        return load(null);
-    }
-
-    /** Calls {@link #load(ManagementContext, CatalogDo)} with the catalog's existing management context. */
-    public CatalogDo load(CatalogDo parent) {
-        return load(mgmt, parent);
-    }
-
-    /** Calls {@link #load(ManagementContext, CatalogDo, boolean)} failing on load errors. */
-    public synchronized CatalogDo load(ManagementContext mgmt, CatalogDo parent) {
-        return load(mgmt, parent, true);
-    }
-
-    /** causes all URL-based catalogs to have their manifests loaded,
-     * and all scanning-based classpaths to scan the classpaths
-     * (but does not load all JARs)
-     */
-    public synchronized CatalogDo load(ManagementContext mgmt, CatalogDo parent, boolean failOnLoadError) {
-        if (isLoaded()) {
-            if (mgmt!=null && !Objects.equal(mgmt, this.mgmt)) {
-                throw new IllegalStateException("Cannot set mgmt "+mgmt+" on "+this+" after catalog is loaded");
-            }
-            log.debug("Catalog "+this+" is already loaded");
-            return this;
-        }
-        loadThisCatalog(mgmt, parent, failOnLoadError);
-        loadChildrenCatalogs(failOnLoadError);
-        buildCaches();
-        return this;
-    }
-
-    protected synchronized void loadThisCatalog(ManagementContext mgmt, CatalogDo parent, boolean failOnLoadError) {
-        if (isLoaded()) return;
-        CatalogUtils.logDebugOrTraceIfRebinding(log, "Loading catalog {} into {}", this, parent);
-        if (this.parent!=null && !this.parent.equals(parent))
-            log.warn("Catalog "+this+" being initialised with different parent "+parent+" when already parented by "+this.parent, new Throwable("source of reparented "+this));
-        if (this.mgmt!=null && !this.mgmt.equals(mgmt))
-            log.warn("Catalog "+this+" being initialised with different mgmt "+mgmt+" when already managed by "+this.mgmt, new Throwable("source of reparented "+this));
-        this.parent = parent;
-        this.mgmt = mgmt;
-        dto.populate();
-        loadCatalogClasspath();
-        loadCatalogItems(failOnLoadError);
-        isLoaded = true;
-        synchronized (this) {
-            notifyAll();
-        }
-    }
-
-    private void loadCatalogClasspath() {
-        try {
-            classpath = new CatalogClasspathDo(this);
-            classpath.load();
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.error("Unable to load catalog "+this+" (ignoring): "+e);
-            log.info("Trace for failure to load "+this+": "+e, e);
-        }
-    }
-
-    private void loadCatalogItems(boolean failOnLoadError) {
-        Iterable<CatalogItemDtoAbstract<?, ?>> entries = dto.getUniqueEntries();
-        if (entries!=null) {
-            for (CatalogItemDtoAbstract<?,?> entry : entries) {
-                try {
-                    CatalogUtils.installLibraries(mgmt, entry.getLibraries());
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    if (failOnLoadError) {
-                        Exceptions.propagate(e);
-                    } else {
-                        log.error("Loading bundles for catalog item " + entry + " failed: " + e.getMessage(), e);
-                    }
-                }
-            }
-        }
-    }
-
-    public boolean blockIfNotLoaded(Duration timeout) throws InterruptedException {
-        if (isLoaded()) return true;
-        synchronized (this) {
-            if (isLoaded()) return true;
-            CountdownTimer timer = CountdownTimer.newInstanceStarted(timeout);
-            while (!isLoaded())
-                if (!timer.waitOnForExpiry(this))
-                    return false;
-            return true;
-        }
-    }
-    
-    protected void loadChildrenCatalogs(boolean failOnLoadError) {
-        if (dto.catalogs!=null) {
-            for (CatalogDto child: dto.catalogs) {
-                loadCatalog(child, failOnLoadError);
-            }
-        }
-    }
-    
-    CatalogDo loadCatalog(CatalogDto child, boolean failOnLoadError) {
-        CatalogDo childL = new CatalogDo(child);
-        childrenCatalogs.add(childL);
-        childL.load(mgmt, this, failOnLoadError);
-        childrenClassLoader.addFirst(childL.getRecursiveClassLoader());
-        clearCache(false);
-        return childL;
-    }
-
-    protected Map<String, CatalogItemDo<?,?>> getIdCache() {
-        Map<String, CatalogItemDo<?,?>> cache = this.cacheById;
-        if (cache==null) cache = buildCaches();
-        return cache;
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected synchronized Map<String, CatalogItemDo<?,?>> buildCaches() {
-        if (cacheById != null) return cacheById;
-        CatalogUtils.logDebugOrTraceIfRebinding(log, "Building cache for {}", this);
-        if (!isLoaded()) 
-            log.debug("Catalog not fully loaded when loading cache of "+this);
-        
-        Map<String, CatalogItemDo<?,?>> cache = new LinkedHashMap<String, CatalogItemDo<?,?>>();
-        
-        // build the cache; first from children catalogs, then from local entities
-        // so that root and near-root takes precedence over deeper items;
-        // and go through in reverse order so that things at the top of the file take precedence
-        // (both in the cache and in the aggregate class loader);
-        // however anything added _subsequently_ will take precedence (again in both)
-        if (dto.catalogs!=null) { 
-            List<CatalogDo> catalogsReversed = new ArrayList<CatalogDo>(childrenCatalogs);
-            Collections.reverse(catalogsReversed);
-            for (CatalogDo child: catalogsReversed) {
-                cache.putAll(child.getIdCache());
-            }
-        }
-        if (dto.getUniqueEntries()!=null) {
-            List<CatalogItemDtoAbstract<?,?>> entriesReversed = MutableList.copyOf(dto.getUniqueEntries());
-            Collections.reverse(entriesReversed);
-            for (CatalogItemDtoAbstract<?,?> entry: entriesReversed)
-                cache.put(entry.getId(), new CatalogItemDo(this, entry));
-        }
-        this.cacheById = cache;
-        return cache;
-    }
-    
-    protected synchronized void clearCache(boolean deep) {
-        this.cacheById = null;
-        if (deep) {
-            for (CatalogDo child : childrenCatalogs) {
-                child.clearCache(true);
-            }
-        }
-        clearParentCache();
-    }
-    protected void clearParentCache() {
-        if (this.parent!=null)
-            this.parent.clearCache(false);
-    }
-    
-    /**
-     * Adds the given entry to the catalog, with no enrichment.
-     * Callers may prefer {@link CatalogClasspathDo#addCatalogEntry(CatalogItemDtoAbstract, Class)}
-     */
-    public synchronized void addEntry(CatalogItemDtoAbstract<?,?> entry) {
-        dto.addEntry(entry);
-        
-        // could do clearCache(false); but this is slightly more efficient...
-        if (cacheById != null) {
-            @SuppressWarnings({ "unchecked", "rawtypes" })
-            CatalogItemDo<?, ?> cdo = new CatalogItemDo(this, entry);
-            cacheById.put(entry.getId(), cdo);
-        }        
-        clearParentCache();
-        
-        if (mgmt != null) {
-            mgmt.getRebindManager().getChangeListener().onManaged(entry);
-        }
-   }
-    
-    /**
-     * Removes the given entry from the catalog.
-     */
-    public synchronized void deleteEntry(CatalogItemDtoAbstract<?, ?> entry) {
-        dto.removeEntry(entry);
-        
-        // could do clearCache(false); but this is slightly more efficient...
-        if (cacheById != null) {
-            cacheById.remove(entry.getId());
-        }
-        clearParentCache();
-        
-        if (mgmt != null) {
-            // TODO: Can the entry be in more than one catalogue? The management context has no notion of
-            // catalogue hierarchy so this will effectively remove it from all catalogues.
-            // (YES- we're assuming ID's are unique across all catalogues; if not, things get out of sync;
-            // however see note at top of BasicBrooklynCatalog --
-            // manualCatalog and OSGi is used for everything now except legacy XML trees)
-            mgmt.getRebindManager().getChangeListener().onUnmanaged(entry);
-        }
-    }
-
-    /** returns loaded catalog, if this has been loaded */
-    CatalogDo addCatalog(CatalogDto child) {
-        if (dto.catalogs == null)
-            dto.catalogs = new ArrayList<CatalogDto>();
-        dto.catalogs.add(child);
-        if (!isLoaded())
-            return null;
-        return loadCatalog(child, true);
-    }
-    
-    /** adds the given urls; filters out any nulls supplied */
-    public synchronized void addToClasspath(String ...urls) {
-        if (dto.classpath == null)
-            dto.classpath = new CatalogClasspathDto();
-        for (String url: urls) {
-            if (url!=null)
-                dto.classpath.addEntry(url);
-        }
-        if (isLoaded())
-            throw new IllegalStateException("dynamic classpath entry value update not supported");
-        // easy enough to add, just support unload+reload (and can also allow dynamic setScan below)
-        // but more predictable if we don't; the one exception is in the manualAdditionsCatalog
-        // where BasicBrooklynCatalog reaches in and updates the DTO and/or CompositeClassLoader directly, if necessary
-//            for (String url: urls)
-//                loadedClasspath.addEntry(url);
-    }
-
-    public synchronized void setClasspathScanForEntities(CatalogScanningModes value) {
-        if (dto.classpath == null)
-            dto.classpath = new CatalogClasspathDto();
-        dto.classpath.scan = value;
-        if (isLoaded()) 
-            throw new IllegalStateException("dynamic classpath scan value update not supported");
-        // easy enough to add, see above
-    }
-
-    @Override
-    public String toString() {
-        String size = cacheById == null ? "not yet loaded" : "size " + cacheById.size();
-        return "Loaded:" + dto + "(" + size + ")";
-    }
-
-    /** is "local" if it and all ancestors are not based on any remote urls */ 
-    public boolean isLocal() {
-        if (dto.url != null) {
-            String proto = Urls.getProtocol(dto.url);
-            if (proto != null) {
-                // 'file' is the only protocol accepted as "local"
-                if (!"file".equals(proto)) return false;
-            }
-        }
-        return parent == null || parent.isLocal();
-    }
-
-    /** classloader for only the entries in this catalog's classpath */ 
-    public ClassLoader getLocalClassLoader() {
-        if (classpath != null) return classpath.getLocalClassLoader();
-        return null;
-    }
-
-    /** recursive classloader is the local classloader plus all children catalog's classloader */
-    public ClassLoader getRecursiveClassLoader() {
-        if (recursiveClassLoader == null) loadRecursiveClassLoader();
-        return recursiveClassLoader;
-    }
-    
-    protected synchronized void loadRecursiveClassLoader() {
-        if (recursiveClassLoader!=null) return;
-        AggregateClassLoader cl = AggregateClassLoader.newInstanceWithNoLoaders();
-        cl.addFirst(childrenClassLoader);
-        ClassLoader local = getLocalClassLoader();
-        if (local != null) cl.addFirst(local);
-        if (parent == null) {
-            // we are root.  include the mgmt base classloader and/or standard class loaders 
-            ClassLoader base = mgmt != null ? ((ManagementContextInternal)mgmt).getBaseClassLoader() : null;
-            if (base != null) cl.addFirst(base);
-            else {
-                cl.addFirst(getClass().getClassLoader());
-                cl.addFirst(Object.class.getClassLoader());
-            }
-        }
-        recursiveClassLoader = cl;
-    }
-    
-    /** the root classloader is the recursive CL from the outermost catalog
-     * (which includes the base classloader from the mgmt context, if set) */
-    public ClassLoader getRootClassLoader() {
-        if (parent != null) return parent.getRootClassLoader();
-        return getRecursiveClassLoader();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDto.java
deleted file mode 100644
index 1bd2236..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDto.java
+++ /dev/null
@@ -1,229 +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.core.catalog.internal;
-
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException;
-import org.apache.brooklyn.util.stream.Streams;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Lists;
-
-@Beta
-public class CatalogDto {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CatalogDto.class);
-
-    String id;
-    String url;
-    String contents;
-    String contentsDescription;
-    String name;
-    String description;
-    CatalogClasspathDto classpath;
-    private List<CatalogItemDtoAbstract<?,?>> entries = null;
-    
-    // for thread-safety, any dynamic additions to this should be handled by a method 
-    // in this class which does copy-on-write
-    List<CatalogDto> catalogs = null;
-
-    public static CatalogDto newDefaultLocalScanningDto(CatalogClasspathDo.CatalogScanningModes scanMode) {
-        CatalogDo result = new CatalogDo(
-                newNamedInstance("Local Scanned Catalog", "All annotated Brooklyn entities detected in the default classpath", "scanning-local-classpath") );
-        result.setClasspathScanForEntities(scanMode);
-        return result.dto;
-    }
-
-    /** @deprecated since 0.7.0 use {@link #newDtoFromXmlUrl(String)} if you must, but note the xml format itself is deprecated */
-    @Deprecated
-    public static CatalogDto newDtoFromUrl(String url) {
-        return newDtoFromXmlUrl(url);
-    }
-    
-    /** @deprecated since 0.7.0 the xml format is deprecated; use YAML parse routines on BasicBrooklynCatalog */
-    @Deprecated
-    public static CatalogDto newDtoFromXmlUrl(String url) {
-        if (LOG.isDebugEnabled()) LOG.debug("Retrieving catalog from: {}", url);
-        try {
-            InputStream source = ResourceUtils.create().getResourceFromUrl(url);
-            String contents = Streams.readFullyString(source);
-            return newDtoFromXmlContents(contents, url);
-        } catch (Throwable t) {
-            Exceptions.propagateIfFatal(t);
-            throw new PropagatedRuntimeException("Unable to retrieve catalog from " + url + ": " + t, t);
-        }
-    }
-
-    /** @deprecated since 0.7.0 the xml format is deprecated; use YAML parse routines on BasicBrooklynCatalog */
-    @Deprecated
-    public static CatalogDto newDtoFromXmlContents(String xmlContents, String originDescription) {
-        CatalogDto result = (CatalogDto) new CatalogXmlSerializer().deserialize(new StringReader(xmlContents));
-        result.contentsDescription = originDescription;
-
-        if (LOG.isDebugEnabled()) LOG.debug("Retrieved catalog from: {}", originDescription);
-        return result;
-    }
-
-    /**
-     * Creates a DTO.
-     * <p>
-     * The way contents is treated may change; thus this (and much of catalog) should be treated as beta.
-     * 
-     * @param name
-     * @param description
-     * @param optionalContentsDescription optional description of contents; if null, we normally expect source 'contents' to be set later;
-     *   if the DTO has no 'contents' (ie XML source) then a description should be supplied so we know who is populating it
-     *   (e.g. manual additions); without this, warnings may be generated
-     *   
-     * @return a new Catalog DTO
-     */
-    public static CatalogDto newNamedInstance(String name, String description, String optionalContentsDescription) {
-        CatalogDto result = new CatalogDto();
-        result.name = name;
-        result.description = description;
-        if (optionalContentsDescription!=null) result.contentsDescription = optionalContentsDescription;
-        return result;
-    }
-
-    /** Used when caller wishes to create an explicitly empty catalog */
-    public static CatalogDto newEmptyInstance(String optionalContentsDescription) {
-        CatalogDto result = new CatalogDto();
-        if (optionalContentsDescription!=null) result.contentsDescription = optionalContentsDescription;
-        return result;
-    }
-
-    public static CatalogDto newLinkedInstance(String url) {
-        CatalogDto result = new CatalogDto();
-        result.contentsDescription = url;
-        result.contents = ResourceUtils.create().getResourceAsString(url);
-        return result;
-    }
-
-    /** @deprecated since 0.7.0 use {@link #newDtoFromCatalogItems(Collection, String)}, supplying a description for tracking */
-    @Deprecated
-    public static CatalogDto newDtoFromCatalogItems(Collection<CatalogItem<?, ?>> entries) {
-        return newDtoFromCatalogItems(entries, null);
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static CatalogDto newDtoFromCatalogItems(Collection<CatalogItem<?, ?>> entries, String description) {
-        CatalogDto result = new CatalogDto();
-        result.contentsDescription = description;
-        // Weird casts because compiler does not seem to like
-        // .copyInto(Lists.<CatalogItemDtoAbstract<?, ?>>newArrayListWithExpectedSize(entries.size()));
-        result.entries = (List<CatalogItemDtoAbstract<?, ?>>) (List) FluentIterable.from(entries)
-                .filter(CatalogItemDtoAbstract.class)
-                .copyInto(Lists.newArrayListWithExpectedSize(entries.size()));
-        return result;
-    }
-    
-    void populate() {
-        if (contents==null) {
-            if (url != null) {
-                contents = ResourceUtils.create().getResourceAsString(url);
-                contentsDescription = url;
-            } else if (contentsDescription==null) {
-                LOG.debug("Catalog DTO has no contents and no description; ignoring call to populate it. Description should be set to suppress this message.");
-                return;
-            } else {
-                LOG.trace("Nothing needs doing (no contents or URL) for catalog with contents described as "+contentsDescription+".");
-                return;
-            }
-        }
-        
-        CatalogDto remoteDto = newDtoFromXmlContents(contents, contentsDescription);
-        try {
-            copyFrom(remoteDto, true);
-        } catch (Exception e) {
-            Exceptions.propagate(e);
-        }
-    }        
-
-    /**
-     * @throws NullPointerException If source is null (and !skipNulls)
-     */
-    void copyFrom(CatalogDto source, boolean skipNulls) throws IllegalAccessException {
-        if (source==null) {
-            if (skipNulls) return;
-            throw new NullPointerException("source DTO is null, when copying to "+this);
-        }
-        
-        if (!skipNulls || source.id != null) id = source.id;
-        if (!skipNulls || source.contentsDescription != null) contentsDescription = source.contentsDescription;
-        if (!skipNulls || source.contents != null) contents = source.contents;
-        if (!skipNulls || source.name != null) name = source.name;
-        if (!skipNulls || source.description != null) description = source.description;
-        if (!skipNulls || source.classpath != null) classpath = source.classpath;
-        if (!skipNulls || source.entries != null) entries = source.entries;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .omitNullValues()
-                .add("name", name)
-                .add("id", id)
-                .add("contentsDescription", contentsDescription)
-                .toString();
-    }
-
-    // temporary fix for issue where entries might not be unique
-    Iterable<CatalogItemDtoAbstract<?, ?>> getUniqueEntries() {
-        if (entries==null) return null;
-        Map<String, CatalogItemDtoAbstract<?, ?>> result = getEntriesMap();
-        return result.values();
-    }
-
-    private Map<String, CatalogItemDtoAbstract<?, ?>> getEntriesMap() {
-        if (entries==null) return null;
-        Map<String,CatalogItemDtoAbstract<?, ?>> result = MutableMap.of();
-        for (CatalogItemDtoAbstract<?,?> entry: entries) {
-            result.put(entry.getId(), entry);
-        }
-        return result;
-    }
-
-    void removeEntry(CatalogItemDtoAbstract<?, ?> entry) {
-        if (entries!=null)
-            entries.remove(entry);
-    }
-
-    void addEntry(CatalogItemDtoAbstract<?, ?> entry) {
-        if (entries == null) entries = MutableList.of();
-        CatalogItemDtoAbstract<?, ?> oldEntry = getEntriesMap().get(entry.getId());
-        entries.add(entry);
-        if (oldEntry!=null)
-            removeEntry(oldEntry);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDtoUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDtoUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDtoUtils.java
deleted file mode 100644
index 93a5cc1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogDtoUtils.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 org.apache.brooklyn.core.catalog.internal;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CatalogDtoUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogDtoUtils.class);
-    
-    public static CatalogDto newDefaultLocalScanningDto(CatalogScanningModes scanMode) {
-        return CatalogDto.newDefaultLocalScanningDto(scanMode);
-    }
-
-    /** throws if there are any problems in retrieving or copying */
-    public static void populateFromUrl(CatalogDto dto, String url) {
-        CatalogDto remoteDto = newDtoFromUrl(url);
-        try {
-            copyDto(remoteDto, dto, true);
-        } catch (Exception e) {
-            Exceptions.propagate(e);
-        }
-    }
-
-    /** does a shallow copy.
-     * "skipNulls" means not to copy any fields from the source which are null */ 
-    static void copyDto(CatalogDto source, CatalogDto target, boolean skipNulls) throws IllegalArgumentException, IllegalAccessException {
-        target.copyFrom(source, skipNulls);
-    }
-
-    public static CatalogDto newDtoFromUrl(String url) {
-        if (log.isDebugEnabled()) log.debug("Retrieving catalog from: {}", url);
-        try {
-            InputStream source = ResourceUtils.create().getResourceFromUrl(url);
-            CatalogDto result = (CatalogDto) new CatalogXmlSerializer().deserialize(new InputStreamReader(source));
-            if (log.isDebugEnabled()) log.debug("Retrieved catalog from: {}", url);
-            return result;
-        } catch (Throwable t) {
-            log.debug("Unable to retrieve catalog from: "+url+" ("+t+")");
-            throw Exceptions.propagate(t);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogEntityItemDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogEntityItemDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogEntityItemDto.java
deleted file mode 100644
index 851287a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogEntityItemDto.java
+++ /dev/null
@@ -1,43 +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.core.catalog.internal;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-
-
-public class CatalogEntityItemDto extends CatalogItemDtoAbstract<Entity,EntitySpec<?>> {
-    
-    @Override
-    public CatalogItemType getCatalogItemType() {
-        return CatalogItemType.ENTITY;
-    }
-
-    @Override
-    public Class<Entity> getCatalogItemJavaType() {
-        return Entity.class;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public Class<EntitySpec<?>> getSpecType() {
-        return (Class)EntitySpec.class;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
deleted file mode 100644
index 37783cd..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
+++ /dev/null
@@ -1,453 +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.core.catalog.internal;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.core.catalog.CatalogLoadMode;
-import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.FatalRuntimeException;
-import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-@Beta
-public class CatalogInitialization implements ManagementContextInjectable {
-
-    /*
-
-    A1) if not persisting, go to B1
-    A2) if --catalog-reset, delete persisted catalog items
-    A3) if there is a persisted catalog (and it wasn't not deleted by A2), read it and go to C1
-    A4) go to B1
-
-    B1) look for --catalog-initial, if so read it, then go to C1
-    B2) look for BrooklynServerConfig.BROOKLYN_CATALOG_URL, if so, read it, supporting YAML or XML (warning if XML), then go to C1
-    B3) look for ~/.brooklyn/catalog.bom, if exists, read it then go to C1
-    B4) look for ~/.brooklyn/brooklyn.xml, if exists, warn, read it then go to C1
-    B5) read all classpath://brooklyn/default.catalog.bom items, if they exist (and for now they will)
-    B6) go to C1
-
-    C1) if --catalog-add, read and add those items
-
-    D1) if persisting, read the rest of the persisted items (entities etc)
-
-     */
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogInitialization.class);
-    
-    private String initialUri;
-    private boolean reset;
-    private String additionsUri;
-    private boolean force;
-
-    private boolean disallowLocal = false;
-    private List<Function<CatalogInitialization, Void>> callbacks = MutableList.of();
-    private boolean 
-        /** has run an unofficial initialization (i.e. an early load, triggered by an early read of the catalog) */
-        hasRunUnofficialInitialization = false, 
-        /** has run an official initialization, but it is not a permanent one (e.g. during a hot standby mode, or a run failed) */
-        hasRunTransientOfficialInitialization = false, 
-        /** has run an official initialization which is permanent (node is master, and the new catalog is now set) */
-        hasRunFinalInitialization = false;
-    /** is running a populate method; used to prevent recursive loops */
-    private boolean isPopulating = false;
-    
-    private ManagementContext managementContext;
-    private boolean isStartingUp = false;
-    private boolean failOnStartupErrors = false;
-    
-    private Object populatingCatalogMutex = new Object();
-    
-    public CatalogInitialization(String initialUri, boolean reset, String additionUri, boolean force) {
-        this.initialUri = initialUri;
-        this.reset = reset;
-        this.additionsUri = additionUri;
-        this.force = force;
-    }
-    
-    public CatalogInitialization() {
-        this(null, false, null, false);
-    }
-
-    @Override
-    public void setManagementContext(ManagementContext managementContext) {
-        Preconditions.checkNotNull(managementContext, "management context");
-        if (this.managementContext!=null && managementContext!=this.managementContext)
-            throw new IllegalStateException("Cannot switch management context, from "+this.managementContext+" to "+managementContext);
-        this.managementContext = managementContext;
-    }
-    
-    /** Called by the framework to set true while starting up, and false afterwards,
-     * in order to assist in appropriate logging and error handling. */
-    public void setStartingUp(boolean isStartingUp) {
-        this.isStartingUp = isStartingUp;
-    }
-
-    public void setFailOnStartupErrors(boolean startupFailOnCatalogErrors) {
-        this.failOnStartupErrors = startupFailOnCatalogErrors;
-    }
-
-    public CatalogInitialization addPopulationCallback(Function<CatalogInitialization, Void> callback) {
-        callbacks.add(callback);
-        return this;
-    }
-    
-    public ManagementContext getManagementContext() {
-        return Preconditions.checkNotNull(managementContext, "management context has not been injected into "+this);
-    }
-
-    public boolean isInitialResetRequested() {
-        return reset;
-    }
-
-    /** Returns true if the canonical initialization has completed, 
-     * that is, an initialization which is done when a node is rebinded as master
-     * (or an initialization done by the startup routines when not running persistence);
-     * see also {@link #hasRunAnyInitialization()}. */
-    public boolean hasRunFinalInitialization() { return hasRunFinalInitialization; }
-    /** Returns true if an official initialization has run,
-     * even if it was a transient run, e.g. so that the launch sequence can tell whether rebind has triggered initialization */
-    public boolean hasRunOfficialInitialization() { return hasRunFinalInitialization || hasRunTransientOfficialInitialization; }
-    /** Returns true if the initializer has run at all,
-     * including transient initializations which might be needed before a canonical becoming-master rebind,
-     * for instance because the catalog is being accessed before loading rebind information
-     * (done by {@link #populateUnofficial(BasicBrooklynCatalog)}) */
-    public boolean hasRunAnyInitialization() { return hasRunFinalInitialization || hasRunTransientOfficialInitialization || hasRunUnofficialInitialization; }
-
-    /** makes or updates the mgmt catalog, based on the settings in this class 
-     * @param nodeState the management node for which this is being read; if master, then we expect this run to be the last one,
-     *   and so subsequent applications should ignore any initialization data (e.g. on a subsequent promotion to master, 
-     *   after a master -> standby -> master cycle)
-     * @param needsInitialItemsLoaded whether the catalog needs the initial items loaded
-     * @param needsAdditionalItemsLoaded whether the catalog needs the additions loaded
-     * @param optionalExcplicitItemsForResettingCatalog
-     *   if supplied, the catalog is reset to contain only these items, before calling any other initialization
-     *   for use primarily when rebinding
-     */
-    public void populateCatalog(ManagementNodeState nodeState, boolean needsInitialItemsLoaded, boolean needsAdditionsLoaded, Collection<CatalogItem<?, ?>> optionalExcplicitItemsForResettingCatalog) {
-        if (log.isDebugEnabled()) {
-            String message = "Populating catalog for "+nodeState+", needsInitial="+needsInitialItemsLoaded+", needsAdditional="+needsAdditionsLoaded+", explicitItems="+(optionalExcplicitItemsForResettingCatalog==null ? "null" : optionalExcplicitItemsForResettingCatalog.size())+"; from "+JavaClassNames.callerNiceClassAndMethod(1);
-            if (!ManagementNodeState.isHotProxy(nodeState)) {
-                log.debug(message);
-            } else {
-                // in hot modes, make this message trace so we don't get too much output then
-                log.trace(message);
-            }
-        }
-        synchronized (populatingCatalogMutex) {
-            try {
-                if (hasRunFinalInitialization() && (needsInitialItemsLoaded || needsAdditionsLoaded)) {
-                    // if we have already run "final" then we should only ever be used to reset the catalog, 
-                    // not to initialize or add; e.g. we are being given a fixed list on a subsequent master rebind after the initial master rebind 
-                    log.warn("Catalog initialization called to populate initial, even though it has already run the final official initialization");
-                }
-                isPopulating = true;
-                BasicBrooklynCatalog catalog = (BasicBrooklynCatalog) managementContext.getCatalog();
-                if (!catalog.getCatalog().isLoaded()) {
-                    catalog.load();
-                } else {
-                    if (needsInitialItemsLoaded && hasRunAnyInitialization()) {
-                        // an indication that something caused it to load early; not severe, but unusual
-                        if (hasRunTransientOfficialInitialization) {
-                            log.debug("Catalog initialization now populating, but has noted a previous official run which was not final (probalby loaded while in a standby mode, or a previous run failed); overwriting any items installed earlier");
-                        } else {
-                            log.warn("Catalog initialization now populating, but has noted a previous unofficial run (it may have been an early web request); overwriting any items installed earlier");
-                        }
-                        catalog.reset(ImmutableList.<CatalogItem<?,?>>of());
-                    }
-                }
-
-                populateCatalogImpl(catalog, needsInitialItemsLoaded, needsAdditionsLoaded, optionalExcplicitItemsForResettingCatalog);
-                if (nodeState == ManagementNodeState.MASTER) {
-                    // TODO ideally this would remain false until it has *persisted* the changed catalog;
-                    // if there is a subsequent startup failure the forced additions will not be persisted,
-                    // but nor will they be loaded on a subsequent run.
-                    // callers will have to restart a brooklyn, or reach into this class to change this field,
-                    // or (recommended) manually adjust the catalog.
-                    // TODO also, if a node comes up in standby, the addition might not take effector for a while
-                    //
-                    // however since these options are mainly for use on the very first brooklyn run, it's not such a big deal; 
-                    // once up and running the typical way to add items is via the REST API
-                    hasRunFinalInitialization = true;
-                }
-            } catch (Throwable e) {
-                log.warn("Error populating catalog (rethrowing): "+e, e);
-                throw Exceptions.propagate(e);
-            } finally {
-                if (!hasRunFinalInitialization) {
-                    hasRunTransientOfficialInitialization = true;
-                }
-                isPopulating = false;
-            }
-        }
-    }
-
-    private void populateCatalogImpl(BasicBrooklynCatalog catalog, boolean needsInitialItemsLoaded, boolean needsAdditionsLoaded, Collection<CatalogItem<?, ?>> optionalItemsForResettingCatalog) {
-        applyCatalogLoadMode();
-        
-        if (optionalItemsForResettingCatalog!=null) {
-            catalog.reset(optionalItemsForResettingCatalog);
-        }
-        
-        if (needsInitialItemsLoaded) {
-            populateInitial(catalog);
-        }
-
-        if (needsAdditionsLoaded) {
-            populateAdditions(catalog);
-            populateViaCallbacks(catalog);
-        }
-    }
-
-    private enum PopulateMode { YAML, XML, AUTODETECT }
-    
-    protected void populateInitial(BasicBrooklynCatalog catalog) {
-        if (disallowLocal) {
-            if (!hasRunFinalInitialization()) {
-                log.debug("CLI initial catalog not being read when local catalog load mode is disallowed.");
-            }
-            return;
-        }
-
-//        B1) look for --catalog-initial, if so read it, then go to C1
-//        B2) look for BrooklynServerConfig.BROOKLYN_CATALOG_URL, if so, read it, supporting YAML or XML (warning if XML), then go to C1
-//        B3) look for ~/.brooklyn/catalog.bom, if exists, read it then go to C1
-//        B4) look for ~/.brooklyn/brooklyn.xml, if exists, warn, read it then go to C1
-//        B5) read all classpath://brooklyn/default.catalog.bom items, if they exist (and for now they will)
-//        B6) go to C1
-
-        if (initialUri!=null) {
-            populateInitialFromUri(catalog, initialUri, PopulateMode.AUTODETECT);
-            return;
-        }
-        
-        String catalogUrl = managementContext.getConfig().getConfig(BrooklynServerConfig.BROOKLYN_CATALOG_URL);
-        if (Strings.isNonBlank(catalogUrl)) {
-            populateInitialFromUri(catalog, catalogUrl, PopulateMode.AUTODETECT);
-            return;
-        }
-        
-        catalogUrl = Os.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.bom");
-        if (new File(catalogUrl).exists()) {
-            populateInitialFromUri(catalog, new File(catalogUrl).toURI().toString(), PopulateMode.YAML);
-            return;
-        }
-        
-        catalogUrl = Os.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.xml");
-        if (new File(catalogUrl).exists()) {
-            populateInitialFromUri(catalog, new File(catalogUrl).toURI().toString(), PopulateMode.XML);
-            return;
-        }
-
-        // otherwise look for for classpath:/brooklyn/default.catalog.bom --
-        // there is one on the classpath which says to scan, and provides a few templates;
-        // if one is supplied by user in the conf/ dir that will override the item from the classpath
-        // (TBD - we might want to scan for all such bom's?)
-        
-        catalogUrl = "classpath:/brooklyn/default.catalog.bom";
-        if (new ResourceUtils(this).doesUrlExist(catalogUrl)) {
-            populateInitialFromUri(catalog, catalogUrl, PopulateMode.YAML);
-            return;
-        }
-        
-        log.info("No catalog found on classpath or specified; catalog will not be initialized.");
-        return;
-    }
-    
-    private void populateInitialFromUri(BasicBrooklynCatalog catalog, String catalogUrl, PopulateMode mode) {
-        log.debug("Loading initial catalog from {}", catalogUrl);
-
-        Exception problem = null;
-        Object result = null;
-        
-        String contents = null;
-        try {
-            contents = new ResourceUtils(this).getResourceAsString(catalogUrl);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            if (problem==null) problem = e;
-        }
-
-        if (contents!=null && (mode==PopulateMode.YAML || mode==PopulateMode.AUTODETECT)) {
-            // try YAML first
-            try {
-                catalog.reset(MutableList.<CatalogItem<?,?>>of());
-                result = catalog.addItems(contents);
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                if (problem==null) problem = e;
-            }
-        }
-        
-        if (result==null && contents!=null && (mode==PopulateMode.XML || mode==PopulateMode.AUTODETECT)) {
-            // then try XML
-            try {
-                populateInitialFromUriXml(catalog, catalogUrl, contents);
-                // clear YAML problem
-                problem = null;
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                if (problem==null) problem = e;
-            }
-        }
-        
-        if (result!=null) {
-            log.debug("Loaded initial catalog from {}: {}", catalogUrl, result);
-        }
-        if (problem!=null) {
-            log.warn("Error importing catalog from " + catalogUrl + ": " + problem, problem);
-            // TODO inform mgmt of error
-        }
-
-    }
-
-    // deprecated XML format
-    @SuppressWarnings("deprecation")
-    private void populateInitialFromUriXml(BasicBrooklynCatalog catalog, String catalogUrl, String contents) {
-        CatalogDto dto = CatalogDto.newDtoFromXmlContents(contents, catalogUrl);
-        if (dto!=null) {
-            catalog.reset(dto);
-        }
-    }
-
-    boolean hasRunAdditions = false;
-    protected void populateAdditions(BasicBrooklynCatalog catalog) {
-        if (Strings.isNonBlank(additionsUri)) {
-            if (disallowLocal) {
-                if (!hasRunAdditions) {
-                    log.warn("CLI additions supplied but not supported when catalog load mode disallows local loads; ignoring.");
-                }
-                return;
-            }   
-            if (!hasRunAdditions) {
-                log.debug("Adding to catalog from CLI: "+additionsUri+" (force: "+force+")");
-            }
-            Iterable<? extends CatalogItem<?, ?>> items = catalog.addItems(
-                new ResourceUtils(this).getResourceAsString(additionsUri), force);
-            
-            if (!hasRunAdditions)
-                log.debug("Added to catalog from CLI: "+items);
-            else
-                log.debug("Added to catalog from CLI: count "+Iterables.size(items));
-            
-            hasRunAdditions = true;
-        }
-    }
-
-    protected void populateViaCallbacks(BasicBrooklynCatalog catalog) {
-        for (Function<CatalogInitialization, Void> callback: callbacks)
-            callback.apply(this);
-    }
-
-    private Object setFromCLMMutex = new Object();
-    private boolean setFromCatalogLoadMode = false;
-
-    /** @deprecated since introduced in 0.7.0, only for legacy compatibility with 
-     * {@link CatalogLoadMode} {@link BrooklynServerConfig#CATALOG_LOAD_MODE},
-     * allowing control of catalog loading from a brooklyn property */
-    @Deprecated
-    public void applyCatalogLoadMode() {
-        synchronized (setFromCLMMutex) {
-            if (setFromCatalogLoadMode) return;
-            setFromCatalogLoadMode = true;
-            Maybe<Object> clmm = ((ManagementContextInternal)managementContext).getConfig().getConfigRaw(BrooklynServerConfig.CATALOG_LOAD_MODE, false);
-            if (clmm.isAbsent()) return;
-            org.apache.brooklyn.core.catalog.CatalogLoadMode clm = TypeCoercions.coerce(clmm.get(), org.apache.brooklyn.core.catalog.CatalogLoadMode.class);
-            log.warn("Legacy CatalogLoadMode "+clm+" set: applying, but this should be changed to use new CLI --catalogXxx commands");
-            switch (clm) {
-            case LOAD_BROOKLYN_CATALOG_URL:
-                reset = true;
-                break;
-            case LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE:
-                // now the default
-                break;
-            case LOAD_PERSISTED_STATE:
-                disallowLocal = true;
-                break;
-            }
-        }
-    }
-
-    /** Creates the catalog based on parameters set here, if not yet loaded,
-     * but ignoring persisted state and warning if persistence is on and we are starting up
-     * (because the official persistence is preferred and the catalog will be subsequently replaced);
-     * for use when the catalog is accessed before persistence is completed. 
-     * <p>
-     * This method is primarily used during testing, which in many cases does not enforce the full startup order
-     * and which wants a local catalog in any case. It may also be invoked if a client requests the catalog
-     * while the server is starting up. */
-    public void populateUnofficial(BasicBrooklynCatalog catalog) {
-        synchronized (populatingCatalogMutex) {
-            // check isPopulating in case this method gets called from inside another populate call
-            if (hasRunAnyInitialization() || isPopulating) return;
-            log.debug("Populating catalog unofficially ("+catalog+")");
-            isPopulating = true;
-            try {
-                if (isStartingUp) {
-                    log.warn("Catalog access requested when not yet initialized; populating best effort rather than through recommended pathway. Catalog data may be replaced subsequently.");
-                }
-                populateCatalogImpl(catalog, true, true, null);
-            } finally {
-                hasRunUnofficialInitialization = true;
-                isPopulating = false;
-            }
-        }
-    }
-
-    public void handleException(Throwable throwable, Object details) {
-        if (throwable instanceof InterruptedException)
-            throw new RuntimeInterruptedException((InterruptedException) throwable);
-        if (throwable instanceof RuntimeInterruptedException)
-            throw (RuntimeInterruptedException) throwable;
-
-        String throwableText = Exceptions.collapseText(throwable);
-        log.error("Error loading catalog item '"+details+"': "+throwableText);
-        log.debug("Trace for error loading catalog item '"+details+"': "+throwableText, throwable);
-
-        // TODO give more detail when adding
-        ((ManagementContextInternal)getManagementContext()).errors().add(throwable);
-        
-        if (isStartingUp && failOnStartupErrors) {
-            throw new FatalRuntimeException("Unable to load catalog item '"+details+"': "+throwableText, throwable);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java
deleted file mode 100644
index 299abdb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.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 org.apache.brooklyn.core.catalog.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
-
-import com.google.common.base.Preconditions;
-
-public class CatalogItemBuilder<CIConcreteType extends CatalogItemDtoAbstract<?, ?>> {
-    private CIConcreteType dto;
-
-    public static CatalogItemBuilder<?> newItem(CatalogItemType itemType, String symbolicName, String version) {
-        Preconditions.checkNotNull(itemType, "itemType required");
-        switch (itemType) {
-        case ENTITY: return newEntity(symbolicName, version);
-        case TEMPLATE: return newTemplate(symbolicName, version);
-        case POLICY: return newPolicy(symbolicName, version);
-        case LOCATION: return newLocation(symbolicName, version);
-        }
-        throw new IllegalStateException("Unexpected itemType: "+itemType);
-    }
-
-    public static CatalogItemBuilder<CatalogEntityItemDto> newEntity(String symbolicName, String version) {
-        return new CatalogItemBuilder<CatalogEntityItemDto>(new CatalogEntityItemDto())
-                .symbolicName(symbolicName)
-                .version(version);
-    }
-
-    public static CatalogItemBuilder<CatalogTemplateItemDto> newTemplate(String symbolicName, String version) {
-        return new CatalogItemBuilder<CatalogTemplateItemDto>(new CatalogTemplateItemDto())
-                .symbolicName(symbolicName)
-                .version(version);
-    }
-
-    public static CatalogItemBuilder<CatalogPolicyItemDto> newPolicy(String symbolicName, String version) {
-        return new CatalogItemBuilder<CatalogPolicyItemDto>(new CatalogPolicyItemDto())
-                .symbolicName(symbolicName)
-                .version(version);
-    }
-
-    public static CatalogItemBuilder<CatalogLocationItemDto> newLocation(String symbolicName, String version) {
-        return new CatalogItemBuilder<CatalogLocationItemDto>(new CatalogLocationItemDto())
-                .symbolicName(symbolicName)
-                .version(version);
-    }
-
-    public CatalogItemBuilder(CIConcreteType dto) {
-        this.dto = dto;
-        this.dto.setLibraries(Collections.<CatalogBundle>emptyList());
-    }
-
-    public CatalogItemBuilder<CIConcreteType> symbolicName(String symbolicName) {
-        dto.setSymbolicName(symbolicName);
-        return this;
-    }
-
-    @Deprecated
-    public CatalogItemBuilder<CIConcreteType> javaType(String javaType) {
-        dto.setJavaType(javaType);
-        return this;
-    }
-
-    /** @deprecated since 0.7.0 use {@link #displayName}*/
-    @Deprecated
-    public CatalogItemBuilder<CIConcreteType> name(String name) {
-        return displayName(name);
-    }
-
-    public CatalogItemBuilder<CIConcreteType> displayName(String displayName) {
-        dto.setDisplayName(displayName);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> description(String description) {
-        dto.setDescription(description);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> iconUrl(String iconUrl) {
-        dto.setIconUrl(iconUrl);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> version(String version) {
-        dto.setVersion(version);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> deprecated(boolean deprecated) {
-        dto.setDeprecated(deprecated);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> disabled(boolean disabled) {
-        dto.setDisabled(disabled);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> libraries(Collection<CatalogBundle> libraries) {
-        dto.setLibraries(libraries);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> plan(String yaml) {
-        dto.setPlanYaml(yaml);
-        return this;
-    }
-
-    public CatalogItemBuilder<CIConcreteType> tag(Object tag) {
-        dto.tags().addTag(tag);
-        return this;
-    }
-
-    public CIConcreteType build() {
-        Preconditions.checkNotNull(dto.getSymbolicName());
-        Preconditions.checkNotNull(dto.getVersion());
-
-        if (dto.getLibraries() == null) {
-            dto.setLibraries(Collections.<CatalogBundle>emptyList());
-        }
-
-        CIConcreteType ret = dto;
-
-        //prevent mutations through the builder
-        dto = null;
-
-        return ret;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemComparator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemComparator.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemComparator.java
deleted file mode 100644
index abd4d08..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemComparator.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.core.catalog.internal;
-
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.util.text.VersionComparator;
-
-/**
- * Largest version first order.
- * 
- * When using the comparator to sort - first using symbolicName
- * and if equal puts larger versions first, snapshots at the back.
- */
-public class CatalogItemComparator<T,SpecT> implements Comparator<CatalogItem<T, SpecT>> {
-
-    public static final CatalogItemComparator<?, ?> INSTANCE = new CatalogItemComparator<Object, Object>();
-
-    @SuppressWarnings("unchecked")
-    public static <T,SpecT> CatalogItemComparator<T,SpecT> getInstance() {
-        return (CatalogItemComparator<T, SpecT>) INSTANCE;
-    }
-
-    @Override
-    public int compare(CatalogItem<T, SpecT> o1, CatalogItem<T, SpecT> o2) {
-        int symbolicNameComparison = o1.getSymbolicName().compareTo(o2.getSymbolicName());
-        if (symbolicNameComparison != 0) {
-            return symbolicNameComparison;
-        } else {
-            return Collections.reverseOrder(VersionComparator.INSTANCE).compare(o1.getVersion(), o2.getVersion());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java
deleted file mode 100644
index 1766ad7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java
+++ /dev/null
@@ -1,226 +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.core.catalog.internal;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.core.relations.EmptyRelationSupport;
-
-import com.google.common.base.Preconditions;
-
-public class CatalogItemDo<T,SpecT> implements CatalogItem<T,SpecT>, BrooklynObjectInternal {
-
-    protected final CatalogDo catalog;
-    protected final CatalogItemDtoAbstract<T,SpecT> itemDto;
-
-    protected volatile Class<T> javaClass; 
-    
-    public CatalogItemDo(CatalogDo catalog, CatalogItem<T,SpecT> itemDto) {
-        this.catalog = Preconditions.checkNotNull(catalog, "catalog");
-        this.itemDto = (CatalogItemDtoAbstract<T, SpecT>) Preconditions.checkNotNull(itemDto, "itemDto");
-    }
-
-    public CatalogItem<T,SpecT> getDto() {
-        return itemDto;
-    }
-    
-    /**
-     * @throws UnsupportedOperationException; Config not supported for catalog item. See {@link #getPlanYaml()}.
-     */
-    @Override
-    public ConfigurationSupportInternal config() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @throws UnsupportedOperationException; subscriptions are not supported for catalog items
-     */
-    @Override
-    public SubscriptionSupportInternal subscriptions() {
-        throw new UnsupportedOperationException();
-    }
-    
-    /**
-     * Overrides the parent so that relations are not visible.
-     * @return an immutable empty relation support object; relations are not supported,
-     * but we do not throw on access to enable reads in a consistent manner
-     */
-    @Override
-    public RelationSupportInternal<CatalogItem<T,SpecT>> relations() {
-        return new EmptyRelationSupport<CatalogItem<T,SpecT>>(this);
-    }
-    
-    @Override
-    public <U> U getConfig(ConfigKey<U> key) {
-        return config().get(key);
-    }
-    
-    @Override
-    public <U> U setConfig(ConfigKey<U> key, U val) {
-        return config().set(key, val);
-    }
-
-    @Override
-    public CatalogItemType getCatalogItemType() {
-        return itemDto.getCatalogItemType();
-    }
-
-    @Override
-    public Class<T> getCatalogItemJavaType() {
-        return itemDto.getCatalogItemJavaType();
-    }
-
-    @Override
-    public String getId() {
-        return itemDto.getId();
-    }
-
-    @Override
-    public String getCatalogItemId() {
-        return itemDto.getCatalogItemId();
-    }
-
-    @Override
-    public void setDeprecated(boolean deprecated) {
-        itemDto.setDeprecated(deprecated);
-    }
-
-    @Override
-    public boolean isDeprecated() {
-        return itemDto.isDeprecated();
-    }
-
-    @Override
-    public void setDisabled(boolean diabled) {
-        itemDto.setDisabled(diabled);
-    }
-
-    @Override
-    public boolean isDisabled() {
-        return itemDto.isDisabled();
-    }
-
-    @Override
-    public void setCatalogItemId(String id) {
-        itemDto.setCatalogItemId(id);
-    }
-
-    @Override
-    public String getJavaType() {
-        return itemDto.getJavaType();
-    }
-
-    @Deprecated
-    @Override
-    public String getName() {
-        return getDisplayName();
-    }
-
-    @Deprecated
-    @Override
-    public String getRegisteredTypeName() {
-        return getSymbolicName();
-    }
-
-    @Override
-    public String getDisplayName() {
-        return itemDto.getDisplayName();
-    }
-
-    @Override
-    public TagSupport tags() {
-        return itemDto.tags();
-    }
-
-    @Override
-    public String getDescription() {
-        return itemDto.getDescription();
-    }
-
-    @Override
-    public String getIconUrl() {
-        return itemDto.getIconUrl();
-    }
-    
-    @Override
-    public String getSymbolicName() {
-        return itemDto.getSymbolicName();
-    }
-
-    @Override
-    public String getVersion() {
-        return itemDto.getVersion();
-    }
-
-    @Nonnull  // but it is still null sometimes, see in CatalogDo.loadJavaClass
-    @Override
-    public Collection<CatalogBundle> getLibraries() {
-        return itemDto.getLibraries();
-    }
-
-    /** @deprecated since 0.7.0 this is the legacy mechanism; still needed for policies and apps, but being phased out.
-     * new items should use {@link #getPlanYaml} and {@link #newClassLoadingContext} */
-    @Deprecated
-    public Class<T> getJavaClass() {
-        if (javaClass==null) loadJavaClass(null);
-        return javaClass;
-    }
-    
-    @SuppressWarnings("unchecked")
-    @Deprecated
-    Class<? extends T> loadJavaClass(final ManagementContext mgmt) {
-        if (javaClass!=null) return javaClass;
-        javaClass = (Class<T>)CatalogUtils.newClassLoadingContext(mgmt, getId(), getLibraries(), catalog.getRootClassLoader()).loadClass(getJavaType());
-        return javaClass;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getCanonicalName()+"["+itemDto+"]";
-    }
-
-    @Override
-    public String toXmlString() {
-        return itemDto.toXmlString();
-    }
-
-    @Override
-    public Class<SpecT> getSpecType() {
-        return itemDto.getSpecType();
-    }
-
-    @Nullable @Override
-    public String getPlanYaml() {
-        return itemDto.getPlanYaml();
-    }
-
-    @Override
-    public RebindSupport<CatalogItemMemento> getRebindSupport() {
-        return itemDto.getRebindSupport();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java
deleted file mode 100644
index df0d2e4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java
+++ /dev/null
@@ -1,439 +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.core.catalog.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.mgmt.rebind.BasicCatalogItemRebindSupport;
-import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
-import org.apache.brooklyn.core.relations.EmptyRelationSupport;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynObject implements CatalogItem<T, SpecT> {
-
-    private static Logger LOG = LoggerFactory.getLogger(CatalogItemDtoAbstract.class);
-
-    private @SetFromFlag String symbolicName;
-    private @SetFromFlag String version = BasicBrooklynCatalog.NO_VERSION;
-
-    private @SetFromFlag String displayName;
-    private @SetFromFlag String description;
-    private @SetFromFlag String iconUrl;
-
-    private @SetFromFlag String javaType;
-    /**@deprecated since 0.7.0, left for deserialization backwards compatibility (including xml based catalog format) */
-    private @Deprecated @SetFromFlag String type;
-    private @SetFromFlag String planYaml;
-
-    private @SetFromFlag Collection<CatalogBundle> libraries;
-    private @SetFromFlag Set<Object> tags = Sets.newLinkedHashSet();
-    private @SetFromFlag boolean deprecated;
-    private @SetFromFlag boolean disabled;
-
-    /**
-     * @throws UnsupportedOperationException; Config not supported for catalog item. See {@link #getPlanYaml()}.
-     */
-    @Override
-    public ConfigurationSupportInternal config() {
-        throw new UnsupportedOperationException();
-    }
-    
-    /**
-     * @throws UnsupportedOperationException; subscriptions are not supported for catalog items
-     */
-    @Override
-    public SubscriptionSupportInternal subscriptions() {
-        throw new UnsupportedOperationException();
-    }
-    
-    @Override
-    public <U> U getConfig(ConfigKey<U> key) {
-        return config().get(key);
-    }
-    
-    @Override
-    public <U> U setConfig(ConfigKey<U> key, U val) {
-        return config().set(key, val);
-    }
-    
-    @Override
-    public String getId() {
-        return getCatalogItemId();
-    }
-
-    @Override
-    public String getCatalogItemId() {
-        return CatalogUtils.getVersionedId(getSymbolicName(), getVersion());
-    }
-
-    @Override
-    public String getJavaType() {
-        if (javaType != null) return javaType;
-        return type;
-    }
-
-    @Override
-    @Deprecated
-    public String getName() {
-        return getDisplayName();
-    }
-
-    @Override
-    @Deprecated
-    public String getRegisteredTypeName() {
-        return getSymbolicName();
-    }
-
-    @Override
-    public String getDisplayName() {
-        return displayName;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getIconUrl() {
-        return iconUrl;
-    }
-
-    @Override
-    public String getSymbolicName() {
-        if (symbolicName != null) return symbolicName;
-        return getJavaType();
-    }
-
-    @Override
-    public String getVersion() {
-        // The property is set to NO_VERSION when the object is initialized so it's not supposed to be null ever.
-        // But xstream doesn't call constructors when reading from the catalog.xml file which results in null value
-        // for the version property. That's why we have to fix it in the getter.
-        if (version != null) {
-            return version;
-        } else {
-            return BasicBrooklynCatalog.NO_VERSION;
-        }
-    }
-
-    @Override
-    public boolean isDeprecated() {
-        return deprecated;
-    }
-
-    @Override
-    public void setDeprecated(boolean deprecated) {
-        this.deprecated = deprecated;
-    }
-
-    @Override
-    public boolean isDisabled() {
-        return disabled;
-    }
-
-    @Override
-    public void setDisabled(boolean disabled) {
-        this.disabled = disabled;
-    }
-
-    @Nonnull
-    @Override
-    public Collection<CatalogBundle> getLibraries() {
-        if (libraries != null) {
-            return ImmutableList.copyOf(libraries);
-        } else {
-            return Collections.emptyList();
-        }
-    }
-
-    @Nullable @Override
-    public String getPlanYaml() {
-        return planYaml;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(symbolicName, planYaml, javaType, nullIfEmpty(libraries), version, getCatalogItemId());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
-        CatalogItemDtoAbstract<?,?> other = (CatalogItemDtoAbstract<?,?>) obj;
-        if (!Objects.equal(symbolicName, other.symbolicName)) return false;
-        if (!Objects.equal(planYaml, other.planYaml)) return false;
-        if (!Objects.equal(javaType, other.javaType)) return false;
-        if (!Objects.equal(nullIfEmpty(libraries), nullIfEmpty(other.libraries))) return false;
-        if (!Objects.equal(getCatalogItemId(), other.getCatalogItemId())) return false;
-        if (!Objects.equal(version, other.version)) return false;
-        if (!Objects.equal(deprecated, other.deprecated)) return false;
-        if (!Objects.equal(description, other.description)) return false;
-        if (!Objects.equal(displayName, other.displayName)) return false;
-        if (!Objects.equal(iconUrl, other.iconUrl)) return false;
-        if (!Objects.equal(tags, other.tags)) return false;
-        // 'type' not checked, because deprecated, 
-        // and in future we might want to allow it to be removed/blanked in some impls without affecting equality
-        // (in most cases it is the same as symbolicName so doesn't matter)
-        return true;
-    }
-
-    private static <T> Collection<T> nullIfEmpty(Collection<T> coll) {
-        if (coll==null || coll.isEmpty()) return null;
-        return coll;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName()+"["+getId()+"/"+getDisplayName()+"]";
-    }
-
-    @Override
-    public abstract Class<SpecT> getSpecType();
-
-    transient CatalogXmlSerializer serializer;
-
-    @Override
-    public String toXmlString() {
-        if (serializer==null) loadSerializer();
-        return serializer.toString(this);
-    }
-
-    private synchronized void loadSerializer() {
-        if (serializer == null) {
-            serializer = new CatalogXmlSerializer();
-        }
-    }
-
-    @Override
-    public RebindSupport<CatalogItemMemento> getRebindSupport() {
-        return new BasicCatalogItemRebindSupport(this);
-    }
-
-    /**
-     * Overrides the parent so that relations are not visible.
-     * @return an immutable empty relation support object; relations are not supported,
-     * but we do not throw on access to enable reads in a consistent manner
-     */
-    @Override
-    public RelationSupportInternal<CatalogItem<T,SpecT>> relations() {
-        return new EmptyRelationSupport<CatalogItem<T,SpecT>>(this);
-    }
-
-    @Override
-    public void setDisplayName(String newName) {
-        this.displayName = newName;
-    }
-
-    @Override
-    protected CatalogItemDtoAbstract<T, SpecT> configure(Map<?, ?> flags) {
-        FlagUtils.setFieldsFromFlags(flags, this);
-        return this;
-    }
-
-    @Override
-    public TagSupport tags() {
-        return new BasicTagSupport();
-    }
-
-    /*
-     * Using a custom tag support class rather than the one in AbstractBrooklynObject because
-     * when XStream unmarshals a catalog item with no tags (e.g. from any catalog.xml file)
-     * super.tags will be null, and any call to getTags throws a NullPointerException on the
-     * synchronized (tags) statement. It can't just be initialised here because super.tags is
-     * final.
-     */
-    private class BasicTagSupport implements TagSupport {
-
-        private void setTagsIfNull() {
-            // Possible if the class was unmarshalled by Xstream with no tags
-            synchronized (CatalogItemDtoAbstract.this) {
-                if (tags == null) {
-                    tags = Sets.newLinkedHashSet();
-                }
-            }
-        }
-
-        @Nonnull
-        @Override
-        public Set<Object> getTags() {
-            synchronized (CatalogItemDtoAbstract.this) {
-                setTagsIfNull();
-                return ImmutableSet.copyOf(tags);
-            }
-        }
-
-        @Override
-        public boolean containsTag(Object tag) {
-            synchronized (CatalogItemDtoAbstract.this) {
-                setTagsIfNull();
-                return tags.contains(tag);
-            }
-        }
-
-        @Override
-        public boolean addTag(Object tag) {
-            boolean result;
-            synchronized (CatalogItemDtoAbstract.this) {
-                setTagsIfNull();
-                result = tags.add(tag);
-            }
-            onTagsChanged();
-            return result;
-        }
-
-        @Override
-        public boolean addTags(Iterable<?> newTags) {
-            boolean result;
-            synchronized (CatalogItemDtoAbstract.this) {
-                setTagsIfNull();
-                result = Iterables.addAll(tags, newTags);
-            }
-            onTagsChanged();
-            return result;
-        }
-
-        @Override
-        public boolean removeTag(Object tag) {
-            boolean result;
-            synchronized (CatalogItemDtoAbstract.this) {
-                setTagsIfNull();
-                result = tags.remove(tag);
-            }
-            onTagsChanged();
-            return result;
-        }
-    }
-
-    @Override
-    @Deprecated
-    public void setCatalogItemId(String id) {
-        //no op, should be used by rebind code only
-    }
-
-    protected void setSymbolicName(String symbolicName) {
-        this.symbolicName = symbolicName;
-    }
-
-    protected void setVersion(String version) {
-        this.version = version;
-    }
-
-    protected void setDescription(String description) {
-        this.description = description;
-    }
-
-    protected void setIconUrl(String iconUrl) {
-        this.iconUrl = iconUrl;
-    }
-
-    protected void setJavaType(String javaType) {
-        this.javaType = javaType;
-        this.type = null;
-    }
-
-    protected void setPlanYaml(String planYaml) {
-        this.planYaml = planYaml;
-    }
-
-    protected void setLibraries(Collection<CatalogBundle> libraries) {
-        this.libraries = libraries;
-    }
-
-    protected void setTags(Set<Object> tags) {
-        this.tags = tags;
-    }
-
-    protected void setSerializer(CatalogXmlSerializer serializer) {
-        this.serializer = serializer;
-    }
-
-    /**
-     * Parses an instance of CatalogLibrariesDto from the given List. Expects the list entries
-     * to be either Strings or Maps of String -> String. Will skip items that are not.
-     */
-    public static Collection<CatalogBundle> parseLibraries(Collection<?> possibleLibraries) {
-        Collection<CatalogBundle> dto = MutableList.of();
-        for (Object object : possibleLibraries) {
-            if (object instanceof Map) {
-                Map<?, ?> entry = (Map<?, ?>) object;
-                String name = stringValOrNull(entry, "name");
-                String version = stringValOrNull(entry, "version");
-                String url = stringValOrNull(entry, "url");
-                dto.add(new CatalogBundleDto(name, version, url));
-            } else if (object instanceof String) {
-                String inlineRef = (String) object;
-
-                final String name;
-                final String version;
-                final String url;
-
-                //Infer reference type (heuristically)
-                if (inlineRef.contains("/") || inlineRef.contains("\\")) {
-                    //looks like an url/file path
-                    name = null;
-                    version = null;
-                    url = inlineRef;
-                } else if (CatalogUtils.looksLikeVersionedId(inlineRef)) {
-                    //looks like a name+version ref
-                    name = CatalogUtils.getSymbolicNameFromVersionedId(inlineRef);
-                    version = CatalogUtils.getVersionFromVersionedId(inlineRef);
-                    url = null;
-                } else {
-                    //assume it to be relative url
-                    name = null;
-                    version = null;
-                    url = inlineRef;
-                }
-
-                dto.add(new CatalogBundleDto(name, version, url));
-            } else {
-                LOG.debug("Unexpected entry in libraries list neither string nor map: " + object);
-            }
-        }
-        return dto;
-    }
-
-    private static String stringValOrNull(Map<?, ?> map, String key) {
-        Object val = map.get(key);
-        return val != null ? String.valueOf(val) : null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDo.java
deleted file mode 100644
index 99041d2..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDo.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 org.apache.brooklyn.core.catalog.internal;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-
-import com.google.common.base.Preconditions;
-
-@Deprecated
-public class CatalogLibrariesDo implements CatalogItem.CatalogItemLibraries {
-
-    private final CatalogLibrariesDto librariesDto;
-
-
-    public CatalogLibrariesDo(CatalogLibrariesDto librariesDto) {
-        this.librariesDto = Preconditions.checkNotNull(librariesDto, "librariesDto");
-    }
-
-    @Override
-    public Collection<String> getBundles() {
-        return librariesDto.getBundles();
-    }
-
-}


[45/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java
deleted file mode 100644
index 88d72cb..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.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 org.apache.brooklyn.api.catalog;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD })
-public @interface CatalogConfig {
-
-    /** a label to be displayed when a config key is exposed as editable in the catalog */ 
-    String label();
-    
-    /** a priority used to determine the order in which config keys are displayed when presenting as editable in the catalog;
-     * a higher value appears higher in the list. the default is 1.
-     * (negative values may be used to indicate advanced config which might not be shown unless requested.) */ 
-    double priority() default 1;
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
deleted file mode 100644
index 795e393..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
+++ /dev/null
@@ -1,153 +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.api.catalog;
-
-import java.util.Collection;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public interface CatalogItem<T,SpecT> extends BrooklynObject, Rebindable {
-    
-    public static enum CatalogItemType {
-        TEMPLATE, 
-        ENTITY, 
-        POLICY,
-        LOCATION;
-        
-        public static CatalogItemType ofSpecClass(Class<? extends AbstractBrooklynObjectSpec<?, ?>> type) {
-            if (type==null) return null;
-            if (PolicySpec.class.isAssignableFrom(type)) return POLICY;
-            if (LocationSpec.class.isAssignableFrom(type)) return LOCATION;
-            if (EntitySpec.class.isAssignableFrom(type)) return ENTITY;
-            return null;
-        }
-        public static CatalogItemType ofTargetClass(Class<? extends BrooklynObject> type) {
-            if (type==null) return null;
-            if (Policy.class.isAssignableFrom(type)) return POLICY;
-            if (Location.class.isAssignableFrom(type)) return LOCATION;
-            if (Application.class.isAssignableFrom(type)) return TEMPLATE;
-            if (Entity.class.isAssignableFrom(type)) return ENTITY;
-            return null;
-        }
-    }
-    
-    public static interface CatalogBundle extends OsgiBundleWithUrl {
-        /** @deprecated since 0.9.0, use {@link #isNameResolved()} */
-        public boolean isNamed();
-    }
-
-    /**
-     * @throws UnsupportedOperationException; config not supported for catalog items
-     */
-    @Override
-    ConfigurationSupport config();
-
-    /**
-     * @throws UnsupportedOperationException; subscriptions are not supported for catalog items
-     */
-    @Override
-    SubscriptionSupport subscriptions();
-
-    /** @deprecated since 0.7.0 in favour of {@link CatalogBundle}, kept for rebind compatibility */
-    @Deprecated
-    public static interface CatalogItemLibraries {
-        Collection<String> getBundles();
-    }
-
-    public CatalogItemType getCatalogItemType();
-
-    /** @return The high-level type of this entity, e.g. Entity (not a specific Entity class) */
-    public Class<T> getCatalogItemJavaType();
-
-    /** @return The type of the spec e.g. EntitySpec corresponding to {@link #getCatalogItemJavaType()} */
-    public Class<SpecT> getSpecType();
-    
-    /**
-     * @return The underlying java type of the item represented, if not described via a YAML spec.
-     * Normally null (and the type comes from yaml).
-     * @deprecated since 0.9.0. Use plan based items instead ({@link #getPlanYaml()})
-     */
-    @Deprecated
-    @Nullable public String getJavaType();
-
-    /** @deprecated since 0.7.0. Use {@link #getDisplayName} */
-    @Deprecated
-    public String getName();
-
-    /** @deprecated since 0.7.0. Use {@link #getSymbolicName} */
-    @Deprecated
-    public String getRegisteredTypeName();
-
-    @Nullable public String getDescription();
-
-    @Nullable public String getIconUrl();
-
-    public String getSymbolicName();
-
-    public String getVersion();
-
-    public Collection<CatalogBundle> getLibraries();
-
-    public String toXmlString();
-
-    /** @return The underlying YAML for this item, if known; 
-     * currently including `services:` or `brooklyn.policies:` prefix (but this will likely be removed) */
-    @Nullable public String getPlanYaml();
-
-    @Override
-    RebindSupport<CatalogItemMemento> getRebindSupport();
-    
-    /** Built up from {@link #getSymbolicName()} and {@link #getVersion()}.
-     * 
-     * (It is a bit self-referential having this method on this type of {@link BrooklynObject},
-     * but it is easier this than making the interface hierarchy more complicated.) */
-    @Override
-    public String getCatalogItemId();
-
-    public void setDeprecated(boolean deprecated);
-
-    public void setDisabled(boolean disabled);
-
-    /**
-     * @return True if the item has been deprecated (i.e. its use is discouraged)
-     */
-    boolean isDeprecated();
-    
-    /**
-     * @return True if the item has been disabled (i.e. its use is forbidden, except for pre-existing apps)
-     */
-    boolean isDisabled();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java
deleted file mode 100644
index 82ce6ee..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/Effector.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 org.apache.brooklyn.api.effector;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.management.MBeanOperationInfo;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * An operation of some kind, carried out by an {@link Entity}.
- *
- * Similar to the concepts in the JMX {@link MBeanOperationInfo} class.
- */
-public interface Effector<T> extends Serializable {
-    /**
-     * human-friendly name of the effector (although frequently this uses java method naming convention)
-     */
-    String getName();
-
-    Class<T> getReturnType();
-
-    /**
-     * canonical name of return type (in case return type does not resolve after serialization)
-     */
-    String getReturnTypeName();
-
-    /**
-     * parameters expected by method, including name and type, optional description and default value
-     */
-    List<ParameterType<?>> getParameters();
-
-    /**
-     * optional description for the effector
-     */
-    String getDescription();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
deleted file mode 100644
index 7f0736d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
+++ /dev/null
@@ -1,48 +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.api.effector;
-
-import java.io.Serializable;
-
-import javax.management.MBeanParameterInfo;
-
-/**
- * Similar to the concepts in the JMX {@link MBeanParameterInfo} class.
- *
- * @see Effector
- */
-public interface ParameterType<T> extends Serializable {
-    
-    public String getName();
-
-    public Class<T> getParameterClass();
-
-    /**
-     * The canonical name of the parameter class; especially useful if the class 
-     * cannot be resolved after deserialization. 
-     */
-    public String getParameterClassName();
-
-    public String getDescription();
-
-    /**
-     * @return The default value for this parameter, if not supplied during an effector call.
-     */
-    public T getDefaultValue();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Application.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
deleted file mode 100644
index 402d004..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
+++ /dev/null
@@ -1,34 +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.api.entity;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-
-/**
- * An application is the root of the entity hierarchy. In the parent-child relationship, it is
- * the top-level entity under which the application's entities are all places.
- * 
- * The recommended ways to write a new application are to either extend {@link org.apache.brooklyn.entity.factory.ApplicationBuilder} 
- * or to extend {@link org.apache.brooklyn.core.entity.AbstractApplication}.
- */
-public interface Application extends Entity {
-    
-    ManagementContext getManagementContext();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
deleted file mode 100644
index 14d3c23..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
+++ /dev/null
@@ -1,442 +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.api.entity;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-
-/**
- * The basic interface for a Brooklyn entity.
- * <p>
- * Implementors of entities are strongly encouraged to extend {@link org.apache.brooklyn.core.entity.AbstractEntity}.
- * <p>
- * To instantiate an entity, see {@code managementContext.getEntityManager().createEntity(entitySpec)}.
- * Also see {@link org.apache.brooklyn.core.entity.factory.ApplicationBuilder}, 
- * {@link org.apache.brooklyn.core.entity.AbstractEntity#addChild(EntitySpec)}, and
- * {@link org.apache.brooklyn.api.entity.EntitySpec}.
- * <p>
- * 
- * @see org.apache.brooklyn.core.entity.AbstractEntity
- */
-public interface Entity extends BrooklynObject {
-    /**
-     * The unique identifier for this entity.
-     */
-    @Override
-    String getId();
-    
-    /**
-     * Returns the creation time for this entity, in UTC.
-     */
-    long getCreationTime();
-    
-    /**
-     * A display name; recommended to be a concise single-line description.
-     */
-    String getDisplayName();
-    
-    /** 
-     * A URL pointing to an image which can be used to represent this entity.
-     */
-    @Nullable String getIconUrl();
-    
-    /**
-     * Information about the type of this entity; analogous to Java's object.getClass.
-     */
-    EntityType getEntityType();
-    
-    /**
-     * @return the {@link Application} this entity is registered with, or null if not registered.
-     */
-    Application getApplication();
-
-    /**
-     * @return the id of the {@link Application} this entity is registered with, or null if not registered.
-     */
-    String getApplicationId();
-
-    /**
-     * The parent of this entity, null if no parent.
-     *
-     * The parent is normally the entity responsible for creating/destroying/managing this entity.
-     *
-     * @see #setParent(Entity)
-     * @see #clearParent
-     */
-    Entity getParent();
-    
-    /** 
-     * Return the entities that are children of (i.e. "owned by") this entity
-     */
-    Collection<Entity> getChildren();
-    
-    /**
-     * Sets the entity's display name.
-     */
-    void setDisplayName(String displayName);
-
-    /**
-     * Sets the parent (i.e. "owner") of this entity. Returns this entity, for convenience.
-     *
-     * @see #getParent
-     * @see #clearParent
-     */
-    Entity setParent(Entity parent);
-    
-    /**
-     * Clears the parent (i.e. "owner") of this entity. Also cleans up any references within its parent entity.
-     *
-     * @see #getParent
-     * @see #setParent
-     */
-    void clearParent();
-    
-    /** 
-     * Add a child {@link Entity}, and set this entity as its parent,
-     * returning the added child.
-     * <p>
-     * As with {@link #addChild(EntitySpec)} the child is <b>not</b> brought under management
-     * as part of this call.  It should not be managed prior to this call either.
-     */
-    <T extends Entity> T addChild(T child);
-    
-    /** 
-     * Creates an {@link Entity} from the given spec and adds it, setting this entity as the parent,
-     * returning the added child.
-     * <p>
-     * The added child is <b>not</b> managed as part of this call, even if the parent is managed,
-     * so if adding post-management an explicit call to manage the child will be needed;
-     * see the convenience method <code>Entities.manage(...)</code>. 
-     * */
-    <T extends Entity> T addChild(EntitySpec<T> spec);
-    
-    /** 
-     * Removes the specified child {@link Entity}; its parent will be set to null.
-     * 
-     * @return True if the given entity was contained in the set of children
-     */
-    boolean removeChild(Entity child);
-    
-    /**
-     * @return an immutable thread-safe view of the policies.
-     * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#getPolicies()}
-     */
-    @Deprecated
-    Collection<Policy> getPolicies();
-    
-    /**
-     * @return an immutable thread-safe view of the enrichers.
-     * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#getEnrichers()}
-     */
-    @Deprecated
-    Collection<Enricher> getEnrichers();
-    
-    /**
-     * The {@link Collection} of {@link Group}s that this entity is a member of.
-     *
-     * Groupings can be used to allow easy management/monitoring of a group of entities.
-     * 
-     * @deprecated since 0.9.0; see {@link GroupSupport#getGroups()} and {@link #groups()}
-     */
-    @Deprecated
-    Collection<Group> getGroups();
-
-    /**
-     * Add this entity as a member of the given {@link Group}. Called by framework.
-     * <p>
-     * Users should call {@link Group#addMember(Entity)} instead; this method will then 
-     * automatically be called. However, the reverse is not true (calling this method will 
-     * not tell the group; this behaviour may change in a future release!)
-     * 
-     * @deprecated since 0.9.0; see {@link GroupSupport#add()} and {@link #groups()}
-     */
-    @Deprecated
-    void addGroup(Group group);
-
-    /**
-     * Removes this entity as a member of the given {@link Group}. Called by framework.
-     * <p>
-     * Users should call {@link Group#removeMember(Entity)} instead; this method will then 
-     * automatically be called. However, the reverse is not true (calling this method will 
-     * not tell the group; this behaviour may change in a future release!)
-     * 
-     * @deprecated since 0.9.0; see {@link GroupSupport#remove()} and {@link #groups()}
-     */
-    @Deprecated
-    void removeGroup(Group group);
-
-    /**
-     * Return all the {@link Location}s this entity is deployed to.
-     */
-    Collection<Location> getLocations();
-
-    /**
-     * Convenience for calling {@link SensorSupport#get(AttributeSensor)},
-     * via code like {@code sensors().get(key)}.
-     */
-    <T> T getAttribute(AttributeSensor<T> sensor);
-    
-    /**
-     * @see {@link #getConfig(ConfigKey)}
-     */
-    <T> T getConfig(HasConfigKey<T> key);
-    
-    /**
-     * Returns the uncoerced value for this config key as set on this entity, if available,
-     * not following any inheritance chains and not taking any default.
-     * 
-     * @deprecated since 0.7.0; use {@code ((EntityInternal)entity).config().getRaw()} or
-     *             {@code ((EntityInternal)entity).config().getLocalRaw()}
-     */
-    @Deprecated
-    Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited);
-    
-    /**
-     * @see {@link #getConfigRaw(ConfigKey, boolean)}.
-     * 
-     * @deprecated since 0.7.0
-     */
-    @Deprecated
-    Maybe<Object> getConfigRaw(HasConfigKey<?> key, boolean includeInherited);
-
-    /**
-     * Invokes the given effector, with the given parameters to that effector.
-     */
-    <T> Task<T> invoke(Effector<T> eff, Map<String,?> parameters);
-    
-    /**
-     * Adds the given policy to this entity. Also calls policy.setEntity if available.
-     * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#add(Policy)}
-     */
-    @Deprecated
-    void addPolicy(Policy policy);
-    
-    /**
-     * Adds the given policy to this entity. Also calls policy.setEntity if available.
-     * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#add(PolicySpec)}
-     */
-    @Deprecated
-    <T extends Policy> T addPolicy(PolicySpec<T> policy);
-    
-    /**
-     * Removes the given policy from this entity. 
-     * @return True if the policy existed at this entity; false otherwise
-     * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#remove(Policy)}
-     */
-    @Deprecated
-    boolean removePolicy(Policy policy);
-    
-    /**
-     * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
-     * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#add(Enricher)}
-     */
-    @Deprecated
-    void addEnricher(Enricher enricher);
-    
-    /**
-     * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
-     * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#add(EnricherSpec)}
-     */
-    @Deprecated
-    <T extends Enricher> T addEnricher(EnricherSpec<T> enricher);
-    
-    /**
-     * Removes the given enricher from this entity. 
-     * @return True if the policy enricher at this entity; false otherwise
-     * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#remove(Enricher)}
-     */
-    @Deprecated
-    boolean removeEnricher(Enricher enricher);
-    
-    /**
-     * Adds the given feed to this entity. Also calls feed.setEntity if available.
-     */
-    <T extends Feed> T addFeed(T feed);
-    
-    SensorSupport sensors();
-
-    PolicySupport policies();
-
-    EnricherSupport enrichers();
-
-    GroupSupport groups();
-
-    @Override
-    RelationSupport<Entity> relations();
-    
-    @Beta
-    public interface SensorSupport {
-
-        /**
-         * Gets the value of the given attribute on this entity, or null if has not been set.
-         *
-         * Attributes can be things like workrate and status information, as well as
-         * configuration (e.g. url/jmxHost/jmxPort), etc.
-         */
-        <T> T get(AttributeSensor<T> key);
-
-        /**
-         * Sets the {@link AttributeSensor} data for the given attribute to the specified value.
-         * 
-         * This can be used to "enrich" the entity, such as adding aggregated information, 
-         * rolling averages, etc.
-         * 
-         * @return the old value for the attribute (possibly {@code null})
-         */
-        <T> T set(AttributeSensor<T> attribute, T val);
-
-        /**
-         * Atomically modifies the {@link AttributeSensor}, ensuring that only one modification is done
-         * at a time.
-         * 
-         * If the modifier returns {@link Maybe#absent()} then the attribute will be
-         * left unmodified, and the existing value will be returned.
-         * 
-         * For details of the synchronization model used to achieve this, refer to the underlying 
-         * attribute store (e.g. AttributeMap).
-         * 
-         * @return the old value for the attribute (possibly {@code null})
-         * @since 0.7.0-M2
-         */
-        @Beta
-        <T> T modify(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier);
-
-        /**
-         * Emits a {@link SensorEvent} event on behalf of this entity (as though produced by this entity).
-         * <p>
-         * Note that for attribute sensors it is nearly always recommended to use setAttribute, 
-         * as this method will not update local values.
-         */
-        <T> void emit(Sensor<T> sensor, T value);
-    }
-    
-    public interface AdjunctSupport<T extends EntityAdjunct> extends Iterable<T> {
-        /**
-         * @return A read-only thread-safe iterator over all the instances.
-         */
-        Iterator<T> iterator();
-        
-        int size();
-        boolean isEmpty();
-        
-        /**
-         * Adds an instance.
-         */
-        void add(T val);
-        
-        /**
-         * Removes an instance.
-         */
-        boolean remove(T val);
-    }
-    
-    @Beta
-    public interface PolicySupport extends AdjunctSupport<Policy> {
-        /**
-         * Adds the given policy to this entity. Also calls policy.setEntity if available.
-         */
-        @Override
-        void add(Policy policy);
-        
-        /**
-         * Removes the given policy from this entity. 
-         * @return True if the policy existed at this entity; false otherwise
-         */
-        @Override
-        boolean remove(Policy policy);
-        
-        /**
-         * Adds the given policy to this entity. Also calls policy.setEntity if available.
-         */
-        <T extends Policy> T add(PolicySpec<T> enricher);
-    }
-    
-    @Beta
-    public interface EnricherSupport extends AdjunctSupport<Enricher> {
-        /**
-         * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
-         */
-        @Override
-        void add(Enricher enricher);
-        
-        /**
-         * Removes the given enricher from this entity. 
-         * @return True if the policy enricher at this entity; false otherwise
-         */
-        @Override
-        boolean remove(Enricher enricher);
-        
-        /**
-         * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
-         */
-        <T extends Enricher> T add(EnricherSpec<T> enricher);
-    }
-
-    /**
-     * For managing/querying the group membership of this entity. 
-     * 
-     * Groupings can be used to allow easy management/monitoring of a group of entities.
-     * 
-     * To add/remove this entity from a group, users should call {@link Group#addMember(Entity)} 
-     * and {@link Group#removeMember(Entity)}. In a future release, add/remove methods may be
-     * added here.
-     */
-    @Beta
-    public interface GroupSupport extends Iterable<Group> {
-        /**
-         * A read-only thread-safe iterator over all the {@link Group}s that this entity is a member of.
-         */
-        @Override
-        Iterator<Group> iterator();
-        
-        int size();
-        boolean isEmpty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java
deleted file mode 100644
index a9f407a..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.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 org.apache.brooklyn.api.entity;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Feed;
-
-/** 
- * Instances of this class supply logic which can be used to initialize entities. 
- * These can be added to an {@link EntitySpec} programmatically, or declared as part
- * of YAML recipes in a <code>brooklyn.initializers</code> section.
- * In the case of the latter, implementing classes should define a no-arg constructor
- * or a {@link Map} constructor so that YAML parameters can be supplied.
- * <p>
- * Note that initializers are only invoked on first creation; they are not called 
- * during a rebind. Instead, the typical pattern is that initializers will create
- * {@link EntityAdjunct} instances such as {@link Policy} and {@link Feed}
- * which will be attached during rebind.
- **/ 
-public interface EntityInitializer {
-    
-    /** Applies initialization logic to a just-built entity.
-     * Invoked immediately after the "init" call on the AbstractEntity constructed.
-     * 
-     * @param entity guaranteed to be the actual implementation instance, 
-     * thus guaranteed to be castable to EntityInternal which is often desired,
-     * or to the type at hand (it is not even a proxy)
-     */
-    public void apply(EntityLocal entity);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
deleted file mode 100644
index aeb7249..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
+++ /dev/null
@@ -1,175 +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.api.entity;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-
-/** 
- * Extended Entity interface for use in places where the caller should have certain privileges,
- * such as setting attribute values, adding policies, etc.
- * 
- * FIXME Moved from core project to api project because of bug in groovy's covariant return types.
- * EntityDriver needs to return EntityLocal rather than Entity, to avoid changing a whole load
- * of sub-types.
- * FIXME Add {@link setAttribute(AttributeSensorAndConfigKey<?,T>)} back in if/when move it back,
- * or if we extract an interface for AttributeSensorAndConfigKey.
- * 
- * @deprecated since 0.9.0; use {@link Entity} or {@link org.apache.brooklyn.core.entity.EntityInternal}
- */
-public interface EntityLocal extends Entity {
-    
-    // FIXME Rename to something other than EntityLocal.
-    // Separate out what is specific to "local jvm", and what is here for an SPI rather than API.
-
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
-     */
-    @Deprecated
-    <T> T setConfig(ConfigKey<T> key, T val);
-    
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
-     */
-    @Deprecated
-    <T> T setConfig(ConfigKey<T> key, Task<T> val);
-    
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
-     */
-    @Deprecated
-    <T> T setConfig(HasConfigKey<T> key, T val);
-    
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
-     */
-    @Deprecated
-    <T> T setConfig(HasConfigKey<T> key, Task<T> val);
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupport#set(AttributeSensor, Object)} via code like {@code sensors().set(attribute, val)}.
-     */
-    <T> T setAttribute(AttributeSensor<T> attribute, T val);
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupport#modify(AttributeSensor, Function)} via code like {@code sensors().modify(attribute, modifier)}.
-     */
-    @Beta
-    <T> T modifyAttribute(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier);
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupport#emit(Sensor, Object)} via code like {@code sensors().emit(sensor, val)}.
-     */
-    <T> void emit(Sensor<T> sensor, T value);
-    
-    /**
-     * @deprecated in 0.5; use {@link #getConfig(ConfigKey)}
-     */
-    <T> T getConfig(ConfigKey<T> key, T defaultValue);
-    
-    /**
-     * @deprecated in 0.5; use {@link #getConfig(HasConfigKey)}
-     */
-    <T> T getConfig(HasConfigKey<T> key, T defaultValue);
-
-    /**
-     * Allow us to subscribe to data from a {@link Sensor} on another entity.
-     * 
-     * @return a subscription id which can be used to unsubscribe
-     *
-     * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
-     * 
-     * @deprecated since 0.9.0; see {@link SubscriptionSupportInternal#getSubscriptionContext()}, e.g. with {@code subscriptions().getSubscriptionContext()}
-     */
-    @Deprecated
-    @Beta
-    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-    /**
-     * @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)
-     * 
-     * @deprecated since 0.9.0; see {@link SubscriptionSupport#subscribeToChildren(Entity, Sensor, SensorEventListener)}, e.g. with {@code subscriptions().subscribeToChildren(...)}
-     */
-    @Deprecated
-    @Beta
-    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /**
-     * @see SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener)
-     * 
-     * @deprecated since 0.9.0; see {@link SubscriptionSupport#subscribeToMembers(Entity, Sensor, SensorEventListener)}, e.g. with {@code subscriptions().subscribeToMembers(...)}
-     */
-    @Deprecated
-    @Beta
-    <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-    /**
-     * Unsubscribes from the given producer.
-     *
-     * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-     * 
-     * @deprecated since 0.9.0; see {@link SubscriptionSupport#unsubscribe(Entity)}, e.g. with {@code subscriptions().unsubscribe(...)}
-     */
-    @Deprecated
-    @Beta
-    boolean unsubscribe(Entity producer);
-
-    /**
-     * Unsubscribes the given handle.
-     *
-     * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-     * 
-     * @deprecated since 0.9.0; see {@link SubscriptionSupport#unsubscribe(Entity, SubscriptionHandle)}, e.g. with {@code subscriptions().unsubscribe(...)}
-     */
-    @Deprecated
-    @Beta
-    boolean unsubscribe(Entity producer, SubscriptionHandle handle);
-
-    /**
-     * Removes all policy from this entity. 
-     * @return True if any policies existed at this entity; false otherwise
-     * 
-     * @deprecated since 0.9.0; see {@link PolicySupportInternal#removeAllPolicies()}, e.g. {@code ((EntityInternal)entity).policies().removeAllPolicies()}
-     */
-    @Deprecated
-    boolean removeAllPolicies();
-    
-    /**
-     * Removes all enricher from this entity.
-     * Use with caution as some entities automatically register enrichers; this will remove those enrichers as well.
-     * @return True if any enrichers existed at this entity; false otherwise
-     * 
-     * @deprecated since 0.9.0; see {@link EnricherSupportInternal#removeAllEnrichers()}, e.g. {@code ((EntityInternal)entity).enrichers().removeAllEnrichers()}
-     */
-    @Deprecated
-    boolean removeAllEnrichers();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
deleted file mode 100644
index 58cf946..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
+++ /dev/null
@@ -1,401 +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.api.entity;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.util.collections.MutableList;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-/**
- * Gives details of an entity to be created. It describes the entity's configuration, and is
- * reusable to create multiple entities with the same configuration.
- * 
- * To create an EntitySpec, it is strongly encouraged to use {@link #create(Class)} etc.
- * Users who need to implement this are strongly encouraged to extend 
- * {@link org.apache.brooklyn.api.entity.EntitySpec}.
- * 
- * @param <T> The type of entity to be created
- * 
- * @author aled
- */
-public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,EntitySpec<T>> {
-
-    private static final long serialVersionUID = -2247153452919128990L;
-    
-    /**
-     * Creates a new {@link EntitySpec} instance for an entity of the given type. The returned 
-     * {@link EntitySpec} can then be customized.
-     * 
-     * @param type An {@link Entity} interface
-     */
-    public static <T extends Entity> EntitySpec<T> create(Class<T> type) {
-        return new EntitySpec<T>(type);
-    }
-    
-    /**
-     * Creates a new {@link EntitySpec} instance for an entity of the given type. The returned 
-     * {@link EntitySpec} can then be customized.
-     * 
-     * @param type     An {@link Entity} interface
-     * @param implType An {@link Entity} implementation, which implements the {@code type} interface
-     */
-    public static <T extends Entity, U extends T> EntitySpec<T> create(Class<T> type, Class<U> implType) {
-        return new EntitySpec<T>(type).impl(implType);
-    }
-    
-    /**
-     * Creates a new {@link EntitySpec} instance with the given config, for an entity of the given type.
-     * 
-     * This is primarily for groovy code; equivalent to {@code EntitySpec.create(type).configure(config)}.
-     * 
-     * @param config The spec's configuration (see {@link EntitySpec#configure(Map)}).
-     * @param type   An {@link Entity} interface
-     */
-    public static <T extends Entity> EntitySpec<T> create(Map<?,?> config, Class<T> type) {
-        return EntitySpec.create(type).configure(config);
-    }
-    
-    /**
-     * Copies entity spec so its configuration can be overridden without modifying the 
-     * original entity spec.
-     */
-    public static <T extends Entity> EntitySpec<T> create(EntitySpec<T> spec) {
-        return create(spec.getType()).copyFrom(spec);
-    }
-    
-    public static <T extends Entity> EntitySpec<T> newInstance(Class<T> type) {
-        return new EntitySpec<T>(type);
-    }
-
-    private Class<? extends T> impl;
-    private Entity parent;
-    private final List<Policy> policies = Lists.newArrayList();
-    private final List<PolicySpec<?>> policySpecs = Lists.newArrayList();
-    private final List<Enricher> enrichers = Lists.newArrayList();
-    private final List<EnricherSpec<?>> enricherSpecs = Lists.newArrayList();
-    private final List<Location> locations = Lists.newArrayList();
-    private final Set<Class<?>> additionalInterfaces = Sets.newLinkedHashSet();
-    private final List<EntityInitializer> entityInitializers = Lists.newArrayList();
-    private final List<EntitySpec<?>> children = Lists.newArrayList();
-    private final List<Entity> members = Lists.newArrayList();
-    private final List<Group> groups = Lists.newArrayList();
-    private volatile boolean immutable;
-    
-    public EntitySpec(Class<T> type) {
-        super(type);
-    }
-
-    @Override
-    protected EntitySpec<T> copyFrom(EntitySpec<T> otherSpec) {
-        super.copyFrom(otherSpec)
-                .additionalInterfaces(otherSpec.getAdditionalInterfaces())
-                .policySpecs(otherSpec.getPolicySpecs())
-                .policies(otherSpec.getPolicies())
-                .enricherSpecs(otherSpec.getEnricherSpecs())
-                .enrichers(otherSpec.getEnrichers())
-                .addInitializers(otherSpec.getInitializers())
-                .children(copyFromSpecs(otherSpec.getChildren()))
-                .members(otherSpec.getMembers())
-                .groups(otherSpec.getGroups())
-                .locations(otherSpec.getLocations());
-        
-        if (otherSpec.getParent() != null) parent(otherSpec.getParent());
-        if (otherSpec.getImplementation() != null) impl(otherSpec.getImplementation());
-        
-        return this;
-    }
-
-    private List<EntitySpec<?>> copyFromSpecs(List<EntitySpec<?>> children) {
-        return Lists.<EntitySpec<?>,EntitySpec<?>>transform(children, new Function<EntitySpec<?>, EntitySpec<?>>() {
-            @Nullable
-            @Override
-            public EntitySpec<?> apply(@Nullable EntitySpec<?> entitySpec) {
-                return create(entitySpec);
-            }
-        });
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public Class<T> getType() {
-        return (Class<T>)super.getType();
-    }
-    
-    @Override
-    protected void checkValidType(Class<? extends T> type) {
-        // EntitySpec does nothing.  Other specs do check it's an implementation etc.
-    }
-    
-    /**
-     * @return The implementation of the entity; if not null. this overrides any defaults or other configuration
-     * 
-     * @see ImplementedBy on the entity interface classes for how defaults are defined.
-     * @see EntityTypeRegistry for how implementations can be defined globally
-     */
-    @Nullable
-    public Class<? extends T> getImplementation() {
-        return impl;
-    }
-    
-    /**
-     * @return Additional interfaces (other than just {@link #getType()}) that this entity implements; 
-     *         important for when accessing entity through a proxy to determine which interfaces the proxy exposes.
-     */
-    public Set<Class<?>> getAdditionalInterfaces() {
-        return additionalInterfaces;
-    }
-
-    /** @return {@link EntityInitializer} objects which customize the entity to be created */
-    public List<EntityInitializer> getInitializers() {
-        return entityInitializers;
-    }
-    
-    public List<EntitySpec<?>> getChildren() {
-        return children;
-    }
-    
-    public List<Entity> getMembers() {
-        return members;
-    }
-    
-    public List<Group> getGroups() {
-        return groups;
-    }
-    
-    /**
-     * @return The entity's parent
-     */
-    public Entity getParent() {
-        return parent;
-    }
-
-    public List<PolicySpec<?>> getPolicySpecs() {
-        return policySpecs;
-    }
-    
-    public List<Policy> getPolicies() {
-        return policies;
-    }
-    
-    public List<EnricherSpec<?>> getEnricherSpecs() {
-        return enricherSpecs;
-    }
-    
-    public List<Enricher> getEnrichers() {
-        return enrichers;
-    }
-    
-    public List<Location> getLocations() {
-        return locations;
-    }
-
-    public EntitySpec<T> impl(Class<? extends T> val) {
-        checkMutable();
-        checkIsImplementation(checkNotNull(val, "impl"), getType());
-        checkIsNewStyleImplementation(val);
-        impl = val;
-        return this;
-    }
-
-    public EntitySpec<T> additionalInterfaces(Class<?>... vals) {
-        checkMutable();
-        for (Class<?> val : vals) {
-            additionalInterfaces.add(val);
-        }
-        return this;
-    }
-
-    public EntitySpec<T> additionalInterfaces(Iterable<Class<?>> val) {
-        checkMutable();
-        additionalInterfaces.addAll(Sets.newLinkedHashSet(val));
-        return this;
-    }
-
-    public EntitySpec<T> addInitializer(EntityInitializer initializer) {
-        checkMutable();
-        entityInitializers.add(initializer);
-        return this;
-    }
-        
-    public EntitySpec<T> addInitializers(Iterable<? extends EntityInitializer> initializers) {
-        checkMutable();
-        Iterables.addAll(entityInitializers, initializers);
-        return this;
-    }
-
-    /** The supplied class must have a public no-arg constructor. */
-    public EntitySpec<T> addInitializer(Class<? extends EntityInitializer> initializerType) {
-        checkMutable();
-        try {
-            entityInitializers.add(initializerType.newInstance());
-        } catch (Exception e) {
-            throw Throwables.propagate(e);
-        }
-        return this;
-    }
-
-    public EntitySpec<T> children(Iterable<? extends EntitySpec<?>> children) {
-        checkMutable();
-        Iterables.addAll(this.children, children);
-        return this;
-    }
-
-    /** The supplied class must have a public no-arg constructor. */
-    public EntitySpec<T> child(EntitySpec<?> child) {
-        checkMutable();
-        children.add(child);
-        return this;
-    }
-
-    public EntitySpec<T> members(Iterable<? extends Entity> members) {
-        checkMutable();
-        Iterables.addAll(this.members, members);
-        return this;
-    }
-
-    public EntitySpec<T> member(Entity member) {
-        checkMutable();
-        members.add(member);
-        return this;
-    }
-
-    public EntitySpec<T> groups(Iterable<? extends Group> groups) {
-        checkMutable();
-        Iterables.addAll(this.groups, groups);
-        return this;
-    }
-
-    public EntitySpec<T> group(Group group) {
-        checkMutable();
-        groups.add(group);
-        return this;
-    }
-
-    public EntitySpec<T> parent(Entity val) {
-        checkMutable();
-        parent = checkNotNull(val, "parent");
-        return this;
-    }
-
-    /** adds a policy to the spec */
-    public <V> EntitySpec<T> policy(Policy val) {
-        checkMutable();
-        policies.add(checkNotNull(val, "policy"));
-        return this;
-    }
-
-    /** adds a policy to the spec */
-    public <V> EntitySpec<T> policy(PolicySpec<?> val) {
-        checkMutable();
-        policySpecs.add(checkNotNull(val, "policySpec"));
-        return this;
-    }
-
-    /** adds the supplied policies to the spec */
-    public <V> EntitySpec<T> policySpecs(Iterable<? extends PolicySpec<?>> val) {
-        checkMutable();
-        policySpecs.addAll(MutableList.copyOf(checkNotNull(val, "policySpecs")));
-        return this;
-    }
-    
-    /** adds the supplied policies to the spec */
-    public <V> EntitySpec<T> policies(Iterable<? extends Policy> val) {
-        checkMutable();
-        policies.addAll(MutableList.copyOf(checkNotNull(val, "policies")));
-        return this;
-    }
-    
-    /** adds a policy to the spec */
-    public <V> EntitySpec<T> enricher(Enricher val) {
-        checkMutable();
-        enrichers.add(checkNotNull(val, "enricher"));
-        return this;
-    }
-
-    /** adds a policy to the spec */
-    public <V> EntitySpec<T> enricher(EnricherSpec<?> val) {
-        checkMutable();
-        enricherSpecs.add(checkNotNull(val, "enricherSpec"));
-        return this;
-    }
-
-    /** adds the supplied policies to the spec */
-    public <V> EntitySpec<T> enricherSpecs(Iterable<? extends EnricherSpec<?>> val) {
-        checkMutable();
-        enricherSpecs.addAll(MutableList.copyOf(checkNotNull(val, "enricherSpecs")));
-        return this;
-    }
-    
-    /** adds the supplied policies to the spec */
-    public <V> EntitySpec<T> enrichers(Iterable<? extends Enricher> val) {
-        checkMutable();
-        enrichers.addAll(MutableList.copyOf(checkNotNull(val, "enrichers")));
-        return this;
-    }
-    
-    /** adds a location to the spec */
-    public <V> EntitySpec<T> location(Location val) {
-        checkMutable();
-        locations.add(checkNotNull(val, "location"));
-        return this;
-    }
-    
-    /** clears locations defined in the spec */
-    public <V> EntitySpec<T> clearLocations() {
-        checkMutable();
-        locations.clear();
-        return this;        
-    }
-    
-    /** adds the supplied locations to the spec */
-    public <V> EntitySpec<T> locations(Iterable<? extends Location> val) {
-        checkMutable();
-        locations.addAll(MutableList.copyOf(checkNotNull(val, "locations")));
-        return this;
-    }
-
-    /** "seals" this spec, preventing any future changes */
-    public EntitySpec<T> immutable() {
-        immutable = true;
-        return this;
-    }
-
-    private void checkMutable() {
-        if (immutable) throw new IllegalStateException("Cannot modify immutable entity spec "+this);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
deleted file mode 100644
index 1c3f7b5..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
+++ /dev/null
@@ -1,73 +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.api.entity;
-
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.objs.BrooklynType;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.util.guava.Maybe;
-
-/**
- * Gives type information for an {@link Entity}. It is an immutable snapshot.
- * 
- * It reflects a given entity at the time the snapshot was created: if sensors
- * were added or removed on-the-fly then those changes will be included in subsequent
- * snapshots. Therefore instances of a given class of entity could have different 
- * EntityTypes.
- */
-public interface EntityType extends BrooklynType {
-
-    /**
-     * Sensors available on this entity.
-     */
-    Set<Sensor<?>> getSensors();
-    
-    /**
-     * Effectors available on this entity.
-     */
-    Set<Effector<?>> getEffectors();
-
-    /** @return an effector with the given name, if it exists.
-     */
-    public Maybe<Effector<?>> getEffectorByName(String name);
-        
-    /**
-     * @return the matching effector on this entity
-     * @throws NoSuchElementException If there is no exact match for this signature
-     * <p>
-     * @deprecated since 0.7.0 use {@link #getEffectorByName(String)};
-     * use of multiple effectors with the same name is not supported by the EntityDynamicType implementation,
-     * so should be discouraged.  overloading can be achieved by inspecting the parameters map. 
-     */
-    @Deprecated
-    Effector<?> getEffector(String name, Class<?>... parameterTypes);
-
-    /**
-     * The Sensor with the given name, or null if not found.
-     */
-    Sensor<?> getSensor(String name);
-    
-    /**
-     * @return True if has the sensor with the given name; false otherwise.
-     */
-    boolean hasSensor(String name);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java
deleted file mode 100644
index 4747e5b..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java
+++ /dev/null
@@ -1,63 +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.api.entity;
-
-import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.location.Location;
-
-/**
- * A registry of the entity implementations to be used when creating an entity of a given type.
- * 
- * A given implementation can only be associated with one entity type interface.
- */
-public interface EntityTypeRegistry {
-
-    /**
-     * Returns the implementation to be used for the given entity type.
-     *
-     * @param entity the {@link DriverDependentEntity} to create the {@link EntityDriver} for.
-     * @param location the {@link Location} where the {@link DriverDependentEntity} is running.
-     * @param <D>
-     * @return the creates EntityDriver.
-     * @throws IllegalArgumentException If no implementation registered, and the given interface is not annotated with {@link ImplementedBy}
-     * @throws IllegalStateException If the given type is not an interface, or if the implementation class is not a concrete class implementing it
-     */
-    <T extends Entity> Class<? extends T> getImplementedBy(Class<T> type);
-
-    /**
-     * Returns the interface of this entity implementation.
-     * E.g. for use as the fully qualified name in {@code entity.getEntityType().getName()}.
-     * 
-     * @throws IllegalArgumentException If no interface is registered against this implementation, 
-     *         and no super-type of the class is annotated with {@link ImplementedBy} to point at the given class
-     */
-    <T extends Entity> Class<? super T> getEntityTypeOf(Class<T> type);
-
-    /**
-     * Registers the implementation to use for a given entity type.
-     * 
-     * The implementation must be a non-abstract class implementing the given type, and must 
-     * have a no-argument constructor.
-     * 
-     * @throws IllegalArgumentException If this implementation has already been registered for a different type
-     * @throws IllegalStateException If the implClazz is not a concrete class, or does not implement type
-     */
-    <T extends Entity> EntityTypeRegistry registerImplementation(Class<T> type, Class<? extends T> implClazz);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Group.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Group.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Group.java
deleted file mode 100644
index 05f80e1..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/Group.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.api.entity;
-
-import java.util.Collection;
-
-/**
- * An {@link Entity} that groups together other entities.
- * 
- * The grouping can be for any purpose, such as allowing easy management/monitoring of
- * a group of entities. The grouping could be static (i.e. a fixed set of entities)
- * or dynamic (i.e. contains all entities that match some filter).
- */
-public interface Group extends Entity {
-    
-    /**
-     * Return the entities that are members of this group.
-     */
-    Collection<Entity> getMembers();
-
-    /**
-     * @return True if it is a member of this group.
-     */
-    boolean hasMember(Entity member);
-
-    /**
-     * Adds the given member, returning true if this modifies the set of members (i.e. it was not already a member).
-     */
-    boolean addMember(Entity member);
- 
-    /**
-     * Removes the given member, returning true if this modifies the set of members (i.e. it was a member).
-     */
-    boolean removeMember(Entity member);
-    
-    /**
-     * @return The number of members in this group.
-     */
-    Integer getCurrentSize();
-    
-    /** As {@link #addChild(EntitySpec)} followed by {@link #addMember(Entity)} */
-    <T extends Entity> T addMemberChild(EntitySpec<T> spec);
-    
-    /** As {@link #addChild(Entity)} followed by {@link #addMember(Entity)} */
-    <T extends Entity> T addMemberChild(T child);
-    
-    /** As in super, but note this does NOT by default add it as a member; see {@link #addMemberChild(EntitySpec)} */
-    @Override
-    <T extends Entity> T addChild(EntitySpec<T> spec);
-    
-    /** As in super, but note this does NOT by default add it as a member; see {@link #addMemberChild(Entity)} */
-    @Override
-    <T extends Entity> T addChild(T child);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java
deleted file mode 100644
index f0ee6a1..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.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.api.entity;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * A pointer to the default implementation of an entity.
- * 
- * A common naming convention is for the implementation class to have the suffix "Impl",
- * but this is not required.
- * 
- * See {@link EntityTypeRegistry} for how to override the implementation to be used, if
- * the class referenced by this annotation is not desired.
- * 
- * @author aled
- */
-@Retention(RUNTIME)
-@Target(TYPE)
-public @interface ImplementedBy {
-
-  /**
-   * The implementation type.
-   */
-  Class<? extends Entity> value();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java
deleted file mode 100644
index b59e9cc..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.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.api.entity.drivers;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * An Entity that needs to have a driver.
- *
- * @param <D>
- */
-public interface DriverDependentEntity<D extends EntityDriver> extends Entity {
-
-    Class<D> getDriverInterface();
-    
-    @Nullable D getDriver();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
deleted file mode 100644
index e2bb0bd..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.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 org.apache.brooklyn.api.entity.drivers;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.location.Location;
-
-import com.google.common.annotations.Beta;
-
-/**
- * The EntityDriver provides an abstraction between the Entity and the environment (the {@link Location} it is running
- * in, so that an entity is not tightly coupled to a specific Location. E.g. you could have a TomcatEntity that uses
- * a TomcatDriver (an interface) and you could have different driver implementations like the
- * TomcatSshDriver/TomcatWindowsDriver and if in the future support for Puppet needs to be added, a TomcatPuppetDriver
- * could be added.
- *
- * @author Peter Veentjer.
- * @see DriverDependentEntity
- * @see EntityDriverManager
- */
-public interface EntityDriver {
-
-    /**
-     * The entity instance that this is a driver for.
-     * 
-     * FIXME The signature of this will change to return Entity instead of EntityLocal.
-     * This is a temporary workaround for groovy not supporting covariant return types,
-     * see http://jira.codehaus.org/browse/GROOVY-5418. It is fixed in groovy 2.0.4 so
-     * we will need to upgrade from 1.8.6 first.
-     */
-    @Beta
-    EntityLocal getEntity();
-
-    /**
-     * The location the entity is running in.
-     */
-    Location getLocation();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
deleted file mode 100644
index b2ad37e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.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 org.apache.brooklyn.api.entity.drivers;
-
-import org.apache.brooklyn.api.location.Location;
-
-/**
- * Responsible for creating a driver for a given entity/location. Also used for customizing which 
- * type of driver should be used by entities in given locations.
- * 
- * The idea is that an entity should not be tightly coupled to a specific driver implementation, 
- * so that there is flexibility for driver changes, without changing the entity itself. The 
- * advantage is that drivers can easily be reconfigured, replaced or new drivers for different 
- * environments can be added, without needing to modify Brooklyn.
- * 
- * To obtain an instance of a driver, use {@link #build(DriverDependentEntity, Location)}.
- * This will use the registered driver types, or if one is not registered will fallback to the 
- * default strategy.
- */
-public interface EntityDriverManager {
-
-    /**
-     * Builds a new {@link EntityDriver} for the given entity/location.
-     *
-     * @param entity the {@link DriverDependentEntity} to create the {@link EntityDriver} for.
-     * @param location the {@link Location} where the {@link DriverDependentEntity} is running.
-     * @param <D>
-     * @return the creates EntityDriver.
-     */
-    <D extends EntityDriver> D build(DriverDependentEntity<D> entity, Location location);
-    
-    <D extends EntityDriver> void registerDriver(Class<D> driverInterface, Class<? extends Location> locationClazz, Class<? extends D> driverClazz);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
deleted file mode 100644
index 56befa4..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
+++ /dev/null
@@ -1,58 +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.api.entity.drivers.downloads;
-
-import java.util.List;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Gives download details for an entity or an entity add-on.
- * Returned by the {@link DownloadResolverManager}, when queried for a specific entity or entity add-on. 
- * 
- * @author aled
- */
-public interface DownloadResolver {
-    /**
-     * The targets (normally URLs) for downloading the artifact. These should be tried in-order
-     * until one works.
-     */
-    public List<String> getTargets();
-
-    /**
-     * The name of the artifact.
-     * The caller is free to use this name, or not. But using this name gives consistency particularly
-     * between brooklyn local-repos and brooklyn install directories.
-     */
-    public String getFilename();
-    
-    /**
-     * The name of the directory in the expanded artifact (e.g. if it's a tar.gz file then the name of
-     * the directory within it). If no value is known, the defaultVal will be returned.
-     * 
-     * This can return null if the artifact is not an archive (and if defaultVal is null).
-     * 
-     * TODO The driver needs to know what will happen when an install archive is unpacked (e.g. an 
-     * AS7 install tgz may be automatically expanded into a directory named "jboss-as-7.1.1-FINAL").
-     * However, it's unclear where the best place to encode that is. The driver supplying the default
-     * seems sensible.
-     */
-    @Beta
-    public String getUnpackedDirectoryName(String defaultVal);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
deleted file mode 100644
index 3597041..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
+++ /dev/null
@@ -1,158 +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.api.entity.drivers.downloads;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-
-import com.google.common.base.Function;
-
-/**
- * Used by an {@link EntityDriver} to obtain the download locations when installing an entity.
- * 
- * Most commonly, the {@link DownloadResolver}'s targets are URIs. However, an EntityDriver 
- * implementation is free to interpret the String however is appropriate (e.g. the name of a 
- * custom package to install from the enterprise's package manager repository).
-
- * Also supports registering other "resolvers" for determining where to download the installers 
- * from, for different entities.
- * 
- * When using {@link resolve(EntityDriver)} to get the list of things to try (in-order until one succeeds),
- * the manager will go through each of the registered resolvers in-order to get their contributions.
- * These contributions are split into "primary" and "fallback". All of the primaries will be added to the
- * list first, and then all of the fallbacks.
- * 
- * @author aled
- */
-public interface DownloadResolverManager {
-
-    /**
-     * For installing the main entity.
-     * Returns a list of options, to be tried in order until one of them works.
-     */
-    public DownloadResolver newDownloader(EntityDriver driver);
-
-    /**
-     * For installing the main entity.
-     * Returns a list of options, to be tried in order until one of them works.
-     */
-    public DownloadResolver newDownloader(EntityDriver driver, Map<String,?> properties);
-
-    /**
-     * For installing an entity add-on.
-     * Returns a list of options, to be tried in order until one of them works.
-     * This is used for resolving the download for an "add-on" - e.g. an additional module required 
-     * during an entity's installation. Common properties include:
-     * <ul>
-     *   <li>addonversion: the required version of the add-on
-     * </ul>
-     */
-    public DownloadResolver newDownloader(EntityDriver driver, String addonName, Map<String,?> addonProperties);
-    
-    /**
-     * Registers a producer, to be tried before all other producers.
-     * 
-     * A "producer" will generate the download targets to be tried, when installing a given entity
-     * or entity add-on.
-     * 
-     * The function should not return null (instead see {@code BasicDownloadTargets.empty()}).
-     * 
-     * @see registerResolver(Function)
-     */
-    public void registerPrimaryProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> resolver);
-
-    /**
-     * Registers a producer, to be tried after all other registered producers have been tried.
-     * The function should not return null (instead see {@code BasicDownloadTargets.empty()}).
-     */
-    public void registerProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> resolver);
-
-    /**
-     * Registers a producer for generating the expected filename of the download artifact.
-     * 
-     * If all such registered producers return null, then default behaviour is to infer the download
-     * name from the first target in the {@link resolve(EntityDriver)} result. 
-     */
-    public void registerFilenameProducer(Function<? super DownloadRequirement, String> producer);
-
-    /**
-     * Gives artifact meta-data for what is required to be downloaded.
-     * 
-     * @author aled
-     */
-    public interface DownloadRequirement {
-        /**
-         * The {@link EntityDriver} that this download is for.
-         */
-        public EntityDriver getEntityDriver();
-
-        /**
-         * The name of the add-on to be downloaded, or null if it is the main installed.
-         * For example, can be used to specify nginx sticky-module or pcre download.
-         */
-        public String getAddonName();
-        
-        /**
-         * Default properties for this download. These will be made available when resolving the
-         * download template.
-         * 
-         * For the main entity download, properties include:
-         * <ul>
-         *   <li>fileSuffix: expected file suffix 
-         * </ul>
-         * 
-         * For an add-on, common properties include:
-         * <ul>
-         *   <li>version: version of the add-on to be used
-         *   <li>fileSuffix: expected file suffix 
-         * </ul>
-         */
-        public Map<String, ?> getProperties();
-    }
-    
-    
-    /**
-     * Describes the download locations, and their order, to try.
-     * 
-     * @author aled
-     */
-    public interface DownloadTargets {
-        /**
-         * Gets the locations to try (in-order).
-         */
-        public List<String> getPrimaryLocations();
-
-        /**
-         * Gets the locations to try (in-order), to be used only after all primary locations 
-         * have been tried.
-         */
-        public List<String> getFallbackLocations();
-
-        /**
-         * Indicates whether or not the results of this resolver are the last that should be used.
-         * If returns false, {@link resolve(EntityDriver)} will not iterate over any other resolvers.
-         * 
-         * For example, useful in an enterprise to disable any other resolvers that would have 
-         * resulted in going out to the public internet.
-         */
-        public boolean canContinueResolving();
-    }
-}


[10/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPredicates.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPredicates.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPredicates.java
deleted file mode 100644
index 35cf54f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPredicates.java
+++ /dev/null
@@ -1,270 +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.core.location;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.guava.SerializablePredicate;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-@SuppressWarnings("serial")
-public class LocationPredicates {
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> idEqualToOld(final T val) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Objects.equal(input.getId(), val);
-            }
-        };
-    }
-    
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> displayNameEqualToOld(final T val) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Objects.equal(input.getDisplayName(), val);
-            }
-        };
-    }
-    
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> configEqualToOld(final ConfigKey<T> configKey, final T val) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Objects.equal(input.getConfig(configKey), val);
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> configEqualToOld(final HasConfigKey<T> configKey, final T val) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Objects.equal(input.getConfig(configKey), val);
-            }
-        };
-    }
-
-    /**
-     * Returns a predicate that determines if a given location is a direct child of this {@code parent}.
-     */
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> isChildOfOld(final Location parent) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Objects.equal(input.getParent(), parent);
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> isDescendantOfOld(final Location ancestor) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                // assumes impossible to have cycles in location-hierarchy
-                Location contenderAncestor = (input == null) ? input : input.getParent();
-                while (contenderAncestor != null) {
-                    if (Objects.equal(contenderAncestor, ancestor)) {
-                        return true;
-                    }
-                    contenderAncestor = contenderAncestor.getParent();
-                }
-                return false;
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Location> managedOld() {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<Location>() {
-            @Override
-            public boolean apply(@Nullable Location input) {
-                return (input != null) && Locations.isManaged(input);
-            }
-        };
-    }
-    
-    public static Predicate<Location> idEqualTo(final String val) {
-        return idSatisfies(Predicates.equalTo(val));
-    }
-    
-    public static Predicate<Location> idSatisfies(final Predicate<? super String> condition) {
-        return new IdSatisfies(condition);
-    }
-    
-    protected static class IdSatisfies implements SerializablePredicate<Location> {
-        protected final Predicate<? super String> condition;
-        protected IdSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Location input) {
-            return (input != null) && condition.apply(input.getId());
-        }
-        @Override
-        public String toString() {
-            return "idSatisfies("+condition+")";
-        }
-    }
-
-    public static Predicate<Location> displayNameEqualTo(final String val) {
-        return displayNameSatisfies(Predicates.equalTo(val));
-    }
-    
-    public static Predicate<Location> displayNameSatisfies(final Predicate<? super String> condition) {
-        return new DisplayNameSatisfies(condition);
-    }
-    
-    protected static class DisplayNameSatisfies implements SerializablePredicate<Location> {
-        protected final Predicate<? super String> condition;
-        protected DisplayNameSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Location input) {
-            return (input != null) && condition.apply(input.getDisplayName());
-        }
-        @Override
-        public String toString() {
-            return "displayNameSatisfies("+condition+")";
-        }
-    }
-
-    public static <T> Predicate<Location> configEqualTo(final ConfigKey<T> configKey, final T val) {
-        return configSatisfies(configKey, Predicates.equalTo(val));
-    }
-
-    public static <T> Predicate<Location> configSatisfies(final ConfigKey<T> configKey, final Predicate<T> condition) {
-        return new ConfigKeySatisfies<T>(configKey, condition);
-    }
-
-    public static <T> Predicate<Location> configEqualTo(final HasConfigKey<T> configKey, final T val) {
-        return configEqualTo(configKey.getConfigKey(), val);
-    }
-
-    public static <T> Predicate<Location> configSatisfies(final HasConfigKey<T> configKey, final Predicate<T> condition) {
-        return new ConfigKeySatisfies<T>(configKey.getConfigKey(), condition);
-    }
-
-    protected static class ConfigKeySatisfies<T> implements SerializablePredicate<Location> {
-        protected final ConfigKey<T> configKey;
-        protected final Predicate<T> condition;
-        private ConfigKeySatisfies(ConfigKey<T> configKey, Predicate<T> condition) {
-            this.configKey = configKey;
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Location input) {
-            return (input != null) && condition.apply(input.getConfig(configKey));
-        }
-        @Override
-        public String toString() {
-            return "configKeySatisfies("+configKey.getName()+","+condition+")";
-        }
-    }
-    
-    /**
-     * Returns a predicate that determines if a given location is a direct child of this {@code parent}.
-     */
-    public static Predicate<Location> isChildOf(final Location parent) {
-        return new IsChildOf(parent);
-    }
-
-    // if needed, could add parentSatisfies(...)
-    
-    protected static class IsChildOf implements SerializablePredicate<Location> {
-        protected final Location parent;
-        protected IsChildOf(Location parent) {
-            this.parent = parent;
-        }
-        @Override
-        public boolean apply(@Nullable Location input) {
-            return (input != null) && Objects.equal(input.getParent(), parent);
-        }
-        @Override
-        public String toString() {
-            return "isChildOf("+parent+")";
-        }
-    }
-
-    /**
-     * Returns a predicate that determines if a given location is a descendant of this {@code ancestor}.
-     */
-    public static <T> Predicate<Location> isDescendantOf(final Location ancestor) {
-        return new IsDescendantOf(ancestor);
-    }
-
-    protected static class IsDescendantOf implements SerializablePredicate<Location> {
-        protected final Location ancestor;
-        protected IsDescendantOf(Location ancestor) {
-            this.ancestor = ancestor;
-        }
-        @Override
-        public boolean apply(@Nullable Location input) {
-            // assumes impossible to have cycles in location-hierarchy
-            Location contenderAncestor = (input == null) ? input : input.getParent();
-            while (contenderAncestor != null) {
-                if (Objects.equal(contenderAncestor, ancestor)) {
-                    return true;
-                }
-                contenderAncestor = contenderAncestor.getParent();
-            }
-            return false;
-        }
-    }
-    
-    public static <T> Predicate<Location> managed() {
-        return IsManaged.INSTANCE;
-    }
-    
-    protected static class IsManaged implements Predicate<Location> {
-        protected static final IsManaged INSTANCE = new IsManaged();
-        @Override
-        public boolean apply(@Nullable Location input) {
-            return (input != null) && Locations.isManaged(input);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPropertiesFromBrooklynProperties.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPropertiesFromBrooklynProperties.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPropertiesFromBrooklynProperties.java
deleted file mode 100644
index c6ada78..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationPropertiesFromBrooklynProperties.java
+++ /dev/null
@@ -1,223 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.io.File;
-import java.util.Map;
-
-import org.apache.brooklyn.core.config.ConfigUtils;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.internal.ssh.SshTool;
-import org.apache.brooklyn.util.os.Os;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicates;
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
-
-/**
- * The properties to use for locations, loaded from brooklyn.properties file.
- * 
- * @author aledsage
- **/
-public class LocationPropertiesFromBrooklynProperties {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LocationPropertiesFromBrooklynProperties.class);
-
-    @SuppressWarnings("deprecation")
-    protected static final Map<String, String> DEPRECATED_KEYS_MAPPING = new DeprecatedKeysMappingBuilder(LOG)
-            .camelToHyphen(LocationConfigKeys.DISPLAY_NAME)
-            .camelToHyphen(LocationConfigKeys.PRIVATE_KEY_FILE)
-            .camelToHyphen(LocationConfigKeys.PRIVATE_KEY_DATA)
-            .camelToHyphen(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE)
-            .camelToHyphen(LocationConfigKeys.PUBLIC_KEY_FILE)
-            .camelToHyphen(LocationConfigKeys.PUBLIC_KEY_DATA)
-            .camelToHyphen(LocationConfigKeys.CALLER_CONTEXT)
-            .build();
-    
-    /**
-     * Finds the properties that apply to location, stripping off the prefixes.
-     * 
-     * Order of preference (in ascending order) is:
-     * <ol>
-     * <li>brooklyn.location.*
-     * <li>brooklyn.location.provider.*
-     * <li>brooklyn.location.named.namedlocation.*
-     * </ol>
-     * <p>
-     * Converts deprecated hyphenated properties to the non-deprecated camelCase format. 
-     */
-    public Map<String, Object> getLocationProperties(String provider, String namedLocation, Map<String, ?> properties) {
-        ConfigBag result = ConfigBag.newInstance();
-        
-        if (!Strings.isNullOrEmpty(provider)) 
-            result.put(LocationConfigKeys.CLOUD_PROVIDER, provider);
-        // named properties are preferred over providerOrApi properties
-        result.putAll(transformDeprecated(getGenericLocationSingleWordProperties(properties)));
-        if (!Strings.isNullOrEmpty(provider)) result.putAll(transformDeprecated(getScopedLocationProperties(provider, properties)));
-        if (!Strings.isNullOrEmpty(namedLocation)) result.putAll(transformDeprecated(getNamedLocationProperties(namedLocation, properties)));
-        
-        setLocalTempDir(properties, result);
-        
-        return result.getAllConfigRaw();
-    }
-
-    /** allow the temp dir where ssh temporary files on the brooklyn server side are placed */
-    public static void setLocalTempDir(Map<String,?> source, ConfigBag target) {
-        // TODO better would be to use BrooklynServerConfig, requiring management passed in
-        String brooklynDataDir = (String) source.get(BrooklynServerConfig.getMgmtBaseDir(source));
-        if (brooklynDataDir != null && brooklynDataDir.length() > 0) {
-            String tempDir = Os.mergePaths(brooklynDataDir, "tmp", "ssh");
-            target.putIfAbsentAndNotNull(SshTool.PROP_LOCAL_TEMP_DIR, tempDir);
-            Os.deleteOnExitEmptyParentsUpTo(new File(tempDir), new File(brooklynDataDir));
-        }
-    }
-    
-    /**
-     * Gets the named provider (e.g. if using a property like {@code brooklyn.location.named.myfavourite=localhost}, then
-     * {@code getNamedProvider("myfavourite", properties)} will return {@code "localhost"}).
-     */
-    protected String getNamedProvider(String namedLocation, Map<String, ?> properties) {
-        String key = String.format("brooklyn.location.named.%s", namedLocation);
-        return (String) properties.get(key);
-    }
-    
-    /**
-     * Returns those properties in the form "brooklyn.location.xyz", where "xyz" is any
-     * key that does not contain dots. We do this special (sub-optimal!) filtering
-     * because we want to exclude brooklyn.location.named.*, brooklyn.location.jclouds.*, etc.
-     * We only want those properties that are to be generic for all locations.
-     * 
-     * Strips off the prefix in the returned map.
-     */
-    protected Map<String, Object> getGenericLocationSingleWordProperties(Map<String, ?> properties) {
-        return getMatchingSingleWordProperties("brooklyn.location.", properties);
-    }
-
-    /**
-     * Gets all properties that start with {@code "brooklyn.location."+scopeSuffix+"."}, stripping off
-     * the prefix in the returned map.
-     */
-    protected Map<String, Object> getScopedLocationProperties(String scopeSuffix, Map<String, ?> properties) {
-        checkArgument(!scopeSuffix.startsWith("."), "scopeSuffix \"%s\" should not start with \".\"", scopeSuffix);
-        checkArgument(!scopeSuffix.endsWith("."), "scopeSuffix \"%s\" should not end with \".\"", scopeSuffix);
-        String prefix = String.format("brooklyn.location.%s.", scopeSuffix);
-        return ConfigUtils.filterForPrefixAndStrip(properties, prefix).asMapWithStringKeys();
-    }
-
-    /**
-     * Gets all properties that start with the given {@code fullPrefix}, stripping off
-     * the prefix in the returned map.
-     */
-    protected Map<String, Object> getMatchingProperties(String fullPrefix, Map<String, ?> properties) {
-        return ConfigUtils.filterForPrefixAndStrip(properties, fullPrefix).asMapWithStringKeys();
-    }
-
-    /**
-     * Gets all properties that start with either of the given prefixes. The {@code fullPreferredPrefix} 
-     * properties will override any duplicates in {@code fullDeprecatedPrefix}. If there are any
-     * properties that match the {@code fullDeprecatedPrefix}, then a warning will be logged.
-     * 
-     * @see #getMatchingProperties(String, Map)
-     */
-    protected Map<String, Object> getMatchingProperties(String fullPreferredPrefix, String fullDeprecatedPrefix, Map<String, ?> properties) {
-        Map<String, Object> deprecatedResults = getMatchingProperties(fullDeprecatedPrefix, properties);
-        Map<String, Object> results = getMatchingProperties(fullPreferredPrefix, properties);
-        
-        if (deprecatedResults.size() > 0) {
-            LOG.warn("Deprecated use of properties prefix "+fullDeprecatedPrefix+"; instead use "+fullPreferredPrefix);
-            return MutableMap.<String, Object>builder()
-                    .putAll(deprecatedResults)
-                    .putAll(results)
-                    .build();
-        } else {
-            return results;
-        }
-    }
-
-    /**
-     * Gets all properties that start with the given {@code fullPrefix}, stripping off
-     * the prefix in the returned map.
-     * 
-     * Returns only those properties whose key suffix is a single word (i.e. contains no dots).
-     * We do this special (sub-optimal!) filtering because we want sub-scoped things 
-     * (e.g. could want brooklyn.location.privateKeyFile, but not brooklyn.location.named.*). 
-     */
-    protected Map<String, Object> getMatchingSingleWordProperties(String fullPrefix, Map<String, ?> properties) {
-        BrooklynProperties filteredProperties = ConfigUtils.filterForPrefixAndStrip(properties, fullPrefix);
-        return ConfigUtils.filterFor(filteredProperties, Predicates.not(Predicates.containsPattern("\\."))).asMapWithStringKeys();
-    }
-
-    /**
-     * Gets all single-word properties that start with either of the given prefixes. The {@code fullPreferredPrefix} 
-     * properties will override any duplicates in {@code fullDeprecatedPrefix}. If there are any
-     * properties that match the {@code fullDeprecatedPrefix}, then a warning will be logged.
-     * 
-     * @see #getMatchingSingleWordProperties(String, Map)
-     */
-    protected Map<String, Object> getMatchingSingleWordProperties(String fullPreferredPrefix, String fullDeprecatedPrefix, Map<String, ?> properties) {
-        Map<String, Object> deprecatedResults = getMatchingSingleWordProperties(fullDeprecatedPrefix, properties);
-        Map<String, Object> results = getMatchingSingleWordProperties(fullPreferredPrefix, properties);
-        
-        if (deprecatedResults.size() > 0) {
-            LOG.warn("Deprecated use of properties prefix "+fullDeprecatedPrefix+"; instead use "+fullPreferredPrefix);
-            return MutableMap.<String, Object>builder()
-                    .putAll(deprecatedResults)
-                    .putAll(results)
-                    .build();
-        } else {
-            return results;
-        }
-    }
-
-    protected Map<String, Object> getNamedLocationProperties(String locationName, Map<String, ?> properties) {
-        checkArgument(!Strings.isNullOrEmpty(locationName), "locationName should not be blank");
-        String prefix = String.format("brooklyn.location.named.%s.", locationName);
-        return ConfigUtils.filterForPrefixAndStrip(properties, prefix).asMapWithStringKeys();
-    }
-
-    protected Map<String, Object> transformDeprecated(Map<String, ?> properties) {
-        Map<String,Object> result = Maps.newLinkedHashMap();
-        Map<String, String> deprecatedKeysMapping = getDeprecatedKeysMapping();
-        
-        for (Map.Entry<String,?> entry : properties.entrySet()) {
-            String key = entry.getKey();
-            Object value = entry.getValue();
-            if (deprecatedKeysMapping.containsKey(key)) {
-                String transformedKey = deprecatedKeysMapping.get(key);
-                LOG.warn("Deprecated key {}, transformed to {}; will not be supported in future versions", new Object[] {key, transformedKey});
-                result.put(transformedKey, value);
-            } else {
-                result.put(key, value);
-            }
-        }
-        
-        return result;
-    }
-    
-    protected Map<String,String> getDeprecatedKeysMapping() {
-        return DEPRECATED_KEYS_MAPPING;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Locations.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Locations.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Locations.java
deleted file mode 100644
index 0b8a060..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Locations.java
+++ /dev/null
@@ -1,160 +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.core.location;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.api.mgmt.LocationManager;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-
-public class Locations {
-
-    private static final Logger log = LoggerFactory.getLogger(Locations.class);
-
-    public static final LocationsFilter USE_FIRST_LOCATION = new LocationsFilter() {
-        private static final long serialVersionUID = 3100091615409115890L;
-
-        @Override
-        public List<Location> filterForContext(List<Location> locations, Object context) {
-            if (locations.size()<=1) return locations;
-            return ImmutableList.of(locations.get(0));
-        }
-    };
-
-    public interface LocationsFilter extends Serializable {
-        public List<Location> filterForContext(List<Location> locations, Object context);
-    }
-    
-    /** as {@link Machines#findUniqueMachineLocation(Iterable)} */
-    public static Maybe<MachineLocation> findUniqueMachineLocation(Iterable<? extends Location> locations) {
-        return Machines.findUniqueMachineLocation(locations);
-    }
-    
-    /** as {@link Machines#findUniqueSshMachineLocation(Iterable)} */
-    public static Maybe<SshMachineLocation> findUniqueSshMachineLocation(Iterable<? extends Location> locations) {
-        return Machines.findUniqueMachineLocation(locations, SshMachineLocation.class);
-    }
-
-    /** if no locations are supplied, returns locations on the entity, or in the ancestors, until it finds a non-empty set,
-     * or ultimately the empty set if no locations are anywhere */ 
-    public static Collection<? extends Location> getLocationsCheckingAncestors(Collection<? extends Location> locations, Entity entity) {
-        // look in ancestors if location not set here
-        Entity ancestor = entity;
-        while ((locations==null || locations.isEmpty()) && ancestor!=null) {
-            locations = ancestor.getLocations();
-            ancestor = ancestor.getParent();
-        }
-        return locations;
-    }
-    
-    public static boolean isManaged(Location loc) {
-        ManagementContext mgmt = ((LocationInternal)loc).getManagementContext();
-        return (mgmt != null) && mgmt.isRunning() && mgmt.getLocationManager().isManaged(loc);
-    }
-
-    public static void unmanage(Location loc) {
-        if (isManaged(loc)) {
-            ManagementContext mgmt = ((LocationInternal)loc).getManagementContext();
-            mgmt.getLocationManager().unmanage(loc);
-        }
-    }
-    
-    /**
-     * Registers the given location (and all its children) with the management context. 
-     * @throws IllegalStateException if the parent location is not already managed
-     * 
-     * @since 0.6.0 (added only for backwards compatibility, where locations are being created directly; previously in {@link Entities}).
-     * @deprecated in 0.6.0; use {@link LocationManager#createLocation(LocationSpec)} instead.
-     */
-    public static void manage(Location loc, ManagementContext managementContext) {
-        if (!managementContext.getLocationManager().isManaged(loc)) {
-            log.warn("Deprecated use of unmanaged location ("+loc+"); will be managed automatically now but not supported in future versions");
-            // FIXME this occurs MOST OF THE TIME e.g. including BrooklynLauncher.location(locationString)
-            // not sure what is the recommend way to convert from locationString to locationSpec, or the API we want to expose;
-            // deprecating some of the LocationRegistry methods seems sensible?
-            log.debug("Stack trace for location of: Deprecated use of unmanaged location; will be managed automatically now but not supported in future versions", new Exception("TRACE for: Deprecated use of unmanaged location"));
-            managementContext.getLocationManager().manage(loc);
-        }
-    }
-
-    public static Location coerce(ManagementContext mgmt, Object rawO) {
-        if (rawO==null)
-            return null;
-        if (rawO instanceof Location)
-            return (Location)rawO;
-        
-        Object raw = rawO;
-        if (raw instanceof String)
-            raw = Yamls.parseAll((String)raw).iterator().next();
-        
-        String name;
-        Map<?, ?> flags = null;
-        if (raw instanceof Map) {
-            // for yaml, take the key, and merge with locationFlags
-            Map<?,?> tm = ((Map<?,?>)raw);
-            if (tm.size()!=1) {
-                throw new IllegalArgumentException("Location "+rawO+" is invalid; maps must have only one key, being the location spec string");
-            }
-            name = (String) tm.keySet().iterator().next();
-            flags = (Map<?, ?>) tm.values().iterator().next();
-            
-        } else if (raw instanceof String) {
-            name = (String)raw;
-            
-        } else {
-            throw new IllegalArgumentException("Location "+rawO+" is invalid; can only parse strings or maps");
-        }
-        return mgmt.getLocationRegistry().resolve(name, flags);
-    }
-    
-    public static Collection<? extends Location> coerceToCollection(ManagementContext mgmt, Object rawO) {
-        if (rawO==null) return null;
-        Object raw = rawO;
-        if (raw instanceof Collection) {
-            List<Location> result = MutableList.<Location>of();
-            for (Object o: (Collection<?>)raw)
-                result.add(coerce(mgmt, o));
-            return result;
-        }
-        if (raw instanceof String) {
-            raw = Yamls.parseAll((String)raw).iterator().next();
-            if (raw instanceof Collection)
-                return coerceToCollection(mgmt, raw);
-        }
-        return Collections.singletonList( coerce(mgmt, raw) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Machines.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Machines.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Machines.java
deleted file mode 100644
index c4eb84c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/Machines.java
+++ /dev/null
@@ -1,194 +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.core.location;
-
-import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation.LocalhostMachine;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.net.HasNetworkAddresses;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Iterables;
-
-/** utilities for working with MachineLocations */
-public class Machines {
-
-    private static final Logger log = LoggerFactory.getLogger(Machines.class);
-    
-    public static Maybe<String> getSubnetHostname(Location where) {
-        // TODO Should we look at HasNetworkAddresses? But that's not a hostname.
-        String hostname = null;
-        if (where instanceof HasSubnetHostname) {
-            hostname = ((HasSubnetHostname) where).getSubnetHostname();
-        }
-        if (hostname == null && where instanceof MachineLocation) {
-            InetAddress addr = ((MachineLocation) where).getAddress();
-            if (addr != null) hostname = addr.getHostAddress();
-        }
-        log.debug("computed subnet hostname {} for {}", hostname, where);
-        // TODO if Maybe.absent(message) appears, could/should use that
-        // TODO If no machine available, should we throw new IllegalStateException("Cannot find hostname for "+where);
-        return Maybe.fromNullable(hostname);
-    }
-
-    public static Maybe<String> getSubnetIp(Location where) {
-        // TODO Too much duplication between the ip and hostname methods
-        String result = null;
-        if (where instanceof HasSubnetHostname) {
-            result = ((HasSubnetHostname) where).getSubnetIp();
-        }
-        if (where instanceof HasNetworkAddresses) {
-            Set<String> privateAddrs = ((HasNetworkAddresses) where).getPrivateAddresses();
-            if (privateAddrs.size() > 0) {
-                result = Iterables.get(privateAddrs, 0);
-            }
-        }
-        if (result == null && where instanceof MachineLocation) {
-            InetAddress addr = ((MachineLocation) where).getAddress();
-            if (addr != null) result = addr.getHostAddress();
-        }
-        log.debug("computed subnet host ip {} for {}", result, where);
-        return Maybe.fromNullable(result);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> Maybe<T> findUniqueElement(Iterable<?> items, Class<T> type) {
-        if (items==null) return null;
-        Iterator<?> i = items.iterator();
-        T result = null;
-        while (i.hasNext()) {
-            Object candidate = i.next();
-            if (type.isInstance(candidate)) {
-                if (result==null) result = (T)candidate;
-                else {
-                    if (log.isTraceEnabled())
-                        log.trace("Multiple instances of "+type+" in "+items+"; ignoring");
-                    return Maybe.absent(new IllegalStateException("Multiple instances of "+type+" in "+items+"; expected a single one"));
-                }
-            }
-        }
-        if (result==null) 
-            return Maybe.absent(new IllegalStateException("No instances of "+type+" available (in "+items+")"));
-        return Maybe.of(result);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link #findUniqueMachineLocation(Iterable, Class)}, 
-     *             e.g. {@code findUniqueMachineLocation(locations, SshMachineLocation.class)}
-     */
-    @Deprecated
-    public static Maybe<SshMachineLocation> findUniqueSshMachineLocation(Iterable<? extends Location> locations) {
-        return findUniqueMachineLocation(locations, SshMachineLocation.class);
-    }
-
-    public static Maybe<MachineLocation> findUniqueMachineLocation(Iterable<? extends Location> locations) {
-        return findUniqueMachineLocation(locations, MachineLocation.class);
-    }
-
-    public static <T extends MachineLocation> Maybe<T> findUniqueMachineLocation(Iterable<? extends Location> locations, Class<T> clazz) {
-        return findUniqueElement(locations, clazz);
-    }
-
-    public static Maybe<String> findSubnetHostname(Iterable<? extends Location> ll) {
-        Maybe<MachineLocation> l = findUniqueMachineLocation(ll);
-        if (!l.isPresent()) {
-            return Maybe.absent();
-//            throw new IllegalStateException("Cannot find hostname for among "+ll);
-        }
-        return Machines.getSubnetHostname(l.get());
-    }
-
-    public static Maybe<String> findSubnetHostname(Entity entity) {
-        String sh = entity.getAttribute(Attributes.SUBNET_HOSTNAME);
-        if (sh!=null) return Maybe.of(sh);
-        return findSubnetHostname(entity.getLocations());
-    }
-    
-    public static Maybe<String> findSubnetOrPublicHostname(Entity entity) {
-        String hn = entity.getAttribute(Attributes.HOSTNAME);
-        if (hn!=null) {
-            // attributes already set, see if there was a SUBNET_HOSTNAME set
-            // note we rely on (public) hostname being set _after_ subnet_hostname,
-            // to prevent tiny possibility of races resulting in hostname being returned
-            // becasue subnet is still being looked up -- see MachineLifecycleEffectorTasks
-            Maybe<String> sn = findSubnetHostname(entity);
-            if (sn.isPresent()) return sn;
-            // short-circuit discovery if attributes have been set already
-            return Maybe.of(hn);
-        }
-        
-        Maybe<MachineLocation> l = findUniqueMachineLocation(entity.getLocations());
-        if (!l.isPresent()) return Maybe.absent();
-        InetAddress addr = l.get().getAddress();
-        if (addr==null) return Maybe.absent();
-        return Maybe.fromNullable(addr.getHostName());
-    }
-
-    public static Maybe<String> findSubnetOrPrivateIp(Entity entity) {
-        // see comments in findSubnetOrPrivateHostname
-        String hn = entity.getAttribute(Attributes.ADDRESS);
-        if (hn!=null) {
-            Maybe<String> sn = findSubnetIp(entity);
-            if (sn.isPresent()) return sn;
-            return Maybe.of(hn);
-        }
-        
-        Maybe<MachineLocation> l = findUniqueMachineLocation(entity.getLocations());
-        if (!l.isPresent()) return Maybe.absent();
-        InetAddress addr = l.get().getAddress();
-        if (addr==null) return Maybe.absent();
-        return Maybe.fromNullable(addr.getHostAddress());
-    }
-
-    public static Maybe<String> findSubnetIp(Entity entity) {
-        String sh = entity.getAttribute(Attributes.SUBNET_ADDRESS);
-        if (sh!=null) return Maybe.of(sh);
-        return findSubnetIp(entity.getLocations());
-    }
-    
-    public static Maybe<String> findSubnetIp(Iterable<? extends Location> ll) {
-        // TODO Or if can't find MachineLocation, should we throw new IllegalStateException("Cannot find hostname for among "+ll);
-        Maybe<MachineLocation> l = findUniqueMachineLocation(ll);
-        return (l.isPresent()) ? Machines.getSubnetIp(l.get()) : Maybe.<String>absent();
-    }
-
-    /** returns whether it is localhost (and has warned) */
-    public static boolean warnIfLocalhost(Collection<? extends Location> locations, String message) {
-        if (locations.size()==1) {
-            Location l = locations.iterator().next();
-            if (l instanceof LocalhostMachineProvisioningLocation || l instanceof LocalhostMachine) {
-                log.warn(message);
-                return true;
-            }
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/NamedLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/NamedLocationResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/NamedLocationResolver.java
deleted file mode 100644
index 6dbe4d7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/NamedLocationResolver.java
+++ /dev/null
@@ -1,97 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Allows you to say, in your brooklyn.properties:
- * 
- * brooklyn.location.named.foo=localhost
- * brooklyn.location.named.foo.user=bob
- * brooklyn.location.named.foo.privateKeyFile=~/.ssh/custom-key-for-bob
- * brooklyn.location.named.foo.privateKeyPassphrase=WithAPassphrase
- * <p>
- * or
- * <p>
- * brooklyn.location.named.bob-aws-east=jclouds:aws-ec2:us-east-1
- * brooklyn.location.named.bob-aws-east.identity=BobId
- * brooklyn.location.named.bob-aws-east.credential=BobCred
- * <p>
- * then you can simply refer to:   foo   or   named:foo   (or bob-aws-east or named:bob-aws-east)   in any location spec
- */
-public class NamedLocationResolver implements LocationResolver {
-
-    public static final Logger log = LoggerFactory.getLogger(NamedLocationResolver.class);
-
-    public static final String NAMED = "named";
-    
-    @SuppressWarnings("unused")
-    private ManagementContext managementContext;
-
-    @Override
-    public void init(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-    }
-    
-    @Override
-    @SuppressWarnings({ "rawtypes" })
-    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
-        String name = spec;
-        ConfigBag lfBag = ConfigBag.newInstance(locationFlags).putIfAbsent(LocationInternal.ORIGINAL_SPEC, name);
-        name = Strings.removeFromStart(spec, getPrefix()+":");
-        if (name.toLowerCase().startsWith(NAMED+":")) {
-            // since 0.7.0
-            log.warn("Deprecated use of 'named:' prefix with wrong case ("+spec+"); support may be removed in future versions");
-            name = spec.substring( (NAMED+":").length() );
-        }
-        
-        LocationDefinition ld = registry.getDefinedLocationByName(name);
-        if (ld==null) throw new NoSuchElementException("No named location defined matching '"+name+"'");
-        return ((BasicLocationRegistry)registry).resolveLocationDefinition(ld, lfBag.getAllConfig(), name);
-    }
-
-    @Override
-    public String getPrefix() {
-        return NAMED;
-    }
-    
-    /** accepts anything starting  named:xxx  or  xxx where xxx is a defined location name */
-    @Override
-    public boolean accepts(String spec, LocationRegistry registry) {
-        if (BasicLocationRegistry.isResolverPrefixForSpec(this, spec, false)) return true;
-        if (registry.getDefinedLocationByName(spec)!=null) return true;
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/PortRanges.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/PortRanges.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/PortRanges.java
deleted file mode 100644
index 4265e36..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/PortRanges.java
+++ /dev/null
@@ -1,273 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.location.PortRange;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.primitives.Ints;
-
-public class PortRanges {
-
-    public static final int MAX_PORT = 65535;
-    public static final PortRange ANY_HIGH_PORT = new LinearPortRange(1024, MAX_PORT);
-    
-    public static class SinglePort implements PortRange, Serializable {
-        private static final long serialVersionUID = 7446781416534230401L;
-        
-        final int port;
-        private SinglePort(int port) { this.port = port; }
-        
-        @Override
-        public Iterator<Integer> iterator() {
-            return Collections.singletonList(port).iterator();
-        }
-        @Override
-        public boolean isEmpty() {
-            return false;
-        }
-        @Override
-        public boolean asBoolean() {
-            return true;
-        }
-        @Override
-        public String toString() {
-            return //getClass().getName()+"["+
-                    ""+port; //+"]";
-        }
-        public int hashCode() {
-            return Objects.hashCode(port);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            return (obj instanceof SinglePort) && port == ((SinglePort)obj).port;
-        }
-    }
-
-    public static class LinearPortRange implements PortRange, Serializable {
-        private static final long serialVersionUID = -9165280509363743508L;
-        
-        final int start, end, delta;
-        private LinearPortRange(int start, int end, int delta) {
-            this.start = start;
-            this.end = end;
-            this.delta = delta;
-            checkArgument(start > 0 && start <= MAX_PORT, "start port %s out of range", start);
-            checkArgument(end > 0 && end <= MAX_PORT, "end port %s out of range", end);
-            checkArgument(delta > 0 ? start <= end : start >= end, "start and end out of order: %s to %s, delta %s", start, end, delta);
-            checkArgument(delta != 0, "delta must be non-zero");
-        }
-        public LinearPortRange(int start, int end) {
-            this(start, end, (start<=end?1:-1));
-        }
-        
-        @Override
-        public Iterator<Integer> iterator() {
-            return new Iterator<Integer>() {
-                int next = start;
-                boolean hasNext = true;
-                
-                @Override
-                public boolean hasNext() {
-                    return hasNext;
-                }
-
-                @Override
-                public Integer next() {
-                    if (!hasNext)
-                        throw new NoSuchElementException("Exhausted available ports");
-                    int result = next;
-                    next += delta;
-                    if ((delta>0 && next>end) || (delta<0 && next<end)) hasNext = false;
-                    return result;
-                }
-                
-                @Override
-                public void remove() {
-                    throw new UnsupportedOperationException();
-                }
-            };
-        }
-        
-        @Override
-        public boolean isEmpty() {
-            return false;
-        }
-        @Override
-        public boolean asBoolean() {
-            return true;
-        }
-        @Override
-        public String toString() {
-            return //getClass().getName()+"["+
-                    start+"-"+end; //+"]";
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(start, end, delta);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (!(obj instanceof LinearPortRange)) return false;
-            LinearPortRange o = (LinearPortRange) obj;
-            return start == o.start && end == o.end && delta == o.delta;
-        }
-    }
-    
-    public static class AggregatePortRange implements PortRange, Serializable {
-        private static final long serialVersionUID = 7332682500816739660L;
-        
-        final List<PortRange> ranges;
-        private AggregatePortRange(List<PortRange> ranges) {
-            this.ranges = ImmutableList.copyOf(ranges);
-        }
-        @Override
-        public Iterator<Integer> iterator() {
-            return Iterables.concat(ranges).iterator();
-        }
-        @Override
-        public boolean isEmpty() {
-            for (PortRange r: ranges)
-                if (!r.isEmpty()) return false;
-            return true;
-        }
-        @Override
-        public boolean asBoolean() {
-            return !isEmpty();
-        }
-        @Override
-        public String toString() {
-            String s = "";
-            for (PortRange r: ranges) {
-                if (s.length()>0) s+=",";
-                s += r;
-            }
-            return //getClass().getName()+"["+
-                s; //+"]";
-        }
-        public int hashCode() {
-            return Objects.hashCode(ranges);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            return (obj instanceof AggregatePortRange) && ranges.equals(((AggregatePortRange)obj).ranges);
-        }
-    }
-
-    public static PortRange fromInteger(int x) {
-        return new SinglePort(x);
-    }
-    
-    public static PortRange fromIterable(Iterable<?> c) {
-        List<PortRange> l = new ArrayList<PortRange>();
-        for (Object o: c) {
-            if (o instanceof Integer) l.add(fromInteger((Integer)o));
-            else if (o instanceof String)
-                for (String string : JavaStringEscapes.unwrapJsonishListIfPossible((String)o))
-                    l.add(fromString(string));
-            else if (o instanceof Iterable) l.add(fromIterable((Iterable<?>)o));
-            else if (o instanceof int[]) l.add(fromIterable(Ints.asList((int[])o)));
-            else if (o instanceof String[])
-                for (String string : (String[])o)
-                    l.add(fromString(string));
-            else if (o instanceof Object[])
-                for (Object object : (Object[])o)
-                    if (object instanceof Integer)
-                        l.add(fromInteger((Integer)object));
-                    else if (object instanceof String)
-                        l.add(fromString((String)object));
-                    else
-                        throw new IllegalArgumentException("'" + object + "' must be of type Integer or String");
-            else l.add(TypeCoercions.coerce(o, PortRange.class));
-        }
-        return new AggregatePortRange(l);
-    }
-
-    /** parses a string representation of ports, as "80,8080,8000,8080-8099" */
-    public static PortRange fromString(String s) {
-        List<PortRange> l = new ArrayList<PortRange>();
-        for (String si: s.split(",")) {
-            si = si.trim();
-            int start, end;
-            if (si.endsWith("+")) {
-                String si2 = si.substring(0, si.length()-1).trim();
-                start = Integer.parseInt(si2);
-                end = MAX_PORT;
-            } else if (si.indexOf('-')>0) {
-                int v = si.indexOf('-');
-                start = Integer.parseInt(si.substring(0, v).trim());
-                end = Integer.parseInt(si.substring(v+1).trim());
-            } else if (si.length()==0) {
-                //nothing, ie empty range, just continue
-                continue;
-            } else {
-                //should be number on its own
-                l.add(new SinglePort(Integer.parseInt(si)));
-                continue;
-            }
-            l.add(new LinearPortRange(start, end));
-        }
-        if (l.size() == 1) {
-            return l.get(0);
-        } else {
-            return new AggregatePortRange(l);
-        }
-    }
-
-    private static AtomicBoolean initialized = new AtomicBoolean(false); 
-    /** performs the language extensions required for this project */
-    @SuppressWarnings("rawtypes")
-    public static void init() {
-        if (initialized.get()) return;
-        synchronized (initialized) {
-            if (initialized.get()) return;
-            TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() {
-                public PortRange apply(Integer x) { return fromInteger(x); }
-            });
-            TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() {
-                public PortRange apply(String x) { return fromString(x); }
-            });
-            TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() {
-                public PortRange apply(Iterable x) { return fromIterable(x); }
-            });
-            initialized.set(true);
-        }
-    }
-    
-    static {
-        init();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/SupportsPortForwarding.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/SupportsPortForwarding.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/SupportsPortForwarding.java
deleted file mode 100644
index 3510230..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/SupportsPortForwarding.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 org.apache.brooklyn.core.location;
-
-import org.apache.brooklyn.util.net.Cidr;
-
-import com.google.common.net.HostAndPort;
-
-public interface SupportsPortForwarding {
-
-    /** returns an endpoint suitable for contacting the indicated private port on this object,
-     * from the given Cidr, creating it if necessary and possible; 
-     * may return null if forwarding not available 
-     */
-    public HostAndPort getSocketEndpointFor(Cidr accessor, int privatePort);
-    
-    /** marker on a location to indicate that port forwarding should be done automatically
-     * for attempts to access from Brooklyn
-     */
-    public interface RequiresPortForwarding extends SupportsPortForwarding {
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/BrooklynAccessUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/BrooklynAccessUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/BrooklynAccessUtils.java
deleted file mode 100644
index b36ddf6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/BrooklynAccessUtils.java
+++ /dev/null
@@ -1,153 +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.core.location.access;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.location.Machines;
-import org.apache.brooklyn.core.location.SupportsPortForwarding;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.core.task.ssh.SshTasks;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.net.Cidr;
-import org.apache.brooklyn.util.text.Strings;
-import com.google.common.collect.Iterables;
-
-import com.google.common.base.Supplier;
-import com.google.common.net.HostAndPort;
-
-public class BrooklynAccessUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynAccessUtils.class);
-    
-    public static final ConfigKey<PortForwardManager> PORT_FORWARDING_MANAGER = new BasicConfigKey<PortForwardManager>(
-            PortForwardManager.class, "brooklyn.portforwarding.manager", "A port-forwarding manager to use at an entity "
-                + "or a location, where supported; note this should normally be a serializable client instance to prevent "
-                + "the creation of multiple disconnected instances via config duplication");
-    
-    public static final ConfigKey<Cidr> MANAGEMENT_ACCESS_CIDR = new BasicConfigKey<Cidr>(
-            Cidr.class, "brooklyn.portforwarding.management.cidr", "CIDR to enable by default for port-forwarding for management",
-            null);  // TODO should be a list
-
-    public static HostAndPort getBrooklynAccessibleAddress(Entity entity, int port) {
-        String host;
-        
-        // look up port forwarding
-        PortForwardManager pfw = entity.getConfig(PORT_FORWARDING_MANAGER);
-        if (pfw!=null) {
-            Collection<Location> ll = entity.getLocations();
-            
-            synchronized (BrooklynAccessUtils.class) {
-                // TODO finer-grained synchronization
-                
-                for (MachineLocation machine : Iterables.filter(ll, MachineLocation.class)) {
-                    HostAndPort hp = pfw.lookup(machine, port);
-                    if (hp!=null) {
-                        log.debug("BrooklynAccessUtils found port-forwarded address {} for entity {}, port {}, using machine {}",
-                                new Object[] {hp, entity, port, machine});
-                        return hp;
-                    }
-                }
-                
-                Maybe<SupportsPortForwarding> supportPortForwardingLoc = Machines.findUniqueElement(ll, SupportsPortForwarding.class);
-                if (supportPortForwardingLoc.isPresent()) {
-                    Cidr source = entity.getConfig(MANAGEMENT_ACCESS_CIDR);
-                    SupportsPortForwarding loc = supportPortForwardingLoc.get();
-                    if (source!=null) {
-                        log.debug("BrooklynAccessUtils requesting new port-forwarding rule to access "+port+" on "+entity+" (at "+loc+", enabled for "+source+")");
-                        // TODO discuss, is this the best way to do it
-                        // (will probably _create_ the port forwarding rule!)
-                        HostAndPort hp = loc.getSocketEndpointFor(source, port);
-                        if (hp!=null) {
-                            log.debug("BrooklynAccessUtils created port-forwarded address {} for entity {}, port {}, using {}",
-                                    new Object[] {hp, entity, port, loc});
-                            return hp;
-                        }
-                    } else {
-                        log.warn("No "+MANAGEMENT_ACCESS_CIDR.getName()+" configured for "+entity+", so cannot forward "
-                                +"port "+port+" "+"even though "+PORT_FORWARDING_MANAGER.getName()+" was supplied, and "
-                                +"have location supporting port forwarding "+loc);
-                    }
-                }
-            }
-        }
-        
-        host = entity.getAttribute(Attributes.HOSTNAME);
-        if (host!=null) return HostAndPort.fromParts(host, port);
-        
-        throw new IllegalStateException("Cannot find way to access port "+port+" on "+entity+" from Brooklyn (no host.name)");
-    }
-
-    /** attempts to resolve hostnameTarget from origin
-     * @return null if it definitively can't be resolved,  
-     * best-effort IP address if possible, or blank if we could not run ssh or make sense of the output */
-    public static String getResolvedAddress(Entity entity, SshMachineLocation origin, String hostnameTarget) {
-        ProcessTaskWrapper<Integer> task = SshTasks.newSshExecTaskFactory(origin, "ping -c 1 -t 1 "+hostnameTarget)
-            .summary("checking resolution of "+hostnameTarget).allowingNonZeroExitCode().newTask();
-        DynamicTasks.queueIfPossible(task).orSubmitAndBlock(entity).asTask().blockUntilEnded();
-        if (task.asTask().isError()) {
-            log.warn("ping could not be run, at "+entity+" / "+origin+": "+Tasks.getError(task.asTask()));
-            return "";
-        }
-        if (task.getExitCode()==null || task.getExitCode()!=0) {
-            if (task.getExitCode()!=null && task.getExitCode()<10) {
-                // small number means ping failed to resolve or ping the hostname
-                log.debug("not able to resolve "+hostnameTarget+" from "+origin+" for "+entity+" because exit code was "+task.getExitCode());
-                return null;
-            }
-            // large number means ping probably did not run
-            log.warn("ping not run as expected, at "+entity+" / "+origin+" (code "+task.getExitCode()+"):\n"+task.getStdout().trim()+" --- "+task.getStderr().trim());
-            return "";
-        }
-        String out = task.getStdout();
-        try {
-            String line1 = Strings.getFirstLine(out);
-            String ip = Strings.getFragmentBetween(line1, "(", ")");
-            if (Strings.isNonBlank(ip)) 
-                return ip;
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            /* ignore non-parseable output */ 
-        }
-        if (out.contains("127.0.0.1")) return "127.0.0.1";
-        return "";
-    }
-
-    public static Supplier<String> resolvedAddressSupplier(final Entity entity, final SshMachineLocation origin, final String hostnameTarget) {
-        return new Supplier<String>() {
-            @Override
-            public String get() {
-                return getResolvedAddress(entity, origin, hostnameTarget);
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManager.java
deleted file mode 100644
index 21e579c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManager.java
+++ /dev/null
@@ -1,328 +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.core.location.access;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.net.HostAndPort;
-
-import java.util.Collection;
-
-/**
- * Acts as a registry for existing port mappings (e.g. the public endpoints for accessing specific
- * ports on private VMs). This could be using DNAT, or iptables port-forwarding, or Docker port-mapping 
- * via the host, or any other port mapping approach.
- * 
- * Also controls the allocation of ports via {@link #acquirePublicPort(String)}
- * (e.g. for port-mapping with DNAT, then which port to use for the public side).
- * 
- * Implementations typically will not know anything about what the firewall/IP actually is, they just 
- * handle a unique identifier for it.
- * 
- * To use, see {@link PortForwardManagerLocationResolver}, with code such as 
- * {@code managementContext.getLocationRegistry().resolve("portForwardManager(scope=global)")}.
- * 
- * @see PortForwardManagerImpl for implementation notes and considerations.
- */
-@Beta
-public interface PortForwardManager extends Location {
-
-    @Beta
-    class AssociationMetadata {
-        private final String publicIpId;
-        private final HostAndPort publicEndpoint;
-        private final Location location;
-        private final int privatePort;
-
-        /**
-         * Users are discouraged from calling this constructor; the signature may change in future releases.
-         * Instead, instances will be created automatically by Brooklyn to be passed to the
-         * {@link AssociationListener#onAssociationCreated(AssociationMetadata)} method.
-         */
-        public AssociationMetadata(String publicIpId, HostAndPort publicEndpoint, Location location, int privatePort) {
-            this.publicIpId = publicIpId;
-            this.publicEndpoint = publicEndpoint;
-            this.location = location;
-            this.privatePort = privatePort;
-        }
-
-        public String getPublicIpId() {
-            return publicIpId;
-        }
-
-        public HostAndPort getPublicEndpoint() {
-            return publicEndpoint;
-        }
-
-        public Location getLocation() {
-            return location;
-        }
-
-        public int getPrivatePort() {
-            return privatePort;
-        }
-
-        public String toString() {
-            return Objects.toStringHelper(this)
-                    .add("publicIpId", publicIpId)
-                    .add("publicEndpoint", publicEndpoint)
-                    .add("location", location)
-                    .add("privatePort", privatePort)
-                    .toString();
-        }
-    }
-
-    @Beta
-    interface AssociationListener {
-        void onAssociationCreated(AssociationMetadata metadata);
-        void onAssociationDeleted(AssociationMetadata metadata);
-    }
-
-    /**
-     * The intention is that there is one PortForwardManager instance per "scope". If you 
-     * use global, then it will be a shared instance (for that management context). If you 
-     * pass in your own name (e.g. "docker-fjie3") then it will shared with just any other
-     * places that use that same location spec (e.g. {@code portForwardManager(scope=docker-fjie3)}).
-     */
-    // TODO Note: using name "scope" rather than "brooklyn.portForwardManager.scope" so that location spec 
-    // "portForwardManager(scope=global)" works, rather than having to do 
-    // portForwardManager(brooklyn.portForwardManager.scope=global).
-    // The config being read by the PortForwardManagerLocationResolver doesn't respect @SetFromFlag("scope").
-    public static final ConfigKey<String> SCOPE = ConfigKeys.newStringConfigKey(
-            "scope",
-            "The scope that this applies to, defaulting to global",
-            "global");
-
-    @Beta
-    public static final ConfigKey<Integer> PORT_FORWARD_MANAGER_STARTING_PORT = ConfigKeys.newIntegerConfigKey(
-            "brooklyn.portForwardManager.startingPort",
-            "The starting port for assigning port numbers, such as for DNAT",
-            11000);
-
-    public String getScope();
-
-    /**
-     * Reserves a unique public port on the given publicIpId.
-     * <p>
-     * Often followed by {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     * to enable {@link #lookup(String, int)} or {@link #lookup(Location, int)} respectively.
-     */
-    public int acquirePublicPort(String publicIpId);
-
-    /**
-     * Records a location and private port against a public endpoint (ip and port),
-     * to support {@link #lookup(Location, int)}.
-     * <p>
-     * Superfluous if {@link #acquirePublicPort(String, Location, int)} was used,
-     * but strongly recommended if {@link #acquirePublicPortExplicit(String, int)} was used
-     * e.g. if the location is not known ahead of time.
-     */
-    public void associate(String publicIpId, HostAndPort publicEndpoint, Location l, int privatePort);
-
-    /**
-     * Records a mapping for publicIpId:privatePort to a public endpoint, such that it can
-     * subsequently be looked up using {@link #lookup(String, int)}.
-     */
-    public void associate(String publicIpId, HostAndPort publicEndpoint, int privatePort);
-
-    /**
-     * Registers a listener, which will be notified each time a new port mapping is associated. See {@link #associate(String, HostAndPort, int)}
-     * and {@link #associate(String, HostAndPort, Location, int)}.
-     */
-    @Beta
-    public void addAssociationListener(AssociationListener listener, Predicate<? super AssociationMetadata> filter);
-
-    @Beta
-    public void removeAssociationListener(AssociationListener listener);
-    
-    /**
-     * Returns the public ip hostname and public port for use contacting the given endpoint.
-     * <p>
-     * Will return null if:
-     * <ul>
-     * <li>No publicPort is associated with this location and private port.
-     * <li>No publicIpId is associated with this location and private port.
-     * <li>No publicIpHostname is recorded against the associated publicIpId.
-     * </ul>
-     * Conceivably this may have to be access-location specific.
-     *
-     * @see #recordPublicIpHostname(String, String)
-     */
-    public HostAndPort lookup(Location l, int privatePort);
-
-    /**
-     * Returns the public endpoint (host and port) for use contacting the given endpoint.
-     * 
-     * Expects a previous call to {@link #associate(String, HostAndPort, int)}, to register
-     * the endpoint.
-     * 
-     * Will return null if there has not been a public endpoint associated with this pairing.
-     */
-    public HostAndPort lookup(String publicIpId, int privatePort);
-
-    /** 
-     * Clears the given port mapping, returning true if there was a match.
-     */
-    public boolean forgetPortMapping(String publicIpId, int publicPort);
-    
-    /** 
-     * Clears the port mappings associated with the given location, returning true if there were any matches.
-     */
-    public boolean forgetPortMappings(Location location);
-    
-    /** 
-     * Clears the port mappings associated with the given publicIpId, returning true if there were any matches.
-     */
-    public boolean forgetPortMappings(String publicIpId);
-    
-    public String toVerboseString();
-
-    
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Deprecated
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Reserves a unique public port for the purpose of forwarding to the given target,
-     * associated with a given location for subsequent lookup purpose.
-     * <p>
-     * If already allocated, returns the previously allocated.
-     * 
-     * @deprecated since 0.7.0; use {@link #acquirePublicPort(String)}, and then use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Deprecated
-    public int acquirePublicPort(String publicIpId, Location l, int privatePort);
-
-    /** 
-     * Returns old mapping if it existed, null if it is new.
-     * 
-     * @deprecated since 0.7.0; use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Deprecated
-    public PortMapping acquirePublicPortExplicit(String publicIpId, int port);
-
-    /**
-     * Records a location and private port against a publicIp and public port,
-     * to support {@link #lookup(Location, int)}.
-     * <p>
-     * Superfluous if {@link #acquirePublicPort(String, Location, int)} was used,
-     * but strongly recommended if {@link #acquirePublicPortExplicit(String, int)} was used
-     * e.g. if the location is not known ahead of time.
-     * 
-     * @deprecated Use {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Deprecated
-    public void associate(String publicIpId, int publicPort, Location l, int privatePort);
-
-    /**
-     * Records a public hostname or address to be associated with the given publicIpId for lookup purposes.
-     * <p>
-     * Conceivably this may have to be access-location specific.
-     * 
-     * @deprecated Use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Deprecated
-    public void recordPublicIpHostname(String publicIpId, String hostnameOrPublicIpAddress);
-
-    /**
-     * Returns a recorded public hostname or address.
-     * 
-     * @deprecated Use {@link #lookup(String, int)} or {@link #lookup(Location, int)}
-     */
-    @Deprecated
-    public String getPublicIpHostname(String publicIpId);
-    
-    /**
-     * Clears a previous call to {@link #recordPublicIpHostname(String, String)}.
-     * 
-     * @deprecated Use {@link #forgetPortMapping(String, int)} or {@link #forgetPortMappings(Location)}
-     */
-    @Deprecated
-    public boolean forgetPublicIpHostname(String publicIpId);
-
-    /**
-     * Returns true if this implementation is a client which is immutable/safe for serialization
-     * i.e. it delegates to something on an entity or location elsewhere.
-     * 
-     * @deprecated since 0.7.0; no need to separate client-proxy from impl
-     */
-    @Deprecated
-    public boolean isClient();
-    
-
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Deprecated; just internal
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    /** 
-     * Returns the port mapping for a given publicIpId and public port.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public PortMapping getPortMappingWithPublicSide(String publicIpId, int publicPort);
-
-    /** 
-     * Returns the subset of port mappings associated with a given public IP ID.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public Collection<PortMapping> getPortMappingWithPublicIpId(String publicIpId);
-
-    /** 
-     * @see {@link #forgetPortMapping(String, int)} and {@link #forgetPortMappings(Location)}
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public boolean forgetPortMapping(PortMapping m);
-
-    /**
-     * Returns the public host and port for use accessing the given mapping.
-     * <p>
-     * Conceivably this may have to be access-location specific.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public HostAndPort getPublicHostAndPort(PortMapping m);
-
-    /** 
-     * Returns the subset of port mappings associated with a given location.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public Collection<PortMapping> getLocationPublicIpIds(Location l);
-        
-    /** 
-     * Returns the mapping to a given private port, or null if none.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Deprecated
-    public PortMapping getPortMappingWithPrivateSide(Location l, int privatePort);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerAuthority.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerAuthority.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerAuthority.java
deleted file mode 100644
index 89c57f3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerAuthority.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.core.location.access;
-
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.entity.EntityInternal;
-
-/**
- * @deprecated since 0.7.0; use {@link PortForwardManagerImpl}
- */
-@Deprecated
-public class PortForwardManagerAuthority extends PortForwardManagerImpl {
-    private Entity owningEntity;
-
-    public PortForwardManagerAuthority() {
-    }
-
-    public PortForwardManagerAuthority(Entity owningEntity) {
-        this.owningEntity = owningEntity;
-    }
-
-    protected void onChanged() {
-        if (owningEntity != null) {
-            ((EntityInternal) owningEntity).requestPersist();
-        } else {
-            super.onChanged();
-        }
-    }
-}


[04/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicSubscriptionContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicSubscriptionContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicSubscriptionContext.java
deleted file mode 100644
index 57d4712..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicSubscriptionContext.java
+++ /dev/null
@@ -1,181 +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.core.mgmt.internal;
-
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.mapOf;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-
-import groovy.lang.Closure;
-
-/**
- * A {@link SubscriptionContext} for an entity or other user of a {@link SubscriptionManager}.
- */
-public class BasicSubscriptionContext implements SubscriptionContext {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(BasicSubscriptionContext.class);
-
-    private final SubscriptionManager manager;
-    private final Object subscriber;
-    private final Map<String,Object> flags;
-
-    public BasicSubscriptionContext(SubscriptionManager manager, Object subscriber) {
-        this(Collections.<String,Object>emptyMap(), manager, subscriber);
-    }
-    
-    public BasicSubscriptionContext(Map<String, ?> flags, SubscriptionManager manager, Object subscriber) {
-        this.manager = manager;
-        this.subscriber = subscriber;
-        this.flags = mapOf("subscriber", subscriber);
-        if (flags!=null) this.flags.putAll(flags);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, Closure c) {
-        return subscribe(Collections.<String,Object>emptyMap(), producer, sensor, c);
-    }
-    
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribe(Map<String, ?> newFlags, Entity producer, Sensor<T> sensor, Closure c) {
-        return subscribe(newFlags, producer, sensor, toSensorEventListener(c));        
-    }
-
-    @Override
-    public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribe(Collections.<String,Object>emptyMap(), producer, sensor, listener);
-    }
-    
-    @Override
-    public <T> SubscriptionHandle subscribe(Map<String, ?> newFlags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        Map<String,Object> subscriptionFlags = Maps.newLinkedHashMap(flags);
-        if (newFlags != null) subscriptionFlags.putAll(newFlags);
-        return manager.subscribe(subscriptionFlags, producer, sensor, listener);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, Closure c) {
-        return subscribeToChildren(Collections.<String,Object>emptyMap(), parent, sensor, c);
-    }
-    
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribeToChildren(Map<String, Object> newFlags, Entity parent, Sensor<T> sensor, Closure c) {
-        return subscribeToChildren(newFlags, parent, sensor, toSensorEventListener(c));
-    }
-
-    @Override
-    public <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribeToChildren(Collections.<String,Object>emptyMap(), parent, sensor, listener);
-    }
-    
-    @Override
-    public <T> SubscriptionHandle subscribeToChildren(Map<String, Object> newFlags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        Map<String,Object> subscriptionFlags = Maps.newLinkedHashMap(flags);
-        if (newFlags != null) subscriptionFlags.putAll(newFlags);
-        return manager.subscribeToChildren(subscriptionFlags, parent, sensor, listener);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, Closure c) {
-        return subscribeToMembers(Collections.<String,Object>emptyMap(), parent, sensor, c);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public <T> SubscriptionHandle subscribeToMembers(Map<String, Object> newFlags, Group parent, Sensor<T> sensor, Closure c) {
-        return subscribeToMembers(newFlags, parent, sensor, toSensorEventListener(c));
-    }
-    
-    @Override
-    public <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribeToMembers(Collections.<String,Object>emptyMap(), parent, sensor, listener);
-    }
-    
-    @Override
-    public <T> SubscriptionHandle subscribeToMembers(Map<String, Object> newFlags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        Map<String,Object> subscriptionFlags = Maps.newLinkedHashMap(flags);
-        if (newFlags != null) subscriptionFlags.putAll(newFlags);
-        return manager.subscribeToMembers(subscriptionFlags, parent, sensor, listener);
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public boolean unsubscribe(SubscriptionHandle subscriptionId) {
-        Preconditions.checkNotNull(subscriptionId, "subscriptionId must not be null");
-        Preconditions.checkArgument(Objects.equal(subscriber, ((Subscription) subscriptionId).subscriber), "The subscriptionId is for a different "+subscriber+"; expected "+((Subscription) subscriptionId).subscriber);
-        return manager.unsubscribe(subscriptionId);
-    }
-
-    /** @see SubscriptionManager#publish(SensorEvent) */
-    @Override
-    public <T> void publish(SensorEvent<T> event) {
-        manager.publish(event);
-    }
-
-    /** Return the subscriptions associated with this context */
-    @Override
-    public Set<SubscriptionHandle> getSubscriptions() {
-        return manager.getSubscriptionsForSubscriber(subscriber);
-    }
-
-    @Override
-    public int unsubscribeAll() {
-        int count = 0;
-        
-        // To avoid ConcurrentModificationException when copying subscriptions, need to synchronize on it
-        Set<SubscriptionHandle> subscriptions = getSubscriptions();
-        Collection<SubscriptionHandle> subscriptionsCopy;
-        synchronized (subscriptions) {
-            subscriptionsCopy = ImmutableList.copyOf(subscriptions);
-        }
-        
-        for (SubscriptionHandle s : subscriptionsCopy) {
-            count++; 
-            boolean result = unsubscribe(s); 
-            if (!result) LOG.warn("When unsubscribing from all of {}, unsubscribe of {} return false", subscriber, s);
-        }
-        return count;
-    }
-    
-    @SuppressWarnings("rawtypes")
-    private <T> SensorEventListener<T> toSensorEventListener(final Closure c) {
-        return new SensorEventListener<T>() {
-            @Override public void onEvent(SensorEvent<T> event) {
-                c.call(event);
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynGarbageCollector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynGarbageCollector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynGarbageCollector.java
deleted file mode 100644
index c8ef0e6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynGarbageCollector.java
+++ /dev/null
@@ -1,625 +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.core.mgmt.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.HasTaskChildren;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags.WrappedEntity;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags.WrappedStream;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.task.BasicExecutionManager;
-import org.apache.brooklyn.util.core.task.ExecutionListener;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.MemoryUsageTracker;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Iterables;
-
-/**
- * Deletes record of old tasks, to prevent space leaks and the eating up of more and more memory.
- * 
- * The deletion policy is configurable:
- * <ul>
- *   <li>Period - how frequently to look at the existing tasks to delete some, if required
- *   <li>Max task age - the time after which a completed task will be automatically deleted
- *       (i.e. any root task completed more than maxTaskAge ago will be deleted)
- *   <li>Max tasks per <various categories> - the maximum number of tasks to be kept for a given tag,
- *       split into categories based on what is seeming to be useful
- * </ul>
- * 
- * The default is to check with a period of one minute, deleting tasks after 30 days, 
- * and keeping at most 100000 tasks in the system,
- * max 1000 tasks per entity, 50 per effector within that entity, and 50 per other non-effector tag
- * within that entity (or global if not attached to an entity).
- * 
- * @author aled
- */
-public class BrooklynGarbageCollector {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BrooklynGarbageCollector.class);
-
-    public static final ConfigKey<Duration> GC_PERIOD = ConfigKeys.newDurationConfigKey(
-            "brooklyn.gc.period", "the period for checking if any tasks need to be deleted", 
-            Duration.minutes(1));
-    
-    public static final ConfigKey<Boolean> DO_SYSTEM_GC = ConfigKeys.newBooleanConfigKey(
-            "brooklyn.gc.doSystemGc", "whether to periodically call System.gc()", false);
-    
-    /** 
-     * should we check for tasks which are submitted by another but backgrounded, i.e. not a child of that task?
-     * default to yes, despite it can be some extra loops, to make sure we GC them promptly.
-     * @since 0.7.0 */
-    // work offender is {@link DynamicSequentialTask} internal job tracker, but it is marked 
-    // transient so it is destroyed prompty; there may be others, however;
-    // but OTOH it might be expensive to check for these all the time!
-    // TODO probably we can set this false (remove this and related code),
-    // and just rely on usual GC to pick up background tasks; the lifecycle of background task
-    // should normally be independent of the submitter. (DST was the exception, and marking 
-    // transient there fixes the main problem, which is when the submitter is GC'd but the submitted is not,
-    // and we don't want the submitted to show up at the root in the GUI, which it will if its
-    // submitter has been GC'd)
-    @Beta
-    public static final ConfigKey<Boolean> CHECK_SUBTASK_SUBMITTERS = ConfigKeys.newBooleanConfigKey(
-        "brooklyn.gc.checkSubtaskSubmitters", "whether for subtasks to check the submitters", true);
-
-    public static final ConfigKey<Integer> MAX_TASKS_PER_TAG = ConfigKeys.newIntegerConfigKey(
-        "brooklyn.gc.maxTasksPerTag", 
-        "the maximum number of tasks to be kept for a given tag "
-        + "within an execution context (e.g. entity); "
-        + "some broad-brush tags are excluded, and if an entity has multiple tags all tag counts must be full",
-        50);
-    
-    public static final ConfigKey<Integer> MAX_TASKS_PER_ENTITY = ConfigKeys.newIntegerConfigKey(
-        "brooklyn.gc.maxTasksPerEntity", 
-        "the maximum number of tasks to be kept for a given entity",
-        1000);
-
-    public static final ConfigKey<Integer> MAX_TASKS_GLOBAL = ConfigKeys.newIntegerConfigKey(
-        "brooklyn.gc.maxTasksGlobal", 
-        "the maximum number of tasks to be kept across the entire system",
-        100000);
-
-    public static final ConfigKey<Duration> MAX_TASK_AGE = ConfigKeys.newDurationConfigKey(
-            "brooklyn.gc.maxTaskAge", 
-            "the duration after which a completed task will be automatically deleted", 
-            Duration.days(30));
-    
-    protected final static Comparator<Task<?>> TASKS_OLDEST_FIRST_COMPARATOR = new Comparator<Task<?>>() {
-        @Override public int compare(Task<?> t1, Task<?> t2) {
-            long end1 = t1.getEndTimeUtc();
-            long end2 = t2.getEndTimeUtc();
-            return (end1 < end2) ? -1 : ((end1 == end2) ? 0 : 1);
-        }
-    };
-    
-    private final BasicExecutionManager executionManager;
-    private final BrooklynStorage storage;
-    private final BrooklynProperties brooklynProperties;
-    private final ScheduledExecutorService executor;
-    private ScheduledFuture<?> activeCollector;
-    private Map<Entity,Task<?>> unmanagedEntitiesNeedingGc = new LinkedHashMap<Entity, Task<?>>();
-    
-    private Duration gcPeriod;
-    private final boolean doSystemGc;
-    private volatile boolean running = true;
-    
-    public BrooklynGarbageCollector(BrooklynProperties brooklynProperties, BasicExecutionManager executionManager, BrooklynStorage storage) {
-        this.executionManager = executionManager;
-        this.storage = storage;
-        this.brooklynProperties = brooklynProperties;
-
-        doSystemGc = brooklynProperties.getConfig(DO_SYSTEM_GC);
-        
-        executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
-                @Override public Thread newThread(Runnable r) {
-                    return new Thread(r, "brooklyn-gc");
-                }});
-        
-        executionManager.addListener(new ExecutionListener() {
-                @Override public void onTaskDone(Task<?> task) {
-                    BrooklynGarbageCollector.this.onTaskDone(task);
-                }});
-    
-        scheduleCollector(true);
-    }
-
-    protected synchronized void scheduleCollector(boolean canInterruptCurrent) {
-        if (activeCollector != null) activeCollector.cancel(canInterruptCurrent);
-        
-        gcPeriod = brooklynProperties.getConfig(GC_PERIOD);
-        if (gcPeriod!=null) {
-            activeCollector = executor.scheduleWithFixedDelay(
-                new Runnable() {
-                    @Override public void run() {
-                        gcIteration();
-                    }
-                }, 
-                gcPeriod.toMillisecondsRoundingUp(), 
-                gcPeriod.toMillisecondsRoundingUp(), 
-                TimeUnit.MILLISECONDS);
-        }
-    }
-
-    /** force a round of Brooklyn garbage collection */
-    public void gcIteration() {
-        try {
-            logUsage("brooklyn gc (before)");
-            gcTasks();
-            logUsage("brooklyn gc (after)");
-            
-            if (doSystemGc) {
-                // Can be very useful when tracking down OOMEs etc, where a lot of tasks are executing
-                // Empirically observed that (on OS X jvm at least) calling twice blocks - logs a significant
-                // amount of memory having been released, as though a full-gc had been run. But this is highly
-                // dependent on the JVM implementation.
-                System.gc(); System.gc();
-                logUsage("brooklyn gc (after system gc)");
-            }
-        } catch (Throwable t) {
-            Exceptions.propagateIfFatal(t);
-            LOG.warn("Error during management-context GC: "+t, t);
-            // previously we bailed on all errors, but I don't think we should do that -Alex
-        }
-    }
-
-    public void logUsage(String prefix) {
-        if (LOG.isDebugEnabled())
-            LOG.debug(prefix+" - using "+getUsageString());
-    }
-
-    public static String makeBasicUsageString() {
-        return Strings.makeSizeString(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())+" / "+
-            Strings.makeSizeString(Runtime.getRuntime().totalMemory()) + " memory" +
-            " ("+Strings.makeSizeString(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed()) + " soft); "+
-            Thread.activeCount()+" threads";
-    }
-    
-    public String getUsageString() {
-        return makeBasicUsageString()+"; "+
-            "storage: " + storage.getStorageMetrics() + "; " +
-            "tasks: " +
-            executionManager.getNumActiveTasks()+" active, "+
-            executionManager.getNumIncompleteTasks()+" unfinished; "+
-            executionManager.getNumInMemoryTasks()+" remembered, "+
-            executionManager.getTotalTasksSubmitted()+" total submitted)";
-    }
-    
-    public void shutdownNow() {
-        running = false;
-        if (activeCollector != null) activeCollector.cancel(true);
-        if (executor != null) executor.shutdownNow();
-    }
-    
-    public void onUnmanaged(Entity entity) {
-        // defer task deletions until the entity is completely unmanaged
-        // (this is usually invoked during the stop sequence)
-        synchronized (unmanagedEntitiesNeedingGc) {
-            unmanagedEntitiesNeedingGc.put(entity, Tasks.current());
-        }
-    }
-    
-    public void deleteTasksForEntity(Entity entity) {
-        // remove all references to this entity from tasks
-        executionManager.deleteTag(entity);
-        executionManager.deleteTag(BrooklynTaskTags.tagForContextEntity(entity));
-        executionManager.deleteTag(BrooklynTaskTags.tagForCallerEntity(entity));
-        executionManager.deleteTag(BrooklynTaskTags.tagForTargetEntity(entity));
-    }
-    
-    public void onUnmanaged(Location loc) {
-        // No-op currently; no tasks are tracked through their location
-    }
-    
-    public void onTaskDone(Task<?> task) {
-        if (shouldDeleteTaskImmediately(task)) {
-            executionManager.deleteTask(task);
-        }
-    }
-    
-    /** @deprecated since 0.7.0, method moved internal until semantics are clarified; see also {@link #shouldDeleteTaskImmediately(Task)} */
-    @Deprecated
-    public boolean shouldDeleteTask(Task<?> task) {
-        return shouldDeleteTaskImmediately(task);
-    }
-    /** whether this task should be deleted on completion,
-     * because it is transient, or because it is submitted background without much context information */
-    protected boolean shouldDeleteTaskImmediately(Task<?> task) {
-        if (!task.isDone()) return false;
-        
-        Set<Object> tags = task.getTags();
-        if (tags.contains(ManagementContextInternal.TRANSIENT_TASK_TAG))
-            return true;
-        if (tags.contains(ManagementContextInternal.EFFECTOR_TAG) || tags.contains(ManagementContextInternal.NON_TRANSIENT_TASK_TAG))
-            return false;
-        
-        if (task.getSubmittedByTask()!=null) {
-            Task<?> parent = task.getSubmittedByTask();
-            if (executionManager.getTask(parent.getId())==null) {
-                // parent is already cleaned up
-                return true;
-            }
-            if (parent instanceof HasTaskChildren && Iterables.contains(((HasTaskChildren)parent).getChildren(), task)) {
-                // it is a child, let the parent manage this task's death
-                return false;
-            }
-            Entity associatedEntity = BrooklynTaskTags.getTargetOrContextEntity(task);
-            if (associatedEntity!=null) {
-                // this is associated to an entity; destroy only if the entity is unmanaged
-                return !Entities.isManaged(associatedEntity);
-            }
-            // if not associated to an entity, then delete immediately
-            return true;
-        }
-        
-        // e.g. scheduled tasks, sensor events, etc
-        // TODO (in future may keep some of these with another limit, based on a new TagCategory)
-        // there may also be a server association for server-side tasks which should be kept
-        // (but be careful not to keep too many subscriptions!)
-        
-        return true;
-    }
-
-    /**
-     * Deletes old tasks. The age/number of tasks to keep is controlled by fields like 
-     * {@link #maxTasksPerTag} and {@link #maxTaskAge}.
-     */
-    protected synchronized int gcTasks() {
-        // TODO Must be careful with memory usage here: have seen OOME if we get crazy lots of tasks.
-        // hopefully the use new limits, filters, and use of live lists in some places (added Sep 2014) will help.
-        // 
-        // An option is for getTasksWithTag(tag) to return an ArrayList rather than a LinkedHashSet. That
-        // is a far more memory efficient data structure (e.g. 4 bytes overhead per object rather than 
-        // 32 bytes overhead per object for HashSet).
-        //
-        // More notes on optimization is in the history of this file.
-        
-        if (!running) return 0;
-        
-        Duration newPeriod = brooklynProperties.getConfig(GC_PERIOD);
-        if (!Objects.equal(gcPeriod, newPeriod)) {
-            // caller has changed period, reschedule on next run
-            scheduleCollector(false);
-        }
-    
-        expireUnmanagedEntityTasks();
-        expireAgedTasks();
-        expireTransientTasks();
-        
-        // now look at overcapacity tags, non-entity tags first
-        
-        Set<Object> taskTags = executionManager.getTaskTags();
-        
-        int maxTasksPerEntity = brooklynProperties.getConfig(MAX_TASKS_PER_ENTITY);
-        int maxTasksPerTag = brooklynProperties.getConfig(MAX_TASKS_PER_TAG);
-        
-        Map<Object,AtomicInteger> taskNonEntityTagsOverCapacity = MutableMap.of();
-        Map<Object,AtomicInteger> taskEntityTagsOverCapacity = MutableMap.of();
-        
-        Map<Object,AtomicInteger> taskAllTagsOverCapacity = MutableMap.of();
-        
-        for (Object tag : taskTags) {
-            if (isTagIgnoredForGc(tag)) continue;
-            
-            Set<Task<?>> tasksWithTag = executionManager.tasksWithTagLiveOrNull(tag);
-            if (tasksWithTag==null) continue;
-            AtomicInteger overA = null;
-            if (tag instanceof WrappedEntity) {
-                int over = tasksWithTag.size() - maxTasksPerEntity;
-                if (over>0) {
-                    overA = new AtomicInteger(over);
-                    taskEntityTagsOverCapacity.put(tag, overA);
-                }
-            } else {
-                int over = tasksWithTag.size() - maxTasksPerTag;
-                if (over>0) {
-                    overA = new AtomicInteger(over);
-                    taskNonEntityTagsOverCapacity.put(tag, overA);
-                }
-            }
-            if (overA!=null) {
-                taskAllTagsOverCapacity.put(tag, overA);
-            }
-        }
-        
-        int deletedCount = 0;
-        deletedCount += expireOverCapacityTagsInCategory(taskNonEntityTagsOverCapacity, taskAllTagsOverCapacity, TagCategory.NON_ENTITY_NORMAL, false);
-        deletedCount += expireOverCapacityTagsInCategory(taskEntityTagsOverCapacity, taskAllTagsOverCapacity, TagCategory.ENTITY, true);
-        deletedCount += expireSubTasksWhoseSubmitterIsExpired();
-        
-        int deletedGlobally = expireIfOverCapacityGlobally();
-        deletedCount += deletedGlobally;
-        if (deletedGlobally>0) deletedCount += expireSubTasksWhoseSubmitterIsExpired();
-        
-        return deletedCount;
-    }
-
-    protected static boolean isTagIgnoredForGc(Object tag) {
-        if (tag == null) return true;
-        if (tag.equals(ManagementContextInternal.EFFECTOR_TAG)) return true;
-        if (tag.equals(ManagementContextInternal.SUB_TASK_TAG)) return true;
-        if (tag.equals(ManagementContextInternal.NON_TRANSIENT_TASK_TAG)) return true;
-        if (tag.equals(ManagementContextInternal.TRANSIENT_TASK_TAG)) return true;
-        if (tag instanceof WrappedStream) {
-            return true;
-        }
-        
-        return false;
-    }
-    
-    protected void expireUnmanagedEntityTasks() {
-        Iterator<Entry<Entity, Task<?>>> ei;
-        synchronized (unmanagedEntitiesNeedingGc) {
-            ei = MutableSet.copyOf(unmanagedEntitiesNeedingGc.entrySet()).iterator();
-        }
-        while (ei.hasNext()) {
-            Entry<Entity, Task<?>> ee = ei.next();
-            if (Entities.isManaged(ee.getKey())) continue;
-            if (ee.getValue()!=null && !ee.getValue().isDone()) continue;
-            deleteTasksForEntity(ee.getKey());
-            synchronized (unmanagedEntitiesNeedingGc) {
-                unmanagedEntitiesNeedingGc.remove(ee.getKey());
-            }
-        }
-    }
-    
-    protected void expireAgedTasks() {
-        Duration maxTaskAge = brooklynProperties.getConfig(MAX_TASK_AGE);
-        
-        Collection<Task<?>> allTasks = executionManager.allTasksLive();
-        Collection<Task<?>> tasksToDelete = MutableList.of();
-
-        try {
-            for (Task<?> task: allTasks) {
-                if (!task.isDone()) continue;
-                if (BrooklynTaskTags.isSubTask(task)) continue;
-
-                if (maxTaskAge.isShorterThan(Duration.sinceUtc(task.getEndTimeUtc())))
-                    tasksToDelete.add(task);
-            }
-            
-        } catch (ConcurrentModificationException e) {
-            // delete what we've found so far
-            LOG.debug("Got CME inspecting aged tasks, with "+tasksToDelete.size()+" found for deletion: "+e);
-        }
-        
-        for (Task<?> task: tasksToDelete) {
-            executionManager.deleteTask(task);
-        }
-    }
-    
-    protected void expireTransientTasks() {
-        Set<Task<?>> transientTasks = executionManager.getTasksWithTag(BrooklynTaskTags.TRANSIENT_TASK_TAG);
-        for (Task<?> t: transientTasks) {
-            if (!t.isDone()) continue;
-            executionManager.deleteTask(t);
-        }
-    }
-    
-    protected int expireSubTasksWhoseSubmitterIsExpired() {
-        // ideally we wouldn't have this; see comments on CHECK_SUBTASK_SUBMITTERS
-        if (!brooklynProperties.getConfig(CHECK_SUBTASK_SUBMITTERS))
-            return 0;
-        
-        Collection<Task<?>> allTasks = executionManager.allTasksLive();
-        Collection<Task<?>> tasksToDelete = MutableList.of();
-        try {
-            for (Task<?> task: allTasks) {
-                if (!task.isDone()) continue;
-                Task<?> submitter = task.getSubmittedByTask();
-                // if we've leaked, ie a subtask which is not a child task, 
-                // and the submitter is GC'd, then delete this also
-                if (submitter!=null && submitter.isDone() && executionManager.getTask(submitter.getId())==null) {
-                    tasksToDelete.add(task);
-                }
-            }
-            
-        } catch (ConcurrentModificationException e) {
-            // delete what we've found so far
-            LOG.debug("Got CME inspecting aged tasks, with "+tasksToDelete.size()+" found for deletion: "+e);
-        }
-        
-        for (Task<?> task: tasksToDelete) {
-            executionManager.deleteTask(task);
-        }
-        return tasksToDelete.size();
-    }
-    
-    protected enum TagCategory { 
-        ENTITY, NON_ENTITY_NORMAL;
-        
-        public boolean acceptsTag(Object tag) {
-            if (isTagIgnoredForGc(tag)) return false;
-            if (tag instanceof WrappedEntity) return this==ENTITY;
-            if (this==ENTITY) return false;
-            return true;
-        }
-    } 
-
-
-    /** expires tasks which are over-capacity in all their non-entity tag categories, returned count */
-    protected int expireOverCapacityTagsInCategory(Map<Object, AtomicInteger> taskTagsInCategoryOverCapacity, Map<Object, AtomicInteger> taskAllTagsOverCapacity, TagCategory category, boolean emptyFilterNeeded) {
-        if (emptyFilterNeeded) {
-            // previous run may have decremented counts  
-            MutableList<Object> nowOkayTags = MutableList.of(); 
-            for (Map.Entry<Object,AtomicInteger> entry: taskTagsInCategoryOverCapacity.entrySet()) {
-                if (entry.getValue().get()<=0) nowOkayTags.add(entry.getKey());
-            }
-            for (Object tag: nowOkayTags) taskTagsInCategoryOverCapacity.remove(tag);
-        }
-        
-        if (taskTagsInCategoryOverCapacity.isEmpty())
-            return 0;
-        
-        Collection<Task<?>> tasks = executionManager.allTasksLive();
-        List<Task<?>> tasksToConsiderDeleting = MutableList.of();
-        try {
-            for (Task<?> task: tasks) {
-                if (!task.isDone()) continue;
-                
-                Set<Object> tags = task.getTags();
-
-                int categoryTags = 0, tooFullCategoryTags = 0;
-                for (Object tag: tags) {
-                    if (category.acceptsTag(tag)) {
-                        categoryTags++;
-                        if (taskTagsInCategoryOverCapacity.containsKey(tag))
-                            tooFullCategoryTags++;
-                    }
-                }
-                if (tooFullCategoryTags>0) {
-                    if (categoryTags==tooFullCategoryTags) {
-                        // all buckets are full, delete this one
-                        tasksToConsiderDeleting.add(task);
-                    } else {
-                        // if any bucket is under capacity, then give grace to the other buckets in this category
-                        for (Object tag: tags) {
-                            if (category.acceptsTag(tag)) {
-                                AtomicInteger over = taskTagsInCategoryOverCapacity.get(tag);
-                                if (over!=null) {
-                                    if (over.decrementAndGet()<=0) {
-                                        // and remove it from over-capacity if so
-                                        taskTagsInCategoryOverCapacity.remove(tag);
-                                        if (taskTagsInCategoryOverCapacity.isEmpty())
-                                            return 0;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-        } catch (ConcurrentModificationException e) {
-            // do CME's happen with these data structures?
-            // if so, let's just delete what we've found so far
-            LOG.debug("Got CME inspecting tasks, with "+tasksToConsiderDeleting.size()+" found for deletion: "+e);
-        }
-
-        if (LOG.isDebugEnabled())
-            LOG.debug("brooklyn-gc detected "+taskTagsInCategoryOverCapacity.size()+" "+category+" "
-                    + "tags over capacity, expiring old tasks; "
-                    + tasksToConsiderDeleting.size()+" tasks under consideration; categories are: "
-                    + taskTagsInCategoryOverCapacity);
-
-        Collections.sort(tasksToConsiderDeleting, TASKS_OLDEST_FIRST_COMPARATOR);
-        // now try deleting tasks which are overcapacity for each (non-entity) tag
-        int deleted = 0;
-        for (Task<?> task: tasksToConsiderDeleting) {
-            boolean delete = true;
-            for (Object tag: task.getTags()) {
-                if (!category.acceptsTag(tag))
-                    continue;
-                if (taskTagsInCategoryOverCapacity.get(tag)==null) {
-                    // no longer over capacity in this tag
-                    delete = false;
-                    break;
-                }
-            }
-            if (delete) {
-                // delete this and update overcapacity info
-                deleted++;
-                executionManager.deleteTask(task);
-                for (Object tag: task.getTags()) {
-                    AtomicInteger counter = taskAllTagsOverCapacity.get(tag);
-                    if (counter!=null && counter.decrementAndGet()<=0)
-                        taskTagsInCategoryOverCapacity.remove(tag);
-                }
-                if (LOG.isTraceEnabled())
-                    LOG.trace("brooklyn-gc deleted "+task+", buckets now "+taskTagsInCategoryOverCapacity);
-                if (taskTagsInCategoryOverCapacity.isEmpty())
-                    break;
-            }
-        }
-
-        if (LOG.isDebugEnabled())
-            LOG.debug("brooklyn-gc deleted "+deleted+" tasks in over-capacity " + category+" tag categories; "
-                    + "capacities now: " + taskTagsInCategoryOverCapacity);
-        return deleted;
-    }
-
-    protected int expireIfOverCapacityGlobally() {
-        Collection<Task<?>> tasksLive = executionManager.allTasksLive();
-        if (tasksLive.size() <= brooklynProperties.getConfig(MAX_TASKS_GLOBAL))
-            return 0;
-        LOG.debug("brooklyn-gc detected "+tasksLive.size()+" tasks in memory, over global limit, looking at deleting some");
-        
-        try {
-            tasksLive = MutableList.copyOf(tasksLive);
-        } catch (ConcurrentModificationException e) {
-            tasksLive = executionManager.getTasksWithAllTags(MutableList.of());
-        }
-
-        MutableList<Task<?>> tasks = MutableList.of();
-        for (Task<?> task: tasksLive) {
-            if (task.isDone()) {
-                tasks.add(task);
-            }
-        }
-        
-        int numToDelete = tasks.size() - brooklynProperties.getConfig(MAX_TASKS_GLOBAL);
-        if (numToDelete <= 0) {
-            LOG.debug("brooklyn-gc detected only "+tasks.size()+" completed tasks in memory, not over global limit, so not deleting any");
-            return 0;
-        }
-            
-        Collections.sort(tasks, TASKS_OLDEST_FIRST_COMPARATOR);
-        
-        int numDeleted = 0;
-        while (numDeleted < numToDelete && tasks.size()>numDeleted) {
-            executionManager.deleteTask( tasks.get(numDeleted++) );
-        }
-        if (LOG.isDebugEnabled())
-            LOG.debug("brooklyn-gc deleted "+numDeleted+" tasks as was over global limit, now have "+executionManager.allTasksLive().size());
-        return numDeleted;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagementMode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagementMode.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagementMode.java
deleted file mode 100644
index 4c56515..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagementMode.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 org.apache.brooklyn.core.mgmt.internal;
-
-/** Indicates how an entity/location/adjunct is treated at a given {@link ManagementContext} */
-public enum BrooklynObjectManagementMode {
-    /** item does not exist, not in memory, nor persisted (e.g. creating for first time, or finally destroying) */
-    NONEXISTENT, 
-    /** item exists or existed elsewhere, i.e. there is persisted state, but is not loaded here */
-    UNMANAGED_PERSISTED, 
-    /** item is loaded but read-only (ie not actively managed here) */
-    LOADED_READ_ONLY, 
-    /** item is actively managed here */
-    MANAGED_PRIMARY 
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagerInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagerInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagerInternal.java
deleted file mode 100644
index db93b60..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynObjectManagerInternal.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.core.mgmt.internal;
-
-import org.apache.brooklyn.api.objs.BrooklynObject;
-
-public interface BrooklynObjectManagerInternal<T extends BrooklynObject> {
-
-    ManagementTransitionMode getLastManagementTransitionMode(String itemId);
-    void setManagementTransitionMode(T item, ManagementTransitionMode mode);
-
-    /** 
-     * Begins management for the given rebinded root, recursively; 
-     * if rebinding as a read-only copy, {@link #setReadOnly(T, boolean)} should be called prior to this.
-     */
-    void manageRebindedRoot(T item);
-    
-    void unmanage(final T e, final ManagementTransitionMode info);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
deleted file mode 100644
index 91ca5dc..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
+++ /dev/null
@@ -1,244 +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.core.mgmt.internal;
-
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
-import org.apache.brooklyn.util.javalang.Threads;
-import org.apache.brooklyn.util.time.CountdownTimer;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
-
-public class BrooklynShutdownHooks {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynShutdownHooks.class);
-
-    private static final Duration DEFAULT_SHUTDOWN_TIMEOUT = Duration.TWO_MINUTES;
-    
-    private static final AtomicBoolean isShutdownHookRegistered = new AtomicBoolean();
-    private static final List<Entity> entitiesToStopOnShutdown = Lists.newArrayList();
-    private static final List<ManagementContext> managementContextsToStopAppsOnShutdown = Lists.newArrayList();
-    private static final List<ManagementContext> managementContextsToTerminateOnShutdown = Lists.newArrayList();
-    private static final AtomicBoolean isShutDown = new AtomicBoolean(false);
-
-//    private static final Object mutex = new Object();
-    private static final Semaphore semaphore = new Semaphore(1);
-    
-    /**
-     * Max time to wait for shutdown to complete, when stopping the entities from {@link #invokeStopOnShutdown(Entity)}.
-     * Default is two minutes - deliberately long because stopping cloud VMs can often take a minute.
-     */
-    private static volatile Duration shutdownTimeout = DEFAULT_SHUTDOWN_TIMEOUT;
-    
-    public static void setShutdownTimeout(Duration val) {
-        shutdownTimeout = val;
-    }
-    
-    public static void invokeStopOnShutdown(Entity entity) {
-        if (!(entity instanceof Startable)) {
-            log.warn("Not adding entity {} for stop-on-shutdown as not an instance of {}", entity, Startable.class.getSimpleName());
-            return;
-        }
-        try {
-            semaphore.acquire();
-            if (isShutDown.get()) {
-                semaphore.release();
-                try {
-                    log.warn("Call to invokeStopOnShutdown for "+entity+" while system already shutting down; invoking stop now and throwing exception");
-                    Entities.destroy(entity);
-                    throw new IllegalStateException("Call to invokeStopOnShutdown for "+entity+" while system already shutting down");
-                } catch (Exception e) {
-                    throw new IllegalStateException("Call to invokeStopOnShutdown for "+entity+" while system already shutting down, had error: "+e, e);
-                }
-            }
-            
-            try {
-                // TODO should be a weak reference in case it is destroyed before shutdown
-                // (only applied to certain entities started via launcher so not a big leak)
-                entitiesToStopOnShutdown.add(entity);
-            } finally {
-                semaphore.release();
-            }
-            addShutdownHookIfNotAlready();
-            
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    public static void invokeStopAppsOnShutdown(ManagementContext managementContext) {
-        try {
-            semaphore.acquire();
-            if (isShutDown.get()) {
-                semaphore.release();
-                try {
-                    log.warn("Call to invokeStopAppsOnShutdown for "+managementContext+" while system already shutting down; invoking stop now and throwing exception");
-                    destroyAndWait(managementContext.getApplications(), shutdownTimeout);
-                    
-                    throw new IllegalStateException("Call to invokeStopAppsOnShutdown for "+managementContext+" while system already shutting down");
-                } catch (Exception e) {
-                    throw new IllegalStateException("Call to invokeStopAppsOnShutdown for "+managementContext+" while system already shutting down, had error: "+e, e);
-                }
-            }
-            
-            // TODO weak reference, as per above
-            managementContextsToStopAppsOnShutdown.add(managementContext);
-            semaphore.release();
-            addShutdownHookIfNotAlready();
-            
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    public static void invokeTerminateOnShutdown(ManagementContext managementContext) {
-        try {
-            semaphore.acquire();
-            if (isShutDown.get()) {
-                semaphore.release();
-                try {
-                    log.warn("Call to invokeStopOnShutdown for "+managementContext+" while system already shutting down; invoking stop now and throwing exception");
-                    ((ManagementContextInternal)managementContext).terminate();
-                    throw new IllegalStateException("Call to invokeTerminateOnShutdown for "+managementContext+" while system already shutting down");
-                } catch (Exception e) {
-                    throw new IllegalStateException("Call to invokeTerminateOnShutdown for "+managementContext+" while system already shutting down, had error: "+e, e);
-                }
-            }
-            
-            // TODO weak reference, as per above
-            managementContextsToTerminateOnShutdown.add(managementContext);
-            semaphore.release();
-            addShutdownHookIfNotAlready();
-            
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    private static void addShutdownHookIfNotAlready() {
-        if (isShutdownHookRegistered.compareAndSet(false, true)) {
-            Threads.addShutdownHook(BrooklynShutdownHookJob.newInstanceForReal());
-        }
-    }
-    
-    @VisibleForTesting
-    public static class BrooklynShutdownHookJob implements Runnable {
-        
-        final boolean setStaticShutDownFlag;
-        
-        private BrooklynShutdownHookJob(boolean setStaticShutDownFlag) {
-            this.setStaticShutDownFlag = setStaticShutDownFlag;
-        }
-        
-        public static BrooklynShutdownHookJob newInstanceForReal() {
-            return new BrooklynShutdownHookJob(true);
-        }
-        
-        /** testing instance does not actually set the `isShutDown` bit */
-        public static BrooklynShutdownHookJob newInstanceForTesting() {
-            return new BrooklynShutdownHookJob(false);
-        }
-        
-        @Override
-        public void run() {
-            // First stop entities; on interrupt, abort waiting for tasks - but let shutdown hook continue
-            Set<Entity> entitiesToStop = MutableSet.of();
-            try {
-                semaphore.acquire();
-                if (setStaticShutDownFlag) 
-                    isShutDown.set(true);
-                semaphore.release();
-            } catch (Exception e) {
-                throw Exceptions.propagate(e);
-            }
-            entitiesToStop.addAll(entitiesToStopOnShutdown);
-            for (ManagementContext mgmt: managementContextsToStopAppsOnShutdown) {
-                if (mgmt.isRunning()) {
-                    entitiesToStop.addAll(mgmt.getApplications());
-                }
-            }
-            
-            if (entitiesToStop.isEmpty()) {
-                log.debug("Brooklyn shutdown: no entities to stop");
-            } else {
-                log.info("Brooklyn shutdown: stopping entities "+entitiesToStop);
-                destroyAndWait(entitiesToStop, shutdownTimeout);
-            }
-
-            // Then terminate management contexts
-            log.debug("Brooklyn terminateOnShutdown shutdown-hook invoked: terminating management contexts: "+managementContextsToTerminateOnShutdown);
-            for (ManagementContext managementContext: managementContextsToTerminateOnShutdown) {
-                try {
-                    if (!managementContext.isRunning())
-                        continue;
-                    ((ManagementContextInternal)managementContext).terminate();
-                } catch (RuntimeException e) {
-                    log.info("terminateOnShutdown of "+managementContext+" returned error (continuing): "+e, e);
-                }
-            }
-        }
-    }
-    
-    protected static void destroyAndWait(Iterable<? extends Entity> entitiesToStop, Duration timeout) {
-        MutableList<Task<?>> stops = MutableList.of();
-        for (Entity entityToStop: entitiesToStop) {
-            final Entity entity = entityToStop;
-            if (!Entities.isManaged(entity)) continue;
-            Task<Object> t = Tasks.builder().dynamic(false).displayName("destroying "+entity).body(new Runnable() {
-                @Override public void run() { Entities.destroy(entity); }
-            }).build();
-            stops.add( ((EntityInternal)entity).getExecutionContext().submit(t) );
-        }
-        CountdownTimer timer = CountdownTimer.newInstanceStarted(timeout);
-        for (Task<?> t: stops) {
-            try {
-                Duration durationRemaining = timer.getDurationRemaining();
-                Object result = t.getUnchecked(durationRemaining.isPositive() ? durationRemaining : Duration.ONE_MILLISECOND);
-                if (log.isDebugEnabled()) log.debug("stopOnShutdown of {} completed: {}", t, result);
-            } catch (RuntimeInterruptedException e) {
-                Thread.currentThread().interrupt();
-                if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" interrupted: "+e);
-                break;
-            } catch (RuntimeException e) {
-                Exceptions.propagateIfFatal(e);
-                log.warn("Shutdown hook "+t+" returned error (continuing): "+e);
-                if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" returned error (continuing to stop others): "+e, e);
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CampYamlParser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CampYamlParser.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CampYamlParser.java
deleted file mode 100644
index 35841be..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CampYamlParser.java
+++ /dev/null
@@ -1,34 +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.core.mgmt.internal;
-
-import java.util.Map;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-
-public interface CampYamlParser {
-
-    ConfigKey<CampYamlParser> YAML_PARSER_KEY = ConfigKeys.newConfigKey(CampYamlParser.class, "brooklyn.camp.yamlParser");
-
-    Map<String, Object> parse(Map<String, Object> map);
-    
-    Object parse(String val);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CollectionChangeListener.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CollectionChangeListener.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CollectionChangeListener.java
deleted file mode 100644
index 7aa700f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/CollectionChangeListener.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 org.apache.brooklyn.core.mgmt.internal;
-
-public interface CollectionChangeListener<Item> {
-    void onItemAdded(Item item);
-    void onItemRemoved(Item item);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/DeferredBrooklynProperties.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/DeferredBrooklynProperties.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/DeferredBrooklynProperties.java
deleted file mode 100644
index ae0c7a5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/DeferredBrooklynProperties.java
+++ /dev/null
@@ -1,370 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Maps;
-
-/**
- * Delegates to another {@link BrooklynProperties} implementation, but intercepts all calls to get.
- * The results are transformed: if they are in the external-config format then they are 
- * automatically converted to {@link DeferredSupplier}.
- * 
- * The external-config format is that same as that for camp-yaml blueprints (i.e. 
- * {@code $brooklyn:external("myprovider", "mykey")}.
- */
-public class DeferredBrooklynProperties implements BrooklynProperties {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DeferredBrooklynProperties.class);
-
-    private static final String BROOKLYN_YAML_PREFIX = "$brooklyn:";
-    
-    private final BrooklynProperties delegate;
-    private final ManagementContextInternal mgmt;
-
-    public DeferredBrooklynProperties(BrooklynProperties delegate, ManagementContextInternal mgmt) {
-        this.delegate = checkNotNull(delegate, "delegate");
-        this.mgmt = checkNotNull(mgmt, "mgmt");
-    }
-    
-    private Object transform(ConfigKey<?> key, Object value) {
-        if (value instanceof CharSequence) {
-            String raw = value.toString();
-            if (raw.startsWith(BROOKLYN_YAML_PREFIX)) {
-                CampYamlParser parser = mgmt.getConfig().getConfig(CampYamlParser.YAML_PARSER_KEY);
-                if (parser == null) {
-                    // TODO Should we fail or return the untransformed value?
-                    // Problem is this gets called during initialisation, e.g. by BrooklynFeatureEnablement calling asMapWithStringKeys()
-                    // throw new IllegalStateException("Cannot parse external-config for "+key+" because no camp-yaml parser available");
-                    LOG.debug("Not transforming external-config {}, as no camp-yaml parser available", key);
-                    return value;
-                }
-                return parser.parse(raw);
-            }
-        }
-        return value;
-    }
-    
-    private <T> T resolve(ConfigKey<T> key, Object value) {
-        Object transformed = transform(key, value);
-
-        Object result;
-        if (transformed instanceof DeferredSupplier) {
-            ExecutionContext exec = mgmt.getServerExecutionContext();
-            try {
-                result = Tasks.resolveValue(transformed, key.getType(), exec);
-            } catch (ExecutionException | InterruptedException e) {
-                throw Exceptions.propagate(e);
-            }
-        } else {
-            result = transformed;
-        }
-
-        return TypeCoercions.coerce(result, key.getTypeToken());
-    }
-    
-    @Override
-    public <T> T getConfig(ConfigKey<T> key) {
-        T raw = delegate.getConfig(key);
-        return resolve(key, raw);
-    }
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key) {
-        T raw = delegate.getConfig(key);
-        return resolve(key.getConfigKey(), raw);
-    }
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key, T defaultValue) {
-        T raw = delegate.getConfig(key, defaultValue);
-        return resolve(key.getConfigKey(), raw);
-    }
-
-    @Override
-    public <T> T getConfig(ConfigKey<T> key, T defaultValue) {
-        T raw = delegate.getConfig(key, defaultValue);
-        return resolve(key, raw);
-    }
-
-    @Deprecated
-    @Override
-    public Object getRawConfig(ConfigKey<?> key) {
-        return transform(key, delegate.getRawConfig(key));
-    }
-    
-    @Override
-    public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited) {
-        Maybe<Object> result = delegate.getConfigRaw(key, includeInherited);
-        return (result.isPresent()) ? Maybe.of(transform(key, result.get())) : Maybe.absent();
-    }
-
-    @Override
-    public Map<ConfigKey<?>, Object> getAllConfig() {
-        Map<ConfigKey<?>, Object> raw = delegate.getAllConfig();
-        Map<ConfigKey<?>, Object> result = Maps.newLinkedHashMap();
-        for (Map.Entry<ConfigKey<?>, Object> entry : raw.entrySet()) {
-            result.put(entry.getKey(), transform(entry.getKey(), entry.getValue()));
-        }
-        return result;
-    }
-
-    @Override
-    public Map<String, Object> asMapWithStringKeys() {
-        Map<ConfigKey<?>, Object> raw = delegate.getAllConfig();
-        Map<String, Object> result = Maps.newLinkedHashMap();
-        for (Map.Entry<ConfigKey<?>, Object> entry : raw.entrySet()) {
-            result.put(entry.getKey().getName(), transform(entry.getKey(), entry.getValue()));
-        }
-        return result;
-    }
-
-    /**
-     * Discouraged; returns the String so if it is external config, it will be the 
-     * {@code $brooklyn:external(...)} format.
-     */
-    @Override
-    @SuppressWarnings("rawtypes")
-    @Deprecated
-    public String get(Map flags, String key) {
-        return delegate.get(flags, key);
-    }
-
-    /**
-     * Discouraged; returns the String so if it is external config, it will be the 
-     * {@code $brooklyn:external(...)} format.
-     */
-    @Override
-    public String getFirst(String ...keys) {
-        return delegate.getFirst(keys);
-    }
-    
-    /**
-     * Discouraged; returns the String so if it is external config, it will be the 
-     * {@code $brooklyn:external(...)} format.
-     */
-    @Override
-    @SuppressWarnings("rawtypes")
-    public String getFirst(Map flags, String ...keys) {
-        return delegate.getFirst(flags, keys);
-    }
-
-    @Override
-    public BrooklynProperties submap(Predicate<ConfigKey<?>> filter) {
-        BrooklynProperties submap = delegate.submap(filter);
-        return new DeferredBrooklynProperties(submap, mgmt);
-    }
-
-    @Override
-    public BrooklynProperties addEnvironmentVars() {
-        delegate.addEnvironmentVars();
-        return this;
-    }
-
-    @Override
-    public BrooklynProperties addSystemProperties() {
-        delegate.addSystemProperties();
-        return this;
-    }
-
-    @Override
-    public BrooklynProperties addFrom(ConfigBag cfg) {
-        delegate.addFrom(cfg);
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public BrooklynProperties addFrom(Map map) {
-        delegate.addFrom(map);
-        return this;
-    }
-
-    @Override
-    public BrooklynProperties addFrom(InputStream i) {
-        delegate.addFrom(i);
-        return this;
-    }
-    
-    @Override
-    public BrooklynProperties addFrom(File f) {
-        delegate.addFrom(f);
-        return this;
-    }
-    
-    @Override
-    public BrooklynProperties addFrom(URL u) {
-        delegate.addFrom(u);
-        return this;
-    }
-
-    @Override
-    public BrooklynProperties addFromUrl(String url) {
-        delegate.addFromUrl(url);
-        return this;
-    }
-
-    @Override
-    public BrooklynProperties addFromUrlProperty(String urlProperty) {
-        delegate.addFromUrlProperty(urlProperty);
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public BrooklynProperties addFromMap(Map properties) {
-        delegate.addFromMap(properties);
-        return this;
-    }
-
-    @Override
-    public boolean putIfAbsent(String key, Object value) {
-        return delegate.putIfAbsent(key, value);
-    }
-
-    @Override
-    public String toString() {
-        return delegate.toString();
-    }
-
-    @Override
-    public Object put(Object key, Object value) {
-        return delegate.put(key, value);
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public void putAll(Map vals) {
-        delegate.putAll(vals);
-    }
-    
-    @Override
-    public <T> Object put(HasConfigKey<T> key, T value) {
-        return delegate.put(key, value);
-    }
-
-    @Override
-    public <T> Object put(ConfigKey<T> key, T value) {
-        return delegate.put(key, value);
-    }
-    
-    @Override
-    public <T> boolean putIfAbsent(ConfigKey<T> key, T value) {
-        return delegate.putIfAbsent(key, value);
-    }
-    
-    
-    //////////////////////////////////////////////////////////////////////////////////
-    // Methods below from java.util.LinkedHashMap, which BrooklynProperties extends //
-    //////////////////////////////////////////////////////////////////////////////////
-    
-    @Override
-    public int size() {
-        return delegate.size();
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return delegate.isEmpty();
-    }
-
-    @Override
-    public boolean containsKey(Object key) {
-        return delegate.containsKey(key);
-    }
-
-    @Override
-    public boolean containsValue(Object value) {
-        return delegate.containsValue(value);
-    }
-
-    @Override
-    public Object get(Object key) {
-        return delegate.get(key);
-    }
-
-    @Override
-    public Object remove(Object key) {
-        return delegate.remove(key);
-    }
-
-    @Override
-    public void clear() {
-        delegate.clear();
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public Set keySet() {
-        return delegate.keySet();
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public Collection values() {
-        return delegate.values();
-    }
-    
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Set<Map.Entry> entrySet() {
-        return delegate.entrySet();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        return delegate.equals(o);
-    }
-
-    @Override
-    public int hashCode() {
-        return delegate.hashCode();
-    }
-    
-    // put(Object, Object) already overridden
-    //@Override
-    //public Object put(Object key, Object value) {
-
-    // putAll(Map) already overridden
-    //@Override
-    //public void putAll(Map m) {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EffectorUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EffectorUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EffectorUtils.java
deleted file mode 100644
index f8bb7cb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/EffectorUtils.java
+++ /dev/null
@@ -1,363 +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.core.mgmt.internal;
-
-import static org.apache.brooklyn.util.groovy.GroovyJavaMethods.truth;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.effector.BasicParameterType;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * Utility methods for invoking effectors.
- */
-public class EffectorUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(EffectorUtils.class);
-
-    /** prepares arguments for an effector either accepting:
-     *  an array, which should contain the arguments in order, optionally omitting those which have defaults defined;
-     *  or a map, which should contain the arguments by name, again optionally omitting those which have defaults defined,
-     *  and in this case also performing type coercion.
-     */
-    public static Object[] prepareArgsForEffector(Effector<?> eff, Object args) {
-        if (args != null && args.getClass().isArray()) {
-            return prepareArgsForEffectorFromArray(eff, (Object[]) args);
-        }
-        if (args instanceof Map) {
-            return prepareArgsForEffectorFromMap(eff, (Map) args);
-        }
-        log.warn("Deprecated effector invocation style for call to "+eff+", expecting a map or an array, got: "+args);
-        if (log.isDebugEnabled()) {
-            log.debug("Deprecated effector invocation style for call to "+eff+", expecting a map or an array, got: "+args,
-                new Throwable("Trace for deprecated effector invocation style"));
-        }
-        return oldPrepareArgsForEffector(eff, args);
-    }
-
-    /** method used for calls such as   entity.effector(arg1, arg2)
-     * get routed here from AbstractEntity.invokeMethod */
-    private static Object[] prepareArgsForEffectorFromArray(Effector<?> eff, Object args[]) {
-        int newArgsNeeded = eff.getParameters().size();
-        if (args.length==1 && args[0] instanceof Map) {
-            if (newArgsNeeded!=1 || !eff.getParameters().get(0).getParameterClass().isAssignableFrom(args[0].getClass())) {
-                // treat a map in an array as a map passed directly (unless the method takes a single-arg map)
-                // this is to support   effector(param1: val1)
-                return prepareArgsForEffectorFromMap(eff, (Map) args[0]);
-            }
-        }
-        return prepareArgsForEffectorAsMapFromArray(eff, args).values().toArray(new Object[0]);
-    }
-
-    public static Map prepareArgsForEffectorAsMapFromArray(Effector<?> eff, Object args[]) {
-        int newArgsNeeded = eff.getParameters().size();
-        List l = Lists.newArrayList();
-        l.addAll(Arrays.asList(args));
-        Map newArgs = new LinkedHashMap();
-
-        for (int index = 0; index < eff.getParameters().size(); index++) {
-            ParameterType<?> it = eff.getParameters().get(index);
-
-            if (l.size() >= newArgsNeeded) {
-                //all supplied (unnamed) arguments must be used; ignore map
-                newArgs.put(it.getName(), l.remove(0));
-                // TODO do we ignore arguments in the same order that groovy does?
-            } else if (!l.isEmpty() && it.getParameterClass().isInstance(l.get(0))) {
-                //if there are parameters supplied, and type is correct, they get applied before default values
-                //(this is akin to groovy)
-                newArgs.put(it.getName(), l.remove(0));
-            } else if (it instanceof BasicParameterType && ((BasicParameterType)it).hasDefaultValue()) {
-                //finally, default values are used to make up for missing parameters
-                newArgs.put(it.getName(), ((BasicParameterType)it).getDefaultValue());
-            } else {
-                throw new IllegalArgumentException("Invalid arguments (count mismatch) for effector "+eff+": "+args);
-            }
-
-            newArgsNeeded--;
-        }
-        if (newArgsNeeded > 0) {
-            throw new IllegalArgumentException("Invalid arguments (missing "+newArgsNeeded+") for effector "+eff+": "+args);
-        }
-        if (!l.isEmpty()) {
-            throw new IllegalArgumentException("Invalid arguments ("+l.size()+" extra) for effector "+eff+": "+args);
-        }
-        return newArgs;
-    }
-
-    private static Object[] prepareArgsForEffectorFromMap(Effector<?> eff, Map m) {
-        m = Maps.newLinkedHashMap(m); //make editable copy
-        List newArgs = Lists.newArrayList();
-        int newArgsNeeded = eff.getParameters().size();
-
-        for (int index = 0; index < eff.getParameters().size(); index++) {
-            ParameterType<?> it = eff.getParameters().get(index);
-            Object v;
-            if (truth(it.getName()) && m.containsKey(it.getName())) {
-                // argument is in the map
-                v = m.remove(it.getName());
-            } else if (it instanceof BasicParameterType && ((BasicParameterType)it).hasDefaultValue()) {
-                //finally, default values are used to make up for missing parameters
-                v = ((BasicParameterType)it).getDefaultValue();
-            } else {
-                throw new IllegalArgumentException("Invalid arguments (missing argument "+it+") for effector "+eff+": "+m);
-            }
-
-            newArgs.add(TypeCoercions.coerce(v, it.getParameterClass()));
-            newArgsNeeded--;
-        }
-        if (newArgsNeeded>0)
-            throw new IllegalArgumentException("Invalid arguments (missing "+newArgsNeeded+") for effector "+eff+": "+m);
-        if (!m.isEmpty()) {
-            log.warn("Unsupported parameter to "+eff+" (ignoring): "+m);
-        }
-        return newArgs.toArray(new Object[newArgs.size()]);
-    }
-
-    /**
-     * Takes arguments, and returns an array of arguments suitable for use by the Effector
-     * according to the ParameterTypes it exposes.
-     * <p>
-     * The args can be:
-     * <ol>
-     * <li>an array of ordered arguments
-     * <li>a collection (which will be automatically converted to an array)
-     * <li>a single argument (which will then be wrapped in an array)
-     * <li>a map containing the (named) arguments
-     * <li>an array or collection single entry of a map (treated same as 5 above)
-     * <li>a semi-populated array or collection that also containing a map as first arg -
-     *     uses ordered args in array, but uses named values from map in preference.
-     * <li>semi-populated array or collection, where default values will otherwise be used.
-     * </ol>
-     */
-    public static Object[] oldPrepareArgsForEffector(Effector<?> eff, Object args) {
-        //attempt to coerce unexpected types
-        Object[] argsArray;
-        if (args==null) {
-            argsArray = new Object[0];
-        } else if (args.getClass().isArray()) {
-            argsArray = (Object[]) args;
-        } else {
-            if (args instanceof Collection) {
-                argsArray = ((Collection) args).toArray(new Object[((Collection) args).size()]);
-            } else {
-                argsArray = new Object[] { args };
-            }
-        }
-
-        //if args starts with a map, assume it contains the named arguments
-        //(but only use it when we have insufficient supplied arguments)
-        List l = Lists.newArrayList();
-        l.addAll(Arrays.asList(argsArray));
-        Map m = (argsArray.length > 0 && argsArray[0] instanceof Map ? Maps.newLinkedHashMap((Map) l.remove(0)) : null);
-        List newArgs = Lists.newArrayList();
-        int newArgsNeeded = eff.getParameters().size();
-        boolean mapUsed = false;
-
-        for (int index = 0; index < eff.getParameters().size(); index++) {
-            ParameterType<?> it = eff.getParameters().get(index);
-
-            if (l.size() >= newArgsNeeded) {
-                //all supplied (unnamed) arguments must be used; ignore map
-                newArgs.add(l.remove(0));
-            } else if (truth(m) && truth(it.getName()) && m.containsKey(it.getName())) {
-                //some arguments were not supplied, and this one is in the map
-                newArgs.add(m.remove(it.getName()));
-            } else if (index == 0 && Map.class.isAssignableFrom(it.getParameterClass())) {
-                //if first arg is a map it takes the supplied map
-                newArgs.add(m);
-                mapUsed = true;
-            } else if (!l.isEmpty() && it.getParameterClass().isInstance(l.get(0))) {
-                //if there are parameters supplied, and type is correct, they get applied before default values
-                //(this is akin to groovy)
-                newArgs.add(l.remove(0));
-            } else if (it instanceof BasicParameterType && ((BasicParameterType)it).hasDefaultValue()) {
-                //finally, default values are used to make up for missing parameters
-                newArgs.add(((BasicParameterType)it).getDefaultValue());
-            } else {
-                throw new IllegalArgumentException("Invalid arguments (count mismatch) for effector "+eff+": "+args);
-            }
-
-            newArgsNeeded--;
-        }
-        if (newArgsNeeded > 0) {
-            throw new IllegalArgumentException("Invalid arguments (missing "+newArgsNeeded+") for effector "+eff+": "+args);
-        }
-        if (!l.isEmpty()) {
-            throw new IllegalArgumentException("Invalid arguments ("+l.size()+" extra) for effector "+eff+": "+args);
-        }
-        if (truth(m) && !mapUsed) {
-            throw new IllegalArgumentException("Invalid arguments ("+m.size()+" extra named) for effector "+eff+": "+args);
-        }
-        return newArgs.toArray(new Object[newArgs.size()]);
-    }
-
-    /**
-     * Invokes a method effector so that its progress is tracked. For internal use only, when we know the effector is backed by a method which is local.
-     */
-    public static <T> T invokeMethodEffector(Entity entity, Effector<T> eff, Object[] args) {
-        String name = eff.getName();
-
-        try {
-            if (log.isDebugEnabled()) log.debug("Invoking effector {} on {}", new Object[] {name, entity});
-            if (log.isTraceEnabled()) log.trace("Invoking effector {} on {} with args {}", new Object[] {name, entity, args});
-            EntityManagementSupport mgmtSupport = ((EntityInternal)entity).getManagementSupport();
-            if (!mgmtSupport.isDeployed()) {
-                mgmtSupport.attemptLegacyAutodeployment(name);
-            }
-            ManagementContextInternal mgmtContext = (ManagementContextInternal) ((EntityInternal) entity).getManagementContext();
-
-            mgmtSupport.getEntityChangeListener().onEffectorStarting(eff, args);
-            try {
-                return mgmtContext.invokeEffectorMethodSync(entity, eff, args);
-            } finally {
-                mgmtSupport.getEntityChangeListener().onEffectorCompleted(eff);
-            }
-        } catch (Exception e) {
-            handleEffectorException(entity, eff, e);
-            // (won't return below)
-            return null;
-        }
-    }
-
-    public static void handleEffectorException(Entity entity, Effector<?> effector, Throwable throwable) {
-        String message = "Error invoking " + effector.getName() + " at " + entity;
-        // Avoid throwing a PropagatedRuntimeException that just repeats the last PropagatedRuntimeException.
-        if (throwable instanceof PropagatedRuntimeException &&
-                throwable.getMessage() != null &&
-                throwable.getMessage().startsWith(message)) {
-            throw PropagatedRuntimeException.class.cast(throwable);
-        } else {
-            log.warn(message + ": " + Exceptions.collapseText(throwable));
-            throw new PropagatedRuntimeException(message, throwable);
-        }
-    }
-
-    public static <T> Task<T> invokeEffectorAsync(Entity entity, Effector<T> eff, Map<String,?> parameters) {
-        String name = eff.getName();
-
-        if (log.isDebugEnabled()) log.debug("Invoking-async effector {} on {}", new Object[] { name, entity });
-        if (log.isTraceEnabled()) log.trace("Invoking-async effector {} on {} with args {}", new Object[] { name, entity, parameters });
-        EntityManagementSupport mgmtSupport = ((EntityInternal)entity).getManagementSupport();
-        if (!mgmtSupport.isDeployed()) {
-            mgmtSupport.attemptLegacyAutodeployment(name);
-        }
-        ManagementContextInternal mgmtContext = (ManagementContextInternal) ((EntityInternal)entity).getManagementContext();
-
-        // FIXME seems brittle to have the listeners in the Utils method; better to move into the context.invokeEff
-        // (or whatever the last mile before invoking the effector is - though currently there is not such a canonical place!)
-        mgmtSupport.getEntityChangeListener().onEffectorStarting(eff, parameters);
-        try {
-            return mgmtContext.invokeEffector(entity, eff, parameters);
-        } finally {
-            // FIXME this is really Effector submitted
-            mgmtSupport.getEntityChangeListener().onEffectorCompleted(eff);
-        }
-    }
-
-    /** @deprecated since 0.7.0, not used */
-    @Deprecated
-    public static Effector<?> findEffectorMatching(Entity entity, Method method) {
-        outer: for (Effector<?> effector : entity.getEntityType().getEffectors()) {
-            if (!effector.getName().equals(entity)) continue;
-            if (effector.getParameters().size() != method.getParameterTypes().length) continue;
-            for (int i = 0; i < effector.getParameters().size(); i++) {
-                if (effector.getParameters().get(i).getParameterClass() != method.getParameterTypes()[i]) continue outer;
-            }
-            return effector;
-        }
-        return null;
-    }
-
-    /** @deprecated since 0.7.0, expects parameters but does not use them! */
-    @Deprecated
-    public static Effector<?> findEffectorMatching(Set<Effector<?>> effectors, String effectorName, Map<String, ?> parameters) {
-        // TODO Support overloading: check parameters as well
-        for (Effector<?> effector : effectors) {
-            if (effector.getName().equals(effectorName)) {
-                return effector;
-            }
-        }
-        return null;
-    }
-
-    /** matches effectors by name only (not parameters) */
-    public static Maybe<Effector<?>> findEffector(Collection<? extends Effector<?>> effectors, String effectorName) {
-        for (Effector<?> effector : effectors) {
-            if (effector.getName().equals(effectorName)) {
-                return Maybe.<Effector<?>>of(effector);
-            }
-        }
-        return Maybe.absent(new NoSuchElementException("No effector with name "+effectorName+" (contenders "+effectors+")"));
-    }
-
-    /** matches effectors by name only (not parameters), based on what is declared on the entity static type */
-    public static Maybe<Effector<?>> findEffectorDeclared(Entity entity, String effectorName) {
-        return findEffector(entity.getEntityType().getEffectors(), effectorName);
-    }
-
-    /** @deprecated since 0.7.0 use {@link #getTaskFlagsForEffectorInvocation(Entity, Effector, ConfigBag)} */
-    public static Map<Object,Object> getTaskFlagsForEffectorInvocation(Entity entity, Effector<?> effector) {
-        return getTaskFlagsForEffectorInvocation(entity, effector, null);
-    }
-    
-    /** returns a (mutable) map of the standard flags which should be placed on an effector */
-    public static Map<Object,Object> getTaskFlagsForEffectorInvocation(Entity entity, Effector<?> effector, ConfigBag parameters) {
-        List<Object> tags = MutableList.of(
-                BrooklynTaskTags.EFFECTOR_TAG,
-                BrooklynTaskTags.tagForEffectorCall(entity, effector.getName(), parameters),
-                BrooklynTaskTags.tagForTargetEntity(entity));
-        if (Entitlements.getEntitlementContext() != null) {
-            tags.add(BrooklynTaskTags.tagForEntitlement(Entitlements.getEntitlementContext()));
-        }
-        return MutableMap.builder()
-                .put("description", "Invoking effector "+effector.getName()
-                    +" on "+entity.getDisplayName()
-                    +(parameters!=null ? " with parameters "+parameters.getAllConfig() : ""))
-                .put("displayName", effector.getName())
-                .put("tags", tags)
-                .build();
-    }
-
-}


[19/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
deleted file mode 100644
index 5422fb6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ /dev/null
@@ -1,2144 +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.core.entity;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.entity.EntityType;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.EntityManager;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.BrooklynLogging;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.config.ConfigConstraints;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.core.enricher.AbstractEnricher;
-import org.apache.brooklyn.core.entity.internal.EntityConfigMap;
-import org.apache.brooklyn.core.entity.lifecycle.PolicyDescriptor;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceNotUpLogic;
-import org.apache.brooklyn.core.feed.AbstractFeed;
-import org.apache.brooklyn.core.feed.ConfigToAttributes;
-import org.apache.brooklyn.core.internal.BrooklynInitialization;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.internal.storage.Reference;
-import org.apache.brooklyn.core.internal.storage.impl.BasicReference;
-import org.apache.brooklyn.core.location.Locations;
-import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagementSupport;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.internal.SubscriptionTracker;
-import org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport;
-import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
-import org.apache.brooklyn.core.objs.AbstractConfigurationSupportInternal;
-import org.apache.brooklyn.core.objs.AbstractEntityAdjunct;
-import org.apache.brooklyn.core.objs.AbstractEntityAdjunct.AdjunctTagSupport;
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-import org.apache.brooklyn.core.sensor.AttributeMap;
-import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.collections.SetFromLiveMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.Equals;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * Default {@link Entity} implementation, which should be extended whenever implementing an entity.
- * <p>
- * Provides several common fields ({@link #displayName}, {@link #id}), and supports the core features of
- * an entity such as configuration keys, attributes, subscriptions and effector invocation.
- * <p>
- * If a sub-class is creating other entities, this should be done in an overridden {@link #init()}
- * method.
- * <p>
- * Note that config is typically inherited by children, whereas the fields and attributes are not.
- * <p>
- * Sub-classes should have a no-argument constructor. When brooklyn creates an entity, it will:
- * <ol>
- *   <li>Construct the entity via the no-argument constructor
- *   <li>Call {@link #setDisplayName(String)}
- *   <li>Call {@link #setManagementContext(ManagementContextInternal)}
- *   <li>Call {@link #setProxy(Entity)}; the proxy should be used by everything else when referring 
- *       to this entity (except for drivers/policies that are attached to the entity, which can be  
- *       given a reference to this entity itself).
- *   <li>Call {@link #configure(Map)} and then {@link #setConfig(ConfigKey, Object)}
- *   <li>Call {@link #init()}
- *   <li>Call {@link #addPolicy(Policy)} (for any policies defined in the {@link EntitySpec})
- *   <li>Call {@link #setParent(Entity)}, if a parent is specified in the {@link EntitySpec}
- * </ol>
- * <p>
- * The legacy (pre 0.5) mechanism for creating entities is for others to call the constructor directly.
- * This is now deprecated.
- */
-public abstract class AbstractEntity extends AbstractBrooklynObject implements EntityLocal, EntityInternal {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractEntity.class);
-    
-    static { BrooklynInitialization.initAll(); }
-    
-    public static final BasicNotificationSensor<Location> LOCATION_ADDED = new BasicNotificationSensor<Location>(
-            Location.class, "entity.location.added", "Location dynamically added to entity");
-    public static final BasicNotificationSensor<Location> LOCATION_REMOVED = new BasicNotificationSensor<Location>(
-            Location.class, "entity.location.removed", "Location dynamically removed from entity");
-
-    @SuppressWarnings("rawtypes")
-    public static final BasicNotificationSensor<Sensor> SENSOR_ADDED = new BasicNotificationSensor<Sensor>(Sensor.class,
-            "entity.sensor.added", "Sensor dynamically added to entity");
-    @SuppressWarnings("rawtypes")
-    public static final BasicNotificationSensor<Sensor> SENSOR_REMOVED = new BasicNotificationSensor<Sensor>(Sensor.class,
-            "entity.sensor.removed", "Sensor dynamically removed from entity");
-
-    public static final BasicNotificationSensor<String> EFFECTOR_ADDED = new BasicNotificationSensor<String>(String.class,
-            "entity.effector.added", "Effector dynamically added to entity");
-    public static final BasicNotificationSensor<String> EFFECTOR_REMOVED = new BasicNotificationSensor<String>(String.class,
-            "entity.effector.removed", "Effector dynamically removed from entity");
-    public static final BasicNotificationSensor<String> EFFECTOR_CHANGED = new BasicNotificationSensor<String>(String.class,
-            "entity.effector.changed", "Effector dynamically changed on entity");
-
-    @SuppressWarnings("rawtypes")
-    public static final BasicNotificationSensor<ConfigKey> CONFIG_KEY_ADDED = new BasicNotificationSensor<ConfigKey>(ConfigKey.class,
-            "entity.config_key.added", "ConfigKey dynamically added to entity");
-    @SuppressWarnings("rawtypes")
-    public static final BasicNotificationSensor<ConfigKey> CONFIG_KEY_REMOVED = new BasicNotificationSensor<ConfigKey>(ConfigKey.class,
-            "entity.config_key.removed", "ConfigKey dynamically removed from entity");
-
-    public static final BasicNotificationSensor<PolicyDescriptor> POLICY_ADDED = new BasicNotificationSensor<PolicyDescriptor>(PolicyDescriptor.class,
-            "entity.policy.added", "Policy dynamically added to entity");
-    public static final BasicNotificationSensor<PolicyDescriptor> POLICY_REMOVED = new BasicNotificationSensor<PolicyDescriptor>(PolicyDescriptor.class,
-            "entity.policy.removed", "Policy dynamically removed from entity");
-
-    public static final BasicNotificationSensor<Entity> CHILD_ADDED = new BasicNotificationSensor<Entity>(Entity.class,
-            "entity.children.added", "Child dynamically added to entity");
-    public static final BasicNotificationSensor<Entity> CHILD_REMOVED = new BasicNotificationSensor<Entity>(Entity.class,
-            "entity.children.removed", "Child dynamically removed from entity");
-
-    public static final BasicNotificationSensor<Group> GROUP_ADDED = new BasicNotificationSensor<Group>(Group.class,
-            "entity.group.added", "Group dynamically added to entity");
-    public static final BasicNotificationSensor<Group> GROUP_REMOVED = new BasicNotificationSensor<Group>(Group.class,
-            "entity.group.removed", "Group dynamically removed from entity");
-    
-    static {
-        RendererHints.register(Entity.class, RendererHints.displayValue(EntityFunctions.displayName()));
-    }
-        
-    private boolean displayNameAutoGenerated = true;
-    
-    private Entity selfProxy;
-    private volatile Application application;
-    
-    // If FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE, then these are just temporary values 
-    // (but may still be needed if something, such as an EntityFactory in a cluster/fabric, did not
-    // use EntitySpec.
-    // If that feature is disabled, then these are not "temporary" values - these are the production
-    // values. They must be thread-safe, and where necessary (e.g. group) they should preserve order
-    // if possible.
-    private Reference<Entity> parent = new BasicReference<Entity>();
-    private Set<Group> groupsInternal = Collections.synchronizedSet(Sets.<Group>newLinkedHashSet());
-    private Set<Entity> children = Collections.synchronizedSet(Sets.<Entity>newLinkedHashSet());
-    private Reference<List<Location>> locations = new BasicReference<List<Location>>(ImmutableList.<Location>of()); // dups removed in addLocations
-    private Reference<Long> creationTimeUtc = new BasicReference<Long>(System.currentTimeMillis());
-    private Reference<String> displayName = new BasicReference<String>();
-    private Reference<String> iconUrl = new BasicReference<String>();
-
-    private Collection<AbstractPolicy> policiesInternal = Lists.newCopyOnWriteArrayList();
-    private Collection<AbstractEnricher> enrichersInternal = Lists.newCopyOnWriteArrayList();
-    Collection<Feed> feeds = Lists.newCopyOnWriteArrayList();
-
-    // FIXME we do not currently support changing parents, but to implement a cluster that can shrink we need to support at least
-    // orphaning (i.e. removing ownership). This flag notes if the entity has previously had a parent, and if an attempt is made to
-    // set a new parent an exception will be thrown.
-    boolean previouslyOwned = false;
-
-    /**
-     * Whether we are still being constructed, in which case never warn in "assertNotYetOwned"
-     */
-    private boolean inConstruction = true;
-    
-    private final EntityDynamicType entityType;
-    
-    protected final EntityManagementSupport managementSupport = new EntityManagementSupport(this);
-
-    private final BasicConfigurationSupport config = new BasicConfigurationSupport();
-
-    private final BasicSensorSupport sensors = new BasicSensorSupport();
-
-    private final BasicSubscriptionSupport subscriptions = new BasicSubscriptionSupport();
-
-    private final BasicPolicySupport policies = new BasicPolicySupport();
-
-    private final BasicEnricherSupport enrichers = new BasicEnricherSupport();
-
-    private final BasicGroupSupport groups = new BasicGroupSupport();
-
-    /**
-     * The config values of this entity. Updating this map should be done
-     * via getConfig/setConfig.
-     */
-    // If FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE, this value will be only temporary.
-    private EntityConfigMap configsInternal = new EntityConfigMap(this);
-
-    /**
-     * The sensor-attribute values of this entity. Updating this map should be done
-     * via getAttribute/setAttribute; it will automatically emit an attribute-change event.
-     */
-    // If FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE, this value will be only temporary.
-    private AttributeMap attributesInternal = new AttributeMap(this);
-
-    /**
-     * For temporary data, e.g. timestamps etc for calculating real attribute values, such as when
-     * calculating averages over time etc.
-     * 
-     * @deprecated since 0.6; use attributes
-     */
-    @Deprecated
-    protected final Map<String,Object> tempWorkings = Maps.newLinkedHashMap();
-
-    protected transient SubscriptionTracker _subscriptionTracker;
-    
-    public AbstractEntity() {
-        this(Maps.newLinkedHashMap(), null);
-    }
-
-    /**
-     * @deprecated since 0.5; instead use no-arg constructor with EntityManager().createEntity(spec)
-     */
-    @Deprecated
-    public AbstractEntity(Map flags) {
-        this(flags, null);
-    }
-
-    /**
-     * @deprecated since 0.5; instead use no-arg constructor with EntityManager().createEntity(spec)
-     */
-    @Deprecated
-    public AbstractEntity(Entity parent) {
-        this(Maps.newLinkedHashMap(), parent);
-    }
-
-    // FIXME don't leak this reference in constructor - even to utils
-    /**
-     * @deprecated since 0.5; instead use no-arg constructor with EntityManager().createEntity(spec)
-     */
-    @Deprecated
-    public AbstractEntity(@SuppressWarnings("rawtypes") Map flags, Entity parent) {
-        super(checkConstructorFlags(flags, parent));
-
-        // TODO Don't let `this` reference escape during construction
-        entityType = new EntityDynamicType(this);
-        
-        if (isLegacyConstruction()) {
-            AbstractEntity checkWeGetThis = configure(flags);
-            assert this.equals(checkWeGetThis) : this+" configure method does not return itself; returns "+checkWeGetThis+" instead of "+this;
-
-            boolean deferConstructionChecks = (flags.containsKey("deferConstructionChecks") && TypeCoercions.coerce(flags.get("deferConstructionChecks"), Boolean.class));
-            if (!deferConstructionChecks) {
-                FlagUtils.checkRequiredFields(this);
-            }
-        }
-    }
-    
-    private static Map<?,?> checkConstructorFlags(Map flags, Entity parent) {
-        if (flags==null) {
-            throw new IllegalArgumentException("Flags passed to entity must not be null (try no-arguments or empty map)");
-        }
-        if (flags.get("parent") != null && parent != null && flags.get("parent") != parent) {
-            throw new IllegalArgumentException("Multiple parents supplied, "+flags.get("parent")+" and "+parent);
-        }
-        if (flags.get("owner") != null && parent != null && flags.get("owner") != parent) {
-            throw new IllegalArgumentException("Multiple parents supplied with flags.parent, "+flags.get("owner")+" and "+parent);
-        }
-        if (flags.get("parent") != null && flags.get("owner") != null && flags.get("parent") != flags.get("owner")) {
-            throw new IllegalArgumentException("Multiple parents supplied with flags.parent and flags.owner, "+flags.get("parent")+" and "+flags.get("owner"));
-        }
-        if (parent != null) {
-            flags.put("parent", parent);
-        }
-        if (flags.get("owner") != null) {
-            LOG.warn("Use of deprecated \"flags.owner\" instead of \"flags.parent\" for entity");
-            flags.put("parent", flags.get("owner"));
-            flags.remove("owner");
-        }
-        return flags;
-    }
-
-    /**
-     * @deprecated since 0.7.0; only used for legacy brooklyn types where constructor is called directly
-     */
-    @Override
-    @Deprecated
-    public AbstractEntity configure(Map flags) {
-        if (!inConstruction && getManagementSupport().isDeployed()) {
-            LOG.warn("bulk/flag configuration being made to {} after deployment: may not be supported in future versions ({})", 
-                    new Object[] { this, flags });
-        }
-        // TODO use a config bag instead
-//        ConfigBag bag = new ConfigBag().putAll(flags);
-        
-        // FIXME Need to set parent with proxy, rather than `this`
-        Entity suppliedParent = (Entity) flags.remove("parent");
-        if (suppliedParent != null) {
-            suppliedParent.addChild(getProxyIfAvailable());
-        }
-        
-        Map<ConfigKey,?> suppliedOwnConfig = (Map<ConfigKey, ?>) flags.remove("config");
-        if (suppliedOwnConfig != null) {
-            for (Map.Entry<ConfigKey, ?> entry : suppliedOwnConfig.entrySet()) {
-                setConfigEvenIfOwned(entry.getKey(), entry.getValue());
-            }
-        }
-
-        if (flags.get("displayName") != null) {
-            displayName.set((String) flags.remove("displayName"));
-            displayNameAutoGenerated = false;
-        } else if (flags.get("name") != null) {
-            displayName.set((String) flags.remove("name"));
-            displayNameAutoGenerated = false;
-        } else if (isLegacyConstruction()) {
-            displayName.set(getClass().getSimpleName()+":"+Strings.maxlen(getId(), 4));
-            displayNameAutoGenerated = true;
-        }
-
-        if (flags.get("iconUrl") != null) {
-            iconUrl.set((String) flags.remove("iconUrl"));
-        }
-        
-        // allow config keys, and fields, to be set from these flags if they have a SetFromFlag annotation
-        // TODO the default values on flags are not used? (we should remove that support, since ConfigKeys gives a better way)
-        FlagUtils.setFieldsFromFlags(flags, this);
-        flags = FlagUtils.setAllConfigKeys(flags, this, false);
-        
-        // finally all config keys specified in map should be set as config
-        // TODO use a config bag and remove the ones set above in the code below
-        for (Iterator<Map.Entry> fi = flags.entrySet().iterator(); fi.hasNext();) {
-            Map.Entry entry = fi.next();
-            Object k = entry.getKey();
-            if (k instanceof HasConfigKey) k = ((HasConfigKey)k).getConfigKey();
-            if (k instanceof ConfigKey) {
-                setConfigEvenIfOwned((ConfigKey)k, entry.getValue());
-                fi.remove();
-            }
-        }
-        
-        if (!flags.isEmpty()) {
-            LOG.warn("Unsupported flags when configuring {}; storing: {}", this, flags);
-            configsInternal.addToLocalBag(flags);
-        }
-
-        return this;
-    }
-
-    /**
-     * Adds the config keys to the entity dynamic type
-     * @since 0.9.0
-     */
-    public void configure(Iterable<ConfigKey<?>> configKeys) {
-        entityType.addConfigKeys(configKeys);
-    }
-
-    @Override
-    public int hashCode() {
-        return getId().hashCode();
-    }
-    
-    @Override
-    public boolean equals(Object o) {
-        return (o == this || o == selfProxy) || 
-                (o instanceof Entity && Objects.equal(getId(), ((Entity)o).getId()));
-    }
-    
-    /** internal use only */ @Beta
-    public void setProxy(Entity proxy) {
-        if (selfProxy != null) 
-            throw new IllegalStateException("Proxy is already set; cannot reset proxy for "+toString());
-        resetProxy(proxy);
-    }
-    /** internal use only */ @Beta
-    public void resetProxy(Entity proxy) {
-        selfProxy = checkNotNull(proxy, "proxy");
-    }
-    
-    public Entity getProxy() {
-        return selfProxy;
-    }
-    
-    /**
-     * Returns the proxy, or if not available (because using legacy code) then returns the real entity.
-     * This method will be deleted in a future release; it will be kept while deprecated legacy code
-     * still exists that creates entities without setting the proxy.
-     */
-    @Beta
-    public Entity getProxyIfAvailable() {
-        return getProxy()!=null ? getProxy() : this;
-    }
-    
-    /**
-     * Sets a config key value, and returns this Entity instance for use in fluent-API style coding.
-     * 
-     * @deprecated since 0.7.0; see {@link #config()}, such as {@code config().set(key, value)}
-     */
-    @Deprecated
-    public <T> AbstractEntity configure(ConfigKey<T> key, T value) {
-        setConfig(key, value);
-        return this;
-    }
-    
-    /**
-     * @deprecated since 0.7.0; see {@link #config()}, such as {@code config().set(key, value)}
-     */
-    @SuppressWarnings("unchecked")
-    @Deprecated
-    public <T> AbstractEntity configure(ConfigKey<T> key, String value) {
-        config().set((ConfigKey)key, value);
-        return this;
-    }
-    
-    /**
-     * @deprecated since 0.7.0; see {@link #config()}, such as {@code config().set(key, value)}
-     */
-    @Deprecated
-    public <T> AbstractEntity configure(HasConfigKey<T> key, T value) {
-        config().set(key, value);
-        return this;
-    }
-    
-    /**
-     * @deprecated since 0.7.0; see {@link #config()}, such as {@code config().set(key, value)}
-     */
-    @SuppressWarnings("unchecked")
-    @Deprecated
-    public <T> AbstractEntity configure(HasConfigKey<T> key, String value) {
-        config().set((ConfigKey)key, value);
-        return this;
-    }
-
-    public void setManagementContext(ManagementContextInternal managementContext) {
-        super.setManagementContext(managementContext);
-        getManagementSupport().setManagementContext(managementContext);
-        entityType.setName(getEntityTypeName());
-        if (displayNameAutoGenerated) displayName.set(getEntityType().getSimpleName()+":"+Strings.maxlen(getId(), 4));
-
-        if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE)) {
-            Entity oldParent = parent.get();
-            Set<Group> oldGroups = groupsInternal;
-            Set<Entity> oldChildren = children;
-            List<Location> oldLocations = locations.get();
-            EntityConfigMap oldConfig = configsInternal;
-            AttributeMap oldAttribs = attributesInternal;
-            long oldCreationTimeUtc = creationTimeUtc.get();
-            String oldDisplayName = displayName.get();
-            String oldIconUrl = iconUrl.get();
-
-            parent = managementContext.getStorage().getReference(getId()+"-parent");
-            groupsInternal = SetFromLiveMap.create(managementContext.getStorage().<Group,Boolean>getMap(getId()+"-groups"));
-            children = SetFromLiveMap.create(managementContext.getStorage().<Entity,Boolean>getMap(getId()+"-children"));
-            locations = managementContext.getStorage().getNonConcurrentList(getId()+"-locations");
-            creationTimeUtc = managementContext.getStorage().getReference(getId()+"-creationTime");
-            displayName = managementContext.getStorage().getReference(getId()+"-displayName");
-            iconUrl = managementContext.getStorage().getReference(getId()+"-iconUrl");
-
-            // Only override stored defaults if we have actual values. We might be in setManagementContext
-            // because we are reconstituting an existing entity in a new brooklyn management-node (in which
-            // case believe what is already in the storage), or we might be in the middle of creating a new 
-            // entity. Normally for a new entity (using EntitySpec creation approach), this will get called
-            // before setting the parent etc. However, for backwards compatibility we still support some
-            // things calling the entity's constructor directly.
-            if (oldParent != null) parent.set(oldParent);
-            if (oldGroups.size() > 0) groupsInternal.addAll(oldGroups);
-            if (oldChildren.size() > 0) children.addAll(oldChildren);
-            if (oldLocations.size() > 0) locations.set(ImmutableList.copyOf(oldLocations));
-            if (creationTimeUtc.isNull()) creationTimeUtc.set(oldCreationTimeUtc);
-            if (displayName.isNull()) {
-                displayName.set(oldDisplayName);
-            } else {
-                displayNameAutoGenerated = false;
-            }
-            if (iconUrl.isNull()) iconUrl.set(oldIconUrl);
-
-            configsInternal = new EntityConfigMap(this, managementContext.getStorage().<ConfigKey<?>, Object>getMap(getId()+"-config"));
-            if (oldConfig.getLocalConfig().size() > 0) {
-                configsInternal.setLocalConfig(oldConfig.getLocalConfig());
-            }
-            config().refreshInheritedConfig();
-
-            attributesInternal = new AttributeMap(this, managementContext.getStorage().<Collection<String>, Object>getMap(getId()+"-attributes"));
-            if (oldAttribs.asRawMap().size() > 0) {
-                for (Map.Entry<Collection<String>,Object> entry : oldAttribs.asRawMap().entrySet()) {
-                    attributesInternal.update(entry.getKey(), entry.getValue());
-                }
-            }
-        }
-    }
-
-    @Override
-    public Map<String, String> toMetadataRecord() {
-        return ImmutableMap.of();
-    }
-
-    @Override
-    public long getCreationTime() {
-        return creationTimeUtc.get();
-    }
-
-    @Override
-    public String getDisplayName() {
-        return displayName.get();
-    }
-    
-    @Override
-    public String getIconUrl() {
-        return iconUrl.get();
-    }
-    
-    @Override
-    public void setDisplayName(String newDisplayName) {
-        displayName.set(newDisplayName);
-        displayNameAutoGenerated = false;
-        getManagementSupport().getEntityChangeListener().onChanged();
-    }
-    
-    /** allows subclasses to set the default display name to use if none is provided */
-    protected void setDefaultDisplayName(String displayNameIfDefault) {
-        if (displayNameAutoGenerated) {
-            displayName.set(displayNameIfDefault);
-        }
-    }
-    
-    /**
-     * Gets the entity type name, to be returned by {@code getEntityType().getName()}.
-     * To be called by brooklyn internals only.
-     * Can be overridden to customize the name.
-     */
-    protected String getEntityTypeName() {
-        try {
-            Class<?> typeClazz = getManagementContext().getEntityManager().getEntityTypeRegistry().getEntityTypeOf(getClass());
-            String typeName = typeClazz.getCanonicalName();
-            if (typeName == null) typeName = typeClazz.getName();
-            return typeName;
-        } catch (IllegalArgumentException e) {
-            String typeName = getClass().getCanonicalName();
-            if (typeName == null) typeName = getClass().getName();
-            LOG.debug("Entity type interface not found for entity "+this+"; instead using "+typeName+" as entity type name");
-            return typeName;
-        }
-    }
-    
-    /**
-     * Adds this as a child of the given entity; registers with application if necessary.
-     */
-    @Override
-    public AbstractEntity setParent(Entity entity) {
-        if (!parent.isNull()) {
-            // If we are changing to the same parent...
-            if (parent.contains(entity)) return this;
-            // If we have a parent but changing to orphaned...
-            if (entity==null) { clearParent(); return this; }
-            
-            // We have a parent and are changing to another parent...
-            throw new UnsupportedOperationException("Cannot change parent of "+this+" from "+parent+" to "+entity+" (parent change not supported)");
-        }
-        // If we have previously had a parent and are trying to change to another one...
-        if (previouslyOwned && entity != null)
-            throw new UnsupportedOperationException("Cannot set a parent of "+this+" because it has previously had a parent");
-        // We don't have a parent, never have and are changing to having a parent...
-
-        //make sure there is no loop
-        if (this.equals(entity)) throw new IllegalStateException("entity "+this+" cannot own itself");
-        //this may be expensive, but preferable to throw before setting the parent!
-        if (Entities.isDescendant(this, entity))
-            throw new IllegalStateException("loop detected trying to set parent of "+this+" as "+entity+", which is already a descendent");
-        
-        parent.set(entity);
-        entity.addChild(getProxyIfAvailable());
-        config().refreshInheritedConfig();
-        previouslyOwned = true;
-        
-        getApplication();
-        
-        return this;
-    }
-
-    @Override
-    public void clearParent() {
-        if (parent.isNull()) return;
-        Entity oldParent = parent.get();
-        parent.clear();
-        if (oldParent != null) {
-            if (!Entities.isNoLongerManaged(oldParent)) 
-                oldParent.removeChild(getProxyIfAvailable());
-        }
-    }
-    
-    /**
-     * Adds the given entity as a child of this parent <em>and</em> sets this entity as the parent of the child;
-     * returns argument passed in, for convenience.
-     * <p>
-     * The child is NOT managed, even if the parent is already managed at this point
-     * (e.g. the child is added *after* the parent's {@link AbstractEntity#init()} is invoked)
-     * and so will need an explicit <code>getEntityManager().manage(childReturnedFromThis)</code> call.
-     * <i>These semantics are currently under review.</i>
-     */
-    @Override
-    public <T extends Entity> T addChild(T child) {
-        checkNotNull(child, "child must not be null (for entity %s)", this);
-        CatalogUtils.setCatalogItemIdOnAddition(this, child);
-        
-        boolean changed;
-        synchronized (children) {
-            if (Entities.isAncestor(this, child)) throw new IllegalStateException("loop detected trying to add child "+child+" to "+this+"; it is already an ancestor");
-            child.setParent(getProxyIfAvailable());
-            changed = children.add(child);
-            
-            getManagementSupport().getEntityChangeListener().onChildrenChanged();
-        }
-        
-        // TODO not holding synchronization lock while notifying risks out-of-order if addChild+removeChild called in rapid succession.
-        // But doing notification in synchronization block may risk deadlock?
-        if (changed) {
-            sensors().emit(AbstractEntity.CHILD_ADDED, child);
-        }
-        return child;
-    }
-
-    /**
-     * Creates an entity using the given spec, and adds it as a child of this entity.
-     * 
-     * @see #addChild(Entity)
-     * @see EntityManager#createEntity(EntitySpec)
-     * 
-     * @throws IllegalArgumentException If {@code spec.getParent()} is set and is different from this entity
-     */
-    @Override
-    public <T extends Entity> T addChild(EntitySpec<T> spec) {
-        if (spec.getParent()==null) {
-            spec = EntitySpec.create(spec).parent(getProxyIfAvailable());
-        }
-        if (!this.equals(spec.getParent())) {
-            throw new IllegalArgumentException("Attempt to create child of "+this+" with entity spec "+spec+
-                " failed because spec has different parent: "+spec.getParent());
-        }
-        
-        // The spec now includes this as the parent, so no need to call addChild; 
-        // that is done by InternalEntityFactory.
-        return getEntityManager().createEntity(spec);
-    }
-    
-    @Override
-    public boolean removeChild(Entity child) {
-        boolean changed;
-        synchronized (children) {
-            changed = children.remove(child);
-            child.clearParent();
-            
-            if (changed) {
-                getManagementSupport().getEntityChangeListener().onChildrenChanged();
-            }
-        }
-        
-        if (changed) {
-            sensors().emit(AbstractEntity.CHILD_REMOVED, child);
-        }
-        return changed;
-    }
-
-    // -------- GROUPS --------------
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return EnricherSupportInternal
-    // TODO revert to EnricherSupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicGroupSupport groups() {
-        return groups;
-    }
-
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #groups()} is reverted to return {@link {GroupSupport} instead of
-     * {@link BasicGroupSupport}.
-     */
-    @Beta
-    // TODO revert to private when groups() is reverted to return GroupSupport
-    public class BasicGroupSupport implements GroupSupportInternal {
-        @Override
-        public Iterator<Group> iterator() { 
-            return asList().iterator();
-        }
-        @Override
-        public int size() {
-            return asList().size();
-        }
-        @Override
-        public boolean isEmpty() {
-            return asList().isEmpty();
-        }
-        
-        protected List<Group> asList() {
-            synchronized (groupsInternal) {
-                return ImmutableList.copyOf(groupsInternal);
-            }
-        }
-        
-        @Override
-        public void add(Group group) {
-            boolean changed = groupsInternal.add(group);
-            getApplication();
-            
-            if (changed) {
-                sensors().emit(AbstractEntity.GROUP_ADDED, group);
-            }
-        }
-
-        @Override
-        public void remove(Group group) {
-            boolean changed = groupsInternal.remove(group);
-            getApplication();
-            
-            if (changed) {
-                sensors().emit(AbstractEntity.GROUP_REMOVED, group);
-            }
-        }
-    }
-    
-    /**
-     * @deprecated since 0.9.0; see {@link #groups()} and {@link GroupSupport#addGroup(Group)}
-     */
-    @Override
-    @Deprecated
-    public void addGroup(Group group) {
-        groups().add(group);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link #groups()} and {@link GroupSupport#removeGroup(Group)}
-     */
-    @Override
-    @Deprecated
-    public void removeGroup(Group group) {
-        groups().remove(group);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link #groups()} and {@link GroupSupport#iterator()}
-     */
-    @Override
-    @Deprecated
-    public Collection<Group> getGroups() { 
-        return groups().asList();
-    }
-    
-    @Override
-    public Entity getParent() {
-        return parent.get();
-    }
-
-    @Override
-    public Collection<Entity> getChildren() {
-        synchronized (children) {
-            return ImmutableList.copyOf(children);
-        }
-    }
-    
-    /**
-     * Returns the application, looking it up if not yet known (registering if necessary)
-     */
-    @Override
-    public Application getApplication() {
-        if (application != null) return application;
-        Entity parent = getParent();
-        Application app = (parent != null) ? parent.getApplication() : null;
-        if (app != null) {
-            if (getManagementSupport().isFullyManaged())
-                // only do this once fully managed, in case root app becomes parented
-                setApplication(app);
-        }
-        return app;
-    }
-
-    // FIXME Can this really be deleted? Overridden by AbstractApplication; needs careful review
-    /** @deprecated since 0.4.0 should not be needed / leaked outwith brooklyn internals / mgmt support? */
-    protected synchronized void setApplication(Application app) {
-        if (application != null) {
-            if (application.getId() != app.getId()) {
-                throw new IllegalStateException("Cannot change application of entity (attempted for "+this+" from "+getApplication()+" to "+app);
-            }
-        }
-        this.application = app;
-    }
-
-    @Override
-    public String getApplicationId() {
-        Application app = getApplication();
-        return (app == null) ? null : app.getId();
-    }
-
-    @Override
-    public ManagementContext getManagementContext() {
-        // NB Sept 2014 - removed synch keyword above due to deadlock;
-        // it also synchs in ManagementSupport.getManagementContext();
-        // no apparent reason why it was here also
-        return getManagementSupport().getManagementContext();
-    }
-
-    protected EntityManager getEntityManager() {
-        return getManagementContext().getEntityManager();
-    }
-    
-    @Override
-    public EntityType getEntityType() {
-        if (entityType==null) return null;
-        return entityType.getSnapshot();
-    }
-
-    @Override
-    public EntityDynamicType getMutableEntityType() {
-        return entityType;
-    }
-    
-    @Override
-    public Collection<Location> getLocations() {
-        synchronized (locations) {
-            return ImmutableList.copyOf(locations.get());
-        }
-    }
-
-    @Override
-    public void addLocations(Collection<? extends Location> newLocations) {
-        if (newLocations==null || newLocations.isEmpty()) {
-            return;
-        }
-        synchronized (locations) {
-            List<Location> oldLocations = locations.get();
-            Set<Location> trulyNewLocations = Sets.newLinkedHashSet(newLocations);
-            trulyNewLocations.removeAll(oldLocations);
-            if (trulyNewLocations.size() > 0) {
-                locations.set(ImmutableList.<Location>builder().addAll(oldLocations).addAll(trulyNewLocations).build());
-            }
-            
-            for (Location loc : trulyNewLocations) {
-                sensors().emit(AbstractEntity.LOCATION_ADDED, loc);
-            }
-        }
-        
-        if (getManagementSupport().isDeployed()) {
-            for (Location newLocation : newLocations) {
-                // Location is now reachable, so manage it
-                // TODO will not be required in future releases when creating locations always goes through LocationManager.createLocation(LocationSpec).
-                Locations.manage(newLocation, getManagementContext());
-            }
-        }
-        getManagementSupport().getEntityChangeListener().onLocationsChanged();
-    }
-
-    @Override
-    public void removeLocations(Collection<? extends Location> removedLocations) {
-        synchronized (locations) {
-            List<Location> oldLocations = locations.get();
-            Set<Location> trulyRemovedLocations = Sets.intersection(ImmutableSet.copyOf(removedLocations), ImmutableSet.copyOf(oldLocations));
-            locations.set(MutableList.<Location>builder().addAll(oldLocations).removeAll(removedLocations).buildImmutable());
-            
-            for (Location loc : trulyRemovedLocations) {
-                sensors().emit(AbstractEntity.LOCATION_REMOVED, loc);
-            }
-        }
-        
-        // TODO Not calling `Entities.unmanage(removedLocation)` because this location might be shared with other entities.
-        // Relying on abstractLocation.removeChildLocation unmanaging it, but not ideal as top-level locations will stick
-        // around forever, even if not referenced.
-        // Same goes for AbstractEntity#clearLocations().
-        
-        getManagementSupport().getEntityChangeListener().onLocationsChanged();
-    }
-    
-    @Override
-    public void clearLocations() {
-        synchronized (locations) {
-            locations.set(ImmutableList.<Location>of());
-        }
-        getManagementSupport().getEntityChangeListener().onLocationsChanged();
-    }
-
-    public Location firstLocation() {
-        synchronized (locations) {
-            return Iterables.get(locations.get(), 0);
-        }
-    }
-    
-    /**
-     * Should be invoked at end-of-life to clean up the item.
-     */
-    @Override
-    public void destroy() {
-    }
-
-    @Override
-    public <T> T getAttribute(AttributeSensor<T> attribute) {
-        return sensors().get(attribute);
-    }
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupport#get(AttributeSensor)}, 
-     *             which may require constructing a temporary sensor using {@link Sensors#newSensor(Class, String)}.
-     */
-    @SuppressWarnings("unchecked")
-    @Deprecated
-    public <T> T getAttributeByNameParts(List<String> nameParts) {
-        return (T) attributesInternal.getValue(nameParts);
-    }
-    
-    static Set<String> WARNED_READ_ONLY_ATTRIBUTES = Collections.synchronizedSet(MutableSet.<String>of());
-    
-    @Override
-    @Deprecated
-    public <T> T setAttribute(AttributeSensor<T> attribute, T val) {
-        return sensors().set(attribute, val);
-    }
-
-    @Override
-    @Deprecated
-    public <T> T setAttributeWithoutPublishing(AttributeSensor<T> attribute, T val) {
-        return sensors().setWithoutPublishing(attribute, val);
-    }
-
-    @Beta
-    @Override
-    @Deprecated
-    public <T> T modifyAttribute(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier) {
-        return sensors().modify(attribute, modifier);
-    }
-
-    @Override
-    @Deprecated
-    public void removeAttribute(AttributeSensor<?> attribute) {
-        sensors().remove(attribute);
-    }
-
-    /** sets the value of the given attribute sensor from the config key value herein
-     * if the attribtue sensor is not-set or null
-     * <p>
-     * returns old value 
-     * @deprecated on interface since 0.5.0; use {@link ConfigToAttributes#apply(EntityLocal, AttributeSensorAndConfigKey)} */
-    public <T> T setAttribute(AttributeSensorAndConfigKey<?,T> configuredSensor) {
-        T v = getAttribute(configuredSensor);
-        if (v!=null) return v;
-        v = configuredSensor.getAsSensorValue(this);
-        if (v!=null) return setAttribute(configuredSensor, v);
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    @SuppressWarnings("rawtypes")
-    public Map<AttributeSensor, Object> getAllAttributes() {
-        return Collections.<AttributeSensor, Object>unmodifiableMap(sensors().getAll());
-    }
-
-    
-    // -------- CONFIGURATION --------------
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return ConfigurationSupportInternal
-    // TODO revert to ConfigurationSupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicConfigurationSupport config() {
-        return config;
-    }
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return SensorsSupport
-    // TODO revert to SensorsSupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicSensorSupport sensors() {
-        return sensors;
-    }
-
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #sensors()} is reverted to return {@link SensorSupport} instead of
-     * {@link BasicSensorSupport}.
-     */
-    @Beta
-    // TODO revert to private when config() is reverted to return SensorSupportInternal
-    public class BasicSensorSupport implements SensorSupportInternal {
-
-        @Override
-        public <T> T get(AttributeSensor<T> attribute) {
-            return attributesInternal.getValue(attribute);
-        }
-
-        @Override
-        public <T> T set(AttributeSensor<T> attribute, T val) {
-            if (LOG.isTraceEnabled())
-                LOG.trace(""+AbstractEntity.this+" setAttribute "+attribute+" "+val);
-            
-            if (Boolean.TRUE.equals(getManagementSupport().isReadOnlyRaw())) {
-                T oldVal = getAttribute(attribute);
-                if (Equals.approximately(val, oldVal)) {
-                    // ignore, probably an enricher resetting values or something on init
-                } else {
-                    String message = AbstractEntity.this+" setting "+attribute+" = "+val+" (was "+oldVal+") in read only mode; will have very little effect"; 
-                    if (!getManagementSupport().isDeployed()) {
-                        if (getManagementSupport().wasDeployed()) message += " (no longer deployed)"; 
-                        else message += " (not yet deployed)";
-                    }
-                    if (WARNED_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
-                        LOG.warn(message + " (future messages for this sensor logged at trace)");
-                    } else if (LOG.isTraceEnabled()) {
-                        LOG.trace(message);
-                    }
-                }
-            }
-            T result = attributesInternal.update(attribute, val);
-            if (result == null) {
-                // could be this is a new sensor
-                entityType.addSensorIfAbsent(attribute);
-            }
-            
-            getManagementSupport().getEntityChangeListener().onAttributeChanged(attribute);
-            return result;
-        }
-
-        @Override
-        public <T> T setWithoutPublishing(AttributeSensor<T> attribute, T val) {
-            if (LOG.isTraceEnabled())
-                LOG.trace(""+AbstractEntity.this+" setAttributeWithoutPublishing "+attribute+" "+val);
-            
-            T result = attributesInternal.updateWithoutPublishing(attribute, val);
-            if (result == null) {
-                // could be this is a new sensor
-                entityType.addSensorIfAbsentWithoutPublishing(attribute);
-            }
-            
-            getManagementSupport().getEntityChangeListener().onAttributeChanged(attribute);
-            return result;
-        }
-
-        @Beta
-        @Override
-        public <T> T modify(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier) {
-            if (LOG.isTraceEnabled())
-                LOG.trace(""+AbstractEntity.this+" modifyAttribute "+attribute+" "+modifier);
-            
-            if (Boolean.TRUE.equals(getManagementSupport().isReadOnlyRaw())) {
-                String message = AbstractEntity.this+" modifying "+attribute+" = "+modifier+" in read only mode; will have very little effect"; 
-                if (!getManagementSupport().isDeployed()) {
-                    if (getManagementSupport().wasDeployed()) message += " (no longer deployed)"; 
-                    else message += " (not yet deployed)";
-                }
-                if (WARNED_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
-                    LOG.warn(message + " (future messages for this sensor logged at trace)");
-                } else if (LOG.isTraceEnabled()) {
-                    LOG.trace(message);
-                }
-            }
-            T result = attributesInternal.modify(attribute, modifier);
-            if (result == null) {
-                // could be this is a new sensor
-                entityType.addSensorIfAbsent(attribute);
-            }
-            
-            // TODO Conditionally set onAttributeChanged, only if was modified
-            getManagementSupport().getEntityChangeListener().onAttributeChanged(attribute);
-            return result;
-        }
-
-        @Override
-        public void remove(AttributeSensor<?> attribute) {
-            if (LOG.isTraceEnabled())
-                LOG.trace(""+AbstractEntity.this+" removeAttribute "+attribute);
-            
-            attributesInternal.remove(attribute);
-            entityType.removeSensor(attribute);
-        }
-
-        @Override
-        public Map<AttributeSensor<?>, Object> getAll() {
-            Map<AttributeSensor<?>, Object> result = Maps.newLinkedHashMap();
-            Map<String, Object> attribs = attributesInternal.asMap();
-            for (Map.Entry<String,Object> entry : attribs.entrySet()) {
-                AttributeSensor<?> attribKey = (AttributeSensor<?>) entityType.getSensor(entry.getKey());
-                if (attribKey == null) {
-                    // Most likely a race: e.g. persister thread calling getAllAttributes; writer thread
-                    // has written attribute value and is in process of calling entityType.addSensorIfAbsent(attribute)
-                    // Just use a synthetic AttributeSensor, rather than ignoring value.
-                    // TODO If it's not a race, then don't log.warn every time!
-                    LOG.warn("When retrieving all attributes of {}, no AttributeSensor for attribute {} (creating synthetic)", AbstractEntity.this, entry.getKey());
-                    attribKey = Sensors.newSensor(Object.class, entry.getKey());
-                }
-                result.put(attribKey, entry.getValue());
-            }
-            return result;
-        }
-        
-        @Override
-        public <T> void emit(Sensor<T> sensor, T val) {
-            if (sensor instanceof AttributeSensor) {
-                LOG.warn("Strongly discouraged use of emit with attribute sensor "+sensor+" "+val+"; use setAttribute instead!",
-                    new Throwable("location of discouraged attribute "+sensor+" emit"));
-            }
-            if (val instanceof SensorEvent) {
-                LOG.warn("Strongly discouraged use of emit with sensor event as value "+sensor+" "+val+"; value should be unpacked!",
-                    new Throwable("location of discouraged event "+sensor+" emit"));
-            }
-            BrooklynLogging.log(LOG, BrooklynLogging.levelDebugOrTraceIfReadOnly(AbstractEntity.this),
-                "Emitting sensor notification {} value {} on {}", sensor.getName(), val, AbstractEntity.this);
-            emitInternal(sensor, val);
-        }
-        
-        public <T> void emitInternal(Sensor<T> sensor, T val) {
-            if (getManagementSupport().isNoLongerManaged())
-                throw new IllegalStateException("Entity "+AbstractEntity.this+" is no longer managed, when trying to publish "+sensor+" "+val);
-
-            SubscriptionContext subsContext = subscriptions().getSubscriptionContext();
-            if (subsContext != null) subsContext.publish(sensor.newEvent(getProxyIfAvailable(), val));
-        }
-    }
-    
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #config()} is reverted to return {@link ConfigurationSupportInternal} instead of
-     * {@link BasicConfigurationSupport}.
-     */
-    @Beta
-    // TODO revert to private when config() is reverted to return ConfigurationSupportInternal
-    public class BasicConfigurationSupport extends AbstractConfigurationSupportInternal {
-
-        @Override
-        public <T> T get(ConfigKey<T> key) {
-            return configsInternal.getConfig(key);
-        }
-
-        @Override
-        public <T> T set(ConfigKey<T> key, T val) {
-            ConfigConstraints.assertValid(AbstractEntity.this, key, val);
-            return setConfigInternal(key, val);
-        }
-
-        @Override
-        public <T> T set(ConfigKey<T> key, Task<T> val) {
-            return setConfigInternal(key, val);
-        }
-
-        @Override
-        public ConfigBag getBag() {
-            return configsInternal.getAllConfigBag();
-        }
-
-        @Override
-        public ConfigBag getLocalBag() {
-            return configsInternal.getLocalConfigBag();
-        }
-
-        @Override
-        public Maybe<Object> getRaw(ConfigKey<?> key) {
-            return configsInternal.getConfigRaw(key, true);
-        }
-
-        @Override
-        public Maybe<Object> getLocalRaw(ConfigKey<?> key) {
-            return configsInternal.getConfigRaw(key, false);
-        }
-
-        @Override
-        public void addToLocalBag(Map<String, ?> vals) {
-            configsInternal.addToLocalBag(vals);
-        }
-
-        @Override
-        public void removeFromLocalBag(String key) {
-            configsInternal.removeFromLocalBag(key);
-        }
-
-        @Override
-        public void refreshInheritedConfig() {
-            if (getParent() != null) {
-                configsInternal.setInheritedConfig(((EntityInternal)getParent()).getAllConfig(), ((EntityInternal)getParent()).config().getBag());
-            } else {
-                configsInternal.clearInheritedConfig();
-            }
-
-            refreshInheritedConfigOfChildren();
-        }
-        
-        @Override
-        public void refreshInheritedConfigOfChildren() {
-            for (Entity it : getChildren()) {
-                ((EntityInternal)it).config().refreshInheritedConfig();
-            }
-        }
-        
-        @SuppressWarnings("unchecked")
-        private <T> T setConfigInternal(ConfigKey<T> key, Object val) {
-            if (!inConstruction && getManagementSupport().isDeployed()) {
-                // previously we threw, then warned, but it is still quite common;
-                // so long as callers don't expect miracles, it should be fine.
-                // i (Alex) think the way to be stricter about this (if that becomes needed) 
-                // would be to introduce a 'mutable' field on config keys
-                LOG.debug("configuration being made to {} after deployment: {} = {}; change may not be visible in other contexts", 
-                        new Object[] { AbstractEntity.this, key, val });
-            }
-            T result = (T) configsInternal.setConfig(key, val);
-            
-            getManagementSupport().getEntityChangeListener().onConfigChanged(key);
-            return result;
-        }
-
-        @Override
-        protected ExecutionContext getContext() {
-            return AbstractEntity.this.getExecutionContext();
-        }
-    }
-    
-    @Override
-    public <T> T getConfig(ConfigKey<T> key) {
-        return config().get(key);
-    }
-    
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key) {
-        return config().get(key);
-    }
-    
-    @Override
-    @Deprecated
-    public <T> T getConfig(HasConfigKey<T> key, T defaultValue) {
-        return configsInternal.getConfig(key, defaultValue);
-    }
-    
-    //don't use groovy defaults for defaultValue as that doesn't implement the contract; we need the above
-    @Override
-    @Deprecated
-    public <T> T getConfig(ConfigKey<T> key, T defaultValue) {
-        return configsInternal.getConfig(key, defaultValue);
-    }
-    
-    @Override
-    @Deprecated
-    public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited) {
-        return (includeInherited) ? config().getRaw(key) : config().getLocalRaw(key);
-    }
-    
-    @Override
-    @Deprecated
-    public Maybe<Object> getConfigRaw(HasConfigKey<?> key, boolean includeInherited) {
-        return (includeInherited) ? config().getRaw(key) : config().getLocalRaw(key);
-    }
-
-    @Override
-    @Deprecated
-    public <T> T setConfig(ConfigKey<T> key, T val) {
-        return config().set(key, val);
-    }
-
-    @Override
-    @Deprecated
-    public <T> T setConfig(ConfigKey<T> key, Task<T> val) {
-        return config().set(key, val);
-    }
-
-    /**
-     * @deprecated since 0.7.0; use {@code config().set(key, task)}, with {@link Task} instead of {@link DeferredSupplier}
-     */
-    @Deprecated
-    public <T> T setConfig(ConfigKey<T> key, DeferredSupplier val) {
-        return config.setConfigInternal(key, val);
-    }
-
-    @Override
-    @Deprecated
-    public <T> T setConfig(HasConfigKey<T> key, T val) {
-        return config().set(key, val);
-    }
-
-    @Override
-    @Deprecated
-    public <T> T setConfig(HasConfigKey<T> key, Task<T> val) {
-        return (T) config().set(key, val);
-    }
-
-    /**
-     * @deprecated since 0.7.0; use {@code config().set(key, task)}, with {@link Task} instead of {@link DeferredSupplier}
-     */
-    @Deprecated
-    public <T> T setConfig(HasConfigKey<T> key, DeferredSupplier val) {
-        return setConfig(key.getConfigKey(), val);
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T> T setConfigEvenIfOwned(ConfigKey<T> key, T val) {
-        return (T) configsInternal.setConfig(key, val);
-    }
-
-    public <T> T setConfigEvenIfOwned(HasConfigKey<T> key, T val) {
-        return setConfigEvenIfOwned(key.getConfigKey(), val);
-    }
-
-    /**
-     * @deprecated since 0.7.0; use {@code if (val != null) config().set(key, val)}
-     */
-    @Deprecated
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected void setConfigIfValNonNull(ConfigKey key, Object val) {
-        if (val != null) config().set(key, val);
-    }
-
-    /**
-     * @deprecated since 0.7.0; use {@code if (val != null) config().set(key, val)}
-     */
-    @Deprecated
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected void setConfigIfValNonNull(HasConfigKey key, Object val) {
-        if (val != null) config().set(key, val);
-    }
-
-    /**
-     * @deprecated since 0.7.0; see {@code config().refreshInheritedConfig()}
-     */
-    @Override
-    @Deprecated
-    public void refreshInheritedConfig() {
-        config().refreshInheritedConfig();
-    }
-
-    /**
-     * @deprecated since 0.7.0; see {@code config().refreshInheritedConfigOfChildren()}
-     */
-    @Deprecated
-    void refreshInheritedConfigOfChildren() {
-        config().refreshInheritedConfigOfChildren();
-    }
-
-    @Override
-    @Deprecated
-    public EntityConfigMap getConfigMap() {
-        return configsInternal;
-    }
-    
-    @Override
-    @Deprecated
-    public Map<ConfigKey<?>,Object> getAllConfig() {
-        return configsInternal.getAllConfig();
-    }
-
-    @Beta
-    @Override
-    @Deprecated
-    public ConfigBag getAllConfigBag() {
-        return config().getBag();
-    }
-
-    @Beta
-    @Override
-    @Deprecated
-    public ConfigBag getLocalConfigBag() {
-        return config().getLocalBag();
-    }
-
-    
-    // -------- SUBSCRIPTIONS --------------
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return SubscriptionSupportInternal
-    // TODO revert to SubscriptionSupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicSubscriptionSupport subscriptions() {
-        return subscriptions;
-    }
-
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #subscriptions()} is reverted to return {@link SubscriptionSupportInternal} instead of
-     * {@link BasicSubscriptionSupport}.
-     */
-    @Beta
-    // TODO revert to private when config() is reverted to return SensorSupportInternal
-    public class BasicSubscriptionSupport implements SubscriptionSupportInternal {
-        
-        @Override
-        public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribe(producer, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribe(flags, producer, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribeToChildren(parent, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribeToMembers(group, sensor, listener);
-        }
-
-        /**
-         * Unsubscribes the given producer.
-         *
-         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-         */
-        @Override
-        public boolean unsubscribe(Entity producer) {
-            return getSubscriptionTracker().unsubscribe(producer);
-        }
-
-        /**
-         * Unsubscribes the given handle.
-         *
-         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
-         */
-        @Override
-        public boolean unsubscribe(Entity producer, SubscriptionHandle handle) {
-            return getSubscriptionTracker().unsubscribe(producer, handle);
-        }
-
-        /**
-         * Unsubscribes the given handle.
-         * 
-         * It is (currently) more efficient to also pass in the producer -
-         * see {@link BasicSubscriptionSupport#unsubscribe(Entity, SubscriptionHandle)} 
-         */
-        @Override
-        public boolean unsubscribe(SubscriptionHandle handle) {
-            return getSubscriptionTracker().unsubscribe(handle);
-        }
-
-        @Override
-        public void unsubscribeAll() {
-            getSubscriptionTracker().unsubscribeAll();
-        }
-        
-        protected SubscriptionContext getSubscriptionContext() {
-            synchronized (AbstractEntity.this) {
-                return getManagementSupport().getSubscriptionContext();
-            }
-        }
-
-        protected SubscriptionTracker getSubscriptionTracker() {
-            synchronized (AbstractEntity.this) {
-                if (_subscriptionTracker == null) {
-                    _subscriptionTracker = new SubscriptionTracker(getSubscriptionContext());
-                }
-                return _subscriptionTracker;
-            }
-        }
-    }
-    
-    /**
-     * @deprecated since 0.9.0; see {@code subscriptions().subscribe(producer, sensor, listener)}
-     */
-    @Override
-    @Deprecated
-    public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscriptions().subscribe(producer, sensor, listener);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@code subscriptions().subscribeToChildren(parent, sensor, listener)}
-     */
-    @Override
-    @Deprecated
-    public <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscriptions().subscribeToChildren(parent, sensor, listener);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@code subscriptions().subscribeToMembers(producer, sensor, listener)}
-     */
-    @Override
-    @Deprecated
-    public <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscriptions().subscribeToMembers(group, sensor, listener);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@code subscriptions().unsubscribe(producer)}
-     */
-    @Override
-    @Deprecated
-    public boolean unsubscribe(Entity producer) {
-        return subscriptions().unsubscribe(producer);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@code subscriptions().unsubscribe(producer, handle)}
-     */
-    @Override
-    @Deprecated
-    public boolean unsubscribe(Entity producer, SubscriptionHandle handle) {
-        return subscriptions().unsubscribe(producer, handle);
-    }
-
-    /**
-     * @deprecated since 0.9.0; for internal use only
-     */
-    @Deprecated
-    protected synchronized SubscriptionTracker getSubscriptionTracker() {
-        return subscriptions().getSubscriptionTracker();
-    }
-    
-    @Override
-    public synchronized ExecutionContext getExecutionContext() {
-        return getManagementSupport().getExecutionContext();
-    }
-
-    /** Default String representation is simplified name of class, together with selected fields. */
-    @Override
-    public String toString() {
-        return toStringHelper().toString();
-    }
-    
-    /**
-     * Override this to add to the toString(), e.g. {@code return super.toStringHelper().add("port", port);}
-     *
-     * Cannot be used in combination with overriding the deprecated toStringFieldsToInclude.
-     */
-    protected ToStringHelper toStringHelper() {
-        return Objects.toStringHelper(this).omitNullValues().add("id", getId());
-    }
-    
-    // -------- INITIALIZATION --------------
-
-    /**
-     * Default entity initialization, just calls {@link #initEnrichers()}.
-     */
-    public void init() {
-        super.init();
-        initEnrichers();
-    }
-    
-    /**
-     * By default, adds enrichers to populate {@link Attributes#SERVICE_UP} and {@link Attributes#SERVICE_STATE_ACTUAL}
-     * based on {@link Attributes#SERVICE_NOT_UP_INDICATORS}, 
-     * {@link Attributes#SERVICE_STATE_EXPECTED} and {@link Attributes#SERVICE_PROBLEMS}
-     * (doing nothing if these sensors are not used).
-     * <p>
-     * Subclasses may go further and populate the {@link Attributes#SERVICE_NOT_UP_INDICATORS} 
-     * and {@link Attributes#SERVICE_PROBLEMS} from children and members or other sources.
-     */
-    // these enrichers do nothing unless Attributes.SERVICE_NOT_UP_INDICATORS are used
-    // and/or SERVICE_STATE_EXPECTED 
-    protected void initEnrichers() {
-        enrichers().add(ServiceNotUpLogic.newEnricherForServiceUpIfNotUpIndicatorsEmpty());
-        enrichers().add(ServiceStateLogic.newEnricherForServiceStateFromProblemsAndUp());
-    }
-    
-    // -------- POLICIES --------------------
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return PolicySupportInternal
-    // TODO revert to PolicySupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicPolicySupport policies() {
-        return policies;
-    }
-
-    @Override 
-    @Beta
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return EnricherSupportInternal
-    // TODO revert to EnricherSupportInternal when groovy subclasses work without this (eg new groovy version)
-    public BasicEnricherSupport enrichers() {
-        return enrichers;
-    }
-
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #policies()} is reverted to return {@link {PolicySupportInternal} instead of
-     * {@link BasicPolicySupport}.
-     */
-    @Beta
-    // TODO revert to private when config() is reverted to return SensorSupportInternal
-    public class BasicPolicySupport implements PolicySupportInternal {
-        
-        @Override
-        public Iterator<Policy> iterator() {
-            return asList().iterator();
-        }
-
-        @Override
-        public int size() {
-            return policiesInternal.size();
-        }
-        @Override
-        public boolean isEmpty() {
-            return policiesInternal.isEmpty();
-        }
-        
-        protected List<Policy> asList() {
-            return ImmutableList.<Policy>copyOf(policiesInternal);
-        }
-
-        @Override
-        public void add(Policy policy) {
-            Policy old = findApparentlyEqualAndWarnIfNotSameUniqueTag(policiesInternal, policy);
-            if (old!=null) {
-                LOG.debug("Removing "+old+" when adding "+policy+" to "+AbstractEntity.this);
-                remove(old);
-            }
-            
-            CatalogUtils.setCatalogItemIdOnAddition(AbstractEntity.this, policy);
-            policiesInternal.add((AbstractPolicy)policy);
-            ((AbstractPolicy)policy).setEntity(AbstractEntity.this);
-            
-            getManagementSupport().getEntityChangeListener().onPolicyAdded(policy);
-            sensors().emit(AbstractEntity.POLICY_ADDED, new PolicyDescriptor(policy));
-        }
-
-        @Override
-        public <T extends Policy> T add(PolicySpec<T> spec) {
-            T policy = getManagementContext().getEntityManager().createPolicy(spec);
-            add(policy);
-            return policy;
-        }
-        
-        @Override
-        public boolean remove(Policy policy) {
-            ((AbstractPolicy)policy).destroy();
-            boolean changed = policiesInternal.remove(policy);
-            
-            if (changed) {
-                getManagementSupport().getEntityChangeListener().onPolicyRemoved(policy);
-                sensors().emit(AbstractEntity.POLICY_REMOVED, new PolicyDescriptor(policy));
-            }
-            return changed;
-        }
-        
-        @Override
-        public boolean removeAllPolicies() {
-            boolean changed = false;
-            for (Policy policy : policiesInternal) {
-                remove(policy);
-                changed = true;
-            }
-            return changed;
-        }
-    }
-
-    /**
-     * Direct use of this class is strongly discouraged. It will become private in a future release,
-     * once {@link #enrichers()} is reverted to return {@link EnricherSupportInternal} instead of
-     * {@link BasicEnricherSupport}.
-     */
-    @Beta
-    // TODO revert to private when config() is reverted to return SensorSupportInternal
-    public class BasicEnricherSupport implements EnricherSupportInternal {
-        @Override
-        public Iterator<Enricher> iterator() {
-            return asList().iterator();
-        }
-
-        @Override
-        public int size() {
-            return enrichersInternal.size();
-        }
-        @Override
-        public boolean isEmpty() {
-            return enrichersInternal.isEmpty();
-        }
-        
-        protected List<Enricher> asList() {
-            return ImmutableList.<Enricher>copyOf(enrichersInternal);
-        }
-
-        @Override
-        public <T extends Enricher> T add(EnricherSpec<T> spec) {
-            T enricher = getManagementContext().getEntityManager().createEnricher(spec);
-            add(enricher);
-            return enricher;
-        }
-
-        @Override
-        public void add(Enricher enricher) {
-            Enricher old = findApparentlyEqualAndWarnIfNotSameUniqueTag(enrichersInternal, enricher);
-            if (old!=null) {
-                LOG.debug("Removing "+old+" when adding "+enricher+" to "+AbstractEntity.this);
-                remove(old);
-            }
-            
-            CatalogUtils.setCatalogItemIdOnAddition(AbstractEntity.this, enricher);
-            enrichersInternal.add((AbstractEnricher) enricher);
-            ((AbstractEnricher)enricher).setEntity(AbstractEntity.this);
-            
-            getManagementSupport().getEntityChangeListener().onEnricherAdded(enricher);
-            // TODO Could add equivalent of AbstractEntity.POLICY_ADDED for enrichers; no use-case for that yet
-        }
-        
-        @Override
-        public boolean remove(Enricher enricher) {
-            ((AbstractEnricher)enricher).destroy();
-            boolean changed = enrichersInternal.remove(enricher);
-            
-            if (changed) {
-                getManagementSupport().getEntityChangeListener().onEnricherRemoved(enricher);
-            }
-            return changed;
-
-        }
-
-        @Override
-        public boolean removeAll() {
-            boolean changed = false;
-            for (AbstractEnricher enricher : enrichersInternal) {
-                changed = remove(enricher) || changed;
-            }
-            return changed;
-        }
-    }
-    
-    /**
-     * @deprecated since 0.9.0; see {@link BasicPolicySupport#iterator()}; e.g. {@code policies().iterator()}
-     */
-    @Override
-    @Deprecated
-    public Collection<Policy> getPolicies() {
-        return policies().asList();
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicPolicySupport#addPolicy(Policy)}; e.g. {@code policies().addPolicy(policy)}
-     */
-    @Override
-    @Deprecated
-    public void addPolicy(Policy policy) {
-        policies().add(policy);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicPolicySupport#addPolicy(PolicySpec)}; e.g. {@code policies().addPolicy(spec)}
-     */
-    @Override
-    @Deprecated
-    public <T extends Policy> T addPolicy(PolicySpec<T> spec) {
-        return policies().add(spec);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicEnricherSupport#; e.g. {@code enrichers().addEnricher(spec)}
-     */
-    @Override
-    @Deprecated
-    public <T extends Enricher> T addEnricher(EnricherSpec<T> spec) {
-        return enrichers().add(spec);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicPolicySupport#removePolicy(Policy)}; e.g. {@code policies().removePolicy(policy)}
-     */
-    @Override
-    @Deprecated
-    public boolean removePolicy(Policy policy) {
-        return policies().remove(policy);
-    }
-    
-    /**
-     * @deprecated since 0.9.0; see {@link BasicPolicySupport#removeAllPolicies()}; e.g. {@code policies().removeAllPolicies()}
-     */
-    @Override
-    @Deprecated
-    public boolean removeAllPolicies() {
-        return policies().removeAllPolicies();
-    }
-    
-    /**
-     * @deprecated since 0.9.0; see {@link BasicEnricherSupport#iterator()}; e.g. {@code enrichers().iterator()}
-     */
-    @Override
-    @Deprecated
-    public Collection<Enricher> getEnrichers() {
-        return enrichers().asList();
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicEnricherSupport#addEnricher(Enricher)}; e.g. {@code enrichers().addEnricher(enricher)}
-     */
-    @Override
-    @Deprecated
-    public void addEnricher(Enricher enricher) {
-        enrichers().add(enricher);
-    }
-    
-    private <T extends EntityAdjunct> T findApparentlyEqualAndWarnIfNotSameUniqueTag(Collection<? extends T> items, T newItem) {
-        T oldItem = findApparentlyEqual(items, newItem, true);
-        
-        if (oldItem!=null) {
-            String oldItemTag = oldItem.getUniqueTag();
-            String newItemTag = newItem.getUniqueTag();
-            if (oldItemTag!=null || newItemTag!=null) {
-                if (Objects.equal(oldItemTag, newItemTag)) {
-                    // if same tag, return old item for replacing without comment
-                    return oldItem;
-                }
-                // if one has a tag bug not the other, and they are apparently equal,
-                // transfer the tag across
-                T tagged = oldItemTag!=null ? oldItem : newItem;
-                T tagless = oldItemTag!=null ? newItem : oldItem;
-                LOG.warn("Apparently equal items "+oldItem+" and "+newItem+"; but one has a unique tag "+tagged.getUniqueTag()+"; applying to the other");
-                ((AdjunctTagSupport)tagless.tags()).setUniqueTag(tagged.getUniqueTag());
-            }
-            
-            if (isRebinding()) {
-                LOG.warn("Adding to "+this+", "+newItem+" appears identical to existing "+oldItem+"; will replace. "
-                    + "Underlying addition should be modified so it is not added twice during rebind or unique tag should be used to indicate it is identical.");
-                return oldItem;
-            } else {
-                LOG.warn("Adding to "+this+", "+newItem+" appears identical to existing "+oldItem+"; may get removed on rebind. "
-                    + "Underlying addition should be modified so it is not added twice.");
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-    private <T extends EntityAdjunct> T findApparentlyEqual(Collection<? extends T> itemsCopy, T newItem, boolean transferUniqueTag) {
-        // TODO workaround for issue where enrichers/feeds/policies can get added multiple times on rebind,
-        // if it's added in onBecomingManager or connectSensors; 
-        // the right fix will be more disciplined about how/where these are added;
-        // furthermore unique tags should be preferred;
-        // when they aren't supplied, a reflection equals is done ignoring selected fields,
-        // which is okay but not great ... and if it misses something (e.g. because an 'equals' isn't implemented)
-        // then you can get a new instance on every rebind
-        // (and currently these aren't readily visible, except looking at the counts or in persisted state) 
-        Class<?> beforeEntityAdjunct = newItem.getClass();
-        while (beforeEntityAdjunct.getSuperclass()!=null && !beforeEntityAdjunct.getSuperclass().equals(AbstractEntityAdjunct.class))
-            beforeEntityAdjunct = beforeEntityAdjunct.getSuperclass();
-        
-        String newItemTag = newItem.getUniqueTag();
-        for (T oldItem: itemsCopy) {
-            String oldItemTag = oldItem.getUniqueTag();
-            if (oldItemTag!=null && newItemTag!=null) { 
-                if (oldItemTag.equals(newItemTag)) {
-                    return oldItem;
-                } else {
-                    continue;
-                }
-            }
-            // either does not have a unique tag, do deep equality
-            if (oldItem.getClass().equals(newItem.getClass())) {
-                if (EqualsBuilder.reflectionEquals(oldItem, newItem, false,
-                        // internal admin in 'beforeEntityAdjunct' should be ignored
-                        beforeEntityAdjunct,
-                        // known fields which shouldn't block equality checks:
-                        // from aggregator
-                        "transformation",
-                        // from averager
-                        "values", "timestamps", "lastAverage",
-                        // from some feeds
-                        "poller",
-                        "pollerStateMutex"
-                        )) {
-                    
-                    return oldItem;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicEnricherSupport#removeEnricher(Enricher)}; e.g. {@code enrichers().removeEnricher(enricher)}
-     */
-    @Override
-    @Deprecated
-    public boolean removeEnricher(Enricher enricher) {
-        return enrichers().remove(enricher);
-    }
-
-    /**
-     * @deprecated since 0.9.0; see {@link BasicEnricherSupport#removeAllEnrichers()}; e.g. {@code enrichers().removeAllEnrichers()}
-     */
-    @Override
-    @Deprecated
-    public boolean removeAllEnrichers() {
-        return enrichers().removeAll();
-    }
-    
-    // -------- FEEDS --------------------
-
-    /**
-     * Convenience, which calls {@link EntityInternal#feeds()} and {@link FeedSupport#addFeed(Feed)}.
-     */
-    @Override
-    public <T extends Feed> T addFeed(T feed) {
-        return feeds().addFeed(feed);
-    }
-
-    @Override
-    public FeedSupport feeds() {
-        return new BasicFeedSupport();
-    }
-    
-    @Override
-    @Deprecated
-    public FeedSupport getFeedSupport() {
-        return feeds();
-    }
-    
-    protected class BasicFeedSupport implements FeedSupport {
-        @Override
-        public Collection<Feed> getFeeds() {
-            return ImmutableList.<Feed>copyOf(feeds);
-        }
-
-        @Override
-        public <T extends Feed> T addFeed(T feed) {
-            Feed old = findApparentlyEqualAndWarnIfNotSameUniqueTag(feeds, feed);
-            if (old != null) {
-                if (old == feed) {
-                    if (!BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_FEED_REGISTRATION_PROPERTY)) {
-                        LOG.debug("Feed " + feed + " already added, not adding a second time.");
-                    } // else expected to be added a second time through addFeed, ignore
-                    return feed;
-                } else {
-                    // Different feed object with (seemingly) same functionality, remove previous one, will stop it.
-                    LOG.debug("Removing "+old+" when adding "+feed+" to "+this);
-                    removeFeed(old);
-                }
-            }
-            
-            CatalogUtils.setCatalogItemIdOnAddition(AbstractEntity.this, feed);
-            feeds.add(feed);
-            if (!AbstractEntity.this.equals(((AbstractFeed)feed).getEntity()))
-                ((AbstractFeed)feed).setEntity(AbstractEntity.this);
-
-            getManagementContext().getRebindManager().getChangeListener().onManaged(feed);
-            getManagementSupport().getEntityChangeListener().onFeedAdded(feed);
-            // TODO Could add equivalent of AbstractEntity.POLICY_ADDED for feeds; no use-case for that yet
-
-            return feed;
-        }
-
-        @Override
-        public boolean removeFeed(Feed feed) {
-            feed.stop();
-            boolean changed = feeds.remove(feed);
-            
-            if (changed) {
-                getManagementContext().getRebindManager().getChangeListener().onUnmanaged(feed);
-                getManagementSupport().getEntityChangeListener().onFeedRemoved(feed);
-            }
-            return changed;
-        }
-
-        @Override
-        public boolean removeAllFeeds() {
-            boolean changed = false;
-            for (Feed feed : feeds) {
-                changed = removeFeed(feed) || changed;
-            }
-            return changed;
-        }
-    }
-    
-    // -------- SENSORS --------------------
-
-    @Override
-    @Deprecated
-    public <T> void emit(Sensor<T> sensor, T val) {
-        sensors().emit(sensor, val);
-    }
-    
-    /**
-     * Warning: for internal purposes only; this method may be deleted without notice in future releases.
-     */
-    public <T> void emitInternal(Sensor<T> sensor, T val) {
-        sensors().emitInternal(sensor, val);
-    }
-
-    // -------- EFFECTORS --------------
-
-    /** Convenience for finding named effector in {@link EntityType#getEffectors()} {@link Map}. */
-    public Effector<?> getEffector(String effectorName) {
-        return entityType.getEffector(effectorName);
-    }
-
-    /** Invoke an {@link Effector} directly. */
-    public <T> Task<T> invoke(Effector<T> eff) {
-        return invoke(MutableMap.of(), eff);
-    }
-    
-    public <T> Task<T> invoke(Map parameters, Effector<T> eff) {
-        return invoke(eff, parameters);
-    }
-
-    /**
-     * Additional form supplied for when the parameter map needs to be made explicit.
-     *
-     * @see #invoke(Effector)
-     */
-    @Override
-    public <T> Task<T> invoke(Effector<T> eff, Map<String,?> parameters) {
-        return EffectorUtils.invokeEffectorAsync(this, eff, parameters);
-    }
-
-    /**
-     * Invoked by {@link EntityManagementSupport} when this entity is becoming managed (i.e. it has a working
-     * management context, but before the entity is visible to other entities), including during a rebind.
-     */
-    public void onManagementStarting() {
-        if (isLegacyConstruction()) {
-            entityType.setName(getEntityTypeName());
-            if (displayNameAutoGenerated) displayName.set(getEntityType().getSimpleName()+":"+Strings.maxlen(getId(), 4));
-        }
-    }
-    
-    /**
-     * Invoked by {@link EntityManagementSupport} when this entity is fully managed and visible to other entities
-     * through the management context.
-     */
-    public void onManagementStarted() {}
-    
-    /**
-     * Invoked by {@link ManagementContext} when this entity becomes managed at a particular management node,
-     * including the initial management started and subsequent management node master-change for this entity.
-     * @deprecated since 0.4.0 override EntityManagementSupport.onManagementStarted if customization needed
-     */
-    public void onManagementBecomingMaster() {}
-    
-    /**
-     * Invoked by {@link ManagementContext} when this entity becomes mastered at a particular management node,
-     * including the final management end and subsequent management node master-change for this entity.
-     * @deprecated since 0.4.0 override EntityManagementSupport.onManagementStopped if customization needed
-     */
-    public void onManagementNoLongerMaster() {}
-
-    /**
-     * Invoked by {@link EntityManagementSupport} when this entity is fully unmanaged.
-     * <p>
-     * Note that the activies possible here (when unmanaged) are limited, 
-     * and that this event may be caused by either a brooklyn node itself being demoted
-     * (so the entity is managed elsewhere) or by a controlled shutdown.
-     */
-    public void onManagementStopped() {
-        if (getManagementContext().isRunning()) {
-            BrooklynStorage storage = ((ManagementContextInternal)getManagementContext()).getStorage();
-            storage.remove(getId()+"-parent");
-            storage.remove(getId()+"-groups");
-            storage.remove(getId()+"-children");
-            storage.remove(getId()+"-locations");
-            storage.remove(getId()+"-creationTime");
-            storage.remove(getId()+"-displayName");
-            storage.remove(getId()+"-config");
-            storage.remove(getId()+"-attributes");
-        }
-    }
-    
-    /** For use by management plane, to invalidate all fields (e.g. when an entity is changing to being proxied) */
-    public void invalidateReferences() {
-        // TODO Just rely on GC of this entity instance, to get rid of the children map etc.
-        //      Don't clear it, as it's persisted.
-        // TODO move this to EntityMangementSupport,
-        application = null;
-    }
-    
-    @Override
-    public EntityManagementSupport getManagementSupport() {
-        return managementSupport;
-    }
-
-    @Override
-    public void requestPersist() {
-        getManagementSupport().getEntityChangeListener().onChanged();
-    }
-
-    /**
-     * As described in {@link EntityInternal#getRebindSupport()}...
-     * Users are strongly discouraged to call or override this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    public RebindSupport<EntityMemento> getRebindSupport() {
-        return new BasicEntityRebindSupport(this);
-    }
-
-    @Override
-    protected void onTagsChanged() {
-        super.onTagsChanged();
-        getManagementSupport().getEntityChangeListener().onTagsChanged();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public RelationSupportInternal<Entity> relations() {
-        return (RelationSupportInternal<Entity>) super.relations();
- 

<TRUNCATED>

[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!)

Posted by he...@apache.org.
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) {
-        }
-        
-    }
-}


[43/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
deleted file mode 100644
index 4988721..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
+++ /dev/null
@@ -1,117 +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.api.mgmt;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/** 
- * This class manages the execution of a number of jobs with tags.
- * 
- * It is like an executor service (and it ends up delegating to one) but adds additional support
- * where jobs can be:
- * <ul>
- * <li>Tracked with tags/buckets
- * <li>Be {@link Runnable}s, {@link Callable}s, or {@link groovy.lang.Closure}s
- * <li>Remembered after completion
- * <li>Treated as {@link Task} instances (see below)
- * <li>Given powerful synchronization capabilities
- * </ul>
- * <p>
- * The advantage of treating them as {@link Task} instances include: 
- * <ul>
- * <li>Richer status information
- * <li>Started-by, contained-by relationships automatically remembered
- * <li>Runtime metadata (start, stop, etc)
- * <li>Grid and multi-machine support) 
- * </ul>
- * <p>
- * For usage instructions see {@link #submit(Map, TaskAdaptable)}, and for examples see the various
- * {@code ExecutionTest} and {@code TaskTest} instances.
- * <p>
- * It has been developed for multi-location provisioning and management to track work being
- * done by each {@link Entity}.
- * <p>
- * Note the use of the environment variable {@code THREAD_POOL_SIZE} which is used to size
- * the {@link ExecutorService} thread pool. The default is calculated as twice the number
- * of CPUs in the system plus two, giving 10 for a four core system, 18 for an eight CPU
- * server and so on.
- */
-public interface ExecutionManager {
-    public boolean isShutdown();
-    
-    /** returns the task with the given ID, or null if none */ 
-    public Task<?> getTask(String id);
-    
-    /** returns all tasks with the given tag (immutable) */
-    public Set<Task<?>> getTasksWithTag(Object tag);
-
-    /** returns all tasks that have any of the given tags (immutable) */
-    public Set<Task<?>> getTasksWithAnyTag(Iterable<?> tags);
-
-    /** returns all tasks that have all of the given tags (immutable) */
-    public Set<Task<?>> getTasksWithAllTags(Iterable<?> tags);
-
-    /** returns all tags known to this manager (immutable) */
-    public Set<Object> getTaskTags();
-
-//    /** returns all tasks known to this manager (immutable) */
-//    public Set<Task<?>> getAllTasks();
-
-    /** see {@link #submit(Map, TaskAdaptable)} */
-    public Task<?> submit(Runnable r);
-
-    /** see {@link #submit(Map, TaskAdaptable)} */
-    public <T> Task<T> submit(Callable<T> c);
-
-    /** see {@link #submit(Map, TaskAdaptable)} */
-    public <T> Task<T> submit(TaskAdaptable<T> task);
-    
-    /** see {@link #submit(Map, TaskAdaptable)} */
-    public Task<?> submit(Map<?, ?> flags, Runnable r);
-
-    /** see {@link #submit(Map, TaskAdaptable)} */
-    public <T> Task<T> submit(Map<?, ?> flags, Callable<T> c);
-
-    /**
-     * Submits the given {@link Task} for execution in the context associated with this manager.
-     *
-     * The following optional flags supported (in the optional map first arg):
-     * <ul>
-     * <li><em>tag</em> - A single object to be used as a tag for looking up the task
-     * <li><em>tags</em> - A {@link Collection} of object tags each of which the task should be associated,
-     *                      used for associating with contexts, mutex execution, and other purposes
-     * <li><em>synchId</em> - A string, or {@link Collection} of strings, representing a category on which an object should own a synch lock 
-     * <li><em>synchObj</em> - A string, or {@link Collection} of strings, representing a category on which an object should own a synch lock 
-     * <li><em>newTaskStartCallback</em> - A {@link groovy.lang.Closure} that will be invoked just before the task starts if it starts as a result of this call
-     * <li><em>newTaskEndCallback</em> - A {@link groovy.lang.Closure} that will be invoked when the task completes if it starts as a result of this call
-     * </ul>
-     * Callbacks run in the task's thread, and if the callback is a {@link groovy.lang.Closure} it is passed the task for convenience. The closure can be any of the
-     * following types; either a {@link groovy.lang.Closure}, {@link Runnable} or {@link Callable}.
-     * <p>
-     * If a Map is supplied it must be modifiable (currently; may allow immutable maps in future). 
-     */
-    public <T> Task<T> submit(Map<?, ?> flags, TaskAdaptable<T> task);
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java
deleted file mode 100644
index 52f9735..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.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 org.apache.brooklyn.api.mgmt;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * Interface marks tasks which have explicit children,
- * typically where the task defines the ordering of running those children tasks
- * <p>
- * The {@link Task#getSubmittedByTask()} on the child will typically return the parent,
- * but note there are other means of submitting tasks (e.g. background, in the same {@link ExecutionContext}),
- * where the submitter has no API reference to the submitted tasks.
- * <p>
- * In general the children mechanism is preferred as it is easier to navigate
- * (otherwise you have to scan the {@link ExecutionContext} to find tasks submitted by a task).  
- */
-@Beta // in 0.6.0
-public interface HasTaskChildren {
-
-    public Iterable<Task<?>> getChildren();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java
deleted file mode 100644
index 9d20a34..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.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 org.apache.brooklyn.api.mgmt;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-
-/**
- * For managing and querying entities.
- */
-public interface LocationManager {
-
-    /**
-     * Creates a new location, which is tracked by the management context.
-     * 
-     * @param spec
-     */
-    <T extends Location> T createLocation(LocationSpec<T> spec);
-
-    /**
-     * Convenience (particularly for groovy code) to create a location.
-     * Equivalent to {@code createLocation(LocationSpec.create(type).configure(config))}
-     * 
-     * @see #createLocation(LocationSpec)
-     */
-    <T extends Location> T createLocation(Map<?,?> config, Class<T> type);
-
-    /**
-     * All locations under control of this management plane.
-     * 
-     * This returns a snapshot of the current locations; it will not reflect future changes in the locations.
-     * If no locations are found, the collection will be empty (i.e. null is never returned).
-     */
-    Collection<Location> getLocations();
-
-    /**
-     * Returns the location under management (e.g. in use) with the given identifier 
-     * (e.g. random string; and different to the LocationDefinition id).
-     * May return a full instance, or a proxy to one which is remote.
-     * If no location found with that id, returns null.
-     */
-    Location getLocation(String id);
-    
-    /** whether the location is under management by this management context */
-    boolean isManaged(Location loc);
-
-    /**
-     * Begins management for the given location and its children, recursively.
-     *
-     * depending on the implementation of the management context,
-     * this might push it out to one or more remote management nodes.
-     * Manage a location.
-     * 
-     * @since 0.6.0 (added only for backwards compatibility, where locations are being created directly).
-     * @deprecated in 0.6.0; use {@link #createLocation(LocationSpec)} instead.
-     */
-    Location manage(Location loc);
-    
-    /**
-     * Causes the given location and its children, recursively, to be removed from the management plane
-     * (for instance because the location is no longer relevant).
-     * 
-     * If the given location is not managed (e.g. it has already been unmanaged) then this is a no-op 
-     * (though it may be logged so duplicate calls are best avoided).
-     */
-    void unmanage(Location loc);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
deleted file mode 100644
index cabadee..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
+++ /dev/null
@@ -1,267 +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.api.mgmt;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.util.Collection;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriverManager;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityManager;
-import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-
-/**
- * This is the entry point for accessing and interacting with a realm of applications and their entities in Brooklyn.
- *
- * For example, policies and the management console(s) (web-app, etc) can use this to interact with entities; 
- * policies, web-app, and entities share the realm for subscribing to events, executing tasks, and generally co-existing.      
- * <p>
- * It may refer to several applications, and it refers to all the entities descended from those applications.
- */
-public interface ManagementContext {
-
-    // TODO Consider separating out into a ConfigManager for methods like:
-    //  - getConfig()
-    //  - reloadBrooklynProperties();
-    //  - addPropertiesReloadListener
-    //  - removePropertiesReloadListener
-    //  - interface PropertiesReloadListener
-    
-    /** 
-     * UID for the Brooklyn management plane which this {@link ManagementContext} node is a part of.
-     * <p>
-     * Each Brooklyn entity is actively managed by a unique management plane 
-     * whose ID which should not normally change for the duration of that entity, 
-     * even though the nodes in that plane might, and the plane may go down and come back up. 
-     * In other words the value of {@link Application#getManagementContext()#getManagementPlaneId()} 
-     * will generally be constant (in contrast to {@link #getManagementNodeId()}).
-     * <p>
-     * This value should not be null unless the management context is a non-functional
-     * (non-deployment) instance. */
-    String getManagementPlaneId();
-    
-    /** 
-     * UID for this {@link ManagementContext} node (as part of a single management plane).
-     * <p>
-     * No two instances of {@link ManagementContext} should ever have the same node UID. 
-     * The value of {@link Application#getManagementContext()#getManagementNodeId()} may
-     * change many times (in contrast to {@link #getManagementPlaneId()}). 
-     * <p>
-     * This value should not be null unless the management context is a non-functional
-     * (non-deployment) instance. */
-    String getManagementNodeId();
-
-    /**
-     * The URI that this management node's REST API is available at, or absent if the node's
-     * API is unavailable.
-     */
-    Maybe<URI> getManagementNodeUri();
-
-    /**
-     * All applications under control of this management plane
-     */
-    Collection<Application> getApplications();
-
-    /**
-     * Returns the {@link EntityManager} instance for managing/querying entities.
-     */
-    EntityManager getEntityManager();
-    
-    /**
-     * Returns the {@link ExecutionManager} instance for entities and users in this management realm 
-     * to submit tasks and to observe what tasks are occurring
-     */
-    ExecutionManager getExecutionManager();
-    
-    /** 
-     * Returns an {@link ExecutionContext} within the {@link ExecutionManager} for tasks
-     * associated to the Brooklyn node's operation (not any entities). 
-     **/
-    ExecutionContext getServerExecutionContext();
-
-    /**
-     * Returns the {@link EntityDriverManager} entities can use to create drivers. This
-     * manager can also be used to programmatically customize which driver type to use 
-     * for entities in different locations.
-     * 
-     * The default strategy for choosing a driver is to use a naming convention: 
-     * {@link DriverDependentEntity#getDriverInterface()} returns the interface that the
-     * driver must implement; its name should end in "Driver". For example, this suffix is 
-     * replaced with "SshDriver" for SshMachineLocation, for example.
-     */
-    EntityDriverManager getEntityDriverManager();
-
-    /**
-     * Returns the {@link DownloadResolverManager} for resolving things like which URL to download an installer from.
-     * 
-     * The default {@link DownloadResolverManager} will retrieve {@code entity.getAttribute(Attributes.DOWNLOAD_URL)},
-     * and substitute things like "${version}" etc.
-     * 
-     * However, additional resolvers can be registered to customize this behaviour (e.g. to always go to an 
-     * enterprise's repository).
-     */
-    DownloadResolverManager getEntityDownloadsManager();
-
-    /**
-     * Returns the {@link SubscriptionManager} instance for entities and users of this management realm
-     * to subscribe to sensor events (and, in the case of entities, to emit sensor events) 
-     */
-    SubscriptionManager getSubscriptionManager();
-
-    //TODO (Alex) I'm not sure the following two getXxxContext methods are needed on the interface;
-    //I expect they will only be called once, in AbstractEntity, and fully capable
-    //there of generating the respective contexts from the managers
-    //(Litmus test will be whether there is anything in FederatedManagementContext
-    //which requires a custom FederatedExecutionContext -- or whether BasicEC 
-    //works with FederatedExecutionManager)
-    /**
-     * Returns an {@link ExecutionContext} instance representing tasks 
-     * (from the {@link ExecutionManager}) associated with this entity, and capable 
-     * of conveniently running such tasks which will be associated with that entity  
-     */
-    ExecutionContext getExecutionContext(Entity entity);
-    
-    /**
-     * Returns a {@link SubscriptionContext} instance representing subscriptions
-     * (from the {@link SubscriptionManager}) associated with this entity, and capable 
-     * of conveniently subscribing on behalf of that entity  
-     */
-    SubscriptionContext getSubscriptionContext(Entity entity);
-
-    /**
-     * Returns a {@link SubscriptionContext} instance representing subscriptions
-     * (from the {@link SubscriptionManager}) associated with this location, and capable 
-     * of conveniently subscribing on behalf of that location  
-     */
-    @Beta
-    SubscriptionContext getSubscriptionContext(Location location);
-
-    @Beta // method may move to an internal interface; brooklyn users should not need to call this directly
-    RebindManager getRebindManager();
-
-    /**
-     * @since 0.7.0
-     */
-    @Beta // method may move to an internal interface; brooklyn users should not need to call this directly
-    HighAvailabilityManager getHighAvailabilityManager();
-    
-    /**
-     * Returns the ConfigMap (e.g. BrooklynProperties) applicable to this management context.
-     * Defaults to reading ~/.brooklyn/brooklyn.properties but configurable in the management context.
-     */
-    StringConfigMap getConfig();
-    
-    /**
-     * Whether the management context has been initialized and not yet terminated.
-     * This does not mean startup is entirely completed. See also {@link #isStartupComplete()}.
-     */
-    // TODO should we replace this with isNotYetTerminated() ??
-    // and perhaps introduce isFullyRunning() which does (isStartupComplete() && isRunning()),
-    // and/or move to a MgmtContextStatus subclass where errors can also be stored?
-    public boolean isRunning();
-    
-    /**
-     * Whether all startup tasks have completed. Previous to this point the management context is still usable 
-     * (and hence {@link #isRunning()} returns true immediately after construction)
-     * but some subsystems (e.g. persistence, OSGi, webapps, entities started at startup)
-     * may not be available until this returns true.
-     * <p>
-     * Also see {@link #isStartupComplete()}.
-     */
-    @Beta  // see comment on isRunning() as items might move to a status handler
-    public boolean isStartupComplete();
-
-    /** Record of configured locations and location resolvers */
-    LocationRegistry getLocationRegistry();
-    
-    /** Record of configured Brooklyn entities (and templates and policies) which can be loaded */
-    BrooklynCatalog getCatalog();
-
-    /** Record of configured classes which can be loaded */
-    BrooklynTypeRegistry getTypeRegistry();
-    
-    /** Returns the class loader to be used to load items. 
-     * Temporary routine while catalog supports classloader-based and OSGi-based classloading. */
-    @Beta
-    ClassLoader getCatalogClassLoader();
-
-    LocationManager getLocationManager();
-
-    /**
-     * For controlling access to operations - can be queried to find if an operation is allowed.
-     * Callers should *not* cache the result of this method, but should instead always call
-     * again to get the {@link AccessController}.
-     */
-    AccessController getAccessController();
-
-    /**
-     * Reloads locations from {@code brooklyn.properties}. Any changes will apply only to newly created applications
-     */
-    void reloadBrooklynProperties();
-
-    /**
-     * Listener for {@code brooklyn.properties} reload events.
-     *
-     * @see {@link #raddPropertiesReloadListenerPropertiesReloadListener)}
-     * @see {@link #removePropertiesReloadListener(PropertiesReloadListener)}
-     */
-    interface PropertiesReloadListener extends Serializable {
-
-        /** Called when {@code brooklyn.properties} is reloaded. */
-        void reloaded();
-
-    }
-    
-    /**
-     * Registers a listener to be notified when brooklyn.properties is reloaded
-     */
-    void addPropertiesReloadListener(PropertiesReloadListener listener);
-    
-    /**
-     * Deregisters a listener from brooklyn.properties reload notifications 
-     */
-    void removePropertiesReloadListener(PropertiesReloadListener listener);
-
-    /**
-     * Active entitlements checker instance.
-     */
-    EntitlementManager getEntitlementManager();
- 
-    /** As {@link #lookup(String, Class)} but not constraining the return type */
-    public BrooklynObject lookup(String id);
-    
-    /** Finds an entity with the given ID known at this management context */
-    // TODO in future support policies etc
-    public <T extends BrooklynObject> T lookup(String id, Class<T> type); 
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java
deleted file mode 100644
index 3328b1a..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.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 org.apache.brooklyn.api.mgmt;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-
-/**
- * This is the context through which an {@link Entity} can manage its subscriptions.
- */
-public interface SubscriptionContext {
-    /**
-     * As {@link SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)} with default subscription parameters for this context
-     */
-    <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
-    
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToChildren(Map<String, Object> flags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
-    
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToMembers(Map<String, Object> flags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
-    
-    /** @see SubscriptionManager#unsubscribe(SubscriptionHandle) */
-    boolean unsubscribe(SubscriptionHandle subscriptionId);
-    
-    /** causes all subscriptions to be deregistered
-     * @return number of subscriptions removed */
-    int unsubscribeAll();
-
-    /** @see SubscriptionManager#publish(SensorEvent) */
-    <T> void publish(SensorEvent<T> event);
-
-    /** Return the subscriptions associated with this context */
-    Set<SubscriptionHandle> getSubscriptions();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
deleted file mode 100644
index bb4de8c..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
+++ /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.
- */
-package org.apache.brooklyn.api.mgmt;
-
-/**
- * A "receipt" returned by {@link SubscriptionContext} and {@link SubscriptionManager}'s {@code subscribe()} 
- * methods. It can be used to unsubscribe - see {@link SubscriptionContext#unsubscribe(SubscriptionHandle)} 
- * and {@link SubscriptionManager#unsubscribe(SubscriptionHandle)}.
- */
-public interface SubscriptionHandle {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java
deleted file mode 100644
index 1fa327e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.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 org.apache.brooklyn.api.mgmt;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-
-/**
- * The management interface for subscriptions.
- * 
- * Different implementations will handle entities subscribing and unsubscribing to {@link SensorEvent}s
- * and their delivery.
- * 
- * @see SubscriptionContext
- */
-public interface SubscriptionManager {
-    /**
-     * Subscribe to {@link Sensor} data changes and events on a given {@link Entity}, supplying the {@link SensorEventListener}
-     * to invoke when they occur.
-     * 
-     * The method returns an id which can be used to {@link #unsubscribe(SubscriptionHandle)} later.
-     * <p>
-     * The listener callback is in-order single-threaded and synchronized on this object. The flags
-     * parameters can include the following:
-     * <ul>
-     * <li>subscriber - object to identify the subscriber (e.g. entity, or console session uid) 
-     * <li><i>in future</i> - control parameters for the subscription (period, minimum delta for updates, etc)
-     * </ul>
-     * 
-     * @param flags optional parameters to be associated with the subscription
-     * @param producer entity to listen to, or null to listen to all entities
-     * @param sensor sensor channel of events to listen to, or null for all sensors from the given producer(s)
-     * @param listener callback to invoke when an event occurs
-     * @return an id for this subscription
-     * 
-     * @see #unsubscribe(SubscriptionHandle)
-     */
-    <T> SubscriptionHandle subscribe(Map<String, Object> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-    /**
-     * Subscribe to {@link Sensor} data changes and events on all children of a given {@link Entity}, supplying the
-     * {@link SensorEventListener} to invoke when they occur.
-     * 
-     * The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
-     * sensor datum. The semantics are otherwise identical to the {@link #subscribe(Map, Entity, Sensor, SensorEventListener)} method.
-     *
-     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
-     */
-    <T> SubscriptionHandle subscribeToChildren(Map<String, Object> flags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-    /**
-     * Subscribe to {@link Sensor} data changes and events on all members of a given {@link Group}, supplying the
-     * {@link SensorEventListener} to invoke when they occur.
-     * 
-     * The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
-     * sensor datum. The semantics are otherwise identical to the {@link #subscribe(Map, Entity, Sensor, SensorEventListener)} method.
-     *
-     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
-     */
-    <T> SubscriptionHandle subscribeToMembers(Map<String, Object> flags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
- 
-    /** @see #subscribeToMembers(Map, Group, Sensor, SensorEventListener) */
-    <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
-
-    /**
-     * Unsubscribe the given subscription id.
-     * 
-     * @return true if such a subscription was present (and it will now be removed)
-     * 
-     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
-     */
-    boolean unsubscribe(SubscriptionHandle subscriptionId);
-
-    /**
-     * Deliver a {@link SensorEvent} to all subscribed listeners.
-     */
-    <T> void publish(SensorEvent<T> event);
-
-    /** Return the subscriptions requested by a given subscriber */
-    Set<SubscriptionHandle> getSubscriptionsForSubscriber(Object subscriber);
-    
-    /** Return the subscriptions on a given source-sensor pair */
-    Set<SubscriptionHandle> getSubscriptionsForEntitySensor(Entity source, Sensor<?> sensor);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
deleted file mode 100644
index 42147c5..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
+++ /dev/null
@@ -1,146 +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.api.mgmt;
-
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Represents a unit of work for execution.
- *
- * When used with an {@link ExecutionManager} or {@link ExecutionContext} it will record submission time,
- * execution start time, end time, and any result. A task can be submitted to the ExecutionManager or
- * ExecutionContext, in which case it will be returned, or it may be created by submission
- * of a {@link Runnable} or {@link Callable} and thereafter it can be treated just like a {@link Future}.
- */
-public interface Task<T> extends ListenableFuture<T>, TaskAdaptable<T> {
-    
-    public String getId();
-    
-    public Set<Object> getTags();
-    /** if {@link #isSubmitted()} returns the time when the task was submitted; or -1 otherwise */
-    public long getSubmitTimeUtc();
-    /** if {@link #isBegun()} returns the time when the task was starts;
-     * guaranteed to be >= {@link #getSubmitTimeUtc()} > 0 if started, or -1 otherwise */
-    public long getStartTimeUtc();
-    /** if {@link #isDone()} (for any reason) returns the time when the task ended;
-     * guaranteed to be >= {@link #getStartTimeUtc()} > 0 if ended, or -1 otherwise */
-    public long getEndTimeUtc();
-    public String getDisplayName();
-    public String getDescription();
-    
-    /** task which submitted this task, if was submitted by a task */
-    public Task<?> getSubmittedByTask();
-
-    /** The thread where the task is running, if it is running. */
-    public Thread getThread();
-
-    /**
-     * Whether task has been submitted
-     *
-     * Submitted tasks are normally expected to start running then complete,
-     * but unsubmitted tasks are sometimes passed around for someone else to submit them.
-     */
-    public boolean isSubmitted();
-
-    /**
-     * Whether task has started running.
-     *
-     * Will remain true after normal completion or non-cancellation error.
-     * will be true on cancel iff the thread did actually start.
-     */
-    public boolean isBegun();
-
-    /**
-     * Whether the task threw an error, including cancellation (implies {@link #isDone()})
-     */
-    public boolean isError();
-
-    /**
-     * As {@link Future#isDone()}. In particular if cancelled, this will return true
-     * as soon as it is cancelled. The thread for this task may still be running,
-     * if the cancellation (often an interruption, but may be weaker) has not applied,
-     * and submitted threads may also be running depending on cancellation parameters.
-     * <p>
-     * {@link #get()} is guaranteed to return immediately, throwing in the case of cancellation
-     * prior to completion (and including the case above where a thread may still be running).
-     * <p>
-     * To check whether cancelled threads for this task have completed, 
-     * inspect {@link #getEndTimeUtc()}, which is guaranteed to be set when threads complete
-     * if the thread is started (as determinable by whether {@link #getStartTimeUtc()} is set).
-     * (The threads of submitted/child tasks will usually be independent; to determine their
-     * completion requires inspecting the {@link ExecutionManager}.)  
-     */
-    @Override
-    public boolean isDone();
-    
-    /**
-     * Causes calling thread to block until the task is started.
-     */
-    public void blockUntilStarted();
-
-    /**
-     * Causes calling thread to block until the task is ended.
-     * <p>
-     * Either normally or by cancellation or error, but without throwing error on cancellation or error.
-     * (Errors are logged at debug.)
-     */
-    public void blockUntilEnded();
-
-    /**
-     * As {@link #blockUntilEnded()}, but returning after the given timeout;
-     * true if the task has ended and false otherwise
-     */
-    public boolean blockUntilEnded(Duration timeout);
-
-    public String getStatusSummary();
-
-    /**
-     * Returns detailed status, suitable for a hover.
-     *
-     * Plain-text format, with new-lines (and sometimes extra info) if multiline enabled.
-     */
-    public String getStatusDetail(boolean multiline);
-
-    /** As {@link #get(long, java.util.concurrent.TimeUnit)} */
-    public T get(Duration duration) throws InterruptedException, ExecutionException, TimeoutException;
-    
-    /** As {@link #get()}, but propagating checked exceptions as unchecked for convenience. */
-    public T getUnchecked();
-
-    /** As {@link #get()}, but propagating checked exceptions as unchecked for convenience
-     * (including a {@link TimeoutException} if the duration expires) */
-    public T getUnchecked(Duration duration);
-
-    /** As {@link Future#cancel(boolean)}. Note that {@link #isDone()} and {@link #blockUntilEnded(Duration)} return immediately
-     * once a task is cancelled, consistent with the underlying {@link FutureTask} behaviour.  
-     * TODO Fine-grained control over underlying jobs, e.g. to ensure anything represented by this task is actually completed,
-     * is not (yet) publicly exposed. See the convenience method blockUntilInternalTasksEnded in the Tasks set of helpers
-     * for more discussion. */
-    public boolean cancel(boolean mayInterruptIfRunning);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java
deleted file mode 100644
index 4b371be..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.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 org.apache.brooklyn.api.mgmt;
-
-/** marker interface for something which can be adapted to a task  */
-public interface TaskAdaptable<T> {
-    Task<T> asTask();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
deleted file mode 100644
index adc4817..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
+++ /dev/null
@@ -1,25 +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.api.mgmt;
-
-
-/** Interface for something which can generate tasks (or task wrappers) */
-public interface TaskFactory<T extends TaskAdaptable<?>> {
-    T newTask();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java
deleted file mode 100644
index 9794c5e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.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 org.apache.brooklyn.api.mgmt;
-
-import java.util.List;
-
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Marks a place where tasks can be added, e.g. a task which allows children to be added (including after it is activated);
- * if the implementer of this is also a task, then it may be picked up by hierarchical methods (e.g. in DynamicTasks).
- * 
- * @since 0.6.0
- */
-@Beta
-public interface TaskQueueingContext {
-
-    /** queues the task for submission as part of this queueing context
-     * <p>
-     * implementations should mark it as queued but not yet submitted.
-     * note the task may have already been submitted, and is being queued here for informational purposes,
-     * in which case the implementation should not run it. */
-    public void queue(Task<?> t);
-    
-    /** returns a list of queued tasks (immutable copy) */
-    public List<Task<?>> getQueue();
-
-    /** Drains the task queue for this context to complete, ie waits for this context to complete (or terminate early)
-     * @param optionalTimeout null to run forever
-     * @param includePrimaryThread whether the parent (this context) should also be joined on;
-     *   should only be true if invoking this from another task, as otherwise it will be waiting for itself!
-     * @param throwFirstError whether to throw the first exception encountered
-     * <p>
-     * Also note that this waits on tasks so that blocking details on the caller are meaningful.
-     */
-    public void drain(Duration optionalTimeout, boolean includePrimaryThread, boolean throwFirstError);
-
-    /** Returns the task which is this queueing context */
-    public Task<?> asTask();
-
-    /** causes subsequent children failures not to fail the parent */
-    public void swallowChildrenFailures();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
deleted file mode 100644
index a66b2e5..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
+++ /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.
- */
-package org.apache.brooklyn.api.mgmt;
-
-/**
- * Interface for something which is not a task, but which is closely linked to one, ie. it has a task.
- * 
- * @since 0.6.0
- */
-public interface TaskWrapper<T> extends TaskAdaptable<T> {
-    Task<T> getTask();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java
deleted file mode 100644
index f95c0d8..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.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 org.apache.brooklyn.api.mgmt.classloading;
-
-import java.net.URL;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.guava.Maybe;
-
-/** 
- * Provides functionality for loading classes based on the current context
- * (e.g. the bundles of a registered type from which an entity is created)
- */
-public interface BrooklynClassLoadingContext {
-
-    public ManagementContext getManagementContext();
-    public Class<?> loadClass(String className);
-    public <T> Class<? extends T> loadClass(String className, @Nullable Class<T> supertype);
-
-    public Maybe<Class<?>> tryLoadClass(String className);
-    public <T> Maybe<Class<? extends T>> tryLoadClass(String className, @Nullable Class<T> supertype);
-
-    /** As {@link ClassLoader#getResource(String)} */
-    public URL getResource(String name);
-
-    /**
-     * As {@link ClassLoader#getResources(String)} but returning an {@link Iterable} rather than
-     * an {@link java.util.Enumeration}.
-     */
-    public Iterable<URL> getResources(String name);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
deleted file mode 100644
index a44a621..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
+++ /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.
- */
-package org.apache.brooklyn.api.mgmt.entitlement;
-
-import com.google.common.reflect.TypeToken;
-
-/** @see EntitlementManager */
-public interface EntitlementClass<T> {
-    String entitlementClassIdentifier();
-    TypeToken<T> entitlementClassArgumentType();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java
deleted file mode 100644
index 8525adc..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.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 org.apache.brooklyn.api.mgmt.entitlement;
-
-/** @see EntitlementManager */
-public interface EntitlementContext {
-    String user();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
deleted file mode 100644
index 54fcd7e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
+++ /dev/null
@@ -1,45 +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.api.mgmt.entitlement;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * Entitlement lookup relies on:
- * <li>an "entitlement context", consisting of at minimum a string identifier of the user/actor for which entitlement is being requested
- * <li>an "entitlement class", representing the category of activity for which entitlement is being requested
- * <li>an "entitlement class argument", representing the specifics of the activity for which entitlement is being requested
- * <p>
- * Instances of this class typically have a 1-arg constructor taking a BrooklynProperties object
- * (configuration injected by the Brooklyn framework)
- * or a 0-arg constructor (if no external configuration is needed).
- * <p>
- * An EntitlementManagerAdapter class is available to do dispatch to common methods.
- * <p>
- * Instantiation is done e.g. by Entitlements.newManager.  
- * @since 0.7.0 */
-@Beta
-public interface EntitlementManager {
-
-    public <T> boolean isEntitled(@Nullable EntitlementContext context, @Nonnull EntitlementClass<T> entitlementClass, @Nullable T entitlementClassArgument);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
deleted file mode 100644
index 6724a03..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
+++ /dev/null
@@ -1,129 +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.api.mgmt.ha;
-
-import java.util.Map;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Monitors other management nodes (via the {@link ManagementPlaneSyncRecordPersister}) to detect
- * if the current master has failed or stopped. If so, then deterministically chooses a new master.
- * If that master is self, then promotes.
-
- * Users are not expected to implement this class, or to call methods on it directly.
- * 
- * Expected lifecycle of methods calls on this is:
- * <ol>
- *   <li>{@link #setPersister(ManagementPlaneSyncRecordPersister)}
- *   <li>Exactly one of {@link #disabled()} or {@link #start(HighAvailabilityMode)}
- *   <li>{@link #stop()}
- * </ol>
- * 
- * @since 0.7.0
- */
-@Beta
-public interface HighAvailabilityManager {
-
-    ManagementNodeState getNodeState();
-    
-    /** The time in milliseconds when the state was last changed. -1 if no state transition has occurred yet.*/
-    long getLastStateChange();
-    
-    /**
-     * @param persister
-     * @return self
-     */
-    HighAvailabilityManager setPersister(ManagementPlaneSyncRecordPersister persister);
-
-    /**
-     * Indicates that HA is disabled: this node will act as the only management node in this management plane,
-     * and will not persist HA meta-information (meaning other nodes cannot join). 
-     * <p>
-     * Subsequently can expect {@link #getNodeState()} to be {@link ManagementNodeState#MASTER} 
-     * and {@link #loadManagementPlaneSyncRecord(boolean)} to show just this one node --
-     * as if it were running HA with just one node --
-     * but {@link #isRunning()} will return false.
-     * <p>
-     * Currently this method is intended to be called early in the lifecycle,
-     * instead of {@link #start(HighAvailabilityMode)}. It may be an error if
-     * this is called after this HA Manager is started.
-     */
-    @Beta
-    void disabled();
-
-    /** Whether HA mode is operational */
-    boolean isRunning();
-    
-    /**
-     * Starts the monitoring of other nodes (and thus potential promotion of this node from standby to master).
-     * <p>
-     * When this method returns, the status of this node will be set,
-     * either {@link ManagementNodeState#MASTER} if appropriate 
-     * or {@link ManagementNodeState#STANDBY} / {@link ManagementNodeState#HOT_STANDBY} / {@link ManagementNodeState#HOT_BACKUP}.
-     *
-     * @param startMode mode to start with
-     * @throws IllegalStateException if current state of the management-plane doesn't match that desired by {@code startMode} 
-     */
-    void start(HighAvailabilityMode startMode);
-
-    /**
-     * Stops this node, then publishes own status (via {@link ManagementPlaneSyncRecordPersister} of {@link ManagementNodeState#TERMINATED}.
-     */
-    void stop();
-
-    /** changes the mode that this HA server is running in
-     * <p>
-     * note it will be an error to {@link #changeMode(HighAvailabilityMode)} to {@link ManagementNodeState#MASTER} 
-     * when there is already a master; to promote a node explicitly set its priority higher than
-     * the others and invoke {@link #changeMode(HighAvailabilityMode)} to a standby mode on the existing master */
-    void changeMode(HighAvailabilityMode mode);
-
-    /** sets the priority, and publishes it synchronously so it is canonical */
-    void setPriority(long priority);
-    
-    long getPriority();
-
-    /** deletes non-master node records; active nodes (including this) will republish, 
-     * so this provides a simple way to clean out the cache of dead brooklyn nodes */
-    @Beta
-    void publishClearNonMaster();
-
-    /**
-     * Returns a snapshot of the management-plane's current / most-recently-known status,
-     * as last read from {@link #loadManagementPlaneSyncRecord(boolean)}, or null if none read.
-     */
-    ManagementPlaneSyncRecord getLastManagementPlaneSyncRecord();
-    
-    /**
-     * @param useLocalKnowledgeForThisNode - if true, the record for this mgmt node will be replaced with the
-     * actual current status known in this JVM (may be more recent than what is persisted);
-     * for most purposes there is little difference but in some cases the local node being updated
-     * may be explicitly wanted or not wanted
-     */
-    ManagementPlaneSyncRecord loadManagementPlaneSyncRecord(boolean useLocalKnowledgeForThisNode);
-    
-    @VisibleForTesting
-    ManagementPlaneSyncRecordPersister getPersister();
-
-    /** Returns a collection of metrics */
-    Map<String,Object> getMetrics();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
deleted file mode 100644
index 146057d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
+++ /dev/null
@@ -1,67 +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.api.mgmt.ha;
-
-/** Specifies the HA mode that a mgmt node should run in */
-public enum HighAvailabilityMode {
-    /** 
-     * Means HA mode should not be operational.
-     * <p>
-     * When specified for the initial HA mode, this simply turns off HA.
-     * <p>
-     * However if being used to {@link HighAvailabilityManager#changeMode(HighAvailabilityMode)},
-     * this will cause the node to transition to a {@link ManagementNodeState#FAILED} state.
-     * Switching to a "master-but-not-part-of-HA" state is not currently supported, as this would be
-     * problematic if another node (which was part of HA) then tries to become master,
-     * and the more common use of this at runtime is to disable a node from being part of the HA plane. 
-     */
-    DISABLED,
-    
-    /**
-     * Means auto-detect whether to be master or standby; if there is already a master then start as standby, 
-     * otherwise start as master.
-     */
-    AUTO,
-    
-    /**
-     * Means node must be lukewarm standby; if there is not already a master then fail fast on startup.
-     * See {@link ManagementNodeState#STANDBY}. 
-     */
-    STANDBY,
-    
-    /**
-     * Means node must be hot standby; if there is not already a master then fail fast on startup.
-     * See {@link ManagementNodeState#HOT_STANDBY}. 
-     */
-    HOT_STANDBY,
-    
-    /**
-     * Means node must be hot backup; do not attempt to become master (but it <i>can</i> start without a master).
-     * See {@link ManagementNodeState#HOT_BACKUP}. 
-     */
-    HOT_BACKUP,
-    
-    /**
-     * Means node must be master; if there is already a master then fail fast on startup.
-     * See {@link ManagementNodeState#MASTER}.
-     */
-    // TODO when multi-master supported we will of course not fail fast on startup when there is already a master;
-    // instead the responsibility for master entities will be divided among masters
-    MASTER;
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java
deleted file mode 100644
index 6e42796..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.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 org.apache.brooklyn.api.mgmt.ha;
-
-import org.apache.brooklyn.util.guava.Maybe;
-
-public enum ManagementNodeState {
-    /** Node is either coming online, or is in some kind of recovery/transitioning mode */
-    INITIALIZING,
-    
-    /** Node is in "lukewarm standby" mode, where it is available to be promoted to master,
-     * but does not have entities loaded and will require some effort to be promoted */
-    STANDBY,
-    /** Node is acting as read-only proxy available to be promoted to master on existing master failure */
-    HOT_STANDBY,
-    /** Node is acting as a read-only proxy but not making itself available for promotion to master */
-    HOT_BACKUP,
-    /** Node is running as primary/master, able to manage entities and create new ones */
-    // the semantics are intended to support multi-master here; we could have multiple master nodes,
-    // but we need to look up who is master for any given entity
-    MASTER,
-
-    /** Node has failed and requires maintenance attention */
-    FAILED,
-    /** Node has gone away; maintenance not possible */
-    TERMINATED;
-
-    /** Converts a {@link HighAvailabilityMode} to a {@link ManagementNodeState}, if possible */
-    public static Maybe<ManagementNodeState> of(HighAvailabilityMode startMode) {
-        switch (startMode) {
-        case AUTO:
-        case DISABLED:
-            return Maybe.absent("Requested "+HighAvailabilityMode.class+" mode "+startMode+" cannot be converted to "+ManagementNodeState.class);
-        case HOT_BACKUP:
-            return Maybe.of(HOT_BACKUP);
-        case HOT_STANDBY:
-            return Maybe.of(HOT_STANDBY);
-        case MASTER:
-            return Maybe.of(MASTER);
-        case STANDBY:
-            return Maybe.of(STANDBY);
-        }
-        // above should be exhaustive
-        return Maybe.absent("Requested "+HighAvailabilityMode.class+" mode "+startMode+" was not expected");
-    }
-
-    /** true for hot non-master modes, where we are proxying the data from the persistent store */
-    public static boolean isHotProxy(ManagementNodeState state) {
-        return state==HOT_BACKUP || state==HOT_STANDBY;
-    }
-
-    /** true for non-master modes which can be promoted to master */
-    public static boolean isStandby(ManagementNodeState state) {
-        return state==ManagementNodeState.STANDBY || state==ManagementNodeState.HOT_STANDBY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java
deleted file mode 100644
index dccbd01..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.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 org.apache.brooklyn.api.mgmt.ha;
-
-import java.net.URI;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Represents the state of a management-node.
- * 
- * @see {@link ManagementPlaneSyncRecord#getManagementNodes()}
- * 
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public interface ManagementNodeSyncRecord {
-
-    // TODO Not setting URI currently; ManagementContext doesn't know its URI; only have one if web-console was enabled.
-    
-    // TODO Add getPlaneId(); but first need to set it in a sensible way
-    
-    String getBrooklynVersion();
-    
-    String getNodeId();
-    
-    URI getUri();
-    
-    ManagementNodeState getStatus();
-
-    Long getPriority();
-    
-    /** timestamp set by the originating management machine */
-    long getLocalTimestamp();
-
-    /** timestamp set by shared persistent store, if available
-     * <p>
-     * this will not be set on records originating at this machine, nor will it be persisted,
-     * but it will be populated for records being read */
-    Long getRemoteTimestamp();
-    
-    String toVerboseString();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java
deleted file mode 100644
index 86bb74e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.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.api.mgmt.ha;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMemento;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Meta-data about the management plane - the management nodes and who is currently master.
- * Does not contain any data about the entities under management.
- * <p>
- * This is very similar to how {@link BrooklynMemento} is used by {@link BrooklynMementoPersister},
- * but it is not a memento in the sense it does not reconstitute the entire management plane
- * (so is not called Memento although it can be used by the same memento-serializers).
- * 
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public interface ManagementPlaneSyncRecord {
-
-    // TODO Add getPlaneId(); but first need to set it sensibly on each management node
-    
-    String getMasterNodeId();
-    
-    /** returns map of {@link ManagementNodeSyncRecord} instances keyed by the nodes' IDs */
-    Map<String, ManagementNodeSyncRecord> getManagementNodes();
-
-    String toVerboseString();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
deleted file mode 100644
index 16ff913..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
+++ /dev/null
@@ -1,68 +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.api.mgmt.ha;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Controls the persisting and reading back of mementos relating to the management plane.
- * This state does not relate to the entities being managed.
- * 
- * @see {@link HighAvailabilityManager#setPersister(ManagementPlaneSyncRecordPersister)} for its use in management-node failover
- * 
- * @since 0.7.0
- */
-@Beta
-public interface ManagementPlaneSyncRecordPersister {
-
-    /**
-     * Analogue to {@link BrooklynMementoPersister#loadMemento(org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext)}
-     * <p>
-     * Note that this method is *not* thread safe.
-     */
-    ManagementPlaneSyncRecord loadSyncRecord() throws IOException;
-    
-    void delta(Delta delta);
-
-    void stop();
-
-    @VisibleForTesting
-    void waitForWritesCompleted(Duration timeout) throws InterruptedException, TimeoutException;
-    
-    public interface Delta {
-        public enum MasterChange {
-            NO_CHANGE,
-            SET_MASTER,
-            CLEAR_MASTER
-        }
-        Collection<ManagementNodeSyncRecord> getNodes();
-        Collection<String> getRemovedNodeIds();
-        MasterChange getMasterChange();
-        String getNewMasterOrNull();
-        String getExpectedMasterToClear();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
deleted file mode 100644
index 320c264..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
+++ /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.
- */
-package org.apache.brooklyn.api.mgmt.ha;
-
-public enum MementoCopyMode {
-    /** Use items currently managed at this node */ 
-    LOCAL,
-    /** Use items as stored in the remote persistence store */ 
-    REMOTE, 
-    /** Auto-detect whether to use {@link #LOCAL} or {@link #REMOTE} depending on the
-     * HA mode of this management node (usually {@link #LOCAL} for master and {@link #REMOTE} otherwise)*/ 
-    AUTO 
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java
deleted file mode 100644
index ce26a82..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.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 org.apache.brooklyn.api.mgmt.rebind;
-
-import org.apache.brooklyn.api.objs.BrooklynObject;
-
-/**
- * Listener to be notified of changes within brooklyn, so that the new state
- * of the entity/location/policy can be persisted.
- * 
- * Users are not expected to implement this class. It is for use by the {@link RebindManager}.
- * 
- * @author aled
- */
-public interface ChangeListener {
-
-    public static final ChangeListener NOOP = new ChangeListener() {
-        @Override public void onChanged(BrooklynObject instance) {}
-        @Override public void onManaged(BrooklynObject instance) {}
-        @Override public void onUnmanaged(BrooklynObject instance) {}
-    };
-
-    void onManaged(BrooklynObject instance);
-    
-    void onUnmanaged(BrooklynObject instance);
-    
-    void onChanged(BrooklynObject instance);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java
deleted file mode 100644
index 759bca6..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.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 org.apache.brooklyn.api.mgmt.rebind;
-
-import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Handler called on all exceptions to do with persistence.
- * 
- * @author aled
- */
-@Beta
-public interface PersistenceExceptionHandler {
-
-    void stop();
-
-    void onGenerateMementoFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
-    
-    void onPersistMementoFailed(Memento memento, Exception e);
-    
-    void onPersistRawMementoFailed(BrooklynObjectType type, String id, Exception e);
-
-    void onDeleteMementoFailed(String id, Exception e);
-}


[51/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!)

Posted by he...@apache.org.
move subdir from incubator up a level as it is promoted to its own repo (first non-incubator commit!)


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

Branch: refs/heads/master
Commit: d03f254ba19472e3fb5e0a7260cb07679991684a
Parents: d7470c2
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Sat Jan 30 15:18:27 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Jan 30 15:18:27 2016 +0000

----------------------------------------------------------------------
 README.md                                       |   40 +-
 api/pom.xml                                     |   64 +
 .../brooklyn/api/catalog/BrooklynCatalog.java   |  141 +
 .../apache/brooklyn/api/catalog/Catalog.java    |   42 +
 .../brooklyn/api/catalog/CatalogConfig.java     |   38 +
 .../brooklyn/api/catalog/CatalogItem.java       |  153 +
 .../apache/brooklyn/api/effector/Effector.java  |   56 +
 .../brooklyn/api/effector/ParameterType.java    |   48 +
 .../apache/brooklyn/api/entity/Application.java |   34 +
 .../org/apache/brooklyn/api/entity/Entity.java  |  442 +++
 .../brooklyn/api/entity/EntityInitializer.java  |   50 +
 .../apache/brooklyn/api/entity/EntityLocal.java |  175 +
 .../apache/brooklyn/api/entity/EntitySpec.java  |  401 +++
 .../apache/brooklyn/api/entity/EntityType.java  |   73 +
 .../brooklyn/api/entity/EntityTypeRegistry.java |   63 +
 .../org/apache/brooklyn/api/entity/Group.java   |   71 +
 .../brooklyn/api/entity/ImplementedBy.java      |   46 +
 .../entity/drivers/DriverDependentEntity.java   |   36 +
 .../api/entity/drivers/EntityDriver.java        |   54 +
 .../api/entity/drivers/EntityDriverManager.java |   49 +
 .../drivers/downloads/DownloadResolver.java     |   58 +
 .../downloads/DownloadResolverManager.java      |  158 +
 .../internal/AbstractBrooklynObjectSpec.java    |  319 ++
 .../api/internal/ApiObjectsFactory.java         |   61 +
 .../internal/ApiObjectsFactoryInterface.java    |   29 +
 .../api/location/AddressableLocation.java       |   43 +
 .../BasicMachineLocationCustomizer.java         |   41 +
 .../brooklyn/api/location/HardwareDetails.java  |   40 +
 .../apache/brooklyn/api/location/Location.java  |  137 +
 .../api/location/LocationDefinition.java        |   42 +
 .../location/LocationNotAvailableException.java |   35 +
 .../brooklyn/api/location/LocationRegistry.java |  128 +
 .../brooklyn/api/location/LocationResolver.java |   57 +
 .../brooklyn/api/location/LocationSpec.java     |  168 +
 .../brooklyn/api/location/LocationType.java     |   32 +
 .../brooklyn/api/location/MachineDetails.java   |   34 +
 .../brooklyn/api/location/MachineLocation.java  |   46 +
 .../api/location/MachineLocationCustomizer.java |   42 +
 .../api/location/MachineManagementMixins.java   |   91 +
 .../location/MachineProvisioningLocation.java   |   72 +
 .../location/NoMachinesAvailableException.java  |   35 +
 .../apache/brooklyn/api/location/OsDetails.java |   46 +
 .../apache/brooklyn/api/location/PortRange.java |   48 +
 .../brooklyn/api/location/PortSupplier.java     |   50 +
 .../api/location/ProvisioningLocation.java      |   44 +
 .../brooklyn/api/mgmt/AccessController.java     |   65 +
 .../apache/brooklyn/api/mgmt/EntityManager.java |  126 +
 .../brooklyn/api/mgmt/ExecutionContext.java     |   67 +
 .../brooklyn/api/mgmt/ExecutionManager.java     |  117 +
 .../brooklyn/api/mgmt/HasTaskChildren.java      |   39 +
 .../brooklyn/api/mgmt/LocationManager.java      |   87 +
 .../brooklyn/api/mgmt/ManagementContext.java    |  267 ++
 .../brooklyn/api/mgmt/SubscriptionContext.java  |   66 +
 .../brooklyn/api/mgmt/SubscriptionHandle.java   |   27 +
 .../brooklyn/api/mgmt/SubscriptionManager.java  |  112 +
 .../java/org/apache/brooklyn/api/mgmt/Task.java |  146 +
 .../apache/brooklyn/api/mgmt/TaskAdaptable.java |   24 +
 .../apache/brooklyn/api/mgmt/TaskFactory.java   |   25 +
 .../brooklyn/api/mgmt/TaskQueueingContext.java  |   62 +
 .../apache/brooklyn/api/mgmt/TaskWrapper.java   |   28 +
 .../BrooklynClassLoadingContext.java            |   50 +
 .../api/mgmt/entitlement/EntitlementClass.java  |   27 +
 .../mgmt/entitlement/EntitlementContext.java    |   24 +
 .../mgmt/entitlement/EntitlementManager.java    |   45 +
 .../api/mgmt/ha/HighAvailabilityManager.java    |  129 +
 .../api/mgmt/ha/HighAvailabilityMode.java       |   67 +
 .../api/mgmt/ha/ManagementNodeState.java        |   72 +
 .../api/mgmt/ha/ManagementNodeSyncRecord.java   |   62 +
 .../api/mgmt/ha/ManagementPlaneSyncRecord.java  |   51 +
 .../ha/ManagementPlaneSyncRecordPersister.java  |   68 +
 .../brooklyn/api/mgmt/ha/MementoCopyMode.java   |   29 +
 .../api/mgmt/rebind/ChangeListener.java         |   44 +
 .../rebind/PersistenceExceptionHandler.java     |   44 +
 .../brooklyn/api/mgmt/rebind/RebindContext.java |   52 +
 .../api/mgmt/rebind/RebindExceptionHandler.java |  119 +
 .../brooklyn/api/mgmt/rebind/RebindManager.java |  132 +
 .../brooklyn/api/mgmt/rebind/RebindSupport.java |   57 +
 .../brooklyn/api/mgmt/rebind/Rebindable.java    |   40 +
 .../mgmt/rebind/mementos/BrooklynMemento.java   |   64 +
 .../mementos/BrooklynMementoManifest.java       |   58 +
 .../mementos/BrooklynMementoPersister.java      |  138 +
 .../rebind/mementos/BrooklynMementoRawData.java |  185 +
 .../rebind/mementos/CatalogItemMemento.java     |   54 +
 .../mgmt/rebind/mementos/EnricherMemento.java   |   33 +
 .../api/mgmt/rebind/mementos/EntityMemento.java |   80 +
 .../api/mgmt/rebind/mementos/FeedMemento.java   |   33 +
 .../mgmt/rebind/mementos/LocationMemento.java   |   38 +
 .../api/mgmt/rebind/mementos/Memento.java       |   85 +
 .../api/mgmt/rebind/mementos/PolicyMemento.java |   35 +
 .../api/mgmt/rebind/mementos/TreeNode.java      |   48 +
 .../brooklyn/api/objs/BrooklynObject.java       |  169 +
 .../brooklyn/api/objs/BrooklynObjectType.java   |   79 +
 .../apache/brooklyn/api/objs/BrooklynType.java  |   57 +
 .../apache/brooklyn/api/objs/Configurable.java  |  101 +
 .../apache/brooklyn/api/objs/EntityAdjunct.java |   53 +
 .../apache/brooklyn/api/objs/HasShortName.java  |   26 +
 .../apache/brooklyn/api/objs/Identifiable.java  |   24 +
 .../apache/brooklyn/api/objs/SpecParameter.java |   42 +
 .../org/apache/brooklyn/api/policy/Policy.java  |   80 +
 .../apache/brooklyn/api/policy/PolicySpec.java  |   76 +
 .../apache/brooklyn/api/policy/PolicyType.java  |   36 +
 .../api/relations/RelationshipType.java         |   38 +
 .../brooklyn/api/sensor/AttributeSensor.java    |   52 +
 .../apache/brooklyn/api/sensor/Enricher.java    |   61 +
 .../brooklyn/api/sensor/EnricherSpec.java       |  140 +
 .../brooklyn/api/sensor/EnricherType.java       |   36 +
 .../org/apache/brooklyn/api/sensor/Feed.java    |   74 +
 .../org/apache/brooklyn/api/sensor/Sensor.java  |   77 +
 .../apache/brooklyn/api/sensor/SensorEvent.java |   47 +
 .../api/sensor/SensorEventListener.java         |   37 +
 .../api/typereg/BrooklynTypeRegistry.java       |   78 +
 .../brooklyn/api/typereg/OsgiBundleWithUrl.java |   36 +
 .../brooklyn/api/typereg/RegisteredType.java    |   96 +
 .../typereg/RegisteredTypeLoadingContext.java   |   50 +
 brooklyn-server/.gitattributes                  |    6 -
 brooklyn-server/.gitignore                      |   32 -
 brooklyn-server/LICENSE                         |  455 ---
 brooklyn-server/NOTICE                          |    5 -
 brooklyn-server/README.md                       |    7 -
 brooklyn-server/api/pom.xml                     |   64 -
 .../brooklyn/api/catalog/BrooklynCatalog.java   |  141 -
 .../apache/brooklyn/api/catalog/Catalog.java    |   42 -
 .../brooklyn/api/catalog/CatalogConfig.java     |   38 -
 .../brooklyn/api/catalog/CatalogItem.java       |  153 -
 .../apache/brooklyn/api/effector/Effector.java  |   56 -
 .../brooklyn/api/effector/ParameterType.java    |   48 -
 .../apache/brooklyn/api/entity/Application.java |   34 -
 .../org/apache/brooklyn/api/entity/Entity.java  |  442 ---
 .../brooklyn/api/entity/EntityInitializer.java  |   50 -
 .../apache/brooklyn/api/entity/EntityLocal.java |  175 -
 .../apache/brooklyn/api/entity/EntitySpec.java  |  401 ---
 .../apache/brooklyn/api/entity/EntityType.java  |   73 -
 .../brooklyn/api/entity/EntityTypeRegistry.java |   63 -
 .../org/apache/brooklyn/api/entity/Group.java   |   71 -
 .../brooklyn/api/entity/ImplementedBy.java      |   46 -
 .../entity/drivers/DriverDependentEntity.java   |   36 -
 .../api/entity/drivers/EntityDriver.java        |   54 -
 .../api/entity/drivers/EntityDriverManager.java |   49 -
 .../drivers/downloads/DownloadResolver.java     |   58 -
 .../downloads/DownloadResolverManager.java      |  158 -
 .../internal/AbstractBrooklynObjectSpec.java    |  319 --
 .../api/internal/ApiObjectsFactory.java         |   61 -
 .../internal/ApiObjectsFactoryInterface.java    |   29 -
 .../api/location/AddressableLocation.java       |   43 -
 .../BasicMachineLocationCustomizer.java         |   41 -
 .../brooklyn/api/location/HardwareDetails.java  |   40 -
 .../apache/brooklyn/api/location/Location.java  |  137 -
 .../api/location/LocationDefinition.java        |   42 -
 .../location/LocationNotAvailableException.java |   35 -
 .../brooklyn/api/location/LocationRegistry.java |  128 -
 .../brooklyn/api/location/LocationResolver.java |   57 -
 .../brooklyn/api/location/LocationSpec.java     |  168 -
 .../brooklyn/api/location/LocationType.java     |   32 -
 .../brooklyn/api/location/MachineDetails.java   |   34 -
 .../brooklyn/api/location/MachineLocation.java  |   46 -
 .../api/location/MachineLocationCustomizer.java |   42 -
 .../api/location/MachineManagementMixins.java   |   91 -
 .../location/MachineProvisioningLocation.java   |   72 -
 .../location/NoMachinesAvailableException.java  |   35 -
 .../apache/brooklyn/api/location/OsDetails.java |   46 -
 .../apache/brooklyn/api/location/PortRange.java |   48 -
 .../brooklyn/api/location/PortSupplier.java     |   50 -
 .../api/location/ProvisioningLocation.java      |   44 -
 .../brooklyn/api/mgmt/AccessController.java     |   65 -
 .../apache/brooklyn/api/mgmt/EntityManager.java |  126 -
 .../brooklyn/api/mgmt/ExecutionContext.java     |   67 -
 .../brooklyn/api/mgmt/ExecutionManager.java     |  117 -
 .../brooklyn/api/mgmt/HasTaskChildren.java      |   39 -
 .../brooklyn/api/mgmt/LocationManager.java      |   87 -
 .../brooklyn/api/mgmt/ManagementContext.java    |  267 --
 .../brooklyn/api/mgmt/SubscriptionContext.java  |   66 -
 .../brooklyn/api/mgmt/SubscriptionHandle.java   |   27 -
 .../brooklyn/api/mgmt/SubscriptionManager.java  |  112 -
 .../java/org/apache/brooklyn/api/mgmt/Task.java |  146 -
 .../apache/brooklyn/api/mgmt/TaskAdaptable.java |   24 -
 .../apache/brooklyn/api/mgmt/TaskFactory.java   |   25 -
 .../brooklyn/api/mgmt/TaskQueueingContext.java  |   62 -
 .../apache/brooklyn/api/mgmt/TaskWrapper.java   |   28 -
 .../BrooklynClassLoadingContext.java            |   50 -
 .../api/mgmt/entitlement/EntitlementClass.java  |   27 -
 .../mgmt/entitlement/EntitlementContext.java    |   24 -
 .../mgmt/entitlement/EntitlementManager.java    |   45 -
 .../api/mgmt/ha/HighAvailabilityManager.java    |  129 -
 .../api/mgmt/ha/HighAvailabilityMode.java       |   67 -
 .../api/mgmt/ha/ManagementNodeState.java        |   72 -
 .../api/mgmt/ha/ManagementNodeSyncRecord.java   |   62 -
 .../api/mgmt/ha/ManagementPlaneSyncRecord.java  |   51 -
 .../ha/ManagementPlaneSyncRecordPersister.java  |   68 -
 .../brooklyn/api/mgmt/ha/MementoCopyMode.java   |   29 -
 .../api/mgmt/rebind/ChangeListener.java         |   44 -
 .../rebind/PersistenceExceptionHandler.java     |   44 -
 .../brooklyn/api/mgmt/rebind/RebindContext.java |   52 -
 .../api/mgmt/rebind/RebindExceptionHandler.java |  119 -
 .../brooklyn/api/mgmt/rebind/RebindManager.java |  132 -
 .../brooklyn/api/mgmt/rebind/RebindSupport.java |   57 -
 .../brooklyn/api/mgmt/rebind/Rebindable.java    |   40 -
 .../mgmt/rebind/mementos/BrooklynMemento.java   |   64 -
 .../mementos/BrooklynMementoManifest.java       |   58 -
 .../mementos/BrooklynMementoPersister.java      |  138 -
 .../rebind/mementos/BrooklynMementoRawData.java |  185 -
 .../rebind/mementos/CatalogItemMemento.java     |   54 -
 .../mgmt/rebind/mementos/EnricherMemento.java   |   33 -
 .../api/mgmt/rebind/mementos/EntityMemento.java |   80 -
 .../api/mgmt/rebind/mementos/FeedMemento.java   |   33 -
 .../mgmt/rebind/mementos/LocationMemento.java   |   38 -
 .../api/mgmt/rebind/mementos/Memento.java       |   85 -
 .../api/mgmt/rebind/mementos/PolicyMemento.java |   35 -
 .../api/mgmt/rebind/mementos/TreeNode.java      |   48 -
 .../brooklyn/api/objs/BrooklynObject.java       |  169 -
 .../brooklyn/api/objs/BrooklynObjectType.java   |   79 -
 .../apache/brooklyn/api/objs/BrooklynType.java  |   57 -
 .../apache/brooklyn/api/objs/Configurable.java  |  101 -
 .../apache/brooklyn/api/objs/EntityAdjunct.java |   53 -
 .../apache/brooklyn/api/objs/HasShortName.java  |   26 -
 .../apache/brooklyn/api/objs/Identifiable.java  |   24 -
 .../apache/brooklyn/api/objs/SpecParameter.java |   42 -
 .../org/apache/brooklyn/api/policy/Policy.java  |   80 -
 .../apache/brooklyn/api/policy/PolicySpec.java  |   76 -
 .../apache/brooklyn/api/policy/PolicyType.java  |   36 -
 .../api/relations/RelationshipType.java         |   38 -
 .../brooklyn/api/sensor/AttributeSensor.java    |   52 -
 .../apache/brooklyn/api/sensor/Enricher.java    |   61 -
 .../brooklyn/api/sensor/EnricherSpec.java       |  140 -
 .../brooklyn/api/sensor/EnricherType.java       |   36 -
 .../org/apache/brooklyn/api/sensor/Feed.java    |   74 -
 .../org/apache/brooklyn/api/sensor/Sensor.java  |   77 -
 .../apache/brooklyn/api/sensor/SensorEvent.java |   47 -
 .../api/sensor/SensorEventListener.java         |   37 -
 .../api/typereg/BrooklynTypeRegistry.java       |   78 -
 .../brooklyn/api/typereg/OsgiBundleWithUrl.java |   36 -
 .../brooklyn/api/typereg/RegisteredType.java    |   96 -
 .../typereg/RegisteredTypeLoadingContext.java   |   50 -
 brooklyn-server/camp/README.md                  |   34 -
 brooklyn-server/camp/camp-base/notes.txt        |   83 -
 brooklyn-server/camp/camp-base/pom.xml          |   96 -
 .../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     |  195 --
 .../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   |   57 -
 .../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  |   98 -
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |   64 -
 .../camp/spi/pdp/ArtifactRequirement.java       |   71 -
 .../spi/pdp/AssemblyTemplateConstructor.java    |  100 -
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   |  147 -
 .../apache/brooklyn/camp/spi/pdp/Service.java   |   94 -
 .../camp/spi/pdp/ServiceCharacteristic.java     |   71 -
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |   51 -
 .../brooklyn/camp/spi/resolve/PdpProcessor.java |  186 --
 .../camp/spi/resolve/PlanInterpreter.java       |  113 -
 .../interpret/PlanInterpretationContext.java    |  152 -
 .../interpret/PlanInterpretationNode.java       |  259 --
 .../apache/brooklyn/camp/util/yaml/Yamls.java   |   24 -
 .../pdp/DeploymentPlanToyInterpreterTest.java   |  112 -
 .../brooklyn/camp/spi/pdp/PdpYamlTest.java      |   79 -
 .../web/MockAssemblyTemplateInstantiator.java   |   37 -
 .../camp/test/mock/web/MockWebPlatform.java     |  131 -
 .../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 -
 brooklyn-server/camp/camp-brooklyn/README.md    |   20 -
 brooklyn-server/camp/camp-brooklyn/pom.xml      |  217 --
 .../camp/brooklyn/BrooklynCampConstants.java    |   49 -
 .../camp/brooklyn/BrooklynCampPlatform.java     |  103 -
 .../BrooklynCampPlatformLauncherAbstract.java   |   73 -
 .../BrooklynCampPlatformLauncherNoServer.java   |   37 -
 .../camp/brooklyn/BrooklynCampReservedKeys.java |   30 -
 .../camp/brooklyn/YamlLauncherAbstract.java     |  131 -
 .../camp/brooklyn/YamlLauncherNoServer.java     |   39 -
 .../api/AssemblyTemplateSpecInstantiator.java   |   43 -
 .../BrooklynAssemblyTemplateInstantiator.java   |  124 -
 .../BrooklynComponentTemplateResolver.java      |  387 ---
 .../BrooklynEntityDecorationResolver.java       |  216 --
 .../spi/creation/BrooklynEntityMatcher.java     |  180 -
 .../creation/BrooklynYamlLocationResolver.java  |  142 -
 .../creation/BrooklynYamlTypeInstantiator.java  |  209 --
 .../brooklyn/spi/creation/CampCatalogUtils.java |   40 -
 .../spi/creation/CampInternalUtils.java         |  247 --
 .../brooklyn/spi/creation/CampResolver.java     |  147 -
 .../spi/creation/CampToSpecTransformer.java     |  110 -
 .../spi/creation/CampTypePlanTransformer.java   |   98 -
 .../spi/creation/EntitySpecConfiguration.java   |   57 -
 .../service/BrooklynServiceTypeResolver.java    |   78 -
 .../service/CampServiceSpecResolver.java        |   47 -
 .../creation/service/ServiceTypeResolver.java   |   77 -
 .../service/ServiceTypeResolverAdaptor.java     |   70 -
 .../service/UrlServiceSpecResolver.java         |   81 -
 .../spi/dsl/BrooklynDslDeferredSupplier.java    |  155 -
 .../spi/dsl/BrooklynDslInterpreter.java         |  193 --
 .../camp/brooklyn/spi/dsl/DslUtils.java         |   44 -
 .../spi/dsl/methods/BrooklynDslCommon.java      |  438 ---
 .../brooklyn/spi/dsl/methods/DslComponent.java  |  331 --
 .../camp/brooklyn/spi/dsl/parse/DslParser.java  |  144 -
 .../spi/dsl/parse/FunctionWithArgs.java         |   57 -
 .../brooklyn/spi/dsl/parse/QuotedString.java    |   50 -
 .../lookup/AbstractBrooklynResourceLookup.java  |   36 -
 .../lookup/AbstractTemplateBrooklynLookup.java  |   56 -
 .../spi/lookup/AssemblyBrooklynLookup.java      |   68 -
 .../lookup/AssemblyTemplateBrooklynLookup.java  |   70 -
 .../brooklyn/spi/lookup/BrooklynUrlLookup.java  |   38 -
 .../lookup/PlatformComponentBrooklynLookup.java |   60 -
 ...PlatformComponentTemplateBrooklynLookup.java |   59 -
 .../platform/BrooklynImmutableCampPlatform.java |  108 -
 ...che.brooklyn.core.plan.PlanToSpecTransformer |   19 -
 ...lyn.core.typereg.BrooklynTypePlanTransformer |   19 -
 .../camp/brooklyn/AbstractYamlRebindTest.java   |  207 --
 .../camp/brooklyn/AbstractYamlTest.java         |  176 -
 .../brooklyn/camp/brooklyn/AppYamlTest.java     |  121 -
 .../camp/brooklyn/ApplicationsYamlTest.java     |  253 --
 .../BrooklynYamlTypeInstantiatorTest.java       |   74 -
 .../camp/brooklyn/ByonLocationsYamlTest.java    |  281 --
 .../DependentConfigPollingYamlTest.java         |  117 -
 .../camp/brooklyn/DslAndRebindYamlTest.java     |  515 ---
 .../brooklyn/EmptySoftwareProcessYamlTest.java  |  124 -
 .../brooklyn/EmptyWindowsProcessYamlTest.java   |   51 -
 .../camp/brooklyn/EnrichersYamlTest.java        |  256 --
 .../camp/brooklyn/EntitiesYamlTest.java         | 1030 ------
 .../ExternalConfigBrooklynPropertiesTest.java   |  146 -
 .../camp/brooklyn/ExternalConfigYamlTest.java   |  328 --
 ...aWebAppWithDslYamlRebindIntegrationTest.java |  123 -
 .../camp/brooklyn/LocationsYamlTest.java        |  285 --
 .../camp/brooklyn/MapReferenceYamlTest.java     |  128 -
 .../brooklyn/camp/brooklyn/ObjectsYamlTest.java |  283 --
 .../camp/brooklyn/PoliciesYamlTest.java         |  214 --
 .../camp/brooklyn/ReferencedYamlTest.java       |  180 -
 .../brooklyn/ReferencingYamlTestEntity.java     |   74 -
 .../brooklyn/ReferencingYamlTestEntityImpl.java |   25 -
 .../brooklyn/ReloadBrooklynPropertiesTest.java  |   87 -
 .../brooklyn/camp/brooklyn/SimpleTestPojo.java  |   43 -
 .../camp/brooklyn/TestEntityWithInitConfig.java |   34 -
 .../brooklyn/TestEntityWithInitConfigImpl.java  |   58 -
 .../camp/brooklyn/TestReferencingEnricher.java  |   34 -
 .../camp/brooklyn/TestReferencingPolicy.java    |   34 -
 .../TestSensorAndEffectorInitializer.java       |   84 -
 .../brooklyn/VanillaBashNetcatYamlTest.java     |  113 -
 .../camp/brooklyn/WindowsYamlLiveTest.java      |  410 ---
 .../brooklyn/camp/brooklyn/WrapAppTest.java     |   92 -
 .../catalog/AbstractCatalogXmlTest.java         |  108 -
 .../CatalogOsgiVersionMoreEntityTest.java       |  265 --
 .../brooklyn/catalog/CatalogXmlOsgiTest.java    |   37 -
 .../brooklyn/catalog/CatalogXmlVersionTest.java |   57 -
 .../brooklyn/catalog/CatalogYamlAppTest.java    |  109 -
 .../brooklyn/catalog/CatalogYamlCombiTest.java  |  148 -
 .../brooklyn/catalog/CatalogYamlEntityTest.java |  891 -----
 .../catalog/CatalogYamlLocationTest.java        |  253 --
 .../brooklyn/catalog/CatalogYamlPolicyTest.java |  195 --
 .../brooklyn/catalog/CatalogYamlRebindTest.java |  343 --
 .../catalog/CatalogYamlTemplateTest.java        |  282 --
 .../catalog/CatalogYamlVersioningTest.java      |  269 --
 .../catalog/SpecParameterParsingTest.java       |  156 -
 .../catalog/SpecParameterUnwrappingTest.java    |  379 ---
 .../camp/brooklyn/catalog/TestBasicApp.java     |   27 -
 .../camp/brooklyn/catalog/TestBasicAppImpl.java |   24 -
 .../CreatePasswordSensorIntegrationTest.java    |   67 -
 .../service/ServiceTypeResolverTest.java        |   39 -
 .../service/TestServiceTypeResolver.java        |   54 -
 .../camp/brooklyn/spi/dsl/DslParseTest.java     |   78 -
 .../lite/CampPlatformWithJustBrooklynMgmt.java  |   41 -
 .../brooklyn/test/lite/CampYamlLiteTest.java    |  261 --
 .../brooklyn/test/lite/TestAppAssembly.java     |   36 -
 .../test/lite/TestAppAssemblyInstantiator.java  |   96 -
 .../EmptySoftwareProcessWithPassword.yaml       |   36 -
 ...lyn.spi.creation.service.ServiceTypeResolver |   19 -
 .../test/resources/example-with-function.yaml   |   34 -
 .../java-web-app-and-db-with-function-2.yaml    |   41 -
 .../java-web-app-and-db-with-function.yaml      |   36 -
 .../src/test/resources/mysql-chef.yaml          |   49 -
 .../more-entities-osgi-catalog-scan.yaml        |   32 -
 .../more-entity-v1-called-v1-osgi-catalog.yaml  |   27 -
 .../catalog/more-entity-v1-osgi-catalog.yaml    |   27 -
 ...more-entity-v1-with-policy-osgi-catalog.yaml |   29 -
 .../catalog/more-entity-v2-osgi-catalog.yaml    |   28 -
 .../more-policies-osgi-catalog-scan.yaml        |   32 -
 .../catalog/simple-policy-osgi-catalog.yaml     |   27 -
 .../apache/brooklyn/camp/brooklyn/echoArg.bat   |   19 -
 .../camp/brooklyn/echoFreemarkerMyarg.bat       |   18 -
 .../camp/brooklyn/echoFreemarkerMyarg.ps1       |   18 -
 .../apache/brooklyn/camp/brooklyn/echoMyArg.ps1 |   22 -
 .../org/apache/brooklyn/camp/brooklyn/exit0.bat |   18 -
 .../org/apache/brooklyn/camp/brooklyn/exit0.ps1 |   18 -
 .../org/apache/brooklyn/camp/brooklyn/exit1.bat |   18 -
 .../org/apache/brooklyn/camp/brooklyn/exit1.ps1 |   19 -
 .../test/lite/test-app-service-blueprint.yaml   |   38 -
 .../src/test/resources/osgi-catalog.xml         |   29 -
 .../src/test/resources/postgresql-chef.yaml     |   38 -
 .../test/resources/same-server-entity-test.yaml |   28 -
 .../src/test/resources/simple-catalog.xml       |   47 -
 .../test/resources/test-app-with-enricher.yaml  |   37 -
 .../test/resources/test-app-with-policy.yaml    |   34 -
 .../test-cluster-with-member-spec.yaml          |   32 -
 .../resources/test-entity-basic-template.yaml   |   24 -
 .../test-entity-reference-map-template.yaml     |   28 -
 .../resources/test-entity-with-enricher.yaml    |   36 -
 .../resources/test-entity-with-init-config.yaml |   31 -
 .../test/resources/test-entity-with-policy.yaml |   36 -
 ...-java-web-app-spec-and-db-with-function.yaml |   39 -
 .../resources/test-propagating-enricher.yaml    |   32 -
 .../resources/test-referencing-enrichers.yaml   |  133 -
 .../resources/test-referencing-entities.yaml    |  136 -
 .../resources/test-referencing-policies.yaml    |  133 -
 .../src/test/resources/test-tomcat-https.yaml   |   28 -
 .../resources/vanilla-bash-netcat-w-client.yaml |   96 -
 .../test/resources/visitors-creation-script.sql |   41 -
 .../src/test/resources/yaml-ref-app.yaml        |   21 -
 .../yaml-ref-bundle-without-libraries.yaml      |   19 -
 .../src/test/resources/yaml-ref-catalog.yaml    |   21 -
 .../src/test/resources/yaml-ref-entity.yaml     |   21 -
 brooklyn-server/camp/camp-server/pom.xml        |  167 -
 .../brooklyn/camp/server/dto/ApiErrorDto.java   |  119 -
 .../server/dto/ApplicationComponentDto.java     |   68 -
 .../dto/ApplicationComponentTemplateDto.java    |   40 -
 .../brooklyn/camp/server/dto/AssemblyDto.java   |   73 -
 .../camp/server/dto/AssemblyTemplateDto.java    |   68 -
 .../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   |   78 -
 .../dto/PlatformComponentTemplateDto.java       |   40 -
 .../brooklyn/camp/server/dto/PlatformDto.java   |  127 -
 .../brooklyn/camp/server/dto/ResourceDto.java   |  111 -
 .../camp/server/rest/CampRestResources.java     |   69 -
 .../brooklyn/camp/server/rest/CampServer.java   |  192 --
 .../rest/resource/AbstractCampRestResource.java |   56 -
 .../rest/resource/ApidocRestResource.java       |   31 -
 .../ApplicationComponentRestResource.java       |   49 -
 ...pplicationComponentTemplateRestResource.java |   49 -
 .../rest/resource/AssemblyRestResource.java     |   51 -
 .../resource/AssemblyTemplateRestResource.java  |   86 -
 .../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       |  175 -
 .../camp/server/rest/util/WebResourceUtils.java |   59 -
 .../ApplicationCompomentTemplateDtoTest.java    |   49 -
 .../brooklyn/camp/server/dto/BasicDtoTest.java  |   90 -
 .../brooklyn/camp/server/dto/LinkDtoTest.java   |   62 -
 .../dto/PlatformCompomentTemplateDtoTest.java   |   49 -
 .../camp/server/dto/ResourceDtoTest.java        |   77 -
 .../rest/resource/PlatformRestResourceTest.java |   43 -
 .../test/fixture/AbstractRestResourceTest.java  |   84 -
 .../camp/server/test/fixture/InMemoryCamp.java  |   52 -
 brooklyn-server/camp/pom.xml                    |   45 -
 brooklyn-server/core/pom.xml                    |  321 --
 .../core/BrooklynFeatureEnablement.java         |  209 --
 .../apache/brooklyn/core/BrooklynLogging.java   |   73 -
 .../apache/brooklyn/core/BrooklynVersion.java   |  450 ---
 .../brooklyn/core/annotation/Effector.java      |   33 -
 .../brooklyn/core/annotation/EffectorParam.java |   42 -
 .../brooklyn/core/catalog/CatalogLoadMode.java  |   73 -
 .../core/catalog/CatalogPredicates.java         |  319 --
 .../catalog/internal/BasicBrooklynCatalog.java  | 1073 ------
 .../internal/CatalogBundleConverter.java        |   63 -
 .../core/catalog/internal/CatalogBundleDto.java |   96 -
 .../catalog/internal/CatalogClasspathDo.java    |  357 --
 .../catalog/internal/CatalogClasspathDto.java   |   43 -
 .../core/catalog/internal/CatalogDo.java        |  364 --
 .../core/catalog/internal/CatalogDto.java       |  229 --
 .../core/catalog/internal/CatalogDtoUtils.java  |   66 -
 .../catalog/internal/CatalogEntityItemDto.java  |   43 -
 .../catalog/internal/CatalogInitialization.java |  453 ---
 .../catalog/internal/CatalogItemBuilder.java    |  150 -
 .../catalog/internal/CatalogItemComparator.java |   52 -
 .../core/catalog/internal/CatalogItemDo.java    |  226 --
 .../internal/CatalogItemDtoAbstract.java        |  439 ---
 .../catalog/internal/CatalogLibrariesDo.java    |   42 -
 .../catalog/internal/CatalogLibrariesDto.java   |   53 -
 .../internal/CatalogLocationItemDto.java        |   43 -
 .../catalog/internal/CatalogPolicyItemDto.java  |   43 -
 .../internal/CatalogTemplateItemDto.java        |   42 -
 .../core/catalog/internal/CatalogUtils.java     |  321 --
 .../catalog/internal/CatalogXmlSerializer.java  |   77 -
 .../internal/JavaCatalogToSpecTransformer.java  |  111 -
 .../brooklyn/core/config/BasicConfigKey.java    |  327 --
 .../brooklyn/core/config/ConfigConstraints.java |  195 --
 .../apache/brooklyn/core/config/ConfigKeys.java |  273 --
 .../brooklyn/core/config/ConfigPredicates.java  |  157 -
 .../brooklyn/core/config/ConfigUtils.java       |  129 -
 .../config/ConstraintViolationException.java    |   38 -
 .../brooklyn/core/config/ListConfigKey.java     |  128 -
 .../brooklyn/core/config/MapConfigKey.java      |  206 --
 .../apache/brooklyn/core/config/Sanitizer.java  |  172 -
 .../brooklyn/core/config/SetConfigKey.java      |  119 -
 .../core/config/StructuredConfigKey.java        |   60 -
 .../core/config/SubElementConfigKey.java        |   77 -
 .../brooklyn/core/config/WrappedConfigKey.java  |   44 -
 .../AbstractExternalConfigSupplier.java         |   45 -
 .../config/external/ExternalConfigSupplier.java |   34 -
 .../external/InPlaceExternalConfigSupplier.java |   51 -
 .../PropertiesFileExternalConfigSupplier.java   |   68 -
 .../vault/VaultAppIdExternalConfigSupplier.java |   90 -
 .../vault/VaultExternalConfigSupplier.java      |  133 -
 .../vault/VaultTokenExternalConfigSupplier.java |   39 -
 .../VaultUserPassExternalConfigSupplier.java    |   56 -
 .../internal/AbstractCollectionConfigKey.java   |  120 -
 .../config/internal/AbstractConfigMapImpl.java  |  110 -
 .../internal/AbstractStructuredConfigKey.java   |  139 -
 .../core/config/render/RendererHints.java       |  284 --
 .../core/effector/AbstractEffector.java         |   90 -
 .../core/effector/AddChildrenEffector.java      |  117 -
 .../brooklyn/core/effector/AddEffector.java     |  116 -
 .../brooklyn/core/effector/AddSensor.java       |  126 -
 .../core/effector/BasicParameterType.java       |  116 -
 .../brooklyn/core/effector/EffectorAndBody.java |   60 -
 .../brooklyn/core/effector/EffectorBase.java    |  106 -
 .../brooklyn/core/effector/EffectorBody.java    |  100 -
 .../brooklyn/core/effector/EffectorTasks.java   |  234 --
 .../core/effector/EffectorWithBody.java         |   32 -
 .../brooklyn/core/effector/Effectors.java       |  214 --
 .../core/effector/ExplicitEffector.java         |   74 -
 .../brooklyn/core/effector/MethodEffector.java  |  180 -
 .../core/effector/ssh/SshCommandEffector.java   |  102 -
 .../core/effector/ssh/SshEffectorTasks.java     |  342 --
 .../core/enricher/AbstractEnricher.java         |  121 -
 .../core/enricher/EnricherDynamicType.java      |   43 -
 .../core/enricher/EnricherTypeSnapshot.java     |   39 -
 .../core/entity/AbstractApplication.java        |  267 --
 .../brooklyn/core/entity/AbstractEntity.java    | 2144 ------------
 .../apache/brooklyn/core/entity/Attributes.java |  169 -
 .../core/entity/BrooklynConfigKeys.java         |  216 --
 .../apache/brooklyn/core/entity/Entities.java   | 1201 -------
 .../brooklyn/core/entity/EntityAdjuncts.java    |   70 -
 .../core/entity/EntityAndAttribute.java         |  107 -
 .../brooklyn/core/entity/EntityAsserts.java     |  226 --
 .../brooklyn/core/entity/EntityDynamicType.java |  376 ---
 .../brooklyn/core/entity/EntityFunctions.java   |  307 --
 .../core/entity/EntityInitializers.java         |   49 -
 .../brooklyn/core/entity/EntityInternal.java    |  274 --
 .../brooklyn/core/entity/EntityPredicates.java  |  451 ---
 .../brooklyn/core/entity/EntityRelations.java   |  179 -
 .../brooklyn/core/entity/EntitySuppliers.java   |   47 -
 .../brooklyn/core/entity/EntityTasks.java       |   81 -
 .../core/entity/EntityTypeSnapshot.java         |  126 -
 .../brooklyn/core/entity/EntityTypes.java       |   28 -
 .../core/entity/StartableApplication.java       |   25 -
 .../drivers/BasicEntityDriverManager.java       |   56 -
 .../drivers/ReflectiveEntityDriverFactory.java  |  281 --
 .../drivers/RegistryEntityDriverFactory.java    |  127 -
 .../downloads/BasicDownloadRequirement.java     |   85 -
 .../downloads/BasicDownloadResolver.java        |   66 -
 .../drivers/downloads/BasicDownloadTargets.java |  121 -
 .../downloads/BasicDownloadsManager.java        |  161 -
 .../DownloadProducerFromCloudsoftRepo.java      |   83 -
 .../DownloadProducerFromLocalRepo.java          |   84 -
 .../DownloadProducerFromProperties.java         |  344 --
 .../DownloadProducerFromUrlAttribute.java       |   63 -
 .../drivers/downloads/DownloadSubstituters.java |  172 -
 .../drivers/downloads/FilenameProducers.java    |   64 -
 .../AbstractConfigurableEntityFactory.java      |   82 -
 .../core/entity/factory/ApplicationBuilder.java |  249 --
 .../factory/BasicConfigurableEntityFactory.java |   76 -
 .../entity/factory/ClosureEntityFactory.java    |   53 -
 .../factory/ConfigurableEntityFactory.java      |   33 -
 ...figurableEntityFactoryFromEntityFactory.java |   45 -
 .../core/entity/factory/EntityFactory.java      |   32 -
 .../factory/EntityFactoryForLocation.java       |   30 -
 .../internal/ConfigMapViewWithStringKeys.java   |  130 -
 .../core/entity/internal/EntityConfigMap.java   |  319 --
 .../internal/EntityTransientCopyInternal.java   |  121 -
 .../core/entity/lifecycle/Lifecycle.java        |  187 --
 .../core/entity/lifecycle/PolicyDescriptor.java |   68 -
 .../entity/lifecycle/ServiceStateLogic.java     |  639 ----
 .../brooklyn/core/entity/trait/Changeable.java  |   35 -
 .../core/entity/trait/MemberReplaceable.java    |   45 -
 .../brooklyn/core/entity/trait/Resizable.java   |   68 -
 .../brooklyn/core/entity/trait/Startable.java   |  123 -
 .../core/entity/trait/StartableMethods.java     |  125 -
 .../apache/brooklyn/core/feed/AbstractFeed.java |  246 --
 .../core/feed/AttributePollHandler.java         |  248 --
 .../brooklyn/core/feed/ConfigToAttributes.java  |   59 -
 .../core/feed/DelegatingPollHandler.java        |   96 -
 .../apache/brooklyn/core/feed/FeedConfig.java   |  307 --
 .../apache/brooklyn/core/feed/PollConfig.java   |   85 -
 .../apache/brooklyn/core/feed/PollHandler.java  |   38 -
 .../org/apache/brooklyn/core/feed/Poller.java   |  210 --
 .../core/internal/ApiObjectsFactoryImpl.java    |   41 -
 .../core/internal/BrooklynInitialization.java   |   81 -
 .../core/internal/BrooklynProperties.java       |  305 --
 .../core/internal/BrooklynPropertiesImpl.java   |  477 ---
 .../core/internal/storage/BrooklynStorage.java  |  114 -
 .../core/internal/storage/DataGrid.java         |   52 -
 .../core/internal/storage/DataGridFactory.java  |   38 -
 .../core/internal/storage/Reference.java        |   50 -
 .../internal/storage/impl/BackedReference.java  |   73 -
 .../internal/storage/impl/BasicReference.java   |   67 -
 .../storage/impl/BrooklynStorageImpl.java       |  139 -
 .../impl/ConcurrentMapAcceptingNullVals.java    |  272 --
 .../impl/inmemory/InMemoryDataGridFactory.java  |   40 -
 .../storage/impl/inmemory/InmemoryDatagrid.java |   93 -
 .../core/location/AbstractLocation.java         |  794 -----
 .../core/location/AbstractLocationResolver.java |  188 --
 .../AggregatingMachineProvisioningLocation.java |  139 -
 .../core/location/BasicHardwareDetails.java     |   56 -
 .../core/location/BasicLocationDefinition.java  |   85 -
 .../core/location/BasicLocationRegistry.java    |  513 ---
 .../core/location/BasicMachineDetails.java      |  183 -
 .../core/location/BasicMachineMetadata.java     |   84 -
 .../brooklyn/core/location/BasicOsDetails.java  |  123 -
 .../core/location/CatalogLocationResolver.java  |   83 -
 .../location/DefinedLocationByIdResolver.java   |   74 -
 .../location/DeprecatedKeysMappingBuilder.java  |   66 -
 .../core/location/HasSubnetHostname.java        |   32 -
 .../core/location/LocationConfigKeys.java       |   79 -
 .../core/location/LocationConfigUtils.java      |  559 ----
 .../core/location/LocationPredicates.java       |  270 --
 ...ocationPropertiesFromBrooklynProperties.java |  223 --
 .../brooklyn/core/location/Locations.java       |  160 -
 .../apache/brooklyn/core/location/Machines.java |  194 --
 .../core/location/NamedLocationResolver.java    |   97 -
 .../brooklyn/core/location/PortRanges.java      |  273 --
 .../core/location/SupportsPortForwarding.java   |   39 -
 .../location/access/BrooklynAccessUtils.java    |  153 -
 .../location/access/PortForwardManager.java     |  328 --
 .../access/PortForwardManagerAuthority.java     |   46 -
 .../access/PortForwardManagerClient.java        |  413 ---
 .../location/access/PortForwardManagerImpl.java |  505 ---
 .../PortForwardManagerLocationResolver.java     |   89 -
 .../core/location/access/PortMapping.java       |  101 -
 .../AbstractAvailabilityZoneExtension.java      |   82 -
 ...bstractCloudMachineProvisioningLocation.java |   97 -
 .../cloud/AvailabilityZoneExtension.java        |   54 -
 .../location/cloud/CloudLocationConfig.java     |  121 -
 .../cloud/names/AbstractCloudMachineNamer.java  |  150 -
 .../cloud/names/BasicCloudMachineNamer.java     |   96 -
 .../location/cloud/names/CloudMachineNamer.java |   61 -
 .../cloud/names/CustomMachineNamer.java         |   72 -
 .../core/location/dynamic/DynamicLocation.java  |   50 -
 .../core/location/dynamic/LocationOwner.java    |   85 -
 .../location/geo/GeoBytesHostGeoLookup.java     |  104 -
 .../core/location/geo/HasHostGeoInfo.java       |   25 -
 .../brooklyn/core/location/geo/HostGeoInfo.java |  216 --
 .../core/location/geo/HostGeoLookup.java        |   27 -
 .../location/geo/LocalhostExternalIpLoader.java |  208 --
 .../location/geo/MaxMind2HostGeoLookup.java     |  114 -
 .../core/location/geo/UtraceHostGeoLookup.java  |  209 --
 .../location/internal/LocationDynamicType.java  |   40 -
 .../location/internal/LocationInternal.java     |   96 -
 .../location/internal/LocationTypeSnapshot.java |   40 -
 .../apache/brooklyn/core/mgmt/BrooklynTags.java |  138 -
 .../brooklyn/core/mgmt/BrooklynTaskTags.java    |  455 ---
 .../brooklyn/core/mgmt/BrooklynTasks.java       |   25 -
 .../core/mgmt/EntityManagementUtils.java        |  332 --
 .../core/mgmt/HasBrooklynManagementContext.java |   31 -
 .../core/mgmt/ManagementContextInjectable.java  |   33 -
 .../AbstractBrooklynClassLoadingContext.java    |   83 -
 .../BrooklynClassLoadingContext.java            |   28 -
 .../BrooklynClassLoadingContextSequential.java  |  135 -
 ...ssLoaderFromBrooklynClassLoadingContext.java |   66 -
 .../JavaBrooklynClassLoadingContext.java        |  133 -
 .../OsgiBrooklynClassLoadingContext.java        |  144 -
 .../BasicEntitlementClassDefinition.java        |   56 -
 .../entitlement/EntitlementManagerAdapter.java  |  133 -
 .../mgmt/entitlement/EntitlementPredicates.java |   61 -
 .../core/mgmt/entitlement/Entitlements.java     |  418 ---
 .../mgmt/entitlement/NotEntitledException.java  |   44 -
 .../entitlement/PerUserEntitlementManager.java  |   99 -
 .../PerUserEntitlementManagerWithDefault.java   |   31 -
 .../mgmt/entitlement/WebEntitlementContext.java |   56 -
 .../core/mgmt/ha/BasicMasterChooser.java        |  203 --
 .../mgmt/ha/HighAvailabilityManagerImpl.java    | 1113 -------
 .../ha/ManagementPlaneSyncRecordDeltaImpl.java  |  122 -
 ...ntPlaneSyncRecordPersisterToObjectStore.java |  364 --
 .../brooklyn/core/mgmt/ha/MasterChooser.java    |   39 -
 .../brooklyn/core/mgmt/ha/OsgiManager.java      |  300 --
 .../ha/dto/BasicManagementNodeSyncRecord.java   |  194 --
 .../ha/dto/ManagementPlaneSyncRecordImpl.java   |   99 -
 .../internal/AbstractManagementContext.java     |  522 ---
 .../internal/AbstractSubscriptionManager.java   |  141 -
 .../core/mgmt/internal/AccessManager.java       |   41 -
 .../internal/AsyncCollectionChangeAdapter.java  |   82 -
 .../BasicExternalConfigSupplierRegistry.java    |  125 -
 .../mgmt/internal/BasicSubscriptionContext.java |  181 -
 .../mgmt/internal/BrooklynGarbageCollector.java |  625 ----
 .../internal/BrooklynObjectManagementMode.java  |   31 -
 .../internal/BrooklynObjectManagerInternal.java |   36 -
 .../mgmt/internal/BrooklynShutdownHooks.java    |  244 --
 .../core/mgmt/internal/CampYamlParser.java      |   34 -
 .../mgmt/internal/CollectionChangeListener.java |   24 -
 .../internal/DeferredBrooklynProperties.java    |  370 --
 .../core/mgmt/internal/EffectorUtils.java       |  363 --
 .../mgmt/internal/EntityChangeListener.java     |   78 -
 .../mgmt/internal/EntityManagementSupport.java  |  480 ---
 .../mgmt/internal/EntityManagerInternal.java    |   32 -
 .../ExternalConfigSupplierRegistry.java         |   45 -
 ...PropertyChangeToCollectionChangeAdapter.java |   65 -
 .../core/mgmt/internal/LocalAccessManager.java  |  111 -
 .../core/mgmt/internal/LocalEntityManager.java  |  820 -----
 .../mgmt/internal/LocalLocationManager.java     |  460 ---
 .../mgmt/internal/LocalManagementContext.java   |  433 ---
 .../mgmt/internal/LocalSubscriptionManager.java |  330 --
 .../core/mgmt/internal/LocalUsageManager.java   |  411 ---
 .../mgmt/internal/LocationManagerInternal.java  |   28 -
 .../internal/ManagementContextInternal.java     |  125 -
 .../mgmt/internal/ManagementTransitionInfo.java |   48 -
 .../mgmt/internal/ManagementTransitionMode.java |  127 -
 .../internal/NonDeploymentAccessManager.java    |   98 -
 .../internal/NonDeploymentEntityManager.java    |  196 --
 .../internal/NonDeploymentLocationManager.java  |  146 -
 .../NonDeploymentManagementContext.java         |  662 ----
 .../internal/NonDeploymentUsageManager.java     |  121 -
 .../internal/QueueingSubscriptionManager.java   |  148 -
 .../core/mgmt/internal/Subscription.java        |   65 -
 .../core/mgmt/internal/SubscriptionTracker.java |  159 -
 .../BrooklynMementoPersisterToObjectStore.java  |  695 ----
 .../mgmt/persist/BrooklynPersistenceUtils.java  |  269 --
 .../persist/CatalogItemLibrariesConverter.java  |   68 -
 .../DeserializingClassRenamesProvider.java      |   84 -
 .../core/mgmt/persist/FileBasedObjectStore.java |  404 ---
 .../persist/FileBasedStoreObjectAccessor.java   |  130 -
 .../mgmt/persist/LocationWithObjectStore.java   |   27 -
 .../core/mgmt/persist/MementoSerializer.java    |   52 -
 .../brooklyn/core/mgmt/persist/PersistMode.java |   26 -
 .../persist/PersistenceActivityMetrics.java     |   83 -
 .../mgmt/persist/PersistenceObjectStore.java    |  142 -
 .../mgmt/persist/RetryingMementoSerializer.java |   95 -
 .../persist/StoreObjectAccessorLocking.java     |  218 --
 .../core/mgmt/persist/XmlMementoSerializer.java |  541 ---
 .../AbstractBrooklynObjectRebindSupport.java    |  128 -
 .../rebind/ActivePartialRebindIteration.java    |  164 -
 .../rebind/BasicCatalogItemRebindSupport.java   |   69 -
 .../mgmt/rebind/BasicEnricherRebindSupport.java |   50 -
 .../mgmt/rebind/BasicEntityRebindSupport.java   |  236 --
 .../mgmt/rebind/BasicFeedRebindSupport.java     |   49 -
 .../mgmt/rebind/BasicLocationRebindSupport.java |  137 -
 .../mgmt/rebind/BasicPolicyRebindSupport.java   |   51 -
 .../rebind/ImmediateDeltaChangeListener.java    |  154 -
 .../mgmt/rebind/InitialFullRebindIteration.java |  133 -
 .../rebind/PeriodicDeltaChangeListener.java     |  509 ---
 .../rebind/PersistenceExceptionHandlerImpl.java |  108 -
 .../core/mgmt/rebind/PersisterDeltaImpl.java    |  174 -
 .../core/mgmt/rebind/RebindContextImpl.java     |  190 --
 .../mgmt/rebind/RebindContextLookupContext.java |  176 -
 .../mgmt/rebind/RebindExceptionHandlerImpl.java |  513 ---
 .../core/mgmt/rebind/RebindIteration.java       | 1164 -------
 .../core/mgmt/rebind/RebindManagerImpl.java     |  672 ----
 .../brooklyn/core/mgmt/rebind/TreeUtils.java    |   56 -
 .../core/mgmt/rebind/dto/AbstractMemento.java   |  230 --
 .../rebind/dto/AbstractTreeNodeMemento.java     |  113 -
 .../rebind/dto/BasicCatalogItemMemento.java     |  293 --
 .../mgmt/rebind/dto/BasicEnricherMemento.java   |   92 -
 .../mgmt/rebind/dto/BasicEntityMemento.java     |  324 --
 .../core/mgmt/rebind/dto/BasicFeedMemento.java  |   92 -
 .../mgmt/rebind/dto/BasicLocationMemento.java   |  106 -
 .../mgmt/rebind/dto/BasicPolicyMemento.java     |   92 -
 .../mgmt/rebind/dto/BrooklynMementoImpl.java    |  256 --
 .../rebind/dto/BrooklynMementoManifestImpl.java |  172 -
 .../rebind/dto/EntityMementoManifestImpl.java   |   56 -
 .../core/mgmt/rebind/dto/MementoValidators.java |   67 -
 .../mgmt/rebind/dto/MementosGenerators.java     |  492 ---
 .../mgmt/rebind/dto/MutableBrooklynMemento.java |  293 --
 .../transformer/BrooklynMementoTransformer.java |   32 -
 .../rebind/transformer/CompoundTransformer.java |  291 --
 .../transformer/CompoundTransformerLoader.java  |  108 -
 .../rebind/transformer/RawDataTransformer.java  |   30 -
 .../DeleteOrphanedLocationsTransformer.java     |  125 -
 .../transformer/impl/XsltTransformer.java       |   59 -
 .../core/mgmt/usage/ApplicationUsage.java       |  126 -
 .../brooklyn/core/mgmt/usage/LocationUsage.java |  135 -
 .../brooklyn/core/mgmt/usage/UsageListener.java |  103 -
 .../brooklyn/core/mgmt/usage/UsageManager.java  |   98 -
 .../core/objs/AbstractBrooklynObject.java       |  265 --
 .../AbstractConfigurationSupportInternal.java   |   89 -
 .../core/objs/AbstractEntityAdjunct.java        |  590 ----
 .../brooklyn/core/objs/AdjunctConfigMap.java    |  139 -
 .../apache/brooklyn/core/objs/AdjunctType.java  |  173 -
 .../core/objs/BasicConfigurableObject.java      |  119 -
 .../core/objs/BasicEntityTypeRegistry.java      |  156 -
 .../brooklyn/core/objs/BasicSpecParameter.java  |  358 --
 .../brooklyn/core/objs/BrooklynDynamicType.java |  283 --
 .../core/objs/BrooklynObjectInternal.java       |  144 -
 .../core/objs/BrooklynObjectPredicate.java      |   33 -
 .../core/objs/BrooklynTypeSnapshot.java         |  101 -
 .../brooklyn/core/objs/BrooklynTypes.java       |  131 -
 .../brooklyn/core/objs/proxy/EntityProxy.java   |   27 -
 .../core/objs/proxy/EntityProxyImpl.java        |  273 --
 .../core/objs/proxy/InternalEntityFactory.java  |  441 ---
 .../core/objs/proxy/InternalFactory.java        |  131 -
 .../objs/proxy/InternalLocationFactory.java     |  151 -
 .../core/objs/proxy/InternalPolicyFactory.java  |  204 --
 .../core/plan/PlanNotRecognizedException.java   |   42 -
 .../brooklyn/core/plan/PlanToSpecFactory.java   |  153 -
 .../core/plan/PlanToSpecTransformer.java        |   68 -
 .../brooklyn/core/policy/AbstractPolicy.java    |  125 -
 .../apache/brooklyn/core/policy/Policies.java   |   73 -
 .../brooklyn/core/policy/PolicyDynamicType.java |   43 -
 .../core/policy/PolicyTypeSnapshot.java         |   39 -
 .../relations/AbstractBasicRelationSupport.java |   62 -
 .../relations/ByObjectBasicRelationSupport.java |  103 -
 .../core/relations/EmptyRelationSupport.java    |   59 -
 .../core/relations/RelationshipTypes.java       |  188 --
 .../entity/AbstractEntitySpecResolver.java      |   65 -
 .../entity/CatalogEntitySpecResolver.java       |   85 -
 .../entity/DelegatingEntitySpecResolver.java    |  127 -
 .../core/resolve/entity/EntitySpecResolver.java |   67 -
 .../resolve/entity/JavaEntitySpecResolver.java  |   99 -
 .../brooklyn/core/sensor/AttributeMap.java      |  217 --
 .../sensor/AttributeSensorAndConfigKey.java     |  152 -
 .../core/sensor/BasicAttributeSensor.java       |   62 -
 .../BasicAttributeSensorAndConfigKey.java       |  114 -
 .../core/sensor/BasicNotificationSensor.java    |   36 -
 .../brooklyn/core/sensor/BasicSensor.java       |  114 -
 .../brooklyn/core/sensor/BasicSensorEvent.java  |  112 -
 .../core/sensor/DependentConfiguration.java     |  935 ------
 .../sensor/PortAttributeSensorAndConfigKey.java |  147 -
 .../apache/brooklyn/core/sensor/Sensors.java    |  164 -
 .../brooklyn/core/sensor/StaticSensor.java      |   72 -
 ...platedStringAttributeSensorAndConfigKey.java |   66 -
 .../core/sensor/http/HttpRequestSensor.java     |   97 -
 .../sensor/password/CreatePasswordSensor.java   |   59 -
 .../core/sensor/ssh/SshCommandSensor.java       |  141 -
 .../core/server/BrooklynServerConfig.java       |  177 -
 .../core/server/BrooklynServerPaths.java        |  281 --
 .../core/server/BrooklynServiceAttributes.java  |   66 -
 .../core/server/entity/BrooklynMetrics.java     |   55 -
 .../core/server/entity/BrooklynMetricsImpl.java |   86 -
 ...actFormatSpecificTypeImplementationPlan.java |   52 -
 .../typereg/AbstractTypePlanTransformer.java    |  138 -
 .../core/typereg/BasicBrooklynTypeRegistry.java |  296 --
 .../core/typereg/BasicOsgiBundleWithUrl.java    |  101 -
 .../core/typereg/BasicRegisteredType.java       |  150 -
 .../typereg/BasicTypeImplementationPlan.java    |   41 -
 .../typereg/BrooklynTypePlanTransformer.java    |   88 -
 .../JavaClassNameTypePlanTransformer.java       |   91 -
 .../core/typereg/RegisteredTypeKindVisitor.java |   45 -
 .../typereg/RegisteredTypeLoadingContexts.java  |  236 --
 .../core/typereg/RegisteredTypePredicates.java  |  257 --
 .../brooklyn/core/typereg/RegisteredTypes.java  |  426 ---
 .../core/typereg/TypePlanTransformers.java      |  165 -
 .../typereg/UnsupportedTypePlanException.java   |   37 -
 .../stock/AbstractAggregatingEnricher.java      |  174 -
 .../enricher/stock/AbstractAggregator.java      |  238 --
 .../stock/AbstractMultipleSensorAggregator.java |  169 -
 .../enricher/stock/AbstractTransformer.java     |  103 -
 .../stock/AbstractTransformingEnricher.java     |   38 -
 .../stock/AbstractTypeTransformingEnricher.java |   68 -
 .../brooklyn/enricher/stock/AddingEnricher.java |  107 -
 .../brooklyn/enricher/stock/Aggregator.java     |  231 --
 .../brooklyn/enricher/stock/Combiner.java       |  138 -
 .../stock/CustomAggregatingEnricher.java        |  320 --
 .../brooklyn/enricher/stock/Enrichers.java      |  935 ------
 .../apache/brooklyn/enricher/stock/Joiner.java  |  127 -
 .../brooklyn/enricher/stock/Propagator.java     |  208 --
 .../stock/SensorPropagatingEnricher.java        |  181 -
 .../stock/SensorTransformingEnricher.java       |  106 -
 .../brooklyn/enricher/stock/Transformer.java    |  102 -
 .../brooklyn/enricher/stock/UpdatingMap.java    |  178 -
 .../YamlRollingTimeWindowMeanEnricher.java      |  178 -
 .../stock/YamlTimeWeightedDeltaEnricher.java    |   83 -
 .../enricher/stock/reducer/Reducer.java         |  138 -
 .../brooklyn/entity/group/AbstractGroup.java    |   90 -
 .../entity/group/AbstractGroupImpl.java         |  278 --
 .../group/AbstractMembershipTrackingPolicy.java |  246 --
 .../brooklyn/entity/group/BasicGroup.java       |   36 -
 .../brooklyn/entity/group/BasicGroupImpl.java   |   46 -
 .../apache/brooklyn/entity/group/Cluster.java   |   35 -
 .../brooklyn/entity/group/DynamicCluster.java   |  226 --
 .../entity/group/DynamicClusterImpl.java        | 1035 ------
 .../brooklyn/entity/group/DynamicFabric.java    |   75 -
 .../entity/group/DynamicFabricImpl.java         |  275 --
 .../brooklyn/entity/group/DynamicGroup.java     |   89 -
 .../brooklyn/entity/group/DynamicGroupImpl.java |  230 --
 .../entity/group/DynamicMultiGroup.java         |  103 -
 .../entity/group/DynamicMultiGroupImpl.java     |  202 --
 .../entity/group/DynamicRegionsFabric.java      |   42 -
 .../entity/group/DynamicRegionsFabricImpl.java  |   77 -
 .../apache/brooklyn/entity/group/Fabric.java    |   26 -
 .../brooklyn/entity/group/QuarantineGroup.java  |   33 -
 .../entity/group/QuarantineGroupImpl.java       |  102 -
 .../group/StopFailedRuntimeException.java       |   40 -
 .../org/apache/brooklyn/entity/group/Tier.java  |   28 -
 .../zoneaware/AbstractZoneFailureDetector.java  |  126 -
 .../BalancingNodePlacementStrategy.java         |  131 -
 .../zoneaware/CombiningZoneFailureDetector.java |   81 -
 .../CriticalCauseZoneFailureDetector.java       |   56 -
 .../ProportionalZoneFailureDetector.java        |   59 -
 .../brooklyn/entity/stock/BasicApplication.java |   32 -
 .../entity/stock/BasicApplicationImpl.java      |   33 -
 .../brooklyn/entity/stock/BasicEntity.java      |   34 -
 .../brooklyn/entity/stock/BasicEntityImpl.java  |   30 -
 .../brooklyn/entity/stock/BasicStartable.java   |   56 -
 .../entity/stock/BasicStartableImpl.java        |  107 -
 .../brooklyn/entity/stock/DataEntity.java       |   58 -
 .../brooklyn/entity/stock/DataEntityImpl.java   |   80 -
 .../brooklyn/entity/stock/DelegateEntity.java   |   73 -
 .../entity/stock/DelegateEntityImpl.java        |   49 -
 .../entity/stock/EffectorStartableImpl.java     |   77 -
 .../brooklyn/feed/function/FunctionFeed.java    |  208 --
 .../feed/function/FunctionPollConfig.java       |  111 -
 .../org/apache/brooklyn/feed/http/HttpFeed.java |  382 ---
 .../brooklyn/feed/http/HttpPollConfig.java      |  160 -
 .../brooklyn/feed/http/HttpPollValue.java       |   40 -
 .../apache/brooklyn/feed/http/HttpPolls.java    |   39 -
 .../brooklyn/feed/http/HttpValueFunctions.java  |  157 -
 .../brooklyn/feed/http/JsonFunctions.java       |  412 ---
 .../apache/brooklyn/feed/shell/ShellFeed.java   |  273 --
 .../brooklyn/feed/shell/ShellPollConfig.java    |  125 -
 .../org/apache/brooklyn/feed/ssh/SshFeed.java   |  290 --
 .../apache/brooklyn/feed/ssh/SshPollConfig.java |  190 --
 .../apache/brooklyn/feed/ssh/SshPollValue.java  |   60 -
 .../brooklyn/feed/ssh/SshValueFunctions.java    |  133 -
 .../WindowsPerformanceCounterPollConfig.java    |   53 -
 .../location/byon/ByonLocationResolver.java     |  266 --
 .../FixedListMachineProvisioningLocation.java   |  476 ---
 .../location/byon/HostLocationResolver.java     |   93 -
 .../byon/SingleMachineLocationResolver.java     |   81 -
 .../byon/SingleMachineProvisioningLocation.java |   93 -
 .../localhost/LocalhostLocationResolver.java    |   76 -
 .../LocalhostMachineProvisioningLocation.java   |  354 --
 ...calhostPropertiesFromBrooklynProperties.java |   57 -
 .../brooklyn/location/multi/MultiLocation.java  |  165 -
 .../location/multi/MultiLocationResolver.java   |  149 -
 .../brooklyn/location/paas/PaasLocation.java    |   30 -
 .../location/ssh/SshMachineLocation.java        | 1106 ------
 .../util/core/BrooklynLanguageExtensions.java   |   45 -
 .../util/core/BrooklynMavenArtifacts.java       |   58 -
 .../util/core/BrooklynNetworkUtils.java         |   42 -
 .../brooklyn/util/core/ResourcePredicates.java  |   72 -
 .../brooklyn/util/core/ResourceUtils.java       |  620 ----
 .../brooklyn/util/core/config/ConfigBag.java    |  588 ----
 .../util/core/crypto/FluentKeySigner.java       |  191 --
 .../brooklyn/util/core/crypto/SecureKeys.java   |  185 -
 .../brooklyn/util/core/file/ArchiveBuilder.java |  442 ---
 .../brooklyn/util/core/file/ArchiveTasks.java   |   57 -
 .../brooklyn/util/core/file/ArchiveUtils.java   |  350 --
 .../util/core/flags/ClassCoercionException.java |   41 -
 .../brooklyn/util/core/flags/FlagUtils.java     |  601 ----
 .../util/core/flags/MethodCoercions.java        |  185 -
 .../brooklyn/util/core/flags/SetFromFlag.java   |   71 -
 .../brooklyn/util/core/flags/TypeCoercions.java |  890 -----
 .../brooklyn/util/core/http/HttpTool.java       |   28 -
 .../util/core/http/HttpToolResponse.java        |   31 -
 .../core/internal/ConfigKeySelfExtracting.java  |   40 -
 .../brooklyn/util/core/internal/Repeater.java   |  366 --
 .../ssh/BackoffLimitedRetryHandler.java         |   73 -
 .../core/internal/ssh/ShellAbstractTool.java    |  441 ---
 .../util/core/internal/ssh/ShellTool.java       |  113 -
 .../util/core/internal/ssh/SshAbstractTool.java |  174 -
 .../util/core/internal/ssh/SshException.java    |   32 -
 .../util/core/internal/ssh/SshTool.java         |  186 --
 .../util/core/internal/ssh/cli/SshCliTool.java  |  316 --
 .../core/internal/ssh/process/ProcessTool.java  |  214 --
 .../internal/ssh/sshj/SshjClientConnection.java |  281 --
 .../util/core/internal/ssh/sshj/SshjTool.java   | 1090 ------
 .../util/core/javalang/ReflectionScanner.java   |  134 -
 .../util/core/javalang/UrlClassLoader.java      |   69 -
 .../brooklyn/util/core/mutex/MutexSupport.java  |  119 -
 .../util/core/mutex/SemaphoreForTasks.java      |  111 -
 .../util/core/mutex/SemaphoreWithOwners.java    |  231 --
 .../brooklyn/util/core/mutex/WithMutexes.java   |   45 -
 .../apache/brooklyn/util/core/osgi/Compat.java  |   69 -
 .../apache/brooklyn/util/core/osgi/Osgis.java   |  473 ---
 .../util/core/sensor/SensorPredicates.java      |   51 -
 .../core/task/AbstractExecutionContext.java     |   75 -
 .../util/core/task/BasicExecutionContext.java   |  220 --
 .../util/core/task/BasicExecutionManager.java   |  892 -----
 .../brooklyn/util/core/task/BasicTask.java      |  910 -----
 .../brooklyn/util/core/task/CanSetName.java     |   25 -
 .../brooklyn/util/core/task/CompoundTask.java   |  130 -
 .../util/core/task/DeferredSupplier.java        |   38 -
 .../util/core/task/DynamicSequentialTask.java   |  496 ---
 .../brooklyn/util/core/task/DynamicTasks.java   |  353 --
 .../util/core/task/ExecutionListener.java       |   31 -
 .../brooklyn/util/core/task/ForwardingTask.java |  324 --
 .../core/task/ListenableForwardingFuture.java   |   74 -
 .../brooklyn/util/core/task/ParallelTask.java   |   84 -
 .../brooklyn/util/core/task/ScheduledTask.java  |  212 --
 .../brooklyn/util/core/task/SequentialTask.java |   58 -
 .../util/core/task/SingleThreadedScheduler.java |  216 --
 .../brooklyn/util/core/task/TaskBuilder.java    |  191 --
 .../brooklyn/util/core/task/TaskInternal.java   |  163 -
 .../brooklyn/util/core/task/TaskPredicates.java |   79 -
 .../brooklyn/util/core/task/TaskScheduler.java  |   41 -
 .../brooklyn/util/core/task/TaskTags.java       |   71 -
 .../apache/brooklyn/util/core/task/Tasks.java   |  487 ---
 .../brooklyn/util/core/task/ValueResolver.java  |  437 ---
 .../util/core/task/ssh/SshFetchTaskFactory.java |   88 -
 .../util/core/task/ssh/SshFetchTaskWrapper.java |  134 -
 .../util/core/task/ssh/SshPutTaskFactory.java   |  122 -
 .../util/core/task/ssh/SshPutTaskStub.java      |   69 -
 .../util/core/task/ssh/SshPutTaskWrapper.java   |  189 --
 .../brooklyn/util/core/task/ssh/SshTasks.java   |  239 --
 .../internal/AbstractSshExecTaskFactory.java    |   58 -
 .../ssh/internal/PlainSshExecTaskFactory.java   |   71 -
 .../core/task/system/ProcessTaskFactory.java    |   64 -
 .../util/core/task/system/ProcessTaskStub.java  |  101 -
 .../core/task/system/ProcessTaskWrapper.java    |  186 --
 .../util/core/task/system/SystemTasks.java      |   29 -
 .../internal/AbstractProcessTaskFactory.java    |  213 --
 .../system/internal/ExecWithLoggingHelpers.java |  199 --
 .../internal/SystemProcessTaskFactory.java      |  131 -
 .../util/core/text/DataUriSchemeParser.java     |  267 --
 .../util/core/text/TemplateProcessor.java       |  536 ---
 .../util/core/xstream/ClassRenamingMapper.java  |   53 -
 ...ompilerIndependentOuterClassFieldMapper.java |  166 -
 .../xstream/EnumCaseForgivingConverter.java     |   60 -
 .../EnumCaseForgivingSingleValueConverter.java  |   35 -
 .../core/xstream/ImmutableListConverter.java    |   54 -
 .../core/xstream/ImmutableMapConverter.java     |   56 -
 .../core/xstream/ImmutableSetConverter.java     |   54 -
 .../core/xstream/Inet4AddressConverter.java     |   65 -
 .../util/core/xstream/MapConverter.java         |  104 -
 .../util/core/xstream/MutableSetConverter.java  |   44 -
 .../core/xstream/StringKeyMapConverter.java     |  133 -
 .../util/core/xstream/XmlSerializer.java        |  134 -
 .../brooklyn/util/core/xstream/XmlUtil.java     |   58 -
 ...klyn.api.internal.ApiObjectsFactoryInterface |   19 -
 ...pache.brooklyn.api.location.LocationResolver |   27 -
 ...che.brooklyn.core.plan.PlanToSpecTransformer |   19 -
 ...oklyn.core.resolve.entity.EntitySpecResolver |   20 -
 ...lyn.core.typereg.BrooklynTypePlanTransformer |   19 -
 .../resources/OSGI-INF/blueprint/blueprint.xml  |   41 -
 .../main/resources/brooklyn-catalog-empty.xml   |   20 -
 .../main/resources/brooklyn/empty.catalog.bom   |   18 -
 .../deserializingClassRenames.properties        | 1423 --------
 .../recursiveCopyWithExtraRules.xslt            |   32 -
 .../brooklyn/location/basic/os-details.sh       |   93 -
 .../geo/external-ip-address-resolvers.txt       |   24 -
 .../core/BrooklynFeatureEnablementTest.java     |  118 -
 .../brooklyn/core/BrooklynVersionTest.java      |  124 -
 .../core/catalog/CatalogPredicatesTest.java     |  176 -
 .../core/catalog/internal/CatalogDtoTest.java   |  162 -
 .../internal/CatalogItemBuilderTest.java        |  132 -
 .../internal/CatalogItemComparatorTest.java     |   86 -
 .../core/catalog/internal/CatalogLoadTest.java  |   79 -
 .../core/catalog/internal/CatalogScanTest.java  |  200 --
 .../catalog/internal/CatalogVersioningTest.java |  178 -
 .../core/catalog/internal/MyCatalogItems.java   |   36 -
 .../internal/StaticTypePlanTransformer.java     |  124 -
 .../internal/StaticTypePlanTransformerTest.java |   63 -
 .../config/BrooklynPropertiesBuilderTest.java   |   83 -
 .../BrooklynPropertiesFromGroovyTest.groovy     |   56 -
 .../core/config/BrooklynPropertiesTest.java     |  202 --
 .../core/config/ConfigKeyConstraintTest.java    |  359 --
 .../brooklyn/core/config/ConfigKeysTest.java    |  104 -
 .../core/config/ConfigPredicatesTest.java       |   87 -
 .../brooklyn/core/config/ConfigUtilsTest.java   |   40 -
 .../config/MapConfigKeyAndFriendsMoreTest.java  |  271 --
 ...apListAndOtherStructuredConfigKeyTest.groovy |  357 --
 .../VaultExternalConfigSupplierLiveTest.java    |  169 -
 .../core/effector/EffectorBasicTest.java        |  183 -
 .../core/effector/EffectorConcatenateTest.java  |  241 --
 .../core/effector/EffectorMetadataTest.java     |  166 -
 .../effector/EffectorSayHiGroovyTest.groovy     |  182 -
 .../core/effector/EffectorSayHiTest.java        |  173 -
 .../core/effector/EffectorTaskTest.java         |  437 ---
 .../ssh/SshCommandEffectorIntegrationTest.java  |   94 -
 .../core/effector/ssh/SshEffectorTasksTest.java |  265 --
 .../core/enricher/BasicEnricherTest.java        |  119 -
 .../core/enricher/EnricherConfigTest.java       |  147 -
 .../entity/AbstractApplicationLegacyTest.java   |  159 -
 .../core/entity/AbstractEntityLegacyTest.java   |  131 -
 .../brooklyn/core/entity/AttributeMapTest.java  |  248 --
 .../brooklyn/core/entity/AttributeTest.java     |   66 -
 .../entity/ConfigEntityInheritanceTest.java     |  190 --
 .../core/entity/DependentConfigurationTest.java |  458 ---
 .../brooklyn/core/entity/DynamicEntityTest.java |   60 -
 .../entity/DynamicEntityTypeConfigTest.java     |  126 -
 .../brooklyn/core/entity/EntitiesTest.java      |  134 -
 .../brooklyn/core/entity/EntityAssertsTest.java |  216 --
 .../core/entity/EntityAutomanagedTest.java      |  329 --
 .../core/entity/EntityConcurrencyTest.java      |  275 --
 .../brooklyn/core/entity/EntityConfigTest.java  |  178 -
 .../core/entity/EntityFunctionsTest.java        |   83 -
 .../core/entity/EntityLocationsTest.java        |  126 -
 .../core/entity/EntityPredicatesTest.java       |  129 -
 .../core/entity/EntityRegistrationTest.java     |  102 -
 .../core/entity/EntitySetFromFlagTest.java      |  213 --
 .../brooklyn/core/entity/EntitySpecTest.java    |  227 --
 .../core/entity/EntitySubscriptionTest.java     |  283 --
 .../core/entity/EntitySuppliersTest.java        |   70 -
 .../brooklyn/core/entity/EntityTypeTest.java    |  289 --
 .../brooklyn/core/entity/OwnedChildrenTest.java |  213 --
 .../core/entity/PolicyRegistrationTest.java     |  161 -
 .../entity/RecordingSensorEventListener.java    |  115 -
 .../brooklyn/core/entity/SanitizerTest.java     |   38 -
 .../drivers/BasicEntityDriverManagerTest.java   |   74 -
 .../drivers/EntityDriverRegistryTest.java       |   59 -
 .../ReflectiveEntityDriverFactoryTest.java      |  169 -
 .../RegistryEntityDriverFactoryTest.java        |   86 -
 .../downloads/BasicDownloadsRegistryTest.java   |  155 -
 .../DownloadProducerFromLocalRepoTest.java      |  130 -
 .../DownloadProducerFromPropertiesTest.java     |  162 -
 .../downloads/DownloadSubstitutersTest.java     |  131 -
 .../downloads/FilenameProducersTest.java        |   34 -
 .../drivers/downloads/MyEntityDriver.java       |   44 -
 .../brooklyn/core/entity/hello/HelloEntity.java |   53 -
 .../core/entity/hello/HelloEntityImpl.java      |   31 -
 .../core/entity/hello/LocalEntitiesTest.java    |  275 --
 .../entity/internal/ConfigMapGroovyTest.groovy  |   61 -
 .../core/entity/internal/ConfigMapTest.java     |  298 --
 .../EntityConfigMapUsageLegacyTest.java         |  292 --
 .../internal/EntityConfigMapUsageTest.java      |  314 --
 .../lifecycle/LifecycleTransitionTest.java      |   51 -
 .../entity/lifecycle/ServiceStateLogicTest.java |  314 --
 .../ApplicationBuilderOverridingTest.java       |  234 --
 .../proxying/BasicEntityTypeRegistryTest.java   |  135 -
 .../core/entity/proxying/EntityManagerTest.java |   83 -
 .../core/entity/proxying/EntityProxyTest.java   |  171 -
 .../proxying/InternalEntityFactoryTest.java     |  109 -
 .../core/entity/trait/FailingEntity.java        |   84 -
 .../core/entity/trait/FailingEntityImpl.java    |   92 -
 .../core/entity/trait/StartableMethodsTest.java |  127 -
 .../core/feed/ConfigToAttributesTest.java       |   69 -
 .../apache/brooklyn/core/feed/PollerTest.java   |  153 -
 .../storage/impl/BrooklynStorageImplTest.java   |  287 --
 .../ConcurrentMapAcceptingNullValsTest.java     |  114 -
 .../core/location/AbstractLocationTest.java     |  184 -
 ...regatingMachineProvisioningLocationTest.java |  117 -
 .../location/LegacyAbstractLocationTest.java    |  151 -
 .../core/location/LocationConfigTest.java       |  204 --
 .../core/location/LocationConfigUtilsTest.java  |  156 -
 .../core/location/LocationExtensionsTest.java   |  185 -
 .../core/location/LocationManagementTest.java   |   82 -
 .../core/location/LocationPredicatesTest.java   |  102 -
 ...ionPropertiesFromBrooklynPropertiesTest.java |  122 -
 .../core/location/LocationRegistryTest.java     |  161 -
 .../core/location/LocationSubscriptionTest.java |  241 --
 .../core/location/MachineDetailsTest.java       |   83 -
 .../brooklyn/core/location/MachinesTest.java    |  158 -
 .../brooklyn/core/location/PortRangesTest.java  |  130 -
 .../RecordingMachineLocationCustomizer.java     |   71 -
 .../core/location/SimulatedLocation.java        |  139 -
 .../core/location/TestPortSupplierLocation.java |   90 -
 .../access/BrooklynAccessUtilsTest.java         |  139 -
 .../PortForwardManagerLocationResolverTest.java |   83 -
 .../access/PortForwardManagerRebindTest.java    |  195 --
 .../location/access/PortForwardManagerTest.java |  193 --
 .../location/cloud/CloudMachineNamerTest.java   |  165 -
 .../location/cloud/CustomMachineNamerTest.java  |   79 -
 .../core/location/geo/HostGeoInfoTest.java      |   52 -
 .../geo/HostGeoLookupIntegrationTest.java       |   87 -
 ...ocalhostExternalIpLoaderIntegrationTest.java |   54 -
 .../entitlement/AcmeEntitlementManager.java     |   52 -
 .../entitlement/AcmeEntitlementManagerTest.java |   60 -
 .../AcmeEntitlementManagerTestFixture.java      |  157 -
 .../entitlement/EntitlementsPredicatesTest.java |   36 -
 .../core/mgmt/entitlement/EntitlementsTest.java |  207 --
 .../mgmt/entitlement/EntityEntitlementTest.java |  184 -
 ...PerUserEntitlementManagerPropertiesTest.java |   52 -
 .../HighAvailabilityManagerFileBasedTest.java   |   46 -
 ...ilabilityManagerInMemoryIntegrationTest.java |   95 -
 .../ha/HighAvailabilityManagerInMemoryTest.java |  142 -
 .../HighAvailabilityManagerSplitBrainTest.java  |  473 ---
 .../ha/HighAvailabilityManagerTestFixture.java  |  286 --
 .../brooklyn/core/mgmt/ha/HotStandbyTest.java   |  660 ----
 .../ha/ImmutableManagementPlaneSyncRecord.java  |   57 -
 ...agementPlaneSyncRecordPersisterInMemory.java |   99 -
 .../core/mgmt/ha/MasterChooserTest.java         |  145 -
 .../ha/MutableManagementPlaneSyncRecord.java    |   62 -
 .../core/mgmt/ha/TestEntityFailingRebind.java   |   55 -
 .../brooklyn/core/mgmt/ha/WarmStandbyTest.java  |  154 -
 .../core/mgmt/internal/AccessManagerTest.java   |  143 -
 .../internal/BrooklynShutdownHooksTest.java     |   91 -
 .../internal/EntityExecutionManagerTest.java    |  477 ---
 .../ExternalConfigSupplierRegistryTest.java     |   72 -
 .../LocalManagementContextInstancesTest.java    |   87 -
 .../internal/LocalManagementContextTest.java    |  126 -
 .../internal/LocalSubscriptionManagerTest.java  |  174 -
 .../brooklyn/core/mgmt/osgi/OsgiPathTest.java   |  104 -
 .../core/mgmt/osgi/OsgiStandaloneTest.java      |  191 --
 .../mgmt/osgi/OsgiVersionMoreEntityTest.java    |  454 ---
 .../BrooklynMementoPersisterFileBasedTest.java  |   55 -
 ...ntoPersisterInMemorySizeIntegrationTest.java |  106 -
 .../BrooklynMementoPersisterInMemoryTest.java   |   33 -
 .../BrooklynMementoPersisterTestFixture.java    |  165 -
 .../mgmt/persist/FileBasedObjectStoreTest.java  |   99 -
 .../FileBasedStoreObjectAccessorWriterTest.java |   90 -
 .../core/mgmt/persist/InMemoryObjectStore.java  |  170 -
 .../InMemoryStoreObjectAccessorWriterTest.java  |   36 -
 .../core/mgmt/persist/ListeningObjectStore.java |  252 --
 ...nceStoreObjectAccessorWriterTestFixture.java |  136 -
 .../mgmt/persist/XmlMementoSerializerTest.java  |  615 ----
 .../mgmt/rebind/ActivePartialRebindTest.java    |  105 -
 .../rebind/ActivePartialRebindVersionTest.java  |  117 -
 .../core/mgmt/rebind/CheckpointEntityTest.java  |  108 -
 .../brooklyn/core/mgmt/rebind/Dumpers.java      |  273 --
 .../mgmt/rebind/RebindCatalogEntityTest.java    |  154 -
 .../core/mgmt/rebind/RebindCatalogItemTest.java |  285 --
 ...talogWhenCatalogPersistenceDisabledTest.java |   93 -
 .../rebind/RebindClassInitializationTest.java   |   78 -
 .../mgmt/rebind/RebindDynamicGroupTest.java     |   67 -
 .../core/mgmt/rebind/RebindEnricherTest.java    |  324 --
 .../rebind/RebindEntityDynamicTypeInfoTest.java |  122 -
 .../core/mgmt/rebind/RebindEntityTest.java      |  953 ------
 .../core/mgmt/rebind/RebindFailuresTest.java    |  293 --
 .../core/mgmt/rebind/RebindFeedTest.java        |  403 ---
 .../core/mgmt/rebind/RebindFeedWithHaTest.java  |  131 -
 .../core/mgmt/rebind/RebindGroupTest.java       |  123 -
 .../rebind/RebindLocalhostLocationTest.java     |  104 -
 .../core/mgmt/rebind/RebindLocationTest.java    |  381 ---
 .../RebindManagerExceptionHandlerTest.java      |   86 -
 .../mgmt/rebind/RebindManagerSorterTest.java    |  147 -
 .../core/mgmt/rebind/RebindManagerTest.java     |   62 -
 .../core/mgmt/rebind/RebindOptions.java         |  102 -
 .../core/mgmt/rebind/RebindPolicyTest.java      |  339 --
 .../rebind/RebindSshMachineLocationTest.java    |  102 -
 .../core/mgmt/rebind/RebindTestFixture.java     |  330 --
 .../mgmt/rebind/RebindTestFixtureWithApp.java   |   32 -
 .../core/mgmt/rebind/RebindTestUtils.java       |  491 ---
 .../rebind/RecordingRebindExceptionHandler.java |   92 -
 .../CompoundTransformerLoaderTest.java          |   79 -
 .../transformer/CompoundTransformerTest.java    |  481 ---
 .../transformer/impl/XsltTransformerTest.java   |  170 -
 .../core/objs/AbstractEntityAdjunctTest.java    |   52 -
 .../objs/BasicSpecParameterFromClassTest.java   |  109 -
 .../objs/BasicSpecParameterFromListTest.java    |  186 --
 .../core/plan/XmlPlanToSpecTransformer.java     |  136 -
 .../core/plan/XmlPlanToSpecTransformerTest.java |   67 -
 .../core/policy/basic/BasicPolicyTest.java      |   89 -
 .../core/policy/basic/EnricherTypeTest.java     |   58 -
 .../core/policy/basic/PolicyConfigTest.java     |  201 --
 .../policy/basic/PolicySubscriptionTest.java    |  153 -
 .../core/policy/basic/PolicyTypeTest.java       |   58 -
 .../relations/RelationsEntityBasicTest.java     |   55 -
 .../relations/RelationsEntityRebindTest.java    |   51 -
 .../core/relations/RelationshipTest.java        |   57 -
 .../brooklyn/core/sensor/StaticSensorTest.java  |   53 -
 .../core/sensor/http/HttpRequestSensorTest.java |   84 -
 .../password/CreatePasswordSensorTest.java      |   59 -
 .../ssh/SshCommandSensorIntegrationTest.java    |   89 -
 .../core/server/entity/BrooklynMetricsTest.java |  127 -
 .../core/test/BrooklynAppLiveTestSupport.java   |   50 -
 .../core/test/BrooklynAppUnitTestSupport.java   |   52 -
 .../core/test/BrooklynMgmtUnitTestSupport.java  |   61 -
 .../apache/brooklyn/core/test/HttpService.java  |  226 --
 .../core/test/entity/BlockingEntity.java        |   45 -
 .../core/test/entity/BlockingEntityImpl.java    |   59 -
 .../entity/LocalManagementContextForTests.java  |  157 -
 .../core/test/entity/NoopStartable.java         |   29 -
 .../core/test/entity/TestApplication.java       |   59 -
 .../core/test/entity/TestApplicationImpl.java   |   96 -
 .../entity/TestApplicationNoEnrichersImpl.java  |   29 -
 .../brooklyn/core/test/entity/TestCluster.java  |   40 -
 .../core/test/entity/TestClusterImpl.java       |  100 -
 .../brooklyn/core/test/entity/TestEntity.java   |  112 -
 .../core/test/entity/TestEntityImpl.java        |  184 -
 .../test/entity/TestEntityNoEnrichersImpl.java  |   32 -
 .../entity/TestEntityTransientCopyImpl.java     |   28 -
 .../brooklyn/core/test/policy/TestEnricher.java |   62 -
 .../brooklyn/core/test/policy/TestPolicy.java   |   61 -
 .../longevity/EntityCleanupLongevityTest.java   |   61 -
 .../EntityCleanupLongevityTestFixture.java      |  174 -
 .../test/qa/longevity/EntityCleanupTest.java    |   58 -
 .../qa/performance/AbstractPerformanceTest.java |  179 -
 .../EntityPerformanceLongevityTest.java         |   35 -
 .../qa/performance/EntityPerformanceTest.java   |  164 -
 .../EntityPersistencePerformanceTest.java       |   99 -
 .../FilePersistencePerformanceTest.java         |  246 --
 .../GroovyYardStickPerformanceTest.groovy       |   67 -
 .../JavaYardStickPerformanceTest.java           |   90 -
 .../SubscriptionPerformanceTest.java            |  155 -
 .../qa/performance/TaskPerformanceTest.java     |  164 -
 .../typereg/BasicBrooklynTypeRegistryTest.java  |  186 --
 .../typereg/ExampleXmlTypePlanTransformer.java  |  140 -
 .../ExampleXmlTypePlanTransformerTest.java      |   67 -
 .../JavaClassNameTypePlanTransformerTest.java   |   90 -
 .../typereg/RegisteredTypePredicatesTest.java   |  157 -
 ...CustomAggregatingEnricherDeprecatedTest.java |  405 ---
 .../stock/CustomAggregatingEnricherTest.java    |  553 ---
 .../stock/EnricherWithDeferredSupplierTest.java |  132 -
 .../brooklyn/enricher/stock/EnrichersTest.java  |  495 ---
 ...SensorPropagatingEnricherDeprecatedTest.java |  108 -
 .../stock/SensorPropagatingEnricherTest.java    |  268 --
 .../TransformingEnricherDeprecatedTest.java     |   92 -
 .../stock/TransformingEnricherTest.java         |   71 -
 .../YamlRollingTimeWindowMeanEnricherTest.java  |  179 -
 .../YamlTimeWeightedDeltaEnricherTest.java      |  107 -
 .../enricher/stock/reducer/ReducerTest.java     |  242 --
 .../entity/group/DynamicClusterTest.java        | 1178 -------
 ...DynamicClusterWithAvailabilityZonesTest.java |  225 --
 .../entity/group/DynamicFabricTest.java         |  494 ---
 .../brooklyn/entity/group/DynamicGroupTest.java |  550 ---
 .../entity/group/DynamicMultiGroupTest.java     |  218 --
 .../entity/group/DynamicRegionsFabricTest.java  |  170 -
 .../entity/group/GroupPickUpEntitiesTest.java   |  157 -
 .../apache/brooklyn/entity/group/GroupTest.java |  143 -
 .../group/MembershipTrackingPolicyTest.java     |  312 --
 .../entity/group/QuarantineGroupTest.java       |   85 -
 .../BalancingNodePlacementStrategyTest.java     |  116 -
 .../ProportionalZoneFailureDetectorTest.java    |  123 -
 .../entity/stock/BasicStartableTest.java        |  172 -
 .../brooklyn/entity/stock/DataEntityTest.java   |  142 -
 .../feed/function/FunctionFeedTest.java         |  315 --
 .../feed/http/HttpFeedIntegrationTest.java      |  160 -
 .../apache/brooklyn/feed/http/HttpFeedTest.java |  389 ---
 .../feed/http/HttpValueFunctionsTest.java       |   93 -
 .../brooklyn/feed/http/JsonFunctionsTest.java   |  135 -
 .../feed/shell/ShellFeedIntegrationTest.java    |  226 --
 .../feed/ssh/SshFeedIntegrationTest.java        |  258 --
 .../apache/brooklyn/feed/ssh/SshFeedTest.java   |  188 --
 .../feed/ssh/SshValueFunctionsTest.java         |   43 -
 .../location/byon/ByonLocationResolverTest.java |  411 ---
 ...stMachineProvisioningLocationRebindTest.java |  131 -
 ...ixedListMachineProvisioningLocationTest.java |  578 ----
 .../location/byon/HostLocationResolverTest.java |  126 -
 .../byon/SingleMachineLocationResolverTest.java |  132 -
 .../SingleMachineProvisioningLocationTest.java  |   65 -
 .../LocalhostLocationResolverTest.java          |  269 --
 ...ocalhostMachineProvisioningLocationTest.java |  215 --
 .../LocalhostProvisioningAndAccessTest.java     |   59 -
 .../location/multi/MultiLocationRebindTest.java |  122 -
 .../multi/MultiLocationResolverTest.java        |  203 --
 .../location/multi/MultiLocationTest.java       |  121 -
 .../location/paas/PaasLocationTest.java         |   34 -
 .../location/paas/TestPaasLocation.java         |   32 -
 .../ssh/SshMachineLocationIntegrationTest.java  |  141 -
 .../ssh/SshMachineLocationPerformanceTest.java  |  172 -
 .../SshMachineLocationReuseIntegrationTest.java |  171 -
 .../ssh/SshMachineLocationSshToolTest.java      |  131 -
 .../location/ssh/SshMachineLocationTest.java    |  346 --
 .../util/core/BrooklynMavenArtifactsTest.java   |   97 -
 .../util/core/ResourceUtilsHttpTest.java        |  195 --
 .../brooklyn/util/core/ResourceUtilsTest.java   |  189 --
 .../util/core/config/ConfigBagTest.java         |  192 --
 .../core/crypto/SecureKeysAndSignerTest.java    |  168 -
 .../util/core/file/ArchiveBuilderTest.java      |  199 --
 .../util/core/file/ArchiveUtilsTest.java        |  136 -
 .../util/core/flags/MethodCoercionsTest.java    |  148 -
 .../util/core/http/BetterMockWebServer.java     |  138 -
 .../util/core/http/HttpToolIntegrationTest.java |   99 -
 .../util/core/internal/FlagUtilsTest.java       |  318 --
 .../util/core/internal/RepeaterTest.java        |  251 --
 .../util/core/internal/TypeCoercionsTest.java   |  381 ---
 .../core/internal/ssh/RecordingSshTool.java     |  104 -
 .../internal/ssh/ShellToolAbstractTest.java     |  444 ---
 .../ssh/SshToolAbstractIntegrationTest.java     |  347 --
 .../ssh/SshToolAbstractPerformanceTest.java     |  137 -
 .../ssh/cli/SshCliToolIntegrationTest.java      |  118 -
 .../ssh/cli/SshCliToolPerformanceTest.java      |   44 -
 .../ssh/process/ProcessToolIntegrationTest.java |   69 -
 .../ssh/process/ProcessToolStaticsTest.java     |   79 -
 .../sshj/SshjToolAsyncStubIntegrationTest.java  |  177 -
 .../ssh/sshj/SshjToolIntegrationTest.java       |  313 --
 .../ssh/sshj/SshjToolPerformanceTest.java       |   44 -
 .../util/core/mutex/WithMutexesTest.java        |  129 -
 .../brooklyn/util/core/osgi/OsgiTestBase.java   |   56 -
 .../util/core/sensor/SensorPredicatesTest.java  |   38 -
 .../core/ssh/BashCommandsIntegrationTest.java   |  530 ---
 .../task/BasicTaskExecutionPerformanceTest.java |  205 --
 .../util/core/task/BasicTaskExecutionTest.java  |  461 ---
 .../util/core/task/BasicTasksFutureTest.java    |  226 --
 .../core/task/CompoundTaskExecutionTest.java    |  257 --
 .../core/task/DynamicSequentialTaskTest.java    |  482 ---
 .../core/task/NonBasicTaskExecutionTest.java    |  134 -
 .../util/core/task/ScheduledExecutionTest.java  |  330 --
 .../core/task/SingleThreadedSchedulerTest.java  |  194 --
 .../util/core/task/TaskFinalizationTest.java    |   62 -
 .../util/core/task/TaskPredicatesTest.java      |   73 -
 .../brooklyn/util/core/task/TasksTest.java      |  183 -
 .../util/core/task/ValueResolverTest.java       |  133 -
 .../util/core/task/ssh/SshTasksTest.java        |  211 --
 .../util/core/task/system/SystemTasksTest.java  |  136 -
 .../util/core/text/DataUriSchemeParserTest.java |   53 -
 .../util/core/text/TemplateProcessorTest.java   |  197 --
 .../core/xstream/CompilerCompatibilityTest.java |  158 -
 .../util/core/xstream/ConverterTestFixture.java |   40 -
 .../xstream/EnumCaseForgivingConverterTest.java |   53 -
 .../xstream/ImmutableListConverterTest.java     |   60 -
 .../core/xstream/InetAddressConverterTest.java  |   42 -
 .../core/xstream/StringKeyMapConverterTest.java |   77 -
 .../brooklyn/util/core/xstream/XmlUtilTest.java |   34 -
 .../io.brooklyn/brooklyn-core/pom.properties    |   22 -
 .../brooklyn/catalog/internal/osgi-catalog.xml  |   31 -
 .../brooklyn/config/more-sample.properties      |   20 -
 .../resources/brooklyn/config/sample.properties |   20 -
 .../resources/brooklyn/config/tricky.properties |   23 -
 .../test/resources/brooklyn/default.catalog.bom |   19 -
 .../rebind/rebind-catalog-item-test-catalog.xml |   28 -
 .../rebind/transformer/impl/renameClass.xslt    |   35 -
 .../rebind/transformer/impl/renameField.xslt    |   35 -
 .../rebind/transformer/impl/renameType.xslt     |   41 -
 .../brooklyn/util/crypto/sample_dsa.pem         |   12 -
 .../brooklyn/util/crypto/sample_dsa.pem.pub     |    1 -
 .../brooklyn/util/crypto/sample_rsa.pem         |   27 -
 .../brooklyn/util/crypto/sample_rsa.pem.pub     |    1 -
 .../util/crypto/sample_rsa_passphrase.pem       |   30 -
 .../util/crypto/sample_rsa_passphrase.pem.pub   |    1 -
 .../resources/brooklyn/util/ssh/test_sudoers    |   24 -
 .../test/resources/hello-world-no-mapping.txt   |   18 -
 .../test/resources/hello-world-no-mapping.war   |  Bin 14693 -> 0 bytes
 .../core/src/test/resources/hello-world.txt     |   18 -
 .../core/src/test/resources/hello-world.war     |  Bin 14729 -> 0 bytes
 .../brooklyn-AppInCatalog.jar                   |  Bin 2891 -> 0 bytes
 .../brooklyn-AppInCatalog.txt                   |   38 -
 .../brooklyn/location/basic/sample_id_rsa       |   27 -
 .../brooklyn/location/basic/sample_id_rsa.pub   |    1 -
 .../rebind/compiler_compatibility_eclipse.xml   |   41 -
 .../rebind/compiler_compatibility_oracle.xml    |   41 -
 .../core/src/test/resources/server.ks           |  Bin 1366 -> 0 bytes
 brooklyn-server/karaf/apache-brooklyn/pom.xml   |  127 -
 .../filtered-resources/etc/branding.properties  |   35 -
 .../src/main/resources/etc/custom.properties    |  120 -
 .../resources/etc/org.ops4j.pax.logging.cfg     |   46 -
 .../src/main/resources/etc/system.properties    |  133 -
 brooklyn-server/karaf/commands/pom.xml          |   82 -
 .../apache/brooklyn/karaf/commands/Catalog.java |   46 -
 brooklyn-server/karaf/features/pom.xml          |   60 -
 .../karaf/features/src/main/feature/feature.xml |  218 --
 .../features/src/main/resources/.gitignore      |    4 -
 brooklyn-server/karaf/itest/pom.xml             |  209 --
 .../java/org/apache/brooklyn/AssemblyTest.java  |  118 -
 .../itest/src/test/resources/exam.properties    |   21 -
 .../karaf/itest/src/test/resources/logback.xml  |   43 -
 brooklyn-server/karaf/pom.xml                   |  163 -
 brooklyn-server/launcher/pom.xml                |  283 --
 .../org/apache/brooklyn/launcher/Activator.java |   39 -
 .../brooklyn/launcher/BrooklynLauncher.java     | 1067 ------
 .../launcher/BrooklynServerDetails.java         |   47 -
 .../brooklyn/launcher/BrooklynWebServer.java    |  670 ----
 .../camp/BrooklynCampPlatformLauncher.java      |   71 -
 .../launcher/camp/SimpleYamlLauncher.java       |   35 -
 .../config/BrooklynDevelopmentModes.java        |   92 -
 .../launcher/config/BrooklynGlobalConfig.java   |   66 -
 .../launcher/config/CustomResourceLocator.java  |  126 -
 .../config/StopWhichAppsOnShutdown.java         |   23 -
 .../ContextHandlerCollectionHotSwappable.java   |   62 -
 .../entity/basic/VanillaSoftwareYamlTest.java   |   97 -
 .../BrooklynEntityMirrorIntegrationTest.java    |  179 -
 .../brooklynnode/BrooklynNodeRestTest.java      |  145 -
 .../database/mssql/MssqlBlueprintLiveTest.java  |   59 -
 .../BrooklynLauncherHighAvailabilityTest.java   |  258 --
 .../BrooklynLauncherRebindCatalogTest.java      |  124 -
 .../BrooklynLauncherRebindTestFixture.java      |  257 --
 .../BrooklynLauncherRebindTestToFiles.java      |  154 -
 ...lynLauncherRebindToCloudObjectStoreTest.java |  175 -
 .../brooklyn/launcher/BrooklynLauncherTest.java |  392 ---
 .../launcher/BrooklynWebServerTest.java         |  222 --
 .../launcher/SimpleYamlLauncherForTests.java    |   31 -
 .../brooklyn/launcher/WebAppRunnerTest.java     |  171 -
 .../apache/brooklyn/launcher/YamlLauncher.java  |   35 -
 .../blueprints/AbstractBlueprintTest.java       |  233 --
 .../blueprints/CouchbaseBlueprintTest.java      |   69 -
 .../blueprints/MongoDbBlueprintTest.java        |   51 -
 .../Windows7zipBlueprintLiveTest.java           |  100 -
 .../jsgui/BrooklynJavascriptGuiLauncher.java    |   88 -
 .../BrooklynJavascriptGuiLauncherTest.java      |   81 -
 .../src/test/resources/7zip-catalog.yaml        |   42 -
 .../basic-empty-app-and-entity-blueprint.yaml   |   30 -
 .../resources/basic-empy-app-blueprint.yaml     |   23 -
 .../src/test/resources/cassandra-blueprint.yaml |   29 -
 .../launcher/src/test/resources/client.ks       |  Bin 1364 -> 0 bytes
 .../launcher/src/test/resources/client.ts       |  Bin 658 -> 0 bytes
 .../resources/couchbase-cluster-singleNode.yaml |   36 -
 .../src/test/resources/couchbase-cluster.yaml   |   33 -
 .../src/test/resources/couchbase-node.yaml      |   26 -
 .../couchbase-replication-w-pillowfight.yaml    |   56 -
 .../src/test/resources/couchbase-w-loadgen.yaml |   54 -
 .../test/resources/couchbase-w-pillowfight.yaml |   35 -
 .../launcher/src/test/resources/install7zip.ps1 |   35 -
 .../java-web-app-and-db-with-function.yaml      |   36 -
 .../src/test/resources/mongo-blueprint.yaml     |   23 -
 .../resources/mongo-client-single-server.yaml   |   35 -
 .../src/test/resources/mongo-product-delete.js  |   20 -
 .../src/test/resources/mongo-product-insert.js  |   24 -
 .../src/test/resources/mongo-product-update.js  |   20 -
 .../src/test/resources/mongo-scripts.yaml       |   39 -
 .../resources/mongo-sharded-authentication.yaml |   65 -
 .../src/test/resources/mongo-sharded.yaml       |   54 -
 .../mongo-single-server-blueprint.yaml          |   23 -
 .../launcher/src/test/resources/mongo.key       |   16 -
 .../launcher/src/test/resources/mssql-test.yaml |   60 -
 .../launcher/src/test/resources/nginx.yaml      |   27 -
 .../src/test/resources/opengamma-cluster.yaml   |   48 -
 .../launcher/src/test/resources/playing.yaml    |   21 -
 .../test/resources/postgres-gce-blueprint.yaml  |   22 -
 .../resources/rebind-test-catalog-additions.bom |   32 -
 .../src/test/resources/rebind-test-catalog.bom  |   32 -
 .../launcher/src/test/resources/server.ks       |  Bin 1366 -> 0 bytes
 .../launcher/src/test/resources/server.ts       |  Bin 658 -> 0 bytes
 .../src/test/resources/storm-blueprint.yaml     |   26 -
 .../resources/vanilla-software-blueprint.yaml   |   40 -
 .../vanilla-software-with-child-blueprint.yaml  |   44 -
 .../test/resources/visitors-creation-script.sql |   41 -
 .../launcher/src/test/resources/web.yaml        |   24 -
 brooklyn-server/locations/jclouds/pom.xml       |  198 --
 .../JcloudsBlobStoreBasedObjectStore.java       |  237 --
 .../jclouds/JcloudsStoreObjectAccessor.java     |  127 -
 ...AbstractJcloudsSubnetSshMachineLocation.java |   37 -
 .../jclouds/BasicJcloudsLocationCustomizer.java |   99 -
 .../location/jclouds/BrooklynImageChooser.java  |  368 --
 .../jclouds/ComputeServiceRegistry.java         |   27 -
 .../jclouds/ComputeServiceRegistryImpl.java     |  182 -
 .../jclouds/JcloudsByonLocationResolver.java    |  182 -
 .../location/jclouds/JcloudsLocation.java       | 3147 ------------------
 .../location/jclouds/JcloudsLocationConfig.java |  279 --
 .../jclouds/JcloudsLocationCustomizer.java      |  104 -
 .../jclouds/JcloudsLocationResolver.java        |  226 --
 .../jclouds/JcloudsMachineLocation.java         |   61 -
 .../location/jclouds/JcloudsMachineNamer.java   |   44 -
 .../location/jclouds/JcloudsPredicates.java     |   60 -
 ...JcloudsPropertiesFromBrooklynProperties.java |  158 -
 .../jclouds/JcloudsSshMachineLocation.java      |  596 ----
 .../brooklyn/location/jclouds/JcloudsUtil.java  |  473 ---
 .../jclouds/JcloudsWinRmMachineLocation.java    |  308 --
 .../jclouds/SudoTtyFixingCustomizer.java        |   57 -
 .../JcloudsLocationSecurityGroupCustomizer.java |  667 ----
 .../JcloudsPortForwarderExtension.java          |   45 -
 .../networking/SecurityGroupDefinition.java     |  102 -
 .../jclouds/networking/SecurityGroupTool.java   |  166 -
 .../jclouds/pool/MachinePoolPredicates.java     |  149 -
 .../location/jclouds/pool/MachineSet.java       |   98 -
 .../jclouds/pool/ReusableMachineTemplate.java   |  182 -
 .../AbstractPortableTemplateBuilder.java        |  527 ---
 .../templates/PortableTemplateBuilder.java      |  145 -
 .../zone/AwsAvailabilityZoneExtension.java      |   73 -
 .../policy/jclouds/os/CreateUserPolicy.java     |  181 -
 ...pache.brooklyn.api.location.LocationResolver |   20 -
 .../brooklyn/location-metadata.properties       |  222 --
 .../location/jclouds/sample/setup-server.sh     |   31 -
 .../mgmt/persist/jclouds/BlobStoreCleaner.java  |   71 -
 .../persist/jclouds/BlobStoreExpiryTest.java    |  196 --
 .../BlobStorePersistencePerformanceTest.java    |  134 -
 .../mgmt/persist/jclouds/BlobStoreTest.java     |  150 -
 ...nMementoPersisterJcloudsObjectStoreTest.java |   67 -
 ...tyToBlobStorePersistencePerformanceTest.java |   65 -
 ...ailabilityManagerJcloudsObjectStoreTest.java |   80 -
 .../JcloudsBlobStoreBasedObjectStoreTest.java   |  118 -
 .../jclouds/JcloudsExpect100ContinueTest.java   |  148 -
 .../JcloudsObjectStoreAccessorWriterTest.java   |  182 -
 .../jclouds/AbstractJcloudsLiveTest.java        |  183 -
 .../jclouds/AbstractJcloudsStubbedLiveTest.java |  124 -
 .../jclouds/BailOutJcloudsLocation.java         |  194 --
 .../jclouds/DelegatingComputeService.java       |  229 --
 .../jclouds/JcloudsAddressesLiveTest.java       |  227 --
 .../JcloudsByonLocationResolverAwsLiveTest.java |  177 -
 ...dsByonLocationResolverSoftlayerLiveTest.java |  104 -
 .../JcloudsByonLocationResolverTest.java        |   80 -
 .../jclouds/JcloudsByonRebindLiveTest.java      |  165 -
 .../JcloudsHardwareProfilesStubbedLiveTest.java |   77 -
 .../jclouds/JcloudsLocationMetadataTest.java    |   71 -
 .../JcloudsLocationRegisterMachineLiveTest.java |  144 -
 ...cloudsLocationReleasePortForwardingTest.java |  184 -
 .../jclouds/JcloudsLocationResolverTest.java    |  356 --
 ...udsLocationSuspendResumeMachineLiveTest.java |   62 -
 ...ationTemplateOptionsCustomisersLiveTest.java |  108 -
 .../location/jclouds/JcloudsLocationTest.java   |  610 ----
 .../location/jclouds/JcloudsLoginLiveTest.java  |  456 ---
 .../jclouds/JcloudsMachineNamerTest.java        |   56 -
 ...udsPropertiesFromBrooklynPropertiesTest.java |   99 -
 .../location/jclouds/JcloudsRebindLiveTest.java |  231 --
 .../location/jclouds/JcloudsRebindStubTest.java |  256 --
 .../location/jclouds/JcloudsSshingLiveTest.java |   60 -
 .../location/jclouds/JcloudsSuseLiveTest.java   |  102 -
 .../location/jclouds/LiveTestEntity.java        |   89 -
 .../jclouds/RebindJcloudsLocationLiveTest.java  |  326 --
 .../jclouds/RebindJcloudsLocationTest.java      |   65 -
 ...loudsLocationUserLoginAndConfigLiveTest.java |  248 --
 ...hineProvisioningLocationJcloudsLiveTest.java |  123 -
 .../jclouds/StandaloneJcloudsLiveTest.java      |  253 --
 ...oudsLocationSecurityGroupCustomizerTest.java |  366 --
 .../JcloudsPortForwardingStubbedLiveTest.java   |  195 --
 .../networking/SecurityGroupLiveTest.java       |   32 -
 .../provider/AbstractJcloudsLocationTest.java   |  202 --
 .../provider/AwsEc2LocationLiveTest.java        |   66 -
 .../provider/AwsEc2LocationWindowsLiveTest.java |   95 -
 .../provider/CarrenzaLocationLiveTest.java      |  135 -
 .../provider/GoGridLocationLiveTest.java        |   52 -
 .../provider/RackspaceLocationLiveTest.java     |   82 -
 .../zone/AwsAvailabilityZoneExtensionTest.java  |  120 -
 .../jclouds/os/CreateUserPolicyLiveTest.java    |  122 -
 .../policy/jclouds/os/CreateUserPolicyTest.java |  136 -
 ...location-test-various-login-credentials.yaml |   67 -
 .../jclouds/persisted-aws-machine-aKEcbxKN      |  329 --
 .../jclouds/persisted-aws-parent-lCYB3mTb       |   78 -
 .../persisted-aws-winrm-machine-KYSryzW8        |  184 -
 .../jclouds/persisted-aws-winrm-parent-fKc0Ofyn |   75 -
 .../jclouds/persisted-azure-machine-VNapYjwp    |  271 --
 .../jclouds/persisted-azure-parent-briByOel     |   65 -
 .../logging/logback-includes/pom.xml            |   50 -
 .../JcloudsPersistenceThreadDiscriminator.java  |   65 -
 .../brooklyn/logback-appender-file.xml          |   71 -
 .../brooklyn/logback-appender-jclouds.xml       |   49 -
 .../brooklyn/logback-appender-stdout.xml        |   35 -
 .../main/resources/brooklyn/logback-debug.xml   |   28 -
 .../brooklyn/logback-logger-debug-all.xml       |   31 -
 .../brooklyn/logback-logger-debug-favs.xml      |   32 -
 .../brooklyn/logback-logger-debug-jclouds.xml   |   47 -
 .../brooklyn/logback-logger-excludes.xml        |   64 -
 .../resources/brooklyn/logback-logger-trace.xml |   26 -
 .../src/main/resources/logback-custom.xml       |   45 -
 .../src/main/resources/logback-main.xml         |   61 -
 brooklyn-server/logging/logback-xml/pom.xml     |   45 -
 .../logback-xml/src/main/resources/logback.xml  |   40 -
 brooklyn-server/parent/pom.xml                  | 1815 ----------
 brooklyn-server/policy/pom.xml                  |   95 -
 .../policy/autoscaling/AutoScalerPolicy.java    | 1133 -------
 .../autoscaling/MaxPoolSizeReachedEvent.java    |  103 -
 .../policy/autoscaling/ResizeOperator.java      |   31 -
 .../policy/autoscaling/SizeHistory.java         |  166 -
 .../brooklyn/policy/enricher/DeltaEnricher.java |   53 -
 .../policy/enricher/HttpLatencyDetector.java    |  320 --
 .../policy/enricher/RollingMeanEnricher.java    |   81 -
 .../enricher/RollingTimeWindowMeanEnricher.java |  212 --
 .../enricher/TimeFractionDeltaEnricher.java     |  109 -
 .../enricher/TimeWeightedDeltaEnricher.java     |  130 -
 .../followthesun/DefaultFollowTheSunModel.java  |  328 --
 .../policy/followthesun/FollowTheSunModel.java  |   56 -
 .../followthesun/FollowTheSunParameters.java    |   95 -
 .../policy/followthesun/FollowTheSunPolicy.java |  279 --
 .../policy/followthesun/FollowTheSunPool.java   |   74 -
 .../followthesun/FollowTheSunPoolImpl.java      |  177 -
 .../followthesun/FollowTheSunStrategy.java      |  161 -
 .../policy/followthesun/WeightedObject.java     |   71 -
 .../policy/ha/AbstractFailureDetector.java      |  360 --
 .../policy/ha/ConditionalSuspendPolicy.java     |  102 -
 .../policy/ha/ConnectionFailureDetector.java    |  125 -
 .../apache/brooklyn/policy/ha/HASensors.java    |   62 -
 .../policy/ha/ServiceFailureDetector.java       |  339 --
 .../brooklyn/policy/ha/ServiceReplacer.java     |  213 --
 .../brooklyn/policy/ha/ServiceRestarter.java    |  162 -
 .../policy/ha/SshMachineFailureDetector.java    |   99 -
 .../loadbalancing/BalanceableContainer.java     |   50 -
 .../loadbalancing/BalanceablePoolModel.java     |   64 -
 .../loadbalancing/BalanceableWorkerPool.java    |   83 -
 .../BalanceableWorkerPoolImpl.java              |  184 -
 .../policy/loadbalancing/BalancingStrategy.java |  622 ----
 .../DefaultBalanceablePoolModel.java            |  280 --
 .../loadbalancing/ItemsInContainersGroup.java   |   51 -
 .../ItemsInContainersGroupImpl.java             |  147 -
 .../loadbalancing/LoadBalancingPolicy.java      |  341 --
 .../loadbalancing/LocationConstraint.java       |   28 -
 .../brooklyn/policy/loadbalancing/Movable.java  |   50 -
 .../policy/loadbalancing/PolicyUtilForPool.java |   96 -
 .../autoscaling/AutoScalerPolicyMetricTest.java |  352 --
 .../autoscaling/AutoScalerPolicyRebindTest.java |  134 -
 .../AutoScalerPolicyReconfigurationTest.java    |  189 --
 .../autoscaling/AutoScalerPolicyTest.java       |  648 ----
 .../autoscaling/LocallyResizableEntity.java     |   72 -
 .../policy/enricher/DeltaEnrichersTests.java    |  144 -
 .../enricher/HttpLatencyDetectorTest.java       |  149 -
 .../policy/enricher/RebindEnricherTest.java     |  153 -
 .../enricher/RollingMeanEnricherTest.java       |  106 -
 .../RollingTimeWindowMeanEnricherTest.java      |  156 -
 .../enricher/TimeFractionDeltaEnricherTest.java |  104 -
 .../AbstractFollowTheSunPolicyTest.java         |  236 --
 .../followthesun/FollowTheSunModelTest.java     |  194 --
 .../FollowTheSunPolicySoakTest.java             |  271 --
 .../followthesun/FollowTheSunPolicyTest.java    |  303 --
 .../ha/ConnectionFailureDetectorTest.java       |  307 --
 .../brooklyn/policy/ha/HaPolicyRebindTest.java  |  170 -
 ...ServiceFailureDetectorStabilizationTest.java |  233 --
 .../policy/ha/ServiceFailureDetectorTest.java   |  406 ---
 .../brooklyn/policy/ha/ServiceReplacerTest.java |  337 --
 .../policy/ha/ServiceRestarterTest.java         |  189 --
 .../AbstractLoadBalancingPolicyTest.java        |  251 --
 .../BalanceableWorkerPoolTest.java              |  131 -
 .../ItemsInContainersGroupTest.java             |  188 --
 .../loadbalancing/LoadBalancingModelTest.java   |  113 -
 .../LoadBalancingPolicyConcurrencyTest.java     |  210 --
 .../LoadBalancingPolicySoakTest.java            |  272 --
 .../loadbalancing/LoadBalancingPolicyTest.java  |  396 ---
 .../loadbalancing/MockContainerEntity.java      |   60 -
 .../loadbalancing/MockContainerEntityImpl.java  |  208 --
 .../policy/loadbalancing/MockItemEntity.java    |   45 -
 .../loadbalancing/MockItemEntityImpl.java       |  112 -
 brooklyn-server/pom.xml                         |  225 --
 brooklyn-server/rest/rest-api/pom.xml           |  178 -
 .../org/apache/brooklyn/rest/api/AccessApi.java |   62 -
 .../apache/brooklyn/rest/api/ActivityApi.java   |   69 -
 .../brooklyn/rest/api/ApplicationApi.java       |  222 --
 .../apache/brooklyn/rest/api/CatalogApi.java    |  376 ---
 .../apache/brooklyn/rest/api/EffectorApi.java   |   85 -
 .../org/apache/brooklyn/rest/api/EntityApi.java |  235 --
 .../brooklyn/rest/api/EntityConfigApi.java      |  145 -
 .../apache/brooklyn/rest/api/LocationApi.java   |  101 -
 .../org/apache/brooklyn/rest/api/PolicyApi.java |  151 -
 .../brooklyn/rest/api/PolicyConfigApi.java      |  120 -
 .../org/apache/brooklyn/rest/api/ScriptApi.java |   52 -
 .../org/apache/brooklyn/rest/api/SensorApi.java |  150 -
 .../org/apache/brooklyn/rest/api/ServerApi.java |  206 --
 .../org/apache/brooklyn/rest/api/UsageApi.java  |  156 -
 .../apache/brooklyn/rest/api/VersionApi.java    |   43 -
 .../brooklyn/rest/domain/AccessSummary.java     |   74 -
 .../apache/brooklyn/rest/domain/ApiError.java   |  207 --
 .../brooklyn/rest/domain/ApplicationSpec.java   |  181 -
 .../rest/domain/ApplicationSummary.java         |  117 -
 .../rest/domain/BrooklynFeatureSummary.java     |   91 -
 .../rest/domain/CatalogEntitySummary.java       |   83 -
 .../rest/domain/CatalogItemSummary.java         |  163 -
 .../rest/domain/CatalogLocationSummary.java     |   62 -
 .../rest/domain/CatalogPolicySummary.java       |   65 -
 .../brooklyn/rest/domain/ConfigSummary.java     |  171 -
 .../brooklyn/rest/domain/EffectorSummary.java   |  187 --
 .../rest/domain/EntityConfigSummary.java        |   70 -
 .../apache/brooklyn/rest/domain/EntitySpec.java |  102 -
 .../brooklyn/rest/domain/EntitySummary.java     |   97 -
 .../apache/brooklyn/rest/domain/HasConfig.java  |   28 -
 .../org/apache/brooklyn/rest/domain/HasId.java  |   26 -
 .../apache/brooklyn/rest/domain/HasName.java    |   26 -
 .../rest/domain/HighAvailabilitySummary.java    |  144 -
 .../brooklyn/rest/domain/LinkWithMetadata.java  |   88 -
 .../rest/domain/LocationConfigSummary.java      |   64 -
 .../brooklyn/rest/domain/LocationSpec.java      |   96 -
 .../brooklyn/rest/domain/LocationSummary.java   |   96 -
 .../rest/domain/PolicyConfigSummary.java        |   60 -
 .../brooklyn/rest/domain/PolicySummary.java     |  108 -
 .../rest/domain/ScriptExecutionSummary.java     |   67 -
 .../brooklyn/rest/domain/SensorSummary.java     |  107 -
 .../org/apache/brooklyn/rest/domain/Status.java |   33 -
 .../rest/domain/SummaryComparators.java         |   82 -
 .../brooklyn/rest/domain/TaskSummary.java       |  231 --
 .../brooklyn/rest/domain/UsageStatistic.java    |  123 -
 .../brooklyn/rest/domain/UsageStatistics.java   |   76 -
 .../brooklyn/rest/domain/VersionSummary.java    |   80 -
 .../rest-api/src/main/webapp/WEB-INF/web.xml    |  121 -
 .../brooklyn/rest/domain/ApiErrorTest.java      |   63 -
 .../rest/domain/ApplicationSpecTest.java        |   53 -
 .../rest/domain/EffectorSummaryTest.java        |   53 -
 .../brooklyn/rest/domain/EntitySpecTest.java    |   50 -
 .../brooklyn/rest/domain/EntitySummaryTest.java |   61 -
 .../brooklyn/rest/domain/LocationSpecTest.java  |   58 -
 .../rest/domain/VersionSummaryTest.java         |   62 -
 .../brooklyn/rest/util/RestApiTestUtils.java    |   57 -
 .../resources/fixtures/api-error-basic.json     |    4 -
 .../fixtures/api-error-no-details.json          |    3 -
 .../resources/fixtures/application-list.json    |   44 -
 .../resources/fixtures/application-spec.json    |   16 -
 .../resources/fixtures/application-tree.json    |   43 -
 .../test/resources/fixtures/application.json    |   22 -
 .../fixtures/catalog-application-list.json      |   29 -
 .../resources/fixtures/catalog-application.json |    9 -
 .../fixtures/effector-summary-list.json         |   47 -
 .../resources/fixtures/effector-summary.json    |    9 -
 .../resources/fixtures/entity-only-type.json    |    3 -
 .../resources/fixtures/entity-summary-list.json |   14 -
 .../test/resources/fixtures/entity-summary.json |   13 -
 .../src/test/resources/fixtures/entity.json     |    7 -
 .../src/test/resources/fixtures/ha-summary.json |   19 -
 .../test/resources/fixtures/location-list.json  |   10 -
 .../resources/fixtures/location-summary.json    |    8 -
 .../fixtures/location-without-credential.json   |    5 -
 .../src/test/resources/fixtures/location.json   |    4 -
 .../fixtures/sensor-current-state.json          |    6 -
 .../resources/fixtures/sensor-summary-list.json |   42 -
 .../test/resources/fixtures/sensor-summary.json |    8 -
 .../test/resources/fixtures/server-version.json |   14 -
 .../test/resources/fixtures/service-state.json  |    1 -
 .../resources/fixtures/task-summary-list.json   |   15 -
 brooklyn-server/rest/rest-client/pom.xml        |  149 -
 .../brooklyn/rest/client/BrooklynApi.java       |  395 ---
 .../util/http/BuiltResponsePreservingError.java |   79 -
 .../ApplicationResourceIntegrationTest.java     |  190 --
 .../rest/client/BrooklynApiRestClientTest.java  |  153 -
 .../src/test/resources/catalog/test-catalog.bom |   33 -
 .../rest-client/src/test/webapp/WEB-INF/web.xml |  129 -
 brooklyn-server/rest/rest-server/pom.xml        |  303 --
 .../apache/brooklyn/rest/BrooklynRestApi.java   |   89 -
 .../apache/brooklyn/rest/BrooklynWebConfig.java |  158 -
 .../BrooklynPropertiesSecurityFilter.java       |  175 -
 .../rest/filter/HaHotCheckResourceFilter.java   |  150 -
 .../rest/filter/HaHotStateRequired.java         |   36 -
 .../rest/filter/HaMasterCheckFilter.java        |  139 -
 .../brooklyn/rest/filter/LoggingFilter.java     |  160 -
 .../brooklyn/rest/filter/NoCacheFilter.java     |   40 -
 .../rest/filter/RequestTaggingFilter.java       |   63 -
 .../brooklyn/rest/filter/SwaggerFilter.java     |   76 -
 .../resources/AbstractBrooklynRestResource.java |  151 -
 .../brooklyn/rest/resources/AccessResource.java |   46 -
 .../rest/resources/ActivityResource.java        |   67 -
 .../brooklyn/rest/resources/ApidocResource.java |   31 -
 .../rest/resources/ApplicationResource.java     |  480 ---
 .../rest/resources/CatalogResource.java         |  521 ---
 .../rest/resources/EffectorResource.java        |  114 -
 .../rest/resources/EntityConfigResource.java    |  171 -
 .../brooklyn/rest/resources/EntityResource.java |  223 --
 .../rest/resources/LocationResource.java        |  184 -
 .../rest/resources/PolicyConfigResource.java    |  108 -
 .../brooklyn/rest/resources/PolicyResource.java |  131 -
 .../brooklyn/rest/resources/ScriptResource.java |  102 -
 .../brooklyn/rest/resources/SensorResource.java |  149 -
 .../brooklyn/rest/resources/ServerResource.java |  495 ---
 .../brooklyn/rest/resources/UsageResource.java  |  256 --
 .../rest/resources/VersionResource.java         |   32 -
 .../brooklyn/rest/security/PasswordHasher.java  |   32 -
 .../provider/AbstractSecurityProvider.java      |   56 -
 .../provider/AnyoneSecurityProvider.java        |   40 -
 .../provider/BlackholeSecurityProvider.java     |   40 -
 ...nUserWithRandomPasswordSecurityProvider.java |   73 -
 .../provider/DelegatingSecurityProvider.java    |  166 -
 .../provider/ExplicitUsersSecurityProvider.java |  118 -
 .../security/provider/LdapSecurityProvider.java |  132 -
 .../security/provider/SecurityProvider.java     |   35 -
 .../rest/transform/AccessTransformer.java       |   39 -
 .../rest/transform/ApplicationTransformer.java  |  116 -
 .../transform/BrooklynFeatureTransformer.java   |   45 -
 .../rest/transform/CatalogTransformer.java      |  192 --
 .../rest/transform/EffectorTransformer.java     |   85 -
 .../rest/transform/EntityTransformer.java       |  165 -
 .../transform/HighAvailabilityTransformer.java  |   50 -
 .../rest/transform/LocationTransformer.java     |  193 --
 .../rest/transform/PolicyTransformer.java       |   83 -
 .../rest/transform/SensorTransformer.java       |   84 -
 .../rest/transform/TaskTransformer.java         |  146 -
 .../rest/util/BrooklynRestResourceUtils.java    |  608 ----
 .../rest/util/DefaultExceptionMapper.java       |  104 -
 .../brooklyn/rest/util/EntityLocationUtils.java |   85 -
 .../brooklyn/rest/util/FormMapProvider.java     |   81 -
 .../rest/util/ManagementContextProvider.java    |   33 -
 .../apache/brooklyn/rest/util/OsgiCompat.java   |   46 -
 .../brooklyn/rest/util/ShutdownHandler.java     |   23 -
 .../rest/util/ShutdownHandlerProvider.java      |   30 -
 .../brooklyn/rest/util/URLParamEncoder.java     |   27 -
 .../brooklyn/rest/util/WebResourceUtils.java    |  161 -
 .../rest/util/json/BidiSerialization.java       |  174 -
 .../util/json/BrooklynJacksonJsonProvider.java  |  170 -
 .../json/ConfigurableSerializerProvider.java    |   93 -
 .../ErrorAndToStringUnknownTypeSerializer.java  |  124 -
 .../rest/util/json/MultimapSerializer.java      |   62 -
 ...StrictPreferringFieldsVisibilityChecker.java |  107 -
 .../main/resources/build-metadata.properties    |   18 -
 .../src/main/resources/not-a-jar-file.txt       |   18 -
 .../src/main/resources/reset-catalog.xml        |   37 -
 .../rest-server/src/main/webapp/WEB-INF/web.xml |  137 -
 .../BrooklynPropertiesSecurityFilterTest.java   |  151 -
 .../brooklyn/rest/BrooklynRestApiLauncher.java  |  476 ---
 .../rest/BrooklynRestApiLauncherTest.java       |   77 -
 .../BrooklynRestApiLauncherTestFixture.java     |  110 -
 .../apache/brooklyn/rest/HaHotCheckTest.java    |  129 -
 .../brooklyn/rest/HaMasterCheckFilterTest.java  |  218 --
 .../brooklyn/rest/domain/ApplicationTest.java   |   92 -
 .../rest/domain/LocationSummaryTest.java        |   55 -
 .../brooklyn/rest/domain/SensorSummaryTest.java |  101 -
 .../rest/resources/AccessResourceTest.java      |   68 -
 .../rest/resources/ApidocResourceTest.java      |  177 -
 .../ApplicationResourceIntegrationTest.java     |  133 -
 .../rest/resources/ApplicationResourceTest.java |  694 ----
 .../rest/resources/CatalogResetTest.java        |  113 -
 .../rest/resources/CatalogResourceTest.java     |  512 ---
 .../rest/resources/DelegatingPrintStream.java   |  183 -
 .../rest/resources/DescendantsTest.java         |  132 -
 .../resources/EntityConfigResourceTest.java     |  172 -
 .../rest/resources/EntityResourceTest.java      |  189 --
 .../rest/resources/ErrorResponseTest.java       |   98 -
 .../rest/resources/LocationResourceTest.java    |  189 --
 .../rest/resources/PolicyResourceTest.java      |  145 -
 .../rest/resources/ScriptResourceTest.java      |   54 -
 .../SensorResourceIntegrationTest.java          |   82 -
 .../rest/resources/SensorResourceTest.java      |  271 --
 .../ServerResourceIntegrationTest.java          |  125 -
 .../rest/resources/ServerResourceTest.java      |  168 -
 .../rest/resources/ServerShutdownTest.java      |  185 -
 .../rest/resources/UsageResourceTest.java       |  443 ---
 .../rest/resources/VersionResourceTest.java     |   52 -
 .../rest/security/PasswordHasherTest.java       |   37 -
 .../security/provider/TestSecurityProvider.java |   46 -
 .../test/config/render/TestRendererHints.java   |   36 -
 .../brooklynnode/DeployBlueprintTest.java       |   89 -
 .../rest/testing/BrooklynRestApiTest.java       |  204 --
 .../rest/testing/BrooklynRestResourceTest.java  |  154 -
 .../rest/testing/mocks/CapitalizePolicy.java    |   33 -
 .../rest/testing/mocks/EverythingGroup.java     |   27 -
 .../rest/testing/mocks/EverythingGroupImpl.java |   32 -
 .../rest/testing/mocks/NameMatcherGroup.java    |   30 -
 .../testing/mocks/NameMatcherGroupImpl.java     |   33 -
 .../rest/testing/mocks/RestMockApp.java         |   24 -
 .../rest/testing/mocks/RestMockAppBuilder.java  |   39 -
 .../testing/mocks/RestMockSimpleEntity.java     |  103 -
 .../testing/mocks/RestMockSimplePolicy.java     |   64 -
 .../util/BrooklynRestResourceUtilsTest.java     |  213 --
 .../rest/util/EntityLocationUtilsTest.java      |   72 -
 .../rest/util/HaHotStateCheckClassResource.java |   38 -
 .../rest/util/HaHotStateCheckResource.java      |   44 -
 .../rest/util/NoOpRecordingShutdownHandler.java |   39 -
 .../util/NullHttpServletRequestProvider.java    |   46 -
 .../rest/util/NullServletConfigProvider.java    |   51 -
 .../util/ServerStoppingShutdownHandler.java     |   75 -
 .../json/BrooklynJacksonSerializerTest.java     |  399 ---
 .../src/test/resources/brooklyn-test-logo.jpg   |  Bin 6986 -> 0 bytes
 .../resources/brooklyn/scanning.catalog.bom     |   19 -
 brooklyn-server/server-cli/README.md            |   89 -
 brooklyn-server/server-cli/pom.xml              |  206 --
 .../org/apache/brooklyn/cli/AbstractMain.java   |  283 --
 .../org/apache/brooklyn/cli/CloudExplorer.java  |  380 ---
 .../org/apache/brooklyn/cli/ItemLister.java     |  271 --
 .../main/java/org/apache/brooklyn/cli/Main.java |  993 ------
 .../apache/brooklyn/cli/lister/ClassFinder.java |  152 -
 .../brooklyn/cli/lister/ItemDescriptors.java    |  172 -
 .../server-cli/src/main/license/README.md       |    7 -
 .../src/main/license/files/DISCLAIMER           |    8 -
 .../server-cli/src/main/license/files/LICENSE   |  242 --
 .../server-cli/src/main/license/files/NOTICE    |    5 -
 .../src/main/license/source-inclusions.yaml     |   24 -
 .../main/resources/brooklyn/default.catalog.bom |  365 --
 .../statics/brooklyn-object-list.html           |  147 -
 .../brooklyn/item-lister/statics/common.js      |   94 -
 .../brooklyn/item-lister/statics/items.css      |  153 -
 .../statics/style/js/catalog/typeahead.js       |  727 ----
 .../statics/style/js/underscore-min.js          |    6 -
 .../statics/style/js/underscore-min.map         |    1 -
 .../item-lister/templates/enricher.html         |   59 -
 .../brooklyn/item-lister/templates/entity.html  |   66 -
 .../item-lister/templates/location.html         |   62 -
 .../brooklyn/item-lister/templates/policy.html  |   59 -
 .../java/org/apache/brooklyn/cli/CliTest.java   |  631 ----
 .../brooklyn/cli/CloudExplorerLiveTest.java     |  209 --
 .../src/test/license/files/DISCLAIMER           |    8 -
 .../server-cli/src/test/license/files/LICENSE   |  175 -
 .../server-cli/src/test/license/files/NOTICE    |    5 -
 .../src/test/resources/ExampleAppInFile.groovy  |   22 -
 .../resources/example-app-app-location.yaml     |   23 -
 .../resources/example-app-entity-location.yaml  |   23 -
 .../test/resources/example-app-no-location.yaml |   22 -
 brooklyn-server/software/base/pom.xml           |  213 --
 .../entity/brooklynnode/BrooklynCluster.java    |   70 -
 .../brooklynnode/BrooklynClusterImpl.java       |  115 -
 .../brooklynnode/BrooklynEntityMirror.java      |   67 -
 .../brooklynnode/BrooklynEntityMirrorImpl.java  |  194 --
 .../entity/brooklynnode/BrooklynNode.java       |  312 --
 .../entity/brooklynnode/BrooklynNodeDriver.java |   27 -
 .../entity/brooklynnode/BrooklynNodeImpl.java   |  528 ---
 .../brooklynnode/BrooklynNodeSshDriver.java     |  413 ---
 .../entity/brooklynnode/EntityHttpClient.java   |   93 -
 .../brooklynnode/EntityHttpClientImpl.java      |  162 -
 .../entity/brooklynnode/LocalBrooklynNode.java  |   37 -
 .../brooklynnode/LocalBrooklynNodeImpl.java     |   48 -
 .../brooklynnode/RemoteEffectorBuilder.java     |   84 -
 .../BrooklynClusterUpgradeEffectorBody.java     |  206 --
 .../BrooklynNodeUpgradeEffectorBody.java        |  229 --
 .../effector/SelectMasterEffectorBody.java      |  174 -
 .../SetHighAvailabilityModeEffectorBody.java    |   63 -
 ...SetHighAvailabilityPriorityEffectorBody.java |   54 -
 .../brooklyn/entity/chef/ChefAttributeFeed.java |  410 ---
 .../entity/chef/ChefAttributePollConfig.java    |   53 -
 .../brooklyn/entity/chef/ChefBashCommands.java  |   42 -
 .../apache/brooklyn/entity/chef/ChefConfig.java |   98 -
 .../brooklyn/entity/chef/ChefConfigs.java       |  102 -
 .../apache/brooklyn/entity/chef/ChefEntity.java |   26 -
 .../brooklyn/entity/chef/ChefEntityImpl.java    |   38 -
 .../entity/chef/ChefLifecycleEffectorTasks.java |  361 --
 .../brooklyn/entity/chef/ChefServerTasks.java   |   97 -
 .../brooklyn/entity/chef/ChefSoloDriver.java    |   85 -
 .../brooklyn/entity/chef/ChefSoloTasks.java     |   70 -
 .../apache/brooklyn/entity/chef/ChefTasks.java  |  153 -
 .../entity/chef/KnifeConvergeTaskFactory.java   |  246 --
 .../brooklyn/entity/chef/KnifeTaskFactory.java  |  240 --
 .../brooklyn/entity/java/JavaAppUtils.java      |  263 --
 .../brooklyn/entity/java/JavaEntityMethods.java |   30 -
 .../entity/java/JavaSoftwareProcessDriver.java  |   30 -
 .../java/JavaSoftwareProcessSshDriver.java      |  443 ---
 .../entity/java/JmxAttributeSensor.java         |  121 -
 .../apache/brooklyn/entity/java/JmxSupport.java |  357 --
 .../brooklyn/entity/java/JmxmpSslSupport.java   |  134 -
 .../apache/brooklyn/entity/java/UsesJava.java   |   68 -
 .../brooklyn/entity/java/UsesJavaMXBeans.java   |   77 -
 .../apache/brooklyn/entity/java/UsesJmx.java    |  190 --
 .../brooklyn/entity/java/VanillaJavaApp.java    |   77 -
 .../entity/java/VanillaJavaAppDriver.java       |   26 -
 .../entity/java/VanillaJavaAppImpl.java         |  112 -
 .../entity/java/VanillaJavaAppSshDriver.java    |  211 --
 .../entity/machine/MachineAttributes.java       |   87 -
 .../brooklyn/entity/machine/MachineEntity.java  |   59 -
 .../entity/machine/MachineEntityImpl.java       |  186 --
 .../entity/machine/MachineInitTasks.java        |  228 --
 .../machine/ProvidesProvisioningFlags.java      |   35 -
 .../entity/machine/SetHostnameCustomizer.java   |  233 --
 .../entity/machine/pool/ServerPool.java         |  109 -
 .../entity/machine/pool/ServerPoolImpl.java     |  432 ---
 .../entity/machine/pool/ServerPoolLocation.java |   80 -
 .../pool/ServerPoolLocationResolver.java        |  138 -
 .../entity/resolve/ChefEntitySpecResolver.java  |   42 -
 .../HardcodedCatalogEntitySpecResolver.java     |   96 -
 .../base/AbstractSoftwareProcessDriver.java     |  514 ---
 .../base/AbstractSoftwareProcessSshDriver.java  |  666 ----
 .../AbstractSoftwareProcessWinRmDriver.java     |  315 --
 .../software/base/AbstractVanillaProcess.java   |   35 -
 .../software/base/EmptySoftwareProcess.java     |   32 -
 .../base/EmptySoftwareProcessDriver.java        |   22 -
 .../software/base/EmptySoftwareProcessImpl.java |   49 -
 .../base/EmptySoftwareProcessSshDriver.java     |   83 -
 .../software/base/EmptyWindowsProcess.java      |   38 -
 .../base/EmptyWindowsProcessDriver.java         |   22 -
 .../software/base/EmptyWindowsProcessImpl.java  |   49 -
 .../base/EmptyWindowsProcessWinRmDriver.java    |   97 -
 .../entity/software/base/InboundPortsUtils.java |   98 -
 .../SameServerDriverLifecycleEffectorTasks.java |  155 -
 .../entity/software/base/SameServerEntity.java  |   78 -
 .../software/base/SameServerEntityImpl.java     |  133 -
 .../entity/software/base/SoftwareProcess.java   |  377 ---
 .../software/base/SoftwareProcessDriver.java    |   75 -
 ...wareProcessDriverLifecycleEffectorTasks.java |  262 --
 .../software/base/SoftwareProcessImpl.java      |  645 ----
 .../software/base/VanillaSoftwareProcess.java   |   62 -
 .../base/VanillaSoftwareProcessDriver.java      |   23 -
 .../base/VanillaSoftwareProcessImpl.java        |   37 -
 .../base/VanillaSoftwareProcessSshDriver.java   |  190 --
 .../software/base/VanillaWindowsProcess.java    |  107 -
 .../base/VanillaWindowsProcessDriver.java       |   23 -
 .../base/VanillaWindowsProcessImpl.java         |   47 -
 .../base/VanillaWindowsProcessWinRmDriver.java  |   99 -
 .../MachineLifecycleEffectorTasks.java          |  970 ------
 .../base/lifecycle/NaiveScriptRunner.java       |   43 -
 .../lifecycle/NativeWindowsScriptRunner.java    |   29 -
 .../software/base/lifecycle/ScriptHelper.java   |  436 ---
 .../software/base/lifecycle/ScriptPart.java     |   82 -
 .../base/lifecycle/WinRmExecuteHelper.java      |  217 --
 .../system_service/EntityLaunchListener.java    |  111 -
 .../system_service/InitdServiceInstaller.java   |  135 -
 .../system_service/SystemServiceEnricher.java   |  142 -
 .../system_service/SystemServiceInstaller.java  |   25 -
 .../SystemServiceInstallerFactory.java          |   28 -
 .../feed/jmx/JmxAttributePollConfig.java        |   74 -
 .../org/apache/brooklyn/feed/jmx/JmxFeed.java   |  423 ---
 .../org/apache/brooklyn/feed/jmx/JmxHelper.java |  724 ----
 .../feed/jmx/JmxNotificationFilters.java        |   64 -
 .../jmx/JmxNotificationSubscriptionConfig.java  |   95 -
 .../feed/jmx/JmxOperationPollConfig.java        |  121 -
 .../brooklyn/feed/jmx/JmxValueFunctions.java    |  136 -
 ...pache.brooklyn.api.location.LocationResolver |   19 -
 ...oklyn.core.resolve.entity.EntitySpecResolver |   20 -
 .../entity/brooklynnode/brooklyn-cluster.yaml   |   33 -
 .../brooklyn-node-persisting-to-tmp.yaml        |   27 -
 .../entity/brooklynnode/brooklyn-node.yaml      |   35 -
 .../brooklyn/entity/system_service/service.sh   |   51 -
 .../brooklyn/entity/AbstractEc2LiveTest.java    |  181 -
 .../entity/AbstractGoogleComputeLiveTest.java   |  137 -
 .../entity/AbstractSoftlayerLiveTest.java       |  115 -
 .../BrooklynClusterIntegrationTest.java         |   97 -
 .../BrooklynNodeIntegrationTest.java            |  711 ----
 .../entity/brooklynnode/BrooklynNodeTest.java   |  137 -
 .../brooklynnode/CallbackEntityHttpClient.java  |   99 -
 .../entity/brooklynnode/MockBrooklynNode.java   |   72 -
 .../brooklynnode/SameBrooklynNodeImpl.java      |   97 -
 .../brooklynnode/SelectMasterEffectorTest.java  |  259 --
 .../brooklyn/entity/chef/ChefConfigsTest.java   |   52 -
 .../entity/chef/ChefLiveTestSupport.java        |   99 -
 .../chef/ChefServerTasksIntegrationTest.java    |  126 -
 .../AbstractChefToyMySqlEntityLiveTest.java     |   40 -
 .../ChefSoloDriverMySqlEntityLiveTest.java      |   49 -
 .../mysql/ChefSoloDriverToyMySqlEntity.java     |   89 -
 ...micChefAutodetectToyMySqlEntityLiveTest.java |   43 -
 ...DynamicChefServerToyMySqlEntityLiveTest.java |   50 -
 .../DynamicChefSoloToyMySqlEntityLiveTest.java  |   43 -
 .../chef/mysql/DynamicToyMySqlEntityChef.java   |   81 -
 .../chef/mysql/TypedToyMySqlEntityChef.java     |   55 -
 .../brooklyn/entity/java/EntityPollingTest.java |  206 --
 .../entity/java/ExampleVanillaMain.java         |   26 -
 .../java/ExampleVanillaMainCpuHungry.java       |   41 -
 .../brooklyn/entity/java/JavaOptsTest.java      |  356 --
 ...SoftwareProcessSshDriverIntegrationTest.java |  173 -
 .../brooklyn/entity/java/JmxSupportTest.java    |  135 -
 .../brooklyn/entity/java/SslKeyConfigTest.java  |   53 -
 .../entity/java/VanillaJavaAppRebindTest.java   |  171 -
 .../entity/java/VanillaJavaAppTest.java         |  352 --
 .../machine/MachineEntityEc2LiveTest.java       |   57 -
 .../entity/machine/MachineEntityRebindTest.java |   44 -
 .../machine/SetHostnameCustomizerLiveTest.java  |  143 -
 .../machine/SetHostnameCustomizerTest.java      |  157 -
 .../machine/pool/AbstractServerPoolTest.java    |  145 -
 .../entity/machine/pool/ServerPoolLiveTest.java |   97 -
 .../pool/ServerPoolLocationResolverTest.java    |   90 -
 .../machine/pool/ServerPoolRebindTest.java      |  109 -
 .../entity/machine/pool/ServerPoolTest.java     |  175 -
 .../software/base/AbstractDockerLiveTest.java   |   99 -
 ...ctSoftwareProcessRestartIntegrationTest.java |   96 -
 .../AbstractSoftwareProcessStreamsTest.java     |  105 -
 .../software/base/DoNothingSoftwareProcess.java |   32 -
 .../base/DoNothingSoftwareProcessDriver.java    |   69 -
 .../base/DoNothingSoftwareProcessImpl.java      |   38 -
 .../DoNothingWinRmSoftwareProcessDriver.java    |   68 -
 .../entity/software/base/EntitySshToolTest.java |  107 -
 ...eServerDriverLifecycleEffectorTasksTest.java |  124 -
 .../software/base/SameServerEntityTest.java     |   82 -
 .../software/base/SoftwareEffectorTest.java     |  141 -
 .../base/SoftwareProcessEntityLatchTest.java    |  161 -
 .../base/SoftwareProcessEntityRebindTest.java   |  177 -
 .../base/SoftwareProcessEntityTest.java         |  816 -----
 ...twareProcessOpenIptablesStreamsLiveTest.java |  113 -
 ...SoftwareProcessSshDriverIntegrationTest.java |  389 ---
 .../base/SoftwareProcessSubclassTest.java       |  169 -
 ...ftwareProcessAndChildrenIntegrationTest.java |  194 --
 .../VanillaSoftwareProcessIntegrationTest.java  |  209 --
 ...laSoftwareProcessStreamsIntegrationTest.java |   70 -
 ...laWindowsProcessWinrmExitStatusLiveTest.java |  291 --
 ...nillaWindowsProcessWinrmStreamsLiveTest.java |  133 -
 .../MachineLifecycleEffectorTasksTest.java      |  147 -
 .../software/base/lifecycle/MyEntity.java       |   27 -
 .../software/base/lifecycle/MyEntityApp.java    |   26 -
 .../software/base/lifecycle/MyEntityImpl.java   |  125 -
 .../base/lifecycle/NaiveScriptRunnerTest.java   |  254 --
 .../base/lifecycle/ScriptHelperTest.java        |  157 -
 .../base/lifecycle/ScriptHelperUnitTest.java    |  146 -
 .../base/lifecycle/StartStopSshDriverTest.java  |  168 -
 .../lifecycle/WinRmExecuteHelperUnitTest.java   |   62 -
 .../AutoScalerPolicyNoMoreMachinesTest.java     |  214 --
 .../usage/ApplicationUsageTrackingTest.java     |  180 -
 .../mgmt/usage/LocationUsageTrackingTest.java   |  172 -
 .../core/mgmt/usage/RecordingUsageListener.java |   68 -
 .../test/core/mgmt/usage/UsageListenerTest.java |  107 -
 .../base/test/driver/MockSshDriver.java         |   72 -
 ...rWithAvailabilityZonesMultiLocationTest.java |  115 -
 .../base/test/jmx/GeneralisedDynamicMBean.java  |  146 -
 .../software/base/test/jmx/JmxService.java      |  176 -
 .../location/MachineDetailsEc2LiveTest.java     |   70 -
 .../MachineDetailsGoogleComputeLiveTest.java    |   67 -
 .../location/WinRmMachineLocationLiveTest.java  |  601 ----
 .../base/test/location/WindowsTestFixture.java  |   78 -
 .../test/mysql/AbstractToyMySqlEntityTest.java  |  107 -
 .../mysql/DynamicToyMySqlEntityBuilder.java     |  185 -
 .../test/mysql/DynamicToyMySqlEntityTest.java   |   58 -
 .../PortAttributeSensorAndConfigKeyTest.java    |   86 -
 .../SystemServiceEnricherTest.java              |   95 -
 .../apache/brooklyn/feed/jmx/JmxFeedTest.java   |  420 ---
 .../apache/brooklyn/feed/jmx/JmxHelperTest.java |  312 --
 .../feed/jmx/JmxValueFunctionsTest.java         |  120 -
 .../brooklyn/feed/jmx/RebindJmxFeedTest.java    |  148 -
 .../brooklyn-tests.pem                          |   27 -
 .../brooklyn-validator.pem                      |   27 -
 .../hosted-chef-brooklyn-credentials/knife.rb   |   27 -
 .../brooklyn/entity/software/base/frogs.txt     |   27 -
 .../brooklyn/entity/software/base/template.yaml |   23 -
 .../base/template_with_extra_substitutions.txt  |   18 -
 brooklyn-server/software/winrm/pom.xml          |   65 -
 .../WindowsPerformanceCounterSensors.java       |   73 -
 .../windows/WindowsPerformanceCounterFeed.java  |  414 ---
 .../winrm/AdvertiseWinrmLoginPolicy.java        |   80 -
 .../location/winrm/WinRmMachineLocation.java    |  428 ---
 .../core/internal/winrm/WinRmException.java     |   32 -
 .../util/core/internal/winrm/WinRmTool.java     |   83 -
 .../core/internal/winrm/WinRmToolResponse.java  |   46 -
 .../internal/winrm/winrm4j/Winrm4jTool.java     |  215 --
 .../WindowsPerformanceCounterFeedLiveTest.java  |  101 -
 .../WindowsPerformanceCounterFeedTest.java      |  129 -
 .../winrm/AdvertiseWinrmLoginPolicyTest.java    |   49 -
 .../winrm/ByonLocationResolverTest.java         |   95 -
 .../winrm/WinRmMachineLocationTest.java         |   43 -
 brooklyn-server/storage/hazelcast/pom.xml       |   88 -
 .../storage/impl/hazelcast/EntityId.java        |   36 -
 .../impl/hazelcast/EntityStreamSerializer.java  |   68 -
 .../impl/hazelcast/HazelcastDataGrid.java       |   89 -
 .../hazelcast/HazelcastDataGridFactory.java     |   42 -
 .../impl/hazelcast/HazelcastStorageTest.java    |  107 -
 brooklyn-server/test-framework/pom.xml          |   96 -
 .../brooklyn/test/framework/BaseTest.java       |   49 -
 .../InfrastructureDeploymentTestCase.java       |   57 -
 .../InfrastructureDeploymentTestCaseImpl.java   |   93 -
 .../framework/LoopOverGroupMembersTestCase.java |   45 -
 .../LoopOverGroupMembersTestCaseImpl.java       |  134 -
 .../test/framework/ParallelTestCase.java        |   30 -
 .../test/framework/ParallelTestCaseImpl.java    |  142 -
 .../test/framework/SimpleShellCommandTest.java  |  100 -
 .../framework/SimpleShellCommandTestImpl.java   |  258 --
 .../test/framework/TargetableTestComponent.java |   53 -
 .../framework/TargetableTestComponentImpl.java  |   83 -
 .../brooklyn/test/framework/TestCase.java       |   30 -
 .../brooklyn/test/framework/TestCaseImpl.java   |   89 -
 .../brooklyn/test/framework/TestEffector.java   |   48 -
 .../test/framework/TestEffectorImpl.java        |  116 -
 .../test/framework/TestFrameworkAssertions.java |  265 --
 .../brooklyn/test/framework/TestHttpCall.java   |   54 -
 .../test/framework/TestHttpCallImpl.java        |  123 -
 .../brooklyn/test/framework/TestSensor.java     |   37 -
 .../brooklyn/test/framework/TestSensorImpl.java |  115 -
 .../InfrastructureDeploymentTestCaseTest.java   |  267 --
 .../LoopOverGroupMembersTestCaseTest.java       |  286 --
 .../SimpleShellCommandIntegrationTest.java      |  292 --
 .../test/framework/TestEffectorTest.java        |  191 --
 .../framework/TestFrameworkAssertionsTest.java  |  155 -
 .../test/framework/TestHttpCallTest.java        |  122 -
 .../brooklyn/test/framework/TestSensorTest.java |  309 --
 .../test/framework/entity/TestEntity.java       |   77 -
 .../test/framework/entity/TestEntityImpl.java   |   64 -
 .../framework/entity/TestInfrastructure.java    |   31 -
 .../entity/TestInfrastructureImpl.java          |   46 -
 .../resources/test-framework-examples/README.md |   28 -
 .../example-catalog-test.bom                    |   40 -
 .../test-framework-examples/example-catalog.bom |   33 -
 .../nginx-test-examples.yml                     |  119 -
 .../testhttpcall-examples.yml                   |  151 -
 .../tomcat-test-examples.yml                    |   57 -
 brooklyn-server/test-support/pom.xml            |   63 -
 .../apache/brooklyn/test/EntityTestUtils.java   |  193 --
 .../org/apache/brooklyn/test/HttpTestUtils.java |  396 ---
 .../brooklyn/test/NetworkingTestUtils.java      |   78 -
 .../brooklyn/test/PerformanceTestUtils.java     |   26 -
 .../org/apache/brooklyn/test/TestUtils.java     |   79 -
 .../org/apache/brooklyn/test/WebAppMonitor.java |  213 --
 .../test/performance/FilePersister.java         |   85 -
 .../brooklyn/test/performance/Histogram.java    |   89 -
 .../performance/MeasurementResultPersister.java |   29 -
 .../test/performance/PerformanceMeasurer.java   |  156 -
 .../performance/PerformanceTestDescriptor.java  |  208 --
 .../test/performance/PerformanceTestResult.java |   62 -
 .../test/performance/PerformanceTestUtils.java  |  107 -
 brooklyn-server/utils/common/pom.xml            |  106 -
 .../brooklyn/config/ConfigInheritance.java      |   50 -
 .../org/apache/brooklyn/config/ConfigKey.java   |  111 -
 .../org/apache/brooklyn/config/ConfigMap.java   |   86 -
 .../apache/brooklyn/config/StringConfigMap.java |   35 -
 .../java/org/apache/brooklyn/test/Asserts.java  | 1350 --------
 .../test/http/TestHttpRequestHandler.java       |   72 -
 .../brooklyn/test/http/TestHttpServer.java      |  150 -
 .../apache/brooklyn/util/CommandLineUtil.java   |   53 -
 .../org/apache/brooklyn/util/GenericTypes.java  |   37 -
 .../brooklyn/util/JavaGroovyEquivalents.java    |  181 -
 .../org/apache/brooklyn/util/ShellUtils.java    |  180 -
 .../util/collections/CollectionFunctionals.java |  263 --
 .../brooklyn/util/collections/Jsonya.java       |  581 ----
 .../brooklyn/util/collections/MutableList.java  |  256 --
 .../brooklyn/util/collections/MutableMap.java   |  253 --
 .../brooklyn/util/collections/MutableSet.java   |  212 --
 .../brooklyn/util/collections/QuorumCheck.java  |  236 --
 .../util/collections/SetFromLiveMap.java        |  141 -
 .../util/collections/TimeWindowedList.java      |  147 -
 .../util/collections/TimestampedValue.java      |   59 -
 .../util/concurrent/CallableFromRunnable.java   |   54 -
 .../util/crypto/AuthorizedKeysParser.java       |  134 -
 .../crypto/SecureKeysWithoutBouncyCastle.java   |  161 -
 .../brooklyn/util/crypto/SslTrustUtils.java     |  100 -
 .../util/crypto/TrustingSslSocketFactory.java   |  105 -
 .../exceptions/CompoundRuntimeException.java    |   59 -
 .../brooklyn/util/exceptions/Exceptions.java    |  347 --
 .../FatalConfigurationRuntimeException.java     |   33 -
 .../util/exceptions/FatalRuntimeException.java  |   34 -
 .../util/exceptions/NotManagedException.java    |   36 -
 .../exceptions/PropagatedRuntimeException.java  |   76 -
 .../util/exceptions/ReferenceWithError.java     |  101 -
 .../exceptions/RuntimeInterruptedException.java |   50 -
 .../exceptions/RuntimeTimeoutException.java     |   36 -
 .../util/exceptions/UserFacingException.java    |   39 -
 .../apache/brooklyn/util/git/GithubUrls.java    |   42 -
 .../apache/brooklyn/util/guava/Functionals.java |  151 -
 .../apache/brooklyn/util/guava/IfFunctions.java |  158 -
 .../guava/IllegalStateExceptionSupplier.java    |   55 -
 .../util/guava/KeyTransformingLoadingCache.java |  152 -
 .../org/apache/brooklyn/util/guava/Maybe.java   |  376 ---
 .../brooklyn/util/guava/MaybeFunctions.java     |   98 -
 .../util/guava/PredicateWithContext.java        |   33 -
 .../util/guava/SerializablePredicate.java       |   26 -
 .../apache/brooklyn/util/guava/TypeTokens.java  |   72 -
 .../apache/brooklyn/util/http/HttpAsserts.java  |  341 --
 .../org/apache/brooklyn/util/http/HttpTool.java |  528 ---
 .../brooklyn/util/http/HttpToolResponse.java    |  186 --
 .../util/http/TrustingSslSocketFactory.java     |  134 -
 .../internal/BasicDelegatingSystemProperty.java |   36 -
 .../util/internal/BooleanSystemProperty.java    |   29 -
 .../util/internal/BrooklynSystemProperties.java |   40 -
 .../util/internal/DoubleSystemProperty.java     |   28 -
 .../util/internal/IntegerSystemProperty.java    |   28 -
 .../util/internal/StringSystemProperty.java     |   50 -
 .../brooklyn/util/io/FilePermissions.java       |   93 -
 .../org/apache/brooklyn/util/io/FileUtil.java   |  187 --
 .../util/javalang/AggregateClassLoader.java     |  173 -
 .../util/javalang/AtomicReferences.java         |   48 -
 .../apache/brooklyn/util/javalang/Boxing.java   |  102 -
 .../apache/brooklyn/util/javalang/Enums.java    |  170 -
 .../apache/brooklyn/util/javalang/Equals.java   |   93 -
 .../brooklyn/util/javalang/JavaClassNames.java  |  162 -
 .../util/javalang/LoadedClassLoader.java        |   44 -
 .../util/javalang/MemoryUsageTracker.java       |   72 -
 .../brooklyn/util/javalang/Reflections.java     |  829 -----
 .../brooklyn/util/javalang/Serializers.java     |  121 -
 .../util/javalang/StackTraceSimplifier.java     |  202 --
 .../apache/brooklyn/util/javalang/Threads.java  |   61 -
 .../brooklyn/util/logging/LoggingSetup.java     |   39 -
 .../util/logging/SimpleOneLineLogFormatter.java |  140 -
 .../org/apache/brooklyn/util/math/BitList.java  |  271 --
 .../org/apache/brooklyn/util/math/BitUtils.java |   70 -
 .../brooklyn/util/math/MathFunctions.java       |  307 --
 .../brooklyn/util/math/MathPredicates.java      |  174 -
 .../brooklyn/util/maven/MavenArtifact.java      |  222 --
 .../brooklyn/util/maven/MavenRetriever.java     |  125 -
 .../java/org/apache/brooklyn/util/net/Cidr.java |  242 --
 .../brooklyn/util/net/HasNetworkAddresses.java  |   48 -
 .../util/net/NetworkMultiAddressUtils.java      |   79 -
 .../apache/brooklyn/util/net/Networking.java    |  553 ---
 .../org/apache/brooklyn/util/net/Protocol.java  |   38 -
 .../util/net/ReachableSocketFinder.java         |  154 -
 .../brooklyn/util/net/URLParamEncoder.java      |   61 -
 .../java/org/apache/brooklyn/util/net/Urls.java |  246 --
 .../brooklyn/util/net/UserAndHostAndPort.java   |   84 -
 .../java/org/apache/brooklyn/util/os/Os.java    |  580 ----
 .../apache/brooklyn/util/pool/BasicPool.java    |  202 --
 .../org/apache/brooklyn/util/pool/Lease.java    |   29 -
 .../org/apache/brooklyn/util/pool/Pool.java     |   74 -
 .../apache/brooklyn/util/repeat/Repeater.java   |  392 ---
 .../apache/brooklyn/util/ssh/BashCommands.java  |  731 ----
 .../brooklyn/util/ssh/IptablesCommands.java     |  261 --
 .../util/stream/DelegatingPrintStream.java      |  174 -
 .../util/stream/IllegalOutputStream.java        |   31 -
 .../util/stream/InputStreamSupplier.java        |   49 -
 .../util/stream/KnownSizeInputStream.java       |  113 -
 .../brooklyn/util/stream/ReaderInputStream.java |  202 --
 .../brooklyn/util/stream/StreamGobbler.java     |  137 -
 .../apache/brooklyn/util/stream/Streams.java    |  176 -
 .../util/stream/ThreadLocalPrintStream.java     |  137 -
 .../brooklyn/util/text/ByteSizeStrings.java     |  416 ---
 .../brooklyn/util/text/ComparableVersion.java   |   90 -
 .../brooklyn/util/text/FormattedString.java     |   47 -
 .../apache/brooklyn/util/text/Identifiers.java  |  302 --
 .../brooklyn/util/text/KeyValueParser.java      |  124 -
 .../util/text/NaturalOrderComparator.java       |  179 -
 .../util/text/QuotedStringTokenizer.java        |  196 --
 .../brooklyn/util/text/StringEscapes.java       |  424 ---
 .../brooklyn/util/text/StringFunctions.java     |  415 ---
 .../brooklyn/util/text/StringPredicates.java    |  310 --
 .../brooklyn/util/text/StringShortener.java     |  150 -
 .../org/apache/brooklyn/util/text/Strings.java  |  919 -----
 .../brooklyn/util/text/VersionComparator.java   |  199 --
 .../brooklyn/util/text/WildcardGlobs.java       |  382 ---
 .../brooklyn/util/time/CountdownTimer.java      |  132 -
 .../org/apache/brooklyn/util/time/Duration.java |  319 --
 .../apache/brooklyn/util/time/Durations.java    |   70 -
 .../org/apache/brooklyn/util/time/Time.java     |  971 ------
 .../org/apache/brooklyn/util/yaml/Yamls.java    |  553 ---
 .../org/apache/brooklyn/test/AssertsTest.java   |  169 -
 .../apache/brooklyn/test/FixedLocaleTest.java   |   49 -
 .../apache/brooklyn/util/HttpAssertsTest.java   |  330 --
 .../collections/CollectionFunctionalsTest.java  |   82 -
 .../brooklyn/util/collections/JsonyaTest.java   |  193 --
 .../util/collections/MutableListTest.java       |  124 -
 .../util/collections/MutableMapTest.java        |   60 -
 .../util/collections/MutableSetTest.java        |  123 -
 .../util/collections/QuorumChecksTest.java      |  105 -
 .../util/collections/TimeWindowedListTest.java  |  144 -
 .../util/exceptions/ExceptionsTest.java         |  207 --
 .../brooklyn/util/guava/FunctionalsTest.java    |   58 -
 .../brooklyn/util/guava/IfFunctionsTest.java    |  106 -
 .../guava/KeyTransformingLoadingCacheTest.java  |  133 -
 .../brooklyn/util/guava/MaybeFunctionsTest.java |   47 -
 .../util/internal/CommandLineUtilTest.java      |   64 -
 .../util/internal/JavaClassNamesCallerTest.java |   45 -
 .../apache/brooklyn/util/io/FileUtilTest.java   |  118 -
 .../brooklyn/util/javalang/BoxingTest.java      |   38 -
 .../brooklyn/util/javalang/EnumsTest.java       |   67 -
 .../util/javalang/JavaClassNamesTest.java       |   76 -
 .../util/javalang/MemoryUsageTrackerTest.java   |   89 -
 .../brooklyn/util/javalang/ReflectionsTest.java |  148 -
 .../util/javalang/StackTraceSimplifierTest.java |   82 -
 .../apache/brooklyn/util/math/BitListTest.java  |  123 -
 .../apache/brooklyn/util/math/BitUtilsTest.java |   50 -
 .../brooklyn/util/math/MathFunctionsTest.java   |   56 -
 .../brooklyn/util/math/MathPredicatesTest.java  |   64 -
 .../brooklyn/util/maven/MavenArtifactTest.java  |  297 --
 .../org/apache/brooklyn/util/net/CidrTest.java  |  176 -
 .../brooklyn/util/net/NetworkingUtilsTest.java  |  230 --
 .../util/net/ReachableSocketFinderTest.java     |  165 -
 .../org/apache/brooklyn/util/net/UrlsTest.java  |   84 -
 .../util/net/UserAndHostAndPortTest.java        |   51 -
 .../org/apache/brooklyn/util/os/OsTest.java     |  168 -
 .../brooklyn/util/pool/BasicPoolTest.java       |  199 --
 .../brooklyn/util/repeat/RepeaterTest.java      |  240 --
 .../util/ssh/IptablesCommandsFirewalldTest.java |  104 -
 .../brooklyn/util/ssh/IptablesCommandsTest.java |   88 -
 .../brooklyn/util/stream/StreamGobblerTest.java |   90 -
 .../stream/ThreadLocalStdoutStderrTest.java     |   90 -
 .../brooklyn/util/text/ByteSizeStringsTest.java |  164 -
 .../util/text/ComparableVersionTest.java        |   63 -
 .../brooklyn/util/text/IdentifiersTest.java     |  118 -
 .../brooklyn/util/text/KeyValueParserTest.java  |  149 -
 .../util/text/NaturalOrderComparatorTest.java   |   90 -
 .../util/text/QuotedStringTokenizerTest.java    |  111 -
 .../brooklyn/util/text/StringEscapesTest.java   |  118 -
 .../brooklyn/util/text/StringFunctionsTest.java |   96 -
 .../util/text/StringPredicatesTest.java         |   75 -
 .../brooklyn/util/text/StringShortenerTest.java |   65 -
 .../apache/brooklyn/util/text/StringsTest.java  |  362 --
 .../util/text/VersionComparatorTest.java        |  102 -
 .../brooklyn/util/text/WildcardGlobsTest.java   |  236 --
 .../brooklyn/util/time/CountdownTimerTest.java  |  102 -
 .../apache/brooklyn/util/time/DurationTest.java |  108 -
 .../org/apache/brooklyn/util/time/TimeTest.java |  346 --
 .../apache/brooklyn/util/yaml/YamlsTest.java    |  195 --
 brooklyn-server/utils/groovy/pom.xml            |   70 -
 .../util/groovy/FromCallableClosure.java        |   38 -
 .../util/groovy/FromFunctionClosure.java        |   39 -
 .../util/groovy/FromRunnableClosure.java        |   46 -
 .../brooklyn/util/groovy/GroovyJavaMethods.java |  200 --
 .../brooklyn/util/groovy/PojoTestingFields.java |   28 -
 .../utils/jmx/jmxmp-ssl-agent/pom.xml           |  157 -
 .../brooklyn/util/jmx/jmxmp/JmxmpAgent.java     |  337 --
 .../src/main/license/DISCLAIMER.shaded          |    8 -
 .../src/main/license/LICENSE.shaded             |  925 -----
 .../src/main/license/NOTICE.shaded              |   15 -
 .../util/jmx/jmxmp/JmxmpAgentSslTest.java       |  257 --
 .../brooklyn/util/jmx/jmxmp/JmxmpClient.java    |   89 -
 brooklyn-server/utils/jmx/jmxrmi-agent/pom.xml  |   71 -
 .../brooklyn/util/jmx/jmxrmi/JmxRmiAgent.java   |  190 --
 .../brooklyn/util/jmx/jmxrmi/JmxRmiClient.java  |   47 -
 brooklyn-server/utils/rest-swagger/pom.xml      |  160 -
 .../rest/apidoc/ApiListingResource.java         |  260 --
 .../rest/apidoc/RestApiResourceScanner.java     |   81 -
 brooklyn-server/utils/rt-felix/pom.xml          |   61 -
 .../rt/felix/EmbeddedFelixFramework.java        |  270 --
 .../brooklyn/rt/felix/ManifestHelper.java       |  103 -
 .../rt/felix/EmbeddedFelixFrameworkTest.java    |  101 -
 brooklyn-server/utils/rt-osgi/pom.xml           |   53 -
 .../apache/brooklyn/util/osgi/OsgiUtils.java    |  101 -
 .../brooklyn/util/osgi/VersionedName.java       |   76 -
 .../src/test/dependencies/osgi/README.md        |   33 -
 .../src/test/dependencies/osgi/entities/pom.xml |   84 -
 .../test/osgi/entities/SimpleApplication.java   |   28 -
 .../osgi/entities/SimpleApplicationImpl.java    |   27 -
 .../test/osgi/entities/SimpleEntity.java        |   28 -
 .../test/osgi/entities/SimpleEntityImpl.java    |   26 -
 .../test/osgi/entities/SimpleLocation.java      |   35 -
 .../test/osgi/entities/SimplePolicy.java        |   36 -
 .../apache/brooklyn/test/osgi/entities/icon.gif |  Bin 43 -> 0 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |   82 -
 .../test/osgi/entities/more/MoreEntity.java     |   37 -
 .../test/osgi/entities/more/MoreEntityImpl.java |   43 -
 .../test/osgi/entities/more/MoreLocation.java   |   24 -
 .../test/osgi/entities/more/MorePolicy.java     |   25 -
 .../test/osgi/entities/more/MoreTemplate.java   |   24 -
 .../osgi/more-entities-v2-evil-twin/pom.xml     |   88 -
 .../test/osgi/entities/more/MoreEntity.java     |   37 -
 .../test/osgi/entities/more/MoreEntityImpl.java |   46 -
 .../dependencies/osgi/more-entities-v2/pom.xml  |   88 -
 .../test/osgi/entities/more/MoreEntity.java     |   43 -
 .../test/osgi/entities/more/MoreEntityImpl.java |   46 -
 .../test/osgi/entities/more/MoreLocation.java   |   26 -
 .../test/osgi/entities/more/MorePolicy.java     |   29 -
 .../test/osgi/entities/more/MoreTemplate.java   |   26 -
 .../brooklyn/util/osgi/OsgiTestResources.java   |   74 -
 .../apache/brooklyn/util/osgi/OsgisTest.java    |   39 -
 .../src/test/resources/brooklyn/osgi/README.md  |   25 -
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         |  Bin 2055 -> 0 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |   26 -
 .../osgi/brooklyn-test-osgi-entities.jar        |  Bin 14454 -> 0 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |   26 -
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  |  Bin 14964 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |   26 -
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  |  Bin 15646 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |   26 -
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar |  Bin 13811 -> 0 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |   26 -
 brooklyn-server/utils/test-support/pom.xml      |   55 -
 .../test/support/BrooklynLeakListener.java      |   89 -
 .../test/support/LoggingVerboseReporter.java    |   36 -
 .../support/PlatformTestSelectorListener.java   |   57 -
 .../brooklyn/test/support/StatusListener.java   |  100 -
 .../TestResourceUnavailableException.java       |  141 -
 .../brooklyn/test/support/VerboseReporter.java  |  343 --
 .../brooklyn/logback-appender-file.xml          |   34 -
 .../src/main/resources/logback-test.xml         |   31 -
 camp/README.md                                  |   34 +
 camp/camp-base/notes.txt                        |   83 +
 camp/camp-base/pom.xml                          |   96 +
 .../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     |  195 ++
 .../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   |   57 +
 .../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  |   98 +
 .../brooklyn/camp/spi/pdp/ArtifactContent.java  |   64 +
 .../camp/spi/pdp/ArtifactRequirement.java       |   71 +
 .../spi/pdp/AssemblyTemplateConstructor.java    |  100 +
 .../brooklyn/camp/spi/pdp/DeploymentPlan.java   |  147 +
 .../apache/brooklyn/camp/spi/pdp/Service.java   |   94 +
 .../camp/spi/pdp/ServiceCharacteristic.java     |   71 +
 .../brooklyn/camp/spi/resolve/PdpMatcher.java   |   51 +
 .../brooklyn/camp/spi/resolve/PdpProcessor.java |  186 ++
 .../camp/spi/resolve/PlanInterpreter.java       |  113 +
 .../interpret/PlanInterpretationContext.java    |  152 +
 .../interpret/PlanInterpretationNode.java       |  259 ++
 .../apache/brooklyn/camp/util/yaml/Yamls.java   |   24 +
 .../pdp/DeploymentPlanToyInterpreterTest.java   |  112 +
 .../brooklyn/camp/spi/pdp/PdpYamlTest.java      |   79 +
 .../web/MockAssemblyTemplateInstantiator.java   |   37 +
 .../camp/test/mock/web/MockWebPlatform.java     |  131 +
 .../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/camp-brooklyn/README.md                    |   20 +
 camp/camp-brooklyn/pom.xml                      |  217 ++
 .../camp/brooklyn/BrooklynCampConstants.java    |   49 +
 .../camp/brooklyn/BrooklynCampPlatform.java     |  103 +
 .../BrooklynCampPlatformLauncherAbstract.java   |   73 +
 .../BrooklynCampPlatformLauncherNoServer.java   |   37 +
 .../camp/brooklyn/BrooklynCampReservedKeys.java |   30 +
 .../camp/brooklyn/YamlLauncherAbstract.java     |  131 +
 .../camp/brooklyn/YamlLauncherNoServer.java     |   39 +
 .../api/AssemblyTemplateSpecInstantiator.java   |   43 +
 .../BrooklynAssemblyTemplateInstantiator.java   |  124 +
 .../BrooklynComponentTemplateResolver.java      |  387 +++
 .../BrooklynEntityDecorationResolver.java       |  216 ++
 .../spi/creation/BrooklynEntityMatcher.java     |  180 +
 .../creation/BrooklynYamlLocationResolver.java  |  142 +
 .../creation/BrooklynYamlTypeInstantiator.java  |  209 ++
 .../brooklyn/spi/creation/CampCatalogUtils.java |   40 +
 .../spi/creation/CampInternalUtils.java         |  247 ++
 .../brooklyn/spi/creation/CampResolver.java     |  147 +
 .../spi/creation/CampToSpecTransformer.java     |  110 +
 .../spi/creation/CampTypePlanTransformer.java   |   98 +
 .../spi/creation/EntitySpecConfiguration.java   |   57 +
 .../service/BrooklynServiceTypeResolver.java    |   78 +
 .../service/CampServiceSpecResolver.java        |   47 +
 .../creation/service/ServiceTypeResolver.java   |   77 +
 .../service/ServiceTypeResolverAdaptor.java     |   70 +
 .../service/UrlServiceSpecResolver.java         |   81 +
 .../spi/dsl/BrooklynDslDeferredSupplier.java    |  155 +
 .../spi/dsl/BrooklynDslInterpreter.java         |  193 ++
 .../camp/brooklyn/spi/dsl/DslUtils.java         |   44 +
 .../spi/dsl/methods/BrooklynDslCommon.java      |  438 +++
 .../brooklyn/spi/dsl/methods/DslComponent.java  |  331 ++
 .../camp/brooklyn/spi/dsl/parse/DslParser.java  |  144 +
 .../spi/dsl/parse/FunctionWithArgs.java         |   57 +
 .../brooklyn/spi/dsl/parse/QuotedString.java    |   50 +
 .../lookup/AbstractBrooklynResourceLookup.java  |   36 +
 .../lookup/AbstractTemplateBrooklynLookup.java  |   56 +
 .../spi/lookup/AssemblyBrooklynLookup.java      |   68 +
 .../lookup/AssemblyTemplateBrooklynLookup.java  |   70 +
 .../brooklyn/spi/lookup/BrooklynUrlLookup.java  |   38 +
 .../lookup/PlatformComponentBrooklynLookup.java |   60 +
 ...PlatformComponentTemplateBrooklynLookup.java |   59 +
 .../platform/BrooklynImmutableCampPlatform.java |  108 +
 ...che.brooklyn.core.plan.PlanToSpecTransformer |   19 +
 ...lyn.core.typereg.BrooklynTypePlanTransformer |   19 +
 .../camp/brooklyn/AbstractYamlRebindTest.java   |  207 ++
 .../camp/brooklyn/AbstractYamlTest.java         |  176 +
 .../brooklyn/camp/brooklyn/AppYamlTest.java     |  121 +
 .../camp/brooklyn/ApplicationsYamlTest.java     |  253 ++
 .../BrooklynYamlTypeInstantiatorTest.java       |   74 +
 .../camp/brooklyn/ByonLocationsYamlTest.java    |  281 ++
 .../DependentConfigPollingYamlTest.java         |  117 +
 .../camp/brooklyn/DslAndRebindYamlTest.java     |  515 +++
 .../brooklyn/EmptySoftwareProcessYamlTest.java  |  124 +
 .../brooklyn/EmptyWindowsProcessYamlTest.java   |   51 +
 .../camp/brooklyn/EnrichersYamlTest.java        |  256 ++
 .../camp/brooklyn/EntitiesYamlTest.java         | 1030 ++++++
 .../ExternalConfigBrooklynPropertiesTest.java   |  146 +
 .../camp/brooklyn/ExternalConfigYamlTest.java   |  328 ++
 ...aWebAppWithDslYamlRebindIntegrationTest.java |  123 +
 .../camp/brooklyn/LocationsYamlTest.java        |  285 ++
 .../camp/brooklyn/MapReferenceYamlTest.java     |  128 +
 .../brooklyn/camp/brooklyn/ObjectsYamlTest.java |  283 ++
 .../camp/brooklyn/PoliciesYamlTest.java         |  214 ++
 .../camp/brooklyn/ReferencedYamlTest.java       |  180 +
 .../brooklyn/ReferencingYamlTestEntity.java     |   74 +
 .../brooklyn/ReferencingYamlTestEntityImpl.java |   25 +
 .../brooklyn/ReloadBrooklynPropertiesTest.java  |   87 +
 .../brooklyn/camp/brooklyn/SimpleTestPojo.java  |   43 +
 .../camp/brooklyn/TestEntityWithInitConfig.java |   34 +
 .../brooklyn/TestEntityWithInitConfigImpl.java  |   58 +
 .../camp/brooklyn/TestReferencingEnricher.java  |   34 +
 .../camp/brooklyn/TestReferencingPolicy.java    |   34 +
 .../TestSensorAndEffectorInitializer.java       |   84 +
 .../brooklyn/VanillaBashNetcatYamlTest.java     |  113 +
 .../camp/brooklyn/WindowsYamlLiveTest.java      |  410 +++
 .../brooklyn/camp/brooklyn/WrapAppTest.java     |   92 +
 .../catalog/AbstractCatalogXmlTest.java         |  108 +
 .../CatalogOsgiVersionMoreEntityTest.java       |  265 ++
 .../brooklyn/catalog/CatalogXmlOsgiTest.java    |   37 +
 .../brooklyn/catalog/CatalogXmlVersionTest.java |   57 +
 .../brooklyn/catalog/CatalogYamlAppTest.java    |  109 +
 .../brooklyn/catalog/CatalogYamlCombiTest.java  |  148 +
 .../brooklyn/catalog/CatalogYamlEntityTest.java |  891 +++++
 .../catalog/CatalogYamlLocationTest.java        |  253 ++
 .../brooklyn/catalog/CatalogYamlPolicyTest.java |  195 ++
 .../brooklyn/catalog/CatalogYamlRebindTest.java |  343 ++
 .../catalog/CatalogYamlTemplateTest.java        |  282 ++
 .../catalog/CatalogYamlVersioningTest.java      |  269 ++
 .../catalog/SpecParameterParsingTest.java       |  156 +
 .../catalog/SpecParameterUnwrappingTest.java    |  379 +++
 .../camp/brooklyn/catalog/TestBasicApp.java     |   27 +
 .../camp/brooklyn/catalog/TestBasicAppImpl.java |   24 +
 .../CreatePasswordSensorIntegrationTest.java    |   67 +
 .../service/ServiceTypeResolverTest.java        |   39 +
 .../service/TestServiceTypeResolver.java        |   54 +
 .../camp/brooklyn/spi/dsl/DslParseTest.java     |   78 +
 .../lite/CampPlatformWithJustBrooklynMgmt.java  |   41 +
 .../brooklyn/test/lite/CampYamlLiteTest.java    |  261 ++
 .../brooklyn/test/lite/TestAppAssembly.java     |   36 +
 .../test/lite/TestAppAssemblyInstantiator.java  |   96 +
 .../EmptySoftwareProcessWithPassword.yaml       |   36 +
 ...lyn.spi.creation.service.ServiceTypeResolver |   19 +
 .../test/resources/example-with-function.yaml   |   34 +
 .../java-web-app-and-db-with-function-2.yaml    |   41 +
 .../java-web-app-and-db-with-function.yaml      |   36 +
 .../src/test/resources/mysql-chef.yaml          |   49 +
 .../more-entities-osgi-catalog-scan.yaml        |   32 +
 .../more-entity-v1-called-v1-osgi-catalog.yaml  |   27 +
 .../catalog/more-entity-v1-osgi-catalog.yaml    |   27 +
 ...more-entity-v1-with-policy-osgi-catalog.yaml |   29 +
 .../catalog/more-entity-v2-osgi-catalog.yaml    |   28 +
 .../more-policies-osgi-catalog-scan.yaml        |   32 +
 .../catalog/simple-policy-osgi-catalog.yaml     |   27 +
 .../apache/brooklyn/camp/brooklyn/echoArg.bat   |   19 +
 .../camp/brooklyn/echoFreemarkerMyarg.bat       |   18 +
 .../camp/brooklyn/echoFreemarkerMyarg.ps1       |   18 +
 .../apache/brooklyn/camp/brooklyn/echoMyArg.ps1 |   22 +
 .../org/apache/brooklyn/camp/brooklyn/exit0.bat |   18 +
 .../org/apache/brooklyn/camp/brooklyn/exit0.ps1 |   18 +
 .../org/apache/brooklyn/camp/brooklyn/exit1.bat |   18 +
 .../org/apache/brooklyn/camp/brooklyn/exit1.ps1 |   19 +
 .../test/lite/test-app-service-blueprint.yaml   |   38 +
 .../src/test/resources/osgi-catalog.xml         |   29 +
 .../src/test/resources/postgresql-chef.yaml     |   38 +
 .../test/resources/same-server-entity-test.yaml |   28 +
 .../src/test/resources/simple-catalog.xml       |   47 +
 .../test/resources/test-app-with-enricher.yaml  |   37 +
 .../test/resources/test-app-with-policy.yaml    |   34 +
 .../test-cluster-with-member-spec.yaml          |   32 +
 .../resources/test-entity-basic-template.yaml   |   24 +
 .../test-entity-reference-map-template.yaml     |   28 +
 .../resources/test-entity-with-enricher.yaml    |   36 +
 .../resources/test-entity-with-init-config.yaml |   31 +
 .../test/resources/test-entity-with-policy.yaml |   36 +
 ...-java-web-app-spec-and-db-with-function.yaml |   39 +
 .../resources/test-propagating-enricher.yaml    |   32 +
 .../resources/test-referencing-enrichers.yaml   |  133 +
 .../resources/test-referencing-entities.yaml    |  136 +
 .../resources/test-referencing-policies.yaml    |  133 +
 .../src/test/resources/test-tomcat-https.yaml   |   28 +
 .../resources/vanilla-bash-netcat-w-client.yaml |   96 +
 .../test/resources/visitors-creation-script.sql |   41 +
 .../src/test/resources/yaml-ref-app.yaml        |   21 +
 .../yaml-ref-bundle-without-libraries.yaml      |   19 +
 .../src/test/resources/yaml-ref-catalog.yaml    |   21 +
 .../src/test/resources/yaml-ref-entity.yaml     |   21 +
 camp/camp-server/pom.xml                        |  167 +
 .../brooklyn/camp/server/dto/ApiErrorDto.java   |  119 +
 .../server/dto/ApplicationComponentDto.java     |   68 +
 .../dto/ApplicationComponentTemplateDto.java    |   40 +
 .../brooklyn/camp/server/dto/AssemblyDto.java   |   73 +
 .../camp/server/dto/AssemblyTemplateDto.java    |   68 +
 .../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   |   78 +
 .../dto/PlatformComponentTemplateDto.java       |   40 +
 .../brooklyn/camp/server/dto/PlatformDto.java   |  127 +
 .../brooklyn/camp/server/dto/ResourceDto.java   |  111 +
 .../camp/server/rest/CampRestResources.java     |   69 +
 .../brooklyn/camp/server/rest/CampServer.java   |  192 ++
 .../rest/resource/AbstractCampRestResource.java |   56 +
 .../rest/resource/ApidocRestResource.java       |   31 +
 .../ApplicationComponentRestResource.java       |   49 +
 ...pplicationComponentTemplateRestResource.java |   49 +
 .../rest/resource/AssemblyRestResource.java     |   51 +
 .../resource/AssemblyTemplateRestResource.java  |   86 +
 .../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       |  175 +
 .../camp/server/rest/util/WebResourceUtils.java |   59 +
 .../ApplicationCompomentTemplateDtoTest.java    |   49 +
 .../brooklyn/camp/server/dto/BasicDtoTest.java  |   90 +
 .../brooklyn/camp/server/dto/LinkDtoTest.java   |   62 +
 .../dto/PlatformCompomentTemplateDtoTest.java   |   49 +
 .../camp/server/dto/ResourceDtoTest.java        |   77 +
 .../rest/resource/PlatformRestResourceTest.java |   43 +
 .../test/fixture/AbstractRestResourceTest.java  |   84 +
 .../camp/server/test/fixture/InMemoryCamp.java  |   52 +
 camp/pom.xml                                    |   45 +
 core/pom.xml                                    |  321 ++
 .../core/BrooklynFeatureEnablement.java         |  209 ++
 .../apache/brooklyn/core/BrooklynLogging.java   |   73 +
 .../apache/brooklyn/core/BrooklynVersion.java   |  450 +++
 .../brooklyn/core/annotation/Effector.java      |   33 +
 .../brooklyn/core/annotation/EffectorParam.java |   42 +
 .../brooklyn/core/catalog/CatalogLoadMode.java  |   73 +
 .../core/catalog/CatalogPredicates.java         |  319 ++
 .../catalog/internal/BasicBrooklynCatalog.java  | 1073 ++++++
 .../internal/CatalogBundleConverter.java        |   63 +
 .../core/catalog/internal/CatalogBundleDto.java |   96 +
 .../catalog/internal/CatalogClasspathDo.java    |  357 ++
 .../catalog/internal/CatalogClasspathDto.java   |   43 +
 .../core/catalog/internal/CatalogDo.java        |  364 ++
 .../core/catalog/internal/CatalogDto.java       |  229 ++
 .../core/catalog/internal/CatalogDtoUtils.java  |   66 +
 .../catalog/internal/CatalogEntityItemDto.java  |   43 +
 .../catalog/internal/CatalogInitialization.java |  453 +++
 .../catalog/internal/CatalogItemBuilder.java    |  150 +
 .../catalog/internal/CatalogItemComparator.java |   52 +
 .../core/catalog/internal/CatalogItemDo.java    |  226 ++
 .../internal/CatalogItemDtoAbstract.java        |  439 +++
 .../catalog/internal/CatalogLibrariesDo.java    |   42 +
 .../catalog/internal/CatalogLibrariesDto.java   |   53 +
 .../internal/CatalogLocationItemDto.java        |   43 +
 .../catalog/internal/CatalogPolicyItemDto.java  |   43 +
 .../internal/CatalogTemplateItemDto.java        |   42 +
 .../core/catalog/internal/CatalogUtils.java     |  321 ++
 .../catalog/internal/CatalogXmlSerializer.java  |   77 +
 .../internal/JavaCatalogToSpecTransformer.java  |  111 +
 .../brooklyn/core/config/BasicConfigKey.java    |  327 ++
 .../brooklyn/core/config/ConfigConstraints.java |  195 ++
 .../apache/brooklyn/core/config/ConfigKeys.java |  273 ++
 .../brooklyn/core/config/ConfigPredicates.java  |  157 +
 .../brooklyn/core/config/ConfigUtils.java       |  129 +
 .../config/ConstraintViolationException.java    |   38 +
 .../brooklyn/core/config/ListConfigKey.java     |  128 +
 .../brooklyn/core/config/MapConfigKey.java      |  206 ++
 .../apache/brooklyn/core/config/Sanitizer.java  |  172 +
 .../brooklyn/core/config/SetConfigKey.java      |  119 +
 .../core/config/StructuredConfigKey.java        |   60 +
 .../core/config/SubElementConfigKey.java        |   77 +
 .../brooklyn/core/config/WrappedConfigKey.java  |   44 +
 .../AbstractExternalConfigSupplier.java         |   45 +
 .../config/external/ExternalConfigSupplier.java |   34 +
 .../external/InPlaceExternalConfigSupplier.java |   51 +
 .../PropertiesFileExternalConfigSupplier.java   |   68 +
 .../vault/VaultAppIdExternalConfigSupplier.java |   90 +
 .../vault/VaultExternalConfigSupplier.java      |  133 +
 .../vault/VaultTokenExternalConfigSupplier.java |   39 +
 .../VaultUserPassExternalConfigSupplier.java    |   56 +
 .../internal/AbstractCollectionConfigKey.java   |  120 +
 .../config/internal/AbstractConfigMapImpl.java  |  110 +
 .../internal/AbstractStructuredConfigKey.java   |  139 +
 .../core/config/render/RendererHints.java       |  284 ++
 .../core/effector/AbstractEffector.java         |   90 +
 .../core/effector/AddChildrenEffector.java      |  117 +
 .../brooklyn/core/effector/AddEffector.java     |  116 +
 .../brooklyn/core/effector/AddSensor.java       |  126 +
 .../core/effector/BasicParameterType.java       |  116 +
 .../brooklyn/core/effector/EffectorAndBody.java |   60 +
 .../brooklyn/core/effector/EffectorBase.java    |  106 +
 .../brooklyn/core/effector/EffectorBody.java    |  100 +
 .../brooklyn/core/effector/EffectorTasks.java   |  234 ++
 .../core/effector/EffectorWithBody.java         |   32 +
 .../brooklyn/core/effector/Effectors.java       |  214 ++
 .../core/effector/ExplicitEffector.java         |   74 +
 .../brooklyn/core/effector/MethodEffector.java  |  180 +
 .../core/effector/ssh/SshCommandEffector.java   |  102 +
 .../core/effector/ssh/SshEffectorTasks.java     |  342 ++
 .../core/enricher/AbstractEnricher.java         |  121 +
 .../core/enricher/EnricherDynamicType.java      |   43 +
 .../core/enricher/EnricherTypeSnapshot.java     |   39 +
 .../core/entity/AbstractApplication.java        |  267 ++
 .../brooklyn/core/entity/AbstractEntity.java    | 2144 ++++++++++++
 .../apache/brooklyn/core/entity/Attributes.java |  169 +
 .../core/entity/BrooklynConfigKeys.java         |  216 ++
 .../apache/brooklyn/core/entity/Entities.java   | 1201 +++++++
 .../brooklyn/core/entity/EntityAdjuncts.java    |   70 +
 .../core/entity/EntityAndAttribute.java         |  107 +
 .../brooklyn/core/entity/EntityAsserts.java     |  226 ++
 .../brooklyn/core/entity/EntityDynamicType.java |  376 +++
 .../brooklyn/core/entity/EntityFunctions.java   |  307 ++
 .../core/entity/EntityInitializers.java         |   49 +
 .../brooklyn/core/entity/EntityInternal.java    |  274 ++
 .../brooklyn/core/entity/EntityPredicates.java  |  451 +++
 .../brooklyn/core/entity/EntityRelations.java   |  179 +
 .../brooklyn/core/entity/EntitySuppliers.java   |   47 +
 .../brooklyn/core/entity/EntityTasks.java       |   81 +
 .../core/entity/EntityTypeSnapshot.java         |  126 +
 .../brooklyn/core/entity/EntityTypes.java       |   28 +
 .../core/entity/StartableApplication.java       |   25 +
 .../drivers/BasicEntityDriverManager.java       |   56 +
 .../drivers/ReflectiveEntityDriverFactory.java  |  281 ++
 .../drivers/RegistryEntityDriverFactory.java    |  127 +
 .../downloads/BasicDownloadRequirement.java     |   85 +
 .../downloads/BasicDownloadResolver.java        |   66 +
 .../drivers/downloads/BasicDownloadTargets.java |  121 +
 .../downloads/BasicDownloadsManager.java        |  161 +
 .../DownloadProducerFromCloudsoftRepo.java      |   83 +
 .../DownloadProducerFromLocalRepo.java          |   84 +
 .../DownloadProducerFromProperties.java         |  344 ++
 .../DownloadProducerFromUrlAttribute.java       |   63 +
 .../drivers/downloads/DownloadSubstituters.java |  172 +
 .../drivers/downloads/FilenameProducers.java    |   64 +
 .../AbstractConfigurableEntityFactory.java      |   82 +
 .../core/entity/factory/ApplicationBuilder.java |  249 ++
 .../factory/BasicConfigurableEntityFactory.java |   76 +
 .../entity/factory/ClosureEntityFactory.java    |   53 +
 .../factory/ConfigurableEntityFactory.java      |   33 +
 ...figurableEntityFactoryFromEntityFactory.java |   45 +
 .../core/entity/factory/EntityFactory.java      |   32 +
 .../factory/EntityFactoryForLocation.java       |   30 +
 .../internal/ConfigMapViewWithStringKeys.java   |  130 +
 .../core/entity/internal/EntityConfigMap.java   |  319 ++
 .../internal/EntityTransientCopyInternal.java   |  121 +
 .../core/entity/lifecycle/Lifecycle.java        |  187 ++
 .../core/entity/lifecycle/PolicyDescriptor.java |   68 +
 .../entity/lifecycle/ServiceStateLogic.java     |  639 ++++
 .../brooklyn/core/entity/trait/Changeable.java  |   35 +
 .../core/entity/trait/MemberReplaceable.java    |   45 +
 .../brooklyn/core/entity/trait/Resizable.java   |   68 +
 .../brooklyn/core/entity/trait/Startable.java   |  123 +
 .../core/entity/trait/StartableMethods.java     |  125 +
 .../apache/brooklyn/core/feed/AbstractFeed.java |  246 ++
 .../core/feed/AttributePollHandler.java         |  248 ++
 .../brooklyn/core/feed/ConfigToAttributes.java  |   59 +
 .../core/feed/DelegatingPollHandler.java        |   96 +
 .../apache/brooklyn/core/feed/FeedConfig.java   |  307 ++
 .../apache/brooklyn/core/feed/PollConfig.java   |   85 +
 .../apache/brooklyn/core/feed/PollHandler.java  |   38 +
 .../org/apache/brooklyn/core/feed/Poller.java   |  210 ++
 .../core/internal/ApiObjectsFactoryImpl.java    |   41 +
 .../core/internal/BrooklynInitialization.java   |   81 +
 .../core/internal/BrooklynProperties.java       |  305 ++
 .../core/internal/BrooklynPropertiesImpl.java   |  477 +++
 .../core/internal/storage/BrooklynStorage.java  |  114 +
 .../core/internal/storage/DataGrid.java         |   52 +
 .../core/internal/storage/DataGridFactory.java  |   38 +
 .../core/internal/storage/Reference.java        |   50 +
 .../internal/storage/impl/BackedReference.java  |   73 +
 .../internal/storage/impl/BasicReference.java   |   67 +
 .../storage/impl/BrooklynStorageImpl.java       |  139 +
 .../impl/ConcurrentMapAcceptingNullVals.java    |  272 ++
 .../impl/inmemory/InMemoryDataGridFactory.java  |   40 +
 .../storage/impl/inmemory/InmemoryDatagrid.java |   93 +
 .../core/location/AbstractLocation.java         |  794 +++++
 .../core/location/AbstractLocationResolver.java |  188 ++
 .../AggregatingMachineProvisioningLocation.java |  139 +
 .../core/location/BasicHardwareDetails.java     |   56 +
 .../core/location/BasicLocationDefinition.java  |   85 +
 .../core/location/BasicLocationRegistry.java    |  513 +++
 .../core/location/BasicMachineDetails.java      |  183 +
 .../core/location/BasicMachineMetadata.java     |   84 +
 .../brooklyn/core/location/BasicOsDetails.java  |  123 +
 .../core/location/CatalogLocationResolver.java  |   83 +
 .../location/DefinedLocationByIdResolver.java   |   74 +
 .../location/DeprecatedKeysMappingBuilder.java  |   66 +
 .../core/location/HasSubnetHostname.java        |   32 +
 .../core/location/LocationConfigKeys.java       |   79 +
 .../core/location/LocationConfigUtils.java      |  559 ++++
 .../core/location/LocationPredicates.java       |  270 ++
 ...ocationPropertiesFromBrooklynProperties.java |  223 ++
 .../brooklyn/core/location/Locations.java       |  160 +
 .../apache/brooklyn/core/location/Machines.java |  194 ++
 .../core/location/NamedLocationResolver.java    |   97 +
 .../brooklyn/core/location/PortRanges.java      |  273 ++
 .../core/location/SupportsPortForwarding.java   |   39 +
 .../location/access/BrooklynAccessUtils.java    |  153 +
 .../location/access/PortForwardManager.java     |  328 ++
 .../access/PortForwardManagerAuthority.java     |   46 +
 .../access/PortForwardManagerClient.java        |  413 +++
 .../location/access/PortForwardManagerImpl.java |  505 +++
 .../PortForwardManagerLocationResolver.java     |   89 +
 .../core/location/access/PortMapping.java       |  101 +
 .../AbstractAvailabilityZoneExtension.java      |   82 +
 ...bstractCloudMachineProvisioningLocation.java |   97 +
 .../cloud/AvailabilityZoneExtension.java        |   54 +
 .../location/cloud/CloudLocationConfig.java     |  121 +
 .../cloud/names/AbstractCloudMachineNamer.java  |  150 +
 .../cloud/names/BasicCloudMachineNamer.java     |   96 +
 .../location/cloud/names/CloudMachineNamer.java |   61 +
 .../cloud/names/CustomMachineNamer.java         |   72 +
 .../core/location/dynamic/DynamicLocation.java  |   50 +
 .../core/location/dynamic/LocationOwner.java    |   85 +
 .../location/geo/GeoBytesHostGeoLookup.java     |  104 +
 .../core/location/geo/HasHostGeoInfo.java       |   25 +
 .../brooklyn/core/location/geo/HostGeoInfo.java |  216 ++
 .../core/location/geo/HostGeoLookup.java        |   27 +
 .../location/geo/LocalhostExternalIpLoader.java |  208 ++
 .../location/geo/MaxMind2HostGeoLookup.java     |  114 +
 .../core/location/geo/UtraceHostGeoLookup.java  |  209 ++
 .../location/internal/LocationDynamicType.java  |   40 +
 .../location/internal/LocationInternal.java     |   96 +
 .../location/internal/LocationTypeSnapshot.java |   40 +
 .../apache/brooklyn/core/mgmt/BrooklynTags.java |  138 +
 .../brooklyn/core/mgmt/BrooklynTaskTags.java    |  455 +++
 .../brooklyn/core/mgmt/BrooklynTasks.java       |   25 +
 .../core/mgmt/EntityManagementUtils.java        |  332 ++
 .../core/mgmt/HasBrooklynManagementContext.java |   31 +
 .../core/mgmt/ManagementContextInjectable.java  |   33 +
 .../AbstractBrooklynClassLoadingContext.java    |   83 +
 .../BrooklynClassLoadingContext.java            |   28 +
 .../BrooklynClassLoadingContextSequential.java  |  135 +
 ...ssLoaderFromBrooklynClassLoadingContext.java |   66 +
 .../JavaBrooklynClassLoadingContext.java        |  133 +
 .../OsgiBrooklynClassLoadingContext.java        |  144 +
 .../BasicEntitlementClassDefinition.java        |   56 +
 .../entitlement/EntitlementManagerAdapter.java  |  133 +
 .../mgmt/entitlement/EntitlementPredicates.java |   61 +
 .../core/mgmt/entitlement/Entitlements.java     |  418 +++
 .../mgmt/entitlement/NotEntitledException.java  |   44 +
 .../entitlement/PerUserEntitlementManager.java  |   99 +
 .../PerUserEntitlementManagerWithDefault.java   |   31 +
 .../mgmt/entitlement/WebEntitlementContext.java |   56 +
 .../core/mgmt/ha/BasicMasterChooser.java        |  203 ++
 .../mgmt/ha/HighAvailabilityManagerImpl.java    | 1113 +++++++
 .../ha/ManagementPlaneSyncRecordDeltaImpl.java  |  122 +
 ...ntPlaneSyncRecordPersisterToObjectStore.java |  364 ++
 .../brooklyn/core/mgmt/ha/MasterChooser.java    |   39 +
 .../brooklyn/core/mgmt/ha/OsgiManager.java      |  300 ++
 .../ha/dto/BasicManagementNodeSyncRecord.java   |  194 ++
 .../ha/dto/ManagementPlaneSyncRecordImpl.java   |   99 +
 .../internal/AbstractManagementContext.java     |  522 +++
 .../internal/AbstractSubscriptionManager.java   |  141 +
 .../core/mgmt/internal/AccessManager.java       |   41 +
 .../internal/AsyncCollectionChangeAdapter.java  |   82 +
 .../BasicExternalConfigSupplierRegistry.java    |  125 +
 .../mgmt/internal/BasicSubscriptionContext.java |  181 +
 .../mgmt/internal/BrooklynGarbageCollector.java |  625 ++++
 .../internal/BrooklynObjectManagementMode.java  |   31 +
 .../internal/BrooklynObjectManagerInternal.java |   36 +
 .../mgmt/internal/BrooklynShutdownHooks.java    |  244 ++
 .../core/mgmt/internal/CampYamlParser.java      |   34 +
 .../mgmt/internal/CollectionChangeListener.java |   24 +
 .../internal/DeferredBrooklynProperties.java    |  370 ++
 .../core/mgmt/internal/EffectorUtils.java       |  363 ++
 .../mgmt/internal/EntityChangeListener.java     |   78 +
 .../mgmt/internal/EntityManagementSupport.java  |  480 +++
 .../mgmt/internal/EntityManagerInternal.java    |   32 +
 .../ExternalConfigSupplierRegistry.java         |   45 +
 ...PropertyChangeToCollectionChangeAdapter.java |   65 +
 .../core/mgmt/internal/LocalAccessManager.java  |  111 +
 .../core/mgmt/internal/LocalEntityManager.java  |  820 +++++
 .../mgmt/internal/LocalLocationManager.java     |  460 +++
 .../mgmt/internal/LocalManagementContext.java   |  433 +++
 .../mgmt/internal/LocalSubscriptionManager.java |  330 ++
 .../core/mgmt/internal/LocalUsageManager.java   |  411 +++
 .../mgmt/internal/LocationManagerInternal.java  |   28 +
 .../internal/ManagementContextInternal.java     |  125 +
 .../mgmt/internal/ManagementTransitionInfo.java |   48 +
 .../mgmt/internal/ManagementTransitionMode.java |  127 +
 .../internal/NonDeploymentAccessManager.java    |   98 +
 .../internal/NonDeploymentEntityManager.java    |  196 ++
 .../internal/NonDeploymentLocationManager.java  |  146 +
 .../NonDeploymentManagementContext.java         |  662 ++++
 .../internal/NonDeploymentUsageManager.java     |  121 +
 .../internal/QueueingSubscriptionManager.java   |  148 +
 .../core/mgmt/internal/Subscription.java        |   65 +
 .../core/mgmt/internal/SubscriptionTracker.java |  159 +
 .../BrooklynMementoPersisterToObjectStore.java  |  695 ++++
 .../mgmt/persist/BrooklynPersistenceUtils.java  |  269 ++
 .../persist/CatalogItemLibrariesConverter.java  |   68 +
 .../DeserializingClassRenamesProvider.java      |   84 +
 .../core/mgmt/persist/FileBasedObjectStore.java |  404 +++
 .../persist/FileBasedStoreObjectAccessor.java   |  130 +
 .../mgmt/persist/LocationWithObjectStore.java   |   27 +
 .../core/mgmt/persist/MementoSerializer.java    |   52 +
 .../brooklyn/core/mgmt/persist/PersistMode.java |   26 +
 .../persist/PersistenceActivityMetrics.java     |   83 +
 .../mgmt/persist/PersistenceObjectStore.java    |  142 +
 .../mgmt/persist/RetryingMementoSerializer.java |   95 +
 .../persist/StoreObjectAccessorLocking.java     |  218 ++
 .../core/mgmt/persist/XmlMementoSerializer.java |  541 +++
 .../AbstractBrooklynObjectRebindSupport.java    |  128 +
 .../rebind/ActivePartialRebindIteration.java    |  164 +
 .../rebind/BasicCatalogItemRebindSupport.java   |   69 +
 .../mgmt/rebind/BasicEnricherRebindSupport.java |   50 +
 .../mgmt/rebind/BasicEntityRebindSupport.java   |  236 ++
 .../mgmt/rebind/BasicFeedRebindSupport.java     |   49 +
 .../mgmt/rebind/BasicLocationRebindSupport.java |  137 +
 .../mgmt/rebind/BasicPolicyRebindSupport.java   |   51 +
 .../rebind/ImmediateDeltaChangeListener.java    |  154 +
 .../mgmt/rebind/InitialFullRebindIteration.java |  133 +
 .../rebind/PeriodicDeltaChangeListener.java     |  509 +++
 .../rebind/PersistenceExceptionHandlerImpl.java |  108 +
 .../core/mgmt/rebind/PersisterDeltaImpl.java    |  174 +
 .../core/mgmt/rebind/RebindContextImpl.java     |  190 ++
 .../mgmt/rebind/RebindContextLookupContext.java |  176 +
 .../mgmt/rebind/RebindExceptionHandlerImpl.java |  513 +++
 .../core/mgmt/rebind/RebindIteration.java       | 1164 +++++++
 .../core/mgmt/rebind/RebindManagerImpl.java     |  672 ++++
 .../brooklyn/core/mgmt/rebind/TreeUtils.java    |   56 +
 .../core/mgmt/rebind/dto/AbstractMemento.java   |  230 ++
 .../rebind/dto/AbstractTreeNodeMemento.java     |  113 +
 .../rebind/dto/BasicCatalogItemMemento.java     |  293 ++
 .../mgmt/rebind/dto/BasicEnricherMemento.java   |   92 +
 .../mgmt/rebind/dto/BasicEntityMemento.java     |  324 ++
 .../core/mgmt/rebind/dto/BasicFeedMemento.java  |   92 +
 .../mgmt/rebind/dto/BasicLocationMemento.java   |  106 +
 .../mgmt/rebind/dto/BasicPolicyMemento.java     |   92 +
 .../mgmt/rebind/dto/BrooklynMementoImpl.java    |  256 ++
 .../rebind/dto/BrooklynMementoManifestImpl.java |  172 +
 .../rebind/dto/EntityMementoManifestImpl.java   |   56 +
 .../core/mgmt/rebind/dto/MementoValidators.java |   67 +
 .../mgmt/rebind/dto/MementosGenerators.java     |  492 +++
 .../mgmt/rebind/dto/MutableBrooklynMemento.java |  293 ++
 .../transformer/BrooklynMementoTransformer.java |   32 +
 .../rebind/transformer/CompoundTransformer.java |  291 ++
 .../transformer/CompoundTransformerLoader.java  |  108 +
 .../rebind/transformer/RawDataTransformer.java  |   30 +
 .../DeleteOrphanedLocationsTransformer.java     |  125 +
 .../transformer/impl/XsltTransformer.java       |   59 +
 .../core/mgmt/usage/ApplicationUsage.java       |  126 +
 .../brooklyn/core/mgmt/usage/LocationUsage.java |  135 +
 .../brooklyn/core/mgmt/usage/UsageListener.java |  103 +
 .../brooklyn/core/mgmt/usage/UsageManager.java  |   98 +
 .../core/objs/AbstractBrooklynObject.java       |  265 ++
 .../AbstractConfigurationSupportInternal.java   |   89 +
 .../core/objs/AbstractEntityAdjunct.java        |  590 ++++
 .../brooklyn/core/objs/AdjunctConfigMap.java    |  139 +
 .../apache/brooklyn/core/objs/AdjunctType.java  |  173 +
 .../core/objs/BasicConfigurableObject.java      |  119 +
 .../core/objs/BasicEntityTypeRegistry.java      |  156 +
 .../brooklyn/core/objs/BasicSpecParameter.java  |  358 ++
 .../brooklyn/core/objs/BrooklynDynamicType.java |  283 ++
 .../core/objs/BrooklynObjectInternal.java       |  144 +
 .../core/objs/BrooklynObjectPredicate.java      |   33 +
 .../core/objs/BrooklynTypeSnapshot.java         |  101 +
 .../brooklyn/core/objs/BrooklynTypes.java       |  131 +
 .../brooklyn/core/objs/proxy/EntityProxy.java   |   27 +
 .../core/objs/proxy/EntityProxyImpl.java        |  273 ++
 .../core/objs/proxy/InternalEntityFactory.java  |  441 +++
 .../core/objs/proxy/InternalFactory.java        |  131 +
 .../objs/proxy/InternalLocationFactory.java     |  151 +
 .../core/objs/proxy/InternalPolicyFactory.java  |  204 ++
 .../core/plan/PlanNotRecognizedException.java   |   42 +
 .../brooklyn/core/plan/PlanToSpecFactory.java   |  153 +
 .../core/plan/PlanToSpecTransformer.java        |   68 +
 .../brooklyn/core/policy/AbstractPolicy.java    |  125 +
 .../apache/brooklyn/core/policy/Policies.java   |   73 +
 .../brooklyn/core/policy/PolicyDynamicType.java |   43 +
 .../core/policy/PolicyTypeSnapshot.java         |   39 +
 .../relations/AbstractBasicRelationSupport.java |   62 +
 .../relations/ByObjectBasicRelationSupport.java |  103 +
 .../core/relations/EmptyRelationSupport.java    |   59 +
 .../core/relations/RelationshipTypes.java       |  188 ++
 .../entity/AbstractEntitySpecResolver.java      |   65 +
 .../entity/CatalogEntitySpecResolver.java       |   85 +
 .../entity/DelegatingEntitySpecResolver.java    |  127 +
 .../core/resolve/entity/EntitySpecResolver.java |   67 +
 .../resolve/entity/JavaEntitySpecResolver.java  |   99 +
 .../brooklyn/core/sensor/AttributeMap.java      |  217 ++
 .../sensor/AttributeSensorAndConfigKey.java     |  152 +
 .../core/sensor/BasicAttributeSensor.java       |   62 +
 .../BasicAttributeSensorAndConfigKey.java       |  114 +
 .../core/sensor/BasicNotificationSensor.java    |   36 +
 .../brooklyn/core/sensor/BasicSensor.java       |  114 +
 .../brooklyn/core/sensor/BasicSensorEvent.java  |  112 +
 .../core/sensor/DependentConfiguration.java     |  935 ++++++
 .../sensor/PortAttributeSensorAndConfigKey.java |  147 +
 .../apache/brooklyn/core/sensor/Sensors.java    |  164 +
 .../brooklyn/core/sensor/StaticSensor.java      |   72 +
 ...platedStringAttributeSensorAndConfigKey.java |   66 +
 .../core/sensor/http/HttpRequestSensor.java     |   97 +
 .../sensor/password/CreatePasswordSensor.java   |   59 +
 .../core/sensor/ssh/SshCommandSensor.java       |  141 +
 .../core/server/BrooklynServerConfig.java       |  177 +
 .../core/server/BrooklynServerPaths.java        |  281 ++
 .../core/server/BrooklynServiceAttributes.java  |   66 +
 .../core/server/entity/BrooklynMetrics.java     |   55 +
 .../core/server/entity/BrooklynMetricsImpl.java |   86 +
 ...actFormatSpecificTypeImplementationPlan.java |   52 +
 .../typereg/AbstractTypePlanTransformer.java    |  138 +
 .../core/typereg/BasicBrooklynTypeRegistry.java |  296 ++
 .../core/typereg/BasicOsgiBundleWithUrl.java    |  101 +
 .../core/typereg/BasicRegisteredType.java       |  150 +
 .../typereg/BasicTypeImplementationPlan.java    |   41 +
 .../typereg/BrooklynTypePlanTransformer.java    |   88 +
 .../JavaClassNameTypePlanTransformer.java       |   91 +
 .../core/typereg/RegisteredTypeKindVisitor.java |   45 +
 .../typereg/RegisteredTypeLoadingContexts.java  |  236 ++
 .../core/typereg/RegisteredTypePredicates.java  |  257 ++
 .../brooklyn/core/typereg/RegisteredTypes.java  |  426 +++
 .../core/typereg/TypePlanTransformers.java      |  165 +
 .../typereg/UnsupportedTypePlanException.java   |   37 +
 .../stock/AbstractAggregatingEnricher.java      |  174 +
 .../enricher/stock/AbstractAggregator.java      |  238 ++
 .../stock/AbstractMultipleSensorAggregator.java |  169 +
 .../enricher/stock/AbstractTransformer.java     |  103 +
 .../stock/AbstractTransformingEnricher.java     |   38 +
 .../stock/AbstractTypeTransformingEnricher.java |   68 +
 .../brooklyn/enricher/stock/AddingEnricher.java |  107 +
 .../brooklyn/enricher/stock/Aggregator.java     |  231 ++
 .../brooklyn/enricher/stock/Combiner.java       |  138 +
 .../stock/CustomAggregatingEnricher.java        |  320 ++
 .../brooklyn/enricher/stock/Enrichers.java      |  935 ++++++
 .../apache/brooklyn/enricher/stock/Joiner.java  |  127 +
 .../brooklyn/enricher/stock/Propagator.java     |  208 ++
 .../stock/SensorPropagatingEnricher.java        |  181 +
 .../stock/SensorTransformingEnricher.java       |  106 +
 .../brooklyn/enricher/stock/Transformer.java    |  102 +
 .../brooklyn/enricher/stock/UpdatingMap.java    |  178 +
 .../YamlRollingTimeWindowMeanEnricher.java      |  178 +
 .../stock/YamlTimeWeightedDeltaEnricher.java    |   83 +
 .../enricher/stock/reducer/Reducer.java         |  138 +
 .../brooklyn/entity/group/AbstractGroup.java    |   90 +
 .../entity/group/AbstractGroupImpl.java         |  278 ++
 .../group/AbstractMembershipTrackingPolicy.java |  246 ++
 .../brooklyn/entity/group/BasicGroup.java       |   36 +
 .../brooklyn/entity/group/BasicGroupImpl.java   |   46 +
 .../apache/brooklyn/entity/group/Cluster.java   |   35 +
 .../brooklyn/entity/group/DynamicCluster.java   |  226 ++
 .../entity/group/DynamicClusterImpl.java        | 1035 ++++++
 .../brooklyn/entity/group/DynamicFabric.java    |   75 +
 .../entity/group/DynamicFabricImpl.java         |  275 ++
 .../brooklyn/entity/group/DynamicGroup.java     |   89 +
 .../brooklyn/entity/group/DynamicGroupImpl.java |  230 ++
 .../entity/group/DynamicMultiGroup.java         |  103 +
 .../entity/group/DynamicMultiGroupImpl.java     |  202 ++
 .../entity/group/DynamicRegionsFabric.java      |   42 +
 .../entity/group/DynamicRegionsFabricImpl.java  |   77 +
 .../apache/brooklyn/entity/group/Fabric.java    |   26 +
 .../brooklyn/entity/group/QuarantineGroup.java  |   33 +
 .../entity/group/QuarantineGroupImpl.java       |  102 +
 .../group/StopFailedRuntimeException.java       |   40 +
 .../org/apache/brooklyn/entity/group/Tier.java  |   28 +
 .../zoneaware/AbstractZoneFailureDetector.java  |  126 +
 .../BalancingNodePlacementStrategy.java         |  131 +
 .../zoneaware/CombiningZoneFailureDetector.java |   81 +
 .../CriticalCauseZoneFailureDetector.java       |   56 +
 .../ProportionalZoneFailureDetector.java        |   59 +
 .../brooklyn/entity/stock/BasicApplication.java |   32 +
 .../entity/stock/BasicApplicationImpl.java      |   33 +
 .../brooklyn/entity/stock/BasicEntity.java      |   34 +
 .../brooklyn/entity/stock/BasicEntityImpl.java  |   30 +
 .../brooklyn/entity/stock/BasicStartable.java   |   56 +
 .../entity/stock/BasicStartableImpl.java        |  107 +
 .../brooklyn/entity/stock/DataEntity.java       |   58 +
 .../brooklyn/entity/stock/DataEntityImpl.java   |   80 +
 .../brooklyn/entity/stock/DelegateEntity.java   |   73 +
 .../entity/stock/DelegateEntityImpl.java        |   49 +
 .../entity/stock/EffectorStartableImpl.java     |   77 +
 .../brooklyn/feed/function/FunctionFeed.java    |  208 ++
 .../feed/function/FunctionPollConfig.java       |  111 +
 .../org/apache/brooklyn/feed/http/HttpFeed.java |  382 +++
 .../brooklyn/feed/http/HttpPollConfig.java      |  160 +
 .../brooklyn/feed/http/HttpPollValue.java       |   40 +
 .../apache/brooklyn/feed/http/HttpPolls.java    |   39 +
 .../brooklyn/feed/http/HttpValueFunctions.java  |  157 +
 .../brooklyn/feed/http/JsonFunctions.java       |  412 +++
 .../apache/brooklyn/feed/shell/ShellFeed.java   |  273 ++
 .../brooklyn/feed/shell/ShellPollConfig.java    |  125 +
 .../org/apache/brooklyn/feed/ssh/SshFeed.java   |  290 ++
 .../apache/brooklyn/feed/ssh/SshPollConfig.java |  190 ++
 .../apache/brooklyn/feed/ssh/SshPollValue.java  |   60 +
 .../brooklyn/feed/ssh/SshValueFunctions.java    |  133 +
 .../WindowsPerformanceCounterPollConfig.java    |   53 +
 .../location/byon/ByonLocationResolver.java     |  266 ++
 .../FixedListMachineProvisioningLocation.java   |  476 +++
 .../location/byon/HostLocationResolver.java     |   93 +
 .../byon/SingleMachineLocationResolver.java     |   81 +
 .../byon/SingleMachineProvisioningLocation.java |   93 +
 .../localhost/LocalhostLocationResolver.java    |   76 +
 .../LocalhostMachineProvisioningLocation.java   |  354 ++
 ...calhostPropertiesFromBrooklynProperties.java |   57 +
 .../brooklyn/location/multi/MultiLocation.java  |  165 +
 .../location/multi/MultiLocationResolver.java   |  149 +
 .../brooklyn/location/paas/PaasLocation.java    |   30 +
 .../location/ssh/SshMachineLocation.java        | 1106 ++++++
 .../util/core/BrooklynLanguageExtensions.java   |   45 +
 .../util/core/BrooklynMavenArtifacts.java       |   58 +
 .../util/core/BrooklynNetworkUtils.java         |   42 +
 .../brooklyn/util/core/ResourcePredicates.java  |   72 +
 .../brooklyn/util/core/ResourceUtils.java       |  620 ++++
 .../brooklyn/util/core/config/ConfigBag.java    |  588 ++++
 .../util/core/crypto/FluentKeySigner.java       |  191 ++
 .../brooklyn/util/core/crypto/SecureKeys.java   |  185 +
 .../brooklyn/util/core/file/ArchiveBuilder.java |  442 +++
 .../brooklyn/util/core/file/ArchiveTasks.java   |   57 +
 .../brooklyn/util/core/file/ArchiveUtils.java   |  350 ++
 .../util/core/flags/ClassCoercionException.java |   41 +
 .../brooklyn/util/core/flags/FlagUtils.java     |  601 ++++
 .../util/core/flags/MethodCoercions.java        |  185 +
 .../brooklyn/util/core/flags/SetFromFlag.java   |   71 +
 .../brooklyn/util/core/flags/TypeCoercions.java |  890 +++++
 .../brooklyn/util/core/http/HttpTool.java       |   28 +
 .../util/core/http/HttpToolResponse.java        |   31 +
 .../core/internal/ConfigKeySelfExtracting.java  |   40 +
 .../brooklyn/util/core/internal/Repeater.java   |  366 ++
 .../ssh/BackoffLimitedRetryHandler.java         |   73 +
 .../core/internal/ssh/ShellAbstractTool.java    |  441 +++
 .../util/core/internal/ssh/ShellTool.java       |  113 +
 .../util/core/internal/ssh/SshAbstractTool.java |  174 +
 .../util/core/internal/ssh/SshException.java    |   32 +
 .../util/core/internal/ssh/SshTool.java         |  186 ++
 .../util/core/internal/ssh/cli/SshCliTool.java  |  316 ++
 .../core/internal/ssh/process/ProcessTool.java  |  214 ++
 .../internal/ssh/sshj/SshjClientConnection.java |  281 ++
 .../util/core/internal/ssh/sshj/SshjTool.java   | 1090 ++++++
 .../util/core/javalang/ReflectionScanner.java   |  134 +
 .../util/core/javalang/UrlClassLoader.java      |   69 +
 .../brooklyn/util/core/mutex/MutexSupport.java  |  119 +
 .../util/core/mutex/SemaphoreForTasks.java      |  111 +
 .../util/core/mutex/SemaphoreWithOwners.java    |  231 ++
 .../brooklyn/util/core/mutex/WithMutexes.java   |   45 +
 .../apache/brooklyn/util/core/osgi/Compat.java  |   69 +
 .../apache/brooklyn/util/core/osgi/Osgis.java   |  473 +++
 .../util/core/sensor/SensorPredicates.java      |   51 +
 .../core/task/AbstractExecutionContext.java     |   75 +
 .../util/core/task/BasicExecutionContext.java   |  220 ++
 .../util/core/task/BasicExecutionManager.java   |  892 +++++
 .../brooklyn/util/core/task/BasicTask.java      |  910 +++++
 .../brooklyn/util/core/task/CanSetName.java     |   25 +
 .../brooklyn/util/core/task/CompoundTask.java   |  130 +
 .../util/core/task/DeferredSupplier.java        |   38 +
 .../util/core/task/DynamicSequentialTask.java   |  496 +++
 .../brooklyn/util/core/task/DynamicTasks.java   |  353 ++
 .../util/core/task/ExecutionListener.java       |   31 +
 .../brooklyn/util/core/task/ForwardingTask.java |  324 ++
 .../core/task/ListenableForwardingFuture.java   |   74 +
 .../brooklyn/util/core/task/ParallelTask.java   |   84 +
 .../brooklyn/util/core/task/ScheduledTask.java  |  212 ++
 .../brooklyn/util/core/task/SequentialTask.java |   58 +
 .../util/core/task/SingleThreadedScheduler.java |  216 ++
 .../brooklyn/util/core/task/TaskBuilder.java    |  191 ++
 .../brooklyn/util/core/task/TaskInternal.java   |  163 +
 .../brooklyn/util/core/task/TaskPredicates.java |   79 +
 .../brooklyn/util/core/task/TaskScheduler.java  |   41 +
 .../brooklyn/util/core/task/TaskTags.java       |   71 +
 .../apache/brooklyn/util/core/task/Tasks.java   |  487 +++
 .../brooklyn/util/core/task/ValueResolver.java  |  437 +++
 .../util/core/task/ssh/SshFetchTaskFactory.java |   88 +
 .../util/core/task/ssh/SshFetchTaskWrapper.java |  134 +
 .../util/core/task/ssh/SshPutTaskFactory.java   |  122 +
 .../util/core/task/ssh/SshPutTaskStub.java      |   69 +
 .../util/core/task/ssh/SshPutTaskWrapper.java   |  189 ++
 .../brooklyn/util/core/task/ssh/SshTasks.java   |  239 ++
 .../internal/AbstractSshExecTaskFactory.java    |   58 +
 .../ssh/internal/PlainSshExecTaskFactory.java   |   71 +
 .../core/task/system/ProcessTaskFactory.java    |   64 +
 .../util/core/task/system/ProcessTaskStub.java  |  101 +
 .../core/task/system/ProcessTaskWrapper.java    |  186 ++
 .../util/core/task/system/SystemTasks.java      |   29 +
 .../internal/AbstractProcessTaskFactory.java    |  213 ++
 .../system/internal/ExecWithLoggingHelpers.java |  199 ++
 .../internal/SystemProcessTaskFactory.java      |  131 +
 .../util/core/text/DataUriSchemeParser.java     |  267 ++
 .../util/core/text/TemplateProcessor.java       |  536 +++
 .../util/core/xstream/ClassRenamingMapper.java  |   53 +
 ...ompilerIndependentOuterClassFieldMapper.java |  166 +
 .../xstream/EnumCaseForgivingConverter.java     |   60 +
 .../EnumCaseForgivingSingleValueConverter.java  |   35 +
 .../core/xstream/ImmutableListConverter.java    |   54 +
 .../core/xstream/ImmutableMapConverter.java     |   56 +
 .../core/xstream/ImmutableSetConverter.java     |   54 +
 .../core/xstream/Inet4AddressConverter.java     |   65 +
 .../util/core/xstream/MapConverter.java         |  104 +
 .../util/core/xstream/MutableSetConverter.java  |   44 +
 .../core/xstream/StringKeyMapConverter.java     |  133 +
 .../util/core/xstream/XmlSerializer.java        |  134 +
 .../brooklyn/util/core/xstream/XmlUtil.java     |   58 +
 ...klyn.api.internal.ApiObjectsFactoryInterface |   19 +
 ...pache.brooklyn.api.location.LocationResolver |   27 +
 ...che.brooklyn.core.plan.PlanToSpecTransformer |   19 +
 ...oklyn.core.resolve.entity.EntitySpecResolver |   20 +
 ...lyn.core.typereg.BrooklynTypePlanTransformer |   19 +
 .../resources/OSGI-INF/blueprint/blueprint.xml  |   41 +
 .../main/resources/brooklyn-catalog-empty.xml   |   20 +
 .../main/resources/brooklyn/empty.catalog.bom   |   18 +
 .../deserializingClassRenames.properties        | 1423 ++++++++
 .../recursiveCopyWithExtraRules.xslt            |   32 +
 .../brooklyn/location/basic/os-details.sh       |   93 +
 .../geo/external-ip-address-resolvers.txt       |   24 +
 .../core/BrooklynFeatureEnablementTest.java     |  118 +
 .../brooklyn/core/BrooklynVersionTest.java      |  124 +
 .../core/catalog/CatalogPredicatesTest.java     |  176 +
 .../core/catalog/internal/CatalogDtoTest.java   |  162 +
 .../internal/CatalogItemBuilderTest.java        |  132 +
 .../internal/CatalogItemComparatorTest.java     |   86 +
 .../core/catalog/internal/CatalogLoadTest.java  |   79 +
 .../core/catalog/internal/CatalogScanTest.java  |  200 ++
 .../catalog/internal/CatalogVersioningTest.java |  178 +
 .../core/catalog/internal/MyCatalogItems.java   |   36 +
 .../internal/StaticTypePlanTransformer.java     |  124 +
 .../internal/StaticTypePlanTransformerTest.java |   63 +
 .../config/BrooklynPropertiesBuilderTest.java   |   83 +
 .../BrooklynPropertiesFromGroovyTest.groovy     |   56 +
 .../core/config/BrooklynPropertiesTest.java     |  202 ++
 .../core/config/ConfigKeyConstraintTest.java    |  359 ++
 .../brooklyn/core/config/ConfigKeysTest.java    |  104 +
 .../core/config/ConfigPredicatesTest.java       |   87 +
 .../brooklyn/core/config/ConfigUtilsTest.java   |   40 +
 .../config/MapConfigKeyAndFriendsMoreTest.java  |  271 ++
 ...apListAndOtherStructuredConfigKeyTest.groovy |  357 ++
 .../VaultExternalConfigSupplierLiveTest.java    |  169 +
 .../core/effector/EffectorBasicTest.java        |  183 +
 .../core/effector/EffectorConcatenateTest.java  |  241 ++
 .../core/effector/EffectorMetadataTest.java     |  166 +
 .../effector/EffectorSayHiGroovyTest.groovy     |  182 +
 .../core/effector/EffectorSayHiTest.java        |  173 +
 .../core/effector/EffectorTaskTest.java         |  437 +++
 .../ssh/SshCommandEffectorIntegrationTest.java  |   94 +
 .../core/effector/ssh/SshEffectorTasksTest.java |  265 ++
 .../core/enricher/BasicEnricherTest.java        |  119 +
 .../core/enricher/EnricherConfigTest.java       |  147 +
 .../entity/AbstractApplicationLegacyTest.java   |  159 +
 .../core/entity/AbstractEntityLegacyTest.java   |  131 +
 .../brooklyn/core/entity/AttributeMapTest.java  |  248 ++
 .../brooklyn/core/entity/AttributeTest.java     |   66 +
 .../entity/ConfigEntityInheritanceTest.java     |  190 ++
 .../core/entity/DependentConfigurationTest.java |  458 +++
 .../brooklyn/core/entity/DynamicEntityTest.java |   60 +
 .../entity/DynamicEntityTypeConfigTest.java     |  126 +
 .../brooklyn/core/entity/EntitiesTest.java      |  134 +
 .../brooklyn/core/entity/EntityAssertsTest.java |  216 ++
 .../core/entity/EntityAutomanagedTest.java      |  329 ++
 .../core/entity/EntityConcurrencyTest.java      |  275 ++
 .../brooklyn/core/entity/EntityConfigTest.java  |  178 +
 .../core/entity/EntityFunctionsTest.java        |   83 +
 .../core/entity/EntityLocationsTest.java        |  126 +
 .../core/entity/EntityPredicatesTest.java       |  129 +
 .../core/entity/EntityRegistrationTest.java     |  102 +
 .../core/entity/EntitySetFromFlagTest.java      |  213 ++
 .../brooklyn/core/entity/EntitySpecTest.java    |  227 ++
 .../core/entity/EntitySubscriptionTest.java     |  283 ++
 .../core/entity/EntitySuppliersTest.java        |   70 +
 .../brooklyn/core/entity/EntityTypeTest.java    |  289 ++
 .../brooklyn/core/entity/OwnedChildrenTest.java |  213 ++
 .../core/entity/PolicyRegistrationTest.java     |  161 +
 .../entity/RecordingSensorEventListener.java    |  115 +
 .../brooklyn/core/entity/SanitizerTest.java     |   38 +
 .../drivers/BasicEntityDriverManagerTest.java   |   74 +
 .../drivers/EntityDriverRegistryTest.java       |   59 +
 .../ReflectiveEntityDriverFactoryTest.java      |  169 +
 .../RegistryEntityDriverFactoryTest.java        |   86 +
 .../downloads/BasicDownloadsRegistryTest.java   |  155 +
 .../DownloadProducerFromLocalRepoTest.java      |  130 +
 .../DownloadProducerFromPropertiesTest.java     |  162 +
 .../downloads/DownloadSubstitutersTest.java     |  131 +
 .../downloads/FilenameProducersTest.java        |   34 +
 .../drivers/downloads/MyEntityDriver.java       |   44 +
 .../brooklyn/core/entity/hello/HelloEntity.java |   53 +
 .../core/entity/hello/HelloEntityImpl.java      |   31 +
 .../core/entity/hello/LocalEntitiesTest.java    |  275 ++
 .../entity/internal/ConfigMapGroovyTest.groovy  |   61 +
 .../core/entity/internal/ConfigMapTest.java     |  298 ++
 .../EntityConfigMapUsageLegacyTest.java         |  292 ++
 .../internal/EntityConfigMapUsageTest.java      |  314 ++
 .../lifecycle/LifecycleTransitionTest.java      |   51 +
 .../entity/lifecycle/ServiceStateLogicTest.java |  314 ++
 .../ApplicationBuilderOverridingTest.java       |  234 ++
 .../proxying/BasicEntityTypeRegistryTest.java   |  135 +
 .../core/entity/proxying/EntityManagerTest.java |   83 +
 .../core/entity/proxying/EntityProxyTest.java   |  171 +
 .../proxying/InternalEntityFactoryTest.java     |  109 +
 .../core/entity/trait/FailingEntity.java        |   84 +
 .../core/entity/trait/FailingEntityImpl.java    |   92 +
 .../core/entity/trait/StartableMethodsTest.java |  127 +
 .../core/feed/ConfigToAttributesTest.java       |   69 +
 .../apache/brooklyn/core/feed/PollerTest.java   |  153 +
 .../storage/impl/BrooklynStorageImplTest.java   |  287 ++
 .../ConcurrentMapAcceptingNullValsTest.java     |  114 +
 .../core/location/AbstractLocationTest.java     |  184 +
 ...regatingMachineProvisioningLocationTest.java |  117 +
 .../location/LegacyAbstractLocationTest.java    |  151 +
 .../core/location/LocationConfigTest.java       |  204 ++
 .../core/location/LocationConfigUtilsTest.java  |  156 +
 .../core/location/LocationExtensionsTest.java   |  185 +
 .../core/location/LocationManagementTest.java   |   82 +
 .../core/location/LocationPredicatesTest.java   |  102 +
 ...ionPropertiesFromBrooklynPropertiesTest.java |  122 +
 .../core/location/LocationRegistryTest.java     |  161 +
 .../core/location/LocationSubscriptionTest.java |  241 ++
 .../core/location/MachineDetailsTest.java       |   83 +
 .../brooklyn/core/location/MachinesTest.java    |  158 +
 .../brooklyn/core/location/PortRangesTest.java  |  130 +
 .../RecordingMachineLocationCustomizer.java     |   71 +
 .../core/location/SimulatedLocation.java        |  139 +
 .../core/location/TestPortSupplierLocation.java |   90 +
 .../access/BrooklynAccessUtilsTest.java         |  139 +
 .../PortForwardManagerLocationResolverTest.java |   83 +
 .../access/PortForwardManagerRebindTest.java    |  195 ++
 .../location/access/PortForwardManagerTest.java |  193 ++
 .../location/cloud/CloudMachineNamerTest.java   |  165 +
 .../location/cloud/CustomMachineNamerTest.java  |   79 +
 .../core/location/geo/HostGeoInfoTest.java      |   52 +
 .../geo/HostGeoLookupIntegrationTest.java       |   87 +
 ...ocalhostExternalIpLoaderIntegrationTest.java |   54 +
 .../entitlement/AcmeEntitlementManager.java     |   52 +
 .../entitlement/AcmeEntitlementManagerTest.java |   60 +
 .../AcmeEntitlementManagerTestFixture.java      |  157 +
 .../entitlement/EntitlementsPredicatesTest.java |   36 +
 .../core/mgmt/entitlement/EntitlementsTest.java |  207 ++
 .../mgmt/entitlement/EntityEntitlementTest.java |  184 +
 ...PerUserEntitlementManagerPropertiesTest.java |   52 +
 .../HighAvailabilityManagerFileBasedTest.java   |   46 +
 ...ilabilityManagerInMemoryIntegrationTest.java |   95 +
 .../ha/HighAvailabilityManagerInMemoryTest.java |  142 +
 .../HighAvailabilityManagerSplitBrainTest.java  |  473 +++
 .../ha/HighAvailabilityManagerTestFixture.java  |  286 ++
 .../brooklyn/core/mgmt/ha/HotStandbyTest.java   |  660 ++++
 .../ha/ImmutableManagementPlaneSyncRecord.java  |   57 +
 ...agementPlaneSyncRecordPersisterInMemory.java |   99 +
 .../core/mgmt/ha/MasterChooserTest.java         |  145 +
 .../ha/MutableManagementPlaneSyncRecord.java    |   62 +
 .../core/mgmt/ha/TestEntityFailingRebind.java   |   55 +
 .../brooklyn/core/mgmt/ha/WarmStandbyTest.java  |  154 +
 .../core/mgmt/internal/AccessManagerTest.java   |  143 +
 .../internal/BrooklynShutdownHooksTest.java     |   91 +
 .../internal/EntityExecutionManagerTest.java    |  477 +++
 .../ExternalConfigSupplierRegistryTest.java     |   72 +
 .../LocalManagementContextInstancesTest.java    |   87 +
 .../internal/LocalManagementContextTest.java    |  126 +
 .../internal/LocalSubscriptionManagerTest.java  |  174 +
 .../brooklyn/core/mgmt/osgi/OsgiPathTest.java   |  104 +
 .../core/mgmt/osgi/OsgiStandaloneTest.java      |  191 ++
 .../mgmt/osgi/OsgiVersionMoreEntityTest.java    |  454 +++
 .../BrooklynMementoPersisterFileBasedTest.java  |   55 +
 ...ntoPersisterInMemorySizeIntegrationTest.java |  106 +
 .../BrooklynMementoPersisterInMemoryTest.java   |   33 +
 .../BrooklynMementoPersisterTestFixture.java    |  165 +
 .../mgmt/persist/FileBasedObjectStoreTest.java  |   99 +
 .../FileBasedStoreObjectAccessorWriterTest.java |   90 +
 .../core/mgmt/persist/InMemoryObjectStore.java  |  170 +
 .../InMemoryStoreObjectAccessorWriterTest.java  |   36 +
 .../core/mgmt/persist/ListeningObjectStore.java |  252 ++
 ...nceStoreObjectAccessorWriterTestFixture.java |  136 +
 .../mgmt/persist/XmlMementoSerializerTest.java  |  615 ++++
 .../mgmt/rebind/ActivePartialRebindTest.java    |  105 +
 .../rebind/ActivePartialRebindVersionTest.java  |  117 +
 .../core/mgmt/rebind/CheckpointEntityTest.java  |  108 +
 .../brooklyn/core/mgmt/rebind/Dumpers.java      |  273 ++
 .../mgmt/rebind/RebindCatalogEntityTest.java    |  154 +
 .../core/mgmt/rebind/RebindCatalogItemTest.java |  285 ++
 ...talogWhenCatalogPersistenceDisabledTest.java |   93 +
 .../rebind/RebindClassInitializationTest.java   |   78 +
 .../mgmt/rebind/RebindDynamicGroupTest.java     |   67 +
 .../core/mgmt/rebind/RebindEnricherTest.java    |  324 ++
 .../rebind/RebindEntityDynamicTypeInfoTest.java |  122 +
 .../core/mgmt/rebind/RebindEntityTest.java      |  953 ++++++
 .../core/mgmt/rebind/RebindFailuresTest.java    |  293 ++
 .../core/mgmt/rebind/RebindFeedTest.java        |  403 +++
 .../core/mgmt/rebind/RebindFeedWithHaTest.java  |  131 +
 .../core/mgmt/rebind/RebindGroupTest.java       |  123 +
 .../rebind/RebindLocalhostLocationTest.java     |  104 +
 .../core/mgmt/rebind/RebindLocationTest.java    |  381 +++
 .../RebindManagerExceptionHandlerTest.java      |   86 +
 .../mgmt/rebind/RebindManagerSorterTest.java    |  147 +
 .../core/mgmt/rebind/RebindManagerTest.java     |   62 +
 .../core/mgmt/rebind/RebindOptions.java         |  102 +
 .../core/mgmt/rebind/RebindPolicyTest.java      |  339 ++
 .../rebind/RebindSshMachineLocationTest.java    |  102 +
 .../core/mgmt/rebind/RebindTestFixture.java     |  330 ++
 .../mgmt/rebind/RebindTestFixtureWithApp.java   |   32 +
 .../core/mgmt/rebind/RebindTestUtils.java       |  491 +++
 .../rebind/RecordingRebindExceptionHandler.java |   92 +
 .../CompoundTransformerLoaderTest.java          |   79 +
 .../transformer/CompoundTransformerTest.java    |  481 +++
 .../transformer/impl/XsltTransformerTest.java   |  170 +
 .../core/objs/AbstractEntityAdjunctTest.java    |   52 +
 .../objs/BasicSpecParameterFromClassTest.java   |  109 +
 .../objs/BasicSpecParameterFromListTest.java    |  186 ++
 .../core/plan/XmlPlanToSpecTransformer.java     |  136 +
 .../core/plan/XmlPlanToSpecTransformerTest.java |   67 +
 .../core/policy/basic/BasicPolicyTest.java      |   89 +
 .../core/policy/basic/EnricherTypeTest.java     |   58 +
 .../core/policy/basic/PolicyConfigTest.java     |  201 ++
 .../policy/basic/PolicySubscriptionTest.java    |  153 +
 .../core/policy/basic/PolicyTypeTest.java       |   58 +
 .../relations/RelationsEntityBasicTest.java     |   55 +
 .../relations/RelationsEntityRebindTest.java    |   51 +
 .../core/relations/RelationshipTest.java        |   57 +
 .../brooklyn/core/sensor/StaticSensorTest.java  |   53 +
 .../core/sensor/http/HttpRequestSensorTest.java |   84 +
 .../password/CreatePasswordSensorTest.java      |   59 +
 .../ssh/SshCommandSensorIntegrationTest.java    |   89 +
 .../core/server/entity/BrooklynMetricsTest.java |  127 +
 .../core/test/BrooklynAppLiveTestSupport.java   |   50 +
 .../core/test/BrooklynAppUnitTestSupport.java   |   52 +
 .../core/test/BrooklynMgmtUnitTestSupport.java  |   61 +
 .../apache/brooklyn/core/test/HttpService.java  |  226 ++
 .../core/test/entity/BlockingEntity.java        |   45 +
 .../core/test/entity/BlockingEntityImpl.java    |   59 +
 .../entity/LocalManagementContextForTests.java  |  157 +
 .../core/test/entity/NoopStartable.java         |   29 +
 .../core/test/entity/TestApplication.java       |   59 +
 .../core/test/entity/TestApplicationImpl.java   |   96 +
 .../entity/TestApplicationNoEnrichersImpl.java  |   29 +
 .../brooklyn/core/test/entity/TestCluster.java  |   40 +
 .../core/test/entity/TestClusterImpl.java       |  100 +
 .../brooklyn/core/test/entity/TestEntity.java   |  112 +
 .../core/test/entity/TestEntityImpl.java        |  184 +
 .../test/entity/TestEntityNoEnrichersImpl.java  |   32 +
 .../entity/TestEntityTransientCopyImpl.java     |   28 +
 .../brooklyn/core/test/policy/TestEnricher.java |   62 +
 .../brooklyn/core/test/policy/TestPolicy.java   |   61 +
 .../longevity/EntityCleanupLongevityTest.java   |   61 +
 .../EntityCleanupLongevityTestFixture.java      |  174 +
 .../test/qa/longevity/EntityCleanupTest.java    |   58 +
 .../qa/performance/AbstractPerformanceTest.java |  179 +
 .../EntityPerformanceLongevityTest.java         |   35 +
 .../qa/performance/EntityPerformanceTest.java   |  164 +
 .../EntityPersistencePerformanceTest.java       |   99 +
 .../FilePersistencePerformanceTest.java         |  246 ++
 .../GroovyYardStickPerformanceTest.groovy       |   67 +
 .../JavaYardStickPerformanceTest.java           |   90 +
 .../SubscriptionPerformanceTest.java            |  155 +
 .../qa/performance/TaskPerformanceTest.java     |  164 +
 .../typereg/BasicBrooklynTypeRegistryTest.java  |  186 ++
 .../typereg/ExampleXmlTypePlanTransformer.java  |  140 +
 .../ExampleXmlTypePlanTransformerTest.java      |   67 +
 .../JavaClassNameTypePlanTransformerTest.java   |   90 +
 .../typereg/RegisteredTypePredicatesTest.java   |  157 +
 ...CustomAggregatingEnricherDeprecatedTest.java |  405 +++
 .../stock/CustomAggregatingEnricherTest.java    |  553 +++
 .../stock/EnricherWithDeferredSupplierTest.java |  132 +
 .../brooklyn/enricher/stock/EnrichersTest.java  |  495 +++
 ...SensorPropagatingEnricherDeprecatedTest.java |  108 +
 .../stock/SensorPropagatingEnricherTest.java    |  268 ++
 .../TransformingEnricherDeprecatedTest.java     |   92 +
 .../stock/TransformingEnricherTest.java         |   71 +
 .../YamlRollingTimeWindowMeanEnricherTest.java  |  179 +
 .../YamlTimeWeightedDeltaEnricherTest.java      |  107 +
 .../enricher/stock/reducer/ReducerTest.java     |  242 ++
 .../entity/group/DynamicClusterTest.java        | 1178 +++++++
 ...DynamicClusterWithAvailabilityZonesTest.java |  225 ++
 .../entity/group/DynamicFabricTest.java         |  494 +++
 .../brooklyn/entity/group/DynamicGroupTest.java |  550 +++
 .../entity/group/DynamicMultiGroupTest.java     |  218 ++
 .../entity/group/DynamicRegionsFabricTest.java  |  170 +
 .../entity/group/GroupPickUpEntitiesTest.java   |  157 +
 .../apache/brooklyn/entity/group/GroupTest.java |  143 +
 .../group/MembershipTrackingPolicyTest.java     |  312 ++
 .../entity/group/QuarantineGroupTest.java       |   85 +
 .../BalancingNodePlacementStrategyTest.java     |  116 +
 .../ProportionalZoneFailureDetectorTest.java    |  123 +
 .../entity/stock/BasicStartableTest.java        |  172 +
 .../brooklyn/entity/stock/DataEntityTest.java   |  142 +
 .../feed/function/FunctionFeedTest.java         |  315 ++
 .../feed/http/HttpFeedIntegrationTest.java      |  160 +
 .../apache/brooklyn/feed/http/HttpFeedTest.java |  389 +++
 .../feed/http/HttpValueFunctionsTest.java       |   93 +
 .../brooklyn/feed/http/JsonFunctionsTest.java   |  135 +
 .../feed/shell/ShellFeedIntegrationTest.java    |  226 ++
 .../feed/ssh/SshFeedIntegrationTest.java        |  258 ++
 .../apache/brooklyn/feed/ssh/SshFeedTest.java   |  188 ++
 .../feed/ssh/SshValueFunctionsTest.java         |   43 +
 .../location/byon/ByonLocationResolverTest.java |  411 +++
 ...stMachineProvisioningLocationRebindTest.java |  131 +
 ...ixedListMachineProvisioningLocationTest.java |  578 ++++
 .../location/byon/HostLocationResolverTest.java |  126 +
 .../byon/SingleMachineLocationResolverTest.java |  132 +
 .../SingleMachineProvisioningLocationTest.java  |   65 +
 .../LocalhostLocationResolverTest.java          |  269 ++
 ...ocalhostMachineProvisioningLocationTest.java |  215 ++
 .../LocalhostProvisioningAndAccessTest.java     |   59 +
 .../location/multi/MultiLocationRebindTest.java |  122 +
 .../multi/MultiLocationResolverTest.java        |  203 ++
 .../location/multi/MultiLocationTest.java       |  121 +
 .../location/paas/PaasLocationTest.java         |   34 +
 .../location/paas/TestPaasLocation.java         |   32 +
 .../ssh/SshMachineLocationIntegrationTest.java  |  141 +
 .../ssh/SshMachineLocationPerformanceTest.java  |  172 +
 .../SshMachineLocationReuseIntegrationTest.java |  171 +
 .../ssh/SshMachineLocationSshToolTest.java      |  131 +
 .../location/ssh/SshMachineLocationTest.java    |  346 ++
 .../util/core/BrooklynMavenArtifactsTest.java   |   97 +
 .../util/core/ResourceUtilsHttpTest.java        |  195 ++
 .../brooklyn/util/core/ResourceUtilsTest.java   |  189 ++
 .../util/core/config/ConfigBagTest.java         |  192 ++
 .../core/crypto/SecureKeysAndSignerTest.java    |  168 +
 .../util/core/file/ArchiveBuilderTest.java      |  199 ++
 .../util/core/file/ArchiveUtilsTest.java        |  136 +
 .../util/core/flags/MethodCoercionsTest.java    |  148 +
 .../util/core/http/BetterMockWebServer.java     |  138 +
 .../util/core/http/HttpToolIntegrationTest.java |   99 +
 .../util/core/internal/FlagUtilsTest.java       |  318 ++
 .../util/core/internal/RepeaterTest.java        |  251 ++
 .../util/core/internal/TypeCoercionsTest.java   |  381 +++
 .../core/internal/ssh/RecordingSshTool.java     |  104 +
 .../internal/ssh/ShellToolAbstractTest.java     |  444 +++
 .../ssh/SshToolAbstractIntegrationTest.java     |  347 ++
 .../ssh/SshToolAbstractPerformanceTest.java     |  137 +
 .../ssh/cli/SshCliToolIntegrationTest.java      |  118 +
 .../ssh/cli/SshCliToolPerformanceTest.java      |   44 +
 .../ssh/process/ProcessToolIntegrationTest.java |   69 +
 .../ssh/process/ProcessToolStaticsTest.java     |   79 +
 .../sshj/SshjToolAsyncStubIntegrationTest.java  |  177 +
 .../ssh/sshj/SshjToolIntegrationTest.java       |  313 ++
 .../ssh/sshj/SshjToolPerformanceTest.java       |   44 +
 .../util/core/mutex/WithMutexesTest.java        |  129 +
 .../brooklyn/util/core/osgi/OsgiTestBase.java   |   56 +
 .../util/core/sensor/SensorPredicatesTest.java  |   38 +
 .../core/ssh/BashCommandsIntegrationTest.java   |  530 +++
 .../task/BasicTaskExecutionPerformanceTest.java |  205 ++
 .../util/core/task/BasicTaskExecutionTest.java  |  461 +++
 .../util/core/task/BasicTasksFutureTest.java    |  226 ++
 .../core/task/CompoundTaskExecutionTest.java    |  257 ++
 .../core/task/DynamicSequentialTaskTest.java    |  482 +++
 .../core/task/NonBasicTaskExecutionTest.java    |  134 +
 .../util/core/task/ScheduledExecutionTest.java  |  330 ++
 .../core/task/SingleThreadedSchedulerTest.java  |  194 ++
 .../util/core/task/TaskFinalizationTest.java    |   62 +
 .../util/core/task/TaskPredicatesTest.java      |   73 +
 .../brooklyn/util/core/task/TasksTest.java      |  183 +
 .../util/core/task/ValueResolverTest.java       |  133 +
 .../util/core/task/ssh/SshTasksTest.java        |  211 ++
 .../util/core/task/system/SystemTasksTest.java  |  136 +
 .../util/core/text/DataUriSchemeParserTest.java |   53 +
 .../util/core/text/TemplateProcessorTest.java   |  197 ++
 .../core/xstream/CompilerCompatibilityTest.java |  158 +
 .../util/core/xstream/ConverterTestFixture.java |   40 +
 .../xstream/EnumCaseForgivingConverterTest.java |   53 +
 .../xstream/ImmutableListConverterTest.java     |   60 +
 .../core/xstream/InetAddressConverterTest.java  |   42 +
 .../core/xstream/StringKeyMapConverterTest.java |   77 +
 .../brooklyn/util/core/xstream/XmlUtilTest.java |   34 +
 .../io.brooklyn/brooklyn-core/pom.properties    |   22 +
 .../brooklyn/catalog/internal/osgi-catalog.xml  |   31 +
 .../brooklyn/config/more-sample.properties      |   20 +
 .../resources/brooklyn/config/sample.properties |   20 +
 .../resources/brooklyn/config/tricky.properties |   23 +
 .../test/resources/brooklyn/default.catalog.bom |   19 +
 .../rebind/rebind-catalog-item-test-catalog.xml |   28 +
 .../rebind/transformer/impl/renameClass.xslt    |   35 +
 .../rebind/transformer/impl/renameField.xslt    |   35 +
 .../rebind/transformer/impl/renameType.xslt     |   41 +
 .../brooklyn/util/crypto/sample_dsa.pem         |   12 +
 .../brooklyn/util/crypto/sample_dsa.pem.pub     |    1 +
 .../brooklyn/util/crypto/sample_rsa.pem         |   27 +
 .../brooklyn/util/crypto/sample_rsa.pem.pub     |    1 +
 .../util/crypto/sample_rsa_passphrase.pem       |   30 +
 .../util/crypto/sample_rsa_passphrase.pem.pub   |    1 +
 .../resources/brooklyn/util/ssh/test_sudoers    |   24 +
 .../test/resources/hello-world-no-mapping.txt   |   18 +
 .../test/resources/hello-world-no-mapping.war   |  Bin 0 -> 14693 bytes
 core/src/test/resources/hello-world.txt         |   18 +
 core/src/test/resources/hello-world.war         |  Bin 0 -> 14729 bytes
 .../brooklyn-AppInCatalog.jar                   |  Bin 0 -> 2891 bytes
 .../brooklyn-AppInCatalog.txt                   |   38 +
 .../brooklyn/location/basic/sample_id_rsa       |   27 +
 .../brooklyn/location/basic/sample_id_rsa.pub   |    1 +
 .../rebind/compiler_compatibility_eclipse.xml   |   41 +
 .../rebind/compiler_compatibility_oracle.xml    |   41 +
 core/src/test/resources/server.ks               |  Bin 0 -> 1366 bytes
 karaf/apache-brooklyn/pom.xml                   |  127 +
 .../filtered-resources/etc/branding.properties  |   35 +
 .../src/main/resources/etc/custom.properties    |  120 +
 .../resources/etc/org.ops4j.pax.logging.cfg     |   46 +
 .../src/main/resources/etc/system.properties    |  133 +
 karaf/commands/pom.xml                          |   82 +
 .../apache/brooklyn/karaf/commands/Catalog.java |   46 +
 karaf/features/pom.xml                          |   60 +
 karaf/features/src/main/feature/feature.xml     |  218 ++
 karaf/features/src/main/resources/.gitignore    |    4 +
 karaf/itest/pom.xml                             |  209 ++
 .../java/org/apache/brooklyn/AssemblyTest.java  |  118 +
 karaf/itest/src/test/resources/exam.properties  |   21 +
 karaf/itest/src/test/resources/logback.xml      |   43 +
 karaf/pom.xml                                   |  163 +
 launcher/pom.xml                                |  283 ++
 .../org/apache/brooklyn/launcher/Activator.java |   39 +
 .../brooklyn/launcher/BrooklynLauncher.java     | 1067 ++++++
 .../launcher/BrooklynServerDetails.java         |   47 +
 .../brooklyn/launcher/BrooklynWebServer.java    |  670 ++++
 .../camp/BrooklynCampPlatformLauncher.java      |   71 +
 .../launcher/camp/SimpleYamlLauncher.java       |   35 +
 .../config/BrooklynDevelopmentModes.java        |   92 +
 .../launcher/config/BrooklynGlobalConfig.java   |   66 +
 .../launcher/config/CustomResourceLocator.java  |  126 +
 .../config/StopWhichAppsOnShutdown.java         |   23 +
 .../ContextHandlerCollectionHotSwappable.java   |   62 +
 .../entity/basic/VanillaSoftwareYamlTest.java   |   97 +
 .../BrooklynEntityMirrorIntegrationTest.java    |  179 +
 .../brooklynnode/BrooklynNodeRestTest.java      |  145 +
 .../database/mssql/MssqlBlueprintLiveTest.java  |   59 +
 .../BrooklynLauncherHighAvailabilityTest.java   |  258 ++
 .../BrooklynLauncherRebindCatalogTest.java      |  124 +
 .../BrooklynLauncherRebindTestFixture.java      |  257 ++
 .../BrooklynLauncherRebindTestToFiles.java      |  154 +
 ...lynLauncherRebindToCloudObjectStoreTest.java |  175 +
 .../brooklyn/launcher/BrooklynLauncherTest.java |  392 +++
 .../launcher/BrooklynWebServerTest.java         |  222 ++
 .../launcher/SimpleYamlLauncherForTests.java    |   31 +
 .../brooklyn/launcher/WebAppRunnerTest.java     |  171 +
 .../apache/brooklyn/launcher/YamlLauncher.java  |   35 +
 .../blueprints/AbstractBlueprintTest.java       |  233 ++
 .../blueprints/CouchbaseBlueprintTest.java      |   69 +
 .../blueprints/MongoDbBlueprintTest.java        |   51 +
 .../Windows7zipBlueprintLiveTest.java           |  100 +
 .../jsgui/BrooklynJavascriptGuiLauncher.java    |   88 +
 .../BrooklynJavascriptGuiLauncherTest.java      |   81 +
 launcher/src/test/resources/7zip-catalog.yaml   |   42 +
 .../basic-empty-app-and-entity-blueprint.yaml   |   30 +
 .../resources/basic-empy-app-blueprint.yaml     |   23 +
 .../src/test/resources/cassandra-blueprint.yaml |   29 +
 launcher/src/test/resources/client.ks           |  Bin 0 -> 1364 bytes
 launcher/src/test/resources/client.ts           |  Bin 0 -> 658 bytes
 .../resources/couchbase-cluster-singleNode.yaml |   36 +
 .../src/test/resources/couchbase-cluster.yaml   |   33 +
 launcher/src/test/resources/couchbase-node.yaml |   26 +
 .../couchbase-replication-w-pillowfight.yaml    |   56 +
 .../src/test/resources/couchbase-w-loadgen.yaml |   54 +
 .../test/resources/couchbase-w-pillowfight.yaml |   35 +
 launcher/src/test/resources/install7zip.ps1     |   35 +
 .../java-web-app-and-db-with-function.yaml      |   36 +
 .../src/test/resources/mongo-blueprint.yaml     |   23 +
 .../resources/mongo-client-single-server.yaml   |   35 +
 .../src/test/resources/mongo-product-delete.js  |   20 +
 .../src/test/resources/mongo-product-insert.js  |   24 +
 .../src/test/resources/mongo-product-update.js  |   20 +
 launcher/src/test/resources/mongo-scripts.yaml  |   39 +
 .../resources/mongo-sharded-authentication.yaml |   65 +
 launcher/src/test/resources/mongo-sharded.yaml  |   54 +
 .../mongo-single-server-blueprint.yaml          |   23 +
 launcher/src/test/resources/mongo.key           |   16 +
 launcher/src/test/resources/mssql-test.yaml     |   60 +
 launcher/src/test/resources/nginx.yaml          |   27 +
 .../src/test/resources/opengamma-cluster.yaml   |   48 +
 launcher/src/test/resources/playing.yaml        |   21 +
 .../test/resources/postgres-gce-blueprint.yaml  |   22 +
 .../resources/rebind-test-catalog-additions.bom |   32 +
 .../src/test/resources/rebind-test-catalog.bom  |   32 +
 launcher/src/test/resources/server.ks           |  Bin 0 -> 1366 bytes
 launcher/src/test/resources/server.ts           |  Bin 0 -> 658 bytes
 .../src/test/resources/storm-blueprint.yaml     |   26 +
 .../resources/vanilla-software-blueprint.yaml   |   40 +
 .../vanilla-software-with-child-blueprint.yaml  |   44 +
 .../test/resources/visitors-creation-script.sql |   41 +
 launcher/src/test/resources/web.yaml            |   24 +
 locations/jclouds/pom.xml                       |  198 ++
 .../JcloudsBlobStoreBasedObjectStore.java       |  237 ++
 .../jclouds/JcloudsStoreObjectAccessor.java     |  127 +
 ...AbstractJcloudsSubnetSshMachineLocation.java |   37 +
 .../jclouds/BasicJcloudsLocationCustomizer.java |   99 +
 .../location/jclouds/BrooklynImageChooser.java  |  368 ++
 .../jclouds/ComputeServiceRegistry.java         |   27 +
 .../jclouds/ComputeServiceRegistryImpl.java     |  182 +
 .../jclouds/JcloudsByonLocationResolver.java    |  182 +
 .../location/jclouds/JcloudsLocation.java       | 3147 ++++++++++++++++++
 .../location/jclouds/JcloudsLocationConfig.java |  279 ++
 .../jclouds/JcloudsLocationCustomizer.java      |  104 +
 .../jclouds/JcloudsLocationResolver.java        |  226 ++
 .../jclouds/JcloudsMachineLocation.java         |   61 +
 .../location/jclouds/JcloudsMachineNamer.java   |   44 +
 .../location/jclouds/JcloudsPredicates.java     |   60 +
 ...JcloudsPropertiesFromBrooklynProperties.java |  158 +
 .../jclouds/JcloudsSshMachineLocation.java      |  596 ++++
 .../brooklyn/location/jclouds/JcloudsUtil.java  |  473 +++
 .../jclouds/JcloudsWinRmMachineLocation.java    |  308 ++
 .../jclouds/SudoTtyFixingCustomizer.java        |   57 +
 .../JcloudsLocationSecurityGroupCustomizer.java |  667 ++++
 .../JcloudsPortForwarderExtension.java          |   45 +
 .../networking/SecurityGroupDefinition.java     |  102 +
 .../jclouds/networking/SecurityGroupTool.java   |  166 +
 .../jclouds/pool/MachinePoolPredicates.java     |  149 +
 .../location/jclouds/pool/MachineSet.java       |   98 +
 .../jclouds/pool/ReusableMachineTemplate.java   |  182 +
 .../AbstractPortableTemplateBuilder.java        |  527 +++
 .../templates/PortableTemplateBuilder.java      |  145 +
 .../zone/AwsAvailabilityZoneExtension.java      |   73 +
 .../policy/jclouds/os/CreateUserPolicy.java     |  181 +
 ...pache.brooklyn.api.location.LocationResolver |   20 +
 .../brooklyn/location-metadata.properties       |  222 ++
 .../location/jclouds/sample/setup-server.sh     |   31 +
 .../mgmt/persist/jclouds/BlobStoreCleaner.java  |   71 +
 .../persist/jclouds/BlobStoreExpiryTest.java    |  196 ++
 .../BlobStorePersistencePerformanceTest.java    |  134 +
 .../mgmt/persist/jclouds/BlobStoreTest.java     |  150 +
 ...nMementoPersisterJcloudsObjectStoreTest.java |   67 +
 ...tyToBlobStorePersistencePerformanceTest.java |   65 +
 ...ailabilityManagerJcloudsObjectStoreTest.java |   80 +
 .../JcloudsBlobStoreBasedObjectStoreTest.java   |  118 +
 .../jclouds/JcloudsExpect100ContinueTest.java   |  148 +
 .../JcloudsObjectStoreAccessorWriterTest.java   |  182 +
 .../jclouds/AbstractJcloudsLiveTest.java        |  183 +
 .../jclouds/AbstractJcloudsStubbedLiveTest.java |  124 +
 .../jclouds/BailOutJcloudsLocation.java         |  194 ++
 .../jclouds/DelegatingComputeService.java       |  229 ++
 .../jclouds/JcloudsAddressesLiveTest.java       |  227 ++
 .../JcloudsByonLocationResolverAwsLiveTest.java |  177 +
 ...dsByonLocationResolverSoftlayerLiveTest.java |  104 +
 .../JcloudsByonLocationResolverTest.java        |   80 +
 .../jclouds/JcloudsByonRebindLiveTest.java      |  165 +
 .../JcloudsHardwareProfilesStubbedLiveTest.java |   77 +
 .../jclouds/JcloudsLocationMetadataTest.java    |   71 +
 .../JcloudsLocationRegisterMachineLiveTest.java |  144 +
 ...cloudsLocationReleasePortForwardingTest.java |  184 +
 .../jclouds/JcloudsLocationResolverTest.java    |  356 ++
 ...udsLocationSuspendResumeMachineLiveTest.java |   62 +
 ...ationTemplateOptionsCustomisersLiveTest.java |  108 +
 .../location/jclouds/JcloudsLocationTest.java   |  610 ++++
 .../location/jclouds/JcloudsLoginLiveTest.java  |  456 +++
 .../jclouds/JcloudsMachineNamerTest.java        |   56 +
 ...udsPropertiesFromBrooklynPropertiesTest.java |   99 +
 .../location/jclouds/JcloudsRebindLiveTest.java |  231 ++
 .../location/jclouds/JcloudsRebindStubTest.java |  256 ++
 .../location/jclouds/JcloudsSshingLiveTest.java |   60 +
 .../location/jclouds/JcloudsSuseLiveTest.java   |  102 +
 .../location/jclouds/LiveTestEntity.java        |   89 +
 .../jclouds/RebindJcloudsLocationLiveTest.java  |  326 ++
 .../jclouds/RebindJcloudsLocationTest.java      |   65 +
 ...loudsLocationUserLoginAndConfigLiveTest.java |  248 ++
 ...hineProvisioningLocationJcloudsLiveTest.java |  123 +
 .../jclouds/StandaloneJcloudsLiveTest.java      |  253 ++
 ...oudsLocationSecurityGroupCustomizerTest.java |  366 ++
 .../JcloudsPortForwardingStubbedLiveTest.java   |  195 ++
 .../networking/SecurityGroupLiveTest.java       |   32 +
 .../provider/AbstractJcloudsLocationTest.java   |  202 ++
 .../provider/AwsEc2LocationLiveTest.java        |   66 +
 .../provider/AwsEc2LocationWindowsLiveTest.java |   95 +
 .../provider/CarrenzaLocationLiveTest.java      |  135 +
 .../provider/GoGridLocationLiveTest.java        |   52 +
 .../provider/RackspaceLocationLiveTest.java     |   82 +
 .../zone/AwsAvailabilityZoneExtensionTest.java  |  120 +
 .../jclouds/os/CreateUserPolicyLiveTest.java    |  122 +
 .../policy/jclouds/os/CreateUserPolicyTest.java |  136 +
 ...location-test-various-login-credentials.yaml |   67 +
 .../jclouds/persisted-aws-machine-aKEcbxKN      |  329 ++
 .../jclouds/persisted-aws-parent-lCYB3mTb       |   78 +
 .../persisted-aws-winrm-machine-KYSryzW8        |  184 +
 .../jclouds/persisted-aws-winrm-parent-fKc0Ofyn |   75 +
 .../jclouds/persisted-azure-machine-VNapYjwp    |  271 ++
 .../jclouds/persisted-azure-parent-briByOel     |   65 +
 logging/logback-includes/pom.xml                |   50 +
 .../JcloudsPersistenceThreadDiscriminator.java  |   65 +
 .../brooklyn/logback-appender-file.xml          |   71 +
 .../brooklyn/logback-appender-jclouds.xml       |   49 +
 .../brooklyn/logback-appender-stdout.xml        |   35 +
 .../main/resources/brooklyn/logback-debug.xml   |   28 +
 .../brooklyn/logback-logger-debug-all.xml       |   31 +
 .../brooklyn/logback-logger-debug-favs.xml      |   32 +
 .../brooklyn/logback-logger-debug-jclouds.xml   |   47 +
 .../brooklyn/logback-logger-excludes.xml        |   64 +
 .../resources/brooklyn/logback-logger-trace.xml |   26 +
 .../src/main/resources/logback-custom.xml       |   45 +
 .../src/main/resources/logback-main.xml         |   61 +
 logging/logback-xml/pom.xml                     |   45 +
 .../logback-xml/src/main/resources/logback.xml  |   40 +
 parent/pom.xml                                  | 1815 ++++++++++
 policy/pom.xml                                  |   95 +
 .../policy/autoscaling/AutoScalerPolicy.java    | 1133 +++++++
 .../autoscaling/MaxPoolSizeReachedEvent.java    |  103 +
 .../policy/autoscaling/ResizeOperator.java      |   31 +
 .../policy/autoscaling/SizeHistory.java         |  166 +
 .../brooklyn/policy/enricher/DeltaEnricher.java |   53 +
 .../policy/enricher/HttpLatencyDetector.java    |  320 ++
 .../policy/enricher/RollingMeanEnricher.java    |   81 +
 .../enricher/RollingTimeWindowMeanEnricher.java |  212 ++
 .../enricher/TimeFractionDeltaEnricher.java     |  109 +
 .../enricher/TimeWeightedDeltaEnricher.java     |  130 +
 .../followthesun/DefaultFollowTheSunModel.java  |  328 ++
 .../policy/followthesun/FollowTheSunModel.java  |   56 +
 .../followthesun/FollowTheSunParameters.java    |   95 +
 .../policy/followthesun/FollowTheSunPolicy.java |  279 ++
 .../policy/followthesun/FollowTheSunPool.java   |   74 +
 .../followthesun/FollowTheSunPoolImpl.java      |  177 +
 .../followthesun/FollowTheSunStrategy.java      |  161 +
 .../policy/followthesun/WeightedObject.java     |   71 +
 .../policy/ha/AbstractFailureDetector.java      |  360 ++
 .../policy/ha/ConditionalSuspendPolicy.java     |  102 +
 .../policy/ha/ConnectionFailureDetector.java    |  125 +
 .../apache/brooklyn/policy/ha/HASensors.java    |   62 +
 .../policy/ha/ServiceFailureDetector.java       |  339 ++
 .../brooklyn/policy/ha/ServiceReplacer.java     |  213 ++
 .../brooklyn/policy/ha/ServiceRestarter.java    |  162 +
 .../policy/ha/SshMachineFailureDetector.java    |   99 +
 .../loadbalancing/BalanceableContainer.java     |   50 +
 .../loadbalancing/BalanceablePoolModel.java     |   64 +
 .../loadbalancing/BalanceableWorkerPool.java    |   83 +
 .../BalanceableWorkerPoolImpl.java              |  184 +
 .../policy/loadbalancing/BalancingStrategy.java |  622 ++++
 .../DefaultBalanceablePoolModel.java            |  280 ++
 .../loadbalancing/ItemsInContainersGroup.java   |   51 +
 .../ItemsInContainersGroupImpl.java             |  147 +
 .../loadbalancing/LoadBalancingPolicy.java      |  341 ++
 .../loadbalancing/LocationConstraint.java       |   28 +
 .../brooklyn/policy/loadbalancing/Movable.java  |   50 +
 .../policy/loadbalancing/PolicyUtilForPool.java |   96 +
 .../autoscaling/AutoScalerPolicyMetricTest.java |  352 ++
 .../autoscaling/AutoScalerPolicyRebindTest.java |  134 +
 .../AutoScalerPolicyReconfigurationTest.java    |  189 ++
 .../autoscaling/AutoScalerPolicyTest.java       |  648 ++++
 .../autoscaling/LocallyResizableEntity.java     |   72 +
 .../policy/enricher/DeltaEnrichersTests.java    |  144 +
 .../enricher/HttpLatencyDetectorTest.java       |  149 +
 .../policy/enricher/RebindEnricherTest.java     |  153 +
 .../enricher/RollingMeanEnricherTest.java       |  106 +
 .../RollingTimeWindowMeanEnricherTest.java      |  156 +
 .../enricher/TimeFractionDeltaEnricherTest.java |  104 +
 .../AbstractFollowTheSunPolicyTest.java         |  236 ++
 .../followthesun/FollowTheSunModelTest.java     |  194 ++
 .../FollowTheSunPolicySoakTest.java             |  271 ++
 .../followthesun/FollowTheSunPolicyTest.java    |  303 ++
 .../ha/ConnectionFailureDetectorTest.java       |  307 ++
 .../brooklyn/policy/ha/HaPolicyRebindTest.java  |  170 +
 ...ServiceFailureDetectorStabilizationTest.java |  233 ++
 .../policy/ha/ServiceFailureDetectorTest.java   |  406 +++
 .../brooklyn/policy/ha/ServiceReplacerTest.java |  337 ++
 .../policy/ha/ServiceRestarterTest.java         |  189 ++
 .../AbstractLoadBalancingPolicyTest.java        |  251 ++
 .../BalanceableWorkerPoolTest.java              |  131 +
 .../ItemsInContainersGroupTest.java             |  188 ++
 .../loadbalancing/LoadBalancingModelTest.java   |  113 +
 .../LoadBalancingPolicyConcurrencyTest.java     |  210 ++
 .../LoadBalancingPolicySoakTest.java            |  272 ++
 .../loadbalancing/LoadBalancingPolicyTest.java  |  396 +++
 .../loadbalancing/MockContainerEntity.java      |   60 +
 .../loadbalancing/MockContainerEntityImpl.java  |  208 ++
 .../policy/loadbalancing/MockItemEntity.java    |   45 +
 .../loadbalancing/MockItemEntityImpl.java       |  112 +
 pom.xml                                         |  159 +-
 rest/rest-api/pom.xml                           |  178 +
 .../org/apache/brooklyn/rest/api/AccessApi.java |   62 +
 .../apache/brooklyn/rest/api/ActivityApi.java   |   69 +
 .../brooklyn/rest/api/ApplicationApi.java       |  222 ++
 .../apache/brooklyn/rest/api/CatalogApi.java    |  376 +++
 .../apache/brooklyn/rest/api/EffectorApi.java   |   85 +
 .../org/apache/brooklyn/rest/api/EntityApi.java |  235 ++
 .../brooklyn/rest/api/EntityConfigApi.java      |  145 +
 .../apache/brooklyn/rest/api/LocationApi.java   |  101 +
 .../org/apache/brooklyn/rest/api/PolicyApi.java |  151 +
 .../brooklyn/rest/api/PolicyConfigApi.java      |  120 +
 .../org/apache/brooklyn/rest/api/ScriptApi.java |   52 +
 .../org/apache/brooklyn/rest/api/SensorApi.java |  150 +
 .../org/apache/brooklyn/rest/api/ServerApi.java |  206 ++
 .../org/apache/brooklyn/rest/api/UsageApi.java  |  156 +
 .../apache/brooklyn/rest/api/VersionApi.java    |   43 +
 .../brooklyn/rest/domain/AccessSummary.java     |   74 +
 .../apache/brooklyn/rest/domain/ApiError.java   |  207 ++
 .../brooklyn/rest/domain/ApplicationSpec.java   |  181 +
 .../rest/domain/ApplicationSummary.java         |  117 +
 .../rest/domain/BrooklynFeatureSummary.java     |   91 +
 .../rest/domain/CatalogEntitySummary.java       |   83 +
 .../rest/domain/CatalogItemSummary.java         |  163 +
 .../rest/domain/CatalogLocationSummary.java     |   62 +
 .../rest/domain/CatalogPolicySummary.java       |   65 +
 .../brooklyn/rest/domain/ConfigSummary.java     |  171 +
 .../brooklyn/rest/domain/EffectorSummary.java   |  187 ++
 .../rest/domain/EntityConfigSummary.java        |   70 +
 .../apache/brooklyn/rest/domain/EntitySpec.java |  102 +
 .../brooklyn/rest/domain/EntitySummary.java     |   97 +
 .../apache/brooklyn/rest/domain/HasConfig.java  |   28 +
 .../org/apache/brooklyn/rest/domain/HasId.java  |   26 +
 .../apache/brooklyn/rest/domain/HasName.java    |   26 +
 .../rest/domain/HighAvailabilitySummary.java    |  144 +
 .../brooklyn/rest/domain/LinkWithMetadata.java  |   88 +
 .../rest/domain/LocationConfigSummary.java      |   64 +
 .../brooklyn/rest/domain/LocationSpec.java      |   96 +
 .../brooklyn/rest/domain/LocationSummary.java   |   96 +
 .../rest/domain/PolicyConfigSummary.java        |   60 +
 .../brooklyn/rest/domain/PolicySummary.java     |  108 +
 .../rest/domain/ScriptExecutionSummary.java     |   67 +
 .../brooklyn/rest/domain/SensorSummary.java     |  107 +
 .../org/apache/brooklyn/rest/domain/Status.java |   33 +
 .../rest/domain/SummaryComparators.java         |   82 +
 .../brooklyn/rest/domain/TaskSummary.java       |  231 ++
 .../brooklyn/rest/domain/UsageStatistic.java    |  123 +
 .../brooklyn/rest/domain/UsageStatistics.java   |   76 +
 .../brooklyn/rest/domain/VersionSummary.java    |   80 +
 rest/rest-api/src/main/webapp/WEB-INF/web.xml   |  121 +
 .../brooklyn/rest/domain/ApiErrorTest.java      |   63 +
 .../rest/domain/ApplicationSpecTest.java        |   53 +
 .../rest/domain/EffectorSummaryTest.java        |   53 +
 .../brooklyn/rest/domain/EntitySpecTest.java    |   50 +
 .../brooklyn/rest/domain/EntitySummaryTest.java |   61 +
 .../brooklyn/rest/domain/LocationSpecTest.java  |   58 +
 .../rest/domain/VersionSummaryTest.java         |   62 +
 .../brooklyn/rest/util/RestApiTestUtils.java    |   57 +
 .../resources/fixtures/api-error-basic.json     |    4 +
 .../fixtures/api-error-no-details.json          |    3 +
 .../resources/fixtures/application-list.json    |   44 +
 .../resources/fixtures/application-spec.json    |   16 +
 .../resources/fixtures/application-tree.json    |   43 +
 .../test/resources/fixtures/application.json    |   22 +
 .../fixtures/catalog-application-list.json      |   29 +
 .../resources/fixtures/catalog-application.json |    9 +
 .../fixtures/effector-summary-list.json         |   47 +
 .../resources/fixtures/effector-summary.json    |    9 +
 .../resources/fixtures/entity-only-type.json    |    3 +
 .../resources/fixtures/entity-summary-list.json |   14 +
 .../test/resources/fixtures/entity-summary.json |   13 +
 .../src/test/resources/fixtures/entity.json     |    7 +
 .../src/test/resources/fixtures/ha-summary.json |   19 +
 .../test/resources/fixtures/location-list.json  |   10 +
 .../resources/fixtures/location-summary.json    |    8 +
 .../fixtures/location-without-credential.json   |    5 +
 .../src/test/resources/fixtures/location.json   |    4 +
 .../fixtures/sensor-current-state.json          |    6 +
 .../resources/fixtures/sensor-summary-list.json |   42 +
 .../test/resources/fixtures/sensor-summary.json |    8 +
 .../test/resources/fixtures/server-version.json |   14 +
 .../test/resources/fixtures/service-state.json  |    1 +
 .../resources/fixtures/task-summary-list.json   |   15 +
 rest/rest-client/pom.xml                        |  149 +
 .../brooklyn/rest/client/BrooklynApi.java       |  395 +++
 .../util/http/BuiltResponsePreservingError.java |   79 +
 .../ApplicationResourceIntegrationTest.java     |  190 ++
 .../rest/client/BrooklynApiRestClientTest.java  |  153 +
 .../src/test/resources/catalog/test-catalog.bom |   33 +
 .../rest-client/src/test/webapp/WEB-INF/web.xml |  129 +
 rest/rest-server/pom.xml                        |  303 ++
 .../apache/brooklyn/rest/BrooklynRestApi.java   |   89 +
 .../apache/brooklyn/rest/BrooklynWebConfig.java |  158 +
 .../BrooklynPropertiesSecurityFilter.java       |  175 +
 .../rest/filter/HaHotCheckResourceFilter.java   |  150 +
 .../rest/filter/HaHotStateRequired.java         |   36 +
 .../rest/filter/HaMasterCheckFilter.java        |  139 +
 .../brooklyn/rest/filter/LoggingFilter.java     |  160 +
 .../brooklyn/rest/filter/NoCacheFilter.java     |   40 +
 .../rest/filter/RequestTaggingFilter.java       |   63 +
 .../brooklyn/rest/filter/SwaggerFilter.java     |   76 +
 .../resources/AbstractBrooklynRestResource.java |  151 +
 .../brooklyn/rest/resources/AccessResource.java |   46 +
 .../rest/resources/ActivityResource.java        |   67 +
 .../brooklyn/rest/resources/ApidocResource.java |   31 +
 .../rest/resources/ApplicationResource.java     |  480 +++
 .../rest/resources/CatalogResource.java         |  521 +++
 .../rest/resources/EffectorResource.java        |  114 +
 .../rest/resources/EntityConfigResource.java    |  171 +
 .../brooklyn/rest/resources/EntityResource.java |  223 ++
 .../rest/resources/LocationResource.java        |  184 +
 .../rest/resources/PolicyConfigResource.java    |  108 +
 .../brooklyn/rest/resources/PolicyResource.java |  131 +
 .../brooklyn/rest/resources/ScriptResource.java |  102 +
 .../brooklyn/rest/resources/SensorResource.java |  149 +
 .../brooklyn/rest/resources/ServerResource.java |  495 +++
 .../brooklyn/rest/resources/UsageResource.java  |  256 ++
 .../rest/resources/VersionResource.java         |   32 +
 .../brooklyn/rest/security/PasswordHasher.java  |   32 +
 .../provider/AbstractSecurityProvider.java      |   56 +
 .../provider/AnyoneSecurityProvider.java        |   40 +
 .../provider/BlackholeSecurityProvider.java     |   40 +
 ...nUserWithRandomPasswordSecurityProvider.java |   73 +
 .../provider/DelegatingSecurityProvider.java    |  166 +
 .../provider/ExplicitUsersSecurityProvider.java |  118 +
 .../security/provider/LdapSecurityProvider.java |  132 +
 .../security/provider/SecurityProvider.java     |   35 +
 .../rest/transform/AccessTransformer.java       |   39 +
 .../rest/transform/ApplicationTransformer.java  |  116 +
 .../transform/BrooklynFeatureTransformer.java   |   45 +
 .../rest/transform/CatalogTransformer.java      |  192 ++
 .../rest/transform/EffectorTransformer.java     |   85 +
 .../rest/transform/EntityTransformer.java       |  165 +
 .../transform/HighAvailabilityTransformer.java  |   50 +
 .../rest/transform/LocationTransformer.java     |  193 ++
 .../rest/transform/PolicyTransformer.java       |   83 +
 .../rest/transform/SensorTransformer.java       |   84 +
 .../rest/transform/TaskTransformer.java         |  146 +
 .../rest/util/BrooklynRestResourceUtils.java    |  608 ++++
 .../rest/util/DefaultExceptionMapper.java       |  104 +
 .../brooklyn/rest/util/EntityLocationUtils.java |   85 +
 .../brooklyn/rest/util/FormMapProvider.java     |   81 +
 .../rest/util/ManagementContextProvider.java    |   33 +
 .../apache/brooklyn/rest/util/OsgiCompat.java   |   46 +
 .../brooklyn/rest/util/ShutdownHandler.java     |   23 +
 .../rest/util/ShutdownHandlerProvider.java      |   30 +
 .../brooklyn/rest/util/URLParamEncoder.java     |   27 +
 .../brooklyn/rest/util/WebResourceUtils.java    |  161 +
 .../rest/util/json/BidiSerialization.java       |  174 +
 .../util/json/BrooklynJacksonJsonProvider.java  |  170 +
 .../json/ConfigurableSerializerProvider.java    |   93 +
 .../ErrorAndToStringUnknownTypeSerializer.java  |  124 +
 .../rest/util/json/MultimapSerializer.java      |   62 +
 ...StrictPreferringFieldsVisibilityChecker.java |  107 +
 .../main/resources/build-metadata.properties    |   18 +
 .../src/main/resources/not-a-jar-file.txt       |   18 +
 .../src/main/resources/reset-catalog.xml        |   37 +
 .../rest-server/src/main/webapp/WEB-INF/web.xml |  137 +
 .../BrooklynPropertiesSecurityFilterTest.java   |  151 +
 .../brooklyn/rest/BrooklynRestApiLauncher.java  |  476 +++
 .../rest/BrooklynRestApiLauncherTest.java       |   77 +
 .../BrooklynRestApiLauncherTestFixture.java     |  110 +
 .../apache/brooklyn/rest/HaHotCheckTest.java    |  129 +
 .../brooklyn/rest/HaMasterCheckFilterTest.java  |  218 ++
 .../brooklyn/rest/domain/ApplicationTest.java   |   92 +
 .../rest/domain/LocationSummaryTest.java        |   55 +
 .../brooklyn/rest/domain/SensorSummaryTest.java |  101 +
 .../rest/resources/AccessResourceTest.java      |   68 +
 .../rest/resources/ApidocResourceTest.java      |  177 +
 .../ApplicationResourceIntegrationTest.java     |  133 +
 .../rest/resources/ApplicationResourceTest.java |  694 ++++
 .../rest/resources/CatalogResetTest.java        |  113 +
 .../rest/resources/CatalogResourceTest.java     |  512 +++
 .../rest/resources/DelegatingPrintStream.java   |  183 +
 .../rest/resources/DescendantsTest.java         |  132 +
 .../resources/EntityConfigResourceTest.java     |  172 +
 .../rest/resources/EntityResourceTest.java      |  189 ++
 .../rest/resources/ErrorResponseTest.java       |   98 +
 .../rest/resources/LocationResourceTest.java    |  189 ++
 .../rest/resources/PolicyResourceTest.java      |  145 +
 .../rest/resources/ScriptResourceTest.java      |   54 +
 .../SensorResourceIntegrationTest.java          |   82 +
 .../rest/resources/SensorResourceTest.java      |  271 ++
 .../ServerResourceIntegrationTest.java          |  125 +
 .../rest/resources/ServerResourceTest.java      |  168 +
 .../rest/resources/ServerShutdownTest.java      |  185 +
 .../rest/resources/UsageResourceTest.java       |  443 +++
 .../rest/resources/VersionResourceTest.java     |   52 +
 .../rest/security/PasswordHasherTest.java       |   37 +
 .../security/provider/TestSecurityProvider.java |   46 +
 .../test/config/render/TestRendererHints.java   |   36 +
 .../brooklynnode/DeployBlueprintTest.java       |   89 +
 .../rest/testing/BrooklynRestApiTest.java       |  204 ++
 .../rest/testing/BrooklynRestResourceTest.java  |  154 +
 .../rest/testing/mocks/CapitalizePolicy.java    |   33 +
 .../rest/testing/mocks/EverythingGroup.java     |   27 +
 .../rest/testing/mocks/EverythingGroupImpl.java |   32 +
 .../rest/testing/mocks/NameMatcherGroup.java    |   30 +
 .../testing/mocks/NameMatcherGroupImpl.java     |   33 +
 .../rest/testing/mocks/RestMockApp.java         |   24 +
 .../rest/testing/mocks/RestMockAppBuilder.java  |   39 +
 .../testing/mocks/RestMockSimpleEntity.java     |  103 +
 .../testing/mocks/RestMockSimplePolicy.java     |   64 +
 .../util/BrooklynRestResourceUtilsTest.java     |  213 ++
 .../rest/util/EntityLocationUtilsTest.java      |   72 +
 .../rest/util/HaHotStateCheckClassResource.java |   38 +
 .../rest/util/HaHotStateCheckResource.java      |   44 +
 .../rest/util/NoOpRecordingShutdownHandler.java |   39 +
 .../util/NullHttpServletRequestProvider.java    |   46 +
 .../rest/util/NullServletConfigProvider.java    |   51 +
 .../util/ServerStoppingShutdownHandler.java     |   75 +
 .../json/BrooklynJacksonSerializerTest.java     |  399 +++
 .../src/test/resources/brooklyn-test-logo.jpg   |  Bin 0 -> 6986 bytes
 .../resources/brooklyn/scanning.catalog.bom     |   19 +
 server-cli/README.md                            |   89 +
 server-cli/pom.xml                              |  206 ++
 .../org/apache/brooklyn/cli/AbstractMain.java   |  283 ++
 .../org/apache/brooklyn/cli/CloudExplorer.java  |  380 +++
 .../org/apache/brooklyn/cli/ItemLister.java     |  271 ++
 .../main/java/org/apache/brooklyn/cli/Main.java |  993 ++++++
 .../apache/brooklyn/cli/lister/ClassFinder.java |  152 +
 .../brooklyn/cli/lister/ItemDescriptors.java    |  172 +
 server-cli/src/main/license/README.md           |    7 +
 server-cli/src/main/license/files/DISCLAIMER    |    8 +
 server-cli/src/main/license/files/LICENSE       |  242 ++
 server-cli/src/main/license/files/NOTICE        |    5 +
 .../src/main/license/source-inclusions.yaml     |   24 +
 .../main/resources/brooklyn/default.catalog.bom |  365 ++
 .../statics/brooklyn-object-list.html           |  147 +
 .../brooklyn/item-lister/statics/common.js      |   94 +
 .../brooklyn/item-lister/statics/items.css      |  153 +
 .../statics/style/js/catalog/typeahead.js       |  727 ++++
 .../statics/style/js/underscore-min.js          |    6 +
 .../statics/style/js/underscore-min.map         |    1 +
 .../item-lister/templates/enricher.html         |   59 +
 .../brooklyn/item-lister/templates/entity.html  |   66 +
 .../item-lister/templates/location.html         |   62 +
 .../brooklyn/item-lister/templates/policy.html  |   59 +
 .../java/org/apache/brooklyn/cli/CliTest.java   |  631 ++++
 .../brooklyn/cli/CloudExplorerLiveTest.java     |  209 ++
 server-cli/src/test/license/files/DISCLAIMER    |    8 +
 server-cli/src/test/license/files/LICENSE       |  175 +
 server-cli/src/test/license/files/NOTICE        |    5 +
 .../src/test/resources/ExampleAppInFile.groovy  |   22 +
 .../resources/example-app-app-location.yaml     |   23 +
 .../resources/example-app-entity-location.yaml  |   23 +
 .../test/resources/example-app-no-location.yaml |   22 +
 software/base/pom.xml                           |  213 ++
 .../entity/brooklynnode/BrooklynCluster.java    |   70 +
 .../brooklynnode/BrooklynClusterImpl.java       |  115 +
 .../brooklynnode/BrooklynEntityMirror.java      |   67 +
 .../brooklynnode/BrooklynEntityMirrorImpl.java  |  194 ++
 .../entity/brooklynnode/BrooklynNode.java       |  312 ++
 .../entity/brooklynnode/BrooklynNodeDriver.java |   27 +
 .../entity/brooklynnode/BrooklynNodeImpl.java   |  528 +++
 .../brooklynnode/BrooklynNodeSshDriver.java     |  413 +++
 .../entity/brooklynnode/EntityHttpClient.java   |   93 +
 .../brooklynnode/EntityHttpClientImpl.java      |  162 +
 .../entity/brooklynnode/LocalBrooklynNode.java  |   37 +
 .../brooklynnode/LocalBrooklynNodeImpl.java     |   48 +
 .../brooklynnode/RemoteEffectorBuilder.java     |   84 +
 .../BrooklynClusterUpgradeEffectorBody.java     |  206 ++
 .../BrooklynNodeUpgradeEffectorBody.java        |  229 ++
 .../effector/SelectMasterEffectorBody.java      |  174 +
 .../SetHighAvailabilityModeEffectorBody.java    |   63 +
 ...SetHighAvailabilityPriorityEffectorBody.java |   54 +
 .../brooklyn/entity/chef/ChefAttributeFeed.java |  410 +++
 .../entity/chef/ChefAttributePollConfig.java    |   53 +
 .../brooklyn/entity/chef/ChefBashCommands.java  |   42 +
 .../apache/brooklyn/entity/chef/ChefConfig.java |   98 +
 .../brooklyn/entity/chef/ChefConfigs.java       |  102 +
 .../apache/brooklyn/entity/chef/ChefEntity.java |   26 +
 .../brooklyn/entity/chef/ChefEntityImpl.java    |   38 +
 .../entity/chef/ChefLifecycleEffectorTasks.java |  361 ++
 .../brooklyn/entity/chef/ChefServerTasks.java   |   97 +
 .../brooklyn/entity/chef/ChefSoloDriver.java    |   85 +
 .../brooklyn/entity/chef/ChefSoloTasks.java     |   70 +
 .../apache/brooklyn/entity/chef/ChefTasks.java  |  153 +
 .../entity/chef/KnifeConvergeTaskFactory.java   |  246 ++
 .../brooklyn/entity/chef/KnifeTaskFactory.java  |  240 ++
 .../brooklyn/entity/java/JavaAppUtils.java      |  263 ++
 .../brooklyn/entity/java/JavaEntityMethods.java |   30 +
 .../entity/java/JavaSoftwareProcessDriver.java  |   30 +
 .../java/JavaSoftwareProcessSshDriver.java      |  443 +++
 .../entity/java/JmxAttributeSensor.java         |  121 +
 .../apache/brooklyn/entity/java/JmxSupport.java |  357 ++
 .../brooklyn/entity/java/JmxmpSslSupport.java   |  134 +
 .../apache/brooklyn/entity/java/UsesJava.java   |   68 +
 .../brooklyn/entity/java/UsesJavaMXBeans.java   |   77 +
 .../apache/brooklyn/entity/java/UsesJmx.java    |  190 ++
 .../brooklyn/entity/java/VanillaJavaApp.java    |   77 +
 .../entity/java/VanillaJavaAppDriver.java       |   26 +
 .../entity/java/VanillaJavaAppImpl.java         |  112 +
 .../entity/java/VanillaJavaAppSshDriver.java    |  211 ++
 .../entity/machine/MachineAttributes.java       |   87 +
 .../brooklyn/entity/machine/MachineEntity.java  |   59 +
 .../entity/machine/MachineEntityImpl.java       |  186 ++
 .../entity/machine/MachineInitTasks.java        |  228 ++
 .../machine/ProvidesProvisioningFlags.java      |   35 +
 .../entity/machine/SetHostnameCustomizer.java   |  233 ++
 .../entity/machine/pool/ServerPool.java         |  109 +
 .../entity/machine/pool/ServerPoolImpl.java     |  432 +++
 .../entity/machine/pool/ServerPoolLocation.java |   80 +
 .../pool/ServerPoolLocationResolver.java        |  138 +
 .../entity/resolve/ChefEntitySpecResolver.java  |   42 +
 .../HardcodedCatalogEntitySpecResolver.java     |   96 +
 .../base/AbstractSoftwareProcessDriver.java     |  514 +++
 .../base/AbstractSoftwareProcessSshDriver.java  |  666 ++++
 .../AbstractSoftwareProcessWinRmDriver.java     |  315 ++
 .../software/base/AbstractVanillaProcess.java   |   35 +
 .../software/base/EmptySoftwareProcess.java     |   32 +
 .../base/EmptySoftwareProcessDriver.java        |   22 +
 .../software/base/EmptySoftwareProcessImpl.java |   49 +
 .../base/EmptySoftwareProcessSshDriver.java     |   83 +
 .../software/base/EmptyWindowsProcess.java      |   38 +
 .../base/EmptyWindowsProcessDriver.java         |   22 +
 .../software/base/EmptyWindowsProcessImpl.java  |   49 +
 .../base/EmptyWindowsProcessWinRmDriver.java    |   97 +
 .../entity/software/base/InboundPortsUtils.java |   98 +
 .../SameServerDriverLifecycleEffectorTasks.java |  155 +
 .../entity/software/base/SameServerEntity.java  |   78 +
 .../software/base/SameServerEntityImpl.java     |  133 +
 .../entity/software/base/SoftwareProcess.java   |  377 +++
 .../software/base/SoftwareProcessDriver.java    |   75 +
 ...wareProcessDriverLifecycleEffectorTasks.java |  262 ++
 .../software/base/SoftwareProcessImpl.java      |  645 ++++
 .../software/base/VanillaSoftwareProcess.java   |   62 +
 .../base/VanillaSoftwareProcessDriver.java      |   23 +
 .../base/VanillaSoftwareProcessImpl.java        |   37 +
 .../base/VanillaSoftwareProcessSshDriver.java   |  190 ++
 .../software/base/VanillaWindowsProcess.java    |  107 +
 .../base/VanillaWindowsProcessDriver.java       |   23 +
 .../base/VanillaWindowsProcessImpl.java         |   47 +
 .../base/VanillaWindowsProcessWinRmDriver.java  |   99 +
 .../MachineLifecycleEffectorTasks.java          |  970 ++++++
 .../base/lifecycle/NaiveScriptRunner.java       |   43 +
 .../lifecycle/NativeWindowsScriptRunner.java    |   29 +
 .../software/base/lifecycle/ScriptHelper.java   |  436 +++
 .../software/base/lifecycle/ScriptPart.java     |   82 +
 .../base/lifecycle/WinRmExecuteHelper.java      |  217 ++
 .../system_service/EntityLaunchListener.java    |  111 +
 .../system_service/InitdServiceInstaller.java   |  135 +
 .../system_service/SystemServiceEnricher.java   |  142 +
 .../system_service/SystemServiceInstaller.java  |   25 +
 .../SystemServiceInstallerFactory.java          |   28 +
 .../feed/jmx/JmxAttributePollConfig.java        |   74 +
 .../org/apache/brooklyn/feed/jmx/JmxFeed.java   |  423 +++
 .../org/apache/brooklyn/feed/jmx/JmxHelper.java |  724 ++++
 .../feed/jmx/JmxNotificationFilters.java        |   64 +
 .../jmx/JmxNotificationSubscriptionConfig.java  |   95 +
 .../feed/jmx/JmxOperationPollConfig.java        |  121 +
 .../brooklyn/feed/jmx/JmxValueFunctions.java    |  136 +
 ...pache.brooklyn.api.location.LocationResolver |   19 +
 ...oklyn.core.resolve.entity.EntitySpecResolver |   20 +
 .../entity/brooklynnode/brooklyn-cluster.yaml   |   33 +
 .../brooklyn-node-persisting-to-tmp.yaml        |   27 +
 .../entity/brooklynnode/brooklyn-node.yaml      |   35 +
 .../brooklyn/entity/system_service/service.sh   |   51 +
 .../brooklyn/entity/AbstractEc2LiveTest.java    |  181 +
 .../entity/AbstractGoogleComputeLiveTest.java   |  137 +
 .../entity/AbstractSoftlayerLiveTest.java       |  115 +
 .../BrooklynClusterIntegrationTest.java         |   97 +
 .../BrooklynNodeIntegrationTest.java            |  711 ++++
 .../entity/brooklynnode/BrooklynNodeTest.java   |  137 +
 .../brooklynnode/CallbackEntityHttpClient.java  |   99 +
 .../entity/brooklynnode/MockBrooklynNode.java   |   72 +
 .../brooklynnode/SameBrooklynNodeImpl.java      |   97 +
 .../brooklynnode/SelectMasterEffectorTest.java  |  259 ++
 .../brooklyn/entity/chef/ChefConfigsTest.java   |   52 +
 .../entity/chef/ChefLiveTestSupport.java        |   99 +
 .../chef/ChefServerTasksIntegrationTest.java    |  126 +
 .../AbstractChefToyMySqlEntityLiveTest.java     |   40 +
 .../ChefSoloDriverMySqlEntityLiveTest.java      |   49 +
 .../mysql/ChefSoloDriverToyMySqlEntity.java     |   89 +
 ...micChefAutodetectToyMySqlEntityLiveTest.java |   43 +
 ...DynamicChefServerToyMySqlEntityLiveTest.java |   50 +
 .../DynamicChefSoloToyMySqlEntityLiveTest.java  |   43 +
 .../chef/mysql/DynamicToyMySqlEntityChef.java   |   81 +
 .../chef/mysql/TypedToyMySqlEntityChef.java     |   55 +
 .../brooklyn/entity/java/EntityPollingTest.java |  206 ++
 .../entity/java/ExampleVanillaMain.java         |   26 +
 .../java/ExampleVanillaMainCpuHungry.java       |   41 +
 .../brooklyn/entity/java/JavaOptsTest.java      |  356 ++
 ...SoftwareProcessSshDriverIntegrationTest.java |  173 +
 .../brooklyn/entity/java/JmxSupportTest.java    |  135 +
 .../brooklyn/entity/java/SslKeyConfigTest.java  |   53 +
 .../entity/java/VanillaJavaAppRebindTest.java   |  171 +
 .../entity/java/VanillaJavaAppTest.java         |  352 ++
 .../machine/MachineEntityEc2LiveTest.java       |   57 +
 .../entity/machine/MachineEntityRebindTest.java |   44 +
 .../machine/SetHostnameCustomizerLiveTest.java  |  143 +
 .../machine/SetHostnameCustomizerTest.java      |  157 +
 .../machine/pool/AbstractServerPoolTest.java    |  145 +
 .../entity/machine/pool/ServerPoolLiveTest.java |   97 +
 .../pool/ServerPoolLocationResolverTest.java    |   90 +
 .../machine/pool/ServerPoolRebindTest.java      |  109 +
 .../entity/machine/pool/ServerPoolTest.java     |  175 +
 .../software/base/AbstractDockerLiveTest.java   |   99 +
 ...ctSoftwareProcessRestartIntegrationTest.java |   96 +
 .../AbstractSoftwareProcessStreamsTest.java     |  105 +
 .../software/base/DoNothingSoftwareProcess.java |   32 +
 .../base/DoNothingSoftwareProcessDriver.java    |   69 +
 .../base/DoNothingSoftwareProcessImpl.java      |   38 +
 .../DoNothingWinRmSoftwareProcessDriver.java    |   68 +
 .../entity/software/base/EntitySshToolTest.java |  107 +
 ...eServerDriverLifecycleEffectorTasksTest.java |  124 +
 .../software/base/SameServerEntityTest.java     |   82 +
 .../software/base/SoftwareEffectorTest.java     |  141 +
 .../base/SoftwareProcessEntityLatchTest.java    |  161 +
 .../base/SoftwareProcessEntityRebindTest.java   |  177 +
 .../base/SoftwareProcessEntityTest.java         |  816 +++++
 ...twareProcessOpenIptablesStreamsLiveTest.java |  113 +
 ...SoftwareProcessSshDriverIntegrationTest.java |  389 +++
 .../base/SoftwareProcessSubclassTest.java       |  169 +
 ...ftwareProcessAndChildrenIntegrationTest.java |  194 ++
 .../VanillaSoftwareProcessIntegrationTest.java  |  209 ++
 ...laSoftwareProcessStreamsIntegrationTest.java |   70 +
 ...laWindowsProcessWinrmExitStatusLiveTest.java |  291 ++
 ...nillaWindowsProcessWinrmStreamsLiveTest.java |  133 +
 .../MachineLifecycleEffectorTasksTest.java      |  147 +
 .../software/base/lifecycle/MyEntity.java       |   27 +
 .../software/base/lifecycle/MyEntityApp.java    |   26 +
 .../software/base/lifecycle/MyEntityImpl.java   |  125 +
 .../base/lifecycle/NaiveScriptRunnerTest.java   |  254 ++
 .../base/lifecycle/ScriptHelperTest.java        |  157 +
 .../base/lifecycle/ScriptHelperUnitTest.java    |  146 +
 .../base/lifecycle/StartStopSshDriverTest.java  |  168 +
 .../lifecycle/WinRmExecuteHelperUnitTest.java   |   62 +
 .../AutoScalerPolicyNoMoreMachinesTest.java     |  214 ++
 .../usage/ApplicationUsageTrackingTest.java     |  180 +
 .../mgmt/usage/LocationUsageTrackingTest.java   |  172 +
 .../core/mgmt/usage/RecordingUsageListener.java |   68 +
 .../test/core/mgmt/usage/UsageListenerTest.java |  107 +
 .../base/test/driver/MockSshDriver.java         |   72 +
 ...rWithAvailabilityZonesMultiLocationTest.java |  115 +
 .../base/test/jmx/GeneralisedDynamicMBean.java  |  146 +
 .../software/base/test/jmx/JmxService.java      |  176 +
 .../location/MachineDetailsEc2LiveTest.java     |   70 +
 .../MachineDetailsGoogleComputeLiveTest.java    |   67 +
 .../location/WinRmMachineLocationLiveTest.java  |  601 ++++
 .../base/test/location/WindowsTestFixture.java  |   78 +
 .../test/mysql/AbstractToyMySqlEntityTest.java  |  107 +
 .../mysql/DynamicToyMySqlEntityBuilder.java     |  185 +
 .../test/mysql/DynamicToyMySqlEntityTest.java   |   58 +
 .../PortAttributeSensorAndConfigKeyTest.java    |   86 +
 .../SystemServiceEnricherTest.java              |   95 +
 .../apache/brooklyn/feed/jmx/JmxFeedTest.java   |  420 +++
 .../apache/brooklyn/feed/jmx/JmxHelperTest.java |  312 ++
 .../feed/jmx/JmxValueFunctionsTest.java         |  120 +
 .../brooklyn/feed/jmx/RebindJmxFeedTest.java    |  148 +
 .../brooklyn-tests.pem                          |   27 +
 .../brooklyn-validator.pem                      |   27 +
 .../hosted-chef-brooklyn-credentials/knife.rb   |   27 +
 .../brooklyn/entity/software/base/frogs.txt     |   27 +
 .../brooklyn/entity/software/base/template.yaml |   23 +
 .../base/template_with_extra_substitutions.txt  |   18 +
 software/winrm/pom.xml                          |   65 +
 .../WindowsPerformanceCounterSensors.java       |   73 +
 .../windows/WindowsPerformanceCounterFeed.java  |  414 +++
 .../winrm/AdvertiseWinrmLoginPolicy.java        |   80 +
 .../location/winrm/WinRmMachineLocation.java    |  428 +++
 .../core/internal/winrm/WinRmException.java     |   32 +
 .../util/core/internal/winrm/WinRmTool.java     |   83 +
 .../core/internal/winrm/WinRmToolResponse.java  |   46 +
 .../internal/winrm/winrm4j/Winrm4jTool.java     |  215 ++
 .../WindowsPerformanceCounterFeedLiveTest.java  |  101 +
 .../WindowsPerformanceCounterFeedTest.java      |  129 +
 .../winrm/AdvertiseWinrmLoginPolicyTest.java    |   49 +
 .../winrm/ByonLocationResolverTest.java         |   95 +
 .../winrm/WinRmMachineLocationTest.java         |   43 +
 storage/hazelcast/pom.xml                       |   88 +
 .../storage/impl/hazelcast/EntityId.java        |   36 +
 .../impl/hazelcast/EntityStreamSerializer.java  |   68 +
 .../impl/hazelcast/HazelcastDataGrid.java       |   89 +
 .../hazelcast/HazelcastDataGridFactory.java     |   42 +
 .../impl/hazelcast/HazelcastStorageTest.java    |  107 +
 test-framework/pom.xml                          |   96 +
 .../brooklyn/test/framework/BaseTest.java       |   49 +
 .../InfrastructureDeploymentTestCase.java       |   57 +
 .../InfrastructureDeploymentTestCaseImpl.java   |   93 +
 .../framework/LoopOverGroupMembersTestCase.java |   45 +
 .../LoopOverGroupMembersTestCaseImpl.java       |  134 +
 .../test/framework/ParallelTestCase.java        |   30 +
 .../test/framework/ParallelTestCaseImpl.java    |  142 +
 .../test/framework/SimpleShellCommandTest.java  |  100 +
 .../framework/SimpleShellCommandTestImpl.java   |  258 ++
 .../test/framework/TargetableTestComponent.java |   53 +
 .../framework/TargetableTestComponentImpl.java  |   83 +
 .../brooklyn/test/framework/TestCase.java       |   30 +
 .../brooklyn/test/framework/TestCaseImpl.java   |   89 +
 .../brooklyn/test/framework/TestEffector.java   |   48 +
 .../test/framework/TestEffectorImpl.java        |  116 +
 .../test/framework/TestFrameworkAssertions.java |  265 ++
 .../brooklyn/test/framework/TestHttpCall.java   |   54 +
 .../test/framework/TestHttpCallImpl.java        |  123 +
 .../brooklyn/test/framework/TestSensor.java     |   37 +
 .../brooklyn/test/framework/TestSensorImpl.java |  115 +
 .../InfrastructureDeploymentTestCaseTest.java   |  267 ++
 .../LoopOverGroupMembersTestCaseTest.java       |  286 ++
 .../SimpleShellCommandIntegrationTest.java      |  292 ++
 .../test/framework/TestEffectorTest.java        |  191 ++
 .../framework/TestFrameworkAssertionsTest.java  |  155 +
 .../test/framework/TestHttpCallTest.java        |  122 +
 .../brooklyn/test/framework/TestSensorTest.java |  309 ++
 .../test/framework/entity/TestEntity.java       |   77 +
 .../test/framework/entity/TestEntityImpl.java   |   64 +
 .../framework/entity/TestInfrastructure.java    |   31 +
 .../entity/TestInfrastructureImpl.java          |   46 +
 .../resources/test-framework-examples/README.md |   28 +
 .../example-catalog-test.bom                    |   40 +
 .../test-framework-examples/example-catalog.bom |   33 +
 .../nginx-test-examples.yml                     |  119 +
 .../testhttpcall-examples.yml                   |  151 +
 .../tomcat-test-examples.yml                    |   57 +
 test-support/pom.xml                            |   63 +
 .../apache/brooklyn/test/EntityTestUtils.java   |  193 ++
 .../org/apache/brooklyn/test/HttpTestUtils.java |  396 +++
 .../brooklyn/test/NetworkingTestUtils.java      |   78 +
 .../brooklyn/test/PerformanceTestUtils.java     |   26 +
 .../org/apache/brooklyn/test/TestUtils.java     |   79 +
 .../org/apache/brooklyn/test/WebAppMonitor.java |  213 ++
 .../test/performance/FilePersister.java         |   85 +
 .../brooklyn/test/performance/Histogram.java    |   89 +
 .../performance/MeasurementResultPersister.java |   29 +
 .../test/performance/PerformanceMeasurer.java   |  156 +
 .../performance/PerformanceTestDescriptor.java  |  208 ++
 .../test/performance/PerformanceTestResult.java |   62 +
 .../test/performance/PerformanceTestUtils.java  |  107 +
 utils/common/pom.xml                            |  106 +
 .../brooklyn/config/ConfigInheritance.java      |   50 +
 .../org/apache/brooklyn/config/ConfigKey.java   |  111 +
 .../org/apache/brooklyn/config/ConfigMap.java   |   86 +
 .../apache/brooklyn/config/StringConfigMap.java |   35 +
 .../java/org/apache/brooklyn/test/Asserts.java  | 1350 ++++++++
 .../test/http/TestHttpRequestHandler.java       |   72 +
 .../brooklyn/test/http/TestHttpServer.java      |  150 +
 .../apache/brooklyn/util/CommandLineUtil.java   |   53 +
 .../org/apache/brooklyn/util/GenericTypes.java  |   37 +
 .../brooklyn/util/JavaGroovyEquivalents.java    |  181 +
 .../org/apache/brooklyn/util/ShellUtils.java    |  180 +
 .../util/collections/CollectionFunctionals.java |  263 ++
 .../brooklyn/util/collections/Jsonya.java       |  581 ++++
 .../brooklyn/util/collections/MutableList.java  |  256 ++
 .../brooklyn/util/collections/MutableMap.java   |  253 ++
 .../brooklyn/util/collections/MutableSet.java   |  212 ++
 .../brooklyn/util/collections/QuorumCheck.java  |  236 ++
 .../util/collections/SetFromLiveMap.java        |  141 +
 .../util/collections/TimeWindowedList.java      |  147 +
 .../util/collections/TimestampedValue.java      |   59 +
 .../util/concurrent/CallableFromRunnable.java   |   54 +
 .../util/crypto/AuthorizedKeysParser.java       |  134 +
 .../crypto/SecureKeysWithoutBouncyCastle.java   |  161 +
 .../brooklyn/util/crypto/SslTrustUtils.java     |  100 +
 .../util/crypto/TrustingSslSocketFactory.java   |  105 +
 .../exceptions/CompoundRuntimeException.java    |   59 +
 .../brooklyn/util/exceptions/Exceptions.java    |  347 ++
 .../FatalConfigurationRuntimeException.java     |   33 +
 .../util/exceptions/FatalRuntimeException.java  |   34 +
 .../util/exceptions/NotManagedException.java    |   36 +
 .../exceptions/PropagatedRuntimeException.java  |   76 +
 .../util/exceptions/ReferenceWithError.java     |  101 +
 .../exceptions/RuntimeInterruptedException.java |   50 +
 .../exceptions/RuntimeTimeoutException.java     |   36 +
 .../util/exceptions/UserFacingException.java    |   39 +
 .../apache/brooklyn/util/git/GithubUrls.java    |   42 +
 .../apache/brooklyn/util/guava/Functionals.java |  151 +
 .../apache/brooklyn/util/guava/IfFunctions.java |  158 +
 .../guava/IllegalStateExceptionSupplier.java    |   55 +
 .../util/guava/KeyTransformingLoadingCache.java |  152 +
 .../org/apache/brooklyn/util/guava/Maybe.java   |  376 +++
 .../brooklyn/util/guava/MaybeFunctions.java     |   98 +
 .../util/guava/PredicateWithContext.java        |   33 +
 .../util/guava/SerializablePredicate.java       |   26 +
 .../apache/brooklyn/util/guava/TypeTokens.java  |   72 +
 .../apache/brooklyn/util/http/HttpAsserts.java  |  341 ++
 .../org/apache/brooklyn/util/http/HttpTool.java |  528 +++
 .../brooklyn/util/http/HttpToolResponse.java    |  186 ++
 .../util/http/TrustingSslSocketFactory.java     |  134 +
 .../internal/BasicDelegatingSystemProperty.java |   36 +
 .../util/internal/BooleanSystemProperty.java    |   29 +
 .../util/internal/BrooklynSystemProperties.java |   40 +
 .../util/internal/DoubleSystemProperty.java     |   28 +
 .../util/internal/IntegerSystemProperty.java    |   28 +
 .../util/internal/StringSystemProperty.java     |   50 +
 .../brooklyn/util/io/FilePermissions.java       |   93 +
 .../org/apache/brooklyn/util/io/FileUtil.java   |  187 ++
 .../util/javalang/AggregateClassLoader.java     |  173 +
 .../util/javalang/AtomicReferences.java         |   48 +
 .../apache/brooklyn/util/javalang/Boxing.java   |  102 +
 .../apache/brooklyn/util/javalang/Enums.java    |  170 +
 .../apache/brooklyn/util/javalang/Equals.java   |   93 +
 .../brooklyn/util/javalang/JavaClassNames.java  |  162 +
 .../util/javalang/LoadedClassLoader.java        |   44 +
 .../util/javalang/MemoryUsageTracker.java       |   72 +
 .../brooklyn/util/javalang/Reflections.java     |  829 +++++
 .../brooklyn/util/javalang/Serializers.java     |  121 +
 .../util/javalang/StackTraceSimplifier.java     |  202 ++
 .../apache/brooklyn/util/javalang/Threads.java  |   61 +
 .../brooklyn/util/logging/LoggingSetup.java     |   39 +
 .../util/logging/SimpleOneLineLogFormatter.java |  140 +
 .../org/apache/brooklyn/util/math/BitList.java  |  271 ++
 .../org/apache/brooklyn/util/math/BitUtils.java |   70 +
 .../brooklyn/util/math/MathFunctions.java       |  307 ++
 .../brooklyn/util/math/MathPredicates.java      |  174 +
 .../brooklyn/util/maven/MavenArtifact.java      |  222 ++
 .../brooklyn/util/maven/MavenRetriever.java     |  125 +
 .../java/org/apache/brooklyn/util/net/Cidr.java |  242 ++
 .../brooklyn/util/net/HasNetworkAddresses.java  |   48 +
 .../util/net/NetworkMultiAddressUtils.java      |   79 +
 .../apache/brooklyn/util/net/Networking.java    |  553 +++
 .../org/apache/brooklyn/util/net/Protocol.java  |   38 +
 .../util/net/ReachableSocketFinder.java         |  154 +
 .../brooklyn/util/net/URLParamEncoder.java      |   61 +
 .../java/org/apache/brooklyn/util/net/Urls.java |  246 ++
 .../brooklyn/util/net/UserAndHostAndPort.java   |   84 +
 .../java/org/apache/brooklyn/util/os/Os.java    |  580 ++++
 .../apache/brooklyn/util/pool/BasicPool.java    |  202 ++
 .../org/apache/brooklyn/util/pool/Lease.java    |   29 +
 .../org/apache/brooklyn/util/pool/Pool.java     |   74 +
 .../apache/brooklyn/util/repeat/Repeater.java   |  392 +++
 .../apache/brooklyn/util/ssh/BashCommands.java  |  731 ++++
 .../brooklyn/util/ssh/IptablesCommands.java     |  261 ++
 .../util/stream/DelegatingPrintStream.java      |  174 +
 .../util/stream/IllegalOutputStream.java        |   31 +
 .../util/stream/InputStreamSupplier.java        |   49 +
 .../util/stream/KnownSizeInputStream.java       |  113 +
 .../brooklyn/util/stream/ReaderInputStream.java |  202 ++
 .../brooklyn/util/stream/StreamGobbler.java     |  137 +
 .../apache/brooklyn/util/stream/Streams.java    |  176 +
 .../util/stream/ThreadLocalPrintStream.java     |  137 +
 .../brooklyn/util/text/ByteSizeStrings.java     |  416 +++
 .../brooklyn/util/text/ComparableVersion.java   |   90 +
 .../brooklyn/util/text/FormattedString.java     |   47 +
 .../apache/brooklyn/util/text/Identifiers.java  |  302 ++
 .../brooklyn/util/text/KeyValueParser.java      |  124 +
 .../util/text/NaturalOrderComparator.java       |  179 +
 .../util/text/QuotedStringTokenizer.java        |  196 ++
 .../brooklyn/util/text/StringEscapes.java       |  424 +++
 .../brooklyn/util/text/StringFunctions.java     |  415 +++
 .../brooklyn/util/text/StringPredicates.java    |  310 ++
 .../brooklyn/util/text/StringShortener.java     |  150 +
 .../org/apache/brooklyn/util/text/Strings.java  |  919 +++++
 .../brooklyn/util/text/VersionComparator.java   |  199 ++
 .../brooklyn/util/text/WildcardGlobs.java       |  382 +++
 .../brooklyn/util/time/CountdownTimer.java      |  132 +
 .../org/apache/brooklyn/util/time/Duration.java |  319 ++
 .../apache/brooklyn/util/time/Durations.java    |   70 +
 .../org/apache/brooklyn/util/time/Time.java     |  971 ++++++
 .../org/apache/brooklyn/util/yaml/Yamls.java    |  553 +++
 .../org/apache/brooklyn/test/AssertsTest.java   |  169 +
 .../apache/brooklyn/test/FixedLocaleTest.java   |   49 +
 .../apache/brooklyn/util/HttpAssertsTest.java   |  330 ++
 .../collections/CollectionFunctionalsTest.java  |   82 +
 .../brooklyn/util/collections/JsonyaTest.java   |  193 ++
 .../util/collections/MutableListTest.java       |  124 +
 .../util/collections/MutableMapTest.java        |   60 +
 .../util/collections/MutableSetTest.java        |  123 +
 .../util/collections/QuorumChecksTest.java      |  105 +
 .../util/collections/TimeWindowedListTest.java  |  144 +
 .../util/exceptions/ExceptionsTest.java         |  207 ++
 .../brooklyn/util/guava/FunctionalsTest.java    |   58 +
 .../brooklyn/util/guava/IfFunctionsTest.java    |  106 +
 .../guava/KeyTransformingLoadingCacheTest.java  |  133 +
 .../brooklyn/util/guava/MaybeFunctionsTest.java |   47 +
 .../util/internal/CommandLineUtilTest.java      |   64 +
 .../util/internal/JavaClassNamesCallerTest.java |   45 +
 .../apache/brooklyn/util/io/FileUtilTest.java   |  118 +
 .../brooklyn/util/javalang/BoxingTest.java      |   38 +
 .../brooklyn/util/javalang/EnumsTest.java       |   67 +
 .../util/javalang/JavaClassNamesTest.java       |   76 +
 .../util/javalang/MemoryUsageTrackerTest.java   |   89 +
 .../brooklyn/util/javalang/ReflectionsTest.java |  148 +
 .../util/javalang/StackTraceSimplifierTest.java |   82 +
 .../apache/brooklyn/util/math/BitListTest.java  |  123 +
 .../apache/brooklyn/util/math/BitUtilsTest.java |   50 +
 .../brooklyn/util/math/MathFunctionsTest.java   |   56 +
 .../brooklyn/util/math/MathPredicatesTest.java  |   64 +
 .../brooklyn/util/maven/MavenArtifactTest.java  |  297 ++
 .../org/apache/brooklyn/util/net/CidrTest.java  |  176 +
 .../brooklyn/util/net/NetworkingUtilsTest.java  |  230 ++
 .../util/net/ReachableSocketFinderTest.java     |  165 +
 .../org/apache/brooklyn/util/net/UrlsTest.java  |   84 +
 .../util/net/UserAndHostAndPortTest.java        |   51 +
 .../org/apache/brooklyn/util/os/OsTest.java     |  168 +
 .../brooklyn/util/pool/BasicPoolTest.java       |  199 ++
 .../brooklyn/util/repeat/RepeaterTest.java      |  240 ++
 .../util/ssh/IptablesCommandsFirewalldTest.java |  104 +
 .../brooklyn/util/ssh/IptablesCommandsTest.java |   88 +
 .../brooklyn/util/stream/StreamGobblerTest.java |   90 +
 .../stream/ThreadLocalStdoutStderrTest.java     |   90 +
 .../brooklyn/util/text/ByteSizeStringsTest.java |  164 +
 .../util/text/ComparableVersionTest.java        |   63 +
 .../brooklyn/util/text/IdentifiersTest.java     |  118 +
 .../brooklyn/util/text/KeyValueParserTest.java  |  149 +
 .../util/text/NaturalOrderComparatorTest.java   |   90 +
 .../util/text/QuotedStringTokenizerTest.java    |  111 +
 .../brooklyn/util/text/StringEscapesTest.java   |  118 +
 .../brooklyn/util/text/StringFunctionsTest.java |   96 +
 .../util/text/StringPredicatesTest.java         |   75 +
 .../brooklyn/util/text/StringShortenerTest.java |   65 +
 .../apache/brooklyn/util/text/StringsTest.java  |  362 ++
 .../util/text/VersionComparatorTest.java        |  102 +
 .../brooklyn/util/text/WildcardGlobsTest.java   |  236 ++
 .../brooklyn/util/time/CountdownTimerTest.java  |  102 +
 .../apache/brooklyn/util/time/DurationTest.java |  108 +
 .../org/apache/brooklyn/util/time/TimeTest.java |  346 ++
 .../apache/brooklyn/util/yaml/YamlsTest.java    |  195 ++
 utils/groovy/pom.xml                            |   70 +
 .../util/groovy/FromCallableClosure.java        |   38 +
 .../util/groovy/FromFunctionClosure.java        |   39 +
 .../util/groovy/FromRunnableClosure.java        |   46 +
 .../brooklyn/util/groovy/GroovyJavaMethods.java |  200 ++
 .../brooklyn/util/groovy/PojoTestingFields.java |   28 +
 utils/jmx/jmxmp-ssl-agent/pom.xml               |  157 +
 .../brooklyn/util/jmx/jmxmp/JmxmpAgent.java     |  337 ++
 .../src/main/license/DISCLAIMER.shaded          |    8 +
 .../src/main/license/LICENSE.shaded             |  925 +++++
 .../src/main/license/NOTICE.shaded              |   15 +
 .../util/jmx/jmxmp/JmxmpAgentSslTest.java       |  257 ++
 .../brooklyn/util/jmx/jmxmp/JmxmpClient.java    |   89 +
 utils/jmx/jmxrmi-agent/pom.xml                  |   71 +
 .../brooklyn/util/jmx/jmxrmi/JmxRmiAgent.java   |  190 ++
 .../brooklyn/util/jmx/jmxrmi/JmxRmiClient.java  |   47 +
 utils/rest-swagger/pom.xml                      |  160 +
 .../rest/apidoc/ApiListingResource.java         |  260 ++
 .../rest/apidoc/RestApiResourceScanner.java     |   81 +
 utils/rt-felix/pom.xml                          |   61 +
 .../rt/felix/EmbeddedFelixFramework.java        |  270 ++
 .../brooklyn/rt/felix/ManifestHelper.java       |  103 +
 .../rt/felix/EmbeddedFelixFrameworkTest.java    |  101 +
 utils/rt-osgi/pom.xml                           |   53 +
 .../apache/brooklyn/util/osgi/OsgiUtils.java    |  101 +
 .../brooklyn/util/osgi/VersionedName.java       |   76 +
 .../src/test/dependencies/osgi/README.md        |   33 +
 .../src/test/dependencies/osgi/entities/pom.xml |   84 +
 .../test/osgi/entities/SimpleApplication.java   |   28 +
 .../osgi/entities/SimpleApplicationImpl.java    |   27 +
 .../test/osgi/entities/SimpleEntity.java        |   28 +
 .../test/osgi/entities/SimpleEntityImpl.java    |   26 +
 .../test/osgi/entities/SimpleLocation.java      |   35 +
 .../test/osgi/entities/SimplePolicy.java        |   36 +
 .../apache/brooklyn/test/osgi/entities/icon.gif |  Bin 0 -> 43 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |   82 +
 .../test/osgi/entities/more/MoreEntity.java     |   37 +
 .../test/osgi/entities/more/MoreEntityImpl.java |   43 +
 .../test/osgi/entities/more/MoreLocation.java   |   24 +
 .../test/osgi/entities/more/MorePolicy.java     |   25 +
 .../test/osgi/entities/more/MoreTemplate.java   |   24 +
 .../osgi/more-entities-v2-evil-twin/pom.xml     |   88 +
 .../test/osgi/entities/more/MoreEntity.java     |   37 +
 .../test/osgi/entities/more/MoreEntityImpl.java |   46 +
 .../dependencies/osgi/more-entities-v2/pom.xml  |   88 +
 .../test/osgi/entities/more/MoreEntity.java     |   43 +
 .../test/osgi/entities/more/MoreEntityImpl.java |   46 +
 .../test/osgi/entities/more/MoreLocation.java   |   26 +
 .../test/osgi/entities/more/MorePolicy.java     |   29 +
 .../test/osgi/entities/more/MoreTemplate.java   |   26 +
 .../brooklyn/util/osgi/OsgiTestResources.java   |   74 +
 .../apache/brooklyn/util/osgi/OsgisTest.java    |   39 +
 .../src/test/resources/brooklyn/osgi/README.md  |   25 +
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         |  Bin 0 -> 2055 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |   26 +
 .../osgi/brooklyn-test-osgi-entities.jar        |  Bin 0 -> 14454 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |   26 +
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  |  Bin 0 -> 14964 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |   26 +
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  |  Bin 0 -> 15646 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |   26 +
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar |  Bin 0 -> 13811 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |   26 +
 utils/test-support/pom.xml                      |   55 +
 .../test/support/BrooklynLeakListener.java      |   89 +
 .../test/support/LoggingVerboseReporter.java    |   36 +
 .../support/PlatformTestSelectorListener.java   |   57 +
 .../brooklyn/test/support/StatusListener.java   |  100 +
 .../TestResourceUnavailableException.java       |  141 +
 .../brooklyn/test/support/VerboseReporter.java  |  343 ++
 .../brooklyn/logback-appender-file.xml          |   34 +
 .../src/main/resources/logback-test.xml         |   31 +
 4676 files changed, 340501 insertions(+), 341120 deletions(-)
----------------------------------------------------------------------



[06/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManager.java
deleted file mode 100644
index dd0b1ba..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManager.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 org.apache.brooklyn.core.mgmt.entitlement;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementClass;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.ConfigPredicates;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-public class PerUserEntitlementManager implements EntitlementManager {
-
-    private static final Logger log = LoggerFactory.getLogger(PerUserEntitlementManager.class);
-    
-    public final static String PER_USER_ENTITLEMENTS_CONFIG_PREFIX = Entitlements.ENTITLEMENTS_CONFIG_PREFIX+".perUser";
-    
-    public final static ConfigKey<String> DEFAULT_MANAGER = ConfigKeys.newStringConfigKey(PER_USER_ENTITLEMENTS_CONFIG_PREFIX+
-        ".default", "Default entitlements manager for users without further specification", "minimal");
-    
-    protected final EntitlementManager defaultManager;
-    protected final Map<String,EntitlementManager> perUserManagers = MutableMap.of();
-
-    private final static ThreadLocal<Boolean> ACTIVE = new ThreadLocal<Boolean>();
-    
-    private static EntitlementManager load(BrooklynProperties properties, String type) {
-        if (Boolean.TRUE.equals(ACTIVE.get())) {
-            // prevent infinite loop
-            throw new IllegalStateException("Cannot set "+PerUserEntitlementManager.class.getName()+" within config for itself");
-        }
-        try {
-            ACTIVE.set(true);
-            return Entitlements.load(null, properties, type);
-        } finally {
-            ACTIVE.remove();
-        }
-    }
-    
-    public PerUserEntitlementManager(BrooklynProperties properties) {
-        this(load(properties, properties.getConfig(DEFAULT_MANAGER)));
-        
-        BrooklynProperties users = properties.submap(ConfigPredicates.startingWith(PER_USER_ENTITLEMENTS_CONFIG_PREFIX+"."));
-        for (Map.Entry<ConfigKey<?>,?> key: users.getAllConfig().entrySet()) {
-            if (key.getKey().getName().equals(DEFAULT_MANAGER.getName())) continue;
-            String user = Strings.removeFromStart(key.getKey().getName(), PER_USER_ENTITLEMENTS_CONFIG_PREFIX+".");
-            addUser(user, load(properties, Strings.toString(key.getValue())));
-        }
-        
-        log.info(getClass().getSimpleName()+" created with "+perUserManagers.size()+" user"+Strings.s(perUserManagers)+" and "
-            + "default "+defaultManager+" (users: "+perUserManagers+")");
-    }
-    
-    public PerUserEntitlementManager(EntitlementManager defaultManager) {
-        this.defaultManager = Preconditions.checkNotNull(defaultManager);
-    }
-
-    public void addUser(String user, EntitlementManager managerForThisUser) {
-        perUserManagers.put(Preconditions.checkNotNull(user, "user"), Preconditions.checkNotNull(managerForThisUser, "managerForThisUser"));
-    }
-
-    @Override
-    public <T> boolean isEntitled(EntitlementContext context, EntitlementClass<T> entitlementClass, T entitlementClassArgument) {
-        EntitlementManager entitlementInEffect = null;
-        if (context==null || context.user()==null) {
-            // no user means it is running as an internal process, always has root
-            entitlementInEffect = Entitlements.root(); 
-        } else {
-            if (context!=null) entitlementInEffect = perUserManagers.get(context.user());
-            if (entitlementInEffect==null) entitlementInEffect = defaultManager;
-        }
-        return entitlementInEffect.isEntitled(context, entitlementClass, entitlementClassArgument);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManagerWithDefault.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManagerWithDefault.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManagerWithDefault.java
deleted file mode 100644
index 813cd5f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/PerUserEntitlementManagerWithDefault.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 org.apache.brooklyn.core.mgmt.entitlement;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-
-@Deprecated
-/** @deprecated since 0.7.0 use {@link PerUserEntitlementManager} */
-public class PerUserEntitlementManagerWithDefault extends PerUserEntitlementManager {
-
-    public PerUserEntitlementManagerWithDefault(EntitlementManager defaultManager) {
-        super(defaultManager);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/WebEntitlementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/WebEntitlementContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/WebEntitlementContext.java
deleted file mode 100644
index b41648e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/entitlement/WebEntitlementContext.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 org.apache.brooklyn.core.mgmt.entitlement;
-
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-
-/**
- * Indicates an authenticated web request as the entitlements context;
- * note user may still be null if no authentication was requested
- */
-public class WebEntitlementContext implements EntitlementContext {
-
-    final String user;
-    final String sourceIp;
-    final String requestUri;
-    
-    /**
-     * A mostly-unique identifier for the inbound request, to distinguish
-     * between duplicate requests and for cross-referencing with URIs
-     */
-    final String requestUniqueIdentifier;
-    
-    public WebEntitlementContext(String user, String sourceIp, String requestUri, String requestUniqueIdentifier) {
-        this.user = user;
-        this.sourceIp = sourceIp;
-        this.requestUri = requestUri;
-        this.requestUniqueIdentifier = requestUniqueIdentifier;
-    }
-    
-    @Override public String user() { return user; }
-    public String sourceIp() { return sourceIp; }
-    public String requestUri() { return requestUri; }
-    public String requestUniqueIdentifier() { return requestUniqueIdentifier; }
-
-    @Override
-    public String toString() {
-        return JavaClassNames.simpleClassName(getClass())+"["+user+"@"+sourceIp+":"+requestUniqueIdentifier+"]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BasicMasterChooser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BasicMasterChooser.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BasicMasterChooser.java
deleted file mode 100644
index 9bb2ea1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/BasicMasterChooser.java
+++ /dev/null
@@ -1,203 +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.core.mgmt.ha;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord;
-import org.apache.brooklyn.api.objs.Identifiable;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.text.NaturalOrderComparator;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ComparisonChain;
-import com.google.common.collect.Ordering;
-
-/**
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public abstract class BasicMasterChooser implements MasterChooser {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BasicMasterChooser.class);
-
-    public static class ScoredRecord<T extends Comparable<T>> implements Identifiable, Comparable<ScoredRecord<T>> {
-        String id;
-        ManagementNodeSyncRecord record;
-        T score;
-        
-        @Override
-        public String getId() {
-            return id;
-        }
-
-        @Override
-        public int compareTo(ScoredRecord<T> o) {
-            return score.compareTo(o.score);
-        }
-    }
-    
-    public ManagementNodeSyncRecord choose(ManagementPlaneSyncRecord memento, Duration heartbeatTimeout, String ownNodeId) {
-        if (LOG.isDebugEnabled()) LOG.debug("Choosing new master from "+memento.getManagementNodes());
-        ManagementNodeSyncRecord me = memento.getManagementNodes().get(ownNodeId);
-        if (me==null) {
-            LOG.warn("Management node details not known when choosing new master: "+memento+" / "+ownNodeId);
-            return null;
-        }
-        Long nowIsh = me.getRemoteTimestamp();
-        if (nowIsh==null) {
-            LOG.warn("Management node for self missing timestamp when choosing new master: "+memento);
-            return null;
-        }
-        
-        List<ScoredRecord<?>> contenders = filterHealthy(memento, heartbeatTimeout, nowIsh);
-        
-        if (!contenders.isEmpty()) {
-            return pick(contenders);
-        } else {
-            LOG.info("No valid management node found for choosing new master: contender="+memento.getManagementNodes());
-            return null;
-        }        
-    }
-
-    /** pick the best contender; argument guaranteed to be non-null and non-empty,
-     * filtered for health reasons */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected ManagementNodeSyncRecord pick(List<ScoredRecord<?>> contenders) {
-        ScoredRecord min = null;
-        for (ScoredRecord x: contenders) {
-            if (min==null || x.score.compareTo(min.score)<0) min = x;
-        }
-        return min.record;
-    }
-
-    public static class AlphabeticChooserScore implements Comparable<AlphabeticChooserScore> {
-        long priority;
-        int versionBias;
-        String brooklynVersion;
-        int statePriority;
-        String nodeId;
-        
-        @Override
-        public int compareTo(AlphabeticChooserScore o) {
-            if (o==null) return -1;
-            return ComparisonChain.start()
-                // invert the order where we prefer higher values
-                .compare(o.priority, this.priority)
-                .compare(o.versionBias, this.versionBias)
-                .compare(o.brooklynVersion, this.brooklynVersion, 
-                    Ordering.from(NaturalOrderComparator.INSTANCE).nullsFirst())
-                .compare(o.statePriority, this.statePriority)
-                .compare(this.nodeId, o.nodeId, Ordering.usingToString().nullsLast())
-                .result();
-        }
-    }
-    
-    /** comparator which prefers, in order:
-     * <li> higher explicit priority
-     * <li> non-snapshot Brooklyn version, then any Brooklyn version, and lastly null version 
-     *      (using {@link NaturalOrderComparator} so e.g. v10 > v3.20 > v3.9 )
-     * <li> higher version (null last)
-     * <li> node which reports it's master, hot standby, then standby 
-     * <li> finally (common case): lower (alphabetically) node id
-     */
-    public static class AlphabeticMasterChooser extends BasicMasterChooser {
-        final boolean preferHotStandby;
-        public AlphabeticMasterChooser(boolean preferHotStandby) { this.preferHotStandby = preferHotStandby; }
-        public AlphabeticMasterChooser() { this.preferHotStandby = true; }
-        @Override
-        protected AlphabeticChooserScore score(ManagementNodeSyncRecord contender) {
-            AlphabeticChooserScore score = new AlphabeticChooserScore();
-            score.priority = contender.getPriority()!=null ? contender.getPriority() : 0;
-            score.brooklynVersion = contender.getBrooklynVersion();
-            score.versionBias = contender.getBrooklynVersion()==null ? -2 :
-                contender.getBrooklynVersion().toLowerCase().indexOf("snapshot")>=0 ? -1 :
-                0;
-            if (preferHotStandby) {
-                // other master should be preferred before we get invoked, but including for good measure
-                score.statePriority = contender.getStatus()==ManagementNodeState.MASTER ? 3 :
-                    contender.getStatus()==ManagementNodeState.HOT_STANDBY ? 2 :
-                        contender.getStatus()==ManagementNodeState.STANDBY ? 1 : -1;
-            } else {
-                score.statePriority = 0;
-            }
-            score.nodeId = contender.getNodeId();
-            return score;
-        }
-    }
-    
-    /**
-     * Filters the {@link ManagementPlaneSyncRecord#getManagementNodes()} to only those in an appropriate state, 
-     * and with heartbeats that have not timed out.
-     */
-    protected List<ScoredRecord<?>> filterHealthy(ManagementPlaneSyncRecord memento, Duration heartbeatTimeout, long nowIsh) {
-        long oldestAcceptableTimestamp = nowIsh - heartbeatTimeout.toMilliseconds();
-        List<ScoredRecord<?>> contenders = MutableList.of();
-        for (ManagementNodeSyncRecord contender : memento.getManagementNodes().values()) {
-            boolean statusOk = (contender.getStatus() == ManagementNodeState.STANDBY || contender.getStatus() == ManagementNodeState.HOT_STANDBY || contender.getStatus() == ManagementNodeState.MASTER);
-            Long remoteTimestamp = contender.getRemoteTimestamp();
-            boolean heartbeatOk;
-            if (remoteTimestamp==null) {
-                throw new IllegalStateException("Missing remote timestamp when performing master election: "+this+" / "+contender);
-                // if the above exception happens in some contexts we could either fallback to local, or fail:
-//                remoteTimestamp = contender.getLocalTimestamp();
-                // or
-//                heartbeatOk=false;
-            } else {
-                heartbeatOk = remoteTimestamp >= oldestAcceptableTimestamp;
-            }
-            if (statusOk && heartbeatOk) {
-                contenders.add(newScoredRecord(contender));
-            }
-            if (LOG.isTraceEnabled()) LOG.trace("Filtering choices of new master: contender="+contender+"; statusOk="+statusOk+"; heartbeatOk="+heartbeatOk);
-        }
-        return contenders;
-    }
-
-    @VisibleForTesting
-    //Java 6 compiler workaround, using parameterized types fails
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected List<ScoredRecord<?>> sort(List<ScoredRecord<?>> input) {
-        ArrayList copy = new ArrayList<ScoredRecord<?>>(input);
-        Collections.sort(copy);
-        return copy;
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected ScoredRecord<?> newScoredRecord(ManagementNodeSyncRecord contender) {
-        ScoredRecord r = new ScoredRecord();
-        r.id = contender.getNodeId();
-        r.record = contender;
-        r.score = score(contender);
-        return r;
-    }
-
-    protected abstract Comparable<?> score(ManagementNodeSyncRecord contender);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
deleted file mode 100644
index 7e6868c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
+++ /dev/null
@@ -1,1113 +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.core.mgmt.ha;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityManager;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister;
-import org.apache.brooklyn.api.mgmt.ha.MementoCopyMode;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister.Delta;
-import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.BrooklynVersion;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.catalog.internal.CatalogDto;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.ha.BasicMasterChooser.AlphabeticMasterChooser;
-import org.apache.brooklyn.core.mgmt.ha.dto.BasicManagementNodeSyncRecord;
-import org.apache.brooklyn.core.mgmt.ha.dto.ManagementPlaneSyncRecordImpl;
-import org.apache.brooklyn.core.mgmt.ha.dto.ManagementPlaneSyncRecordImpl.Builder;
-import org.apache.brooklyn.core.mgmt.internal.BrooklynObjectManagementMode;
-import org.apache.brooklyn.core.mgmt.internal.LocalEntityManager;
-import org.apache.brooklyn.core.mgmt.internal.LocationManagerInternal;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.internal.ManagementTransitionMode;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceActivityMetrics;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils.CreateBackupMode;
-import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.ScheduledTask;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.ReferenceWithError;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Stopwatch;
-import com.google.common.base.Ticker;
-import com.google.common.collect.Iterables;
-
-/**
- * This is the guts of the high-availability solution in Brooklyn.
- * <p>
- * Multiple brooklyn nodes can be started to form a single management plane, where one node is 
- * designated master and the others are "warm standbys". On termination or failure of the master,
- * the standbys deterministically decide which standby should become master (see {@link MasterChooser}).
- * That standby promotes itself.
- * <p>
- * The management nodes communicate their health/status via the {@link ManagementPlaneSyncRecordPersister}.
- * For example, if using {@link ManagementPlaneSyncRecordPersisterToObjectStore} with a shared blobstore or 
- * filesystem/NFS mount, then each management-node periodically writes its state. 
- * This acts as a heartbeat, being read by the other management-nodes.
- * <p>
- * Promotion to master involves:
- * <ol>
- *   <li>notifying the other management-nodes that it is now master
- *   <li>calling {@link RebindManager#rebind(ClassLoader, org.apache.brooklyn.api.mgmt.rebind.RebindExceptionHandler, ManagementNodeState)} to read all persisted entity state, and thus reconstitute the entities.
- * </ol>
- * <p>
- * Future improvements in this area will include brooklyn-managing-brooklyn to decide + promote
- * the standby.
- * 
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
-
-    public final ConfigKey<Duration> POLL_PERIOD = ConfigKeys.newConfigKey(Duration.class, "brooklyn.ha.pollPeriod",
-        "How often nodes should poll to detect whether master is healthy", Duration.seconds(1));
-    public final ConfigKey<Duration> HEARTBEAT_TIMEOUT = ConfigKeys.newConfigKey(Duration.class, "brooklyn.ha.heartbeatTimeout",
-        "Maximum allowable time for detection of a peer's heartbeat; if no sign of master after this time, "
-        + "another node may promote itself", Duration.THIRTY_SECONDS);
-    
-    @VisibleForTesting /* only used in tests currently */
-    public static interface PromotionListener {
-        public void promotingToMaster();
-    }
-    
-    private static final Logger LOG = LoggerFactory.getLogger(HighAvailabilityManagerImpl.class);
-
-    private final ManagementContextInternal managementContext;
-    private volatile String ownNodeId;
-    private volatile ManagementPlaneSyncRecordPersister persister;
-    private volatile PromotionListener promotionListener;
-    private volatile MasterChooser masterChooser = new AlphabeticMasterChooser();
-    private volatile Ticker localTickerUtc = new Ticker() {
-        // strictly not a ticker because returns millis UTC, but it works fine even so
-        @Override
-        public long read() {
-            return System.currentTimeMillis();
-        }
-    };
-    private volatile Ticker optionalRemoteTickerUtc = null;
-    
-    private volatile Task<?> pollingTask;
-    private volatile boolean disabled;
-    private volatile boolean running;
-    private volatile ManagementNodeState nodeState = ManagementNodeState.INITIALIZING;
-    private volatile boolean nodeStateTransitionComplete = false;
-    private volatile long priority = 0;
-    
-    private final static int MAX_NODE_STATE_HISTORY = 200;
-    private final List<Map<String,Object>> nodeStateHistory = MutableList.of();
-    
-    private volatile transient Duration pollPeriodLocalOverride;
-    private volatile transient Duration heartbeatTimeoutOverride;
-
-    private volatile ManagementPlaneSyncRecord lastSyncRecord;
-    
-    private volatile PersistenceActivityMetrics managementStateWritePersistenceMetrics = new PersistenceActivityMetrics();
-    private volatile PersistenceActivityMetrics managementStateReadPersistenceMetrics = new PersistenceActivityMetrics();
-    private final long startTimeUtc;
-
-    public HighAvailabilityManagerImpl(ManagementContextInternal managementContext) {
-        this.managementContext = managementContext;
-        startTimeUtc = localTickerUtc.read();
-    }
-
-    @Override
-    public HighAvailabilityManagerImpl setPersister(ManagementPlaneSyncRecordPersister persister) {
-        this.persister = checkNotNull(persister, "persister");
-        return this;
-    }
-    
-    @Override
-    public ManagementPlaneSyncRecordPersister getPersister() {
-        return persister;
-    }
-    
-    protected synchronized Duration getPollPeriod() {
-        if (pollPeriodLocalOverride!=null) return pollPeriodLocalOverride;
-        return managementContext.getBrooklynProperties().getConfig(POLL_PERIOD);
-    }
-    
-    /** Overrides {@link #POLL_PERIOD} from brooklyn config, 
-     * including e.g. {@link Duration#PRACTICALLY_FOREVER} to disable polling;
-     * or <code>null</code> to clear a local override */
-    public HighAvailabilityManagerImpl setPollPeriod(Duration val) {
-        this.pollPeriodLocalOverride = val;
-        if (running) {
-            registerPollTask();
-        }
-        return this;
-    }
-
-    public HighAvailabilityManagerImpl setMasterChooser(MasterChooser val) {
-        this.masterChooser = checkNotNull(val, "masterChooser");
-        return this;
-    }
-
-    public synchronized Duration getHeartbeatTimeout() {
-        if (heartbeatTimeoutOverride!=null) return heartbeatTimeoutOverride;
-        return managementContext.getBrooklynProperties().getConfig(HEARTBEAT_TIMEOUT);
-    }
-    
-    /** Overrides {@link #HEARTBEAT_TIMEOUT} from brooklyn config, 
-     * including e.g. {@link Duration#PRACTICALLY_FOREVER} to prevent failover due to heartbeat absence;
-     * or <code>null</code> to clear a local override */
-    public HighAvailabilityManagerImpl setHeartbeatTimeout(Duration val) {
-        this.heartbeatTimeoutOverride = val;
-        return this;
-    }
-
-    /** A ticker that reads in milliseconds, for populating local timestamps.
-     * Defaults to System.currentTimeMillis(); may be overridden e.g. for testing. */
-    public HighAvailabilityManagerImpl setLocalTicker(Ticker val) {
-        this.localTickerUtc = checkNotNull(val);
-        return this;
-    }
-
-    /** A ticker that reads in milliseconds, for overriding remote timestamps.
-     * Defaults to null which means to use the remote timestamp. 
-     * Only for testing as this records the remote timestamp in the object.
-     * <p>
-     * If this is supplied, one must also set {@link ManagementPlaneSyncRecordPersisterToObjectStore#useRemoteTimestampInMemento()}. */
-    @VisibleForTesting
-    public HighAvailabilityManagerImpl setRemoteTicker(Ticker val) {
-        this.optionalRemoteTickerUtc = val;
-        return this;
-    }
-
-    public HighAvailabilityManagerImpl setPromotionListener(PromotionListener val) {
-        this.promotionListener = checkNotNull(val, "promotionListener");
-        return this;
-    }
-    
-    @Override
-    public boolean isRunning() {
-        return running;
-    }
-
-    @Override
-    public void disabled() {
-        disabled = true;
-        ownNodeId = managementContext.getManagementNodeId();
-        // this is notionally the master, just not running; see javadoc for more info
-        stop(ManagementNodeState.MASTER);
-        
-    }
-
-    @Override
-    public void start(HighAvailabilityMode startMode) {
-        nodeStateTransitionComplete = true;
-        disabled = false;
-        running = true;
-        changeMode(startMode, true, true);
-    }
-    
-    @Override
-    public void changeMode(HighAvailabilityMode startMode) {
-        changeMode(startMode, false, false);
-    }
-    
-    @VisibleForTesting
-    @Beta
-    public void changeMode(HighAvailabilityMode startMode, boolean preventElectionOnExplicitStandbyMode, boolean failOnExplicitModesIfUnusual) {
-        if (!running) {
-            // if was not running then start as disabled mode, then proceed as normal
-            LOG.info("HA changing mode to "+startMode+" from "+getInternalNodeState()+" when not running, forcing an intermediate start as DISABLED then will convert to "+startMode);
-            start(HighAvailabilityMode.DISABLED);
-        }
-        if (getNodeState()==ManagementNodeState.FAILED || getNodeState()==ManagementNodeState.INITIALIZING) {
-            if (startMode!=HighAvailabilityMode.DISABLED) {
-                // if coming from FAILED (or INITIALIZING because we skipped start call) then treat as initializing
-                setInternalNodeState(ManagementNodeState.INITIALIZING);
-            }
-        }
-        
-        ownNodeId = managementContext.getManagementNodeId();
-        // TODO Small race in that we first check, and then we'll do checkMaster() on first poll,
-        // so another node could have already become master or terminated in that window.
-        ManagementNodeSyncRecord existingMaster = hasHealthyMaster();
-        boolean weAreRecognisedAsMaster = existingMaster!=null && ownNodeId.equals(existingMaster.getNodeId());
-        boolean weAreMasterLocally = getInternalNodeState()==ManagementNodeState.MASTER;
-        
-        // catch error in some tests where mgmt context has a different HA manager
-        if (managementContext.getHighAvailabilityManager()!=this)
-            throw new IllegalStateException("Cannot start an HA manager on a management context with a different HA manager!");
-        
-        if (weAreMasterLocally) {
-            // demotion may be required; do this before triggering an election
-            switch (startMode) {
-            case MASTER:
-            case AUTO:
-            case DISABLED:
-                // no action needed, will do anything necessary below (or above)
-                break;
-            case HOT_STANDBY: 
-            case HOT_BACKUP: 
-            case STANDBY: 
-                demoteTo(ManagementNodeState.of(startMode).get()); break;
-            default:
-                throw new IllegalStateException("Unexpected high availability mode "+startMode+" requested for "+this);
-            }
-        }
-        
-        ManagementNodeState oldState = getInternalNodeState();
-        
-        // now do election
-        switch (startMode) {
-        case AUTO:
-            // don't care; let's start and see if we promote ourselves
-            if (getInternalNodeState()==ManagementNodeState.INITIALIZING) {
-                setInternalNodeState(ManagementNodeState.STANDBY);
-            }
-            publishAndCheck(true);
-            switch (getInternalNodeState()) {
-            case HOT_BACKUP:
-                if (!nodeStateTransitionComplete) throw new IllegalStateException("Cannot switch to AUTO when in the middle of a transition to "+getInternalNodeState());
-                // else change us to standby, desiring to go to hot standby, and continue to below
-                setInternalNodeState(ManagementNodeState.STANDBY);
-                startMode = HighAvailabilityMode.HOT_BACKUP;
-            case HOT_STANDBY:
-            case STANDBY:
-                if (getInternalNodeState()==ManagementNodeState.STANDBY && oldState==ManagementNodeState.INITIALIZING && startMode!=HighAvailabilityMode.HOT_BACKUP
-                        && BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY)) {
-                    // auto requested; not promoted; so it should become hot standby
-                    startMode = HighAvailabilityMode.HOT_STANDBY;
-                }
-                ManagementPlaneSyncRecord newState = loadManagementPlaneSyncRecord(true);
-                String masterNodeId = newState.getMasterNodeId();
-                ManagementNodeSyncRecord masterNodeDetails = newState.getManagementNodes().get(masterNodeId);
-                LOG.info("Management node "+ownNodeId+" running as HA " + getInternalNodeState() + " autodetected"
-                        + (startMode == HighAvailabilityMode.HOT_STANDBY || startMode == HighAvailabilityMode.HOT_BACKUP ? 
-                            " (will change to "+startMode+")" : "")
-                        + ", " +
-                    (Strings.isBlank(masterNodeId) ? "no master currently (other node should promote itself soon)" : "master "
-                        + (existingMaster==null ? "(new) " : "")
-                        + "is "+masterNodeId +
-                        (masterNodeDetails==null || masterNodeDetails.getUri()==null ? " (no url)" : " at "+masterNodeDetails.getUri())));
-                break;
-            case MASTER:
-                LOG.info("Management node "+ownNodeId+" running as HA MASTER autodetected");
-                break;
-            default:
-                throw new IllegalStateException("Management node "+ownNodeId+" set to HA AUTO, encountered unexpected mode "+getInternalNodeState());
-            }
-            break;
-        case MASTER:
-            if (!failOnExplicitModesIfUnusual || existingMaster==null) {
-                promoteToMaster();
-                if (existingMaster!=null) {
-                    LOG.info("Management node "+ownNodeId+" running as HA MASTER explicitly");
-                } else {
-                    LOG.info("Management node "+ownNodeId+" running as HA MASTER explicitly, stealing from "+existingMaster);
-                }
-            } else if (!weAreRecognisedAsMaster) {
-                throw new IllegalStateException("Master already exists; cannot run as master (master "+existingMaster.toVerboseString()+"); "
-                    + "to trigger a promotion, set a priority and demote the current master");
-            } else {
-                LOG.info("Management node "+ownNodeId+" already running as HA MASTER, when set explicitly");
-            }
-            break;
-        case HOT_BACKUP:
-            setInternalNodeState(ManagementNodeState.HOT_BACKUP);
-            // then continue into next block
-        case STANDBY:
-        case HOT_STANDBY:
-            if (startMode!=HighAvailabilityMode.HOT_BACKUP) {
-                if (ManagementNodeState.isHotProxy(getInternalNodeState()) && startMode==HighAvailabilityMode.HOT_STANDBY) {
-                    // if was hot_backup, we can immediately go hot_standby
-                    setInternalNodeState(ManagementNodeState.HOT_STANDBY);
-                } else {
-                    // from any other state, set standby, then perhaps switch to hot_standby later on (or might become master in the next block)
-                    setInternalNodeState(ManagementNodeState.STANDBY);
-                }
-            }
-            if (ManagementNodeState.isStandby(getInternalNodeState())) {
-                if (!preventElectionOnExplicitStandbyMode) {
-                    publishAndCheck(true);
-                }
-                if (failOnExplicitModesIfUnusual && existingMaster==null) {
-                    LOG.error("Management node "+ownNodeId+" detected no master when "+startMode+" requested and existing master required; failing.");
-                    throw new IllegalStateException("No existing master; cannot start as "+startMode);
-                }
-            }
-            String message = "Management node "+ownNodeId+" running as HA "+getNodeState()+" (";
-            if (getNodeState().toString().equals(startMode.toString()))
-                message += "explicitly requested";
-            else if (startMode==HighAvailabilityMode.HOT_STANDBY && getNodeState()==ManagementNodeState.STANDBY)
-                message += "caller requested "+startMode+", will attempt rebind for HOT_STANDBY next";
-            else
-                message += "caller requested "+startMode;
-            
-            if (getNodeState()==ManagementNodeState.MASTER) {
-                message += " but election re-promoted this node)";
-            } else {
-                ManagementPlaneSyncRecord newState = loadManagementPlaneSyncRecord(true);
-                if (Strings.isBlank(newState.getMasterNodeId())) {
-                    message += "); no master currently"; 
-                    if (startMode != HighAvailabilityMode.HOT_BACKUP) message += " (subsequent election may repair)";
-                } else {
-                    message += "); master "+newState.getMasterNodeId();
-                }
-            }
-            LOG.info(message);
-            break;
-        case DISABLED:
-            // safe just to run even if we weren't master
-            LOG.info("Management node "+ownNodeId+" HA DISABLED (was "+getInternalNodeState()+")");
-            demoteTo(ManagementNodeState.FAILED);
-            if (pollingTask!=null) pollingTask.cancel(true);
-            break;
-        default:
-            throw new IllegalStateException("Unexpected high availability mode "+startMode+" requested for "+this);
-        }
-        
-        if ((startMode==HighAvailabilityMode.HOT_STANDBY || startMode==HighAvailabilityMode.HOT_BACKUP)) {
-            if (!ManagementNodeState.isHotProxy(oldState)) {
-                // now transition to hot proxy
-                nodeStateTransitionComplete = false;
-                if (startMode==HighAvailabilityMode.HOT_STANDBY) {
-                    // if it should be hot standby, then we may need to promote
-                    // inform the world that we are transitioning (but not eligible for promotion while going in to hot standby)
-                    // (no harm in doing this twice)
-                    publishHealth();
-                }
-                try {
-                    activateHotProxy(ManagementNodeState.of(startMode).get()).get();
-                    // error above now throws
-                    nodeStateTransitionComplete = true;
-                    publishHealth();
-
-                    if (getNodeState()==ManagementNodeState.HOT_STANDBY || getNodeState()==ManagementNodeState.HOT_BACKUP) {
-                        LOG.info("Management node "+ownNodeId+" now running as HA "+getNodeState()+"; "
-                            + managementContext.getApplications().size()+" application"+Strings.s(managementContext.getApplications().size())+" loaded");
-                    } else {
-                        // shouldn't come here, we should have gotten an error above
-                        LOG.warn("Management node "+ownNodeId+" unable to promote to "+startMode+" (currently "+getNodeState()+"); "
-                            + "(see log for further details)");
-                    }
-                } catch (Exception e) {
-                    LOG.warn("Management node "+ownNodeId+" unable to promote to "+startMode+" (currently "+getNodeState()+"); rethrowing: "+Exceptions.collapseText(e));
-                    nodeStateTransitionComplete = true;
-                    throw Exceptions.propagate(e);
-                }
-            } else {
-                // transitioning among hot proxy states - tell the rebind manager
-                managementContext.getRebindManager().stopReadOnly();
-                managementContext.getRebindManager().startReadOnly(ManagementNodeState.of(startMode).get());
-                nodeStateTransitionComplete = true;
-            }
-        } else {
-            nodeStateTransitionComplete = true;
-        }
-        if (startMode!=HighAvailabilityMode.DISABLED)
-            registerPollTask();
-    }
-
-    @Override
-    public void setPriority(long priority) {
-        this.priority = priority;
-        if (persister!=null) publishHealth();
-    }
-    
-    @Override
-    public long getPriority() {
-        return priority;
-    }
-    
-    @Override
-    public void stop() {
-        LOG.debug("Stopping "+this);
-        stop(ManagementNodeState.TERMINATED);
-    }
-    
-    private void stop(ManagementNodeState newState) {
-        boolean wasRunning = running;
-        
-        running = false;
-        setInternalNodeState(newState);
-        if (pollingTask != null) pollingTask.cancel(true);
-        
-        if (wasRunning) {
-            try {
-                publishHealth();
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                LOG.error("Problem publishing manager-node health on termination (continuing)", e);
-            }
-        }
-    }
-    
-    /** returns the node state this node is trying to be in */
-    public ManagementNodeState getTransitionTargetNodeState() {
-        return getInternalNodeState();
-    }
-    
-    protected ManagementNodeState getInternalNodeState() {
-        return nodeState;
-    }
-    
-    protected void setInternalNodeState(ManagementNodeState newState) {
-        ManagementNodeState oldState = getInternalNodeState();
-        synchronized (nodeStateHistory) {
-            if (this.nodeState != newState) {
-                nodeStateHistory.add(0, MutableMap.<String,Object>of("state", newState, "timestamp", currentTimeMillis()));
-                while (nodeStateHistory.size()>MAX_NODE_STATE_HISTORY) {
-                    nodeStateHistory.remove(nodeStateHistory.size()-1);
-                }
-            }
-            ((RebindManagerImpl)managementContext.getRebindManager()).setAwaitingInitialRebind(running &&
-                (ManagementNodeState.isHotProxy(newState) || newState==ManagementNodeState.MASTER));
-            this.nodeState = newState;
-        }
-        
-        if (ManagementNodeState.isHotProxy(oldState) && !ManagementNodeState.isHotProxy(newState)) {
-            // could perhaps promote standby items on some transitions; but for now we stop the old read-only and re-load them
-            // TODO ideally there'd be an incremental rebind as well as an incremental persist
-            managementContext.getRebindManager().stopReadOnly();
-            clearManagedItems(ManagementTransitionMode.transitioning(BrooklynObjectManagementMode.LOADED_READ_ONLY, BrooklynObjectManagementMode.UNMANAGED_PERSISTED));
-        }
-    }
-
-    @Override
-    public ManagementNodeState getNodeState() {
-        ManagementNodeState myNodeState = getInternalNodeState();
-        if (myNodeState==ManagementNodeState.FAILED) return getInternalNodeState();
-        // if target is master then we claim already being master, to prevent other nodes from taking it
-        // (we may fail subsequently of course)
-        if (myNodeState==ManagementNodeState.MASTER) return myNodeState;
-        
-        if (!nodeStateTransitionComplete) return ManagementNodeState.INITIALIZING;
-        return myNodeState;
-    }
-
-    public ManagementPlaneSyncRecord getLastManagementPlaneSyncRecord() {
-        return lastSyncRecord;
-    }
-    
-    @SuppressWarnings("unchecked")
-    protected void registerPollTask() {
-        final Runnable job = new Runnable() {
-            private boolean lastFailed;
-            
-            @Override public void run() {
-                try {
-                    publishAndCheck(false);
-                    lastFailed = false;
-                } catch (Exception e) {
-                    if (running) {
-                        if (lastFailed) {
-                            if (LOG.isDebugEnabled()) LOG.debug("Recurring problem in HA-poller: "+e, e);
-                        } else {
-                            LOG.error("Problem in HA-poller: "+e, e);
-                            lastFailed = true;
-                        }
-                    } else {
-                        if (LOG.isDebugEnabled()) LOG.debug("Problem in HA-poller, but no longer running: "+e, e);
-                    }
-                } catch (Throwable t) {
-                    LOG.error("Problem in HA-poller: "+t, t);
-                    throw Exceptions.propagate(t);
-                }
-            }
-        };
-        Callable<Task<?>> taskFactory = new Callable<Task<?>>() {
-            @Override public Task<?> call() {
-                return Tasks.builder().dynamic(false).body(job).displayName("HA poller task").tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
-                    .description("polls HA status to see whether this node should promote").build();
-            }
-        };
-        
-        Duration pollPeriod = getPollPeriod();
-        LOG.debug("Registering poll task for "+this+", period "+pollPeriod);
-        if (pollPeriod.equals(Duration.PRACTICALLY_FOREVER)) {
-            // don't schedule - used for tests
-            // (scheduling fires off one initial task in the background before the delay, 
-            // which affects tests that want to know exactly when publishing happens;
-            // TODO would be nice if scheduled task had a "no initial submission" flag )
-        } else {
-            if (pollingTask!=null) pollingTask.cancel(true);
-            
-            ScheduledTask task = new ScheduledTask(MutableMap.of("period", pollPeriod, "displayName", "scheduled:[HA poller task]"), taskFactory);
-            pollingTask = managementContext.getExecutionManager().submit(task);
-        }
-    }
-    
-    /** invoked manually when initializing, and periodically thereafter */
-    @VisibleForTesting
-    public synchronized void publishAndCheck(boolean initializing) {
-        publishHealth();
-        checkMaster(initializing);
-    }
-    
-    protected synchronized void publishHealth() {
-        if (persister == null) {
-            LOG.info("Cannot publish management-node health as no persister");
-            return;
-        }
-        
-        Stopwatch timer = Stopwatch.createStarted();
-        try {
-            ManagementNodeSyncRecord memento = createManagementNodeSyncRecord(false);
-            Delta delta = ManagementPlaneSyncRecordDeltaImpl.builder().node(memento).build();
-            persister.delta(delta);
-            managementStateWritePersistenceMetrics.noteSuccess(Duration.of(timer));
-            if (LOG.isTraceEnabled()) LOG.trace("Published management-node health: {}", memento);
-        } catch (Throwable t) {
-            managementStateWritePersistenceMetrics.noteFailure(Duration.of(timer));
-            managementStateWritePersistenceMetrics.noteError(t.toString());
-            LOG.debug("Error publishing management-node health (rethrowing): "+t);
-            throw Exceptions.propagate(t);
-        }
-    }
-    
-    public void publishClearNonMaster() {
-        ManagementPlaneSyncRecord plane = getLastManagementPlaneSyncRecord();
-        if (plane==null || persister==null) {
-            LOG.warn("Cannot clear HA node records; HA not active (or not yet loaded)");
-            return;
-        }
-        org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordDeltaImpl.Builder db = ManagementPlaneSyncRecordDeltaImpl.builder();
-        for (Map.Entry<String,ManagementNodeSyncRecord> node: plane.getManagementNodes().entrySet()) {
-            // only keep a node if it both claims master and is recognised as master;
-            // else ex-masters who died are kept around!
-            if (!ManagementNodeState.MASTER.equals(node.getValue().getStatus()) || 
-                    !Objects.equal(plane.getMasterNodeId(), node.getValue().getNodeId())) {
-                db.removedNodeId(node.getKey());
-            }
-        }
-        persister.delta(db.build());
-        // then get, so model is updated
-        loadManagementPlaneSyncRecord(true);
-    }
-    
-    protected synchronized void publishDemotion(boolean demotingFromMaster) {
-        checkState(getNodeState() != ManagementNodeState.MASTER, "node status must not be master when demoting", getNodeState());
-        
-        if (persister == null) {
-            LOG.info("Cannot publish management-node health as no persister");
-            return;
-        }
-        
-        ManagementNodeSyncRecord memento = createManagementNodeSyncRecord(false);
-        ManagementPlaneSyncRecordDeltaImpl.Builder deltaBuilder = ManagementPlaneSyncRecordDeltaImpl.builder()
-                .node(memento);
-        if (demotingFromMaster) {
-            deltaBuilder.clearMaster(ownNodeId);
-        }
-        
-        Delta delta = deltaBuilder.build();
-        persister.delta(delta);
-        if (LOG.isTraceEnabled()) LOG.trace("Published management-node health: {}", memento);
-    }
-    
-    /**
-     * Publishes (via {@link #persister}) the state of this management node with itself set to master.
-     */
-    protected synchronized void publishPromotionToMaster() {
-        checkState(getNodeState() == ManagementNodeState.MASTER, "node status must be master on publish, but is %s", getNodeState());
-        
-        if (persister == null) {
-            LOG.info("Cannot publish management-node health as no persister");
-            return;
-        }
-        
-        ManagementNodeSyncRecord memento = createManagementNodeSyncRecord(false);
-        Delta delta = ManagementPlaneSyncRecordDeltaImpl.builder()
-                .node(memento)
-                .setMaster(ownNodeId)
-                .build();
-        persister.delta(delta);
-        if (LOG.isTraceEnabled()) LOG.trace("Published management-node health: {}", memento);
-    }
-    
-    protected boolean isHeartbeatOk(ManagementNodeSyncRecord masterNode, ManagementNodeSyncRecord meNode) {
-        if (masterNode==null) return false;
-        if (meNode==null) {
-            // we can't confirm it's healthy, but it appears so as far as we can tell
-            return true;
-        }
-        Long timestampMaster = masterNode.getRemoteTimestamp();
-        Long timestampMe = meNode.getRemoteTimestamp();
-        if (timestampMaster==null || timestampMe==null) return false;
-        return (timestampMe - timestampMaster) <= getHeartbeatTimeout().toMilliseconds();
-    }
-    
-    protected ManagementNodeSyncRecord hasHealthyMaster() {
-        ManagementPlaneSyncRecord memento = loadManagementPlaneSyncRecord(false);
-        
-        String nodeId = memento.getMasterNodeId();
-        ManagementNodeSyncRecord masterMemento = (nodeId == null) ? null : memento.getManagementNodes().get(nodeId);
-        
-        ManagementNodeSyncRecord ourMemento = memento.getManagementNodes().get(ownNodeId);
-        boolean result = masterMemento != null && masterMemento.getStatus() == ManagementNodeState.MASTER
-                && isHeartbeatOk(masterMemento, ourMemento);
-        
-        if (LOG.isDebugEnabled()) LOG.debug("Healthy-master check result={}; masterId={}; masterMemento={}; ourMemento={}",
-                new Object[] {result, nodeId, (masterMemento == null ? "<none>" : masterMemento.toVerboseString()), (ourMemento == null ? "<none>" : ourMemento.toVerboseString())});
-        
-        return (result ? masterMemento : null);
-    }
-    
-    /**
-     * Looks up the state of all nodes in the management plane, and checks if the master is still ok.
-     * If it's not then determines which node should be promoted to master. If it is ourself, then promotes.
-     */
-    protected void checkMaster(boolean initializing) {
-        ManagementPlaneSyncRecord memento = loadManagementPlaneSyncRecord(false);
-        
-        if (getNodeState()==ManagementNodeState.FAILED || getNodeState()==ManagementNodeState.HOT_BACKUP) {
-            // if failed or hot backup then we can't promote ourselves, so no point in checking who is master
-            return;
-        }
-        
-        String currMasterNodeId = memento.getMasterNodeId();
-        ManagementNodeSyncRecord currMasterNodeRecord = memento.getManagementNodes().get(currMasterNodeId);
-        ManagementNodeSyncRecord ownNodeRecord = memento.getManagementNodes().get(ownNodeId);
-        
-        ManagementNodeSyncRecord newMasterNodeRecord = null;
-        boolean demotingSelfInFavourOfOtherMaster = false;
-        
-        if (currMasterNodeRecord != null && currMasterNodeRecord.getStatus() == ManagementNodeState.MASTER && isHeartbeatOk(currMasterNodeRecord, ownNodeRecord)) {
-            // master seems healthy
-            if (ownNodeId.equals(currMasterNodeId)) {
-                if (LOG.isTraceEnabled()) LOG.trace("Existing master healthy (us): master={}", currMasterNodeRecord.toVerboseString());
-                return;
-            } else {
-                if (ownNodeRecord!=null && ownNodeRecord.getStatus() == ManagementNodeState.MASTER) {
-                    LOG.error("Management node "+ownNodeId+" detected master change, stolen from us, deferring to "+currMasterNodeId);
-                    newMasterNodeRecord = currMasterNodeRecord;
-                    demotingSelfInFavourOfOtherMaster = true;
-                } else {
-                    if (LOG.isTraceEnabled()) LOG.trace("Existing master healthy (remote): master={}", currMasterNodeRecord.toVerboseString());
-                    return;
-                }
-            }
-        } else if (ownNodeRecord == null || !isHeartbeatOk(ownNodeRecord, ownNodeRecord)) {
-            // our heartbeats are also out-of-date! perhaps something wrong with persistence? just log, and don't over-react!
-            if (ownNodeRecord == null) {
-                LOG.error("No management node memento for self ("+ownNodeId+"); perhaps persister unwritable? "
-                        + "Master ("+currMasterNodeId+") reported failed but no-op as cannot tell conclusively");
-            } else {
-                LOG.error("This management node ("+ownNodeId+") memento heartbeats out-of-date; perhaps perister unwritable? "
-                        + "Master ("+currMasterNodeId+") reported failed but no-op as cannot tell conclusively"
-                        + ": self="+ownNodeRecord.toVerboseString());
-            }
-            return;
-        } else if (ownNodeId.equals(currMasterNodeId)) {
-            // we are supposed to be the master, but seem to be unhealthy!
-            LOG.warn("This management node ("+ownNodeId+") supposed to be master but reportedly unhealthy? "
-                    + "no-op as expect other node to fix: self="+ownNodeRecord.toVerboseString());
-            return;
-        }
-        
-        if (demotingSelfInFavourOfOtherMaster) {
-            LOG.debug("Master-change for this node only, demoting "+ownNodeRecord.toVerboseString()+" in favour of official master "+newMasterNodeRecord.toVerboseString());
-            demoteTo(
-                BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY) ?
-                    ManagementNodeState.HOT_STANDBY : ManagementNodeState.STANDBY);
-            return;
-        } else {
-            LOG.debug("Detected master heartbeat timeout. Initiating a new master election. Master was " + currMasterNodeRecord);
-        }
-        
-        // Need to choose a new master
-        newMasterNodeRecord = masterChooser.choose(memento, getHeartbeatTimeout(), ownNodeId);
-        
-        String newMasterNodeId = (newMasterNodeRecord == null) ? null : newMasterNodeRecord.getNodeId();
-        URI newMasterNodeUri = (newMasterNodeRecord == null) ? null : newMasterNodeRecord.getUri();
-        boolean weAreNewMaster = ownNodeId.equals(newMasterNodeId);
-        
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Management node master-change required: newMaster={}; oldMaster={}; plane={}, self={}; heartbeatTimeout={}", 
-                new Object[] {
-                    (newMasterNodeRecord == null ? "<none>" : newMasterNodeRecord.toVerboseString()),
-                    (currMasterNodeRecord == null ? currMasterNodeId+" (no memento)": currMasterNodeRecord.toVerboseString()),
-                    memento,
-                    ownNodeRecord.toVerboseString(), 
-                    getHeartbeatTimeout()
-                });
-        }
-        String message = "Management node "+ownNodeId+" detected ";
-        String currMasterSummary = currMasterNodeId + "(" + (currMasterNodeRecord==null ? "<none>" : timestampString(currMasterNodeRecord.getRemoteTimestamp())) + ")";
-        if (weAreNewMaster && (ownNodeRecord.getStatus() == ManagementNodeState.MASTER)) {
-            LOG.warn(message + "we must reassert master status, as was stolen and then failed at "+
-                (currMasterNodeRecord==null ? "a node which has gone away" : currMasterSummary));
-            publishPromotionToMaster();
-            publishHealth();
-            return;
-        }
-        
-        if (!initializing) {
-            if (weAreNewMaster) {
-                message += "we should be master, changing from ";
-            }
-            else if (currMasterNodeRecord==null && newMasterNodeId==null) message += "master change attempted but no candidates ";
-            else message += "master change, from ";
-            message += currMasterSummary + " to "
-                + (newMasterNodeId == null ? "<none>" :
-                    (weAreNewMaster ? "us " : "")
-                    + newMasterNodeId + " (" + timestampString(newMasterNodeRecord.getRemoteTimestamp()) + ")" 
-                    + (newMasterNodeUri!=null ? " "+newMasterNodeUri : "")  );
-            // always log, if you're looking at a standby node it's useful to see the new master's URL
-            LOG.info(message);
-        }
-
-        // New master is ourself: promote
-        if (weAreNewMaster) {
-            promoteToMaster();
-        }
-    }
-    
-    private static String timestampString(Long remoteTimestamp) {
-        if (remoteTimestamp==null) return null;
-        return remoteTimestamp+" / "+Time.makeTimeStringRounded( Duration.sinceUtc(remoteTimestamp))+" ago";
-    }
-
-    protected void promoteToMaster() {
-        if (!running) {
-            LOG.warn("Ignoring promote-to-master request, as HighAvailabilityManager is not running");
-            return;
-        }
-        
-        if (promotionListener != null) {
-            try {
-                promotionListener.promotingToMaster();
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                LOG.warn("Problem in promption-listener (continuing)", e);
-            }
-        }
-        setInternalNodeState(ManagementNodeState.MASTER);
-        publishPromotionToMaster();
-        try {
-            managementContext.getRebindManager().rebind(managementContext.getCatalogClassLoader(), null, getInternalNodeState());
-        } catch (Exception e) {
-            LOG.error("Management node "+managementContext.getManagementNodeId()+" enountered problem during rebind when promoting self to master; demoting to FAILED and rethrowing: "+e);
-            demoteTo(ManagementNodeState.FAILED);
-            throw Exceptions.propagate(e);
-        }
-        managementContext.getRebindManager().start();
-    }
-    
-    protected void backupOnDemotionIfNeeded() {
-        if (managementContext.getBrooklynProperties().getConfig(BrooklynServerConfig.PERSISTENCE_BACKUPS_REQUIRED_ON_DEMOTION)) {
-            BrooklynPersistenceUtils.createBackup(managementContext, CreateBackupMode.DEMOTION, MementoCopyMode.LOCAL);
-        }
-    }
-
-    /** @deprecated since 0.7.0, use {@link #demoteTo(ManagementNodeState)} */ @Deprecated
-    protected void demoteToFailed() {
-        demoteTo(ManagementNodeState.FAILED);
-    }
-    /** @deprecated since 0.7.0, use {@link #demoteTo(ManagementNodeState)} */ @Deprecated
-    protected void demoteToStandby(boolean hot) {
-        demoteTo(hot ? ManagementNodeState.HOT_STANDBY : ManagementNodeState.STANDBY);
-    }
-    
-    protected void demoteTo(ManagementNodeState toState) {
-        if (toState!=ManagementNodeState.FAILED && !running) {
-            LOG.warn("Ignoring demote-from-master request, as HighAvailabilityManager is no longer running");
-            return;
-        }
-        boolean wasMaster = (getInternalNodeState() == ManagementNodeState.MASTER);
-        if (wasMaster) backupOnDemotionIfNeeded();
-        // TODO target may be RO ?
-        ManagementTransitionMode mode = ManagementTransitionMode.transitioning(
-            wasMaster ? BrooklynObjectManagementMode.MANAGED_PRIMARY : BrooklynObjectManagementMode.LOADED_READ_ONLY,
-            BrooklynObjectManagementMode.UNMANAGED_PERSISTED);
-
-        nodeStateTransitionComplete = false;
-        
-        switch (toState) {
-        case FAILED: 
-        case HOT_BACKUP:
-        case STANDBY:
-            setInternalNodeState(toState); break;
-        case HOT_STANDBY:
-            setInternalNodeState(ManagementNodeState.STANDBY); break;
-        default:
-            throw new IllegalStateException("Illegal target state: "+toState);
-        }
-        onDemotionStopItems(mode);
-        nodeStateTransitionComplete = true;
-        publishDemotion(wasMaster);
-        
-        if (toState==ManagementNodeState.HOT_BACKUP || toState==ManagementNodeState.HOT_STANDBY) {
-            nodeStateTransitionComplete = false;
-            try {
-                activateHotProxy(toState).get();
-            } finally {
-                nodeStateTransitionComplete = true;
-            }
-            publishHealth();
-        }
-    }
-    
-    protected void onDemotionStopItems(ManagementTransitionMode mode) {
-        // stop persistence and remove all apps etc
-        managementContext.getRebindManager().stopPersistence();
-        managementContext.getRebindManager().stopReadOnly();
-        clearManagedItems(mode);
-        
-        // tasks are cleared as part of unmanaging entities above
-    }
-
-    /** clears all managed items from the management context; same items destroyed as in the course of a rebind cycle */
-    protected void clearManagedItems(ManagementTransitionMode mode) {
-        // start with the root applications
-        for (Application app: managementContext.getApplications()) {
-            if (((EntityInternal)app).getManagementSupport().isDeployed()) {
-                ((LocalEntityManager)((EntityInternal)app).getManagementContext().getEntityManager()).unmanage(app, mode);
-            }
-        }
-        // for active management, call above will remove recursively at present,
-        // but for read-only, and if we stop recursively, go through them all
-        for (Entity entity: managementContext.getEntityManager().getEntities()) {
-            ((LocalEntityManager)managementContext.getEntityManager()).unmanage(entity, mode);
-        }
-    
-        // again, for locations, call unmanage on parents first
-        for (Location loc: managementContext.getLocationManager().getLocations()) {
-            if (loc.getParent()==null)
-                ((LocationManagerInternal)managementContext.getLocationManager()).unmanage(loc, mode);
-        }
-        for (Location loc: managementContext.getLocationManager().getLocations()) {
-            ((LocationManagerInternal)managementContext.getLocationManager()).unmanage(loc, mode);
-        }
-        
-        ((BasicBrooklynCatalog)managementContext.getCatalog()).reset(CatalogDto.newEmptyInstance("<reset-by-ha-status-change>"));
-    }
-    
-    /** @deprecated since 0.7.0, use {@link #activateHotProxy(ManagementNodeState)} */ @Deprecated
-    protected boolean attemptHotStandby() {
-        return activateHotProxy(ManagementNodeState.HOT_STANDBY).getWithoutError();
-    }
-    
-    /** Starts hot standby or hot backup, in foreground
-     * <p>
-     * In the case of the former, the caller is responsible for publishing health afterwards,
-     * but if it fails, this method will {@link #demoteTo(ManagementNodeState)} {@link ManagementNodeState#FAILED}.
-     * <p>
-     * @return whether the requested {@link ManagementNodeState} was possible;
-     * (if not, errors should be stored elsewhere), callers may want to rethrow */
-    protected ReferenceWithError<Boolean> activateHotProxy(ManagementNodeState toState) {
-        try {
-            Preconditions.checkState(nodeStateTransitionComplete==false, "Must be in transitioning state to go into "+toState);
-            setInternalNodeState(toState);
-            managementContext.getRebindManager().startReadOnly(toState);
-            
-            return ReferenceWithError.newInstanceWithoutError(true);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            LOG.warn("Unable to change "+ownNodeId+" to "+toState+", switching to FAILED: "+e, e);
-            demoteTo(ManagementNodeState.FAILED);
-            return ReferenceWithError.newInstanceThrowingError(false, e);
-        }
-    }
-    
-    @Override
-    public ManagementPlaneSyncRecord loadManagementPlaneSyncRecord(boolean useLocalKnowledgeForThisNode) {
-        ManagementPlaneSyncRecord record = loadManagementPlaneSyncRecordInternal(useLocalKnowledgeForThisNode);
-        lastSyncRecord = record;
-        return record; 
-    }
-    
-    private ManagementPlaneSyncRecord loadManagementPlaneSyncRecordInternal(boolean useLocalKnowledgeForThisNode) {
-        if (disabled) {
-            // if HA is disabled, then we are the only node - no persistence; just load a memento to describe this node
-            Builder builder = ManagementPlaneSyncRecordImpl.builder()
-                .node(createManagementNodeSyncRecord(true));
-            if (getTransitionTargetNodeState() == ManagementNodeState.MASTER) {
-                builder.masterNodeId(ownNodeId);
-            }
-            return builder.build();
-        }
-        if (persister == null) {
-            // e.g. web-console may be polling before we've started up
-            LOG.debug("High availablity manager has no persister; returning empty record");
-            return ManagementPlaneSyncRecordImpl.builder().build();
-        }
-        
-        int maxLoadAttempts = 5;
-        Exception lastException = null;
-        Stopwatch timer = Stopwatch.createStarted();
-
-        for (int i = 0; i < maxLoadAttempts; i++) {
-            try {
-                ManagementPlaneSyncRecord result = persister.loadSyncRecord();
-                
-                if (useLocalKnowledgeForThisNode) {
-                    // Report this node's most recent state, and detect AWOL nodes
-                    ManagementNodeSyncRecord me = BasicManagementNodeSyncRecord.builder()
-                        .from(result.getManagementNodes().get(ownNodeId), true)
-                        .from(createManagementNodeSyncRecord(false), true)
-                        .build();
-                    Iterable<ManagementNodeSyncRecord> allNodes = result.getManagementNodes().values();
-                    if (me.getRemoteTimestamp()!=null)
-                        allNodes = Iterables.transform(allNodes, new MarkAwolNodes(me));
-                    Builder builder = ManagementPlaneSyncRecordImpl.builder()
-                        .masterNodeId(result.getMasterNodeId())
-                        .nodes(allNodes);
-                    builder.node(me);
-                    if (getTransitionTargetNodeState() == ManagementNodeState.MASTER) {
-                        builder.masterNodeId(ownNodeId);
-                    }
-                    result = builder.build();
-                }
-                
-                if (i>0) {
-                    managementStateReadPersistenceMetrics.noteError("Succeeded only on attempt "+(i+1)+": "+lastException);
-                }
-                managementStateReadPersistenceMetrics.noteSuccess(Duration.of(timer));
-                return result;
-            } catch (IOException e) {
-                if (i < (maxLoadAttempts - 1)) {
-                    if (LOG.isDebugEnabled()) LOG.debug("Problem loading mangement-plane memento attempt "+(i+1)+"/"+maxLoadAttempts+"; retrying", e);
-                }
-                lastException = e;
-            }
-        }
-        String message = "Failed to load mangement-plane memento "+maxLoadAttempts+" consecutive times";
-        managementStateReadPersistenceMetrics.noteError(message+": "+lastException);
-        managementStateReadPersistenceMetrics.noteFailure(Duration.of(timer));
-
-        throw new IllegalStateException(message, lastException);
-    }
-
-    protected ManagementNodeSyncRecord createManagementNodeSyncRecord(boolean useLocalTimestampAsRemoteTimestamp) {
-        long timestamp = currentTimeMillis();
-        org.apache.brooklyn.core.mgmt.ha.dto.BasicManagementNodeSyncRecord.Builder builder = BasicManagementNodeSyncRecord.builder()
-                .brooklynVersion(BrooklynVersion.get())
-                .nodeId(ownNodeId)
-                .status(getNodeState())
-                .priority(getPriority())
-                .localTimestamp(timestamp)
-                .uri(managementContext.getManagementNodeUri().orNull());
-        if (useLocalTimestampAsRemoteTimestamp)
-            builder.remoteTimestamp(timestamp);
-        else if (optionalRemoteTickerUtc!=null) {
-            builder.remoteTimestamp(optionalRemoteTickerUtc.read());
-        }
-        return builder.build();
-    }
-    
-    /**
-     * Gets the current time, using the {@link #localTickerUtc}. Normally this is equivalent of {@link System#currentTimeMillis()},
-     * but in test environments a custom {@link Ticker} can be injected via {@link #setLocalTicker(Ticker)} to allow testing of
-     * specific timing scenarios.
-     */
-    protected long currentTimeMillis() {
-        return localTickerUtc.read();
-    }
-
-    /**
-     * Infers the health of a node - if it last reported itself as healthy (standby or master), but we haven't heard 
-     * from it in a long time then report that node as failed; otherwise report its health as-is.
-     */
-    private class MarkAwolNodes implements Function<ManagementNodeSyncRecord, ManagementNodeSyncRecord> {
-        private final ManagementNodeSyncRecord referenceNode;
-        private MarkAwolNodes(ManagementNodeSyncRecord referenceNode) {
-            this.referenceNode = referenceNode;
-        }
-        @Nullable
-        @Override
-        public ManagementNodeSyncRecord apply(@Nullable ManagementNodeSyncRecord input) {
-            if (input == null) return null;
-            if (!(input.getStatus() == ManagementNodeState.STANDBY || input.getStatus() == ManagementNodeState.HOT_STANDBY || input.getStatus() == ManagementNodeState.MASTER || input.getStatus() == ManagementNodeState.HOT_BACKUP)) return input;
-            if (isHeartbeatOk(input, referenceNode)) return input;
-            return BasicManagementNodeSyncRecord.builder()
-                    .from(input)
-                    .status(ManagementNodeState.FAILED)
-                    .build();
-        }
-    }
-    
-    @Override
-    public String toString() {
-        return super.toString()+"[node:"+ownNodeId+";running="+running+"]";
-    }
-    
-    @Override
-    public Map<String,Object> getMetrics() {
-        Map<String,Object> result = MutableMap.of();
-        
-        result.put("state", getNodeState());
-        result.put("uptime", Time.makeTimeStringRounded(Duration.millis(currentTimeMillis()-startTimeUtc)));
-        result.put("currentTimeUtc", currentTimeMillis());
-        result.put("startTimeUtc", startTimeUtc);
-        result.put("highAvailability", MutableMap.<String,Object>of(
-            "priority", getPriority(),
-            "pollPeriod", getPollPeriod().toMilliseconds(),
-            "heartbeatTimeout", getHeartbeatTimeout().toMilliseconds(),
-            "history", nodeStateHistory));
-        
-        result.putAll(managementContext.getRebindManager().getMetrics());
-        result.put("managementStatePersistence", 
-            MutableMap.of("read", managementStateReadPersistenceMetrics, "write", managementStateWritePersistenceMetrics));
-        
-        return result;
-    }
-    
-    @Override
-    public long getLastStateChange() {
-        if (nodeStateHistory.size() > 0) {
-            return (Long)nodeStateHistory.get(0).get("timestamp");
-        } else {
-            return 0;
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordDeltaImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordDeltaImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordDeltaImpl.java
deleted file mode 100644
index 141859d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordDeltaImpl.java
+++ /dev/null
@@ -1,122 +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.core.mgmt.ha;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister.Delta;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Sets;
-
-/**
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public class ManagementPlaneSyncRecordDeltaImpl implements Delta {
-    
-    public static Builder builder() {
-        return new Builder();
-    }
-    
-    public static class Builder {
-        private Collection<ManagementNodeSyncRecord> nodes = Sets.newLinkedHashSet();
-        private Collection <String> removedNodeIds = Sets.newLinkedHashSet();
-        private MasterChange masterChange = MasterChange.NO_CHANGE;
-        private String master;
-        private String expectedOldMaster;
-        
-        public Builder node(ManagementNodeSyncRecord node) {
-            nodes.add(checkNotNull(node, "node")); return this;
-        }
-        public Builder removedNodeId(String id) {
-            removedNodeIds.add(checkNotNull(id, "id")); return this;
-        }
-        public Builder setMaster(String nodeId) {
-            masterChange = MasterChange.SET_MASTER;
-            master = checkNotNull(nodeId, "masterId");
-            return this;
-        }
-        public Builder clearMaster(String optionalExpectedNodeId) {
-            masterChange = MasterChange.CLEAR_MASTER;
-            this.expectedOldMaster = optionalExpectedNodeId;
-            return this;
-        }
-        public Delta build() {
-            return new ManagementPlaneSyncRecordDeltaImpl(this);
-        }
-    }
-    
-    private final Collection<ManagementNodeSyncRecord> nodes;
-    private final Collection <String> removedNodeIds;
-    private final MasterChange masterChange;
-    private String masterId;
-    private String expectedOldMaster;
-    
-    ManagementPlaneSyncRecordDeltaImpl(Builder builder) {
-        nodes = builder.nodes;
-        removedNodeIds = builder.removedNodeIds;
-        masterChange = builder.masterChange;
-        masterId = builder.master;
-        this.expectedOldMaster = builder.expectedOldMaster;
-        checkState((masterChange == MasterChange.SET_MASTER) ? (masterId != null) : (masterId == null), 
-                "invalid combination: change=%s; masterId=%s", masterChange, masterId);
-    }
-    
-    @Override
-    public Collection<ManagementNodeSyncRecord> getNodes() {
-        return nodes;
-    }
-
-    @Override
-    public Collection<String> getRemovedNodeIds() {
-        return removedNodeIds;
-    }
-
-    @Override
-    public MasterChange getMasterChange() {
-        return masterChange;
-    }
-
-    @Override
-    public String getNewMasterOrNull() {
-        return masterId;
-    }
-    
-    @Override
-    public String getExpectedMasterToClear() {
-        return expectedOldMaster;
-    }
-    
-    @Override
-    public String toString() {
-        return getClass().getCanonicalName()+"["+
-            (masterChange!=null && masterChange != MasterChange.NO_CHANGE ? 
-                masterChange+": "+expectedOldMaster+"->"+masterId+"; " : "")+
-            "nodes: "+nodes+
-            (removedNodeIds!=null && !removedNodeIds.isEmpty() ? "; removing: "+removedNodeIds : "")
-            +"]";
-    }
-}


[49/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
new file mode 100644
index 0000000..56befa4
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolver.java
@@ -0,0 +1,58 @@
+/*
+ * 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.api.entity.drivers.downloads;
+
+import java.util.List;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives download details for an entity or an entity add-on.
+ * Returned by the {@link DownloadResolverManager}, when queried for a specific entity or entity add-on. 
+ * 
+ * @author aled
+ */
+public interface DownloadResolver {
+    /**
+     * The targets (normally URLs) for downloading the artifact. These should be tried in-order
+     * until one works.
+     */
+    public List<String> getTargets();
+
+    /**
+     * The name of the artifact.
+     * The caller is free to use this name, or not. But using this name gives consistency particularly
+     * between brooklyn local-repos and brooklyn install directories.
+     */
+    public String getFilename();
+    
+    /**
+     * The name of the directory in the expanded artifact (e.g. if it's a tar.gz file then the name of
+     * the directory within it). If no value is known, the defaultVal will be returned.
+     * 
+     * This can return null if the artifact is not an archive (and if defaultVal is null).
+     * 
+     * TODO The driver needs to know what will happen when an install archive is unpacked (e.g. an 
+     * AS7 install tgz may be automatically expanded into a directory named "jboss-as-7.1.1-FINAL").
+     * However, it's unclear where the best place to encode that is. The driver supplying the default
+     * seems sensible.
+     */
+    @Beta
+    public String getUnpackedDirectoryName(String defaultVal);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
new file mode 100644
index 0000000..3597041
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/downloads/DownloadResolverManager.java
@@ -0,0 +1,158 @@
+/*
+ * 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.api.entity.drivers.downloads;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.api.entity.drivers.EntityDriver;
+
+import com.google.common.base.Function;
+
+/**
+ * Used by an {@link EntityDriver} to obtain the download locations when installing an entity.
+ * 
+ * Most commonly, the {@link DownloadResolver}'s targets are URIs. However, an EntityDriver 
+ * implementation is free to interpret the String however is appropriate (e.g. the name of a 
+ * custom package to install from the enterprise's package manager repository).
+
+ * Also supports registering other "resolvers" for determining where to download the installers 
+ * from, for different entities.
+ * 
+ * When using {@link resolve(EntityDriver)} to get the list of things to try (in-order until one succeeds),
+ * the manager will go through each of the registered resolvers in-order to get their contributions.
+ * These contributions are split into "primary" and "fallback". All of the primaries will be added to the
+ * list first, and then all of the fallbacks.
+ * 
+ * @author aled
+ */
+public interface DownloadResolverManager {
+
+    /**
+     * For installing the main entity.
+     * Returns a list of options, to be tried in order until one of them works.
+     */
+    public DownloadResolver newDownloader(EntityDriver driver);
+
+    /**
+     * For installing the main entity.
+     * Returns a list of options, to be tried in order until one of them works.
+     */
+    public DownloadResolver newDownloader(EntityDriver driver, Map<String,?> properties);
+
+    /**
+     * For installing an entity add-on.
+     * Returns a list of options, to be tried in order until one of them works.
+     * This is used for resolving the download for an "add-on" - e.g. an additional module required 
+     * during an entity's installation. Common properties include:
+     * <ul>
+     *   <li>addonversion: the required version of the add-on
+     * </ul>
+     */
+    public DownloadResolver newDownloader(EntityDriver driver, String addonName, Map<String,?> addonProperties);
+    
+    /**
+     * Registers a producer, to be tried before all other producers.
+     * 
+     * A "producer" will generate the download targets to be tried, when installing a given entity
+     * or entity add-on.
+     * 
+     * The function should not return null (instead see {@code BasicDownloadTargets.empty()}).
+     * 
+     * @see registerResolver(Function)
+     */
+    public void registerPrimaryProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> resolver);
+
+    /**
+     * Registers a producer, to be tried after all other registered producers have been tried.
+     * The function should not return null (instead see {@code BasicDownloadTargets.empty()}).
+     */
+    public void registerProducer(Function<? super DownloadRequirement, ? extends DownloadTargets> resolver);
+
+    /**
+     * Registers a producer for generating the expected filename of the download artifact.
+     * 
+     * If all such registered producers return null, then default behaviour is to infer the download
+     * name from the first target in the {@link resolve(EntityDriver)} result. 
+     */
+    public void registerFilenameProducer(Function<? super DownloadRequirement, String> producer);
+
+    /**
+     * Gives artifact meta-data for what is required to be downloaded.
+     * 
+     * @author aled
+     */
+    public interface DownloadRequirement {
+        /**
+         * The {@link EntityDriver} that this download is for.
+         */
+        public EntityDriver getEntityDriver();
+
+        /**
+         * The name of the add-on to be downloaded, or null if it is the main installed.
+         * For example, can be used to specify nginx sticky-module or pcre download.
+         */
+        public String getAddonName();
+        
+        /**
+         * Default properties for this download. These will be made available when resolving the
+         * download template.
+         * 
+         * For the main entity download, properties include:
+         * <ul>
+         *   <li>fileSuffix: expected file suffix 
+         * </ul>
+         * 
+         * For an add-on, common properties include:
+         * <ul>
+         *   <li>version: version of the add-on to be used
+         *   <li>fileSuffix: expected file suffix 
+         * </ul>
+         */
+        public Map<String, ?> getProperties();
+    }
+    
+    
+    /**
+     * Describes the download locations, and their order, to try.
+     * 
+     * @author aled
+     */
+    public interface DownloadTargets {
+        /**
+         * Gets the locations to try (in-order).
+         */
+        public List<String> getPrimaryLocations();
+
+        /**
+         * Gets the locations to try (in-order), to be used only after all primary locations 
+         * have been tried.
+         */
+        public List<String> getFallbackLocations();
+
+        /**
+         * Indicates whether or not the results of this resolver are the last that should be used.
+         * If returns false, {@link resolve(EntityDriver)} will not iterate over any other resolvers.
+         * 
+         * For example, useful in an enterprise to disable any other resolvers that would have 
+         * resulted in going out to the public internet.
+         */
+        public boolean canContinueResolving();
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java b/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
new file mode 100644
index 0000000..789d282
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
@@ -0,0 +1,319 @@
+/*
+ * 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.api.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Serializable;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.mgmt.EntityManager;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.SpecParameter;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+import org.apache.brooklyn.util.collections.MutableSet;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+
+/** Defines a spec for creating a {@link BrooklynObject}.
+ * <p>
+ * In addition to the contract defined by the code,
+ * subclasses should provide a public static <code>create(Class)</code>
+ * method to create an instance of the spec for the target type indicated by the argument. 
+ * <p>
+ * The spec is then passed to type-specific methods,
+ * e.g. {@link EntityManager#createEntity(org.apache.brooklyn.api.entity.EntitySpec)}
+ * to create a managed instance of the target type. */
+public abstract class AbstractBrooklynObjectSpec<T,SpecT extends AbstractBrooklynObjectSpec<T,SpecT>> implements Serializable {
+
+    private static final long serialVersionUID = 3010955277740333030L;
+
+    private static final Logger log = LoggerFactory.getLogger(AbstractBrooklynObjectSpec.class);
+    
+    private final Class<? extends T> type;
+    private String displayName;
+    private String catalogItemId;
+    private Set<Object> tags = MutableSet.of();
+    private List<SpecParameter<?>> parameters = ImmutableList.of();
+
+    protected final Map<String, Object> flags = Maps.newLinkedHashMap();
+    protected final Map<ConfigKey<?>, Object> config = Maps.newLinkedHashMap();
+
+    protected AbstractBrooklynObjectSpec(Class<? extends T> type) {
+        checkValidType(type);
+        this.type = type;
+        this.catalogItemId = ApiObjectsFactory.get().getCatalogItemIdFromContext();
+    }
+    
+    @SuppressWarnings("unchecked")
+    protected SpecT self() {
+        return (SpecT) this;
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this).add("type", getType()).toString()+"@"+Integer.toHexString(System.identityHashCode(this));
+    }
+
+    protected abstract void checkValidType(Class<? extends T> type);
+    
+    public SpecT displayName(String val) {
+        displayName = val;
+        return self();
+    }
+    
+    public SpecT catalogItemId(String val) {
+        catalogItemId = val;
+        return self();
+    }
+    // TODO in many places (callers to this method) we prefer a wrapper item ID;
+    // that is right, because the wrapper's defn will refer to the wrapped,
+    // but we might need also to collect the item ID's so that *all* can be searched.
+    // e.g. if R3 references R2 which references R1 any one of these might supply config keys 
+    // referencing resources or types in their local bundles. 
+    @Beta
+    public SpecT catalogItemIdIfNotNull(String val) {
+        if (val!=null) {
+            catalogItemId = val;
+        }
+        return self();
+    }
+
+    
+    public SpecT tag(Object tag) {
+        tags.add(tag);
+        return self();
+    }
+
+    /** adds the given tags */
+    public SpecT tags(Iterable<Object> tagsToAdd) {
+        return tagsAdd(tagsToAdd);
+    }
+    /** adds the given tags */
+    public SpecT tagsAdd(Iterable<Object> tagsToAdd) {
+        Iterables.addAll(this.tags, tagsToAdd);
+        return self();
+    }
+    /** replaces tags with the given */
+    public SpecT tagsReplace(Iterable<Object> tagsToReplace) {
+        this.tags.clear();
+        Iterables.addAll(this.tags, tagsToReplace);
+        return self();
+    }
+    
+    // TODO which semantics are correct? replace has been the behaviour;
+    // add breaks tests and adds unwanted parameters,
+    // but replacing will cause some desired parameters to be lost.
+    // i (AH) think ideally the caller should remove any parameters which
+    // have been defined as config keys, and then add the others;
+    // or actually we should always add, since this is really defining the config keys,
+    // and maybe extend the SpecParameter object to be able to advertise whether
+    // it is a CatalogConfig or merely a config key, maybe introducing displayable, or even priority 
+    // (but note part of the reason for CatalogConfig.priority is that java reflection doesn't preserve field order) .
+    // see also comments on the camp SpecParameterResolver.
+    @Beta
+    public SpecT parameters(List<? extends SpecParameter<?>> parameters) {
+        return parametersReplace(parameters);
+    }
+    /** adds the given parameters */
+    @Beta
+    public SpecT parametersAdd(List<? extends SpecParameter<?>> parameters) {
+        // parameters follows immutable pattern, unlike the other fields
+        Builder<SpecParameter<?>> result = ImmutableList.<SpecParameter<?>>builder();
+        if (this.parameters!=null)
+            result.addAll(this.parameters);
+        result.addAll( checkNotNull(parameters, "parameters") );
+        this.parameters = result.build();
+        return self();
+    }
+    /** replaces parameters with the given */
+    @Beta
+    public SpecT parametersReplace(List<? extends SpecParameter<?>> parameters) {
+        this.parameters = ImmutableList.copyOf( checkNotNull(parameters, "parameters") );
+        return self();
+    }
+
+    /**
+     * @return The type (often an interface) this spec represents and which will be instantiated from it 
+     */
+    public Class<? extends T> getType() {
+        return type;
+    }
+    
+    /**
+     * @return The display name of the object
+     */
+    public final String getDisplayName() {
+        return displayName;
+    }
+    
+    public final String getCatalogItemId() {
+        return catalogItemId;
+    }
+
+    public final Set<Object> getTags() {
+        return ImmutableSet.copyOf(tags);
+    }
+
+    /** A list of configuration options that the entity supports. */
+    public final List<SpecParameter<?>> getParameters() {
+        //Could be null after rebind
+        if (parameters != null) {
+            return ImmutableList.copyOf(parameters);
+        } else {
+            return ImmutableList.of();
+        }
+    }
+
+    // TODO Duplicates method in BasicEntityTypeRegistry and InternalEntityFactory.isNewStyleEntity
+    protected final void checkIsNewStyleImplementation(Class<?> implClazz) {
+        try {
+            implClazz.getConstructor(new Class[0]);
+        } catch (NoSuchMethodException e) {
+            throw new IllegalStateException("Implementation "+implClazz+" must have a no-argument constructor");
+        } catch (SecurityException e) {
+            throw Exceptions.propagate(e);
+        }
+        
+        if (implClazz.isInterface()) throw new IllegalStateException("Implementation "+implClazz+" is an interface, but must be a non-abstract class");
+        if (Modifier.isAbstract(implClazz.getModifiers())) throw new IllegalStateException("Implementation "+implClazz+" is abstract, but must be a non-abstract class");
+    }
+    
+    // TODO Duplicates method in BasicEntityTypeRegistry
+    protected final void checkIsImplementation(Class<?> val, Class<? super T> requiredInterface) {
+        if (!requiredInterface.isAssignableFrom(val)) throw new IllegalStateException("Implementation "+val+" does not implement "+requiredInterface.getName());
+        if (val.isInterface()) throw new IllegalStateException("Implementation "+val+" is an interface, but must be a non-abstract class");
+        if (Modifier.isAbstract(val.getModifiers())) throw new IllegalStateException("Implementation "+val+" is abstract, but must be a non-abstract class");
+    }
+    
+    protected SpecT copyFrom(SpecT otherSpec) {
+        return displayName(otherSpec.getDisplayName())
+            .configure(otherSpec.getConfig())
+            .configure(otherSpec.getFlags())
+            .tags(otherSpec.getTags())
+            .catalogItemId(otherSpec.getCatalogItemId())
+            .parameters(otherSpec.getParameters());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj==null) return false;
+        if (!obj.getClass().equals(getClass())) return false;
+        AbstractBrooklynObjectSpec<?,?> other = (AbstractBrooklynObjectSpec<?,?>)obj;
+        if (!Objects.equal(getDisplayName(), other.getDisplayName())) return false;
+        if (!Objects.equal(getCatalogItemId(), other.getCatalogItemId())) return false;
+        if (!Objects.equal(getType(), other.getType())) return false;
+        if (!Objects.equal(getTags(), other.getTags())) return false;
+        if (!Objects.equal(getParameters(), other.getParameters())) return false;
+        return true;
+    }
+    
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(getCatalogItemId(), getDisplayName(), getType(), getTags());
+    }
+
+    /** strings inserted as flags, config keys inserted as config keys; 
+     * if you want to force one or the other, create a ConfigBag and convert to the appropriate map type */
+    public SpecT configure(Map<?,?> val) {
+        for (Map.Entry<?, ?> entry: val.entrySet()) {
+            if (entry.getKey()==null) throw new NullPointerException("Null key not permitted");
+            if (entry.getKey() instanceof CharSequence)
+                flags.put(entry.getKey().toString(), entry.getValue());
+            else if (entry.getKey() instanceof ConfigKey<?>)
+                config.put((ConfigKey<?>)entry.getKey(), entry.getValue());
+            else if (entry.getKey() instanceof HasConfigKey<?>)
+                config.put(((HasConfigKey<?>)entry.getKey()).getConfigKey(), entry.getValue());
+            else {
+                log.warn("Spec "+this+" ignoring unknown config key "+entry.getKey());
+            }
+        }
+        return self();
+    }
+
+    public SpecT configure(CharSequence key, Object val) {
+        flags.put(checkNotNull(key, "key").toString(), val);
+        return self();
+    }
+    
+    public <V> SpecT configure(ConfigKey<V> key, V val) {
+        config.put(checkNotNull(key, "key"), val);
+        return self();
+    }
+
+    public <V> SpecT configureIfNotNull(ConfigKey<V> key, V val) {
+        return (val != null) ? configure(key, val) : self();
+    }
+
+    public <V> SpecT configure(ConfigKey<V> key, Task<? extends V> val) {
+        config.put(checkNotNull(key, "key"), val);
+        return self();
+    }
+
+    public <V> SpecT configure(HasConfigKey<V> key, V val) {
+        config.put(checkNotNull(key, "key").getConfigKey(), val);
+        return self();
+    }
+
+    public <V> SpecT configure(HasConfigKey<V> key, Task<? extends V> val) {
+        config.put(checkNotNull(key, "key").getConfigKey(), val);
+        return self();
+    }
+
+    public <V> SpecT removeConfig(ConfigKey<V> key) {
+        config.remove( checkNotNull(key, "key") );
+        return self();
+    }
+
+    /** Clears the config map, removing any config previously set. */
+    public void clearConfig() {
+        config.clear();
+    }
+        
+    /**
+     * @return Read-only construction flags
+     * @see SetFromFlag declarations on the policy type
+     */
+    public Map<String, ?> getFlags() {
+        return Collections.unmodifiableMap(flags);
+    }
+    
+    /**
+     * @return Read-only configuration values
+     */
+    public Map<ConfigKey<?>, Object> getConfig() {
+        return Collections.unmodifiableMap(config);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
new file mode 100644
index 0000000..51c0185
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.api.internal;
+
+import java.util.ServiceLoader;
+
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+
+/** 
+ * This class grants access to implementations in core for operations needed in API classes.
+ * The majority of the API classes are interfaces or have minimal behaviour, but there are a
+ * few instances where more complex behaviour from core is desired.
+ * <p>
+ * This class acts as a bridge for those instances. See the concrete implementation of the
+ * {@link ApiObjectsFactoryInterface} in brooklyn-core class ApiObjectsFactoryImpl.
+ */
+@Beta
+public class ApiObjectsFactory {
+    
+    private static Maybe<ApiObjectsFactoryInterface> INSTANCE;
+
+    private static synchronized ApiObjectsFactoryInterface getFactoryInstance() {
+        // defer initialization to allow any other static initialization to complete,
+        // and use maybe so we (1) don't check multiple times, but (2) do throw error in the caller's stack
+        if (INSTANCE!=null) return INSTANCE.get();
+        
+        ServiceLoader<ApiObjectsFactoryInterface> LOADER = ServiceLoader.load(ApiObjectsFactoryInterface.class);
+        for (ApiObjectsFactoryInterface item : LOADER) {
+            INSTANCE = Maybe.of(item);
+            return INSTANCE.get();
+        }
+        INSTANCE = Maybe.absent("Implementation of " + ApiObjectsFactoryInterface.class + " not found on classpath; "
+            + "can be caused by IDE not copying resources, or by something else clobbering non-class resources needed for service loading");
+        return INSTANCE.get();
+    }
+
+    /**
+     * Create (if necessary) and return the concrete implementation from core for the
+     * methods exposed here. */
+    public static ApiObjectsFactoryInterface get() {
+        return getFactoryInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
new file mode 100644
index 0000000..6257524
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
@@ -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.
+ */
+package org.apache.brooklyn.api.internal;
+
+/** 
+ * Methods from downstream projects used in API classes at runtime. 
+ * See {@link ApiObjectsFactory}. 
+ */
+public interface ApiObjectsFactoryInterface {
+    
+    public String getCatalogItemIdFromContext();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
new file mode 100644
index 0000000..31c3b29
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.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.api.location;
+
+import java.net.InetAddress;
+
+/** A location that has an IP address.
+ * <p>
+ * This IP address may be a machine (usually the MachineLocation sub-interface), 
+ * or often an entry point for a service.
+ */
+public interface AddressableLocation extends Location {
+
+    /**
+     * Return the single most appropriate address for this location.
+     * (An implementation or sub-interface definition may supply more information
+     * on the precise semantics of the address.)
+     * 
+     * Should not return null, but in some "special cases" (e.g. CloudFoundryLocation it
+     * may return null if the location is not configured correctly). Users should expect
+     * a non-null result and treat null as a programming error or misconfiguration. 
+     * Implementors of this interface should strive to not return null (and then we'll
+     * remove this caveat from the javadoc!).
+     */
+    InetAddress getAddress();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
new file mode 100644
index 0000000..99d4fee
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.api.location;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * A default no-op implementation, which can be extended to override the appropriate methods.
+ * 
+ * Sub-classing will give the user some protection against future API changes - note that 
+ * {@link MachineLocationCustomizer} is marked {@link Beta}.
+ */
+@Beta
+public class BasicMachineLocationCustomizer implements MachineLocationCustomizer {
+
+    @Override
+    public void customize(MachineLocation machine) {
+        // no-op
+    }
+    
+    @Override
+    public void preRelease(MachineLocation machine) {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
new file mode 100644
index 0000000..7e4cc49
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.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.api.location;
+
+import javax.annotation.Nullable;
+
+/**
+ * @since 0.7.0
+ */
+public interface HardwareDetails {
+
+    /**
+     * The number of CPUs on the machine
+     */
+    @Nullable
+    Integer getCpuCount();
+
+    /**
+     * Amount of RAM in megabytes
+     */
+    @Nullable
+    Integer getRam();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/Location.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/Location.java b/api/src/main/java/org/apache/brooklyn/api/location/Location.java
new file mode 100644
index 0000000..ea43bfd
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/Location.java
@@ -0,0 +1,137 @@
+/*
+ * 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.api.location;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+
+/**
+ * A location that an entity can be in. Examples of locations include a single machine
+ * or a pool of machines, or a region within a given cloud. 
+ */
+public interface Location extends BrooklynObject {
+
+    /**
+     * A unique id for this location.
+     */
+    @Override
+    String getId();
+
+    /**
+     * Get the name assigned to this location.
+     *
+     * @return the name assigned to the location.
+     * @since 0.6 (previously getName())
+     */
+    @Override
+    String getDisplayName();
+
+    /**
+     * Get the 'parent' of this location. Locations are organized into a tree hierarchy, and this method will return a reference
+     * to the parent of this location, or {@code null} if this location is the tree root.
+     *
+     * @return a reference to the parent of this location, or {@code null} if this location is the tree root.
+     * @since 0.6 (previously getParentLocation())
+     */
+    Location getParent();
+
+    /**
+     * Get the 'children' of this location. Locations are organized into a tree hierarchy, and this method will return a
+     * collection containing the children of this location. This collection is an unmodifiable view of the data.
+     *
+     * @return a collection containing the children of this location.
+     * @since 0.6 (previously getChildLocations())
+     */
+    Collection<Location> getChildren();
+
+    /**
+     * Set the 'parent' of this location. If this location was previously a child of a different location, it is removed from
+     * the other location first. It is valid to pass in {@code null} to indicate that the location should be disconnected
+     * from its parent.
+     * 
+     * Adds this location as a child of the new parent (see {@code getChildLocations()}).
+     *
+     * @param newParent the new parent location object, or {@code null} to clear the parent reference.
+     * @since 0.6 (previously setParentLocation(Location))
+     */
+    void setParent(Location newParent);
+
+    /**
+     * @return meta-data about the location (usually a long line, or a small number of lines).
+     * 
+     * @since 0.6
+     */
+    String toVerboseString();
+    
+    /**
+     * Answers true if this location equals or is an ancestor of the given location.
+     */
+    boolean containsLocation(Location potentialDescendent);
+
+    /**
+     * Convenience method for {@code config().get(key)}
+     * 
+     * @see {@link #getConfig(ConfigKey)}
+     */
+    <T> T getConfig(HasConfigKey<T> key);
+
+    /** 
+     * True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false).
+     * 
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getRaw(key).isPresent()}
+     */
+    @Deprecated
+    boolean hasConfig(ConfigKey<?> key, boolean includeInherited);
+
+    /** 
+     * Returns all config set, either inherited (argument true) or locally-only (argument false).
+     * 
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().getBag()}
+     */
+    @Deprecated
+    public Map<String,Object> getAllConfig(boolean includeInherited);
+    
+    /**
+     * Whether this location has support for the given extension type.
+     * See additional comments in {@link #getExtension(Class)}.
+     * 
+     * @throws NullPointerException if extensionType is null
+     */
+    boolean hasExtension(Class<?> extensionType);
+
+    /**
+     * Returns an extension of the given type. Note that the type must be an exact match for
+     * how the extension was registered (e.g. {@code getExtension(Object.class)} will not match
+     * anything, even though registered extension extend {@link Object}.
+     * <p>
+     * This will not look at extensions of {@link #getParent()}.
+     * 
+     * @throws IllegalArgumentException if this location does not support the given extension type
+     * @throws NullPointerException if extensionType is null
+     */
+    <T> T getExtension(Class<T> extensionType);
+    
+    @Override
+    RelationSupport<Location> relations();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
new file mode 100644
index 0000000..2bbe74c
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+
+/**
+ * Defines a location, where the {@link #getSpec()} is like a serialized representation
+ * of the location so that Brooklyn can create a corresponding location.
+ * 
+ * Examples include a complete description (e.g. giving a list of machines in a pool), or
+ * a name that matches a named location defined in the brooklyn poperties.
+ * 
+ * Users are not expected to implement this, or to use the interface directly. See
+ * {@link LocationRegistry#resolve(String)} and {@link ManagementContext#getLocationRegistry()}.
+ */
+public interface LocationDefinition {
+
+    public String getId();
+    public String getName();
+    public String getSpec();
+    public Map<String,Object> getConfig();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
new file mode 100644
index 0000000..de1c09d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.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.api.location;
+
+
+/**
+ * Indicates that a {@link ProvisioningLocation} is not able to provision a requested location
+ */
+public class LocationNotAvailableException extends Exception {
+    private static final long serialVersionUID = 1079817235289265761L;
+    
+    public LocationNotAvailableException(String s) {
+        super(s);
+    }
+
+    public LocationNotAvailableException(String s, Throwable throwable) {
+        super(s, throwable);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
new file mode 100644
index 0000000..50fbc6a
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
@@ -0,0 +1,128 @@
+/*
+ * 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.api.location;
+
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * The registry of the sorts of locations that brooklyn knows about. Given a
+ * {@LocationDefinition} or a {@link String} representation of a spec, this can
+ * be used to create a {@link Location} instance.
+ */
+@SuppressWarnings("rawtypes")
+public interface LocationRegistry {
+
+    /** map of ID (possibly randomly generated) to the definition (spec, name, id, and props; 
+     * where spec is the spec as defined, for instance possibly another named:xxx location) */
+    public Map<String,LocationDefinition> getDefinedLocations();
+    
+    /** returns a LocationDefinition given its ID (usually a random string), or null if none */
+    public LocationDefinition getDefinedLocationById(String id);
+    
+    /** returns a LocationDefinition given its name (e.g. for named locations, supply the bit after the "named:" prefix), 
+     * or null if none */
+    public LocationDefinition getDefinedLocationByName(String name);
+
+    /** adds or updates the given defined location */
+    public void updateDefinedLocation(LocationDefinition l);
+
+    /** removes the defined location from the registry (applications running there are unaffected) */
+    public void removeDefinedLocation(String id);
+
+    /** Returns a fully populated (config etc) location from the given definition, with optional add'l flags.
+     * the location will be managed by default, unless the manage parameter is false, 
+     * or the manage parameter is null and the CREATE_UNMANAGED flag is set.
+     * <p>
+     * The manage parameter is {@link Boolean} so that null can be used to say rely on anything in the flags.
+     * 
+     * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
+    @Beta
+    public Maybe<Location> resolve(LocationDefinition ld, Boolean manage, Map locationFlags);
+    
+    /** As {@link #resolve(LocationDefinition, Boolean, Map), with the location managed, and no additional flags,
+     * unwrapping the result (throwing if not resolvable) */
+    public Location resolve(LocationDefinition l);
+
+    /** Returns a location created from the given spec, which might correspond to a definition, or created on-the-fly.
+     * Optional flags can be passed through to underlying the location. 
+     * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
+    @Beta
+    public Maybe<Location> resolve(String spec, Boolean manage, Map locationFlags);
+    
+    /** efficiently returns for inspection only a fully populated (config etc) location from the given definition; 
+     * the value might be unmanaged so it is not meant for any use other than inspection,
+     * but callers should prefer this when they don't wish to create a new location which will be managed in perpetuity!
+     * 
+     * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
+    @Deprecated
+    public Location resolveForPeeking(LocationDefinition l);
+
+    /** returns fully populated (config etc) location from the given definition, with overrides;
+     * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
+    @Deprecated
+    public Location resolve(LocationDefinition l, Map<?,?> locationFlags);
+    
+    /** See {@link #resolve(String, Boolean, Map)}; asks for the location to be managed, and supplies no additional flags,
+     * and unwraps the result (throwing if the spec cannot be resolve) */
+    public Location resolve(String spec);
+    
+    /** Returns true/false depending whether spec seems like a valid location,
+     * that is it has a chance of being resolved (depending on the spec) but NOT guaranteed,
+     * as it is not passed to the spec;
+     * see {@link #resolve(String, Boolean, Map)} which has stronger guarantees 
+     * @deprecated since 0.7.0, not really needed, and semantics are weak; use {@link #resolve(String, Boolean, Map)} */
+    @Deprecated
+    public boolean canMaybeResolve(String spec);
+    
+    /** As {@link #resolve(String, Boolean, Map)}, but unwrapped
+     * @throws NoSuchElementException if the spec cannot be resolved */
+    public Location resolve(String spec, @Nullable Map locationFlags);
+    
+    /** as {@link #resolve(String)} but returning null (never throwing)
+     * @deprecated since 0.7.0 use {@link #resolve(String, Boolean, Map)} */
+    @Deprecated
+    public Location resolveIfPossible(String spec);
+
+    /**
+     * As {@link #resolve(String)} but takes collections (of strings or locations)
+     * <p>
+     * Expects a collection of elements being individual location spec strings or locations, 
+     * and returns a list of resolved (newly created and managed) locations.
+     * <p>
+     * From 0.7.0 this no longer flattens lists (nested lists are disallowed) 
+     * or parses comma-separated elements (they are resolved as-is)
+     */
+    public List<Location> resolve(Iterable<?> spec);
+    
+    /** Takes a string, interpreted as a comma-separated (or JSON style, when you need internal double quotes or commas) list;
+     * or a list, passed to {@link #resolve(Iterable)}; or null/empty (empty list),
+     * and returns a list of resolved (created and managed) locations */
+    public List<Location> resolveList(Object specList);
+    
+    public Map getProperties();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
new file mode 100644
index 0000000..4ddb5e4
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provides a way of creating location instances of a particular type.
+ */
+public interface LocationResolver {
+
+    void init(ManagementContext managementContext);
+    
+    /** the prefix that this resolver will attend to */
+    String getPrefix();
+    
+    /** whether the spec is something which should be passed to this resolver */
+    boolean accepts(String spec, LocationRegistry registry);
+
+    /**
+     * Similar to {@link #newLocationFromString(Map, String)} 
+     * but passing in a reference to the registry itself (from which the base properties are discovered)
+     * and including flags (e.g. user, key, cloud credential) which are known to be for this location.
+     * <p>
+     * introduced to support locations which refer to other locations, e.g. NamedLocationResolver  
+     **/ 
+    @SuppressWarnings("rawtypes")
+    Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry);
+
+    /** @since 0.7.0 exploring this as a mechanism to disable locations */
+    @Beta
+    public interface EnableableLocationResolver extends LocationResolver {
+        /** whether the location is enabled */
+        boolean isEnabled();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
new file mode 100644
index 0000000..b66ebea
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
@@ -0,0 +1,168 @@
+/*
+ * 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.api.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.config.ConfigKey;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Gives details of a location to be created. It describes the location's configuration, and is
+ * reusable to create multiple locations with the same configuration.
+ * 
+ * To create a LocationSpec, it is strongly encouraged to use {@code create(...)} methods.
+ * 
+ * @param <T> The type of location to be created
+ * 
+ * @author aled
+ */
+public class LocationSpec<T extends Location> extends AbstractBrooklynObjectSpec<T,LocationSpec<T>> {
+
+    // TODO Would like to add `configure(ConfigBag)`, but `ConfigBag` is in core rather than api
+    
+    private final static long serialVersionUID = 1L;
+
+    /**
+     * Creates a new {@link LocationSpec} instance for a location of the given type. The returned 
+     * {@link LocationSpec} can then be customized.
+     * 
+     * @param type A {@link Location} class
+     */
+    public static <T extends Location> LocationSpec<T> create(Class<T> type) {
+        return new LocationSpec<T>(type);
+    }
+    
+    /**
+     * Creates a new {@link LocationSpec} instance with the given config, for a location of the given type.
+     * 
+     * This is primarily for groovy code; equivalent to {@code LocationSpec.create(type).configure(config)}.
+     * 
+     * @param config The spec's configuration (see {@link LocationSpec#configure(Map)}).
+     * @param type   A {@link Location} class
+     */
+    public static <T extends Location> LocationSpec<T> create(Map<?,?> config, Class<T> type) {
+        return LocationSpec.create(type).configure(config);
+    }
+    
+    /**
+     * Copies entity spec so its configuration can be overridden without modifying the 
+     * original entity spec.
+     */
+    public static <T extends Location> LocationSpec<T> create(LocationSpec<T> spec) {
+        // need this to get LocationSpec<T> rather than LocationSpec<? extends T>
+        @SuppressWarnings("unchecked")
+        Class<T> exactType = (Class<T>)spec.getType();
+        
+        return create(exactType).copyFrom(spec);
+    }
+
+    private String id;
+    private Location parent;
+    private final Map<Class<?>, Object> extensions = Maps.newLinkedHashMap();
+
+    protected LocationSpec(Class<T> type) {
+        super(type);
+    }
+     
+    @Override
+    protected LocationSpec<T> copyFrom(LocationSpec<T> otherSpec) {
+        LocationSpec<T> result = super.copyFrom(otherSpec).extensions(otherSpec.getExtensions());
+        if (otherSpec.getParent() != null) result.parent(otherSpec.getParent());
+        if (otherSpec.getId() != null) result.id(otherSpec.getId());
+        return result;
+    }
+    
+    protected void checkValidType(Class<? extends T> type) {
+        checkIsImplementation(type, Location.class);
+        checkIsNewStyleImplementation(type);
+    }
+
+    /**
+     * @deprecated since 0.7.0; instead let the management context pick a random+unique id
+     */
+    @Deprecated
+    public LocationSpec<T> id(String val) {
+        id = val;
+        return this;
+    }
+
+    public LocationSpec<T> parent(Location val) {
+        parent = checkNotNull(val, "parent");
+        return this;
+    }
+
+    public <E> LocationSpec<T> extension(Class<E> extensionType, E extension) {
+        extensions.put(checkNotNull(extensionType, "extensionType"), checkNotNull(extension, "extension"));
+        return this;
+    }
+    
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public <E> LocationSpec<T> extensions(Map<Class<?>, ?> extensions) {
+        for (Map.Entry<Class<?>, ?> entry : extensions.entrySet()) {
+            extension((Class)entry.getKey(), entry.getValue());
+        }
+        return this;
+    }
+    
+    /**
+     * @return The id of the location to be created, or null if brooklyn can auto-generate an id
+     * 
+     * @deprecated since 0.7.0; instead let the management context pick a random+unique id
+     */
+    @Deprecated
+    public String getId() {
+        return id;
+    }
+    
+    /**
+     * @return The location's parent
+     */
+    public Location getParent() {
+        return parent;
+    }
+    
+    /**
+     * @return Read-only construction flags
+     * @see SetFromFlag declarations on the location type
+     */
+    public Map<String, ?> getFlags() {
+        return Collections.unmodifiableMap(flags);
+    }
+    
+    /**
+     * @return Read-only configuration values
+     */
+    public Map<ConfigKey<?>, Object> getConfig() {
+        return Collections.unmodifiableMap(config);
+    }
+        
+    /**
+     * @return Read-only extension values
+     */
+    public Map<Class<?>, Object> getExtensions() {
+        return Collections.unmodifiableMap(extensions);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
new file mode 100644
index 0000000..8032333
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationType.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.api.location;
+
+import org.apache.brooklyn.api.objs.BrooklynType;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives type information for a {@link Location}. It is immutable.
+ 
+ * @since 0.7.0
+ */
+@Beta
+public interface LocationType extends BrooklynType {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
new file mode 100644
index 0000000..ae8b1c2
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
@@ -0,0 +1,34 @@
+/*
+ * 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.api.location;
+
+import javax.annotation.Nonnull;
+
+/**
+ * @since 0.7.0
+ */
+public interface MachineDetails {
+
+    @Nonnull
+    HardwareDetails getHardwareDetails();
+
+    @Nonnull
+    OsDetails getOsDetails();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
new file mode 100644
index 0000000..7483ec5
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.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.api.location;
+
+import java.net.InetAddress;
+
+import org.apache.brooklyn.util.net.HasNetworkAddresses;
+
+/**
+ * A location that is a machine.
+ *
+ * This interface marks a {@link Location} being a network node with an IP address, 
+ * and supports appropriate operations on the node.
+ */
+public interface MachineLocation extends AddressableLocation, HasNetworkAddresses {
+    /**
+     * @return the machine's network address.
+     */
+    InetAddress getAddress();
+
+    /** @deprecated since 0.7.0. Use getMachineDetails().getOsDetails() instead. */
+    @Deprecated
+    OsDetails getOsDetails();
+
+    /*
+     * @return hardware and operating system-specific details for the machine.
+     */
+    MachineDetails getMachineDetails();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
new file mode 100644
index 0000000..a9b4e2e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.location;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Customization hooks to allow apps to perform specific customisation of obtained machines.
+ * <p>
+ * Users are strongly encouraged to sub-class {@link BasicMachineLocationCustomizer}, to give
+ * some protection against this {@link Beta} API changing in future releases.
+ */
+@Beta
+public interface MachineLocationCustomizer {
+
+    /**
+     * Override to configure the given machine once it has been created (prior to any use).
+     */
+    void customize(MachineLocation machine);
+    
+    /**
+     * Override to handle machine-related cleanup prior to {@link MachineProvisioningLocation} 
+     * releasing the machine.
+     */
+    void preRelease(MachineLocation machine);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
new file mode 100644
index 0000000..f7c091b
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.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.api.location;
+
+import java.util.Map;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Defines mixins for interesting locations.
+ */
+public class MachineManagementMixins {
+    
+    public interface RichMachineProvisioningLocation<T extends MachineLocation> extends
+            MachineProvisioningLocation<T>, ListsMachines, GivesMachineMetadata, KillsMachines {}
+
+    public interface ListsMachines {
+        /**
+         * @return A map of machine ID to metadata record for all machines known in a given cloud location.
+         */
+        Map<String,MachineMetadata> listMachines();
+    }
+    
+    public interface GivesMachineMetadata {
+        /**
+         * @return the {@link MachineMetadata} for a given (brooklyn) machine location instance,
+         * or null if not matched.
+         */
+        MachineMetadata getMachineMetadata(MachineLocation location);
+    }
+    
+    public interface KillsMachines {
+        /** Kills the indicated machine; throws if not recognised or possible */
+        void killMachine(MachineLocation machine);
+        
+        /** Kills the machine indicated by the given (server-side) machine id;
+         *  note, the ID is the _cloud-service_ ID,
+         *  that is, pass in getMetadata(machineLocation).getId() not the machineLocation.getId() */
+        void killMachine(String cloudServiceId);
+    }
+    
+    /** very lightweight machine record */
+    public interface MachineMetadata {
+        /** The cloud service ID -- distinct from any Brooklyn {@link Location#getId()} */
+        String getId();
+        String getName();
+        String getPrimaryIp();
+        Boolean isRunning();
+        /** original metadata object, if available; e.g. ComputeMetadata when using jclouds */ 
+        Object getOriginalMetadata();
+    }
+
+    /**
+     * Implement to indicate that a location can suspend and resume machines.
+     */
+    @Beta
+    public interface SuspendResumeLocation extends SuspendsMachines, ResumesMachines {}
+
+    @Beta
+    public interface SuspendsMachines {
+        /**
+         * Suspend the indicated machine.
+         */
+        void suspendMachine(MachineLocation location);
+    }
+
+    @Beta
+    public interface ResumesMachines {
+        /**
+         * Resume the indicated machine.
+         */
+        MachineLocation resumeMachine(Map<?, ?> flags);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
new file mode 100644
index 0000000..1fcf785
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.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.api.location;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * A location that is able to provision new machines within its location.
+ *
+ * This interface extends {@link Location} to add the ability to provision {@link MachineLocation}s in this location.
+ */
+public interface MachineProvisioningLocation<T extends MachineLocation> extends ProvisioningLocation<T> {
+    /**
+     * Obtain a machine in this location.
+     * 
+     * @param flags Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers).
+     * "callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel)
+     * @return a machine that is a child of this location.
+     * @throws NoMachinesAvailableException if there are no machines available in this location (or impls may return null, but that is discouraged)
+     */
+    @Override
+    T obtain(Map<?,?> flags) throws NoMachinesAvailableException;
+
+    /**
+     * Creates a new location of the same type, but with additional creation instructions in the form of flags,
+     * e.g. for specifying subnets, security groups, etc
+     * <p>
+     * Implementers who wish to subclass this provisioning location for additional functionality
+     * in a specific cloud can use the relevant implementation of this method as a guide. 
+     */
+    MachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags);
+    
+    /**
+     * Release a previously-obtained machine.
+     *
+     * @param machine a {@link MachineLocation} previously obtained from a call to {@link #obtain()}
+     * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released.
+     */
+    @Override
+    void release(T machine);
+    
+    /**
+     * Gets flags, suitable as an argument to {@link #obtain(Map)}. The tags provided give
+     * hints about the machine required. The provisioning-location could be configured to 
+     * understand those tags. 
+     * 
+     * For example, an AWS-location could be configured to understand that a particular entity
+     * type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the 
+     * required image id.
+     *  
+     * @param tags
+     * @return
+     */
+    Map<String,Object> getProvisioningFlags(Collection<String> tags);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java b/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java
new file mode 100644
index 0000000..f13c1ff
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.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.api.location;
+
+
+/**
+ * Indicates no machines are available in a given location.
+ */
+public class NoMachinesAvailableException extends LocationNotAvailableException {
+    private static final long serialVersionUID = 1079817235289265761L;
+    
+    public NoMachinesAvailableException(String s) {
+        super(s);
+    }
+
+    public NoMachinesAvailableException(String s, Throwable throwable) {
+        super(s, throwable);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java
new file mode 100644
index 0000000..9baac9e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.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.api.location;
+
+import javax.annotation.Nullable;
+
+public interface OsDetails {
+
+    /** The name of the operating system, e.g. "Debian" or "Red Hat Enterprise Linux Server" */
+    @Nullable
+    String getName();
+
+    /**
+     * The version of the operating system. Generally numeric (e.g. "6.3") but occasionally
+     * alphabetic (e.g. Debian's "Squeeze").
+     */
+    @Nullable
+    String getVersion();
+
+    /** The operating system's architecture, e.g. "x86" or "x86_64" */
+    @Nullable
+    String getArch();
+
+    boolean is64bit();
+
+    boolean isWindows();
+    boolean isLinux();
+    boolean isMac();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java b/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
new file mode 100644
index 0000000..108f0dd
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
@@ -0,0 +1,48 @@
+/*
+ * 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.api.location;
+
+/**
+ * A range of ports (indicator for Location and other APIs).
+ * Using methods {@code PortRanges.fromXxx(...)} this is adaptable from a number, a string, or a collection of numbers or a strings.
+ * String may be of the form:
+ *   <li> "80": just 80
+ *   <li> "8080-8090": limited range sequentially; ie try 8080, then 8081, ..., then 8090, then give up
+ *   <li> "8080-8000": as above, but descending; ie try 8080, then 8079, ..., then 8000, then give up
+ *   <li> "8000+": unlimited range sequentially; ie try 8000, then 8001, then 8002, etc
+ *   <li> "80,8080,8000,8080-8099": different ranges, in order; ie try 80, then 8080, then 8000, then 8080 (again), then 8081, ..., then 8099, then give up
+ * Ranges (but not lists) may be preceeded by "!" to indicate a randomly selected port:
+ * 
+ * @see brooklyn.location.basic.PortRanges
+ */
+//MAYDO could have:   <li> "~32168-65535" (or "~32168-"): try randomly selected numbers in range 32168-65535 (MAX_PORT) until all have been tried
+public interface PortRange extends Iterable<Integer> {
+    /**
+     * Whether there are any ports in the range.
+     */
+    boolean isEmpty();
+    
+    /**
+     * Note: this method is only here for use with "groovy truth". Users are strongly discouraged  
+     * from calling it directly.
+     *  
+     * @return {@code !isEmpty()}; i.e. true if there is at least one port in the range; false otherwise
+     */
+    boolean asBoolean();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java b/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java
new file mode 100644
index 0000000..02c4398
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.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.api.location;
+
+/** Mixin interface for location which allows it to supply ports from a given range */
+public interface PortSupplier {
+
+    /**
+     * Reserve a specific port for an application. If your application requires a specific port - for example, port 80 for a web
+     * server - you should reserve this port before starting your application. Using this method, you will be able to detect if
+     * another application has already claimed this port number.
+     *
+     * @param portNumber the required port number.
+     * @return {@code true} if the port was successfully reserved; {@code false} if it has been previously reserved.
+     */
+    boolean obtainSpecificPort(int portNumber);
+
+    /**
+     * Reserve a port for your application, with a port number in a specific range. If your application requires a port, but it does
+     * not mind exactly which port number - for example, a port for internal JMX monitoring - call this method.
+     *
+     * @param range the range of acceptable port numbers.
+     * @return the port number that has been reserved, or -1 if there was no available port in the acceptable range.
+     */
+    int obtainPort(PortRange range);
+
+    /**
+     * Release a previously reserved port.
+     *
+     * @param portNumber the port number from a call to {@link #obtainPort(PortRange)} or {@link #obtainSpecificPort(int)}
+     */
+    void releasePort(int portNumber);
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java
new file mode 100644
index 0000000..25bd209
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.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.api.location;
+
+import java.util.Map;
+
+/**
+ * A location that is able to provision new locations within it.
+ */
+public interface ProvisioningLocation<T extends Location> extends Location {
+    /**
+     * Obtain a new (sub)-location in the location represented by this class.
+     * 
+     * @param flags Constraints and details of the location to be provisioned
+     * @return the location provisioned
+     * @throws LocationNotAvailableException if could not provision such a location
+     */
+    T obtain(Map<?,?> flags) throws LocationNotAvailableException;
+
+    /**
+     * Release a previously-obtained location.
+     *
+     * @param location a location previously obtained
+     * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released.
+     */
+    void release(T machine);
+    
+}


[21/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/render/RendererHints.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/render/RendererHints.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/render/RendererHints.java
deleted file mode 100644
index 4ff47d1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/render/RendererHints.java
+++ /dev/null
@@ -1,284 +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.core.config.render;
-
-import groovy.lang.Closure;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.util.groovy.GroovyJavaMethods;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.SetMultimap;
-import com.google.common.collect.Sets;
-
-/**
- * Registry of hints for displaying items such as sensors, e.g. in the web console.
- */
-public class RendererHints {
-
-    private static final Logger log = LoggerFactory.getLogger(RendererHints.class);
-    
-    private static SetMultimap<Object, Hint<?>> registry = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.<Object, Hint<?>>create());
-
-    @VisibleForTesting
-    public static SetMultimap<Object, Hint<?>> getRegistry() { return registry; }
-    
-    /**
-     * Registers a {@link Hint} against the given element.
-     * <p>
-     * Returns the element, for convenience when used in a with block after defining the element.
-     */
-    public static <T> AttributeSensor<T> register(AttributeSensor<T> element, Hint<? super T> hintForThatElement) { return _register(element, hintForThatElement); }
-    /** as {@link #register(AttributeSensor, Hint)} */
-    public static <T> ConfigKey<T> register(ConfigKey<T> element, Hint<? super T> hintForThatElement) { return _register(element, hintForThatElement); }
-    /** as {@link #register(AttributeSensor, Hint)} */
-    public static <T> Class<T> register(Class<T> element, Hint<? super T> hintForThatElement) { return _register(element, hintForThatElement); }
-    
-    private static <T> T _register(T element, Hint<?> hintForThatElement) {
-        if (element==null) {
-            // can happen if being done in a static initializer in an inner class
-            log.error("Invalid null target for renderer hint "+hintForThatElement, new Throwable("Trace for invalid null target for renderer hint"));
-        }
-        registry.put(element, hintForThatElement);
-        return element;
-    }
-
-    /** Returns all registered hints against the given element */
-    public static Set<Hint<?>> getHintsFor(AttributeSensor<?> element) { return _getHintsFor(element, null); }
-    /** as {@link #getHintsFor(AttributeSensor)} */
-    public static Set<Hint<?>> getHintsFor(ConfigKey<?> element) { return _getHintsFor(element, null); }
-    /** as {@link #getHintsFor(AttributeSensor)} */
-    public static Set<Hint<?>> getHintsFor(Class<?> element) { return _getHintsFor(element, null); }
-
-    @Deprecated /** @deprecated since 0.7.0 only supported for certain types */
-    public static Set<Hint<?>> getHintsFor(Object element) { return getHintsFor(element, null); }
-
-    @Deprecated /** @deprecated since 0.7.0 only supported for certain types */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static Set<Hint<?>> getHintsFor(Object element, Class<? extends Hint> optionalHintSuperClass) { return (Set<Hint<?>>) _getHintsFor(element, optionalHintSuperClass); }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private static <T extends Hint> Set<T> _getHintsFor(Object element, Class<T> optionalHintSuperClass) {
-        Set<Hint<?>> found = ImmutableSet.copyOf(registry.get(element));
-        if (found.isEmpty() && element instanceof Class && !Object.class.equals(element)) {
-            // try superclasses of the element; this seems overkill for the main use case, Entity;
-            // (other classes registered are typically final)
-            found = (Set<Hint<?>>) _getHintsFor(((Class)element).getSuperclass(), optionalHintSuperClass);
-            if (found.isEmpty()) {
-                for (Class<?> parentInterface: ((Class)element).getInterfaces()) {
-                    found = (Set<Hint<?>>) _getHintsFor(parentInterface, optionalHintSuperClass);
-                    if (!found.isEmpty())
-                        break;
-                }
-            }
-        }
-        if (optionalHintSuperClass != null) {
-            return (Set<T>)Sets.filter(found, Predicates.instanceOf(optionalHintSuperClass));
-        } else {
-            return (Set<T>)found;
-        }
-    }
-
-    /** Applies the (first) display value hint registered against the given target to the given initialValue */  
-    public static Object applyDisplayValueHint(AttributeSensor<?> target, Object initialValue) { return applyDisplayValueHintUnchecked(target, initialValue); }
-    /** as {@link #applyDisplayValueHint(AttributeSensor, Object)} */
-    public static Object applyDisplayValueHint(ConfigKey<?> target, Object initialValue) { return applyDisplayValueHintUnchecked(target, initialValue); }
-    /** as {@link #applyDisplayValueHint(AttributeSensor, Object)} */
-    public static Object applyDisplayValueHint(Class<?> target, Object initialValue) { return applyDisplayValueHintUnchecked(target, initialValue); }
-    
-    /** as {@link #applyDisplayValueHint(AttributeSensor, Object)}, but without type checking; public for those few cases where we may have lost the type */
-    @Beta
-    public static Object applyDisplayValueHintUnchecked(Object target, Object initialValue) { return _applyDisplayValueHint(target, initialValue, true); }
-    @SuppressWarnings("rawtypes")
-    private static Object _applyDisplayValueHint(Object target, Object initialValue, boolean includeClass) {
-        Iterable<RendererHints.DisplayValue> hints = RendererHints._getHintsFor(target, RendererHints.DisplayValue.class);
-        if (Iterables.size(hints) > 1) {
-            log.warn("Multiple display value hints set for {}; Only one will be applied, using first", target);
-        }
-
-        Optional<RendererHints.DisplayValue> hint = Optional.fromNullable(Iterables.getFirst(hints, null));
-        Object value = hint.isPresent() ? hint.get().getDisplayValue(initialValue) : initialValue;
-        if (includeClass && value!=null && !(value instanceof String) && !(value instanceof Number) && !(value.getClass().isPrimitive())) {
-            value = _applyDisplayValueHint(value.getClass(), value, false);
-        }
-        return value;
-    }
-
-
-    /** Parent marker class for hints. */
-    public static abstract class Hint<T> { }
-
-    public static interface NamedAction {
-        String getActionName();
-    }
-    
-    /**
-     * This hint describes a named action possible on something, e.g. a sensor;
-     * currently used in web client to show actions on sensors
-     */
-    public static class NamedActionWithUrl<T> extends Hint<T> implements NamedAction {
-        private final String actionName;
-        private final Function<T, String> postProcessing;
-
-        public NamedActionWithUrl(String actionName) {
-            this(actionName, (Function<T, String>)null);
-        }
-
-        @SuppressWarnings("unchecked") @Deprecated /** @deprecated since 0.7.0 use Function */
-        public NamedActionWithUrl(String actionName, Closure<String> postProcessing) {
-            this.actionName = actionName;
-            this.postProcessing = (Function<T, String>) ((postProcessing == null) ? null : GroovyJavaMethods.functionFromClosure(postProcessing));
-        }
-
-        public NamedActionWithUrl(String actionName, Function<T, String> postProcessing) {
-            this.actionName = actionName;
-            this.postProcessing = postProcessing;
-        }
-
-        /** @deprecated since 0.7.0 call {@link #getUrlFromValue(Object)}, parsing the sensor value yourself */ @Deprecated
-        public String getUrl(Entity e, AttributeSensor<T> s) {
-            return getUrlFromValue(e.getAttribute(s));
-        }
-
-        public String getActionName() {
-            return actionName;
-        }
-
-        /** this is the method invoked by web console SensorSummary, at the moment */
-        public String getUrlFromValue(T v) {
-            String v2;
-            if (postProcessing != null) {
-                v2 = postProcessing.apply(v);
-            } else {
-                v2 = (v==null ? null : v.toString());
-            }
-            if (v2 == null) return v2;
-            return v2.toString();
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(actionName, postProcessing);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (!(obj instanceof NamedActionWithUrl)) return false;
-            NamedActionWithUrl<?> o = (NamedActionWithUrl<?>) obj;
-            return Objects.equal(actionName, o.actionName) && Objects.equal(postProcessing, o.postProcessing);
-        }
-    }
-
-    /**
-     * This hint describes a transformation used to generate a display value for config keys and sensors.
-     * <p>
-     * <em><strong>Warning</strong> This is currently a {@link Beta} implementation, and
-     * may be changed or removed if there is a suitable alternative mechanism to achieve
-     * this functionality.</em>
-     */
-    @Beta
-    public static class DisplayValue<T> extends Hint<T> {
-        private final Function<Object, String> transform;
-
-        @SuppressWarnings("unchecked")
-        protected DisplayValue(Function<?, String> transform) {
-            this.transform = (Function<Object, String>) Preconditions.checkNotNull(transform, "transform");
-        }
-
-        public String getDisplayValue(Object v) {
-            String dv = transform.apply(v);
-            return Strings.nullToEmpty(dv);
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(transform);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj == null || !(obj instanceof DisplayValue)) return false;
-            return Objects.equal(transform, ((DisplayValue<?>)obj).transform);
-        }
-    }
-
-    @Beta
-    public static <T> DisplayValue<T> displayValue(Function<T,String> transform) {
-        return new DisplayValue<T>(transform);
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> namedActionWithUrl(String actionName, Function<T,String> transform) {
-        return new NamedActionWithUrl<T>(actionName, transform);
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> namedActionWithUrl(String actionName) {
-        return new NamedActionWithUrl<T>(actionName);
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> namedActionWithUrl(Function<T,String> transform) {
-        return openWithUrl(transform);
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> namedActionWithUrl() {
-        return openWithUrl();
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> openWithUrl() {
-        return openWithUrl((Function<T,String>) null);
-    }
-
-    @Beta
-    public static <T> NamedActionWithUrl<T> openWithUrl(Function<T,String> transform) {
-        return new NamedActionWithUrl<T>("Open", transform);
-    }
-
-    /**
-     * Forces the given sensor or config key's value to be censored. It will be
-     * presented as <code>********</code>.
-     */
-    @Beta
-    public static <T> DisplayValue<T> censoredValue() {
-        return new DisplayValue<T>(Functions.constant("********"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AbstractEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AbstractEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AbstractEffector.java
deleted file mode 100644
index 4acd0e0..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AbstractEffector.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 org.apache.brooklyn.core.effector;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.DynamicSequentialTask;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * The abstract {@link Effector} implementation.
- * 
- * The concrete subclass (often anonymous) will supply the {@link #call(Entity, Map)} implementation,
- * and the fields in the constructor.
- */
-public abstract class AbstractEffector<T> extends EffectorBase<T> implements EffectorWithBody<T> {
-
-    private static final long serialVersionUID = 1832435915652457843L;
-    
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractEffector.class);
-
-    public AbstractEffector(String name, Class<T> returnType, List<ParameterType<?>> parameters, String description) {
-        super(name, returnType, parameters, description);
-    }
-
-    public abstract T call(Entity entity, @SuppressWarnings("rawtypes") Map parameters);
-
-    /** Convenience for named-parameter syntax (needs map in first argument) */
-    public T call(Entity entity) { return call(ImmutableMap.of(), entity); }
-
-    /** Convenience for named-parameter syntax (needs map in first argument) */
-    public T call(@SuppressWarnings("rawtypes") Map parameters, Entity entity) { return call(entity, parameters); }
-
-    /** @deprecated since 0.7.0 use {@link #getFlagsForTaskInvocationAt(Entity, Effector, ConfigBag)} */ @Deprecated
-    protected final Map<Object,Object> getFlagsForTaskInvocationAt(Entity entity) {
-        return getFlagsForTaskInvocationAt(entity, this, null);
-    }
-    /** subclasses may override to add additional flags, but they should include the flags returned here 
-     * unless there is very good reason not to */
-    protected Map<Object,Object> getFlagsForTaskInvocationAt(Entity entity, Effector<T> effector, ConfigBag parameters) {
-        return EffectorUtils.getTaskFlagsForEffectorInvocation(entity, effector, parameters);
-    }
-    
-    /** not meant for overriding; subclasses should override the abstract {@link #call(Entity, Map)} method in this class */
-    @Override
-    public final EffectorTaskFactory<T> getBody() {
-        return new EffectorTaskFactory<T>() {
-            @Override
-            public Task<T> newTask(final Entity entity, final Effector<T> effector, final ConfigBag parameters) {
-                return new DynamicSequentialTask<T>(
-                        getFlagsForTaskInvocationAt(entity, AbstractEffector.this, parameters),
-                        new Callable<T>() {
-                            @Override public T call() {
-                                return AbstractEffector.this.call(parameters.getAllConfig(), entity);
-                            }
-                        });
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddChildrenEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddChildrenEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddChildrenEffector.java
deleted file mode 100644
index f2730ca..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddChildrenEffector.java
+++ /dev/null
@@ -1,117 +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.core.effector;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils.CreationResult;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.gson.Gson;
-
-/** Entity initializer which defines an effector which adds a child blueprint to an entity.
- * <p>
- * One of the config keys {@link #BLUEPRINT_YAML} (containing a YAML blueprint (map or string)) 
- * or {@link #BLUEPRINT_TYPE} (containing a string referring to a catalog type) should be supplied, but not both.
- * Parameters defined here are supplied as config during the entity creation.
- * 
- * @since 0.7.0 */
-@Beta
-public class AddChildrenEffector extends AddEffector {
-    
-    private static final Logger log = LoggerFactory.getLogger(AddChildrenEffector.class);
-    
-    public static final ConfigKey<Object> BLUEPRINT_YAML = ConfigKeys.newConfigKey(Object.class, "blueprint_yaml");
-    public static final ConfigKey<String> BLUEPRINT_TYPE = ConfigKeys.newStringConfigKey("blueprint_type");
-    public static final ConfigKey<Boolean> AUTO_START = ConfigKeys.newBooleanConfigKey("auto_start");
-    
-    public AddChildrenEffector(ConfigBag params) {
-        super(newEffectorBuilder(params).build());
-    }
-    
-    public AddChildrenEffector(Map<String,String> params) {
-        this(ConfigBag.newInstance(params));
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static EffectorBuilder<List<String>> newEffectorBuilder(ConfigBag params) {
-        EffectorBuilder<List<String>> eff = (EffectorBuilder) AddEffector.newEffectorBuilder(List.class, params);
-        eff.impl(new Body(eff.buildAbstract(), params));
-        return eff;
-    }
-
-    protected static class Body extends EffectorBody<List<String>> {
-
-        private final Effector<?> effector;
-        private final String blueprintBase;
-        private final Boolean autostart;
-
-        public Body(Effector<?> eff, ConfigBag params) {
-            this.effector = eff;
-            String newBlueprint = null;
-            Object yaml = params.get(BLUEPRINT_YAML);
-            if (yaml instanceof Map) {
-                newBlueprint = new Gson().toJson(yaml);
-            } else if (yaml instanceof String) {
-                newBlueprint = (String) yaml;
-            } else if (yaml!=null) {
-                throw new IllegalArgumentException(this+" requires map or string in "+BLUEPRINT_YAML+"; not "+yaml.getClass()+" ("+yaml+")");
-            }
-            String blueprintType = params.get(BLUEPRINT_TYPE);
-            if (blueprintType!=null) {
-                if (newBlueprint!=null) {
-                    throw new IllegalArgumentException(this+" cannot take both "+BLUEPRINT_TYPE+" and "+BLUEPRINT_YAML);
-                }
-                newBlueprint = "services: [ { type: "+blueprintType+" } ]";
-            }
-            if (newBlueprint==null) {
-                throw new IllegalArgumentException(this+" requires either "+BLUEPRINT_TYPE+" or "+BLUEPRINT_YAML);
-            }
-            blueprintBase = newBlueprint;
-            autostart = params.get(AUTO_START);
-        }
-
-        @Override
-        public List<String> call(ConfigBag params) {
-            params = getMergedParams(effector, params);
-            
-            String blueprint = blueprintBase;
-            if (!params.isEmpty()) { 
-                blueprint = blueprint+"\n"+"brooklyn.config: "+
-                    new Gson().toJson(params.getAllConfig());
-            }
-
-            log.debug(this+" adding children to "+entity()+":\n"+blueprint);
-            CreationResult<List<Entity>, List<String>> result = EntityManagementUtils.addChildren(entity(), blueprint, autostart);
-            log.debug(this+" added children to "+entity()+": "+result.get());
-            return result.task().getUnchecked();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddEffector.java
deleted file mode 100644
index 9590bcf..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddEffector.java
+++ /dev/null
@@ -1,116 +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.core.effector;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.EntityInitializer;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.MapConfigKey;
-import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-
-/** 
- * Entity initializer which adds an effector to an entity.
- * <p>
- * This instance provides a {@link #newEffectorBuilder(Class, ConfigBag)} 
- * which returns an abstract (body-less) effector defining:
- * <li> the name from {@link #EFFECTOR_NAME};
- * <li> the description from {@link #EFFECTOR_DESCRIPTION}
- * <li> the parameters from {@link #EFFECTOR_PARAMETER_DEFS}
- * <p>
- * Callers should pass the effector to instantiate into the constructor.
- * Often subclasses will supply a constructor which takes a ConfigBag of parameters,
- * and a custom {@link #newEffectorBuilder(Class, ConfigBag)} which adds the body
- * before passing to this class.
- * <p>
- * Note that the parameters passed to the call method in the body of the effector implementation
- * are only those supplied by a user at runtime; in order to merge with default
- * values, use {@link #getMergedParams(Effector, ConfigBag)}.
- *  
- * @since 0.7.0 */
-@Beta
-public class AddEffector implements EntityInitializer {
-    
-    public static final ConfigKey<String> EFFECTOR_NAME = ConfigKeys.newStringConfigKey("name");
-    public static final ConfigKey<String> EFFECTOR_DESCRIPTION = ConfigKeys.newStringConfigKey("description");
-    
-    public static final ConfigKey<Map<String,Object>> EFFECTOR_PARAMETER_DEFS = new MapConfigKey<Object>(Object.class, "parameters");
-
-    final Effector<?> effector;
-    
-    public AddEffector(Effector<?> effector) {
-        this.effector = Preconditions.checkNotNull(effector, "effector");
-    }
-    
-    @Override
-    public void apply(EntityLocal entity) {
-        ((EntityInternal)entity).getMutableEntityType().addEffector(effector);
-    }
-    
-    public static <T> EffectorBuilder<T> newEffectorBuilder(Class<T> type, ConfigBag params) {
-        String name = Preconditions.checkNotNull(params.get(EFFECTOR_NAME), "name must be supplied when defining an effector: %s", params);
-        EffectorBuilder<T> eff = Effectors.effector(type, name);
-        eff.description(params.get(EFFECTOR_DESCRIPTION));
-        
-        Map<String, Object> paramDefs = params.get(EFFECTOR_PARAMETER_DEFS);
-        if (paramDefs!=null) {
-            for (Map.Entry<String, Object> paramDef: paramDefs.entrySet()){
-                if (paramDef!=null) {
-                    String paramName = paramDef.getKey();
-                    Object value = paramDef.getValue();
-                    if (value==null) value = Collections.emptyMap();
-                    if (!(value instanceof Map)) {
-                        if (value instanceof CharSequence && Strings.isBlank((CharSequence) value)) 
-                            value = Collections.emptyMap();
-                    }
-                    if (!(value instanceof Map))
-                        throw new IllegalArgumentException("Illegal argument of type "+value.getClass()+" value '"+value+"' supplied as parameter definition "
-                            + "'"+paramName);
-                    eff.parameter(ConfigKeys.DynamicKeys.newNamedInstance(paramName, (Map<?, ?>) value));
-                }
-            }
-        }
-        
-        return eff;
-    }
-
-    /** returns a ConfigBag containing the merger of the supplied parameters with default values on the effector-defined parameters */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static ConfigBag getMergedParams(Effector<?> eff, ConfigBag params) {
-        ConfigBag result = ConfigBag.newInstanceCopying(params);
-        for (ParameterType<?> param: eff.getParameters()) {
-            ConfigKey key = Effectors.asConfigKey(param);
-            if (!result.containsKey(key))
-                result.configure(key, params.get(key));
-        }
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
deleted file mode 100644
index d35068f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
+++ /dev/null
@@ -1,126 +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.core.effector;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.EntityInitializer;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.Boxing;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-
-/**
- * Creates a new {@link AttributeSensor} on an entity.
- * <p>
- * The configuration can include the sensor {@code name}, {@code period} and {@code targetType}.
- * For the targetType, currently this only supports classes on the initial classpath, not those in
- * OSGi bundles added at runtime.
- *
- * @since 0.7.0
- */
-@Beta
-public class AddSensor<T> implements EntityInitializer {
-
-    public static final ConfigKey<String> SENSOR_NAME = ConfigKeys.newStringConfigKey("name", "The name of the sensor to create");
-    public static final ConfigKey<Duration> SENSOR_PERIOD = ConfigKeys.newConfigKey(Duration.class, "period", "Period, including units e.g. 1m or 5s or 200ms; default 5 minutes", Duration.FIVE_MINUTES);
-    public static final ConfigKey<String> SENSOR_TYPE = ConfigKeys.newStringConfigKey("targetType", "Target type for the value; default String", "java.lang.String");
-
-    protected final String name;
-    protected final Duration period;
-    protected final String type;
-    protected final AttributeSensor<T> sensor;
-
-    public AddSensor(Map<String, String> params) {
-        this(ConfigBag.newInstance(params));
-    }
-
-    public AddSensor(final ConfigBag params) {
-        this.name = Preconditions.checkNotNull(params.get(SENSOR_NAME), "Name must be supplied when defining a sensor");
-        this.period = params.get(SENSOR_PERIOD);
-        this.type = params.get(SENSOR_TYPE);
-        this.sensor = newSensor();
-    }
-
-    @Override
-    public void apply(EntityLocal entity) {
-        ((EntityInternal) entity).getMutableEntityType().addSensor(sensor);
-    }
-
-    private AttributeSensor<T> newSensor() {
-        String className = getFullClassName(type);
-        Class<T> clazz = getType(className);
-        return Sensors.newSensor(clazz, name);
-    }
-
-    @SuppressWarnings("unchecked")
-    protected Class<T> getType(String className) {
-        try {
-            // TODO use OSGi loader (low priority however); also ensure that allows primitives
-            Maybe<Class<?>> primitive = Boxing.getPrimitiveType(className);
-            if (primitive.isPresent()) return (Class<T>) primitive.get();
-            return (Class<T>) Class.forName(className);
-        } catch (ClassNotFoundException e) {
-            if (!className.contains(".")) {
-                // could be assuming "java.lang" package; try again with that
-                try {
-                    return (Class<T>) Class.forName("java.lang."+className);
-                } catch (ClassNotFoundException e2) {
-                    throw new IllegalArgumentException("Invalid target type for sensor "+name+": " + className+" (also tried java.lang."+className+")");
-                }
-            } else {
-                throw new IllegalArgumentException("Invalid target type for sensor "+name+": " + className);
-            }
-        }
-    }
-
-    protected String getFullClassName(String className) {
-        if (className.equalsIgnoreCase("string")) {
-            return "java.lang.String";
-        } else if (className.equalsIgnoreCase("int") || className.equalsIgnoreCase("integer")) {
-            return "java.lang.Integer";
-        } else if (className.equalsIgnoreCase("long")) {
-            return "java.lang.Long";
-        } else if (className.equalsIgnoreCase("float")) {
-            return "java.lang.Float";
-        } else if (className.equalsIgnoreCase("double")) {
-            return "java.lang.Double";
-        } else if (className.equalsIgnoreCase("bool") || className.equalsIgnoreCase("boolean")) {
-            return "java.lang.Boolean";
-        } else if (className.equalsIgnoreCase("byte")) {
-            return "java.lang.Byte";
-        } else if (className.equalsIgnoreCase("char") || className.equalsIgnoreCase("character")) {
-            return "java.lang.Character";
-        } else if (className.equalsIgnoreCase("object")) {
-            return "java.lang.Object";
-        } else {
-            return className;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/BasicParameterType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/BasicParameterType.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/BasicParameterType.java
deleted file mode 100644
index eb0417f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/BasicParameterType.java
+++ /dev/null
@@ -1,116 +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.core.effector;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.ParameterType;
-
-import com.google.common.base.Objects;
-
-public class BasicParameterType<T> implements ParameterType<T> {
-    private static final long serialVersionUID = -5521879180483663919L;
-    
-    private String name;
-    private Class<T> type;
-    private String description;
-    private Boolean hasDefaultValue = null;
-    private T defaultValue = null;
-
-    public BasicParameterType() {
-        this(Collections.emptyMap());
-    }
-    
-    @SuppressWarnings("unchecked")
-    public BasicParameterType(Map<?, ?> arguments) {
-        if (arguments.containsKey("name")) name = (String) arguments.get("name");
-        if (arguments.containsKey("type")) type = (Class<T>) arguments.get("type");
-        if (arguments.containsKey("description")) description = (String) arguments.get("description");
-        if (arguments.containsKey("defaultValue")) defaultValue = (T) arguments.get("defaultValue");
-    }
-
-    public BasicParameterType(String name, Class<T> type) {
-        this(name, type, null, null, false);
-    }
-    
-    public BasicParameterType(String name, Class<T> type, String description) {
-        this(name, type, description, null, false);
-    }
-    
-    public BasicParameterType(String name, Class<T> type, String description, T defaultValue) {
-        this(name, type, description, defaultValue, true);
-    }
-    
-    public BasicParameterType(String name, Class<T> type, String description, T defaultValue, boolean hasDefaultValue) {
-        this.name = name;
-        this.type = type;
-        this.description = description;
-        this.defaultValue = defaultValue;
-        if (defaultValue!=null && !defaultValue.getClass().equals(Object.class)) {
-            // if default value is null (or is an Object, which is ambiguous on resolution to to rebind), 
-            // don't bother to set this as it creates noise in the persistence files
-            this.hasDefaultValue = hasDefaultValue;
-        }
-    }
-
-    @Override
-    public String getName() { return name; }
-
-    @Override
-    public Class<T> getParameterClass() { return type; }
-    
-    @Override
-    public String getParameterClassName() { return type.getCanonicalName(); }
-
-    @Override
-    public String getDescription() { return description; }
-
-    @Override
-    public T getDefaultValue() {
-        return hasDefaultValue() ? defaultValue : null;
-    }
-
-    public boolean hasDefaultValue() {
-        // a new Object() was previously used to indicate no default value, but that doesn't work well across serialization boundaries!
-        return hasDefaultValue!=null ? hasDefaultValue : defaultValue!=null && !defaultValue.getClass().equals(Object.class);
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).omitNullValues()
-                .add("name", name).add("description", description).add("type", getParameterClassName())
-                .add("defaultValue", defaultValue)
-                .toString();
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(name, description, type, defaultValue);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return (obj instanceof ParameterType) &&
-                Objects.equal(name, ((ParameterType<?>)obj).getName()) &&
-                Objects.equal(description, ((ParameterType<?>)obj).getDescription()) &&
-                Objects.equal(type, ((ParameterType<?>)obj).getParameterClass()) &&
-                Objects.equal(defaultValue, ((ParameterType<?>)obj).getDefaultValue());
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorAndBody.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorAndBody.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorAndBody.java
deleted file mode 100644
index 49e85b8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorAndBody.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 org.apache.brooklyn.core.effector;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-
-@Beta // added in 0.6.0
-public class EffectorAndBody<T> extends EffectorBase<T> implements EffectorWithBody<T> {
-
-    private static final long serialVersionUID = -6023389678748222968L;
-    private final EffectorTaskFactory<T> body;
-
-    public EffectorAndBody(Effector<T> original, EffectorTaskFactory<T> body) {
-        this(original.getName(), original.getReturnType(), original.getParameters(), original.getDescription(), body);
-    }
-    
-    public EffectorAndBody(String name, Class<T> returnType, List<ParameterType<?>> parameters, String description, EffectorTaskFactory<T> body) {
-        super(name, returnType, parameters, description);
-        this.body = body;
-    }
-
-    @Override
-    public EffectorTaskFactory<T> getBody() {
-        return body;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(super.hashCode(), getBody());
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        return super.equals(other) && Objects.equal(getBody(), ((EffectorAndBody<?>)other).getBody());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBase.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBase.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBase.java
deleted file mode 100644
index 68132c4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBase.java
+++ /dev/null
@@ -1,106 +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.core.effector;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
-
-/** concrete implementation of Effector interface, 
- * but not (at this level of the hirarchy) defining an implementation 
- * (see {@link EffectorTaskFactory} and {@link EffectorWithBody}) */
-public class EffectorBase<T> implements Effector<T> {
-
-    @SuppressWarnings("unused")
-    private static final Logger log = LoggerFactory.getLogger(EffectorBase.class);
-    
-    private static final long serialVersionUID = -4153962199078384835L;
-    
-    private final String name;
-    private final Class<T> returnType;
-    private final List<ParameterType<?>> parameters;
-    private final String description;
-
-    public EffectorBase(String name, Class<T> returnType, List<ParameterType<?>> parameters, String description) {
-        this.name = name;
-        this.returnType = returnType;
-        this.parameters = new ArrayList<ParameterType<?>>(parameters);
-        this.description = description;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public Class<T> getReturnType() {
-        return returnType;
-    }
-
-    @Override
-    public String getReturnTypeName() {
-        return returnType.getCanonicalName();
-    }
-
-    @Override
-    public List<ParameterType<?>> getParameters() {
-        return parameters;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String toString() {
-        List<String> parameterNames = new ArrayList<String>(parameters.size());
-        for (ParameterType<?> parameter: parameters) {
-            String parameterName = (parameter.getName() != null) ? parameter.getName() : "<unknown>";
-            parameterNames.add(parameterName);
-        }
-        return name+"["+Joiner.on(",").join(parameterNames)+"]";
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(name, returnType, parameters, description);
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof EffectorBase)) return false;
-        if (!(other.getClass().equals(getClass()))) return false;
-        if (!Objects.equal(hashCode(), other.hashCode())) return false;
-        return Objects.equal(getName(), ((EffectorBase<?>)other).getName()) &&
-            Objects.equal(getReturnType(), ((EffectorBase<?>)other).getReturnType()) &&
-            Objects.equal(getParameters(), ((EffectorBase<?>)other).getParameters()) &&
-            Objects.equal(getDescription(), ((EffectorBase<?>)other).getDescription());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBody.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBody.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBody.java
deleted file mode 100644
index b1643ba..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorBody.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.core.effector;
-
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.api.mgmt.TaskFactory;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DynamicSequentialTask;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.Tasks;
-
-import com.google.common.annotations.Beta;
-
-/** Typical implementations override {@link #main(ConfigBag)} to do the work of the effector
- * <p>
- * See also {@link EffectorTasks}: possibly this will be deleted in preference for an approach based on {@link EffectorTasks}. 
- * 
- * @since 0.6.0
- **/
-@Beta
-public abstract class EffectorBody<T> {
-    /** Does the work of the effector, either in place, or (better) by building up
-     * subtasks, which can by added using {@link DynamicTasks} methods
-     * (and various convenience methods which do that automatically; see subclasses of EffectorBody 
-     * for more info on usage; or see {@link DynamicSequentialTask} for details of the threading model
-     * by which added tasks are placed in a secondary thread)
-     * <p>
-     * The associated entity can be accessed through the {@link #entity()} method.
-     */
-    public abstract T call(ConfigBag parameters);
-    
-    // NB: we could also support an 'init' method which is done at creation,
-    // as a place where implementers can describe the structure of the task before it executes
-    // (and init gets invoked in EffectorBodyTaskFactory.newTask _before_ the task is submitted and main is called)
-    
-    
-    // ---- convenience method(s) for implementers of main -- see subclasses and *Tasks statics for more
-    
-    protected EntityInternal entity() {
-        return (EntityInternal) BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-    }
-    
-    protected <V extends TaskAdaptable<?>> V queue(V task) {
-        return DynamicTasks.queue(task);
-    }
-
-    protected <V extends TaskAdaptable<?>> void queue(V task1, V task2, V ...tasks) {
-        DynamicTasks.queue(task1);
-        DynamicTasks.queue(task2);
-        for (V task: tasks)
-            DynamicTasks.queue(task);
-    }
-
-    protected <V extends TaskFactory<?>> void queue(V task1, V task2, V ...tasks) {
-        DynamicTasks.queue(task1.newTask());
-        DynamicTasks.queue(task2.newTask());
-        for (V task: tasks)
-            DynamicTasks.queue(task.newTask());
-    }
-    
-    protected <U extends TaskAdaptable<?>> U queue(TaskFactory<U> task) {
-        return DynamicTasks.queue(task.newTask());
-    }
-    
-    /** see {@link DynamicTasks#waitForLast()} */
-    protected Task<?> waitForLast() {
-        return DynamicTasks.waitForLast();
-    }
-
-    /** Returns the result of the last task queued in this context, coerced to the given type */
-    protected <V> V last(Class<V> type) {
-        Task<?> last = waitForLast();
-        if (last==null)
-            throw new IllegalStateException("No last task available (in "+DynamicTasks.getTaskQueuingContext()+")");
-        if (!Tasks.isQueuedOrSubmitted(last))
-            throw new IllegalStateException("Last task "+last+" has not been queued or submitted; will not block on its result");
-        
-        return TypeCoercions.coerce(last.getUnchecked(), type);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorTasks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorTasks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorTasks.java
deleted file mode 100644
index 68d45a5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorTasks.java
+++ /dev/null
@@ -1,234 +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.core.effector;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.location.Machines;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.DynamicSequentialTask;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.TaskBuilder;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.javalang.Reflections;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-
-/**
- * Miscellaneous tasks which are useful in effectors.
- * @since 0.6.0
- */
-@Beta
-public class EffectorTasks {
-
-    @SuppressWarnings("unused")
-    private static final Logger log = LoggerFactory.getLogger(EffectorTasks.class);
-    
-    public interface EffectorTaskFactory<T> {
-        public abstract TaskAdaptable<T> newTask(Entity entity, Effector<T> effector, ConfigBag parameters);
-    }
-    
-    /** wrapper for {@link EffectorBody} which simply runs that body on each invocation;
-     * the body must be thread safe and ideally stateless */
-    public static class EffectorBodyTaskFactory<T> implements EffectorTaskFactory<T> {
-        private final EffectorBody<T> effectorBody;
-        public EffectorBodyTaskFactory(EffectorBody<T> effectorBody) {
-            this.effectorBody = effectorBody;
-        }
-        
-        @Override
-        public Task<T> newTask(final Entity entity, final org.apache.brooklyn.api.effector.Effector<T> effector, final ConfigBag parameters) {
-            final AtomicReference<DynamicSequentialTask<T>> dst = new AtomicReference<DynamicSequentialTask<T>>();
-
-            dst.set(new DynamicSequentialTask<T>(
-                    getFlagsForTaskInvocationAt(entity, effector, parameters), 
-                    new Callable<T>() {
-                        @Override
-                        public T call() throws Exception {
-                            try {
-                                DynamicTasks.setTaskQueueingContext(dst.get());
-                                return effectorBody.call(parameters);
-                            } finally {
-                                DynamicTasks.removeTaskQueueingContext();
-                            }
-                        }
-                    }) {
-                        @Override
-                        public void handleException(Throwable throwable) throws Exception {
-                            EffectorUtils.handleEffectorException(entity, effector, throwable);
-                        }
-                    });
-            return dst.get();
-        };
-
-        /** @deprecated since 0.7.0 use {@link #getFlagsForTaskInvocationAt(Entity, Effector, ConfigBag)} */ @Deprecated
-        protected final Map<Object,Object> getFlagsForTaskInvocationAt(Entity entity, Effector<?> effector) {
-            return getFlagsForTaskInvocationAt(entity, effector, null);
-        }
-        /** subclasses may override to add additional flags, but they should include the flags returned here 
-         * unless there is very good reason not to; default impl returns a MutableMap */
-        protected Map<Object,Object> getFlagsForTaskInvocationAt(Entity entity, Effector<?> effector, ConfigBag parameters) {
-            return EffectorUtils.getTaskFlagsForEffectorInvocation(entity, effector, parameters);
-        }
-    }
-    
-    /** wrapper for {@link EffectorTaskFactory} which ensures effector task tags are applied to it if needed
-     * (wrapping in a task if needed); without this, {@link EffectorBody}-based effectors get it by
-     * virtue of the call to {@link #getFlagsForTaskInvocationAt(Entity,Effector,ConfigBag)} therein
-     * but {@link EffectorTaskFactory}-based effectors generate a task without the right tags
-     * to be able to tell using {@link BrooklynTaskTags} the effector-context of the task 
-     * <p>
-     * this gets applied automatically so marked as package-private */
-    static class EffectorMarkingTaskFactory<T> implements EffectorTaskFactory<T> {
-        private final EffectorTaskFactory<T> effectorTaskFactory;
-        public EffectorMarkingTaskFactory(EffectorTaskFactory<T> effectorTaskFactory) {
-            this.effectorTaskFactory = effectorTaskFactory;
-        }
-        
-        @Override
-        public Task<T> newTask(final Entity entity, final org.apache.brooklyn.api.effector.Effector<T> effector, final ConfigBag parameters) {
-            if (effectorTaskFactory instanceof EffectorBodyTaskFactory)
-                return effectorTaskFactory.newTask(entity, effector, parameters).asTask();
-            // if we're in an effector context for this effector already, then also pass through
-            if (BrooklynTaskTags.isInEffectorTask(Tasks.current(), entity, effector, false))
-                return effectorTaskFactory.newTask(entity, effector, parameters).asTask();
-            // otherwise, create the task inside an appropriate effector body so tags, name, etc are set correctly
-            return new EffectorBodyTaskFactory<T>(new EffectorBody<T>() {
-                @Override
-                public T call(ConfigBag parameters) {
-                    TaskAdaptable<T> t = DynamicTasks.queue(effectorTaskFactory.newTask(entity, effector, parameters));
-                    return t.asTask().getUnchecked();
-                }
-            }).newTask(entity, effector, parameters);
-        }
-    }
-    
-    public static <T> ConfigKey<T> asConfigKey(ParameterType<T> t) {
-        return ConfigKeys.newConfigKey(t.getParameterClass(), t.getName());
-    }
-    
-    public static <T> ParameterTask<T> parameter(ParameterType<T> t) {
-        return new ParameterTask<T>(asConfigKey(t)).
-                name("parameter "+t);
-    }
-    public static <T> ParameterTask<T> parameter(Class<T> type, String name) {
-        return new ParameterTask<T>(ConfigKeys.newConfigKey(type, name)).
-                name("parameter "+name+" ("+type+")");
-    }
-    public static <T> ParameterTask<T> parameter(final ConfigKey<T> p) {
-        return new ParameterTask<T>(p);
-    }
-    public static class ParameterTask<T> implements EffectorTaskFactory<T> {
-        final ConfigKey<T> p;
-        private TaskBuilder<T> builder;
-        public ParameterTask(ConfigKey<T> p) {
-            this.p = p;
-            this.builder = Tasks.<T>builder().displayName("parameter "+p);
-        }
-        public ParameterTask<T> name(String taskName) {
-            builder.displayName(taskName);
-            return this;
-        }
-        @Override
-        public Task<T> newTask(Entity entity, Effector<T> effector, final ConfigBag parameters) {
-            return builder.body(new Callable<T>() {
-                @Override
-                public T call() throws Exception {
-                    return parameters.get(p);
-                }
-                
-            }).build();
-        }
-        
-    }
-
-    public static <T> EffectorTaskFactory<T> of(final Task<T> task) {
-        return new EffectorTaskFactory<T>() {
-            @Override
-            public Task<T> newTask(Entity entity, Effector<T> effector, ConfigBag parameters) {
-                return task;
-            }
-        };
-    }
-
-    /** Finds the entity where this task is running
-     * @throws NullPointerException if there is none (no task, or no context entity for that task) */
-    public static Entity findEntity() {
-        return Preconditions.checkNotNull(BrooklynTaskTags.getTargetOrContextEntity(Tasks.current()),
-                "This must be executed in a task whose execution context has a target or context entity " +
-                "(i.e. it must be run from within an effector)");
-    }
-
-    /** Finds the entity where this task is running, casted to the given Entity subtype
-     * @throws NullPointerException if there is none
-     * @throws IllegalArgumentException if it is not of the indicated type */
-    public static <T extends Entity> T findEntity(Class<T> type) {
-        Entity t = findEntity();
-        return Reflections.cast(t, type);
-    }
-
-    /** Finds a unique {@link MachineLocation} attached to the entity
-     * where this task is running
-     * @throws NullPointerException if {@link #findEntity()} fails
-     * @throws IllegalStateException if call to {@link #getSshMachine(Entity)} fails */
-    public static <T extends MachineLocation> T findMachine(Class<T> clazz) {
-        return getMachine(findEntity(), clazz);
-    }
-
-    /** Finds a unique {@link MachineLocation} attached to the supplied entity
-     * @throws IllegalStateException if there is not a unique such {@link SshMachineLocation} */
-    public static <T extends MachineLocation> T getMachine(Entity entity, Class<T> clazz) {
-        try {
-            return Machines.findUniqueMachineLocation(entity.getLocations(), clazz).get();
-        } catch (Exception e) {
-            throw new IllegalStateException("Entity "+entity+" (in "+Tasks.current()+") requires a single " + clazz.getName() + ", but has "+entity.getLocations(), e);
-        }
-    }
-
-    /** Finds a unique {@link SshMachineLocation} attached to the entity 
-     * where this task is running
-     * @throws NullPointerException if {@link #findEntity()} fails
-     * @throws IllegalStateException if call to {@link #getSshMachine(Entity)} fails */
-    public static SshMachineLocation findSshMachine() {
-        return getSshMachine(findEntity());
-    }
-
-    /** Finds a unique {@link SshMachineLocation} attached to the supplied entity 
-     * @throws IllegalStateException if there is not a unique such {@link SshMachineLocation} */
-    public static SshMachineLocation getSshMachine(Entity entity) {
-        return getMachine(entity, SshMachineLocation.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorWithBody.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorWithBody.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorWithBody.java
deleted file mode 100644
index 67dba14..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/EffectorWithBody.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 org.apache.brooklyn.core.effector;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-
-import com.google.common.annotations.Beta;
-
-@Beta // added in 0.6.0
-public interface EffectorWithBody<T> extends Effector<T> {
-
-    /** returns the body of the effector, i.e. a factory which can generate tasks which can run */
-    public EffectorTaskFactory<T> getBody();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
deleted file mode 100644
index 9b10d1d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
+++ /dev/null
@@ -1,214 +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.core.effector;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorBodyTaskFactory;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorMarkingTaskFactory;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class Effectors {
-
-    private static final Logger log = LoggerFactory.getLogger(Effectors.class);
-    
-    public static class EffectorBuilder<T> {
-        private Class<T> returnType;
-        private String effectorName;
-        private String description;
-        private Map<String,ParameterType<?>> parameters = new LinkedHashMap<String,ParameterType<?>>();
-        private EffectorTaskFactory<T> impl;
-        
-        private EffectorBuilder(Class<T> returnType, String effectorName) {
-            this.returnType = returnType;
-            this.effectorName = effectorName;
-        }
-        public EffectorBuilder<T> description(String description) {
-            this.description = description;
-            return this;                
-        }
-        public EffectorBuilder<T> parameter(Class<?> paramType, String paramName) {
-            return parameter(paramType, paramName, null, null);
-        }
-        public EffectorBuilder<T> parameter(Class<?> paramType, String paramName, String paramDescription) {
-            return parameter(paramType, paramName, paramDescription, null);                
-        }
-        public <V> EffectorBuilder<T> parameter(Class<V> paramType, String paramName, String paramDescription, V defaultValue) {
-            return parameter(new BasicParameterType<V>(paramName, paramType, paramDescription, defaultValue));
-        }
-        public <V> EffectorBuilder<T> parameter(ConfigKey<V> key) {
-            return parameter(asParameterType(key));
-        }
-        public EffectorBuilder<T> parameter(ParameterType<?> p) {
-            // allow redeclaring, e.g. for the case where we are overriding an existing effector
-            parameters.put(p.getName(), p);
-            return this;
-        }
-        public EffectorBuilder<T> impl(EffectorTaskFactory<T> taskFactory) {
-            this.impl = new EffectorMarkingTaskFactory<T>(taskFactory);
-            return this;
-        }
-        public EffectorBuilder<T> impl(EffectorBody<T> effectorBody) {
-            this.impl = new EffectorBodyTaskFactory<T>(effectorBody);
-            return this;
-        }
-        /** returns the effector, with an implementation (required); @see {@link #buildAbstract()} */
-        public Effector<T> build() {
-             Preconditions.checkNotNull(impl, "Cannot create effector %s with no impl (did you forget impl? or did you mean to buildAbstract?)", effectorName);
-             return new EffectorAndBody<T>(effectorName, returnType, ImmutableList.copyOf(parameters.values()), description, impl);
-        }
-        
-        /** returns an abstract effector, where the body will be defined later/elsewhere 
-         * (impl must not be set) */
-        public Effector<T> buildAbstract() {
-            Preconditions.checkArgument(impl==null, "Cannot create abstract effector {} as an impl is defined", effectorName);
-            return new EffectorBase<T>(effectorName, returnType, ImmutableList.copyOf(parameters.values()), description);
-        }
-    }
-
-    /** creates a new effector builder with the given name and return type */
-    public static <T> EffectorBuilder<T> effector(Class<T> returnType, String effectorName) {
-        return new EffectorBuilder<T>(returnType, effectorName);
-    }
-
-    /** creates a new effector builder to _override_ the given effector */
-    public static <T> EffectorBuilder<T> effector(Effector<T> base) {
-        EffectorBuilder<T> builder = new EffectorBuilder<T>(base.getReturnType(), base.getName());
-        for (ParameterType<?> p: base.getParameters())
-            builder.parameter(p);
-        builder.description(base.getDescription());
-        if (base instanceof EffectorWithBody)
-            builder.impl(((EffectorWithBody<T>) base).getBody());
-        return builder;
-    }
-
-    /** as {@link #invocation(Entity, Effector, Map)} but convenience for passing a {@link ConfigBag} */
-    public static <T> TaskAdaptable<T> invocation(Entity entity, Effector<T> eff, ConfigBag parameters) {
-        return invocation(entity, eff, parameters==null ? ImmutableMap.of() : parameters.getAllConfig());
-    }
-    
-    /** returns an unsubmitted task which invokes the given effector; use {@link Entities#invokeEffector(EntityLocal, Entity, Effector, Map)} for a submitted variant */
-    public static <T> TaskAdaptable<T> invocation(Entity entity, Effector<T> eff, @Nullable Map<?,?> parameters) {
-        @SuppressWarnings("unchecked")
-        Effector<T> eff2 = (Effector<T>) ((EntityInternal)entity).getEffector(eff.getName());
-        if (log.isTraceEnabled()) {
-            Object eff1Body = (eff instanceof EffectorWithBody<?> ? ((EffectorWithBody<?>) eff).getBody() : "bodyless");
-            String message = String.format("Invoking %s/%s on entity %s", eff, eff1Body, entity);
-            if (eff != eff2) {
-                Object eff2Body = (eff2 instanceof EffectorWithBody<?> ? ((EffectorWithBody<?>) eff2).getBody() : "bodyless");
-                message += String.format(" (actually %s/%s)", eff2, eff2Body);
-            }
-            log.trace(message);
-        }
-        if (eff2 != null) {
-            if (eff2 != eff) {
-                if (eff2 instanceof EffectorWithBody) {
-                    log.debug("Replacing invocation of {} on {} with {} which is the impl defined at that entity", new Object[] { eff, entity, eff2 });
-                    return ((EffectorWithBody<T>)eff2).getBody().newTask(entity, eff2, ConfigBag.newInstance().putAll(parameters));
-                } else {
-                    log.warn("Effector {} defined on {} has no body; invoking caller-supplied {} instead", new Object[] { eff2, entity, eff });
-                }
-            }
-        } else {
-            log.debug("Effector {} does not exist on {}; attempting to invoke anyway", new Object[] { eff, entity });
-        }
-        
-        if (eff instanceof EffectorWithBody) {
-            return ((EffectorWithBody<T>)eff).getBody().newTask(entity, eff, ConfigBag.newInstance().putAll(parameters));
-        }
-        
-        throw new UnsupportedOperationException("No implementation registered for effector "+eff+" on "+entity);
-    }    
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static <V> ParameterType<V> asParameterType(ConfigKey<V> key) {
-        return key.hasDefaultValue()
-            ? new BasicParameterType<V>(key.getName(), (Class)key.getType(), key.getDescription(), key.getDefaultValue())
-            : new BasicParameterType<V>(key.getName(), (Class)key.getType(), key.getDescription());
-    }
-    
-    public static <V> ConfigKey<V> asConfigKey(ParameterType<V> paramType) {
-        return ConfigKeys.newConfigKey(paramType.getParameterClass(), paramType.getName(), paramType.getDescription(), paramType.getDefaultValue());
-    }
-
-    /** convenience for {@link #invocationParallel(Effector, Map, Iterable)} */
-    public static TaskAdaptable<List<?>> invocation(Effector<?> eff, Map<?,?> params, Iterable<? extends Entity> entities) {
-        return invocationParallel(eff, params, entities);
-    }
-    
-    /** returns an unsubmitted task which will invoke the given effector on the given entities in parallel;
-     * return type is Task<List<T>> (but haven't put in the blood sweat toil and tears to make the generics work) */
-    public static TaskAdaptable<List<?>> invocationParallel(Effector<?> eff, Map<?,?> params, Iterable<? extends Entity> entities) {
-        List<TaskAdaptable<?>> tasks = new ArrayList<TaskAdaptable<?>>();
-        for (Entity e: entities) tasks.add(invocation(e, eff, params));
-        return Tasks.parallel("invoking "+eff+" on "+tasks.size()+" node"+(Strings.s(tasks.size())), tasks.toArray(new TaskAdaptable[tasks.size()]));
-    }
-
-    /** as {@link #invocationParallel(Effector, Map, Iterable)} but executing sequentially */
-    public static TaskAdaptable<List<?>> invocationSequential(Effector<?> eff, Map<?,?> params, Iterable<? extends Entity> entities) {
-        List<TaskAdaptable<?>> tasks = new ArrayList<TaskAdaptable<?>>();
-        for (Entity e: entities) tasks.add(invocation(e, eff, params));
-        return Tasks.sequential("invoking "+eff+" on "+tasks.size()+" node"+(Strings.s(tasks.size())), tasks.toArray(new TaskAdaptable[tasks.size()]));
-    }
-
-    /** returns an unsubmitted task which will invoke the given effector on the given entities
-     * (this form of method is a convenience for {@link #invocation(Effector, Map, Iterable)}) */
-    public static TaskAdaptable<List<?>> invocation(Effector<?> eff, MutableMap<?, ?> params, Entity ...entities) {
-        return invocation(eff, params, Arrays.asList(entities));
-    }
-    
-    public static boolean sameSignature(Effector<?> e1, Effector<?> e2) {
-        return Objects.equal(e1.getName(), e2.getName()) &&
-                Objects.equal(e1.getParameters(), e2.getParameters()) &&
-                Objects.equal(e1.getReturnType(), e2.getReturnType());
-    }
-    
-    // TODO sameSignatureAndBody
-    
-    public static boolean sameInstance(Effector<?> e1, Effector<?> e2) {
-        return e1 == e2;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java
deleted file mode 100644
index 65c1f0c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java
+++ /dev/null
@@ -1,74 +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.core.effector;
-
-import groovy.lang.Closure;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.ParameterType;
-import org.apache.brooklyn.api.entity.Entity;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-
-public abstract class ExplicitEffector<I,T> extends AbstractEffector<T> {
-    public ExplicitEffector(String name, Class<T> type, String description) {
-        this(name, type, ImmutableList.<ParameterType<?>>of(), description);
-    }
-    public ExplicitEffector(String name, Class<T> type, List<ParameterType<?>> parameters, String description) {
-        super(name, type, parameters, description);
-    }
-
-    public T call(Entity entity, Map parameters) {
-        return invokeEffector((I) entity, (Map<String,?>)parameters );
-    }
-
-    public abstract T invokeEffector(I trait, Map<String,?> parameters);
-    
-    /** convenience to create an effector supplying a closure; annotations are preferred,
-     * and subclass here would be failback, but this is offered as 
-     * workaround for bug GROOVY-5122, as discussed in test class CanSayHi 
-     */
-    public static <I,T> ExplicitEffector<I,T> create(String name, Class<T> type, List<ParameterType<?>> parameters, String description, Closure body) {
-        return new ExplicitEffectorFromClosure<I,T>(name, type, parameters, description, body);
-    }
-    
-    private static class ExplicitEffectorFromClosure<I,T> extends ExplicitEffector<I,T> {
-        private static final long serialVersionUID = -5771188171702382236L;
-        final Closure<T> body;
-        public ExplicitEffectorFromClosure(String name, Class<T> type, List<ParameterType<?>> parameters, String description, Closure<T> body) {
-            super(name, type, parameters, description);
-            this.body = body;
-        }
-        public T invokeEffector(I trait, Map<String,?> parameters) { return body.call(trait, parameters); }
-        
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(super.hashCode(), body);
-        }
-        
-        @Override
-        public boolean equals(Object other) {
-            return super.equals(other) && Objects.equal(body, ((ExplicitEffectorFromClosure<?,?>)other).body);
-        }
-        
-    }
-}


[48/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java
new file mode 100644
index 0000000..331d990
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.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.api.mgmt;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.Location;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public interface AccessController {
+
+    // TODO Expect this class' methods to change, e.g. including the user doing the
+    // provisioning or the provisioning parameters such as jurisdiction
+    
+    public static class Response {
+        private static final Response ALLOWED = new Response(true, "");
+        
+        public static Response allowed() {
+            return ALLOWED;
+        }
+        
+        public static Response disallowed(String msg) {
+            return new Response(false, msg);
+        }
+        
+        private final boolean allowed;
+        private final String msg;
+
+        private Response(boolean allowed, String msg) {
+            this.allowed = allowed;
+            this.msg = msg;
+        }
+        
+        public boolean isAllowed() {
+            return allowed;
+        }
+        
+        public String getMsg() {
+            return msg;
+        }
+    }
+
+    public Response canProvisionLocation(Location provisioner);
+
+    public Response canManageLocation(Location loc);
+    
+    public Response canManageEntity(Entity entity);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
new file mode 100644
index 0000000..fe66a5b
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
@@ -0,0 +1,126 @@
+/*
+ * 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.api.mgmt;
+
+import java.util.Collection;
+import java.util.Map;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Application;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.entity.EntityTypeRegistry;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.EnricherSpec;
+
+import com.google.common.base.Predicate;
+
+/**
+ * For managing and querying entities.
+ */
+public interface EntityManager {
+
+    /**
+     * Returns the type registry, used to identify the entity implementation when instantiating an
+     * entity of a given type.
+     * 
+     * @see EntityManager.createEntity(EntitySpec)
+     */
+    EntityTypeRegistry getEntityTypeRegistry();
+    
+    /**
+     * Creates a new entity. Management is started immediately (by this method).
+     * 
+     * @param spec
+     * @return A proxy to the created entity (rather than the actual entity itself).
+     */
+    <T extends Entity> T createEntity(EntitySpec<T> spec);
+    
+    /**
+     * Convenience (particularly for groovy code) to create an entity.
+     * Equivalent to {@code createEntity(EntitySpec.create(type).configure(config))}
+     * 
+     * @see createEntity(EntitySpec)
+     */
+    <T extends Entity> T createEntity(Map<?,?> config, Class<T> type);
+
+    /**
+     * Creates a new policy (not managed; not associated with any entity).
+     * 
+     * @param spec
+     */
+    <T extends Policy> T createPolicy(PolicySpec<T> spec);
+
+    /**
+     * Creates a new enricher (not managed; not associated with any entity).
+     * 
+     * @param spec
+     */
+    <T extends Enricher> T createEnricher(EnricherSpec<T> spec);
+
+    /**
+     * All entities under control of this management plane
+     */
+    Collection<Entity> getEntities();
+
+    /**
+     * All entities managed as part of the given application
+     */
+    Collection<Entity> getEntitiesInApplication(Application application);
+
+    /**
+     * All entities under control of this management plane that match the given filter
+     */
+    Collection<Entity> findEntities(Predicate<? super Entity> filter);
+
+    /**
+     * All entities managed as part of the given application that match the given filter
+     */
+    Collection<Entity> findEntitiesInApplication(Application application, Predicate<? super Entity> filter);
+
+    /**
+     * Returns the entity with the given identifier (may be a full instance, or a proxy to one which is remote),
+     * or null.
+     */
+    @Nullable Entity getEntity(String id);
+    
+    /** whether the entity is under management by this management context */
+    boolean isManaged(Entity entity);
+
+    /**
+     * Begins management for the given entity and its children, recursively.
+     *
+     * depending on the implementation of the management context,
+     * this might push it out to one or more remote management nodes.
+     * Manage an entity.
+     */
+    // TODO manage and unmanage without arguments should be changed to take an explicit ManagementTransitionMode
+    // (but that class is not currently in the API project)
+    void manage(Entity e);
+    
+    /**
+     * Causes the given entity and its children, recursively, to be removed from the management plane
+     * (for instance because the entity is no longer relevant)
+     */
+    void unmanage(Entity e);
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
new file mode 100644
index 0000000..4540240
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
@@ -0,0 +1,67 @@
+/*
+ * 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.api.mgmt;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executor;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/**
+ * This is a Brooklyn extension to the Java {@link Executor}.
+ * 
+ * The "context" could, for example, be an {@link Entity} so that tasks executed 
+ * can be annotated as executing in that context.
+ */
+public interface ExecutionContext extends Executor {
+
+    /**
+     * Get the tasks executed through this context (returning an immutable set).
+     */
+    Set<Task<?>> getTasks();
+
+    /**
+     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
+     */
+    Task<?> submit(Map<?,?> properties, Runnable runnable);
+
+    /**
+     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
+     */
+    <T> Task<T> submit(Map<?,?> properties, Callable<T> callable);
+
+    /** {@link ExecutionManager#submit(Runnable) */
+    Task<?> submit(Runnable runnable);
+ 
+    /** {@link ExecutionManager#submit(Callable) */
+    <T> Task<T> submit(Callable<T> callable);
+
+    /** See {@link ExecutionManager#submit(Map, TaskAdaptable)}. */
+    <T> Task<T> submit(TaskAdaptable<T> task);
+    
+    /**
+     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
+     */
+    <T> Task<T> submit(Map<?,?> properties, TaskAdaptable<T> task);
+
+    boolean isShutdown();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
new file mode 100644
index 0000000..4988721
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionManager.java
@@ -0,0 +1,117 @@
+/*
+ * 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.api.mgmt;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/** 
+ * This class manages the execution of a number of jobs with tags.
+ * 
+ * It is like an executor service (and it ends up delegating to one) but adds additional support
+ * where jobs can be:
+ * <ul>
+ * <li>Tracked with tags/buckets
+ * <li>Be {@link Runnable}s, {@link Callable}s, or {@link groovy.lang.Closure}s
+ * <li>Remembered after completion
+ * <li>Treated as {@link Task} instances (see below)
+ * <li>Given powerful synchronization capabilities
+ * </ul>
+ * <p>
+ * The advantage of treating them as {@link Task} instances include: 
+ * <ul>
+ * <li>Richer status information
+ * <li>Started-by, contained-by relationships automatically remembered
+ * <li>Runtime metadata (start, stop, etc)
+ * <li>Grid and multi-machine support) 
+ * </ul>
+ * <p>
+ * For usage instructions see {@link #submit(Map, TaskAdaptable)}, and for examples see the various
+ * {@code ExecutionTest} and {@code TaskTest} instances.
+ * <p>
+ * It has been developed for multi-location provisioning and management to track work being
+ * done by each {@link Entity}.
+ * <p>
+ * Note the use of the environment variable {@code THREAD_POOL_SIZE} which is used to size
+ * the {@link ExecutorService} thread pool. The default is calculated as twice the number
+ * of CPUs in the system plus two, giving 10 for a four core system, 18 for an eight CPU
+ * server and so on.
+ */
+public interface ExecutionManager {
+    public boolean isShutdown();
+    
+    /** returns the task with the given ID, or null if none */ 
+    public Task<?> getTask(String id);
+    
+    /** returns all tasks with the given tag (immutable) */
+    public Set<Task<?>> getTasksWithTag(Object tag);
+
+    /** returns all tasks that have any of the given tags (immutable) */
+    public Set<Task<?>> getTasksWithAnyTag(Iterable<?> tags);
+
+    /** returns all tasks that have all of the given tags (immutable) */
+    public Set<Task<?>> getTasksWithAllTags(Iterable<?> tags);
+
+    /** returns all tags known to this manager (immutable) */
+    public Set<Object> getTaskTags();
+
+//    /** returns all tasks known to this manager (immutable) */
+//    public Set<Task<?>> getAllTasks();
+
+    /** see {@link #submit(Map, TaskAdaptable)} */
+    public Task<?> submit(Runnable r);
+
+    /** see {@link #submit(Map, TaskAdaptable)} */
+    public <T> Task<T> submit(Callable<T> c);
+
+    /** see {@link #submit(Map, TaskAdaptable)} */
+    public <T> Task<T> submit(TaskAdaptable<T> task);
+    
+    /** see {@link #submit(Map, TaskAdaptable)} */
+    public Task<?> submit(Map<?, ?> flags, Runnable r);
+
+    /** see {@link #submit(Map, TaskAdaptable)} */
+    public <T> Task<T> submit(Map<?, ?> flags, Callable<T> c);
+
+    /**
+     * Submits the given {@link Task} for execution in the context associated with this manager.
+     *
+     * The following optional flags supported (in the optional map first arg):
+     * <ul>
+     * <li><em>tag</em> - A single object to be used as a tag for looking up the task
+     * <li><em>tags</em> - A {@link Collection} of object tags each of which the task should be associated,
+     *                      used for associating with contexts, mutex execution, and other purposes
+     * <li><em>synchId</em> - A string, or {@link Collection} of strings, representing a category on which an object should own a synch lock 
+     * <li><em>synchObj</em> - A string, or {@link Collection} of strings, representing a category on which an object should own a synch lock 
+     * <li><em>newTaskStartCallback</em> - A {@link groovy.lang.Closure} that will be invoked just before the task starts if it starts as a result of this call
+     * <li><em>newTaskEndCallback</em> - A {@link groovy.lang.Closure} that will be invoked when the task completes if it starts as a result of this call
+     * </ul>
+     * Callbacks run in the task's thread, and if the callback is a {@link groovy.lang.Closure} it is passed the task for convenience. The closure can be any of the
+     * following types; either a {@link groovy.lang.Closure}, {@link Runnable} or {@link Callable}.
+     * <p>
+     * If a Map is supplied it must be modifiable (currently; may allow immutable maps in future). 
+     */
+    public <T> Task<T> submit(Map<?, ?> flags, TaskAdaptable<T> task);
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.java
new file mode 100644
index 0000000..52f9735
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/HasTaskChildren.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.api.mgmt;
+
+import com.google.common.annotations.Beta;
+
+/** 
+ * Interface marks tasks which have explicit children,
+ * typically where the task defines the ordering of running those children tasks
+ * <p>
+ * The {@link Task#getSubmittedByTask()} on the child will typically return the parent,
+ * but note there are other means of submitting tasks (e.g. background, in the same {@link ExecutionContext}),
+ * where the submitter has no API reference to the submitted tasks.
+ * <p>
+ * In general the children mechanism is preferred as it is easier to navigate
+ * (otherwise you have to scan the {@link ExecutionContext} to find tasks submitted by a task).  
+ */
+@Beta // in 0.6.0
+public interface HasTaskChildren {
+
+    public Iterable<Task<?>> getChildren();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.java
new file mode 100644
index 0000000..9d20a34
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/LocationManager.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.api.mgmt;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+
+/**
+ * For managing and querying entities.
+ */
+public interface LocationManager {
+
+    /**
+     * Creates a new location, which is tracked by the management context.
+     * 
+     * @param spec
+     */
+    <T extends Location> T createLocation(LocationSpec<T> spec);
+
+    /**
+     * Convenience (particularly for groovy code) to create a location.
+     * Equivalent to {@code createLocation(LocationSpec.create(type).configure(config))}
+     * 
+     * @see #createLocation(LocationSpec)
+     */
+    <T extends Location> T createLocation(Map<?,?> config, Class<T> type);
+
+    /**
+     * All locations under control of this management plane.
+     * 
+     * This returns a snapshot of the current locations; it will not reflect future changes in the locations.
+     * If no locations are found, the collection will be empty (i.e. null is never returned).
+     */
+    Collection<Location> getLocations();
+
+    /**
+     * Returns the location under management (e.g. in use) with the given identifier 
+     * (e.g. random string; and different to the LocationDefinition id).
+     * May return a full instance, or a proxy to one which is remote.
+     * If no location found with that id, returns null.
+     */
+    Location getLocation(String id);
+    
+    /** whether the location is under management by this management context */
+    boolean isManaged(Location loc);
+
+    /**
+     * Begins management for the given location and its children, recursively.
+     *
+     * depending on the implementation of the management context,
+     * this might push it out to one or more remote management nodes.
+     * Manage a location.
+     * 
+     * @since 0.6.0 (added only for backwards compatibility, where locations are being created directly).
+     * @deprecated in 0.6.0; use {@link #createLocation(LocationSpec)} instead.
+     */
+    Location manage(Location loc);
+    
+    /**
+     * Causes the given location and its children, recursively, to be removed from the management plane
+     * (for instance because the location is no longer relevant).
+     * 
+     * If the given location is not managed (e.g. it has already been unmanaged) then this is a no-op 
+     * (though it may be logged so duplicate calls are best avoided).
+     */
+    void unmanage(Location loc);
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
new file mode 100644
index 0000000..cabadee
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java
@@ -0,0 +1,267 @@
+/*
+ * 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.api.mgmt;
+
+import java.io.Serializable;
+import java.net.URI;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.catalog.BrooklynCatalog;
+import org.apache.brooklyn.api.entity.Application;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
+import org.apache.brooklyn.api.entity.drivers.EntityDriverManager;
+import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationRegistry;
+import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
+import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityManager;
+import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
+import org.apache.brooklyn.config.StringConfigMap;
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * This is the entry point for accessing and interacting with a realm of applications and their entities in Brooklyn.
+ *
+ * For example, policies and the management console(s) (web-app, etc) can use this to interact with entities; 
+ * policies, web-app, and entities share the realm for subscribing to events, executing tasks, and generally co-existing.      
+ * <p>
+ * It may refer to several applications, and it refers to all the entities descended from those applications.
+ */
+public interface ManagementContext {
+
+    // TODO Consider separating out into a ConfigManager for methods like:
+    //  - getConfig()
+    //  - reloadBrooklynProperties();
+    //  - addPropertiesReloadListener
+    //  - removePropertiesReloadListener
+    //  - interface PropertiesReloadListener
+    
+    /** 
+     * UID for the Brooklyn management plane which this {@link ManagementContext} node is a part of.
+     * <p>
+     * Each Brooklyn entity is actively managed by a unique management plane 
+     * whose ID which should not normally change for the duration of that entity, 
+     * even though the nodes in that plane might, and the plane may go down and come back up. 
+     * In other words the value of {@link Application#getManagementContext()#getManagementPlaneId()} 
+     * will generally be constant (in contrast to {@link #getManagementNodeId()}).
+     * <p>
+     * This value should not be null unless the management context is a non-functional
+     * (non-deployment) instance. */
+    String getManagementPlaneId();
+    
+    /** 
+     * UID for this {@link ManagementContext} node (as part of a single management plane).
+     * <p>
+     * No two instances of {@link ManagementContext} should ever have the same node UID. 
+     * The value of {@link Application#getManagementContext()#getManagementNodeId()} may
+     * change many times (in contrast to {@link #getManagementPlaneId()}). 
+     * <p>
+     * This value should not be null unless the management context is a non-functional
+     * (non-deployment) instance. */
+    String getManagementNodeId();
+
+    /**
+     * The URI that this management node's REST API is available at, or absent if the node's
+     * API is unavailable.
+     */
+    Maybe<URI> getManagementNodeUri();
+
+    /**
+     * All applications under control of this management plane
+     */
+    Collection<Application> getApplications();
+
+    /**
+     * Returns the {@link EntityManager} instance for managing/querying entities.
+     */
+    EntityManager getEntityManager();
+    
+    /**
+     * Returns the {@link ExecutionManager} instance for entities and users in this management realm 
+     * to submit tasks and to observe what tasks are occurring
+     */
+    ExecutionManager getExecutionManager();
+    
+    /** 
+     * Returns an {@link ExecutionContext} within the {@link ExecutionManager} for tasks
+     * associated to the Brooklyn node's operation (not any entities). 
+     **/
+    ExecutionContext getServerExecutionContext();
+
+    /**
+     * Returns the {@link EntityDriverManager} entities can use to create drivers. This
+     * manager can also be used to programmatically customize which driver type to use 
+     * for entities in different locations.
+     * 
+     * The default strategy for choosing a driver is to use a naming convention: 
+     * {@link DriverDependentEntity#getDriverInterface()} returns the interface that the
+     * driver must implement; its name should end in "Driver". For example, this suffix is 
+     * replaced with "SshDriver" for SshMachineLocation, for example.
+     */
+    EntityDriverManager getEntityDriverManager();
+
+    /**
+     * Returns the {@link DownloadResolverManager} for resolving things like which URL to download an installer from.
+     * 
+     * The default {@link DownloadResolverManager} will retrieve {@code entity.getAttribute(Attributes.DOWNLOAD_URL)},
+     * and substitute things like "${version}" etc.
+     * 
+     * However, additional resolvers can be registered to customize this behaviour (e.g. to always go to an 
+     * enterprise's repository).
+     */
+    DownloadResolverManager getEntityDownloadsManager();
+
+    /**
+     * Returns the {@link SubscriptionManager} instance for entities and users of this management realm
+     * to subscribe to sensor events (and, in the case of entities, to emit sensor events) 
+     */
+    SubscriptionManager getSubscriptionManager();
+
+    //TODO (Alex) I'm not sure the following two getXxxContext methods are needed on the interface;
+    //I expect they will only be called once, in AbstractEntity, and fully capable
+    //there of generating the respective contexts from the managers
+    //(Litmus test will be whether there is anything in FederatedManagementContext
+    //which requires a custom FederatedExecutionContext -- or whether BasicEC 
+    //works with FederatedExecutionManager)
+    /**
+     * Returns an {@link ExecutionContext} instance representing tasks 
+     * (from the {@link ExecutionManager}) associated with this entity, and capable 
+     * of conveniently running such tasks which will be associated with that entity  
+     */
+    ExecutionContext getExecutionContext(Entity entity);
+    
+    /**
+     * Returns a {@link SubscriptionContext} instance representing subscriptions
+     * (from the {@link SubscriptionManager}) associated with this entity, and capable 
+     * of conveniently subscribing on behalf of that entity  
+     */
+    SubscriptionContext getSubscriptionContext(Entity entity);
+
+    /**
+     * Returns a {@link SubscriptionContext} instance representing subscriptions
+     * (from the {@link SubscriptionManager}) associated with this location, and capable 
+     * of conveniently subscribing on behalf of that location  
+     */
+    @Beta
+    SubscriptionContext getSubscriptionContext(Location location);
+
+    @Beta // method may move to an internal interface; brooklyn users should not need to call this directly
+    RebindManager getRebindManager();
+
+    /**
+     * @since 0.7.0
+     */
+    @Beta // method may move to an internal interface; brooklyn users should not need to call this directly
+    HighAvailabilityManager getHighAvailabilityManager();
+    
+    /**
+     * Returns the ConfigMap (e.g. BrooklynProperties) applicable to this management context.
+     * Defaults to reading ~/.brooklyn/brooklyn.properties but configurable in the management context.
+     */
+    StringConfigMap getConfig();
+    
+    /**
+     * Whether the management context has been initialized and not yet terminated.
+     * This does not mean startup is entirely completed. See also {@link #isStartupComplete()}.
+     */
+    // TODO should we replace this with isNotYetTerminated() ??
+    // and perhaps introduce isFullyRunning() which does (isStartupComplete() && isRunning()),
+    // and/or move to a MgmtContextStatus subclass where errors can also be stored?
+    public boolean isRunning();
+    
+    /**
+     * Whether all startup tasks have completed. Previous to this point the management context is still usable 
+     * (and hence {@link #isRunning()} returns true immediately after construction)
+     * but some subsystems (e.g. persistence, OSGi, webapps, entities started at startup)
+     * may not be available until this returns true.
+     * <p>
+     * Also see {@link #isStartupComplete()}.
+     */
+    @Beta  // see comment on isRunning() as items might move to a status handler
+    public boolean isStartupComplete();
+
+    /** Record of configured locations and location resolvers */
+    LocationRegistry getLocationRegistry();
+    
+    /** Record of configured Brooklyn entities (and templates and policies) which can be loaded */
+    BrooklynCatalog getCatalog();
+
+    /** Record of configured classes which can be loaded */
+    BrooklynTypeRegistry getTypeRegistry();
+    
+    /** Returns the class loader to be used to load items. 
+     * Temporary routine while catalog supports classloader-based and OSGi-based classloading. */
+    @Beta
+    ClassLoader getCatalogClassLoader();
+
+    LocationManager getLocationManager();
+
+    /**
+     * For controlling access to operations - can be queried to find if an operation is allowed.
+     * Callers should *not* cache the result of this method, but should instead always call
+     * again to get the {@link AccessController}.
+     */
+    AccessController getAccessController();
+
+    /**
+     * Reloads locations from {@code brooklyn.properties}. Any changes will apply only to newly created applications
+     */
+    void reloadBrooklynProperties();
+
+    /**
+     * Listener for {@code brooklyn.properties} reload events.
+     *
+     * @see {@link #raddPropertiesReloadListenerPropertiesReloadListener)}
+     * @see {@link #removePropertiesReloadListener(PropertiesReloadListener)}
+     */
+    interface PropertiesReloadListener extends Serializable {
+
+        /** Called when {@code brooklyn.properties} is reloaded. */
+        void reloaded();
+
+    }
+    
+    /**
+     * Registers a listener to be notified when brooklyn.properties is reloaded
+     */
+    void addPropertiesReloadListener(PropertiesReloadListener listener);
+    
+    /**
+     * Deregisters a listener from brooklyn.properties reload notifications 
+     */
+    void removePropertiesReloadListener(PropertiesReloadListener listener);
+
+    /**
+     * Active entitlements checker instance.
+     */
+    EntitlementManager getEntitlementManager();
+ 
+    /** As {@link #lookup(String, Class)} but not constraining the return type */
+    public BrooklynObject lookup(String id);
+    
+    /** Finds an entity with the given ID known at this management context */
+    // TODO in future support policies etc
+    public <T extends BrooklynObject> T lookup(String id, Class<T> type); 
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.java
new file mode 100644
index 0000000..3328b1a
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionContext.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.api.mgmt;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.Group;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+
+/**
+ * This is the context through which an {@link Entity} can manage its subscriptions.
+ */
+public interface SubscriptionContext {
+    /**
+     * As {@link SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)} with default subscription parameters for this context
+     */
+    <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+    
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToChildren(Map<String, Object> flags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+    
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToMembers(Map<String, Object> flags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+    
+    /** @see SubscriptionManager#unsubscribe(SubscriptionHandle) */
+    boolean unsubscribe(SubscriptionHandle subscriptionId);
+    
+    /** causes all subscriptions to be deregistered
+     * @return number of subscriptions removed */
+    int unsubscribeAll();
+
+    /** @see SubscriptionManager#publish(SensorEvent) */
+    <T> void publish(SensorEvent<T> event);
+
+    /** Return the subscriptions associated with this context */
+    Set<SubscriptionHandle> getSubscriptions();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
new file mode 100644
index 0000000..bb4de8c
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionHandle.java
@@ -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.
+ */
+package org.apache.brooklyn.api.mgmt;
+
+/**
+ * A "receipt" returned by {@link SubscriptionContext} and {@link SubscriptionManager}'s {@code subscribe()} 
+ * methods. It can be used to unsubscribe - see {@link SubscriptionContext#unsubscribe(SubscriptionHandle)} 
+ * and {@link SubscriptionManager#unsubscribe(SubscriptionHandle)}.
+ */
+public interface SubscriptionHandle {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.java
new file mode 100644
index 0000000..1fa327e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/SubscriptionManager.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.api.mgmt;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.Group;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+
+/**
+ * The management interface for subscriptions.
+ * 
+ * Different implementations will handle entities subscribing and unsubscribing to {@link SensorEvent}s
+ * and their delivery.
+ * 
+ * @see SubscriptionContext
+ */
+public interface SubscriptionManager {
+    /**
+     * Subscribe to {@link Sensor} data changes and events on a given {@link Entity}, supplying the {@link SensorEventListener}
+     * to invoke when they occur.
+     * 
+     * The method returns an id which can be used to {@link #unsubscribe(SubscriptionHandle)} later.
+     * <p>
+     * The listener callback is in-order single-threaded and synchronized on this object. The flags
+     * parameters can include the following:
+     * <ul>
+     * <li>subscriber - object to identify the subscriber (e.g. entity, or console session uid) 
+     * <li><i>in future</i> - control parameters for the subscription (period, minimum delta for updates, etc)
+     * </ul>
+     * 
+     * @param flags optional parameters to be associated with the subscription
+     * @param producer entity to listen to, or null to listen to all entities
+     * @param sensor sensor channel of events to listen to, or null for all sensors from the given producer(s)
+     * @param listener callback to invoke when an event occurs
+     * @return an id for this subscription
+     * 
+     * @see #unsubscribe(SubscriptionHandle)
+     */
+    <T> SubscriptionHandle subscribe(Map<String, Object> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribe(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+    /**
+     * Subscribe to {@link Sensor} data changes and events on all children of a given {@link Entity}, supplying the
+     * {@link SensorEventListener} to invoke when they occur.
+     * 
+     * The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
+     * sensor datum. The semantics are otherwise identical to the {@link #subscribe(Map, Entity, Sensor, SensorEventListener)} method.
+     *
+     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
+     */
+    <T> SubscriptionHandle subscribeToChildren(Map<String, Object> flags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+    /**
+     * Subscribe to {@link Sensor} data changes and events on all members of a given {@link Group}, supplying the
+     * {@link SensorEventListener} to invoke when they occur.
+     * 
+     * The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
+     * sensor datum. The semantics are otherwise identical to the {@link #subscribe(Map, Entity, Sensor, SensorEventListener)} method.
+     *
+     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
+     */
+    <T> SubscriptionHandle subscribeToMembers(Map<String, Object> flags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /** @see #subscribeToMembers(Map, Group, Sensor, SensorEventListener) */
+    <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+    /**
+     * Unsubscribe the given subscription id.
+     * 
+     * @return true if such a subscription was present (and it will now be removed)
+     * 
+     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
+     */
+    boolean unsubscribe(SubscriptionHandle subscriptionId);
+
+    /**
+     * Deliver a {@link SensorEvent} to all subscribed listeners.
+     */
+    <T> void publish(SensorEvent<T> event);
+
+    /** Return the subscriptions requested by a given subscriber */
+    Set<SubscriptionHandle> getSubscriptionsForSubscriber(Object subscriber);
+    
+    /** Return the subscriptions on a given source-sensor pair */
+    Set<SubscriptionHandle> getSubscriptionsForEntitySensor(Entity source, Sensor<?> sensor);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
new file mode 100644
index 0000000..42147c5
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/Task.java
@@ -0,0 +1,146 @@
+/*
+ * 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.api.mgmt;
+
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.brooklyn.util.time.Duration;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Represents a unit of work for execution.
+ *
+ * When used with an {@link ExecutionManager} or {@link ExecutionContext} it will record submission time,
+ * execution start time, end time, and any result. A task can be submitted to the ExecutionManager or
+ * ExecutionContext, in which case it will be returned, or it may be created by submission
+ * of a {@link Runnable} or {@link Callable} and thereafter it can be treated just like a {@link Future}.
+ */
+public interface Task<T> extends ListenableFuture<T>, TaskAdaptable<T> {
+    
+    public String getId();
+    
+    public Set<Object> getTags();
+    /** if {@link #isSubmitted()} returns the time when the task was submitted; or -1 otherwise */
+    public long getSubmitTimeUtc();
+    /** if {@link #isBegun()} returns the time when the task was starts;
+     * guaranteed to be >= {@link #getSubmitTimeUtc()} > 0 if started, or -1 otherwise */
+    public long getStartTimeUtc();
+    /** if {@link #isDone()} (for any reason) returns the time when the task ended;
+     * guaranteed to be >= {@link #getStartTimeUtc()} > 0 if ended, or -1 otherwise */
+    public long getEndTimeUtc();
+    public String getDisplayName();
+    public String getDescription();
+    
+    /** task which submitted this task, if was submitted by a task */
+    public Task<?> getSubmittedByTask();
+
+    /** The thread where the task is running, if it is running. */
+    public Thread getThread();
+
+    /**
+     * Whether task has been submitted
+     *
+     * Submitted tasks are normally expected to start running then complete,
+     * but unsubmitted tasks are sometimes passed around for someone else to submit them.
+     */
+    public boolean isSubmitted();
+
+    /**
+     * Whether task has started running.
+     *
+     * Will remain true after normal completion or non-cancellation error.
+     * will be true on cancel iff the thread did actually start.
+     */
+    public boolean isBegun();
+
+    /**
+     * Whether the task threw an error, including cancellation (implies {@link #isDone()})
+     */
+    public boolean isError();
+
+    /**
+     * As {@link Future#isDone()}. In particular if cancelled, this will return true
+     * as soon as it is cancelled. The thread for this task may still be running,
+     * if the cancellation (often an interruption, but may be weaker) has not applied,
+     * and submitted threads may also be running depending on cancellation parameters.
+     * <p>
+     * {@link #get()} is guaranteed to return immediately, throwing in the case of cancellation
+     * prior to completion (and including the case above where a thread may still be running).
+     * <p>
+     * To check whether cancelled threads for this task have completed, 
+     * inspect {@link #getEndTimeUtc()}, which is guaranteed to be set when threads complete
+     * if the thread is started (as determinable by whether {@link #getStartTimeUtc()} is set).
+     * (The threads of submitted/child tasks will usually be independent; to determine their
+     * completion requires inspecting the {@link ExecutionManager}.)  
+     */
+    @Override
+    public boolean isDone();
+    
+    /**
+     * Causes calling thread to block until the task is started.
+     */
+    public void blockUntilStarted();
+
+    /**
+     * Causes calling thread to block until the task is ended.
+     * <p>
+     * Either normally or by cancellation or error, but without throwing error on cancellation or error.
+     * (Errors are logged at debug.)
+     */
+    public void blockUntilEnded();
+
+    /**
+     * As {@link #blockUntilEnded()}, but returning after the given timeout;
+     * true if the task has ended and false otherwise
+     */
+    public boolean blockUntilEnded(Duration timeout);
+
+    public String getStatusSummary();
+
+    /**
+     * Returns detailed status, suitable for a hover.
+     *
+     * Plain-text format, with new-lines (and sometimes extra info) if multiline enabled.
+     */
+    public String getStatusDetail(boolean multiline);
+
+    /** As {@link #get(long, java.util.concurrent.TimeUnit)} */
+    public T get(Duration duration) throws InterruptedException, ExecutionException, TimeoutException;
+    
+    /** As {@link #get()}, but propagating checked exceptions as unchecked for convenience. */
+    public T getUnchecked();
+
+    /** As {@link #get()}, but propagating checked exceptions as unchecked for convenience
+     * (including a {@link TimeoutException} if the duration expires) */
+    public T getUnchecked(Duration duration);
+
+    /** As {@link Future#cancel(boolean)}. Note that {@link #isDone()} and {@link #blockUntilEnded(Duration)} return immediately
+     * once a task is cancelled, consistent with the underlying {@link FutureTask} behaviour.  
+     * TODO Fine-grained control over underlying jobs, e.g. to ensure anything represented by this task is actually completed,
+     * is not (yet) publicly exposed. See the convenience method blockUntilInternalTasksEnded in the Tasks set of helpers
+     * for more discussion. */
+    public boolean cancel(boolean mayInterruptIfRunning);
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.java
new file mode 100644
index 0000000..4b371be
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskAdaptable.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.api.mgmt;
+
+/** marker interface for something which can be adapted to a task  */
+public interface TaskAdaptable<T> {
+    Task<T> asTask();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
new file mode 100644
index 0000000..adc4817
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskFactory.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.api.mgmt;
+
+
+/** Interface for something which can generate tasks (or task wrappers) */
+public interface TaskFactory<T extends TaskAdaptable<?>> {
+    T newTask();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java
new file mode 100644
index 0000000..9794c5e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskQueueingContext.java
@@ -0,0 +1,62 @@
+/*
+ * 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.api.mgmt;
+
+import java.util.List;
+
+import org.apache.brooklyn.util.time.Duration;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Marks a place where tasks can be added, e.g. a task which allows children to be added (including after it is activated);
+ * if the implementer of this is also a task, then it may be picked up by hierarchical methods (e.g. in DynamicTasks).
+ * 
+ * @since 0.6.0
+ */
+@Beta
+public interface TaskQueueingContext {
+
+    /** queues the task for submission as part of this queueing context
+     * <p>
+     * implementations should mark it as queued but not yet submitted.
+     * note the task may have already been submitted, and is being queued here for informational purposes,
+     * in which case the implementation should not run it. */
+    public void queue(Task<?> t);
+    
+    /** returns a list of queued tasks (immutable copy) */
+    public List<Task<?>> getQueue();
+
+    /** Drains the task queue for this context to complete, ie waits for this context to complete (or terminate early)
+     * @param optionalTimeout null to run forever
+     * @param includePrimaryThread whether the parent (this context) should also be joined on;
+     *   should only be true if invoking this from another task, as otherwise it will be waiting for itself!
+     * @param throwFirstError whether to throw the first exception encountered
+     * <p>
+     * Also note that this waits on tasks so that blocking details on the caller are meaningful.
+     */
+    public void drain(Duration optionalTimeout, boolean includePrimaryThread, boolean throwFirstError);
+
+    /** Returns the task which is this queueing context */
+    public Task<?> asTask();
+
+    /** causes subsequent children failures not to fail the parent */
+    public void swallowChildrenFailures();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
new file mode 100644
index 0000000..a66b2e5
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/TaskWrapper.java
@@ -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.
+ */
+package org.apache.brooklyn.api.mgmt;
+
+/**
+ * Interface for something which is not a task, but which is closely linked to one, ie. it has a task.
+ * 
+ * @since 0.6.0
+ */
+public interface TaskWrapper<T> extends TaskAdaptable<T> {
+    Task<T> getTask();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.java
new file mode 100644
index 0000000..f95c0d8
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/classloading/BrooklynClassLoadingContext.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.api.mgmt.classloading;
+
+import java.net.URL;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.util.guava.Maybe;
+
+/** 
+ * Provides functionality for loading classes based on the current context
+ * (e.g. the bundles of a registered type from which an entity is created)
+ */
+public interface BrooklynClassLoadingContext {
+
+    public ManagementContext getManagementContext();
+    public Class<?> loadClass(String className);
+    public <T> Class<? extends T> loadClass(String className, @Nullable Class<T> supertype);
+
+    public Maybe<Class<?>> tryLoadClass(String className);
+    public <T> Maybe<Class<? extends T>> tryLoadClass(String className, @Nullable Class<T> supertype);
+
+    /** As {@link ClassLoader#getResource(String)} */
+    public URL getResource(String name);
+
+    /**
+     * As {@link ClassLoader#getResources(String)} but returning an {@link Iterable} rather than
+     * an {@link java.util.Enumeration}.
+     */
+    public Iterable<URL> getResources(String name);
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
new file mode 100644
index 0000000..a44a621
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementClass.java
@@ -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.
+ */
+package org.apache.brooklyn.api.mgmt.entitlement;
+
+import com.google.common.reflect.TypeToken;
+
+/** @see EntitlementManager */
+public interface EntitlementClass<T> {
+    String entitlementClassIdentifier();
+    TypeToken<T> entitlementClassArgumentType();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.java
new file mode 100644
index 0000000..8525adc
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementContext.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.api.mgmt.entitlement;
+
+/** @see EntitlementManager */
+public interface EntitlementContext {
+    String user();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
new file mode 100644
index 0000000..54fcd7e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/entitlement/EntitlementManager.java
@@ -0,0 +1,45 @@
+/*
+ * 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.api.mgmt.entitlement;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.common.annotations.Beta;
+
+/** 
+ * Entitlement lookup relies on:
+ * <li>an "entitlement context", consisting of at minimum a string identifier of the user/actor for which entitlement is being requested
+ * <li>an "entitlement class", representing the category of activity for which entitlement is being requested
+ * <li>an "entitlement class argument", representing the specifics of the activity for which entitlement is being requested
+ * <p>
+ * Instances of this class typically have a 1-arg constructor taking a BrooklynProperties object
+ * (configuration injected by the Brooklyn framework)
+ * or a 0-arg constructor (if no external configuration is needed).
+ * <p>
+ * An EntitlementManagerAdapter class is available to do dispatch to common methods.
+ * <p>
+ * Instantiation is done e.g. by Entitlements.newManager.  
+ * @since 0.7.0 */
+@Beta
+public interface EntitlementManager {
+
+    public <T> boolean isEntitled(@Nullable EntitlementContext context, @Nonnull EntitlementClass<T> entitlementClass, @Nullable T entitlementClassArgument);
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
new file mode 100644
index 0000000..6724a03
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityManager.java
@@ -0,0 +1,129 @@
+/*
+ * 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.api.mgmt.ha;
+
+import java.util.Map;
+
+import com.google.common.annotations.Beta;
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Monitors other management nodes (via the {@link ManagementPlaneSyncRecordPersister}) to detect
+ * if the current master has failed or stopped. If so, then deterministically chooses a new master.
+ * If that master is self, then promotes.
+
+ * Users are not expected to implement this class, or to call methods on it directly.
+ * 
+ * Expected lifecycle of methods calls on this is:
+ * <ol>
+ *   <li>{@link #setPersister(ManagementPlaneSyncRecordPersister)}
+ *   <li>Exactly one of {@link #disabled()} or {@link #start(HighAvailabilityMode)}
+ *   <li>{@link #stop()}
+ * </ol>
+ * 
+ * @since 0.7.0
+ */
+@Beta
+public interface HighAvailabilityManager {
+
+    ManagementNodeState getNodeState();
+    
+    /** The time in milliseconds when the state was last changed. -1 if no state transition has occurred yet.*/
+    long getLastStateChange();
+    
+    /**
+     * @param persister
+     * @return self
+     */
+    HighAvailabilityManager setPersister(ManagementPlaneSyncRecordPersister persister);
+
+    /**
+     * Indicates that HA is disabled: this node will act as the only management node in this management plane,
+     * and will not persist HA meta-information (meaning other nodes cannot join). 
+     * <p>
+     * Subsequently can expect {@link #getNodeState()} to be {@link ManagementNodeState#MASTER} 
+     * and {@link #loadManagementPlaneSyncRecord(boolean)} to show just this one node --
+     * as if it were running HA with just one node --
+     * but {@link #isRunning()} will return false.
+     * <p>
+     * Currently this method is intended to be called early in the lifecycle,
+     * instead of {@link #start(HighAvailabilityMode)}. It may be an error if
+     * this is called after this HA Manager is started.
+     */
+    @Beta
+    void disabled();
+
+    /** Whether HA mode is operational */
+    boolean isRunning();
+    
+    /**
+     * Starts the monitoring of other nodes (and thus potential promotion of this node from standby to master).
+     * <p>
+     * When this method returns, the status of this node will be set,
+     * either {@link ManagementNodeState#MASTER} if appropriate 
+     * or {@link ManagementNodeState#STANDBY} / {@link ManagementNodeState#HOT_STANDBY} / {@link ManagementNodeState#HOT_BACKUP}.
+     *
+     * @param startMode mode to start with
+     * @throws IllegalStateException if current state of the management-plane doesn't match that desired by {@code startMode} 
+     */
+    void start(HighAvailabilityMode startMode);
+
+    /**
+     * Stops this node, then publishes own status (via {@link ManagementPlaneSyncRecordPersister} of {@link ManagementNodeState#TERMINATED}.
+     */
+    void stop();
+
+    /** changes the mode that this HA server is running in
+     * <p>
+     * note it will be an error to {@link #changeMode(HighAvailabilityMode)} to {@link ManagementNodeState#MASTER} 
+     * when there is already a master; to promote a node explicitly set its priority higher than
+     * the others and invoke {@link #changeMode(HighAvailabilityMode)} to a standby mode on the existing master */
+    void changeMode(HighAvailabilityMode mode);
+
+    /** sets the priority, and publishes it synchronously so it is canonical */
+    void setPriority(long priority);
+    
+    long getPriority();
+
+    /** deletes non-master node records; active nodes (including this) will republish, 
+     * so this provides a simple way to clean out the cache of dead brooklyn nodes */
+    @Beta
+    void publishClearNonMaster();
+
+    /**
+     * Returns a snapshot of the management-plane's current / most-recently-known status,
+     * as last read from {@link #loadManagementPlaneSyncRecord(boolean)}, or null if none read.
+     */
+    ManagementPlaneSyncRecord getLastManagementPlaneSyncRecord();
+    
+    /**
+     * @param useLocalKnowledgeForThisNode - if true, the record for this mgmt node will be replaced with the
+     * actual current status known in this JVM (may be more recent than what is persisted);
+     * for most purposes there is little difference but in some cases the local node being updated
+     * may be explicitly wanted or not wanted
+     */
+    ManagementPlaneSyncRecord loadManagementPlaneSyncRecord(boolean useLocalKnowledgeForThisNode);
+    
+    @VisibleForTesting
+    ManagementPlaneSyncRecordPersister getPersister();
+
+    /** Returns a collection of metrics */
+    Map<String,Object> getMetrics();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
new file mode 100644
index 0000000..146057d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/HighAvailabilityMode.java
@@ -0,0 +1,67 @@
+/*
+ * 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.api.mgmt.ha;
+
+/** Specifies the HA mode that a mgmt node should run in */
+public enum HighAvailabilityMode {
+    /** 
+     * Means HA mode should not be operational.
+     * <p>
+     * When specified for the initial HA mode, this simply turns off HA.
+     * <p>
+     * However if being used to {@link HighAvailabilityManager#changeMode(HighAvailabilityMode)},
+     * this will cause the node to transition to a {@link ManagementNodeState#FAILED} state.
+     * Switching to a "master-but-not-part-of-HA" state is not currently supported, as this would be
+     * problematic if another node (which was part of HA) then tries to become master,
+     * and the more common use of this at runtime is to disable a node from being part of the HA plane. 
+     */
+    DISABLED,
+    
+    /**
+     * Means auto-detect whether to be master or standby; if there is already a master then start as standby, 
+     * otherwise start as master.
+     */
+    AUTO,
+    
+    /**
+     * Means node must be lukewarm standby; if there is not already a master then fail fast on startup.
+     * See {@link ManagementNodeState#STANDBY}. 
+     */
+    STANDBY,
+    
+    /**
+     * Means node must be hot standby; if there is not already a master then fail fast on startup.
+     * See {@link ManagementNodeState#HOT_STANDBY}. 
+     */
+    HOT_STANDBY,
+    
+    /**
+     * Means node must be hot backup; do not attempt to become master (but it <i>can</i> start without a master).
+     * See {@link ManagementNodeState#HOT_BACKUP}. 
+     */
+    HOT_BACKUP,
+    
+    /**
+     * Means node must be master; if there is already a master then fail fast on startup.
+     * See {@link ManagementNodeState#MASTER}.
+     */
+    // TODO when multi-master supported we will of course not fail fast on startup when there is already a master;
+    // instead the responsibility for master entities will be divided among masters
+    MASTER;
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.java
new file mode 100644
index 0000000..6e42796
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeState.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.api.mgmt.ha;
+
+import org.apache.brooklyn.util.guava.Maybe;
+
+public enum ManagementNodeState {
+    /** Node is either coming online, or is in some kind of recovery/transitioning mode */
+    INITIALIZING,
+    
+    /** Node is in "lukewarm standby" mode, where it is available to be promoted to master,
+     * but does not have entities loaded and will require some effort to be promoted */
+    STANDBY,
+    /** Node is acting as read-only proxy available to be promoted to master on existing master failure */
+    HOT_STANDBY,
+    /** Node is acting as a read-only proxy but not making itself available for promotion to master */
+    HOT_BACKUP,
+    /** Node is running as primary/master, able to manage entities and create new ones */
+    // the semantics are intended to support multi-master here; we could have multiple master nodes,
+    // but we need to look up who is master for any given entity
+    MASTER,
+
+    /** Node has failed and requires maintenance attention */
+    FAILED,
+    /** Node has gone away; maintenance not possible */
+    TERMINATED;
+
+    /** Converts a {@link HighAvailabilityMode} to a {@link ManagementNodeState}, if possible */
+    public static Maybe<ManagementNodeState> of(HighAvailabilityMode startMode) {
+        switch (startMode) {
+        case AUTO:
+        case DISABLED:
+            return Maybe.absent("Requested "+HighAvailabilityMode.class+" mode "+startMode+" cannot be converted to "+ManagementNodeState.class);
+        case HOT_BACKUP:
+            return Maybe.of(HOT_BACKUP);
+        case HOT_STANDBY:
+            return Maybe.of(HOT_STANDBY);
+        case MASTER:
+            return Maybe.of(MASTER);
+        case STANDBY:
+            return Maybe.of(STANDBY);
+        }
+        // above should be exhaustive
+        return Maybe.absent("Requested "+HighAvailabilityMode.class+" mode "+startMode+" was not expected");
+    }
+
+    /** true for hot non-master modes, where we are proxying the data from the persistent store */
+    public static boolean isHotProxy(ManagementNodeState state) {
+        return state==HOT_BACKUP || state==HOT_STANDBY;
+    }
+
+    /** true for non-master modes which can be promoted to master */
+    public static boolean isStandby(ManagementNodeState state) {
+        return state==ManagementNodeState.STANDBY || state==ManagementNodeState.HOT_STANDBY;
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java
new file mode 100644
index 0000000..dccbd01
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementNodeSyncRecord.java
@@ -0,0 +1,62 @@
+/*
+ * 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.api.mgmt.ha;
+
+import java.net.URI;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Represents the state of a management-node.
+ * 
+ * @see {@link ManagementPlaneSyncRecord#getManagementNodes()}
+ * 
+ * @since 0.7.0
+ * 
+ * @author aled
+ */
+@Beta
+public interface ManagementNodeSyncRecord {
+
+    // TODO Not setting URI currently; ManagementContext doesn't know its URI; only have one if web-console was enabled.
+    
+    // TODO Add getPlaneId(); but first need to set it in a sensible way
+    
+    String getBrooklynVersion();
+    
+    String getNodeId();
+    
+    URI getUri();
+    
+    ManagementNodeState getStatus();
+
+    Long getPriority();
+    
+    /** timestamp set by the originating management machine */
+    long getLocalTimestamp();
+
+    /** timestamp set by shared persistent store, if available
+     * <p>
+     * this will not be set on records originating at this machine, nor will it be persisted,
+     * but it will be populated for records being read */
+    Long getRemoteTimestamp();
+    
+    String toVerboseString();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.java
new file mode 100644
index 0000000..86bb74e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecord.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.api.mgmt.ha;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMemento;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Meta-data about the management plane - the management nodes and who is currently master.
+ * Does not contain any data about the entities under management.
+ * <p>
+ * This is very similar to how {@link BrooklynMemento} is used by {@link BrooklynMementoPersister},
+ * but it is not a memento in the sense it does not reconstitute the entire management plane
+ * (so is not called Memento although it can be used by the same memento-serializers).
+ * 
+ * @since 0.7.0
+ * 
+ * @author aled
+ */
+@Beta
+public interface ManagementPlaneSyncRecord {
+
+    // TODO Add getPlaneId(); but first need to set it sensibly on each management node
+    
+    String getMasterNodeId();
+    
+    /** returns map of {@link ManagementNodeSyncRecord} instances keyed by the nodes' IDs */
+    Map<String, ManagementNodeSyncRecord> getManagementNodes();
+
+    String toVerboseString();
+}


[39/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!)

Posted by he...@apache.org.
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/interpret/PlanInterpretationContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationContext.java
deleted file mode 100644
index f45d7c6..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/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 org.apache.brooklyn.camp.spi.resolve.interpret;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import com.google.common.collect.ImmutableList;
-
-public class PlanInterpretationContext {
-
-    private final Map<String,Object> originalDeploymentPlan;
-    private final List<PlanInterpreter> interpreters;
-    private final PlanInterpreter allInterpreter;
-
-    public PlanInterpretationContext(Map<String,?> originalDeploymentPlan, List<PlanInterpreter> interpreters) {
-        super();
-        this.originalDeploymentPlan = MutableMap.copyOf(originalDeploymentPlan).asUnmodifiable();
-        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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java b/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
deleted file mode 100644
index 2cf3d5d..0000000
--- a/brooklyn-server/camp/camp-base/src/main/java/org/apache/brooklyn/camp/spi/resolve/interpret/PlanInterpretationNode.java
+++ /dev/null
@@ -1,259 +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.interpret;
-
-import java.util.Map;
-
-import org.apache.brooklyn.camp.spi.resolve.PlanInterpreter;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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 (!checkCollectionImmutable(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 (!checkCollectionImmutable(in))
-            log.warn("Node original value "+in+" at "+this+" should be immutable");
-    }
-    
-    private static boolean checkCollectionImmutable(Object in) {
-        // not used -- input might now be UnmodifiableMap, as some args might be null, 
-        // and UnmodifiableMap is private :(  ... (and same for list)
-        return true;
-    }
-
-    private static Object immutable(Object in) {
-        if (in instanceof Map) return MutableMap.copyOf((Map<?,?>)in).asUnmodifiable();
-        if (in instanceof Iterable) return MutableList.copyOf((Iterable<?>)in).asUnmodifiable();
-        return in;
-    }
-
-}

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

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.java
deleted file mode 100644
index 51dcc2f..0000000
--- a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/DeploymentPlanToyInterpreterTest.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 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.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-@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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
deleted file mode 100644
index b9fee6f..0000000
--- a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/spi/pdp/PdpYamlTest.java
+++ /dev/null
@@ -1,79 +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.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.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.java
deleted file mode 100644
index a358eed..0000000
--- a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockAssemblyTemplateInstantiator.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.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/mock/web/MockWebPlatform.java
deleted file mode 100644
index 4a60d1c..0000000
--- a/brooklyn-server/camp/camp-base/src/test/java/org/apache/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 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 org.apache.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java b/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.java
deleted file mode 100644
index ccebaa6..0000000
--- a/brooklyn-server/camp/camp-base/src/test/java/org/apache/brooklyn/camp/test/platform/BasicCampPlatformTest.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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-artifact.yaml
deleted file mode 100644
index 0b4518b..0000000
--- a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/pdp-single-service.yaml
deleted file mode 100644
index fe052d6..0000000
--- a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter-result.yaml
deleted file mode 100644
index 71b0ba8..0000000
--- a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml b/brooklyn-server/camp/camp-base/src/test/resources/org/apache/brooklyn/camp/spi/pdp/yaml-sample-toy-interpreter.yaml
deleted file mode 100644
index 8aa01d2..0000000
--- a/brooklyn-server/camp/camp-base/src/test/resources/org/apache/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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/README.md
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/README.md b/brooklyn-server/camp/camp-brooklyn/README.md
deleted file mode 100644
index e0a112a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Depends on  brooklyncentral/camp-server
-
-----
-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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/pom.xml b/brooklyn-server/camp/camp-brooklyn/pom.xml
deleted file mode 100644
index b818b99..0000000
--- a/brooklyn-server/camp/camp-brooklyn/pom.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>brooklyn-camp</artifactId>
-    <packaging>jar</packaging>
-    <name>Brooklyn CAMP REST API</name>
-    <description>
-        Brooklyn support for the Oasis CAMP server
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-policy</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn.camp</groupId>
-            <artifactId>camp-base</artifactId>
-            <version>${project.version}</version>
-            <exclusions>
-                <!-- Dependency versions mismatch between transitive dependencies, declare explicitly -->
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <!-- for $brooklyn:object -->
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-            <version>1.9.1</version>
-            <exclusions>
-                <!-- Dependency versions mismatch between transitive dependencies, declare explicitly -->
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!-- TODO not enamoured of including software-base here, but it allows us to reference chef and vanilla for short names;
-             ideally there is a mixin strategy by which they can be discovered (eg using java service discovery) -->
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-base</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-logback-xml</artifactId>
-            <version>${project.version}</version>
-            <!-- optional so that this project has logging; dependencies may redeclare or supply their own -->
-            <optional>true</optional>
-        </dependency>
-        
-        <!-- demo and tests -->
-        <dependency>
-            <groupId>org.apache.brooklyn.camp</groupId>
-            <artifactId>camp-base</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-rt-osgi</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-base</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-locations-jclouds</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- Transitive dependencies, declared explicitly due to version mismatch -->
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>${commons-logging.version}</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <supportedProjectTypes>
-                        <supportedProjectType>jar</supportedProjectType>
-                    </supportedProjectTypes>
-                    <instructions>
-                        <Export-Package>org.apache.brooklyn.*</Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-<!-- if you want to build a WAR, full or skinny:
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>${maven-war-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>make-skinny-war</id>
-                        <phase>install</phase>
-                        <goals>
-                            <goal>war</goal>
-                        </goals>
-                        <configuration>
-                            <classifier>skinny</classifier>
-                            <packagingExcludes>WEB-INF/lib/*.jar,WEB-INF/classes/**/*.class</packagingExcludes>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>make-full-war</id>
-                        <phase>install</phase>
-                        <goals>
-                            <goal>war</goal>
-                        </goals>
-                        <configuration>
-                            <classifier>full</classifier>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
--->
-
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
deleted file mode 100644
index d3641f2..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.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 org.apache.brooklyn.camp.brooklyn;
-
-import java.util.Set;
-
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-
-import com.google.common.collect.ImmutableSet;
-
-public class BrooklynCampConstants {
-
-    public static final String PLAN_ID_FLAG = "planId";
-
-    public static final ConfigKey<String> PLAN_ID = ConfigKeys.builder(String.class, "camp.plan.id")
-            .description("Identifier supplied in the deployment plan for component to which this entity corresponds "
-                        + "(human-readable, for correlating across plan, template, and instance)")
-            .inheritance(ConfigInheritance.NONE)
-            .build();
-
-    public static final ConfigKey<String> TEMPLATE_ID = ConfigKeys.builder(String.class, "camp.template.id")
-            .description("UID of the component in the CAMP template from which this entity was created")
-            .inheritance(ConfigInheritance.NONE)
-            .build();
-
-    public static final ConfigKey<CampPlatform> CAMP_PLATFORM = ConfigKeys.newConfigKey(CampPlatform.class, "brooklyn.camp.platform",
-            "Config set at brooklyn management platform to find the CampPlatform instance (bi-directional)");
-
-    public static final Set<String> YAML_URL_PROTOCOL_WHITELIST = ImmutableSet.of("classpath", "http", "https");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
deleted file mode 100644
index 7290c24..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
+++ /dev/null
@@ -1,103 +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.brooklyn;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.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 org.apache.brooklyn.core.mgmt.HasBrooklynManagementContext;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.internal.CampYamlParser;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/** {@link CampPlatform} implementation which includes Brooklyn entities 
- * (via {@link BrooklynImmutableCampPlatform})
- * and allows customisation / additions */
-public class BrooklynCampPlatform extends AggregatingCampPlatform implements HasBrooklynManagementContext {
-
-    private final ManagementContext bmc;
-
-    public BrooklynCampPlatform(PlatformRootSummary root, ManagementContext managementContext) {
-        super(root);
-        addPlatform(new BrooklynImmutableCampPlatform(root, managementContext));
-        
-        this.bmc = managementContext;
-        
-        addMatchers();
-        addInterpreters();
-        
-        managementContext.addPropertiesReloadListener(new PropertiesReloadListener() {
-            private static final long serialVersionUID = -3739276553334749184L;
-            @Override public void reloaded() {
-                setConfigKeyAtManagmentContext();
-            }
-        });
-    }
-
-    // --- brooklyn setup
-    
-    @Override
-    public ManagementContext getBrooklynManagementContext() {
-        return bmc;
-    }
-    
-    protected void addMatchers() {
-        // TODO artifacts
-        pdp().addMatcher(new BrooklynEntityMatcher(bmc));
-    }
-    
-    protected void addInterpreters() {
-        pdp().addInterpreter(new BrooklynDslInterpreter());
-    }
-
-    public BrooklynCampPlatform setConfigKeyAtManagmentContext() {
-        ((ManagementContextInternal)bmc).getBrooklynProperties().put(BrooklynCampConstants.CAMP_PLATFORM, this);
-        ((ManagementContextInternal)bmc).getBrooklynProperties().put(CampYamlParser.YAML_PARSER_KEY, new YamlParserImpl(this));
-        return this;
-    }
-    
-    public static class YamlParserImpl implements CampYamlParser {
-        private final BrooklynCampPlatform platform;
-        
-        YamlParserImpl(BrooklynCampPlatform platform) {
-            this.platform = platform;
-        }
-        
-        public Map<String, Object> parse(Map<String, Object> map) {
-            return platform.pdp().applyInterpreters(map);
-        }
-        
-        public Object parse(String val) {
-            Map<String, Object> result = platform.pdp().applyInterpreters(ImmutableMap.of("dummyKey", val));
-            checkState(result.keySet().equals(ImmutableSet.of("dummyKey")), "expected single result, but got %s", result);
-            return result.get("dummyKey");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
deleted file mode 100644
index 921615e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
+++ /dev/null
@@ -1,73 +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.brooklyn;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-
-import com.google.common.annotations.Beta;
-
-/** launcher for {@link BrooklynCampPlatform}, which may or may not start a (web) server depending on children */
-@Beta
-public abstract class BrooklynCampPlatformLauncherAbstract {
-
-    protected BrooklynCampPlatform platform;
-    protected ManagementContext mgmt;
-    
-    public BrooklynCampPlatformLauncherAbstract useManagementContext(ManagementContext mgmt) {
-        if (this.mgmt!=null && mgmt!=this.mgmt)
-            throw new IllegalStateException("Attempt to change mgmt context; not supported.");
-        
-        this.mgmt = mgmt;
-        
-        return this;
-    }
-    
-    public BrooklynCampPlatformLauncherAbstract launch() {
-        if (platform!=null)
-            throw new IllegalStateException("platform already created");
-
-        if (getBrooklynMgmt()==null)
-            useManagementContext(newMgmtContext());
-        
-        platform = new BrooklynCampPlatform(
-                PlatformRootSummary.builder().name("Brooklyn CAMP Platform").build(),
-                getBrooklynMgmt())
-            .setConfigKeyAtManagmentContext();
-        
-        return this;
-    }
-
-    protected LocalManagementContext newMgmtContext() {
-        return new LocalManagementContext();
-    }
-
-    public ManagementContext getBrooklynMgmt() {
-        return mgmt;
-    }
-    
-    public BrooklynCampPlatform getCampPlatform() {
-        return platform;
-    }
-
-    /** stops any servers (camp and brooklyn) launched by this launcher */
-    public abstract void stopServers() throws Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherNoServer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherNoServer.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherNoServer.java
deleted file mode 100644
index be2488b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherNoServer.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.brooklyn;
-
-import com.google.common.annotations.Beta;
-
-
-/** launcher for {@link BrooklynCampPlatform}, which does not start a server (and can live in this project) */
-@Beta
-public class BrooklynCampPlatformLauncherNoServer extends BrooklynCampPlatformLauncherAbstract {
-
-    @Override
-    public void stopServers() {
-        // nothing to do
-    }
-    
-    public static void main(String[] args) {
-        new BrooklynCampPlatformLauncherNoServer().launch();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampReservedKeys.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampReservedKeys.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampReservedKeys.java
deleted file mode 100644
index 52f52e9..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampReservedKeys.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.brooklyn;
-
-public interface BrooklynCampReservedKeys {
-    public static final String BROOKLYN_CONFIG = "brooklyn.config";
-    public static final String BROOKLYN_FLAGS = "brooklyn.flags";
-    public static final String BROOKLYN_POLICIES = "brooklyn.policies";
-    public static final String BROOKLYN_ENRICHERS = "brooklyn.enrichers";
-    public static final String BROOKLYN_CHILDREN = "brooklyn.children";
-    public static final String BROOKLYN_INITIALIZERS = "brooklyn.initializers";
-    public static final String BROOKLYN_PARAMETERS = "brooklyn.parameters";
-    public static final String BROOKLYN_CATALOG = "brooklyn.catalog";
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
deleted file mode 100644
index 931a358..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.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 org.apache.brooklyn.camp.brooklyn;
-
-import java.io.Reader;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.BrooklynShutdownHooks;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-
-/** convenience for launching YAML files directly */
-@Beta
-public abstract class YamlLauncherAbstract {
-
-    private static final Logger log = LoggerFactory.getLogger(YamlLauncherAbstract.class);
-       
-    protected final BrooklynCampPlatformLauncherAbstract platformLauncher;
-
-    protected final BrooklynCampPlatform platform;
-    protected final ManagementContext brooklynMgmt;
-    protected boolean shutdownAppsOnExit = false;
-
-    public YamlLauncherAbstract() {
-        this.platformLauncher = newPlatformLauncher();
-        platformLauncher.launch();
-        this.platform = platformLauncher.getCampPlatform();
-        this.brooklynMgmt = platformLauncher.getBrooklynMgmt();
-    }
-
-    public ManagementContext getManagementContext() {
-        return brooklynMgmt;
-    }
-
-    public boolean getShutdownAppsOnExit() {
-        return shutdownAppsOnExit;
-    }
-    
-    public void setShutdownAppsOnExit(boolean shutdownAppsOnExit) {
-        this.shutdownAppsOnExit = shutdownAppsOnExit;
-    }
-    
-    protected abstract BrooklynCampPlatformLauncherAbstract newPlatformLauncher();
-
-    public Application launchAppYaml(String url) {
-        return launchAppYaml(url, true);
-    }
-
-    public Application launchAppYaml(String url, boolean waitForTasksToComplete) {
-        try {
-            Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl(url));
-            Application app = launchAppYaml(input, waitForTasksToComplete);
-            log.info("Application started from YAML file "+url+": "+app);
-            return app;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    public Application launchAppYaml(Reader input) {
-        return launchAppYaml(input, true);
-    }
-
-    public Application launchAppYaml(Reader input, boolean waitForTasksToComplete) {
-        try {
-            AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-
-            Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-            Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId());
-            log.info("Launching "+app);
-
-            if (getShutdownAppsOnExit()) BrooklynShutdownHooks.invokeStopOnShutdown(app);
-
-            if (waitForTasksToComplete) {
-                Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(), app);
-                log.info("Waiting on "+tasks.size()+" task(s)");
-                for (Task<?> t: tasks) {
-                    t.blockUntilEnded();
-                }
-            }
-
-            log.info("Application started from YAML: "+app);
-            Entities.dumpInfo(app);
-            return (Application)app;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    /** kills all apps, web servers, and mgmt context
-     * <p>
-     * this launcher does not support being used again subsequently */
-    public void destroyAll() {
-        Entities.destroyAll(getManagementContext());
-        try {
-            platformLauncher.stopServers();
-        } catch (Exception e) {
-            log.warn("Unable to stop servers (ignoring): "+e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherNoServer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherNoServer.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherNoServer.java
deleted file mode 100644
index 1ec3c8d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherNoServer.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 org.apache.brooklyn.camp.brooklyn;
-
-import com.google.common.annotations.Beta;
-
-/** convenience for launching YAML files directly */
-@Beta
-public class YamlLauncherNoServer extends YamlLauncherAbstract {
-
-    @Override
-    protected BrooklynCampPlatformLauncherAbstract newPlatformLauncher() {
-        return new BrooklynCampPlatformLauncherNoServer();
-    }
-
-    public static void main(String[] args) {
-        YamlLauncherNoServer l = new YamlLauncherNoServer();
-        l.setShutdownAppsOnExit(true);
-        
-        l.launchAppYaml("java-web-app-and-db-with-function.yaml");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
deleted file mode 100644
index 8540663..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
+++ /dev/null
@@ -1,43 +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.brooklyn.api;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.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 {
-    
-    /**
-     * Gets the single item returned by {@link #createServiceSpecs}
-     * and wraps it in an Application if needed, applying top-level
-     * attributes and locations to the root entity.
-     */
-    EntitySpec<? extends Application> createApplicationSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext loader, Set<String> encounteredCatalogTypes);
-    
-    /** Returns specs for each item in the services list */
-    List<EntitySpec<?>> createServiceSpecs(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes);
-
-}


[13/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
deleted file mode 100644
index b9662ef..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
+++ /dev/null
@@ -1,307 +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.core.feed;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.feed.http.HttpPollConfig;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.guava.Functionals;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-
-/**
- * Configuration for a poll, or a subscription etc, that is being added to a feed.
- * 
- * @author aled
- */
-public class FeedConfig<V, T, F extends FeedConfig<V, T, F>> {
-
-    /** The onSuccess or onError functions can return this value to indicate that the sensor should not change. 
-     * @deprecated since 0.7.0 use UNCHANGED */
-    public static final Object UNSET = Entities.UNCHANGED;
-    /** The onSuccess or onError functions can return this value to indicate that the sensor should not change. */ 
-    public static final Object UNCHANGED = Entities.UNCHANGED;
-    /** The onSuccess or onError functions can return this value to indicate that the sensor value should be removed
-     * (cf 'null', but useful in dynamic situations) */ 
-    public static final Object REMOVE = Entities.REMOVE;
-    
-    /** Indicates that no sensor is being used here. This sensor is suppressed,
-     * but is useful where you want to use the feeds with custom success/exception/failure functions
-     * which directly set multiple sensors, e.g. dynamically based on the poll response.
-     * <p>
-     * See {@link HttpPollConfig#forMultiple()} and its usages.
-     * (It can work for any poll config, but conveniences have not been supplied for others.)  */
-    public static final AttributeSensor<Void> NO_SENSOR = Sensors.newSensor(Void.class, "brooklyn.no.sensor");
-    
-    private final AttributeSensor<T> sensor;
-    private Function<? super V, T> onsuccess;
-    private Function<? super V, T> onfailure;
-    private Function<? super Exception, T> onexception;
-    private Predicate<? super V> checkSuccess;
-    private boolean suppressDuplicates;
-    private boolean enabled = true;
-    
-    public FeedConfig(AttributeSensor<T> sensor) {
-        this.sensor = checkNotNull(sensor, "sensor");
-    }
-
-    public FeedConfig(FeedConfig<V, T, F> other) {
-        this.sensor = other.sensor;
-        this.onsuccess = other.onsuccess;
-        this.onfailure = other.onfailure;
-        this.onexception = other.onexception;
-        this.checkSuccess = other.checkSuccess;
-        this.suppressDuplicates = other.suppressDuplicates;
-        this.enabled = other.enabled;
-    }
-
-    @SuppressWarnings("unchecked")
-    protected F self() {
-        return (F) this;
-    }
-    
-    public AttributeSensor<T> getSensor() {
-        return sensor;
-    }
-
-    public Predicate<? super V> getCheckSuccess() {
-        return checkSuccess;
-    }
-    
-    public Function<? super V, T> getOnSuccess() {
-        return onsuccess;
-    }
-
-    public Function<? super V, T> getOnFailure() {
-        return onfailure;
-    }
-    
-    public Function<? super Exception, T> getOnException() {
-        return onexception;
-    }
-
-    public boolean getSupressDuplicates() {
-        return suppressDuplicates;
-    }
-    
-    public boolean isEnabled() {
-        return enabled;
-    }
-    
-    /** sets the predicate used to check whether a feed run is successful */
-    public F checkSuccess(Predicate<? super V> val) {
-        this.checkSuccess = checkNotNull(val, "checkSuccess");
-        return self();
-    }
-    /** as {@link #checkSuccess(Predicate)} */
-    public F checkSuccess(final Function<? super V,Boolean> val) {
-        return checkSuccess(Functionals.predicate(val));
-    }
-
-    @SuppressWarnings("unused")
-    /** @deprecated since 0.7.0, kept for rebind */ @Deprecated
-    private F checkSuccessLegacy(final Function<? super V,Boolean> val) {
-        return checkSuccess(new Predicate<V>() {
-            @Override
-            public boolean apply(V input) {
-                return val.apply(input);
-            }
-        });
-    }
-
-    public F onSuccess(Function<? super V,T> val) {
-        this.onsuccess = checkNotNull(val, "onSuccess");
-        return self();
-    }
-
-    public F setOnSuccess(T val) {
-        return onSuccess(Functions.constant(val));
-    }
-
-    /**
-     * A failure is when the connection is fine (no exception) but the other end returns a result object V
-     * which the feed can tell indicates a failure (e.g. HTTP code 404)
-     */
-    public F onFailure(Function<? super V,T> val) {
-        this.onfailure = checkNotNull(val, "onFailure");
-        return self();
-    }
-
-    /** @see #onFailure(Function) */
-    public F setOnFailure(T val) {
-        return onFailure(Functions.constant(val));
-    }
-
-    /**
-     * Registers a callback to be used by {@link #onSuccess(Function)} and {@link #onFailure(Function)},
-     * i.e. whenever a result comes back, but not in case of exceptions being thrown (ie problems communicating)
-     */
-    public F onResult(Function<? super V, T> val) {
-        onSuccess(val);
-        return onFailure(val);
-    }
-
-    /** @see #onResult(Function) */
-    public F setOnResult(T val) {
-        return onResult(Functions.constant(val));
-    }
-
-    /**
-     * An exception is when there is an error in the communication
-     */
-    public F onException(Function<? super Exception,T> val) {
-        this.onexception = checkNotNull(val, "onException");
-        return self();
-    }
-
-    /** @see #onException(Function) */
-    public F setOnException(T val) {
-        return onException(Functions.constant(val));
-    }
-
-    /**
-     * A convenience for indicating a behaviour to occur for both {@link #onException(Function)}
-     * (error connecting) and {@link #onFailure(Function)} (successful communication but failure
-     * report from remote end)
-     */
-    public F onFailureOrException(Function<Object,T> val) {
-        onFailure(val);
-        return onException(val);
-    }
-
-    /** @see #onFailureOrException(Function) */
-    public F setOnFailureOrException(T val) {
-        return onFailureOrException(Functions.constant(val));
-    }
-
-    public F suppressDuplicates(boolean val) {
-        suppressDuplicates = val;
-        return self();
-    }
-
-    /**
-     * Whether this feed is enabled (defaulting to true).
-     */
-    public F enabled(boolean val) {
-        enabled = val;
-        return self();
-    }
-
-    public boolean hasSuccessHandler() {
-        return this.onsuccess != null;
-    }
-
-    public boolean hasFailureHandler() {
-        return this.onfailure != null;
-    }
-
-    public boolean hasExceptionHandler() {
-        return this.onexception != null;
-    }
-
-    public boolean hasCheckSuccessHandler() {
-        return this.checkSuccess != null;
-    }
-    
-    @Override
-    public String toString() {
-        StringBuilder result = new StringBuilder();
-        result.append(toStringBaseName());
-        result.append("[");
-        boolean contents = false;
-        Object source = toStringPollSource();
-        AttributeSensor<T> s = getSensor();
-        if (Strings.isNonBlank(Strings.toString(source))) {
-            result.append(Strings.toUniqueString(source, 40));
-            if (s!=null) {
-                result.append("->");
-                result.append(s.getName());
-            }
-            contents = true;
-        } else if (s!=null) {
-            result.append(s.getName());
-            contents = true;
-        }
-        MutableList<Object> fields = toStringOtherFields();
-        if (fields!=null) {
-            for (Object field: fields) {
-                if (Strings.isNonBlank(Strings.toString(field))) {
-                    if (contents) result.append(";");
-                    contents = true;
-                    result.append(field);
-                }
-            }
-        }
-        result.append("]");
-        return result.toString();
-    }
-
-    /** can be overridden to supply a simpler base name than the class name */
-    protected String toStringBaseName() {
-        return JavaClassNames.simpleClassName(this);
-    }
-    /** can be overridden to supply add'l info for the {@link #toString()}; subclasses can add to the returned value */
-    protected MutableList<Object> toStringOtherFields() {
-        return MutableList.<Object>of();
-    }
-    /** can be overridden to supply add'l info for the {@link #toString()}, placed before the sensor with -> */
-    protected Object toStringPollSource() {
-        return null;
-    }
-    /** all configs should supply a unique tag element, inserted into the feed */
-    protected String getUniqueTag() {
-        return toString();
-    }
-
-    /** returns fields which should be used for equality, including by default {@link #toStringOtherFields()} and {@link #toStringPollSource()};
-     * subclasses can add to the returned value */
-    protected MutableList<Object> equalsFields() {
-        MutableList<Object> result = MutableList.of().appendIfNotNull(getSensor()).appendIfNotNull(toStringPollSource());
-        for (Object field: toStringOtherFields()) result.appendIfNotNull(field);
-        return result;
-    }
-
-    @Override
-    public int hashCode() { 
-        int hc = super.hashCode();
-        for (Object f: equalsFields())
-            hc = Objects.hashCode(hc, f);
-        return hc;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (!super.equals(obj)) return false;
-        PollConfig<?,?,?> other = (PollConfig<?,?,?>) obj;
-        if (!Objects.equal(getUniqueTag(), other.getUniqueTag())) return false;
-        if (!Objects.equal(equalsFields(), other.equalsFields())) return false;
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollConfig.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollConfig.java
deleted file mode 100644
index 133431b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollConfig.java
+++ /dev/null
@@ -1,85 +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.core.feed;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.time.Duration;
-
-/**
- * Configuration for polling, which is being added to a feed (e.g. to poll a given URL over http).
- * 
- * @author aled
- */
-public class PollConfig<V, T, F extends PollConfig<V, T, F>> extends FeedConfig<V, T, F> {
-
-    private long period = -1;
-    private String description;
-
-    public PollConfig(AttributeSensor<T> sensor) {
-        super(sensor);
-    }
-
-    public PollConfig(PollConfig<V,T,F> other) {
-        super(other);
-        this.period = other.period;
-    }
-
-    public long getPeriod() {
-        return period;
-    }
-    
-    public F period(Duration val) {
-        checkArgument(val.toMilliseconds() >= 0, "period must be greater than or equal to zero");
-        this.period = val.toMilliseconds();
-        return self();
-    }
-    
-    public F period(long val) {
-        checkArgument(val >= 0, "period must be greater than or equal to zero");
-        this.period = val; return self();
-    }
-    
-    public F period(long val, TimeUnit units) {
-        checkArgument(val >= 0, "period must be greater than or equal to zero");
-        return period(units.toMillis(val));
-    }
-    
-    public F description(String description) {
-        this.description = description;
-        return self();
-    }
-    
-    public String getDescription() {
-        return description;
-    }
-    
-    @Override protected MutableList<Object> toStringOtherFields() {
-        return super.toStringOtherFields().appendIfNotNull(description);
-    }
-
-    @Override
-    protected MutableList<Object> equalsFields() {
-        return super.equalsFields().appendIfNotNull(period);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollHandler.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollHandler.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollHandler.java
deleted file mode 100644
index a63ebde..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/PollHandler.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 org.apache.brooklyn.core.feed;
-
-/**
- * Notified by the Poller of the result for each job, on each poll.
- * 
- * @author aled
- */
-public interface PollHandler<V> {
-
-    public boolean checkSuccess(V val);
-
-    public void onSuccess(V val);
-
-    public void onFailure(V val);
-
-    public void onException(Exception exception);
-
-    public String getDescription();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/Poller.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/Poller.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/Poller.java
deleted file mode 100644
index a9a34d9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/Poller.java
+++ /dev/null
@@ -1,210 +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.core.feed;
-
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.DynamicSequentialTask;
-import org.apache.brooklyn.util.core.task.ScheduledTask;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-
-
-/** 
- * For executing periodic polls.
- * Jobs are added to the schedule, and then the poller is started.
- * The jobs will then be executed periodically, and the handler called for the result/failure.
- * 
- * Assumes the schedule+start will be done single threaded, and that stop will not be done concurrently.
- */
-public class Poller<V> {
-    public static final Logger log = LoggerFactory.getLogger(Poller.class);
-
-    private final EntityLocal entity;
-    private final boolean onlyIfServiceUp;
-    private final Set<Callable<?>> oneOffJobs = new LinkedHashSet<Callable<?>>();
-    private final Set<PollJob<V>> pollJobs = new LinkedHashSet<PollJob<V>>();
-    private final Set<Task<?>> oneOffTasks = new LinkedHashSet<Task<?>>();
-    private final Set<ScheduledTask> tasks = new LinkedHashSet<ScheduledTask>();
-    private volatile boolean started = false;
-    
-    private static class PollJob<V> {
-        final PollHandler<? super V> handler;
-        final Duration pollPeriod;
-        final Runnable wrappedJob;
-        private boolean loggedPreviousException = false;
-        
-        PollJob(final Callable<V> job, final PollHandler<? super V> handler, Duration period) {
-            this.handler = handler;
-            this.pollPeriod = period;
-            
-            wrappedJob = new Runnable() {
-                public void run() {
-                    try {
-                        V val = job.call();
-                        loggedPreviousException = false;
-                        if (handler.checkSuccess(val)) {
-                            handler.onSuccess(val);
-                        } else {
-                            handler.onFailure(val);
-                        }
-                    } catch (Exception e) {
-                        if (loggedPreviousException) {
-                            if (log.isTraceEnabled()) log.trace("PollJob for {}, repeated consecutive failures, handling {} using {}", new Object[] {job, e, handler});
-                        } else {
-                            if (log.isDebugEnabled()) log.debug("PollJob for {} handling {} using {}", new Object[] {job, e, handler});
-                            loggedPreviousException = true;
-                        }
-                        handler.onException(e);
-                    }
-                }
-            };
-        }
-    }
-    
-    /** @deprecated since 0.7.0, pass in whether should run onlyIfServiceUp */
-    @Deprecated
-    public Poller(EntityLocal entity) {
-        this(entity, false);
-    }
-    public Poller(EntityLocal entity, boolean onlyIfServiceUp) {
-        this.entity = entity;
-        this.onlyIfServiceUp = onlyIfServiceUp;
-    }
-    
-    /** Submits a one-off poll job; recommended that callers supply to-String so that task has a decent description */
-    public void submit(Callable<?> job) {
-        if (started) {
-            throw new IllegalStateException("Cannot submit additional tasks after poller has started");
-        }
-        oneOffJobs.add(job);
-    }
-
-    public void scheduleAtFixedRate(Callable<V> job, PollHandler<? super V> handler, long period) {
-        scheduleAtFixedRate(job, handler, Duration.millis(period));
-    }
-    public void scheduleAtFixedRate(Callable<V> job, PollHandler<? super V> handler, Duration period) {
-        if (started) {
-            throw new IllegalStateException("Cannot schedule additional tasks after poller has started");
-        }
-        PollJob<V> foo = new PollJob<V>(job, handler, period);
-        pollJobs.add(foo);
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    public void start() {
-        // TODO Previous incarnation of this logged this logged polledSensors.keySet(), but we don't know that anymore
-        // Is that ok, are can we do better?
-        
-        if (log.isDebugEnabled()) log.debug("Starting poll for {} (using {})", new Object[] {entity, this});
-        if (started) { 
-            throw new IllegalStateException(String.format("Attempt to start poller %s of entity %s when already running", 
-                    this, entity));
-        }
-        
-        started = true;
-        
-        for (final Callable<?> oneOffJob : oneOffJobs) {
-            Task<?> task = Tasks.builder().dynamic(false).body((Callable<Object>) oneOffJob).displayName("Poll").description("One-time poll job "+oneOffJob).build();
-            oneOffTasks.add(((EntityInternal)entity).getExecutionContext().submit(task));
-        }
-        
-        for (final PollJob<V> pollJob : pollJobs) {
-            final String scheduleName = pollJob.handler.getDescription();
-            if (pollJob.pollPeriod.compareTo(Duration.ZERO) > 0) {
-                Callable<Task<?>> pollingTaskFactory = new Callable<Task<?>>() {
-                    public Task<?> call() {
-                        DynamicSequentialTask<Void> task = new DynamicSequentialTask<Void>(MutableMap.of("displayName", scheduleName, "entity", entity), 
-                            new Callable<Void>() { public Void call() {
-                                if (onlyIfServiceUp && !Boolean.TRUE.equals(entity.getAttribute(Attributes.SERVICE_UP))) {
-                                        return null;
-                                }
-                                pollJob.wrappedJob.run();
-                                return null; 
-                            } } );
-                        BrooklynTaskTags.setTransient(task);
-                        return task;
-                    }
-                };
-                Map<String, ?> taskFlags = MutableMap.of("displayName", "scheduled:" + scheduleName);
-                ScheduledTask task = new ScheduledTask(taskFlags, pollingTaskFactory)
-                        .period(pollJob.pollPeriod)
-                        .cancelOnException(false);
-                tasks.add(Entities.submit(entity, task));
-            } else {
-                if (log.isDebugEnabled()) log.debug("Activating poll (but leaving off, as period {}) for {} (using {})", new Object[] {pollJob.pollPeriod, entity, this});
-            }
-        }
-    }
-    
-    public void stop() {
-        if (log.isDebugEnabled()) log.debug("Stopping poll for {} (using {})", new Object[] {entity, this});
-        if (!started) { 
-            throw new IllegalStateException(String.format("Attempt to stop poller %s of entity %s when not running", 
-                    this, entity));
-        }
-        
-        started = false;
-        for (Task<?> task : oneOffTasks) {
-            if (task != null) task.cancel(true);
-        }
-        for (ScheduledTask task : tasks) {
-            if (task != null) task.cancel();
-        }
-        oneOffTasks.clear();
-        tasks.clear();
-    }
-
-    public boolean isRunning() {
-        boolean hasActiveTasks = false;
-        for (Task<?> task: tasks) {
-            if (task.isBegun() && !task.isDone()) {
-                hasActiveTasks = true;
-                break;
-            }
-        }
-        if (!started && hasActiveTasks) {
-            log.warn("Poller should not be running, but has active tasks, tasks: "+tasks);
-        }
-        return started && hasActiveTasks;
-    }
-    
-    protected boolean isEmpty() {
-        return pollJobs.isEmpty();
-    }
-    
-    public String toString() {
-        return Objects.toStringHelper(this).add("entity", entity).toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/ApiObjectsFactoryImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/ApiObjectsFactoryImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/ApiObjectsFactoryImpl.java
deleted file mode 100644
index 6957ebe..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/ApiObjectsFactoryImpl.java
+++ /dev/null
@@ -1,41 +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.core.internal;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.internal.ApiObjectsFactoryInterface;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.util.core.task.Tasks;
-
-public class ApiObjectsFactoryImpl implements ApiObjectsFactoryInterface {
-
-    @Override
-    public String getCatalogItemIdFromContext() {
-        Task<?> currentTask = Tasks.current();
-        if (currentTask != null) {
-            Entity contextEntity = BrooklynTaskTags.getContextEntity(currentTask);
-            if (contextEntity != null) {
-                return contextEntity.getCatalogItemId();
-            }
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
deleted file mode 100644
index 6dc825d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
+++ /dev/null
@@ -1,81 +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.core.internal;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.util.core.crypto.SecureKeys;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.net.Networking;
-
-import com.google.common.annotations.Beta;
-
-/** Various static initialization tasks are routed through this class,
- * to give us better traceability of their invocation. */ 
-@Beta
-public class BrooklynInitialization {
-
-    private static AtomicBoolean done = new AtomicBoolean(false);
-    
-    public static void initTypeCoercionStandardAdapters() {
-        TypeCoercions.initStandardAdapters();
-    }
-
-    public static void initSecureKeysBouncyCastleProvider() {
-        SecureKeys.initBouncyCastleProvider();
-    }
-
-    public static void initNetworking() {
-        Networking.init();
-    }
-    
-    public static void initPortRanges() {
-        PortRanges.init();
-    }
-
-    @SuppressWarnings("deprecation")
-    public static void initLegacyLanguageExtensions() {
-        org.apache.brooklyn.util.core.BrooklynLanguageExtensions.init();
-    }
-
-    /* other things:
-     * 
-     * RendererHints - done by the entity classes which need them, including Sensors
-     * 
-     */
-    
-    public synchronized static void initAll() {
-        if (done.get()) return;
-        initTypeCoercionStandardAdapters();
-        initSecureKeysBouncyCastleProvider();
-        initNetworking();
-        initPortRanges();
-        initLegacyLanguageExtensions();
-        done.set(true);
-    }
-
-    @SuppressWarnings("deprecation")
-    public synchronized static void reinitAll() {
-        done.set(false);
-        org.apache.brooklyn.util.core.BrooklynLanguageExtensions.reinit();
-        initAll();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynProperties.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynProperties.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynProperties.java
deleted file mode 100644
index 75b7b34..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynProperties.java
+++ /dev/null
@@ -1,305 +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.core.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.os.Os;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-
-/** 
- * Utils for accessing command-line and system-env properties;
- * doesn't resolve anything (unless an execution context is supplied)
- * and treats ConfigKeys as of type object when in doubt,
- * or string when that is likely wanted (e.g. {@link #getFirst(Map, String...)}
- * <p>
- * Intention for normal use is that they are set during startup and not modified 
- * thereafter.
- */
-@SuppressWarnings("rawtypes")
-public interface BrooklynProperties extends Map, StringConfigMap {
-
-    public static class Factory {
-        private static final Logger LOG = LoggerFactory.getLogger(BrooklynProperties.Factory.class);
-        
-        /** creates a new empty {@link BrooklynProperties} */
-        public static BrooklynProperties newEmpty() {
-            return new BrooklynPropertiesImpl();
-        }
-
-        /** creates a new {@link BrooklynProperties} with contents loaded 
-         * from the usual places, including *.properties files and environment variables */
-        public static BrooklynProperties newDefault() {
-            return new Builder(true).build();
-        }
-
-        public static Builder builderDefault() {
-            return new Builder(true);
-        }
-
-        public static Builder builderEmpty() {
-            return new Builder(false);
-        }
-
-        public static class Builder {
-            private String defaultLocationMetadataUrl;
-            private String globalLocationMetadataFile = null;
-            private String globalPropertiesFile = null;
-            private String localPropertiesFile = null;
-            private BrooklynProperties originalProperties = null;
-            
-            /** @deprecated since 0.7.0 use static methods in {@link Factory} to create */
-            public Builder() {
-                this(true);
-            }
-            
-            private Builder(boolean setGlobalFileDefaults) {
-                resetDefaultLocationMetadataUrl();
-                if (setGlobalFileDefaults) {
-                    resetGlobalFiles();
-                }
-            }
-            
-            public Builder resetDefaultLocationMetadataUrl() {
-                defaultLocationMetadataUrl = "classpath://brooklyn/location-metadata.properties";
-                return this;
-            }
-            public Builder resetGlobalFiles() {
-                defaultLocationMetadataUrl = "classpath://brooklyn/location-metadata.properties";
-                globalLocationMetadataFile = Os.mergePaths(Os.home(), ".brooklyn", "location-metadata.properties");
-                globalPropertiesFile = Os.mergePaths(Os.home(), ".brooklyn", "brooklyn.properties");
-                return this;
-            }
-            
-            /**
-             * Creates a Builder that when built, will return the BrooklynProperties passed to this constructor
-             */
-            private Builder(BrooklynProperties originalProperties) {
-                this.originalProperties = new BrooklynPropertiesImpl().addFromMap(originalProperties);
-            }
-            
-            /**
-             * The URL of a default location-metadata.properties (for meta-data about different locations, such as iso3166 and global lat/lon). 
-             * Defaults to classpath://brooklyn/location-metadata.properties
-             */
-            public Builder defaultLocationMetadataUrl(String val) {
-                defaultLocationMetadataUrl = checkNotNull(val, "file");
-                return this;
-            }
-            
-            /**
-             * The URL of a location-metadata.properties file that appends to and overwrites values in the locationMetadataUrl. 
-             * Defaults to ~/.brooklyn/location-metadata.properties
-             */
-            public Builder globalLocationMetadataFile(String val) {
-                globalLocationMetadataFile = checkNotNull(val, "file");
-                return this;
-            }
-            
-            /**
-             * The URL of a shared brooklyn.properties file. Defaults to ~/.brooklyn/brooklyn.properties.
-             * Can be null to disable.
-             */
-            public Builder globalPropertiesFile(String val) {
-                globalPropertiesFile = val;
-                return this;
-            }
-            
-            @Beta
-            public boolean hasDelegateOriginalProperties() {
-                return this.originalProperties==null;
-            }
-            
-            /**
-             * The URL of a brooklyn.properties file specific to this launch. Appends to and overwrites values in globalPropertiesFile.
-             */
-            public Builder localPropertiesFile(String val) {
-                localPropertiesFile = val;
-                return this;
-            }
-            
-            public BrooklynProperties build() {
-                if (originalProperties != null) 
-                    return new BrooklynPropertiesImpl().addFromMap(originalProperties);
-                
-                BrooklynProperties properties = new BrooklynPropertiesImpl();
-
-                // TODO Could also read from http://brooklyn.io, for up-to-date values?
-                // But might that make unit tests run very badly when developer is offline?
-                addPropertiesFromUrl(properties, defaultLocationMetadataUrl, false);
-                
-                addPropertiesFromFile(properties, globalLocationMetadataFile);
-                addPropertiesFromFile(properties, globalPropertiesFile);
-                addPropertiesFromFile(properties, localPropertiesFile);
-                
-                properties.addEnvironmentVars();
-                properties.addSystemProperties();
-
-                return properties;
-            }
-
-            public static Builder fromProperties(BrooklynProperties brooklynProperties) {
-                return new Builder(brooklynProperties);
-            }
-
-            @Override
-            public String toString() {
-                return Objects.toStringHelper(this)
-                        .omitNullValues()
-                        .add("originalProperties", originalProperties)
-                        .add("defaultLocationMetadataUrl", defaultLocationMetadataUrl)
-                        .add("globalLocationMetadataUrl", globalLocationMetadataFile)
-                        .add("globalPropertiesFile", globalPropertiesFile)
-                        .add("localPropertiesFile", localPropertiesFile)
-                        .toString();
-            }
-        }
-        
-        private static void addPropertiesFromUrl(BrooklynProperties p, String url, boolean warnIfNotFound) {
-            if (url==null) return;
-            
-            try {
-                p.addFrom(ResourceUtils.create(BrooklynProperties.class).getResourceFromUrl(url));
-            } catch (Exception e) {
-                if (warnIfNotFound)
-                    LOG.warn("Could not load {}; continuing", url);
-                if (LOG.isTraceEnabled()) LOG.trace("Could not load "+url+"; continuing", e);
-            }
-        }
-        
-        private static void addPropertiesFromFile(BrooklynProperties p, String file) {
-            if (file==null) return;
-            
-            String fileTidied = Os.tidyPath(file);
-            File f = new File(fileTidied);
-
-            if (f.exists()) {
-                p.addFrom(f);
-            }
-        }
-    }
-
-    public BrooklynProperties addEnvironmentVars();
-
-    public BrooklynProperties addSystemProperties();
-
-    public BrooklynProperties addFrom(ConfigBag cfg);
-
-    public BrooklynProperties addFrom(Map map);
-
-    public BrooklynProperties addFrom(InputStream i);
-    
-    public BrooklynProperties addFrom(File f);
-
-    public BrooklynProperties addFrom(URL u);
-
-    /**
-     * @see ResourceUtils#getResourceFromUrl(String)
-     *
-     * of the form form file:///home/... or http:// or classpath://xx ;
-     * for convenience if not starting with xxx: it is treated as a classpath reference or a file;
-     * throws if not found (but does nothing if argument is null)
-     */
-    public BrooklynProperties addFromUrl(String url);
-
-    /** expects a property already set in scope, whose value is acceptable to {@link #addFromUrl(String)};
-     * if property not set, does nothing */
-    public BrooklynProperties addFromUrlProperty(String urlProperty);
-
-    /**
-    * adds the indicated properties
-    */
-    public BrooklynProperties addFromMap(Map properties);
-
-    /** inserts the value under the given key, if it was not present */
-    public boolean putIfAbsent(String key, Object value);
-
-   /** @deprecated attempts to call get with this syntax are probably mistakes; get(key, defaultValue) is fine but
-    * Map is unlikely the key, much more likely they meant getFirst(flags, key).
-    */
-   @Deprecated
-   public String get(Map flags, String key);
-
-    /** returns the value of the first key which is defined
-     * <p>
-     * takes the following flags:
-     * 'warnIfNone', 'failIfNone' (both taking a boolean (to use default message) or a string (which is the message));
-     * and 'defaultIfNone' (a default value to return if there is no such property); defaults to no warning and null response */
-    @Override
-    public String getFirst(String ...keys);
-
-    @Override
-    public String getFirst(Map flags, String ...keys);
-
-    /** like normal map.put, except config keys are dereferenced on the way in */
-    public Object put(Object key, Object value);
-
-    /** like normal map.putAll, except config keys are dereferenced on the way in */
-    @Override
-    public void putAll(Map vals);
-    
-    public <T> Object put(HasConfigKey<T> key, T value);
-
-    public <T> Object put(ConfigKey<T> key, T value);
-    
-    public <T> boolean putIfAbsent(ConfigKey<T> key, T value);
-    
-    @Override
-    public <T> T getConfig(ConfigKey<T> key);
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key);
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key, T defaultValue);
-
-    @Override
-    public <T> T getConfig(ConfigKey<T> key, T defaultValue);
-
-    @Override
-    public Object getRawConfig(ConfigKey<?> key);
-    
-    @Override
-    public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited);
-
-    @Override
-    public Map<ConfigKey<?>, Object> getAllConfig();
-
-    @Override
-    public BrooklynProperties submap(Predicate<ConfigKey<?>> filter);
-
-    @Override
-    public Map<String, Object> asMapWithStringKeys();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynPropertiesImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynPropertiesImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynPropertiesImpl.java
deleted file mode 100644
index 023b3e3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynPropertiesImpl.java
+++ /dev/null
@@ -1,477 +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.core.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import groovy.lang.Closure;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Properties;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.text.StringFunctions;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-
-/**
- * TODO methods in this class are not thread safe.
- * intention is that they are set during startup and not modified thereafter.
- */
-@SuppressWarnings("rawtypes")
-public class BrooklynPropertiesImpl extends LinkedHashMap implements BrooklynProperties {
-
-    private static final long serialVersionUID = -945875483083108978L;
-    private static final Logger LOG = LoggerFactory.getLogger(BrooklynPropertiesImpl.class);
-
-    public static class Factory {
-        /** creates a new empty {@link BrooklynPropertiesImpl} */
-        public static BrooklynPropertiesImpl newEmpty() {
-            return new BrooklynPropertiesImpl();
-        }
-
-        /** creates a new {@link BrooklynPropertiesImpl} with contents loaded 
-         * from the usual places, including *.properties files and environment variables */
-        public static BrooklynPropertiesImpl newDefault() {
-            return new Builder(true).build();
-        }
-
-        public static Builder builderDefault() {
-            return new Builder(true);
-        }
-
-        public static Builder builderEmpty() {
-            return new Builder(false);
-        }
-
-        public static class Builder {
-            private String defaultLocationMetadataUrl;
-            private String globalLocationMetadataFile = null;
-            private String globalPropertiesFile = null;
-            private String localPropertiesFile = null;
-            private BrooklynPropertiesImpl originalProperties = null;
-            
-            /** @deprecated since 0.7.0 use static methods in {@link Factory} to create */
-            public Builder() {
-                this(true);
-            }
-            
-            private Builder(boolean setGlobalFileDefaults) {
-                resetDefaultLocationMetadataUrl();
-                if (setGlobalFileDefaults) {
-                    resetGlobalFiles();
-                }
-            }
-            
-            public Builder resetDefaultLocationMetadataUrl() {
-                defaultLocationMetadataUrl = "classpath://brooklyn/location-metadata.properties";
-                return this;
-            }
-            public Builder resetGlobalFiles() {
-                defaultLocationMetadataUrl = "classpath://brooklyn/location-metadata.properties";
-                globalLocationMetadataFile = Os.mergePaths(Os.home(), ".brooklyn", "location-metadata.properties");
-                globalPropertiesFile = Os.mergePaths(Os.home(), ".brooklyn", "brooklyn.properties");
-                return this;
-            }
-            
-            /**
-             * Creates a Builder that when built, will return the BrooklynProperties passed to this constructor
-             */
-            private Builder(BrooklynPropertiesImpl originalProperties) {
-                this.originalProperties = new BrooklynPropertiesImpl().addFromMap(originalProperties);
-            }
-            
-            /**
-             * The URL of a default location-metadata.properties (for meta-data about different locations, such as iso3166 and global lat/lon). 
-             * Defaults to classpath://brooklyn/location-metadata.properties
-             */
-            public Builder defaultLocationMetadataUrl(String val) {
-                defaultLocationMetadataUrl = checkNotNull(val, "file");
-                return this;
-            }
-            
-            /**
-             * The URL of a location-metadata.properties file that appends to and overwrites values in the locationMetadataUrl. 
-             * Defaults to ~/.brooklyn/location-metadata.properties
-             */
-            public Builder globalLocationMetadataFile(String val) {
-                globalLocationMetadataFile = checkNotNull(val, "file");
-                return this;
-            }
-            
-            /**
-             * The URL of a shared brooklyn.properties file. Defaults to ~/.brooklyn/brooklyn.properties.
-             * Can be null to disable.
-             */
-            public Builder globalPropertiesFile(String val) {
-                globalPropertiesFile = val;
-                return this;
-            }
-            
-            @Beta
-            public boolean hasDelegateOriginalProperties() {
-                return this.originalProperties==null;
-            }
-            
-            /**
-             * The URL of a brooklyn.properties file specific to this launch. Appends to and overwrites values in globalPropertiesFile.
-             */
-            public Builder localPropertiesFile(String val) {
-                localPropertiesFile = val;
-                return this;
-            }
-            
-            public BrooklynPropertiesImpl build() {
-                if (originalProperties != null) 
-                    return new BrooklynPropertiesImpl().addFromMap(originalProperties);
-                
-                BrooklynPropertiesImpl properties = new BrooklynPropertiesImpl();
-
-                // TODO Could also read from http://brooklyn.io, for up-to-date values?
-                // But might that make unit tests run very badly when developer is offline?
-                addPropertiesFromUrl(properties, defaultLocationMetadataUrl, false);
-                
-                addPropertiesFromFile(properties, globalLocationMetadataFile);
-                addPropertiesFromFile(properties, globalPropertiesFile);
-                addPropertiesFromFile(properties, localPropertiesFile);
-                
-                properties.addEnvironmentVars();
-                properties.addSystemProperties();
-
-                return properties;
-            }
-
-            public static Builder fromProperties(BrooklynPropertiesImpl brooklynProperties) {
-                return new Builder(brooklynProperties);
-            }
-
-            @Override
-            public String toString() {
-                return Objects.toStringHelper(this)
-                        .omitNullValues()
-                        .add("originalProperties", originalProperties)
-                        .add("defaultLocationMetadataUrl", defaultLocationMetadataUrl)
-                        .add("globalLocationMetadataUrl", globalLocationMetadataFile)
-                        .add("globalPropertiesFile", globalPropertiesFile)
-                        .add("localPropertiesFile", localPropertiesFile)
-                        .toString();
-            }
-        }
-        
-        private static void addPropertiesFromUrl(BrooklynPropertiesImpl p, String url, boolean warnIfNotFound) {
-            if (url==null) return;
-            
-            try {
-                p.addFrom(ResourceUtils.create(BrooklynPropertiesImpl.class).getResourceFromUrl(url));
-            } catch (Exception e) {
-                if (warnIfNotFound)
-                    LOG.warn("Could not load {}; continuing", url);
-                if (LOG.isTraceEnabled()) LOG.trace("Could not load "+url+"; continuing", e);
-            }
-        }
-        
-        private static void addPropertiesFromFile(BrooklynPropertiesImpl p, String file) {
-            if (file==null) return;
-            
-            String fileTidied = Os.tidyPath(file);
-            File f = new File(fileTidied);
-
-            if (f.exists()) {
-                p.addFrom(f);
-            }
-        }
-    }
-
-    protected BrooklynPropertiesImpl() {
-    }
-
-    public BrooklynPropertiesImpl addEnvironmentVars() {
-        addFrom(System.getenv());
-        return this;
-    }
-
-    public BrooklynPropertiesImpl addSystemProperties() {
-        addFrom(System.getProperties());
-        return this;
-    }
-
-    public BrooklynPropertiesImpl addFrom(ConfigBag cfg) {
-        addFrom(cfg.getAllConfig());
-        return this;
-    }
-
-    @SuppressWarnings("unchecked")
-    public BrooklynPropertiesImpl addFrom(Map map) {
-        putAll(Maps.transformValues(map, StringFunctions.trim()));
-        return this;
-    }
-
-    public BrooklynPropertiesImpl addFrom(InputStream i) {
-        // Ugly way to load them in order, but Properties is a Hashtable so loses order otherwise.
-        @SuppressWarnings({ "serial" })
-        Properties p = new Properties() {
-            @Override
-            public synchronized Object put(Object key, Object value) {
-                // Trim the string values to remove leading and trailing spaces
-                String s = (String) value;
-                if (Strings.isBlank(s)) {
-                    s = Strings.EMPTY;
-                } else {
-                    s = CharMatcher.BREAKING_WHITESPACE.trimFrom(s);
-                }
-                return BrooklynPropertiesImpl.this.put(key, s);
-            }
-        };
-        try {
-            p.load(i);
-        } catch (IOException e) {
-            throw Throwables.propagate(e);
-        }
-        return this;
-    }
-    
-    public BrooklynPropertiesImpl addFrom(File f) {
-        if (!f.exists()) {
-            LOG.warn("Unable to find file '"+f.getAbsolutePath()+"' when loading properties; ignoring");
-            return this;
-        } else {
-            try {
-                return addFrom(new FileInputStream(f));
-            } catch (FileNotFoundException e) {
-                throw Throwables.propagate(e);
-            }
-        }
-    }
-    public BrooklynPropertiesImpl addFrom(URL u) {
-        try {
-            return addFrom(u.openStream());
-        } catch (IOException e) {
-            throw new RuntimeException("Error reading properties from "+u+": "+e, e);
-        }
-    }
-    /**
-     * @see ResourceUtils#getResourceFromUrl(String)
-     *
-     * of the form form file:///home/... or http:// or classpath://xx ;
-     * for convenience if not starting with xxx: it is treated as a classpath reference or a file;
-     * throws if not found (but does nothing if argument is null)
-     */
-    public BrooklynPropertiesImpl addFromUrl(String url) {
-        try {
-            if (url==null) return this;
-            return addFrom(ResourceUtils.create(this).getResourceFromUrl(url));
-        } catch (Exception e) {
-            throw new RuntimeException("Error reading properties from "+url+": "+e, e);
-        }
-    }
-
-    /** expects a property already set in scope, whose value is acceptable to {@link #addFromUrl(String)};
-     * if property not set, does nothing */
-    public BrooklynPropertiesImpl addFromUrlProperty(String urlProperty) {
-        String url = (String) get(urlProperty);
-        if (url==null) addFromUrl(url);
-        return this;
-    }
-
-    /**
-    * adds the indicated properties
-    */
-    public BrooklynPropertiesImpl addFromMap(Map properties) {
-        putAll(properties);
-        return this;
-    }
-
-    /** inserts the value under the given key, if it was not present */
-    public boolean putIfAbsent(String key, Object value) {
-        if (containsKey(key)) return false;
-        put(key, value);
-        return true;
-    }
-
-   /** @deprecated attempts to call get with this syntax are probably mistakes; get(key, defaultValue) is fine but
-    * Map is unlikely the key, much more likely they meant getFirst(flags, key).
-    */
-   @Deprecated
-   public String get(Map flags, String key) {
-       LOG.warn("Discouraged use of 'BrooklynProperties.get(Map,String)' (ambiguous); use getFirst(Map,String) or get(String) -- assuming the former");
-       LOG.debug("Trace for discouraged use of 'BrooklynProperties.get(Map,String)'",
-           new Throwable("Arguments: "+flags+" "+key));
-       return getFirst(flags, key);
-   }
-
-    /** returns the value of the first key which is defined
-     * <p>
-     * takes the following flags:
-     * 'warnIfNone', 'failIfNone' (both taking a boolean (to use default message) or a string (which is the message));
-     * and 'defaultIfNone' (a default value to return if there is no such property); defaults to no warning and null response */
-    @Override
-    public String getFirst(String ...keys) {
-       return getFirst(MutableMap.of(), keys);
-    }
-    @Override
-    public String getFirst(Map flags, String ...keys) {
-        for (String k: keys) {
-            if (k!=null && containsKey(k)) return (String) get(k);
-        }
-        if (flags.get("warnIfNone")!=null && !Boolean.FALSE.equals(flags.get("warnIfNone"))) {
-            if (Boolean.TRUE.equals(flags.get("warnIfNone")))
-                LOG.warn("Unable to find Brooklyn property "+keys);
-            else
-                LOG.warn(""+flags.get("warnIfNone"));
-        }
-        if (flags.get("failIfNone")!=null && !Boolean.FALSE.equals(flags.get("failIfNone"))) {
-            Object f = flags.get("failIfNone");
-            if (f instanceof Closure)
-                ((Closure)f).call((Object[])keys);
-            if (Boolean.TRUE.equals(f))
-                throw new NoSuchElementException("Brooklyn unable to find mandatory property "+keys[0]+
-                    (keys.length>1 ? " (or "+(keys.length-1)+" other possible names, full list is "+Arrays.asList(keys)+")" : "") );
-            else
-                throw new NoSuchElementException(""+f);
-        }
-        if (flags.get("defaultIfNone")!=null) {
-            return (String) flags.get("defaultIfNone");
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "BrooklynProperties["+size()+"]";
-    }
-
-    /** like normal map.put, except config keys are dereferenced on the way in */
-    @SuppressWarnings("unchecked")
-    public Object put(Object key, Object value) {
-        if (key instanceof HasConfigKey) key = ((HasConfigKey)key).getConfigKey().getName();
-        if (key instanceof ConfigKey) key = ((ConfigKey)key).getName();
-        return super.put(key, value);
-    }
-
-    /** like normal map.putAll, except config keys are dereferenced on the way in */
-    @Override
-    public void putAll(Map vals) {
-        for (Map.Entry<?,?> entry : ((Map<?,?>)vals).entrySet()) {
-            put(entry.getKey(), entry.getValue());
-        }
-    }
-    
-    @SuppressWarnings("unchecked")
-    public <T> Object put(HasConfigKey<T> key, T value) {
-        return super.put(key.getConfigKey().getName(), value);
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T> Object put(ConfigKey<T> key, T value) {
-        return super.put(key.getName(), value);
-    }
-    
-    public <T> boolean putIfAbsent(ConfigKey<T> key, T value) {
-        return putIfAbsent(key.getName(), value);
-    }
-    
-    @Override
-    public <T> T getConfig(ConfigKey<T> key) {
-        return getConfig(key, null);
-    }
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key) {
-        return getConfig(key.getConfigKey(), null);
-    }
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key, T defaultValue) {
-        return getConfig(key.getConfigKey(), defaultValue);
-    }
-
-    @Override
-    public <T> T getConfig(ConfigKey<T> key, T defaultValue) {
-        // TODO does not support MapConfigKey etc where entries use subkey notation; for now, access using submap
-        if (!containsKey(key.getName())) {
-            if (defaultValue!=null) return defaultValue;
-            return key.getDefaultValue();
-        }
-        Object value = get(key.getName());
-        if (value==null) return null;
-        // no evaluation / key extraction here
-        return TypeCoercions.coerce(value, key.getTypeToken());
-    }
-
-    @Override
-    public Object getRawConfig(ConfigKey<?> key) {
-        return get(key.getName());
-    }
-    
-    @Override
-    public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited) {
-        if (containsKey(key.getName())) return Maybe.of(get(key.getName()));
-        return Maybe.absent();
-    }
-
-    @Override
-    public Map<ConfigKey<?>, Object> getAllConfig() {
-        Map<ConfigKey<?>, Object> result = new LinkedHashMap<ConfigKey<?>, Object>();
-        for (Object entry: entrySet())
-            result.put(new BasicConfigKey<Object>(Object.class, ""+((Map.Entry)entry).getKey()), ((Map.Entry)entry).getValue());
-        return result;
-    }
-
-    @Override
-    public BrooklynPropertiesImpl submap(Predicate<ConfigKey<?>> filter) {
-        BrooklynPropertiesImpl result = Factory.newEmpty();
-        for (Object entry: entrySet()) {
-            ConfigKey<?> k = new BasicConfigKey<Object>(Object.class, ""+((Map.Entry)entry).getKey());
-            if (filter.apply(k))
-                result.put(((Map.Entry)entry).getKey(), ((Map.Entry)entry).getValue());
-        }
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public Map<String, Object> asMapWithStringKeys() {
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/BrooklynStorage.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/BrooklynStorage.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/BrooklynStorage.java
deleted file mode 100644
index b1f9cdf..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/BrooklynStorage.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 org.apache.brooklyn.core.internal.storage;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-
-public interface BrooklynStorage {
-
-    /**
-     * Creates a reference to a value, backed by the storage-medium. If a reference with this 
-     * name has already been created, then that existing reference will be returned.
-     * 
-     * The returned reference is a live view: changes made to the reference will be persisted, 
-     * and changes that others make will be reflected in the reference.
-     * 
-     * The reference is thread-safe. No additional synchronization is required when getting/setting
-     * the reference.
-     * 
-     * @param id
-     */
-    <T> Reference<T> getReference(String id);
-
-    /**
-     * Creates a list backed by the storage-medium. If a list with this name has already been
-     * created, then that existing list will be returned.
-     * 
-     * The returned list is not a live view. Changes are made by calling reference.set(), and
-     * the view is refreshed by calling reference.get(). Changes are thread-safe, but callers
-     * must be careful not to overwrite other's changes. For example, the code below could overwrite
-     * another threads changes that are made to the map between the call to get() and the subsequent
-     * call to set().
-     * 
-     * <pre>
-     * {@code
-     * Reference<List<String>> ref = storage.<String>createNonConcurrentList("myid");
-     * List<String> newval = ImmutableList.<String>builder().addAll(ref.get()).add("another").builder();
-     * ref.set(newval);
-     * }
-     * </pre>
-     * 
-     * TODO Aled says: Is getNonConcurrentList necessary?
-     *   The purpose of this method, rather than just using
-     *   {@code Reference ref = getReference(id); ref.set(ImmutableList.of())}
-     *   is to allow control of the serialization of the things inside the list 
-     *   (e.g. switching the Location object to serialize a proxy object of some sort). 
-     *   I don't want us to have to do deep inspection of every object being added to any map/ref. 
-     *   Feels like we can use normal serialization unless the top-level object matches an 
-     *   instanceof for special things like Entity, Location, etc.
-     * 
-     * Peter responds:
-     *   What I'm a bit scared of is that we need to write some kind of meta serialization mechanism 
-     *   on top of the mechanisms provided by e.g. Hazelcast or Infinispan. Hazelcast has a very 
-     *   extensive serialization library where you can plug in all kinds of serialization mechanisms.
-     * 
-     * @param id
-     */
-    @Beta
-    <T> Reference<List<T>> getNonConcurrentList(String id);
-    
-    /**
-     * Creates a map backed by the storage-medium. If a map with this name has already been
-     * created, then that existing map will be returned.
-     * 
-     * The returned map is a live view: changes made to the map will be persisted, and changes 
-     * that others make will be reflected in the map.
-     * 
-     * The map is thread-safe: {@link Map#keySet()} etc will iterate over a snapshot view of the
-     * contents.
-     * 
-     * @param id
-     */
-    <K,V> ConcurrentMap<K,V> getMap(String id);
-
-    /**
-     * Removes the data stored against this id, whether it is a map, ref or whatever.
-     */
-    void remove(String id);
-
-    /**
-     * Terminates the BrooklynStorage.
-     */
-    void terminate();
-
-    /** asserts that some of the storage containers which should be empty are empty; 
-     * this could do more thorough checks, but as it is it is useful to catch many leaks,
-     * and the things which aren't empty it's much harder to check whether they should be empty!
-     * <p>
-     * not meant for use outwith tests */
-    @VisibleForTesting
-    public boolean isMostlyEmpty();
-    
-    Map<String, Object> getStorageMetrics();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGrid.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGrid.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGrid.java
deleted file mode 100644
index 09f50fb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGrid.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.core.internal.storage;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import com.google.common.annotations.VisibleForTesting;
-
-public interface DataGrid {
-
-    /**
-     * If a map already exists with this id, returns it; otherwise creates a new map stored
-     * in the datagrid.
-     */
-    <K,V> ConcurrentMap<K,V> getMap(String id);
-
-    /**
-     * Deletes the map for this id, if it exists; otherwise a no-op.
-     */
-    void remove(String id);
-
-    /**
-     * Terminates the DataGrid. If there is a real datagrid with multiple machines running, it doesn't mean that the
-     * datagrid is going to be terminated; it only means that all local resources of the datagrid are released.
-     */
-    void terminate();
-    
-    Map<String, Object> getDatagridMetrics();
-
-    /** Returns snapshot of known keys at this datagrid */
-    @VisibleForTesting
-    Set<String> getKeys();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGridFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGridFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGridFactory.java
deleted file mode 100644
index 45c696b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/DataGridFactory.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 org.apache.brooklyn.core.internal.storage;
-
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-
-/**
- * A factory for creating a {@link DataGrid}.
- *
- * Implementations of this interface should have a public no arg constructor; this constructor will be
- * called through reflection in the {@link org.apache.brooklyn.core.mgmt.internal.LocalManagementContext}.
- */
-public interface DataGridFactory {
-
-    /**
-     * Creates a {@link BrooklynStorage} instance.
-     *
-     * @param managementContext the ManagementContextInternal
-     * @return the created BrooklynStorage.
-     */
-    DataGrid newDataGrid(ManagementContextInternal managementContext);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/Reference.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/Reference.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/Reference.java
deleted file mode 100644
index 3f2d846..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/Reference.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 org.apache.brooklyn.core.internal.storage;
-
-/**
- * A reference to a value, backed by the storage-medium.
- * 
- * @see BrooklynStorage#getReference(String)
- * 
- * @author aled
- */
-public interface Reference<T> {
-
-    // TODO We can add compareAndSet(T,T) as and when required
-    
-    T get();
-    
-    T set(T val);
-    
-    /**
-     * @return true if the value is null; false otherwise.
-     */
-    boolean isNull();
-    
-    /**
-     * Sets the value back to null. Similar to {@code set(null)}.
-     */
-    void clear();
-    
-    /**
-     * @return true if the value equals the given parameter; false otherwise
-     */
-    boolean contains(Object other);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BackedReference.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BackedReference.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BackedReference.java
deleted file mode 100644
index e51e782..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BackedReference.java
+++ /dev/null
@@ -1,73 +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.core.internal.storage.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.apache.brooklyn.core.internal.storage.Reference;
-
-import com.google.common.base.Objects;
-
-class BackedReference<T> implements Reference<T> {
-    private final Map<String,? super T> backingMap;
-    private final String key;
-    
-    BackedReference(Map<String,? super T> backingMap, String key) {
-        this.backingMap = checkNotNull(backingMap, "backingMap");
-        this.key = key;
-    }
-    
-    @Override
-    public T get() {
-        // For happens-before (for different threads calling get and set), relies on 
-        // underlying map (e.g. from datagrid) having some synchronization
-        return (T) backingMap.get(key);
-    }
-    
-    @Override
-    public T set(T val) {
-        if (val == null) {
-            return (T) backingMap.remove(key);
-        } else {
-            return (T) backingMap.put(key, val);
-        }
-    }
-    
-    @Override
-    public String toString() {
-        return ""+get();
-    }
-    
-    @Override
-    public boolean isNull() {
-        return get() == null;
-    }
-    
-    @Override
-    public void clear() {
-        set(null);
-    }
-    
-    @Override
-    public boolean contains(Object other) {
-        return Objects.equal(get(), other);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BasicReference.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BasicReference.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BasicReference.java
deleted file mode 100644
index a01d61c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BasicReference.java
+++ /dev/null
@@ -1,67 +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.core.internal.storage.impl;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.core.internal.storage.Reference;
-
-import com.google.common.base.Objects;
-
-public class BasicReference<T> implements Reference<T >{
-
-    private final AtomicReference<T> ref = new AtomicReference<T>();
-    
-    public BasicReference() {
-    }
-    
-    public BasicReference(T val) {
-        set(val);
-    }
-    
-    @Override
-    public T get() {
-        return ref.get();
-    }
-
-    @Override
-    public T set(T val) {
-        return ref.getAndSet(val);
-    }
-
-    @Override
-    public boolean isNull() {
-        return get() == null;
-    }
-
-    @Override
-    public void clear() {
-        set(null);
-    }
-
-    @Override
-    public boolean contains(Object other) {
-        return Objects.equal(get(), other);
-    }
-    
-    @Override
-    public String toString() {
-        return ""+get();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BrooklynStorageImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BrooklynStorageImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BrooklynStorageImpl.java
deleted file mode 100644
index 188955a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/BrooklynStorageImpl.java
+++ /dev/null
@@ -1,139 +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.core.internal.storage.impl;
-
-import java.lang.ref.WeakReference;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.internal.storage.DataGrid;
-import org.apache.brooklyn.core.internal.storage.Reference;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-public class BrooklynStorageImpl implements BrooklynStorage {
-
-    private final DataGrid datagrid;
-    private final ConcurrentMap<String, Object> refsMap;
-    private final ConcurrentMap<String, Object> listsMap;
-    private final ConcurrentMap<String, WeakReference<Reference<?>>> refsCache;
-    private final ConcurrentMap<String, WeakReference<Reference<?>>> listRefsCache;
-    
-    public BrooklynStorageImpl(DataGrid datagrid) {
-        this.datagrid = datagrid;
-        this.refsMap = datagrid.getMap("refs");
-        this.listsMap = datagrid.getMap("lists");
-        this.refsCache = Maps.newConcurrentMap();
-        this.listRefsCache = Maps.newConcurrentMap();
-    }
-
-    /**
-     * Returns the DataGrid used by this  BrooklynStorageImpl
-     *
-     * @return the DataGrid.
-     */
-    @VisibleForTesting
-    public DataGrid getDataGrid() {
-        return datagrid;
-    }
-
-    @Override
-    public <T> Reference<T> getReference(final String id) {
-        // Can use different ref instances; no need to always return same one. Caching is an
-        // optimisation to just avoid extra object creation.
-        WeakReference<Reference<?>> weakRef = refsCache.get(id);
-        Reference<?> ref = (weakRef != null) ? weakRef.get() : null;
-        if (ref == null) {
-            ref = new BackedReference<T>(refsMap, id) {
-                @Override protected void finalize() {
-                    // TODO Don't like using finalize due to performance overhead, but not
-                    // optimising yet. Could use PhantomReference instead; see
-                    // http://java.dzone.com/articles/finalization-and-phantom
-                    refsCache.remove(id);
-                }
-            };
-            refsCache.putIfAbsent(id, new WeakReference<Reference<?>>(ref));
-        }
-        return (Reference<T>) ref;
-    }
-    
-    @Override
-    public <T> Reference<List<T>> getNonConcurrentList(final String id) {
-        WeakReference<Reference<?>> weakRef = listRefsCache.get(id);
-        Reference<?> ref = (weakRef != null) ? weakRef.get() : null;
-        if (ref == null) {
-            ref = new BackedReference<List<T>>(listsMap, id) {
-                @Override public List<T> get() {
-                    List<T> result = super.get();
-                    return (result == null ? ImmutableList.<T>of() : Collections.unmodifiableList(result));
-                }
-                @Override protected void finalize() {
-                    listRefsCache.remove(id);
-                }
-            };
-            listRefsCache.putIfAbsent(id, new WeakReference<Reference<?>>(ref));
-        }
-        return (Reference<List<T>>) ref;
-    }
-
-    @Override
-    public <K, V> ConcurrentMap<K, V> getMap(final String id) {
-        return datagrid.<K,V>getMap(id);
-    }
-    
-    @Override
-    public void remove(String id) {
-        datagrid.remove(id);
-        refsMap.remove(id);
-        listsMap.remove(id);
-        refsCache.remove(id);
-        listRefsCache.remove(id);
-    }
-
-    @Override
-    public void terminate() {
-        datagrid.terminate();
-    }
-    
-    public boolean isMostlyEmpty() {
-        if (!refsMap.isEmpty() || !listsMap.isEmpty()) 
-            return false;
-        // the datagrid may have some standard bookkeeping entries
-        return true;
-    }
-    
-    @Override
-    public Map<String, Object> getStorageMetrics() {
-        return ImmutableMap.of(
-                "datagrid", datagrid.getDatagridMetrics(),
-                "refsMapSize", ""+refsMap.size(),
-                "listsMapSize", ""+listsMap.size());
-    }
-    
-    @Override
-    public String toString() {
-        return super.toString() + getStorageMetrics();
-    }
-}


[38/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
deleted file mode 100644
index 931c2e7..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ /dev/null
@@ -1,124 +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.brooklyn.spi.creation;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-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.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils.CreationResult;
-import org.apache.brooklyn.core.mgmt.HasBrooklynManagementContext;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-
-public class BrooklynAssemblyTemplateInstantiator implements AssemblyTemplateSpecInstantiator {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynAssemblyTemplateInstantiator.class);
-
-    public static final String NEVER_UNWRAP_APPS_PROPERTY = "wrappedApp";
-
-    @Override
-    public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
-        Application app = create(template, platform);
-        CreationResult<Application, Void> start = EntityManagementUtils.start(app);
-        log.debug("CAMP created "+app+"; starting in "+start.task());
-        return platform.assemblies().get(app.getApplicationId());
-    }
-
-    private Application create(AssemblyTemplate template, CampPlatform platform) {
-        ManagementContext mgmt = getManagementContext(platform);
-        BrooklynClassLoadingContext loader = JavaBrooklynClassLoadingContext.create(mgmt);
-        EntitySpec<? extends Application> spec = createApplicationSpec(template, platform, loader, MutableSet.<String>of());
-        Application instance = mgmt.getEntityManager().createEntity(spec);
-        log.info("CAMP created '{}'", instance);
-        return instance;
-    }
-
-    @Override
-    public List<EntitySpec<?>> createServiceSpecs(
-            AssemblyTemplate template,
-            CampPlatform platform, BrooklynClassLoadingContext itemLoader,
-            Set<String> encounteredRegisteredTypeIds) {
-        return buildTemplateServicesAsSpecs(itemLoader, template, platform, encounteredRegisteredTypeIds);
-    }
-
-    @Override
-    public EntitySpec<? extends Application> createApplicationSpec(
-            AssemblyTemplate template,
-            CampPlatform platform,
-            BrooklynClassLoadingContext loader,
-            Set<String> encounteredTypeSymbolicNames) {
-        log.debug("CAMP creating application instance for {} ({})", template.getId(), template);
-
-        // AssemblyTemplates created via PDP, _specifying_ then entities to put in
-
-        EntitySpec<? extends Application> app = CampInternalUtils.createWrapperApp(template, loader);
-        app.configure(EntityManagementUtils.WRAPPER_APP_MARKER, Boolean.TRUE);
-
-        // first build the children into an empty shell app
-        List<EntitySpec<?>> childSpecs = createServiceSpecs(template, platform, loader, encounteredTypeSymbolicNames);
-        for (EntitySpec<?> childSpec : childSpecs) {
-            // children get parsed and unwrapped irrespective of the NEVER_UNWRAP_APPS setting;
-            // we could support a NEVER_UNWRAP_NESTED_ENTITIES item but i don't know if there's a use case
-            app.child(EntityManagementUtils.unwrapEntity(childSpec));
-        }
-
-        if (allowedToUnwrap(template, app)) {
-            app = EntityManagementUtils.unwrapApplication(app);
-        }
-
-        return app;
-    }
-
-    private boolean allowedToUnwrap(AssemblyTemplate template, EntitySpec<? extends Application> app) {
-        return !(Boolean.TRUE.equals(TypeCoercions.coerce(template.getCustomAttributes().get(NEVER_UNWRAP_APPS_PROPERTY), Boolean.class)));
-    }
-
-    private List<EntitySpec<?>> buildTemplateServicesAsSpecs(BrooklynClassLoadingContext loader, AssemblyTemplate template, CampPlatform platform, Set<String> encounteredRegisteredTypeIds) {
-        List<EntitySpec<?>> result = Lists.newArrayList();
-
-        for (ResolvableLink<PlatformComponentTemplate> ctl: template.getPlatformComponentTemplates().links()) {
-            PlatformComponentTemplate appChildComponentTemplate = ctl.resolve();
-            BrooklynComponentTemplateResolver entityResolver = BrooklynComponentTemplateResolver.Factory.newInstance(loader, appChildComponentTemplate);
-            EntitySpec<?> spec = entityResolver.resolveSpec(encounteredRegisteredTypeIds);
-            result.add(spec);
-        }
-        return result;
-    }
-
-    private static ManagementContext getManagementContext(CampPlatform platform) {
-        return ((HasBrooklynManagementContext)platform).getBrooklynManagementContext();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
deleted file mode 100644
index fdc2559..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
+++ /dev/null
@@ -1,387 +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.brooklyn.spi.creation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.service.CampServiceSpecResolver;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolverAdaptor;
-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.config.ConfigKey;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.mgmt.BrooklynTags;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.resolve.entity.EntitySpecResolver;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.FlagUtils.FlagConfigKeyAndValueRecord;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.net.Urls;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-/**
- * This generates instances of a template resolver that use a {@link ServiceTypeResolver}
- * to parse the {@code serviceType} line in the template.
- */
-@SuppressWarnings("deprecation")  // Because of ServiceTypeResolver
-public class BrooklynComponentTemplateResolver {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynComponentTemplateResolver.class);
-
-    private final BrooklynClassLoadingContext loader;
-    private final ManagementContext mgmt;
-    private final ConfigBag attrs;
-    private final Maybe<AbstractResource> template;
-    private final BrooklynYamlTypeInstantiator.Factory yamlLoader;
-    private final String type;
-    private final AtomicBoolean alreadyBuilt = new AtomicBoolean(false);
-    private final EntitySpecResolver serviceSpecResolver;
-
-    private BrooklynComponentTemplateResolver(BrooklynClassLoadingContext loader, ConfigBag attrs, AbstractResource optionalTemplate, String type) {
-        this.loader = loader;
-        this.mgmt = loader.getManagementContext();
-        this.attrs = ConfigBag.newInstanceCopying(attrs);
-        this.template = Maybe.fromNullable(optionalTemplate);
-        this.yamlLoader = new BrooklynYamlTypeInstantiator.Factory(loader, this);
-        this.type = type;
-        this.serviceSpecResolver = new CampServiceSpecResolver(mgmt, getServiceTypeResolverOverrides());
-    }
-
-    // Deprecated because want to keep as much of the state private as possible
-    // Can't remove them because used by ServiceTypeResolver implementations
-    /** @deprecated since 0.9.0 */
-    @Deprecated public ManagementContext getManagementContext() { return mgmt; }
-    @Deprecated public ConfigBag getAttrs() { return attrs; }
-    @Deprecated public BrooklynYamlTypeInstantiator.Factory getYamlLoader() { return yamlLoader; }
-    @Deprecated public String getDeclaredType() { return type; }
-
-    public static class Factory {
-
-        public static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, Map<String, ?> childAttrs) {
-            return newInstance(context, ConfigBag.newInstance(childAttrs), null);
-        }
-
-        public static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, AbstractResource template) {
-            return newInstance(context, ConfigBag.newInstance(template.getCustomAttributes()), template);
-        }
-
-        public static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, String serviceType) {
-            return newInstance(context, ConfigBag.newInstance().configureStringKey("serviceType", serviceType), null);
-        }
-
-        private static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, ConfigBag attrs, AbstractResource optionalTemplate) {
-            String type = getDeclaredType(null, optionalTemplate, attrs);
-            return new BrooklynComponentTemplateResolver(context, attrs, optionalTemplate, type);
-        }
-
-        private static String getDeclaredType(String knownServiceType, AbstractResource optionalTemplate, @Nullable ConfigBag attrs) {
-            String type = knownServiceType;
-            if (type==null && optionalTemplate!=null) {
-                type = optionalTemplate.getType();
-                if (type.equals(AssemblyTemplate.CAMP_TYPE) || type.equals(PlatformComponentTemplate.CAMP_TYPE) || type.equals(ApplicationComponentTemplate.CAMP_TYPE))
-                    // ignore these values for the type; only subclasses are interesting
-                    type = null;
-            }
-            if (type==null) type = extractServiceTypeAttribute(attrs);
-            return type;
-        }
-
-        private static String extractServiceTypeAttribute(@Nullable ConfigBag attrs) {
-            return BrooklynYamlTypeInstantiator.InstantiatorFromKey.extractTypeName("service", attrs).orNull();
-        }
-    }
-
-    public boolean canResolve() {
-        return serviceSpecResolver.accepts(type, loader);
-    }
-
-    public <T extends Entity> EntitySpec<T> resolveSpec(Set<String> encounteredRegisteredTypeSymbolicNames) {
-        if (alreadyBuilt.getAndSet(true))
-            throw new IllegalStateException("Spec can only be used once: "+this);
-
-        EntitySpec<?> spec = serviceSpecResolver.resolve(type, loader, encounteredRegisteredTypeSymbolicNames);
-
-        if (spec == null) {
-            // Try to provide some troubleshooting details
-            final String msgDetails;
-            RegisteredType item = mgmt.getTypeRegistry().get(Strings.removeFromStart(type, "catalog:"));
-            String proto = Urls.getProtocol(type);
-            if (item != null && encounteredRegisteredTypeSymbolicNames.contains(item.getSymbolicName())) {
-                msgDetails = "Cycle between catalog items detected, starting from " + type +
-                        ". Other catalog items being resolved up the stack are " + encounteredRegisteredTypeSymbolicNames +
-                        ". Tried loading it as a Java class instead but failed.";
-            } else if (proto != null) {
-                msgDetails = "The reference " + type + " looks like a URL (running the CAMP Brooklyn assembly-template instantiator) but the protocol " +
-                        proto + " isn't white listed (" + BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST + "). " +
-                        "It's also neither a catalog item nor a java type.";
-            } else {
-                msgDetails = "No resolver knew how to handle it. Using resolvers: " + serviceSpecResolver;
-            }
-            throw new IllegalStateException("Unable to create spec for type " + type + ". " + msgDetails);
-        }
-        spec = EntityManagementUtils.unwrapEntity(spec);
-
-        populateSpec(spec, encounteredRegisteredTypeSymbolicNames);
-
-        @SuppressWarnings("unchecked")
-        EntitySpec<T> typedSpec = (EntitySpec<T>) spec;
-        return typedSpec;
-    }
-
-    private List<EntitySpecResolver> getServiceTypeResolverOverrides() {
-        List<EntitySpecResolver> overrides = new ArrayList<>();
-        ServiceLoader<ServiceTypeResolver> loader = ServiceLoader.load(ServiceTypeResolver.class, mgmt.getCatalogClassLoader());
-        for (ServiceTypeResolver resolver : loader) {
-           overrides.add(new ServiceTypeResolverAdaptor(this, resolver));
-        }
-        return overrides;
-    }
-
-    @SuppressWarnings("unchecked")
-    private <T extends Entity> void populateSpec(EntitySpec<T> spec, Set<String> encounteredRegisteredTypeIds) {
-        String name, source=null, templateId=null, planId=null;
-        if (template.isPresent()) {
-            name = template.get().getName();
-            templateId = template.get().getId();
-            source = template.get().getSourceCode();
-        } else {
-            name = (String)attrs.getStringKey("name");
-        }
-        planId = (String)attrs.getStringKey("id");
-        if (planId==null)
-            planId = (String) attrs.getStringKey(BrooklynCampConstants.PLAN_ID_FLAG);
-
-        Object childrenObj = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_CHILDREN);
-        if (childrenObj != null) {
-            Iterable<Map<String,?>> children = (Iterable<Map<String,?>>)childrenObj;
-            for (Map<String,?> childAttrs : children) {
-                BrooklynComponentTemplateResolver entityResolver = BrooklynComponentTemplateResolver.Factory.newInstance(loader, childAttrs);
-                // encounteredRegisteredTypeIds must contain the items currently being loaded (the dependency chain),
-                // but not parent items in this type already resolved.
-                EntitySpec<? extends Entity> childSpec = entityResolver.resolveSpec(encounteredRegisteredTypeIds);
-                spec.child(EntityManagementUtils.unwrapEntity(childSpec));
-            }
-        }
-
-        if (source!=null) {
-            spec.tag(BrooklynTags.newYamlSpecTag(source));
-        }
-
-        if (!Strings.isBlank(name))
-            spec.displayName(name);
-        if (templateId != null)
-            spec.configure(BrooklynCampConstants.TEMPLATE_ID, templateId);
-        if (planId != null)
-            spec.configure(BrooklynCampConstants.PLAN_ID, planId);
-
-        List<Location> locations = new BrooklynYamlLocationResolver(mgmt).resolveLocations(attrs.getAllConfig(), true);
-        if (locations != null) {
-            // override locations defined in the type if locations are specified here
-            // empty list can be used by caller to clear, so they are inherited
-            spec.clearLocations();
-            spec.locations(locations);
-        }
-
-        decorateSpec(spec, encounteredRegisteredTypeIds);
-    }
-
-    private <T extends Entity> void decorateSpec(EntitySpec<T> spec, Set<String> encounteredRegisteredTypeIds) {
-        new BrooklynEntityDecorationResolver.PolicySpecResolver(yamlLoader).decorate(spec, attrs);
-        new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs);
-        new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs);
-        new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs);
-
-        configureEntityConfig(spec, encounteredRegisteredTypeIds);
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private void configureEntityConfig(EntitySpec<?> spec, Set<String> encounteredRegisteredTypeIds) {
-        // first take *recognised* flags and config keys from the top-level, and put them in the bag (of brooklyn.config)
-        // attrs will contain only brooklyn.xxx properties when coming from BrooklynEntityMatcher.
-        // Any top-level flags will go into "brooklyn.flags". When resolving a spec from $brooklyn:entitySpec
-        // top level flags remain in place. Have to support both cases.
-
-        ConfigBag bag = ConfigBag.newInstance((Map<Object, Object>) attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_CONFIG));
-        ConfigBag bagFlags = ConfigBag.newInstanceCopying(attrs);
-        if (attrs.containsKey(BrooklynCampReservedKeys.BROOKLYN_FLAGS)) {
-            bagFlags.putAll((Map<String, Object>) attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_FLAGS));
-        }
-
-        Collection<FlagConfigKeyAndValueRecord> topLevelApparentConfig = findAllFlagsAndConfigKeys(spec, bagFlags);
-        for (FlagConfigKeyAndValueRecord r: topLevelApparentConfig) {
-            if (r.getConfigKeyMaybeValue().isPresent())
-                bag.putIfAbsent((ConfigKey)r.getConfigKey(), r.getConfigKeyMaybeValue().get());
-            if (r.getFlagMaybeValue().isPresent())
-                bag.putAsStringKeyIfAbsent(r.getFlagName(), r.getFlagMaybeValue().get());
-        }
-
-        // now set configuration for all the items in the bag
-        Collection<FlagConfigKeyAndValueRecord> records = findAllFlagsAndConfigKeys(spec, bag);
-        Set<String> keyNamesUsed = new LinkedHashSet<String>();
-        for (FlagConfigKeyAndValueRecord r: records) {
-            if (r.getFlagMaybeValue().isPresent()) {
-                Object transformed = new SpecialFlagsTransformer(loader, encounteredRegisteredTypeIds).apply(r.getFlagMaybeValue().get());
-                spec.configure(r.getFlagName(), transformed);
-                keyNamesUsed.add(r.getFlagName());
-            }
-            if (r.getConfigKeyMaybeValue().isPresent()) {
-                Object transformed = new SpecialFlagsTransformer(loader, encounteredRegisteredTypeIds).apply(r.getConfigKeyMaybeValue().get());
-                spec.configure((ConfigKey<Object>)r.getConfigKey(), transformed);
-                keyNamesUsed.add(r.getConfigKey().getName());
-            }
-        }
-
-        // set unused keys as anonymous config keys -
-        // they aren't flags or known config keys, so must be passed as config keys in order for
-        // EntitySpec to know what to do with them (as they are passed to the spec as flags)
-        for (String key: MutableSet.copyOf(bag.getUnusedConfig().keySet())) {
-            // we don't let a flag with the same name as a config key override the config key
-            // (that's why we check whether it is used)
-            if (!keyNamesUsed.contains(key)) {
-                Object transformed = new SpecialFlagsTransformer(loader, encounteredRegisteredTypeIds).apply(bag.getStringKey(key));
-                spec.configure(ConfigKeys.newConfigKey(Object.class, key.toString()), transformed);
-            }
-        }
-    }
-
-    /**
-     * Searches for config keys in the type, additional interfaces and the implementation (if specified)
-     */
-    private Collection<FlagConfigKeyAndValueRecord> findAllFlagsAndConfigKeys(EntitySpec<?> spec, ConfigBag bagFlags) {
-        Set<FlagConfigKeyAndValueRecord> allKeys = MutableSet.of();
-        allKeys.addAll(FlagUtils.findAllFlagsAndConfigKeys(null, spec.getType(), bagFlags));
-        if (spec.getImplementation() != null) {
-            allKeys.addAll(FlagUtils.findAllFlagsAndConfigKeys(null, spec.getImplementation(), bagFlags));
-        }
-        for (Class<?> iface : spec.getAdditionalInterfaces()) {
-            allKeys.addAll(FlagUtils.findAllFlagsAndConfigKeys(null, iface, bagFlags));
-        }
-        allKeys.addAll(FlagUtils.findAllParameterConfigKeys(spec.getParameters(), bagFlags));
-        return allKeys;
-    }
-
-    private static class SpecialFlagsTransformer implements Function<Object, Object> {
-        protected final ManagementContext mgmt;
-        /* TODO find a way to make do without loader here?
-         * it is not very nice having to serialize it; but serialization of BLCL is now relatively clean.
-         *
-         * it is only used to instantiate classes, and now most types should be registered;
-         * the notable exception is when one entity in a bundle is creating another in the same bundle,
-         * it wants to use his bundle CLC to do that.  but we can set up some unique reference to the entity
-         * which can be used to find it from mgmt, rather than pass the loader.
-         */
-        private BrooklynClassLoadingContext loader = null;
-        private Set<String> encounteredRegisteredTypeIds;
-
-        public SpecialFlagsTransformer(BrooklynClassLoadingContext loader, Set<String> encounteredRegisteredTypeIds) {
-            this.loader = loader;
-            mgmt = loader.getManagementContext();
-            this.encounteredRegisteredTypeIds = encounteredRegisteredTypeIds;
-        }
-        @Override
-        public Object apply(Object input) {
-            if (input instanceof Map)
-                return transformSpecialFlags((Map<?, ?>)input);
-            else if (input instanceof Set<?>)
-                return MutableSet.copyOf(transformSpecialFlags((Iterable<?>)input));
-            else if (input instanceof List<?>)
-                return MutableList.copyOf(transformSpecialFlags((Iterable<?>)input));
-            else if (input instanceof Iterable<?>)
-                return transformSpecialFlags((Iterable<?>)input);
-            else
-                return transformSpecialFlags((Object)input);
-        }
-
-        protected Map<?, ?> transformSpecialFlags(Map<?, ?> flag) {
-            return Maps.transformValues(flag, this);
-        }
-
-        protected Iterable<?> transformSpecialFlags(Iterable<?> flag) {
-            return Iterables.transform(flag, this);
-        }
-
-        protected BrooklynClassLoadingContext getLoader() {
-            if (loader!=null) return loader;
-            // TODO currently loader will non-null unless someone has messed with the rebind files,
-            // but we'd like to get rid of it; ideally we'd have a reference to the entity.
-            // for now, this is a slightly naff way to do it, if we have to set loader=null as a workaround
-            Entity entity = BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-            if (entity!=null) return CatalogUtils.getClassLoadingContext(entity);
-            return JavaBrooklynClassLoadingContext.create(mgmt);
-        }
-
-        /**
-         * Makes additional transformations to the given flag with the extra knowledge of the flag's management context.
-         * @return The modified flag, or the flag unchanged.
-         */
-        protected Object transformSpecialFlags(Object flag) {
-            if (flag instanceof EntitySpecConfiguration) {
-                EntitySpecConfiguration specConfig = (EntitySpecConfiguration) flag;
-                // TODO: This should called from BrooklynAssemblyTemplateInstantiator.configureEntityConfig
-                // And have transformSpecialFlags(Object flag, ManagementContext mgmt) drill into the Object flag if it's a map or iterable?
-                @SuppressWarnings("unchecked")
-                Map<String, Object> resolvedConfig = (Map<String, Object>)transformSpecialFlags(specConfig.getSpecConfiguration());
-                specConfig.setSpecConfiguration(resolvedConfig);
-                EntitySpec<?> entitySpec = Factory.newInstance(getLoader(), specConfig.getSpecConfiguration()).resolveSpec(encounteredRegisteredTypeIds);
-                
-                return EntityManagementUtils.unwrapEntity(entitySpec);
-            }
-            if (flag instanceof ManagementContextInjectable) {
-                log.debug("Injecting Brooklyn management context info object: {}", flag);
-                ((ManagementContextInjectable) flag).setManagementContext(loader.getManagementContext());
-            }
-
-            return flag;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java
deleted file mode 100644
index 4913cb1..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java
+++ /dev/null
@@ -1,216 +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.brooklyn.spi.creation;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.EntityInitializer;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.objs.SpecParameter;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynYamlTypeInstantiator.InstantiatorFromKey;
-import org.apache.brooklyn.core.objs.BasicSpecParameter;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Pattern for resolving "decorations" on service specs / entity specs, such as policies, enrichers, etc.
- * @since 0.7.0
- */
-@Beta
-public abstract class BrooklynEntityDecorationResolver<DT> {
-
-    public final BrooklynYamlTypeInstantiator.Factory instantiator;
-    
-    protected BrooklynEntityDecorationResolver(BrooklynYamlTypeInstantiator.Factory instantiator) {
-        this.instantiator = instantiator;
-    }
-    
-    public abstract void decorate(EntitySpec<?> entitySpec, ConfigBag attrs);
-
-    protected List<? extends DT> buildListOfTheseDecorationsFromEntityAttributes(ConfigBag attrs) {
-        Object value = getDecorationAttributeJsonValue(attrs); 
-        if (value==null) return MutableList.of();
-        if (value instanceof Iterable) {
-            return buildListOfTheseDecorationsFromIterable((Iterable<?>)value);
-        } else {
-            // in future may support types other than iterables here, 
-            // e.g. a map short form where the key is the type
-            throw new IllegalArgumentException(getDecorationKind()+" body should be iterable, not " + value.getClass());
-        }
-    }
-
-    protected Map<?,?> checkIsMap(Object decorationJson) {
-        if (!(decorationJson instanceof Map))
-            throw new IllegalArgumentException(getDecorationKind()+" value must be a Map, not " + 
-                (decorationJson==null ? null : decorationJson.getClass()) );
-        return (Map<?,?>) decorationJson;
-    }
-
-    protected List<DT> buildListOfTheseDecorationsFromIterable(Iterable<?> value) {
-        List<DT> decorations = MutableList.of();
-        for (Object decorationJson: value)
-            addDecorationFromJsonMap(checkIsMap(decorationJson), decorations);
-        return decorations;
-    }
-
-    protected abstract String getDecorationKind();
-    protected abstract Object getDecorationAttributeJsonValue(ConfigBag attrs);
-    
-    /** creates and adds decorations from the given json to the given collection; 
-     * default impl requires a map and calls {@link #addDecorationFromJsonMap(Map, List)} */
-    protected void addDecorationFromJson(Object decorationJson, List<DT> decorations) {
-        addDecorationFromJsonMap(checkIsMap(decorationJson), decorations);
-    }
-    protected abstract void addDecorationFromJsonMap(Map<?,?> decorationJson, List<DT> decorations);
-    
-
-    public static class PolicySpecResolver extends BrooklynEntityDecorationResolver<PolicySpec<?>> {
-        
-        public PolicySpecResolver(BrooklynYamlTypeInstantiator.Factory loader) { super(loader); }
-        @Override protected String getDecorationKind() { return "Policy"; }
-
-        @Override
-        public void decorate(EntitySpec<?> entitySpec, ConfigBag attrs) {
-            entitySpec.policySpecs(buildListOfTheseDecorationsFromEntityAttributes(attrs));
-        }
-        
-        @Override
-        protected Object getDecorationAttributeJsonValue(ConfigBag attrs) {
-            return attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_POLICIES);
-        }
-
-        @Override
-        protected void addDecorationFromJsonMap(Map<?, ?> decorationJson, List<PolicySpec<?>> decorations) {
-            InstantiatorFromKey decoLoader = instantiator.from(decorationJson).prefix("policy");
-
-            String policyType = decoLoader.getTypeName().get();
-            ManagementContext mgmt = instantiator.loader.getManagementContext();
-            
-            Maybe<RegisteredType> item = RegisteredTypes.tryValidate(mgmt.getTypeRegistry().get(policyType), RegisteredTypeLoadingContexts.spec(Policy.class));
-            PolicySpec<?> spec;
-            if (!item.isNull()) {
-                // throw error if absent for any reason other than null
-                spec = mgmt.getTypeRegistry().createSpec(item.get(), null, PolicySpec.class);
-            } else {
-                Class<? extends Policy> type = decoLoader.getType(Policy.class);
-                spec = PolicySpec.create(type)
-                        .parameters(BasicSpecParameter.fromClass(mgmt, type));
-            }
-            spec.configure( decoLoader.getConfigMap() );
-            decorations.add(spec);
-        }
-    }
-
-    public static class EnricherSpecResolver extends BrooklynEntityDecorationResolver<EnricherSpec<?>> {
-        
-        public EnricherSpecResolver(BrooklynYamlTypeInstantiator.Factory loader) { super(loader); }
-        @Override protected String getDecorationKind() { return "Enricher"; }
-
-        @Override
-        public void decorate(EntitySpec<?> entitySpec, ConfigBag attrs) {
-            entitySpec.enricherSpecs(buildListOfTheseDecorationsFromEntityAttributes(attrs));
-        }
-        
-        @Override
-        protected Object getDecorationAttributeJsonValue(ConfigBag attrs) {
-            return attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_ENRICHERS);
-        }
-
-        @Override
-        protected void addDecorationFromJsonMap(Map<?, ?> decorationJson, List<EnricherSpec<?>> decorations) {
-            InstantiatorFromKey decoLoader = instantiator.from(decorationJson).prefix("enricher");
-            Class<? extends Enricher> type = decoLoader.getType(Enricher.class);
-            decorations.add(EnricherSpec.create(type)
-                .configure(decoLoader.getConfigMap())
-                .parameters(BasicSpecParameter.fromClass(instantiator.loader.getManagementContext(), type)));
-        }
-    }
-    
-    public static class InitializerResolver extends BrooklynEntityDecorationResolver<EntityInitializer> {
-        
-        public InitializerResolver(BrooklynYamlTypeInstantiator.Factory loader) { super(loader); }
-        @Override protected String getDecorationKind() { return "Entity initializer"; }
-
-        @Override
-        public void decorate(EntitySpec<?> entitySpec, ConfigBag attrs) {
-            entitySpec.addInitializers(buildListOfTheseDecorationsFromEntityAttributes(attrs));
-        }
-        
-        @Override
-        protected Object getDecorationAttributeJsonValue(ConfigBag attrs) {
-            return attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_INITIALIZERS);
-        }
-
-        @Override
-        protected void addDecorationFromJsonMap(Map<?, ?> decorationJson, List<EntityInitializer> decorations) {
-            decorations.add(instantiator.from(decorationJson).prefix("initializer").newInstance(EntityInitializer.class));
-        }
-    }
-
-    // Not much value from extending from BrooklynEntityDecorationResolver, but let's not break the convention
-    public static class SpecParameterResolver extends BrooklynEntityDecorationResolver<SpecParameter<?>> {
-
-        protected SpecParameterResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { super(instantiator); }
-        @Override protected String getDecorationKind() { return "Spec Parameter initializer"; }
-
-        @Override
-        public void decorate(EntitySpec<?> entitySpec, ConfigBag attrs) {
-            List<? extends SpecParameter<?>> explicitParams = buildListOfTheseDecorationsFromEntityAttributes(attrs);
-            // TODO see discussion at EntitySpec.parameters; 
-            // maybe we should instead inherit always, or 
-            // inherit except where it is set as config and then add the new explicit ones
-            if (!explicitParams.isEmpty()) {
-                entitySpec.parameters(explicitParams);
-            }
-            if (entitySpec.getParameters().isEmpty()) {
-                entitySpec.parameters(BasicSpecParameter.fromSpec(instantiator.loader.getManagementContext(), entitySpec));
-            }
-        }
-
-        @Override
-        protected List<SpecParameter<?>> buildListOfTheseDecorationsFromIterable(Iterable<?> value) {
-            return BasicSpecParameter.fromConfigList(ImmutableList.copyOf(value), instantiator.loader);
-        }
-
-        @Override
-        protected Object getDecorationAttributeJsonValue(ConfigBag attrs) {
-            return attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_PARAMETERS);
-        }
-
-        @Override
-        protected void addDecorationFromJsonMap(Map<?, ?> decorationJson, List<SpecParameter<?>> decorations) {
-            throw new IllegalStateException("Not called");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
deleted file mode 100644
index 91a490a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
+++ /dev/null
@@ -1,180 +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.brooklyn.spi.creation;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-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.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-public class BrooklynEntityMatcher implements PdpMatcher {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynEntityMatcher.class);
-    
-    protected final ManagementContext mgmt;
-
-    public BrooklynEntityMatcher(ManagementContext bmc) {
-        this.mgmt = bmc;
-    }
-
-    @Override
-    public boolean accepts(Object deploymentPlanItem) {
-        return lookupType(deploymentPlanItem) != null;
-    }
-
-    /** returns the type of the given plan item, 
-     * typically whether a Service can be matched to a Brooklyn entity,
-     * or null if not supported */
-    protected String lookupType(Object deploymentPlanItem) {
-        if (deploymentPlanItem instanceof Service) {
-            Service service = (Service)deploymentPlanItem;
-
-            String serviceType = service.getServiceType();
-            if (serviceType==null) throw new NullPointerException("Service must declare a type ("+service+")");
-            BrooklynClassLoadingContext loader = BasicBrooklynCatalog.BrooklynLoaderTracker.getLoader();
-            if (loader == null) loader = JavaBrooklynClassLoadingContext.create(mgmt);
-            if (BrooklynComponentTemplateResolver.Factory.newInstance(loader, serviceType).canResolve())
-                return serviceType;
-        }
-        return null;
-    }
-
-    @Override
-    public boolean apply(Object deploymentPlanItem, AssemblyTemplateConstructor atc) {
-        if (!(deploymentPlanItem instanceof Service)) return false;
-        
-        String type = lookupType(deploymentPlanItem);
-        if (type==null) return false;
-
-        log.debug("Item "+deploymentPlanItem+" being instantiated with "+type);
-
-        Object old = atc.getInstantiator();
-        if (old!=null && !old.equals(BrooklynAssemblyTemplateInstantiator.class)) {
-            log.warn("Can't mix Brooklyn entities with non-Brooklyn entities (at present): "+old);
-            return false;
-        }
-
-        // TODO should we build up a new type, BrooklynEntityComponentTemplate here
-        // complete w EntitySpec -- ie merge w BrooklynComponentTemplateResolver ?
-        
-        Builder<? extends PlatformComponentTemplate> builder = PlatformComponentTemplate.builder();
-        builder.type( type.indexOf(':')==-1 ? "brooklyn:"+type : type );
-        
-        // currently instantiator must be brooklyn at the ATC level
-        // optionally would be nice to support multiple/mixed instantiators, 
-        // ie at the component level, perhaps with the first one responsible for building the app
-        atc.instantiator(BrooklynAssemblyTemplateInstantiator.class);
-
-        String name = ((Service)deploymentPlanItem).getName();
-        if (!Strings.isBlank(name)) builder.name(name);
-        
-        // configuration
-        Map<String, Object> attrs = MutableMap.copyOf( ((Service)deploymentPlanItem).getCustomAttributes() );
-
-        if (attrs.containsKey("id"))
-            builder.customAttribute("planId", attrs.remove("id"));
-
-        Object location = attrs.remove("location");
-        if (location!=null)
-            builder.customAttribute("location", location);
-        Object locations = attrs.remove("locations");
-        if (locations!=null)
-            builder.customAttribute("locations", locations);
-
-        MutableMap<Object, Object> brooklynFlags = MutableMap.of();
-        Object origBrooklynFlags = attrs.remove(BrooklynCampReservedKeys.BROOKLYN_FLAGS);
-        if (origBrooklynFlags!=null) {
-            if (!(origBrooklynFlags instanceof Map))
-                throw new IllegalArgumentException("brooklyn.flags must be a map of brooklyn flags");
-            brooklynFlags.putAll((Map<?,?>)origBrooklynFlags);
-        }
-
-        addCustomMapAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_CONFIG);
-        addCustomListAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_POLICIES);
-        addCustomListAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_ENRICHERS);
-        addCustomListAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_INITIALIZERS);
-        addCustomListAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_CHILDREN);
-        addCustomListAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_PARAMETERS);
-        addCustomMapAttributeIfNonNull(builder, attrs, BrooklynCampReservedKeys.BROOKLYN_CATALOG);
-
-        brooklynFlags.putAll(attrs);
-        if (!brooklynFlags.isEmpty()) {
-            builder.customAttribute(BrooklynCampReservedKeys.BROOKLYN_FLAGS, brooklynFlags);
-        }
-
-        atc.add(builder.build());
-
-        return true;
-    }
-
-    /**
-     * Looks for the given key in the map of attributes and adds it to the given builder
-     * as a custom attribute with type List.
-     * @throws java.lang.IllegalArgumentException if map[key] is not an instance of List
-     */
-    private void addCustomListAttributeIfNonNull(Builder<? extends PlatformComponentTemplate> builder, Map<?,?> attrs, String key) {
-        Object items = attrs.remove(key);
-        if (items != null) {
-            if (items instanceof List) {
-                List<?> itemList = (List<?>) items;
-                if (!itemList.isEmpty()) {
-                    builder.customAttribute(key, Lists.newArrayList(itemList));
-                }
-            } else {
-                throw new IllegalArgumentException(key + " must be a list, is: " + items.getClass().getName());
-            }
-        }
-    }
-
-    /**
-     * Looks for the given key in the map of attributes and adds it to the given builder
-     * as a custom attribute with type Map.
-     * @throws java.lang.IllegalArgumentException if map[key] is not an instance of Map
-     */
-    private void addCustomMapAttributeIfNonNull(Builder<? extends PlatformComponentTemplate> builder, Map<?,?> attrs, String key) {
-        Object items = attrs.remove(key);
-        if (items != null) {
-            if (items instanceof Map) {
-                Map<?, ?> itemMap = (Map<?, ?>) items;
-                if (!itemMap.isEmpty()) {
-                    builder.customAttribute(key, Maps.newHashMap(itemMap));
-                }
-            } else {
-                throw new IllegalArgumentException(key + " must be a map, is: " + items.getClass().getName());
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlLocationResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlLocationResolver.java
deleted file mode 100644
index 2f8dd99..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlLocationResolver.java
+++ /dev/null
@@ -1,142 +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.brooklyn.spi.creation;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.guava.Maybe.Absent;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.collect.Iterables;
-
-public class BrooklynYamlLocationResolver {
-
-    protected final ManagementContext mgmt;
-
-    public BrooklynYamlLocationResolver(ManagementContext bmc) {
-        this.mgmt = bmc;
-    }
-
-    /** returns list of locations, if any were supplied, or null if none indicated */
-    @SuppressWarnings("unchecked")
-    public List<Location> resolveLocations(Map<? super String,?> attrs, boolean removeUsedAttributes) {
-        Object location = attrs.get("location");
-        Object locations = attrs.get("locations");
-
-        if (location==null && locations==null)
-            return null;
-        
-        Location locationFromString = null;
-        List<Location> locationsFromList = null;
-        
-        if (location!=null) {
-            if (location instanceof String) {
-                locationFromString = resolveLocationFromString((String)location);
-            } else if (location instanceof Map) {
-                locationFromString = resolveLocationFromMap((Map<?,?>)location);
-            } else {
-                throw new IllegalStateException("Illegal parameter for 'location'; must be a string or map (but got "+location+")");
-            }
-        }
-        
-        if (locations!=null) {
-            if (!(locations instanceof Iterable))
-                throw new IllegalStateException("Illegal parameter for 'locations'; must be an iterable (but got "+locations+")");
-            locationsFromList = resolveLocations( (Iterable<Object>)locations );
-        }
-        
-        if (locationFromString!=null && locationsFromList!=null) {
-            if (locationsFromList.size() != 1)
-                throw new IllegalStateException("Conflicting 'location' and 'locations' ("+location+" and "+locations+"); "
-                    + "if both are supplied the list must have exactly one element being the same");
-            if (!locationFromString.equals( Iterables.getOnlyElement(locationsFromList) ))
-                throw new IllegalStateException("Conflicting 'location' and 'locations' ("+location+" and "+locations+"); "
-                    + "different location specified in each");
-        } else if (locationFromString!=null) {
-            locationsFromList = Arrays.asList(locationFromString);
-        }
-        
-        return locationsFromList;
-    }
-
-    public List<Location> resolveLocations(Iterable<Object> locations) {
-        List<Location> result = MutableList.of();
-        for (Object l: locations) {
-            Location ll = resolveLocation(l);
-            if (ll!=null) result.add(ll);
-        }
-        return result;
-    }
-
-    public Location resolveLocation(Object location) {
-        if (location instanceof String) {
-            return resolveLocationFromString((String)location);
-        } else if (location instanceof Map) {
-            return resolveLocationFromMap((Map<?,?>)location);
-        }
-        // could support e.g. location definition
-        throw new IllegalStateException("Illegal parameter for 'location' ("+location+"); must be a string or map");
-    }
-    
-    /** resolves the location from the given spec string, either "Named Location", or "named:Named Location" format;
-     * returns null if input is blank (or null); otherwise guaranteed to resolve or throw error */
-    public Location resolveLocationFromString(String location) {
-        if (Strings.isBlank(location)) return null;
-        return resolveLocation(location, MutableMap.of());
-    }
-
-    public Location resolveLocationFromMap(Map<?,?> location) {
-        if (location.size() > 1) {
-            throw new IllegalStateException("Illegal parameter for 'location'; expected a single entry in map ("+location+")");
-        }
-        Object key = Iterables.getOnlyElement(location.keySet());
-        Object value = location.get(key);
-        
-        if (!(key instanceof String)) {
-            throw new IllegalStateException("Illegal parameter for 'location'; expected String key ("+location+")");
-        }
-        if (!(value instanceof Map)) {
-            throw new IllegalStateException("Illegal parameter for 'location'; expected config map ("+location+")");
-        }
-        return resolveLocation((String)key, (Map<?,?>)value);
-    }
-    
-    protected Location resolveLocation(String spec, Map<?,?> flags) {
-        LocationDefinition ldef = mgmt.getLocationRegistry().getDefinedLocationByName((String)spec);
-        if (ldef!=null)
-            // found it as a named location
-            return mgmt.getLocationRegistry().resolve(ldef, null, flags).get();
-        
-        Maybe<Location> l = mgmt.getLocationRegistry().resolve(spec, null, flags);
-        if (l.isPresent()) return l.get();
-        
-        RuntimeException exception = ((Absent<?>)l).getException();
-        throw new IllegalStateException("Illegal parameter for 'location' ("+spec+"); not resolvable: "+
-            Exceptions.collapseText( exception ), exception);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlTypeInstantiator.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlTypeInstantiator.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlTypeInstantiator.java
deleted file mode 100644
index 01bfaa2..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynYamlTypeInstantiator.java
+++ /dev/null
@@ -1,209 +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.brooklyn.spi.creation;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-
-/** Assists in loading types referenced from YAML;
- * mainly as a way to share logic used in very different contexts. */
-public abstract class BrooklynYamlTypeInstantiator {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynYamlTypeInstantiator.class);
-    
-    protected final Factory factory;
-
-    @Beta
-    public static class Factory {
-        final BrooklynClassLoadingContext loader;
-        final Object contextForLogging;
-        
-        public Factory(BrooklynClassLoadingContext loader, Object contextForLogging) {
-            this.loader = loader;
-            this.contextForLogging = contextForLogging;
-        }
-        
-        public InstantiatorFromKey from(Map<?,?> data) {
-            return new InstantiatorFromKey(this, ConfigBag.newInstance(data));
-        }
-        
-        public InstantiatorFromKey from(ConfigBag data) {
-            return new InstantiatorFromKey(this, data);
-        }
-        
-        public InstantiatorFromName type(String typeName) {
-            return new InstantiatorFromName(this, typeName);
-        }
-
-    }
-        
-    public static class InstantiatorFromKey extends BrooklynYamlTypeInstantiator {
-        protected final ConfigBag data;
-        protected String typeKeyPrefix = null;
-        
-        /** Nullable only permitted for instances which do not do loading, e.g. LoaderFromKey#lookup */
-        protected InstantiatorFromKey(@Nullable Factory factory, ConfigBag data) {
-            super(factory);
-            this.data = data;
-        }
-        
-        public static Maybe<String> extractTypeName(String prefix, ConfigBag data) {
-            if (data==null) return Maybe.absent();
-            return new InstantiatorFromKey(null, data).prefix(prefix).getTypeName();
-        }
-        
-        public InstantiatorFromKey prefix(String prefix) {
-            typeKeyPrefix = prefix;
-            return this;
-        }
-
-        @Override
-        public Maybe<String> getTypeName() {
-            Maybe<Object> result = data.getStringKeyMaybe(getPreferredKeyName());
-            if (result.isAbsent() && typeKeyPrefix!=null) {
-                // try alternatives if a prefix was specified
-                result = data.getStringKeyMaybe(typeKeyPrefix+"Type");
-                if (result.isAbsent()) result = data.getStringKeyMaybe("type");
-            }
-            
-            if (result.isAbsent() || result.get()==null) 
-                return Maybe.absent("Missing key '"+getPreferredKeyName()+"'");
-            
-            if (result.get() instanceof String) return Maybe.of((String)result.get());
-            
-            throw new IllegalArgumentException("Invalid value "+result.get().getClass()+" for "+getPreferredKeyName()+"; "
-                + "expected String, got "+result.get());
-        }
-        
-        protected String getPreferredKeyName() {
-            if (typeKeyPrefix!=null) return typeKeyPrefix+"_type";
-            return "type";
-        }
-        
-        /** as {@link #newInstance(Class)} but inferring the type */
-        public Object newInstance() {
-            return newInstance(null);
-        }
-        
-        /** creates a new instance of the type referred to by this description,
-         * as a subtype of the type supplied here, 
-         * inferring a Map from <code>brooklyn.config</code> key.
-         * TODO in future also picking up recognized flags and config keys (those declared on the type).  
-         * <p>
-         * constructs the object using:
-         * <li> a constructor on the class taking a Map
-         * <li> a no-arg constructor, only if the inferred map is empty  
-         **/
-        public <T> T newInstance(@Nullable Class<T> supertype) {
-            Class<? extends T> type = getType(supertype);
-            Map<String, ?> cfg = getConfigMap();
-            Optional<? extends T> result = Reflections.invokeConstructorWithArgs(type, cfg);
-            if (result.isPresent()) 
-                return result.get();
-            
-            ConfigBag cfgBag = ConfigBag.newInstance(cfg);
-            result = Reflections.invokeConstructorWithArgs(type, cfgBag);
-            if (result.isPresent()) 
-                return result.get();
-            
-            if (cfg.isEmpty()) {
-                result = Reflections.invokeConstructorWithArgs(type);
-                if (result.isPresent()) 
-                    return result.get();
-            }
-            
-            throw new IllegalStateException("No known mechanism for constructing type "+type+" in "+factory.contextForLogging);
-        }
-
-        /** finds the map of config for the type specified;
-         * currently only gets <code>brooklyn.config</code>, returning empty map if none,
-         * but TODO in future should support recognized flags and config keys (those declared on the type),
-         * incorporating code in {@link BrooklynEntityMatcher}.
-         */
-        @SuppressWarnings("unchecked")
-        @Nonnull
-        public Map<String,?> getConfigMap() {
-            MutableMap<String,Object> result = MutableMap.of();
-            Object bc = data.getStringKey(BrooklynCampReservedKeys.BROOKLYN_CONFIG);
-            if (bc!=null) {
-                if (bc instanceof Map)
-                    result.putAll((Map<? extends String, ?>) bc);
-                else
-                    throw new IllegalArgumentException("brooklyn.config key in "+factory.contextForLogging+" should be a map, not "+bc.getClass()+" ("+bc+")");
-            }
-            return result; 
-        }
-
-    }
-    
-    public static class InstantiatorFromName extends BrooklynYamlTypeInstantiator {
-        protected final String typeName;
-        protected InstantiatorFromName(Factory factory, String typeName) {
-            super(factory);
-            this.typeName = typeName;
-        }
-        
-        @Override
-        public Maybe<String> getTypeName() {
-            return Maybe.fromNullable(typeName);
-        }
-    }
-    
-    protected BrooklynYamlTypeInstantiator(Factory factory) {
-        this.factory = factory;
-    }
-        
-    public abstract Maybe<String> getTypeName();
-    
-    public BrooklynClassLoadingContext getClassLoadingContext() {
-        Preconditions.checkNotNull(factory, "No factory set; cannot use this instance for type loading");
-        return factory.loader;
-    }
-    
-    public Class<?> getType() {
-        return getType(Object.class);
-    }
-    
-    public <T> Class<? extends T> getType(@Nonnull Class<T> type) {
-        try {
-            return getClassLoadingContext().loadClass(getTypeName().get(), type);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.debug("Unable to resolve " + type + " " + getTypeName().get() + " (rethrowing) in spec " + factory.contextForLogging);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampCatalogUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampCatalogUtils.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampCatalogUtils.java
deleted file mode 100644
index 706d6f2..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampCatalogUtils.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.brooklyn.spi.creation;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-
-@Deprecated /** @deprecated since 0.9.0 use RegisteredType and CampResolver */
-public class CampCatalogUtils {
-
-    public static AbstractBrooklynObjectSpec<?, ?> createSpec(ManagementContext mgmt, CatalogItem<?, ?> item, Set<String> parentEncounteredTypes) {
-        return CampResolver.createSpecFromFull(mgmt, RegisteredTypes.of(item), item.getCatalogItemJavaType(), parentEncounteredTypes, null);
-    }
-    
-    public static CampPlatform getCampPlatform(ManagementContext mgmt) {
-        return CampInternalUtils.getCampPlatform(mgmt);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampInternalUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampInternalUtils.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampInternalUtils.java
deleted file mode 100644
index 9096168..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampInternalUtils.java
+++ /dev/null
@@ -1,247 +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.brooklyn.spi.creation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.objs.SpecParameter;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate.Builder;
-import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog.BrooklynLoaderTracker;
-import org.apache.brooklyn.core.objs.BasicSpecParameter;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal.ConfigurationSupportInternal;
-import org.apache.brooklyn.entity.stock.BasicApplicationImpl;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.yaml.Yamls;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-/** package-private; as {@link RegisteredType} becomes standard hopefully we can remove this */
-class CampInternalUtils {
-
-    static EntitySpec<? extends Application> createWrapperApp(AssemblyTemplate template, BrooklynClassLoadingContext loader) {
-        BrooklynComponentTemplateResolver resolver = BrooklynComponentTemplateResolver.Factory.newInstance(
-            loader, buildWrapperAppTemplate(template));
-        EntitySpec<Application> wrapperSpec = resolver.resolveSpec(ImmutableSet.<String>of());
-        resetSpecIfTemplateHasNoExplicitParameters(template, wrapperSpec);
-        // caller always sets WRAPPER_APP config; should we do it here?
-        return wrapperSpec;
-    }
-
-    static void resetSpecIfTemplateHasNoExplicitParameters(AssemblyTemplate template, EntitySpec<? extends Application> wrapperSpec) {
-        if (!template.getCustomAttributes().containsKey(BrooklynCampReservedKeys.BROOKLYN_PARAMETERS)) {
-            // Clear out default parameters (coming from the wrapper app's class) so they don't overwrite the entity's params on unwrap.
-            wrapperSpec.parameters(ImmutableList.<SpecParameter<?>>of());
-        }
-    }
-
-    private static AssemblyTemplate buildWrapperAppTemplate(AssemblyTemplate template) {
-        Builder<? extends AssemblyTemplate> builder = AssemblyTemplate.builder();
-        builder.type("brooklyn:" + BasicApplicationImpl.class.getName());
-        builder.id(template.getId());
-        builder.name(template.getName());
-        builder.sourceCode(template.getSourceCode());
-        for (Entry<String, Object> entry : template.getCustomAttributes().entrySet()) {
-            builder.customAttribute(entry.getKey(), entry.getValue());
-        }
-        builder.instantiator(template.getInstantiator());
-        AssemblyTemplate wrapTemplate = builder.build();
-        return wrapTemplate;
-    }
-
-    static AssemblyTemplateInstantiator getInstantiator(AssemblyTemplate at) {
-        try {
-            return at.getInstantiator().newInstance();
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    static AssemblyTemplate registerDeploymentPlan(String plan, BrooklynClassLoadingContext loader, CampPlatform camp) {
-        BrooklynLoaderTracker.setLoader(loader);
-        try {
-            return camp.pdp().registerDeploymentPlan(new StringReader(plan));
-        } finally {
-            BrooklynLoaderTracker.unsetLoader(loader);
-        }
-    }
-
-    static PolicySpec<?> createPolicySpec(String yamlPlan, BrooklynClassLoadingContext loader, Set<String> encounteredCatalogTypes) {
-        DeploymentPlan plan = makePlanFromYaml(loader.getManagementContext(), yamlPlan);
-
-        //Would ideally re-use the PolicySpecResolver
-        //but it is CAMP specific and there is no easy way to get hold of it.
-        Object policies = checkNotNull(plan.getCustomAttributes().get(BasicBrooklynCatalog.POLICIES_KEY), "policy config");
-        if (!(policies instanceof Iterable<?>)) {
-            throw new IllegalStateException("The value of " + BasicBrooklynCatalog.POLICIES_KEY + " must be an Iterable.");
-        }
-
-        Object policy = Iterables.getOnlyElement((Iterable<?>)policies);
-
-        return createPolicySpec(loader, policy, encounteredCatalogTypes);
-    }
-
-    @SuppressWarnings("unchecked")
-    static PolicySpec<?> createPolicySpec(BrooklynClassLoadingContext loader, Object policy, Set<String> encounteredCatalogTypes) {
-        Map<String, Object> itemMap;
-        if (policy instanceof String) {
-            itemMap = ImmutableMap.<String, Object>of("type", policy);
-        } else if (policy instanceof Map) {
-            itemMap = (Map<String, Object>) policy;
-        } else {
-            throw new IllegalStateException("Policy expected to be string or map. Unsupported object type " + policy.getClass().getName() + " (" + policy.toString() + ")");
-        }
-
-        String versionedId = (String) checkNotNull(Yamls.getMultinameAttribute(itemMap, "policy_type", "policyType", "type"), "policy type");
-        PolicySpec<? extends Policy> spec = resolvePolicySpec(versionedId, loader, encounteredCatalogTypes);
-        Map<String, Object> brooklynConfig = (Map<String, Object>) itemMap.get(BrooklynCampReservedKeys.BROOKLYN_CONFIG);
-        if (brooklynConfig != null) {
-            spec.configure(brooklynConfig);
-        }
-        List<?> parameters = (List<?>) itemMap.get(BrooklynCampReservedKeys.BROOKLYN_PARAMETERS);
-        initParameters(parameters, spec, loader);
-        return spec;
-    }
-
-    static LocationSpec<?> createLocationSpec(String yamlPlan, BrooklynClassLoadingContext loader, Set<String> encounteredTypes) {
-        DeploymentPlan plan = makePlanFromYaml(loader.getManagementContext(), yamlPlan);
-        Object locations = checkNotNull(plan.getCustomAttributes().get(BasicBrooklynCatalog.LOCATIONS_KEY), "location config");
-        if (!(locations instanceof Iterable<?>)) {
-            throw new IllegalStateException("The value of " + BasicBrooklynCatalog.LOCATIONS_KEY + " must be an Iterable.");
-        }
-
-        Object location = Iterables.getOnlyElement((Iterable<?>)locations);
-        return createLocationSpec(loader, location);
-    }
-
-    @SuppressWarnings("unchecked")
-    private static LocationSpec<?> createLocationSpec(BrooklynClassLoadingContext loader, Object location) {
-        Map<String, Object> itemMap;
-        if (location instanceof String) {
-            itemMap = ImmutableMap.<String, Object>of("type", location);
-        } else if (location instanceof Map) {
-            itemMap = (Map<String, Object>) location;
-        } else {
-            throw new IllegalStateException("Location expected to be string or map. Unsupported object type " + location.getClass().getName() + " (" + location.toString() + ")");
-        }
-
-        String type = (String) checkNotNull(Yamls.getMultinameAttribute(itemMap, "location_type", "locationType", "type"), "location type");
-        Map<String, Object> brooklynConfig = (Map<String, Object>) itemMap.get("brooklyn.config");
-        LocationSpec<?> locationSpec = resolveLocationSpec(type, brooklynConfig, loader);
-        List<?> explicitParams = (List<?>) itemMap.get(BrooklynCampReservedKeys.BROOKLYN_PARAMETERS);
-        initParameters(explicitParams, locationSpec, loader);
-        return locationSpec;
-    }
-
-    private static void initParameters(List<?> explicitParams, AbstractBrooklynObjectSpec<?, ?> spec, BrooklynClassLoadingContext loader) {
-        if (explicitParams != null) {
-            spec.parameters(BasicSpecParameter.fromConfigList(explicitParams, loader));
-        } else {
-            spec.parameters(BasicSpecParameter.fromSpec(loader.getManagementContext(), spec));
-        }
-    }
-
-    public static DeploymentPlan makePlanFromYaml(ManagementContext mgmt, String yaml) {
-        CampPlatform camp = getCampPlatform(mgmt);
-        return camp.pdp().parseDeploymentPlan(Streams.newReaderWithContents(yaml));
-    }
-
-    public static CampPlatform getCampPlatform(ManagementContext mgmt) {
-        CampPlatform result = mgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM);
-        if (result!=null) {
-            return result;
-        } else {
-            throw new IllegalStateException("No CAMP Platform is registered with this Brooklyn management context.");
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static PolicySpec<? extends Policy> resolvePolicySpec(
-            String versionedId,
-            BrooklynClassLoadingContext loader,
-            Set<String> encounteredCatalogTypes) {
-        
-        PolicySpec<? extends Policy> spec;
-        RegisteredType item = loader.getManagementContext().getTypeRegistry().get(versionedId);
-        if (item != null && !encounteredCatalogTypes.contains(item.getSymbolicName())) {
-            return loader.getManagementContext().getTypeRegistry().createSpec(item, null, PolicySpec.class);
-        } else {
-            // TODO-type-registry pass the loader in to the above, and allow it to load with the loader
-            spec = PolicySpec.create(loader.loadClass(versionedId, Policy.class));
-        }
-        return spec;
-    }
-
-    private static LocationSpec<?> resolveLocationSpec(
-            String type,
-            Map<String, Object> brooklynConfig,
-            BrooklynClassLoadingContext loader) {
-        Maybe<Class<? extends Location>> javaClass = loader.tryLoadClass(type, Location.class);
-        if (javaClass.isPresent()) {
-            LocationSpec<?> spec = LocationSpec.create(javaClass.get());
-            if (brooklynConfig != null) {
-                spec.configure(brooklynConfig);
-            }
-            return spec;
-        } else {
-            Maybe<Location> loc = loader.getManagementContext().getLocationRegistry().resolve(type, false, brooklynConfig);
-            if (loc.isPresent()) {
-                // TODO extensions?
-                Map<String, Object> locConfig = ((ConfigurationSupportInternal)loc.get().config()).getBag().getAllConfig();
-                Class<? extends Location> locType = loc.get().getClass();
-                Set<Object> locTags = loc.get().tags().getTags();
-                String locDisplayName = loc.get().getDisplayName();
-                return LocationSpec.create(locType)
-                        .configure(locConfig)
-                        .displayName(locDisplayName)
-                        .tags(locTags);
-            } else {
-                throw new IllegalStateException("No class or resolver found for location type "+type);
-            }
-        }
-    }
-
-}


[31/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
deleted file mode 100644
index cfa88d4..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ /dev/null
@@ -1,891 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.test.entity.TestEntityImpl;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-
-public class CatalogYamlEntityTest extends AbstractYamlTest {
-    
-    private static final String SIMPLE_ENTITY_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY;
-
-    @Test
-    public void testAddCatalogItemVerySimple() throws Exception {
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "  item:",
-            "    type: "+ BasicEntity.class.getName());
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        assertTrue(planYaml.indexOf("services:")>=0, "expected 'services:' block: "+item+"\n"+planYaml);
-
-        deleteCatalogEntity(symbolicName);
-    }
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogOSGiEntity(symbolicName);
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTypeAsString() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTypeExplicitTypeAsString() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  item_type: entity",
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelSyntax() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemWithoutVersion() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "unversioned.app";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  name: " + id,
-            "  libraries:",
-            "  - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: "+ SIMPLE_ENTITY_TYPE);
-        RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, BrooklynCatalog.DEFAULT_VERSION);
-        assertEquals(catalogItem.getVersion(), "0.0.0.SNAPSHOT");
-        mgmt().getCatalog().deleteCatalogItem(id, "0.0.0.SNAPSHOT");
-    }
-
-    @Test
-    public void testAddCatalogItemWithInlinedVersion() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "inline_version.app";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  name: " + id+":"+TEST_VERSION,
-            "  libraries:",
-            "  - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, TEST_VERSION);
-        assertEquals(catalogItem.getVersion(), TEST_VERSION);
-        mgmt().getCatalog().deleteCatalogItem(id, TEST_VERSION);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.launch";
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-    }
-
-    @Test
-    public void testLaunchApplicationUnversionedCatalogReference() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.fail";
-        addCatalogOSGiEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-        try {
-            String yaml = "name: simple-app-yaml\n" +
-                          "location: localhost\n" +
-                          "services: \n" +
-                          "  - serviceType: " + symbolicName;
-            createAndStartApplication(yaml);
-        } finally {
-            deleteCatalogEntity(symbolicName);
-        }
-    }
-
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.referring";
-        addCatalogOSGiEntities(referencedSymbolicName, SIMPLE_ENTITY_TYPE, referrerSymbolicName, ver(referencedSymbolicName));
-
-        RegisteredType referrer = mgmt().getTypeRegistry().get(referrerSymbolicName, TEST_VERSION);
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(referrer);
-        Assert.assertTrue(planYaml.indexOf("services")>=0, "expected services in: "+planYaml);
-        
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - type: " + ver(referrerSymbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalogInTwoSteps() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogOSGiEntity(referrerSymbolicName, ver(referencedSymbolicName));
-
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - serviceType: " + ver(referrerSymbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildWithCatalogReferencingOtherCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.child.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogChildOSGiEntity(referrerSymbolicName, ver(referencedSymbolicName));
-
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services:",
-            "- type: "+BasicEntity.class.getName(),
-            "  brooklyn.children:",
-            "  - type: " + ver(referrerSymbolicName));
-
-        Collection<Entity> children = app.getChildren();
-        assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandChildren = child.getChildren();
-        assertEquals(grandChildren.size(), 1);
-        Entity grandChild = Iterables.getOnlyElement(grandChildren);
-        assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandGrandChildren = grandChild.getChildren();
-        assertEquals(grandGrandChildren.size(), 1);
-        Entity grandGrandChild = Iterables.getOnlyElement(grandGrandChildren);
-        assertEquals(grandGrandChild.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildWithCatalogReferencingOtherCatalogServicesBlock() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.child.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogChildOSGiEntityWithServicesBlock(referrerSymbolicName, ver(referencedSymbolicName));
-
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services:",
-            "- serviceType: "+BasicEntity.class.getName(),
-            "  brooklyn.children:",
-            "  - type: " + ver(referrerSymbolicName));
-
-        Collection<Entity> children = app.getChildren();
-        assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandChildren = child.getChildren();
-        assertEquals(grandChildren.size(), 1);
-        Entity grandChild = Iterables.getOnlyElement(grandChildren);
-        assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandGrandChildren = grandChild.getChildren();
-        assertEquals(grandGrandChildren.size(), 1);
-        Entity grandGrandChild = Iterables.getOnlyElement(grandGrandChildren);
-        assertEquals(grandGrandChild.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-    
-    @Test
-    public void testLaunchApplicationWithTypeUsingJavaColonPrefix() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = SIMPLE_ENTITY_TYPE;
-        String serviceName = "java:"+SIMPLE_ENTITY_TYPE;
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, serviceName);
-    }
-
-    @Test
-    public void testLaunchApplicationLoopWithJavaTypeName() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = SIMPLE_ENTITY_TYPE;
-        String serviceName = SIMPLE_ENTITY_TYPE;
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, serviceName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildLoopCatalogIdFails() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        try {
-            // TODO only fails if using 'services', because that forces plan parsing; should fail in all cases
-            addCatalogChildOSGiEntityWithServicesBlock(referrerSymbolicName, ver(referrerSymbolicName));
-            fail("Expected to throw");
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            assertTrue(e.getMessage().contains(referrerSymbolicName), "message was: "+e);
-        }
-    }
-
-    @Test
-    public void testReferenceInstalledBundleByName() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String firstItemId = "my.catalog.app.id.register_bundle";
-        String secondItemId = "my.catalog.app.id.reference_bundle";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + firstItemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        deleteCatalogEntity(firstItemId);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + secondItemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
-            "    version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(secondItemId);
-    }
-
-    @Test
-    public void testReferenceNonInstalledBundledByNameFails() {
-        String nonExistentId = "none-existent-id";
-        String nonExistentVersion = "9.9.9";
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: " + nonExistentId,
-                "    version: " + nonExistentVersion,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (IllegalStateException e) {
-            Assert.assertEquals(e.getMessage(), "Bundle from null failed to install: Bundle CatalogBundleDto{symbolicName=" + nonExistentId + ", version=" + nonExistentVersion + ", url=null} not previously registered, but URL is empty.");
-        }
-    }
-
-    @Test
-    public void testPartialBundleReferenceFails() {
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: io.brooklyn.brooklyn-test-osgi-entities",
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (NullPointerException e) {
-            Assert.assertEquals(e.getMessage(), "both name and version are required");
-        }
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (NullPointerException e) {
-            Assert.assertEquals(e.getMessage(), "both name and version are required");
-        }
-    }
-
-    @Test
-    public void testFullBundleReference() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String itemId = "my.catalog.app.id.full_ref";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + itemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
-            "    version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-            "    url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        deleteCatalogEntity(itemId);
-    }
-
-    /**
-     * Test that the name:version contained in the OSGi bundle will
-     * override the values supplied in the YAML.
-     */
-    @Test
-    public void testFullBundleReferenceUrlMetaOverridesLocalNameVersion() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String firstItemId = "my.catalog.app.id.register_bundle";
-        String nonExistentId = "non_existent_id";
-        String nonExistentVersion = "9.9.9";
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + firstItemId,
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: " + nonExistentId,
-                "    version: " + nonExistentVersion,
-                "    url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (IllegalStateException e) {
-            assertEquals(e.getMessage(), "Bundle from " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL + " failed to install: " +
-                    "Bundle already installed as " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME + ":" +
-                    OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION + " but user explicitly requested " +
-                    "CatalogBundleDto{symbolicName=" + nonExistentId + ", version=" + nonExistentVersion + ", url=" +
-                    OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL + "}");
-        }
-    }
-
-    @Test
-    public void testUpdatingItemAllowedIfSame() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        addCatalogOSGiEntity(id);
-    }
-    
-    @Test(expectedExceptions = IllegalStateException.class)
-    public void testUpdatingItemFailsIfDifferent() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        addCatalogOSGiEntity(id, SIMPLE_ENTITY_TYPE, true);
-    }
-
-    @Test
-    public void testForcedUpdatingItem() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        forceCatalogUpdate();
-        addCatalogOSGiEntity(id);
-        deleteCatalogEntity(id);
-    }
-
-    @Test
-    public void testCreateSpecFromCatalogItem() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.create_spec";
-        addCatalogOSGiEntity(id);
-        BrooklynTypeRegistry catalog = mgmt().getTypeRegistry();
-        RegisteredType item = catalog.get(id, TEST_VERSION);
-        EntitySpec<?> spec = catalog.createSpec(item, null, EntitySpec.class);
-        Assert.assertNotNull(spec);
-        AbstractBrooklynObjectSpec<?,?> spec2 = catalog.createSpec(item, null, null);
-        Assert.assertNotNull(spec2);
-    }
-    
-    @Test
-    public void testLoadResourceFromBundle() throws Exception {
-        String id = "resource.test";
-        addCatalogOSGiEntity(id, SIMPLE_ENTITY_TYPE);
-        String yaml =
-                "services: \n" +
-                "  - serviceType: "+ver(id);
-        Entity app = createAndStartApplication(yaml);
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        InputStream icon = new ResourceUtils(simpleEntity).getResourceFromUrl("classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif");
-        assertTrue(icon != null);
-        icon.close();
-    }
-    
-    @Test
-    public void testMissingTypeDoesNotRecurse() {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "",
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName,
-                    "  version: " + TEST_VERSION + "-update",
-                    "",
-                    "services:",
-                    "- type: " + symbolicName);
-            fail("Catalog addition expected to fail due to non-existent java type " + symbolicName);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-    
-    @Test
-    public void testVersionedTypeDoesNotRecurse() {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "",
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        String versionedId = CatalogUtils.getVersionedId(symbolicName, TEST_VERSION);
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  version: " + TEST_VERSION + "-update",
-                "",
-                "services:",
-                "- type: " + versionedId);
-            fail("Catalog addition expected to fail due to non-existent java type " + versionedId);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testIndirectRecursionFails() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        // Need to have a stand alone caller first so we can create an item to depend on it.
-        // After that replace it/insert a new version which completes the cycle
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".caller",
-                "  version: " + TEST_VERSION + "pre",
-                "",
-                "services:",
-                "- type: "+BasicEntity.class.getName());
-
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".callee",
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: " + symbolicName + ".caller");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName + ".caller",
-                    "  version: " + TEST_VERSION,
-                    "",
-                    "services:",
-                    "- type: " + symbolicName + ".callee");
-            fail();
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testChildItemsDoNotRecurse() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        // Need to have a stand alone caller first so we can create an item to depend on it.
-        // After that replace it/insert a new version which completes the cycle
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".caller",
-                "  version: " + TEST_VERSION + "pre",
-                "",
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".callee",
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: " + symbolicName + ".caller");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName + ".caller",
-                    "  version: " + TEST_VERSION,
-                    "",
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-                    // Being a child is important, triggers the case where
-                    // we allow retrying with other transformers.
-                    "  brooklyn.children:",
-                    "  - type: " + symbolicName + ".callee");
-            fail();
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testRecursiveCheckForDepenentsOnly() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        createAndStartApplication(
-                "services:",
-                "- type: " + ver(symbolicName),
-                "  brooklyn.children:",
-                "  - type: " + ver(symbolicName),
-                "- type: " + ver(symbolicName),
-                "  brooklyn.children:",
-                "  - type: " + ver(symbolicName));
-    }
-
-    @Test
-    public void testOsgiNotLeakingToParent() {
-        addCatalogOSGiEntity(SIMPLE_ENTITY_TYPE);
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + SIMPLE_ENTITY_TYPE,
-                    "  version: " + TEST_VERSION + "-update",
-                    "",
-                    "services:",
-                    "- type: " + SIMPLE_ENTITY_TYPE);
-            fail("Catalog addition expected to fail due to non-existent java type " + SIMPLE_ENTITY_TYPE);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testConfigAppliedToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.config:",
-                "    test.confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testFlagsAppliesToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testExplicitFlagsAppliesToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.flags:",
-                "    confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-    
-
-    @Test
-    public void testConfigAppliedToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.config:",
-                "    test.confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testFlagsAppliesToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testExplicitFlagsAppliesToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.flags:",
-                "    confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testHardcodedCatalog() throws Exception {
-        createAppEntitySpec(
-                "services:",
-                "- type: cluster",
-                "- type: vanilla");
-    }
-
-    private void registerAndLaunchAndAssertSimpleEntity(String symbolicName, String serviceType) throws Exception {
-        addCatalogOSGiEntity(symbolicName, serviceType);
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - serviceType: "+ver(symbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    private void addCatalogOSGiEntity(String symbolicName) {
-        addCatalogOSGiEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-    }
-
-    private void addCatalogOSGiEntity(String symbolicName, String serviceType) {
-        addCatalogOSGiEntity(symbolicName, serviceType, false);
-    }
-    
-    private void addCatalogOSGiEntity(String symbolicName, String serviceType, boolean extraLib) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL +
-            (extraLib ? "\n"+"  - url: "+OsgiStandaloneTest.BROOKLYN_OSGI_TEST_A_0_1_0_URL : ""),
-            "  item:",
-            "    type: " + serviceType);
-    }
-
-    private void addCatalogOSGiEntities(String ...namesAndTypes) {
-        List<String> lines = MutableList.of(
-            "brooklyn.catalog:",
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  items:");
-        
-        for (int i=0; i<namesAndTypes.length; i+=2) {
-            lines.addAll(MutableList.of(
-            "  - id: " + namesAndTypes[i],
-            "    item:",
-            "      type: " + namesAndTypes[i+1]));
-        }
-            
-        addCatalogItems(lines);
-    }
-    private void addCatalogChildOSGiEntityWithServicesBlock(String symbolicName, String serviceType) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    services:",
-            "    - type: " + BasicEntity.class.getName(),
-            "      brooklyn.children:",
-            "      - type: " + serviceType);
-    }
-    private void addCatalogChildOSGiEntity(String symbolicName, String serviceType) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: " + BasicEntity.class.getName(),
-            "    brooklyn.children:",
-            "    - type: " + serviceType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
deleted file mode 100644
index f792d65..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
+++ /dev/null
@@ -1,253 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.text.StringFunctions;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class CatalogYamlLocationTest extends AbstractYamlTest {
-    private static final String LOCALHOST_LOCATION_SPEC = "localhost";
-    private static final String LOCALHOST_LOCATION_TYPE = LocalhostMachineProvisioningLocation.class.getName();
-    private static final String SIMPLE_LOCATION_TYPE = "org.apache.brooklyn.test.osgi.entities.SimpleLocation";
-
-    @AfterMethod
-    public void tearDown() {
-        for (RegisteredType ci : mgmt().getTypeRegistry().getMatching(RegisteredTypePredicates.IS_LOCATION)) {
-            mgmt().getCatalog().deleteCatalogItem(ci.getSymbolicName(), ci.getVersion());
-        }
-    }
-    
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        assertAdded(symbolicName, LOCALHOST_LOCATION_TYPE);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemOsgi() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocation(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        assertAdded(symbolicName, SIMPLE_LOCATION_TYPE);
-        assertOsgi(symbolicName);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelItemSyntax() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        assertAdded(symbolicName, LOCALHOST_LOCATION_TYPE);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemOsgiTopLevelItemSyntax() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        assertAdded(symbolicName, SIMPLE_LOCATION_TYPE);
-        assertOsgi(symbolicName);
-        removeAndAssert(symbolicName);
-    }
-
-    private void assertOsgi(String symbolicName) {
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        Collection<OsgiBundleWithUrl> libs = item.getLibraries();
-        assertEquals(libs.size(), 1);
-        assertEquals(Iterables.getOnlyElement(libs).getUrl(), Iterables.getOnlyElement(getOsgiLibraries()));
-    }
-
-    @SuppressWarnings({ "rawtypes" })
-    private void assertAdded(String symbolicName, String expectedJavaType) {
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        Assert.assertTrue(RegisteredTypes.isSubtypeOf(item, Location.class), "Expected Location, not "+item.getSuperTypes());
-        assertEquals(countCatalogLocations(), 1);
-
-        // Item added to catalog should automatically be available in location registry
-        LocationDefinition def = mgmt().getLocationRegistry().getDefinedLocationByName(symbolicName);
-        assertEquals(def.getId(), symbolicName);
-        assertEquals(def.getName(), symbolicName);
-        
-        LocationSpec spec = (LocationSpec) mgmt().getTypeRegistry().createSpec(item, null, LocationSpec.class);
-        assertEquals(spec.getType().getName(), expectedJavaType);
-    }
-    
-    private void removeAndAssert(String symbolicName) {
-        // Deleting item: should be gone from catalog, and from location registry
-        deleteCatalogEntity(symbolicName);
-
-        assertEquals(countCatalogLocations(), 0);
-        assertNull(mgmt().getLocationRegistry().getDefinedLocationByName(symbolicName));
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationClass() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationSpec() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_SPEC, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationClassTopLevelItemSyntax() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationSpecTopLevelSyntax() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_SPEC, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingOsgiLocation() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        runLaunchApplicationReferencingLocation(symbolicName, SIMPLE_LOCATION_TYPE);
-        
-        deleteCatalogEntity(symbolicName);
-    }
-    
-    protected void runLaunchApplicationReferencingLocation(String locTypeInYaml, String locType) throws Exception {
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: ",
-            "  "+locTypeInYaml+":",
-            "    config2: config2 override",
-            "    config3: config3",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicStartable");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Location location = Iterables.getOnlyElement(Entities.getAllInheritedLocations(simpleEntity));
-        assertEquals(location.getClass().getName(), locType);
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-    }
-
-    private List<String> getOsgiLibraries() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        return ImmutableList.of(OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL);
-    }
-    
-    private void addCatalogLocation(String symbolicName, String locationType, List<String> libraries) {
-        ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  name: My Catalog Location",
-                "  description: My description",
-                "  version: " + TEST_VERSION);
-        if (libraries!=null && libraries.size() > 0) {
-            yaml.add("  libraries:")
-                .addAll(Lists.transform(libraries, StringFunctions.prepend("  - url: ")));
-        }
-        yaml.add(
-                "  item.type: location",
-                "  item:",
-                "    type: " + locationType,
-                "    brooklyn.config:",
-                "      config1: config1",
-                "      config2: config2");
-        
-        
-        addCatalogItems(yaml.build());
-    }
-
-    private void addCatalogLocationTopLevelItemSyntax(String symbolicName, String locationType, List<String> libraries) {
-        ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  name: My Catalog Location",
-                "  description: My description",
-                "  version: " + TEST_VERSION);
-        if (libraries!=null && libraries.size() > 0) {
-            yaml.add("  libraries:")
-                .addAll(Lists.transform(libraries, StringFunctions.prepend("  - url: ")));
-        }
-        yaml.add(
-                "",
-                "brooklyn.locations:",
-                "- type: " + locationType,
-                "  brooklyn.config:",
-                "    config1: config1",
-                "    config2: config2");
-        
-        
-        addCatalogItems(yaml.build());
-    }
-
-    private int countCatalogLocations() {
-        return Iterables.size(mgmt().getTypeRegistry().getMatching(RegisteredTypePredicates.IS_LOCATION));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
deleted file mode 100644
index fbfe630..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
+++ /dev/null
@@ -1,195 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-public class CatalogYamlPolicyTest extends AbstractYamlTest {
-    private static final String SIMPLE_POLICY_TYPE = "org.apache.brooklyn.test.osgi.entities.SimplePolicy";
-    private static final String SIMPLE_ENTITY_TYPE = "org.apache.brooklyn.test.osgi.entities.SimpleEntity";
-
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        assertEquals(countCatalogPolicies(), 0);
-
-        String symbolicName = "my.catalog.policy.id.load";
-        addCatalogOsgiPolicy(symbolicName, SIMPLE_POLICY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        assertEquals(countCatalogPolicies(), 1);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelSyntax() throws Exception {
-        assertEquals(countCatalogPolicies(), 0);
-
-        String symbolicName = "my.catalog.policy.id.load";
-        addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        assertEquals(countCatalogPolicies(), 1);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingPolicy() throws Exception {
-        String symbolicName = "my.catalog.policy.id.launch";
-        addCatalogOsgiPolicy(symbolicName, SIMPLE_POLICY_TYPE);
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicEntity\n" +
-            "    brooklyn.policies:\n" +
-            "    - type: " + ver(symbolicName),
-            "      brooklyn.config:",
-            "        config2: config2 override",
-            "        config3: config3");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingPolicyTopLevelSyntax() throws Exception {
-        String symbolicName = "my.catalog.policy.id.launch";
-        addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicEntity\n" +
-            "    brooklyn.policies:\n" +
-            "    - type: " + ver(symbolicName),
-            "      brooklyn.config:",
-            "        config2: config2 override",
-            "        config3: config3");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-
-        deleteCatalogEntity(symbolicName);
-    }
-    
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalog() throws Exception {
-        String referencedSymbolicName = "my.catalog.policy.id.referenced";
-        String referrerSymbolicName = "my.catalog.policy.id.referring";
-        addCatalogOsgiPolicy(referencedSymbolicName, SIMPLE_POLICY_TYPE);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + referrerSymbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE,
-            "  brooklyn.policies:",
-            "  - type: " + ver(referencedSymbolicName));
-
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "- type: "+ ver(referrerSymbolicName);
-
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-    }
-
-    private void addCatalogOsgiPolicy(String symbolicName, String policyType) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog Policy",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: " + policyType,
-            "    brooklyn.config:",
-            "      config1: config1",
-            "      config2: config2");
-    }
-
-    private void addCatalogOsgiPolicyTopLevelSyntax(String symbolicName, String policyType) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog Policy",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "brooklyn.policies:",
-            "- type: " + policyType,
-            "  brooklyn.config:",
-            "    config1: config1",
-            "    config2: config2");
-    }
-
-    private int countCatalogPolicies() {
-        return Iterables.size(mgmt().getCatalog().getCatalogItems(CatalogPredicates.IS_POLICY));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
deleted file mode 100644
index 989bdb3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
+++ /dev/null
@@ -1,343 +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.brooklyn.catalog;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore.StoreObjectAccessor;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.test.policy.TestEnricher;
-import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.Strings;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
-
-    // TODO Other tests (relating to https://issues.apache.org/jira/browse/BROOKLYN-149) include:
-    //   - entities cannot be instantiated because class no longer on classpath (e.g. was OSGi)
-    //   - config/attribute cannot be instantiated (e.g. because class no longer on classpath)
-    //   - entity file corrupt
-    
-    enum RebindWithCatalogTestMode {
-        NO_OP,
-        STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM,
-        DEPRECATE_CATALOG,
-        DISABLE_CATALOG,
-        DELETE_CATALOG,
-        REPLACE_CATALOG_WITH_NEWER_VERSION;
-    }
-    
-    @Test
-    public void testRebindWithCatalogAndApp() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.NO_OP);
-    }
-    
-    @Test
-    public void testRebindWithCatalogDeprecatedAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DEPRECATE_CATALOG);
-    }
-    
-    @Test
-    public void testRebindWithCatalogDisabledAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DISABLE_CATALOG);
-    }
-    
-    // See https://issues.apache.org/jira/browse/BROOKLYN-149.
-    // Deletes the catalog item before rebind, but the referenced types are still on the 
-    // default classpath.
-    // Will fallback to loading from classpath.
-    @Test
-    public void testRebindWithCatalogDeletedAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DELETE_CATALOG);
-    }
-    
-    // Upgrades the catalog item before rebind, deleting the old version.
-    // Will automatically upgrade.
-    @Test
-    public void testRebindWithCatalogUpgradedWithOldDeletedAndAppExisting() throws Exception {
-        BrooklynFeatureEnablement.enable(BrooklynFeatureEnablement.FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND);
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.REPLACE_CATALOG_WITH_NEWER_VERSION);
-    }
-    
-    /**
-     * Old persisted state for catalog items may not have a "deprecated" or "disabled"
-     * value. Need to check that their absence will default to false.
-     */
-    @Test
-    public void testRebindWithCatalogPropertiesForDeprecationAndEnablementAbsent() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM);
-    }
-
-    @SuppressWarnings({ "unused", "deprecation" })
-    protected void runRebindWithCatalogAndApp(RebindWithCatalogTestMode mode) throws Exception {
-        String appSymbolicName = "my.catalog.app.id.load";
-        String appVersion = "0.1.0";
-        String appCatalogFormat = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: " + appSymbolicName,
-                "  version: %s",
-                "  item:",
-                "    type: "+ BasicEntity.class.getName(),
-                "    brooklyn.enrichers:",
-                "    - type: "+TestEnricher.class.getName(),
-                "    brooklyn.policies:",
-                "    - type: "+TestPolicy.class.getName());
-        
-        String locSymbolicName = "my.catalog.loc.id.load";
-        String locVersion = "1.0.0";
-        String locCatalogFormat = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: " + locSymbolicName,
-                "  version: %s",
-                "  item.type: location",
-                "  item:",
-                "    type: localhost");
-        
-        // Create the catalog items
-        CatalogItem<?, ?> appItem = Iterables.getOnlyElement(addCatalogItems(String.format(appCatalogFormat, appVersion)));
-        CatalogItem<?, ?> locItem = Iterables.getOnlyElement(addCatalogItems(String.format(locCatalogFormat, locVersion)));
-        final String appItemId = appItem.getId();
-        final String locItemId = locItem.getId();
-        
-        // Create an app, using that catalog item
-        String yaml = "name: simple-app-yaml\n" +
-                "location: \"brooklyn.catalog:"+CatalogUtils.getVersionedId(locSymbolicName, locVersion)+"\"\n" +
-                "services: \n" +
-                "- type: "+CatalogUtils.getVersionedId(appSymbolicName, appVersion);
-        origApp = (StartableApplication) createAndStartApplication(yaml);
-        BasicEntity origEntity = (BasicEntity) Iterables.getOnlyElement(origApp.getChildren());
-        TestPolicy origPolicy = (TestPolicy) Iterables.getOnlyElement(origEntity.policies());
-        TestEnricher origEnricher = (TestEnricher) Iterables.tryFind(origEntity.enrichers(), Predicates.instanceOf(TestEnricher.class)).get();
-        assertEquals(origEntity.getCatalogItemId(), appSymbolicName+":"+appVersion);
-
-        // Depending on test-mode, delete the catalog item, and then rebind
-        switch (mode) {
-            case DEPRECATE_CATALOG:
-                CatalogUtils.setDeprecated(mgmt(), appSymbolicName, appVersion, true);
-                CatalogUtils.setDeprecated(mgmt(), locSymbolicName, locVersion, true);
-                break;
-            case DISABLE_CATALOG:
-                CatalogUtils.setDisabled(mgmt(), appSymbolicName, appVersion, true);
-                CatalogUtils.setDisabled(mgmt(), locSymbolicName, locVersion, true);
-                break;
-            case DELETE_CATALOG:
-                mgmt().getCatalog().deleteCatalogItem(appSymbolicName, appVersion);
-                mgmt().getCatalog().deleteCatalogItem(locSymbolicName, locVersion);
-                break;
-            case REPLACE_CATALOG_WITH_NEWER_VERSION:
-                mgmt().getCatalog().deleteCatalogItem(appSymbolicName, appVersion);
-                mgmt().getCatalog().deleteCatalogItem(locSymbolicName, locVersion);
-                appVersion = "0.2.0";
-                locVersion = "1.1.0";
-                addCatalogItems(String.format(appCatalogFormat, appVersion));
-                addCatalogItems(String.format(locCatalogFormat, locVersion));
-                break;
-            case STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM:
-                // set everything false -- then below we rebind with these fields removed to ensure that we can rebind
-                CatalogUtils.setDeprecated(mgmt(), appSymbolicName, appVersion, false);
-                CatalogUtils.setDeprecated(mgmt(), locSymbolicName, locVersion, false);
-                CatalogUtils.setDisabled(mgmt(), appSymbolicName, appVersion, false);
-                CatalogUtils.setDisabled(mgmt(), locSymbolicName, locVersion, false);
-                break;
-            case NO_OP:
-                break; // no-op
-            default:
-                throw new IllegalStateException("Unknown mode: "+mode);
-        }
-
-        // Rebind
-        if (mode == RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM) {
-            // Edit the persisted state to remove the "deprecated" and "enablement" tags for our catalog items
-            rebind(RebindOptions.create()
-                    .stateTransformer(new Function<BrooklynMementoPersister, Void>() {
-                        @Override public Void apply(BrooklynMementoPersister input) {
-                            PersistenceObjectStore objectStore = ((BrooklynMementoPersisterToObjectStore)input).getObjectStore();
-                            StoreObjectAccessor appItemAccessor = objectStore.newAccessor("catalog/"+Strings.makeValidFilename(appItemId));
-                            StoreObjectAccessor locItemAccessor = objectStore.newAccessor("catalog/"+Strings.makeValidFilename(locItemId));
-                            String appItemMemento = checkNotNull(appItemAccessor.get(), "appItem in catalog");
-                            String locItemMemento = checkNotNull(locItemAccessor.get(), "locItem in catalog");
-                            String newAppItemMemento = removeFromXml(appItemMemento, ImmutableList.of("catalogItem/deprecated", "catalogItem/disabled"));
-                            String newLocItemMemento = removeFromXml(locItemMemento, ImmutableList.of("catalogItem/deprecated", "catalogItem/disabled"));
-                            appItemAccessor.put(newAppItemMemento);
-                            locItemAccessor.put(newLocItemMemento);
-                            return null;
-                        }}));
-        } else {
-            rebind();
-        }
-
-        // Ensure app is still there, and that it is usable - e.g. "stop" effector functions as expected
-        BasicEntity newEntity = (BasicEntity) Iterables.getOnlyElement(newApp.getChildren());
-        Policy newPolicy = Iterables.getOnlyElement(newEntity.policies());
-        Enricher newEnricher = Iterables.tryFind(newEntity.enrichers(), Predicates.instanceOf(TestEnricher.class)).get();
-        assertEquals(newEntity.getCatalogItemId(), appSymbolicName+":"+appVersion);
-
-        newApp.stop();
-        assertFalse(Entities.isManaged(newApp));
-        assertFalse(Entities.isManaged(newEntity));
-        
-        // Ensure catalog item is as expecpted
-        RegisteredType newAppItem = mgmt().getTypeRegistry().get(appSymbolicName, appVersion);
-        RegisteredType newLocItem = mgmt().getTypeRegistry().get(locSymbolicName, locVersion);
-
-        boolean itemDeployable;
-        switch (mode) {
-        case DISABLE_CATALOG:
-            assertTrue(newAppItem.isDisabled());
-            assertTrue(newLocItem.isDisabled());
-            itemDeployable = false;
-            break;
-        case DELETE_CATALOG:
-            assertNull(newAppItem);
-            assertNull(newLocItem);
-            itemDeployable = false;
-            break;
-        case DEPRECATE_CATALOG:
-            assertTrue(newAppItem.isDeprecated());
-            assertTrue(newLocItem.isDeprecated());
-            itemDeployable = true;
-            break;
-        case NO_OP:
-        case STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM:
-        case REPLACE_CATALOG_WITH_NEWER_VERSION:
-            assertNotNull(newAppItem);
-            assertNotNull(newLocItem);
-            assertFalse(newAppItem.isDeprecated());
-            assertFalse(newAppItem.isDisabled());
-            assertFalse(newLocItem.isDeprecated());
-            assertFalse(newLocItem.isDisabled());
-            itemDeployable = true;
-            break;
-        default:
-            throw new IllegalStateException("Unknown mode: "+mode);
-        }
-
-        // Try to deploy a new app
-        String yaml2 = "name: simple-app-yaml2\n" +
-                "location: \"brooklyn.catalog:"+CatalogUtils.getVersionedId(locSymbolicName, locVersion)+"\"\n" +
-                "services: \n" +
-                "- type: "+CatalogUtils.getVersionedId(appSymbolicName, appVersion);
-
-        if (itemDeployable) {
-            StartableApplication app2 = (StartableApplication) createAndStartApplication(yaml2);
-            BasicEntity entity2 = (BasicEntity) Iterables.getOnlyElement(app2.getChildren());
-            assertEquals(entity2.getCatalogItemId(), appSymbolicName+":"+appVersion);
-        } else {
-            try {
-                StartableApplication app2 = (StartableApplication) createAndStartApplication(yaml2);
-                fail();
-            } catch (Exception e) {
-                if (mode == RebindWithCatalogTestMode.DELETE_CATALOG) {
-                    if (!e.toString().contains("cannot be matched")) throw e;
-                } else {
-                    assertEquals(mode, RebindWithCatalogTestMode.DISABLE_CATALOG);
-                    if (!e.toString().contains("cannot be matched")) throw e;
-                }
-            }
-        }
-    }
-    
-    /**
-     * Given the "/"-separated path for the elements to be removed, it removes these from the xml
-     * and returns the transformed XML.
-     */
-    private String removeFromXml(String xml, List<String> elementsToRemove) {
-        try {
-            InputSource source = new InputSource(new StringReader(xml));
-            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(source);
-
-            for (String elementToRemove : elementsToRemove) {
-                Node current = null;
-                boolean first = true;
-                for (String tag : elementToRemove.split("/")) {
-                    NodeList matches;
-                    if (first) {
-                        matches = doc.getElementsByTagName(tag);
-                        first = false;
-                    } else {
-                        matches = ((Element)current).getElementsByTagName(tag);
-                    }
-                    if (matches.getLength() > 0) {
-                        current = matches.item(0);
-                    } else {
-                        current = null;
-                        break;
-                    }
-                }
-                if (current != null) {
-                    current.getParentNode().removeChild(current);
-                }
-            }
-          
-            DOMSource domSource = new DOMSource(doc);
-            StringWriter writer = new StringWriter();
-            StreamResult result = new StreamResult(writer);
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            transformer.transform(domSource, result);
-            
-            return writer.toString();
-          
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-}


[12/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/ConcurrentMapAcceptingNullVals.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/ConcurrentMapAcceptingNullVals.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/ConcurrentMapAcceptingNullVals.java
deleted file mode 100644
index c0d02c2..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/ConcurrentMapAcceptingNullVals.java
+++ /dev/null
@@ -1,272 +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.core.internal.storage.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.annotation.Nullable;
-
-/**
- * A decorator for a ConcurrentMap that allows null values to be used.
- * 
- * However, {@link #values()} and {@link #entrySet()} return immutable snapshots
- * of the map's contents. This may be revisited in a future version.
- * 
- * @author aled
- */
-public class ConcurrentMapAcceptingNullVals<K, V> implements ConcurrentMap<K, V> {
-
-    private static enum Marker {
-        NULL;
-    }
-    
-    private final ConcurrentMap<K, V> delegate;
-
-    public ConcurrentMapAcceptingNullVals(ConcurrentMap<K,V> delegate) {
-        this.delegate = checkNotNull(delegate, "delegate");
-    }
-    
-    @Override
-    public void clear() {
-        delegate.clear();
-    }
-
-    @Override
-    public boolean containsKey(Object key) {
-        return delegate.containsKey(key);
-    }
-
-    @Override
-    public boolean containsValue(Object value) {
-        return delegate.containsValue(toNonNullValue(value));
-    }
-
-    @Override
-    public Set<Map.Entry<K, V>> entrySet() {
-        // Note that returns an immutable snapshot
-        Set<Map.Entry<K, V>> result = new LinkedHashSet<Map.Entry<K, V>>(delegate.size());
-        for (Map.Entry<K, V> entry : delegate.entrySet()) {
-            result.add(new AbstractMap.SimpleEntry<K,V>(entry.getKey(), (V)fromNonNullValue(entry.getValue())));
-        }
-        return Collections.unmodifiableSet(result);
-    }
-
-    @Override
-    public Collection<V> values() {
-        // Note that returns an immutable snapshot
-        List<V> result = new ArrayList<V>(delegate.size());
-        for (V v : delegate.values()) {
-            result.add((V)fromNonNullValue(v));
-        }
-        return Collections.unmodifiableCollection(result);
-    }
-
-    @Override
-    public Set<K> keySet() {
-        return delegate.keySet();
-    }
-
-    @Override
-    public V get(Object key) {
-        return (V) fromNonNullValue(delegate.get(key));
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return delegate.isEmpty();
-    }
-
-    @Override
-    public V put(K key, V value) {
-        return (V) fromNonNullValue(delegate.put(key, (V) toNonNullValue(value)));
-    }
-
-    @Override
-    public void putAll(Map<? extends K, ? extends V> vals) {
-        for (Map.Entry<? extends K, ? extends V> entry : vals.entrySet()) {
-            put(entry.getKey(), entry.getValue());
-        }
-    }
-
-    @Override
-    public V remove(Object key) {
-        return (V) fromNonNullValue(delegate.remove(key));
-    }
-
-    @Override
-    public int size() {
-        return delegate.size();
-    }
-
-    @Override
-    public V putIfAbsent(K key, V value) {
-        return (V) fromNonNullValue(delegate.putIfAbsent(key, (V) toNonNullValue(value)));
-    }
-
-    @Override
-    public boolean remove(Object key, Object value) {
-        return delegate.remove(key, (V) toNonNullValue(value));
-    }
-
-    @Override
-    public V replace(K key, V value) {
-        return (V) fromNonNullValue(delegate.replace(key, (V) toNonNullValue(value)));
-    }
-
-    @Override
-    public boolean replace(K key, V oldValue, V newValue) {
-        return delegate.replace(key, (V) toNonNullValue(oldValue), (V) toNonNullValue(newValue));
-    }
-    
-    private static class SetWithNullVals<T> implements Set<T> {
-
-        private final Set<T> delegate;
-        
-        public SetWithNullVals(Set<T> delegate) {
-            this.delegate = delegate;
-        }
-        
-        @Override
-        public boolean add(T e) {
-            return delegate.add(e); // unsupported; let delegate give exception
-        }
-
-        @Override
-        public boolean addAll(Collection<? extends T> c) {
-            return delegate.addAll(c); // unsupported; let delegate give exception
-        }
-
-        @Override
-        public void clear() {
-            delegate.clear();
-        }
-
-        @Override
-        public boolean contains(Object o) {
-            return delegate.contains(toNonNullValue(o));
-        }
-
-        @Override
-        public boolean containsAll(Collection<?> c) {
-            for (Object e : c) {
-                if (!delegate.contains(toNonNullValue(e))) return false;
-            }
-            return true;
-        }
-
-        @Override
-        public boolean isEmpty() {
-            return delegate.isEmpty();
-        }
-
-        @Override
-        public Iterator<T> iterator() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public boolean remove(Object o) {
-            return delegate.remove(toNonNullValue(o));
-        }
-
-        @Override
-        public boolean removeAll(Collection<?> c) {
-            boolean result = false;
-            for (Object e : c) {
-                result = result & delegate.remove(toNonNullValue(e));
-            }
-            return result;
-        }
-
-        @Override
-        public boolean retainAll(Collection<?> c) {
-            boolean result = false;
-            for (Iterator<T> iter = delegate.iterator(); iter.hasNext();) {
-                T e = iter.next();
-                if (!c.contains(fromNonNullValue(e))) {
-                    iter.remove();
-                    result = true;
-                }
-            }
-            return result;
-        }
-
-        @Override
-        public int size() {
-            return delegate.size();
-        }
-
-        @Override
-        public Object[] toArray() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public <T> T[] toArray(T[] a) {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-    }
-    
-    private static Object toNonNullValue(Object value) {
-        return (value != null) ? value : Marker.NULL;
-    }
-
-    private static Object fromNonNullValue(Object value) {
-        return (value == Marker.NULL) ? null : value; 
-    }
-    
-    @Override
-    public boolean equals(@Nullable Object object) {
-        // copied from guava's non-public method Maps.equalsImpl
-        if (this == object) {
-            return true;
-        }
-        if (object instanceof Map) {
-            Map<?, ?> o = (Map<?, ?>) object;
-            return entrySet().equals(o.entrySet());
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        // copied from guava's ImmutableMap.hashCode
-        return entrySet().hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return delegate.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InMemoryDataGridFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InMemoryDataGridFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InMemoryDataGridFactory.java
deleted file mode 100644
index 0ce0aa7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InMemoryDataGridFactory.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.core.internal.storage.impl.inmemory;
-
-import org.apache.brooklyn.core.internal.storage.DataGrid;
-import org.apache.brooklyn.core.internal.storage.DataGridFactory;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-
-public class InMemoryDataGridFactory implements DataGridFactory {
-    
-    public static DataGridFactory ofInstance(final DataGrid datagrid) {
-        return new DataGridFactory() {
-            @Override
-            public DataGrid newDataGrid(ManagementContextInternal managementContext) {
-                return datagrid;
-            }
-        };
-    }
-    
-    @Override
-    public DataGrid newDataGrid(ManagementContextInternal managementContext) {
-        return new InmemoryDatagrid();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InmemoryDatagrid.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InmemoryDatagrid.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InmemoryDatagrid.java
deleted file mode 100644
index 48600d9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/internal/storage/impl/inmemory/InmemoryDatagrid.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 org.apache.brooklyn.core.internal.storage.impl.inmemory;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.brooklyn.core.internal.storage.DataGrid;
-import org.apache.brooklyn.core.internal.storage.impl.ConcurrentMapAcceptingNullVals;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- * A simple implementation of datagrid backed by in-memory (unpersisted) maps, within a single JVM.
- * 
- * @author aled
- */
-public class InmemoryDatagrid implements DataGrid {
-
-    private final Map<String,Map<?,?>> maps = Maps.newLinkedHashMap();
-    private final AtomicInteger creationCounter = new AtomicInteger();
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    public <K, V> ConcurrentMap<K, V> getMap(String id) {
-        synchronized (maps) {
-            ConcurrentMap<K, V> result = (ConcurrentMap<K, V>) maps.get(id);
-            if (result == null) {
-                result = newMap();
-                maps.put(id, result);
-                creationCounter.incrementAndGet();
-            }
-            return result;
-        }
-    }
-    
-    // TODO Not doing Maps.newConcurrentMap() because needs to store null values.
-    // Easy to avoid for Refererence<?> but harder for entity ConfigMap where the user
-    // can insert null values.
-    // 
-    // Could write a decorator that switches null values for a null marker, and back again.
-    //
-    private <K,V> ConcurrentMap<K,V> newMap() {
-        //return Collections.synchronizedMap(new HashMap<K, V>());
-        return new ConcurrentMapAcceptingNullVals<K,V>(Maps.<K,V>newConcurrentMap());
-    }
-
-    @Override
-    public void remove(String id) {
-        synchronized (maps) {
-            maps.remove(id);
-        }
-    }
-
-    @Override
-    public void terminate() {
-        synchronized (maps) {
-            maps.clear();
-        }
-    }
-
-    @Override
-    public Map<String, Object> getDatagridMetrics() {
-        synchronized (maps) {
-            return ImmutableMap.<String, Object>of("size", maps.size(), "createCount", creationCounter.get());
-        }
-    }
-
-    @Override
-    public Set<String> getKeys() {
-        return maps.keySet();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
deleted file mode 100644
index dc48862..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
+++ /dev/null
@@ -1,794 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.groovyTruth;
-import static org.apache.brooklyn.util.groovy.GroovyJavaMethods.elvis;
-
-import java.io.Closeable;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento;
-import org.apache.brooklyn.api.objs.Configurable;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.config.ConfigConstraints;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.internal.storage.Reference;
-import org.apache.brooklyn.core.internal.storage.impl.BasicReference;
-import org.apache.brooklyn.core.location.geo.HasHostGeoInfo;
-import org.apache.brooklyn.core.location.geo.HostGeoInfo;
-import org.apache.brooklyn.core.location.internal.LocationDynamicType;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.internal.LocalLocationManager;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.internal.SubscriptionTracker;
-import org.apache.brooklyn.core.mgmt.rebind.BasicLocationRebindSupport;
-import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
-import org.apache.brooklyn.core.objs.AbstractConfigurationSupportInternal;
-import org.apache.brooklyn.util.collections.SetFromLiveMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.reflect.TypeToken;
-
-/**
- * A basic implementation of the {@link Location} interface.
- *
- * This provides an implementation which works according to the requirements of
- * the interface documentation, and is ready to be extended to make more specialized locations.
- * 
- * Override {@link #configure(Map)} to add special initialization logic.
- */
-public abstract class AbstractLocation extends AbstractBrooklynObject implements LocationInternal, HasHostGeoInfo, Configurable {
-    
-    /** @deprecated since 0.7.0 shouldn't be public */
-    @Deprecated
-    public static final Logger LOG = LoggerFactory.getLogger(AbstractLocation.class);
-
-    public static final ConfigKey<Location> PARENT_LOCATION = new BasicConfigKey<Location>(Location.class, "parentLocation");
-
-    public static final ConfigKey<Boolean> TEMPORARY_LOCATION = ConfigKeys.newBooleanConfigKey("temporaryLocation",
-            "Indicates that the location is a temporary location that has been created to test connectivity, and that" +
-            "the location's events should not be recorded by usage listeners", false);
-
-    private final AtomicBoolean configured = new AtomicBoolean();
-    
-    private Reference<Long> creationTimeUtc = new BasicReference<Long>(System.currentTimeMillis());
-    
-    // _not_ set from flag; configured explicitly in configure, because we also need to update the parent's list of children
-    private Reference<Location> parent = new BasicReference<Location>();
-    
-    // NB: all accesses should be synchronized
-    private Set<Location> children = Sets.newLinkedHashSet();
-
-    private Reference<String> name = new BasicReference<String>();
-    private boolean displayNameAutoGenerated = true;
-
-    private Reference<HostGeoInfo> hostGeoInfo = new BasicReference<HostGeoInfo>();
-
-    private BasicConfigurationSupport config = new BasicConfigurationSupport();
-    
-    private BasicSubscriptionSupport subscriptions = new BasicSubscriptionSupport();
-    
-    private ConfigBag configBag = new ConfigBag();
-
-    /** not for direct access; refer to as 'subscriptionTracker' via getter so that it is initialized */
-    protected transient SubscriptionTracker _subscriptionTracker;
-
-    private volatile boolean managed;
-
-    private boolean inConstruction;
-
-    private Reference<Map<Class<?>, Object>> extensions = new BasicReference<Map<Class<?>, Object>>(Maps.<Class<?>, Object>newConcurrentMap());
-
-    private final LocationDynamicType locationType;
-
-    /**
-     * Construct a new instance of an AbstractLocation.
-     */
-    public AbstractLocation() {
-        this(Maps.newLinkedHashMap());
-    }
-    
-    /**
-     * Construct a new instance of an AbstractLocation.
-     *
-     * The properties map recognizes the following keys:
-     * <ul>
-     * <li>name - a name for the location
-     * <li>parentLocation - the parent {@link Location}
-     * </ul>
-     * 
-     * Other common properties (retrieved via get/findLocationProperty) include:
-     * <ul>
-     * <li>latitude
-     * <li>longitude
-     * <li>displayName
-     * <li>iso3166 - list of iso3166-2 code strings
-     * <li>timeZone
-     * <li>abbreviatedName
-     * </ul>
-     */
-    public AbstractLocation(Map<?,?> properties) {
-        super(properties);
-        inConstruction = true;
-        
-        // When one calls getConfig(key), we want to use the default value specified on *this* location
-        // if it overrides the default config, by using the type object 
-        locationType = new LocationDynamicType(this);
-        
-        if (isLegacyConstruction()) {
-            AbstractLocation checkWeGetThis = configure(properties);
-            assert this.equals(checkWeGetThis) : this+" configure method does not return itself; returns "+checkWeGetThis+" instead of "+this;
-
-            boolean deferConstructionChecks = (properties.containsKey("deferConstructionChecks") && TypeCoercions.coerce(properties.get("deferConstructionChecks"), Boolean.class));
-            if (!deferConstructionChecks) {
-                FlagUtils.checkRequiredFields(this);
-            }
-        }
-        
-        inConstruction = false;
-    }
-
-    protected void assertNotYetManaged() {
-        if (!inConstruction && Locations.isManaged(this)) {
-            LOG.warn("Configuration being made to {} after deployment; may not be supported in future versions", this);
-        }
-        //throw new IllegalStateException("Cannot set configuration "+key+" on active location "+this)
-    }
-
-    public void setManagementContext(ManagementContextInternal managementContext) {
-        super.setManagementContext(managementContext);
-        if (displayNameAutoGenerated && getId() != null) name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
-
-        if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE)) {
-            Location oldParent = parent.get();
-            Set<Location> oldChildren = children;
-            Map<String, Object> oldConfig = configBag.getAllConfig();
-            Long oldCreationTimeUtc = creationTimeUtc.get();
-            String oldDisplayName = name.get();
-            HostGeoInfo oldHostGeoInfo = hostGeoInfo.get();
-
-            parent = managementContext.getStorage().getReference(getId()+"-parent");
-            children = SetFromLiveMap.create(managementContext.getStorage().<Location,Boolean>getMap(getId()+"-children"));
-            creationTimeUtc = managementContext.getStorage().getReference(getId()+"-creationTime");
-            hostGeoInfo = managementContext.getStorage().getReference(getId()+"-hostGeoInfo");
-            name = managementContext.getStorage().getReference(getId()+"-displayName");
-
-            // Only override stored defaults if we have actual values. We might be in setManagementContext
-            // because we are reconstituting an existing entity in a new brooklyn management-node (in which
-            // case believe what is already in the storage), or we might be in the middle of creating a new 
-            // entity. Normally for a new entity (using EntitySpec creation approach), this will get called
-            // before setting the parent etc. However, for backwards compatibility we still support some
-            // things calling the entity's constructor directly.
-            if (oldParent != null) parent.set(oldParent);
-            if (oldChildren.size() > 0) children.addAll(oldChildren);
-            if (creationTimeUtc.isNull()) creationTimeUtc.set(oldCreationTimeUtc);
-            if (hostGeoInfo.isNull()) hostGeoInfo.set(oldHostGeoInfo);
-            if (name.isNull()) {
-                name.set(oldDisplayName);
-            } else {
-                displayNameAutoGenerated = false;
-            }
-
-            configBag = ConfigBag.newLiveInstance(managementContext.getStorage().<String,Object>getMap(getId()+"-config"));
-            if (oldConfig.size() > 0) {
-                configBag.putAll(oldConfig);
-            }
-        }
-    }
-
-    /**
-     * @deprecated since 0.7.0; only used for legacy brooklyn types where constructor is called directly;
-     * see overridden method for more info
-     */
-    @SuppressWarnings("serial")
-    @Override
-    @Deprecated
-    public AbstractLocation configure(Map<?,?> properties) {
-        assertNotYetManaged();
-        
-        boolean firstTime = !configured.getAndSet(true);
-            
-        configBag.putAll(properties);
-        
-        if (properties.containsKey(PARENT_LOCATION.getName())) {
-            // need to ensure parent's list of children is also updated
-            setParent(configBag.get(PARENT_LOCATION));
-            
-            // don't include parentLocation in configBag, as breaks rebind
-            configBag.remove(PARENT_LOCATION);
-        }
-
-        // NB: flag-setting done here must also be done in BasicLocationRebindSupport 
-        FlagUtils.setFieldsFromFlagsWithBag(this, properties, configBag, firstTime);
-        FlagUtils.setAllConfigKeys(this, configBag, false);
-
-        if (properties.containsKey("displayName")) {
-            name.set((String) removeIfPossible(properties, "displayName"));
-            displayNameAutoGenerated = false;
-        } else if (properties.containsKey("name")) {
-            name.set((String) removeIfPossible(properties, "name"));
-            displayNameAutoGenerated = false;
-        } else if (isLegacyConstruction()) {
-            name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
-            displayNameAutoGenerated = true;
-        }
-
-        // TODO Explicitly dealing with iso3166 here because want custom splitter rule comma-separated string.
-        // Is there a better way to do it (e.g. more similar to latitude, where configKey+TypeCoercion is enough)?
-        if (groovyTruth(properties.get("iso3166"))) {
-            Object rawCodes = removeIfPossible(properties, "iso3166");
-            Set<String> codes;
-            if (rawCodes instanceof CharSequence) {
-                codes = ImmutableSet.copyOf(Splitter.on(",").trimResults().split((CharSequence)rawCodes));
-            } else {
-                codes = TypeCoercions.coerce(rawCodes, new TypeToken<Set<String>>() {});
-            }
-            configBag.put(LocationConfigKeys.ISO_3166, codes);
-        }
-        
-        return this;
-    }
-
-    // TODO ensure no callers rely on 'remove' semantics, and don't remove;
-    // or perhaps better use a config bag so we know what is used v unused
-    private static Object removeIfPossible(Map<?,?> map, Object key) {
-        try {
-            return map.remove(key);
-        } catch (Exception e) {
-            return map.get(key);
-        }
-    }
-    
-    public boolean isManaged() {
-        return getManagementContext() != null && managed;
-    }
-
-    public void onManagementStarted() {
-        if (displayNameAutoGenerated) name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
-        this.managed = true;
-    }
-    
-    public void onManagementStopped() {
-        this.managed = false;
-        if (getManagementContext().isRunning()) {
-            BrooklynStorage storage = ((ManagementContextInternal)getManagementContext()).getStorage();
-            storage.remove(getId()+"-parent");
-            storage.remove(getId()+"-children");
-            storage.remove(getId()+"-creationTime");
-            storage.remove(getId()+"-hostGeoInfo");
-            storage.remove(getId()+"-displayName");
-            storage.remove(getId()+"-config");
-        }
-    }
-    
-    @Override
-    public String getDisplayName() {
-        return name.get();
-    }
-    
-    protected boolean isDisplayNameAutoGenerated() {
-        return displayNameAutoGenerated;
-    }
-    
-    @Override
-    public Location getParent() {
-        return parent.get();
-    }
-    
-    @Override
-    public Collection<Location> getChildren() {
-        synchronized (children) {
-            return ImmutableList.copyOf(children);
-        }
-    }
-
-    @Override
-    public void setParent(Location newParent) {
-        setParent(newParent, true);
-    }
-    
-    public void setParent(Location newParent, boolean updateChildListParents) {
-        if (newParent == this) {
-            throw new IllegalArgumentException("Location cannot be its own parent: "+this);
-        }
-        if (newParent == parent.get()) {
-            return; // no-op; already have desired parent
-        }
-        
-        if (parent.get() != null) {
-            Location oldParent = parent.get();
-            parent.set(null);
-            if (updateChildListParents)
-                ((AbstractLocation)oldParent).removeChild(this);
-        }
-        // TODO Should we support a location changing parent? The resulting unmanage/manage might cause problems.
-        // The code above suggests we do, but maybe we should warn or throw error, or at least test it!
-        
-        parent.set(newParent);
-        if (newParent != null) {
-            if (updateChildListParents)
-                ((AbstractLocation)newParent).addChild(this);
-        }
-        
-        onChanged();
-    }
-
-    @Override
-    public ConfigurationSupportInternal config() {
-        return config;
-    }
-
-    // the concrete type rather than an interface is returned because Groovy subclasses
-    // complain (incorrectly) if we return SubscriptionSupportInternal
-    // TODO revert to SubscriptionSupportInternal when groovy subclasses work without this (eg new groovy version)
-    @Override
-    @Beta
-    public BasicSubscriptionSupport subscriptions() {
-        return subscriptions;
-    }
-
-    private class BasicConfigurationSupport extends AbstractConfigurationSupportInternal {
-
-        @Override
-        public <T> T get(ConfigKey<T> key) {
-            Object result = null;
-            if (hasConfig(key, false)) {
-                result = getLocalBag().getAllConfigRaw().get(key.getName());
-
-            } else if (getParent() != null && isInherited(key)) {
-                result = getParent().getConfig(key);
-
-            } else {
-                // In case this entity class has overridden the given key (e.g. to set default), then retrieve this entity's key
-                // TODO when locations become entities, the duplication of this compared to EntityConfigMap.getConfig will disappear.
-                @SuppressWarnings("unchecked")
-                ConfigKey<T> ownKey = (ConfigKey<T>) elvis(locationType.getConfigKey(key.getName()), key);
-                result = ownKey.getDefaultValue();
-            }
-
-            if (result instanceof DeferredSupplier<?>) {
-                try {
-                    ManagementContext mgmt = AbstractLocation.this.getManagementContext();
-                    ExecutionContext exec = mgmt.getServerExecutionContext();
-                    result = Tasks.resolveValue(result, key.getType(), exec);
-
-                } catch (Exception e) {
-                    throw Exceptions.propagate(e);
-                }
-            }
-
-            return TypeCoercions.coerce(result, key.getTypeToken());
-        }
-
-        @Override
-        public <T> T set(ConfigKey<T> key, T val) {
-            ConfigConstraints.assertValid(AbstractLocation.this, key, val);
-            T result = configBag.put(key, val);
-            onChanged();
-            return result;
-        }
-
-        @Override
-        public <T> T set(ConfigKey<T> key, Task<T> val) {
-            // TODO Support for locations
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public ConfigBag getBag() {
-            ConfigBag result = ConfigBag.newInstanceExtending(configBag, ImmutableMap.of());
-            Location p = getParent();
-            if (p!=null) result.putIfAbsent(((LocationInternal)p).config().getBag());
-            return result;
-        }
-
-        @Override
-        public ConfigBag getLocalBag() {
-            return configBag;
-        }
-
-        @Override
-        public Maybe<Object> getRaw(ConfigKey<?> key) {
-            if (hasConfig(key, false)) return Maybe.of(getLocalBag().getStringKey(key.getName()));
-            if (getParent() != null && isInherited(key)) return ((LocationInternal)getParent()).config().getRaw(key);
-            return Maybe.absent();
-        }
-
-        @Override
-        public Maybe<Object> getLocalRaw(ConfigKey<?> key) {
-            if (hasConfig(key, false)) return Maybe.of(getLocalBag().getStringKey(key.getName()));
-            return Maybe.absent();
-        }
-
-        @Override
-        public void addToLocalBag(Map<String, ?> vals) {
-            configBag.putAll(vals);
-        }
-
-        @Override
-        public void removeFromLocalBag(String key) {
-            configBag.remove(key);
-        }
-
-        @Override
-        public void refreshInheritedConfig() {
-            // no-op for location
-        }
-        
-        @Override
-        public void refreshInheritedConfigOfChildren() {
-            // no-op for location
-        }
-        
-        private boolean hasConfig(ConfigKey<?> key, boolean includeInherited) {
-            if (includeInherited && isInherited(key)) {
-                return getBag().containsKey(key);
-            } else {
-                return getLocalBag().containsKey(key);
-            }
-        }
-        
-        private boolean isInherited(ConfigKey<?> key) {
-            ConfigInheritance inheritance = key.getInheritance();
-            if (inheritance==null) inheritance = getDefaultInheritance();
-            return inheritance.isInherited(key, getParent(), AbstractLocation.this);
-        }
-
-        private ConfigInheritance getDefaultInheritance() {
-            return ConfigInheritance.ALWAYS;
-        }
-
-        @Override
-        protected ExecutionContext getContext() {
-            return AbstractLocation.this.getManagementContext().getServerExecutionContext();
-        }
-    }
-    
-    public class BasicSubscriptionSupport implements SubscriptionSupportInternal {
-        @Override
-        public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribe(producer, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribe(flags, producer, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribeToMembers(Group producerGroup, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribeToMembers(producerGroup, sensor, listener);
-        }
-
-        @Override
-        public <T> SubscriptionHandle subscribeToChildren(Entity producerParent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-            return getSubscriptionTracker().subscribeToChildren(producerParent, sensor, listener);
-        }
-        
-        @Override
-        public boolean unsubscribe(Entity producer) {
-            return getSubscriptionTracker().unsubscribe(producer);
-        }
-
-        @Override
-        public boolean unsubscribe(Entity producer, SubscriptionHandle handle) {
-            return getSubscriptionTracker().unsubscribe(producer, handle);
-        }
-
-        @Override
-        public boolean unsubscribe(SubscriptionHandle handle) {
-            return getSubscriptionTracker().unsubscribe(handle);
-        }
-
-        @Override
-        public void unsubscribeAll() {
-            getSubscriptionTracker().unsubscribeAll();
-        }
-
-        protected SubscriptionTracker getSubscriptionTracker() {
-            synchronized (AbstractLocation.this) {
-                if (_subscriptionTracker!=null) return _subscriptionTracker;
-                _subscriptionTracker = new SubscriptionTracker(newSubscriptionContext());
-                return _subscriptionTracker;
-            }
-        }
-        
-        private SubscriptionContext newSubscriptionContext() {
-            synchronized (AbstractLocation.this) {
-                return getManagementContext().getSubscriptionContext(AbstractLocation.this);
-            }
-        }
-    }
-    
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key) {
-        return config().get(key);
-    }
-
-    @Override
-    public <T> T getConfig(ConfigKey<T> key) {
-        return config().get(key);
-    }
-
-    @Override
-    @Deprecated
-    public boolean hasConfig(ConfigKey<?> key, boolean includeInherited) {
-        return config.hasConfig(key, includeInherited);
-    }
-
-    @Override
-    @Deprecated
-    public Map<String,Object> getAllConfig(boolean includeInherited) {
-        // TODO Have no information about what to include/exclude inheritance wise.
-        // however few things use getAllConfigBag()
-        ConfigBag bag = (includeInherited ? config().getBag() : config().getLocalBag());
-        return bag.getAllConfig();
-    }
-    
-    @Override
-    @Deprecated
-    public ConfigBag getAllConfigBag() {
-        // TODO see comments in EntityConfigMap and on interface methods. 
-        // here ConfigBag is used exclusively so
-        // we have no information about what to include/exclude inheritance wise.
-        // however few things use getAllConfigBag()
-        return config().getBag();
-    }
-    
-    @Override
-    public ConfigBag getLocalConfigBag() {
-        return config().getLocalBag();
-    }
-
-    /** 
-     * @deprecated since 0.7; use {@link #getLocalConfigBag()}
-     * @since 0.6
-     */
-    @Deprecated
-    public ConfigBag getRawLocalConfigBag() {
-        return config().getLocalBag();
-    }
-    
-    @Override
-    @Deprecated
-    public <T> T setConfig(ConfigKey<T> key, T value) {
-        return config().set(key, value);
-    }
-
-    /**
-     * @since 0.6.0 (?) - use getDisplayName
-     * @deprecated since 0.7.0; use {@link #getDisplayName()}
-     */
-    @Deprecated
-    public void setName(String newName) {
-        setDisplayName(newName);
-    }
-
-    public void setDisplayName(String newName) {
-        name.set(newName);
-        displayNameAutoGenerated = false;
-        onChanged();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (! (o instanceof Location)) {
-            return false;
-        }
-
-        Location l = (Location) o;
-        return getId().equals(l.getId());
-    }
-
-    @Override
-    public int hashCode() {
-        return getId().hashCode();
-    }
-
-    @Override
-    public boolean containsLocation(Location potentialDescendent) {
-        Location loc = potentialDescendent;
-        while (loc != null) {
-            if (this == loc) return true;
-            loc = loc.getParent();
-        }
-        return false;
-    }
-
-    protected <T extends Location> T addChild(LocationSpec<T> spec) {
-        T child = getManagementContext().getLocationManager().createLocation(spec);
-        addChild(child);
-        return child;
-    }
-    
-    @SuppressWarnings("deprecation")
-    public void addChild(Location child) {
-        // Previously, setParent delegated to addChildLocation and we sometimes ended up with
-        // duplicate entries here. Instead this now uses a similar scheme to 
-        // AbstractLocation.setParent/addChild (with any weaknesses for distribution that such a 
-        // scheme might have...).
-        // 
-        // We continue to use a list to allow identical-looking locations, but they must be different 
-        // instances.
-        
-        synchronized (children) {
-            for (Location contender : children) {
-                if (contender == child) {
-                    // don't re-add; no-op
-                    return;
-                }
-            }
-
-            children.add(child);
-        }
-        
-        if (isManaged()) {
-            if (!getManagementContext().getLocationManager().isManaged(child)) {
-                Locations.manage(child, getManagementContext());
-            }
-        } else if (getManagementContext() != null) {
-            if (((LocalLocationManager)getManagementContext().getLocationManager()).getLocationEvenIfPreManaged(child.getId()) == null) {
-                ((ManagementContextInternal)getManagementContext()).prePreManage(child);
-            }
-        }
-
-        children.add(child);
-        child.setParent(this);
-        
-        onChanged();
-    }
-    
-    public boolean removeChild(Location child) {
-        boolean removed;
-        synchronized (children) {
-            removed = children.remove(child);
-        }
-        if (removed) {
-            if (child instanceof Closeable) {
-                Streams.closeQuietly((Closeable)child);
-            }
-            child.setParent(null);
-            
-            if (isManaged()) {
-                getManagementContext().getLocationManager().unmanage(child);
-            }
-        }
-        onChanged();
-        return removed;
-    }
-
-    protected void onChanged() {
-        // currently changes simply trigger re-persistence; there is no intermediate listener as we do for EntityChangeListener
-        if (isManaged()) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(this);
-        }
-    }
-
-    /** Default String representation is simplified name of class, together with selected fields. */
-    @Override
-    public String toString() {
-        return string().toString();
-    }
-    
-    @Override
-    public String toVerboseString() {
-        return toString();
-    }
-
-    /** override this, adding to the returned value, to supply additional fields to include in the toString */
-    protected ToStringHelper string() {
-        return Objects.toStringHelper(getClass()).add("id", getId()).add("name", name);
-    }
-    
-    @Override
-    public HostGeoInfo getHostGeoInfo() { return hostGeoInfo.get(); }
-    
-    public void setHostGeoInfo(HostGeoInfo hostGeoInfo) {
-        if (hostGeoInfo!=null) { 
-            this.hostGeoInfo.set(hostGeoInfo);
-            setConfig(LocationConfigKeys.LATITUDE, hostGeoInfo.latitude); 
-            setConfig(LocationConfigKeys.LONGITUDE, hostGeoInfo.longitude); 
-        } 
-    }
-
-    @Override
-    public RebindSupport<LocationMemento> getRebindSupport() {
-        return new BasicLocationRebindSupport(this);
-    }
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    public RelationSupportInternal<Location> relations() {
-        return (RelationSupportInternal<Location>) super.relations();
-    }
-    
-    @Override
-    public boolean hasExtension(Class<?> extensionType) {
-        return extensions.get().containsKey(checkNotNull(extensionType, "extensionType"));
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> T getExtension(Class<T> extensionType) {
-        Object extension = extensions.get().get(checkNotNull(extensionType, "extensionType"));
-        if (extension == null) {
-            throw new IllegalArgumentException("No extension of type "+extensionType+" registered for location "+this);
-        }
-        return (T) extension;
-    }
-    
-    @Override
-    public <T> void addExtension(Class<T> extensionType, T extension) {
-        checkNotNull(extensionType, "extensionType");
-        checkNotNull(extension, "extension");
-        checkArgument(extensionType.isInstance(extension), "extension %s does not implement %s", extension, extensionType);
-        extensions.get().put(extensionType, extension);
-    }
-
-    @Override
-    public Map<String, String> toMetadataRecord() {
-        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
-        if (getDisplayName() != null) builder.put("displayName", getDisplayName());
-        if (getParent() != null && getParent().getDisplayName() != null) {
-            builder.put("parentDisplayName", getParent().getDisplayName());
-        }
-        return builder.build();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java
deleted file mode 100644
index 766021e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.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 org.apache.brooklyn.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.KeyValueParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Examples of valid specs:
- *   <ul>
- *     <li>byon(hosts=myhost)
- *     <li>byon(hosts=myhost,myhost2)
- *     <li>byon(hosts="myhost, myhost2")
- *     <li>byon(hosts=myhost,myhost2, name=abc)
- *     <li>byon(hosts="myhost, myhost2", name="my location name")
- *   </ul>
- * 
- * @author aled
- */
-@SuppressWarnings({"unchecked","rawtypes"})
-public abstract class AbstractLocationResolver implements LocationResolver {
-
-    public static final Logger log = LoggerFactory.getLogger(AbstractLocationResolver.class);
-    
-    protected volatile ManagementContext managementContext;
-
-    protected volatile SpecParser specParser;
-
-    protected abstract Class<? extends Location> getLocationType();
-    
-    protected abstract SpecParser getSpecParser();
-    
-    @Override
-    public void init(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-        this.specParser = getSpecParser();
-    }
-    
-    @Override
-    public boolean accepts(String spec, LocationRegistry registry) {
-        return BasicLocationRegistry.isResolverPrefixForSpec(this, spec, true);
-    }
-
-    @Override
-    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
-        ConfigBag config = extractConfig(locationFlags, spec, registry);
-        Map globalProperties = registry.getProperties();
-        String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
-        
-        if (registry != null) {
-            LocationPropertiesFromBrooklynProperties.setLocalTempDir(globalProperties, config);
-        }
-
-        return managementContext.getLocationManager().createLocation(LocationSpec.create(getLocationType())
-            .configure(config.getAllConfig())
-            .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, locationFlags, globalProperties, namedLocation)));
-    }
-
-    protected ConfigBag extractConfig(Map<?,?> locationFlags, String spec, LocationRegistry registry) {
-        Map globalProperties = registry.getProperties();
-        ParsedSpec parsedSpec = specParser.parse(spec);
-        String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
-        
-        // prefer args map over location flags
-        Map<String, Object> filteredProperties = getFilteredLocationProperties(getPrefix(), namedLocation, globalProperties);
-        ConfigBag flags = ConfigBag.newInstance(parsedSpec.argsMap).putIfAbsent(locationFlags).putIfAbsent(filteredProperties);
-
-        return flags;
-    }
-    
-    protected Map<String, Object> getFilteredLocationProperties(String provider, String namedLocation, Map<String, ?> globalProperties) {
-        return new LocationPropertiesFromBrooklynProperties().getLocationProperties(getPrefix(), namedLocation, globalProperties);
-    }
-    
-    protected static class ParsedSpec {
-        public final String spec;
-        public final List<String> partsList;
-        public final Map<String,String> argsMap;
-        
-        ParsedSpec(String spec, List<String> partsList, Map<String,String> argsMap) {
-            this.spec = spec;
-            this.partsList = ImmutableList.copyOf(partsList);
-            this.argsMap = Collections.unmodifiableMap(MutableMap.copyOf(argsMap));
-        }
-    }
-    
-    /**
-     * Parses a spec, by default of the general form "prefix:parts1:part2(arg1=val1,arg2=val2)"
-     */
-    protected static class SpecParser {
-        
-        protected final String prefix;
-        protected final Pattern pattern;
-        private String exampleUsage;
-        
-        public SpecParser(String prefix) {
-            this.prefix = prefix;
-            pattern = Pattern.compile("("+prefix+"|"+prefix.toLowerCase()+"|"+prefix.toUpperCase()+")" + "(:)?" + "(\\((.*)\\))?$");
-        }
-        
-        public SpecParser(String prefix, Pattern pattern) {
-            this.prefix = prefix;
-            this.pattern = pattern;
-        }
-        
-        public SpecParser setExampleUsage(String exampleUsage) {
-            this.exampleUsage = exampleUsage;
-            return this;
-        }
-
-        protected String getUsage(String spec) {
-            if (exampleUsage == null) {
-                return "Spec should be in the form "+pattern;
-            } else {
-                return "for example, "+exampleUsage;
-            }
-        }
-        
-        protected void checkParsedSpec(ParsedSpec parsedSpec) {
-            // If someone tries "byon:(),byon:()" as a single spec, we get weird key-values!
-            for (String key : parsedSpec.argsMap.keySet()) {
-                if (key.contains(":") || key.contains("{") || key.contains("}") || key.contains("(") || key.contains(")")) {
-                    throw new IllegalArgumentException("Invalid byon spec: "+parsedSpec.spec+" (key="+key+")");
-                }
-            }
-            String name = parsedSpec.argsMap.get("name");
-            if (parsedSpec.argsMap.containsKey("name") && (name == null || name.isEmpty())) {
-                throw new IllegalArgumentException("Invalid location '"+parsedSpec.spec+"'; if name supplied then value must be non-empty");
-            }
-            String displayName = parsedSpec.argsMap.get("displayName");
-            if (parsedSpec.argsMap.containsKey("displayName") && (displayName == null || displayName.isEmpty())) {
-                throw new IllegalArgumentException("Invalid location '"+parsedSpec.spec+"'; if displayName supplied then value must be non-empty");
-            }
-        }
-        
-        public ParsedSpec parse(String spec) {
-            Matcher matcher = pattern.matcher(spec);
-            if (!matcher.matches()) {
-                throw new IllegalArgumentException("Invalid location '"+spec+"'; "+getUsage(spec));
-            }
-            
-            String argsPart = matcher.group(3);
-            if (argsPart != null && argsPart.startsWith("(") && argsPart.endsWith(")")) {
-                // TODO Hacky; hosts("1.1.1.1") returns argsPart=("1.1.1.1")
-                argsPart = argsPart.substring(1, argsPart.length()-1);
-            }
-            Map<String, String> argsMap = KeyValueParser.parseMap(argsPart);
-            ParsedSpec result = new ParsedSpec(spec, ImmutableList.<String>of(), argsMap);
-            checkParsedSpec(result);
-            return result;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
deleted file mode 100644
index 6fc9920..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
+++ /dev/null
@@ -1,139 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.io.Closeable;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.api.location.MachineProvisioningLocation;
-import org.apache.brooklyn.api.location.NoMachinesAvailableException;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.apache.brooklyn.util.stream.Streams;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * Takes a list of other provisioners, and round-robins across them when obtaining a machine.
- */
-public class AggregatingMachineProvisioningLocation<T extends MachineLocation> extends AbstractLocation 
-        implements MachineProvisioningLocation<T>, Closeable {
-
-    private Object lock;
-    
-    @SetFromFlag
-    protected List<MachineProvisioningLocation<T>> provisioners;
-    
-    @SetFromFlag
-    protected Map<T, MachineProvisioningLocation<T>> inUse;
-
-    protected final AtomicInteger obtainCounter = new AtomicInteger();
-    
-    public AggregatingMachineProvisioningLocation() {
-        this(Maps.newLinkedHashMap());
-    }
-    
-    public AggregatingMachineProvisioningLocation(Map properties) {
-        super(properties);
-
-        if (isLegacyConstruction()) {
-            init();
-        }
-    }
-
-    @Override
-    public void init() {
-        super.init();
-    }
-    
-    @Override
-    public String toVerboseString() {
-        return Objects.toStringHelper(this).omitNullValues()
-                .add("id", getId()).add("name", getDisplayName())
-                .add("provisioners", provisioners)
-                .toString();
-    }
-
-    @Override
-    public AbstractLocation configure(Map<?,?> properties) {
-        if (lock == null) {
-            lock = new Object();
-            provisioners = Lists.<MachineProvisioningLocation<T>>newArrayList();
-            inUse = Maps.<T, MachineProvisioningLocation<T>>newLinkedHashMap();
-        }
-        return super.configure(properties);
-    }
-    
-    @Override
-    public AggregatingMachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void close() {
-        for (MachineProvisioningLocation<?> provisioner : provisioners) {
-            if (provisioner instanceof Closeable) {
-                Streams.closeQuietly((Closeable)provisioner);
-            }
-        }
-    }
-    
-    public T obtain() throws NoMachinesAvailableException {
-        return obtain(Maps.<String,Object>newLinkedHashMap());
-    }
-    
-    @Override
-    public T obtain(Map<?,?> flags) throws NoMachinesAvailableException {
-        checkState(provisioners.size() > 0, "no provisioners!");
-        int index = obtainCounter.getAndIncrement();
-        for (int i = 0; i < provisioners.size(); i++) {
-            MachineProvisioningLocation<T> provisioner = provisioners.get(index++ % provisioners.size());
-            try {
-                T machine = provisioner.obtain(flags);
-                inUse.put(machine, provisioner);
-                return machine;
-            } catch (NoMachinesAvailableException e) {
-                // move on; try next
-            }
-        }
-        throw new NoMachinesAvailableException("No machines available in "+toString());
-    }
-
-    @Override
-    public void release(T machine) {
-        MachineProvisioningLocation<T> provisioner = inUse.remove(machine);
-        if (provisioner != null) {
-            provisioner.release(machine);
-        } else {
-            throw new IllegalStateException("Request to release machine "+machine+", but this machine is not currently allocated");
-        }
-    }
-
-    @Override
-    public Map<String,Object> getProvisioningFlags(Collection<String> tags) {
-        return Maps.<String,Object>newLinkedHashMap();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java
deleted file mode 100644
index f666268..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.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 org.apache.brooklyn.core.location;
-
-import javax.annotation.concurrent.Immutable;
-
-import com.google.common.base.Objects;
-
-import org.apache.brooklyn.api.location.HardwareDetails;
-
-@Immutable
-public class BasicHardwareDetails implements HardwareDetails {
-
-    private final Integer cpuCount;
-    private final Integer ram;
-
-    public BasicHardwareDetails(Integer cpuCount, Integer ram) {
-        this.cpuCount = cpuCount;
-        this.ram = ram;
-    }
-
-    @Override
-    public Integer getCpuCount() {
-        return cpuCount;
-    }
-
-    @Override
-    public Integer getRam() {
-        return ram;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(HardwareDetails.class)
-                .omitNullValues()
-                .add("cpuCount", cpuCount)
-                .add("ram", ram)
-                .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
deleted file mode 100644
index 508a417..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
+++ /dev/null
@@ -1,85 +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.core.location;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.util.text.Identifiers;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-
-public class BasicLocationDefinition implements LocationDefinition {
-
-    private final String id;
-    private final String name;
-    private final String spec;
-    private final Map<String,Object> config;
-
-    public BasicLocationDefinition(String name, String spec, Map<String,? extends Object> config) {
-        this(Identifiers.makeRandomId(8), name, spec, config);
-    }
-    
-    public BasicLocationDefinition(String id, String name, String spec, Map<String,? extends Object> config) {      
-        this.id = Preconditions.checkNotNull(id);
-        this.name = name;
-        this.spec = Preconditions.checkNotNull(spec);
-        this.config = config==null ? ImmutableMap.<String, Object>of() : ImmutableMap.<String, Object>copyOf(config);
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public String getName() {
-        return name;
-    }
-    
-    public String getSpec() {
-        return spec;
-    }
-    
-    @Override
-    public Map<String, Object> getConfig() {
-        return config;
-    }
-    
-    @Override
-    public boolean equals(Object o) {
-        if (this==o) return true;
-        if ((o instanceof LocationDefinition) && id.equals(((LocationDefinition)o).getId())) return true;
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return id.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return "LocationDefinition{" +
-                "id='" + getId() + '\'' +
-                ", name='" + getName() + '\'' +
-                ", spec='" + getSpec() + '\'' +
-                ", config=" + getConfig() +
-                '}';
-    }
-}


[46/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.java
new file mode 100644
index 0000000..bf4b042
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/Identifiable.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.api.objs;
+
+public interface Identifiable {
+
+    String getId();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java
new file mode 100644
index 0000000..fd7047e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/SpecParameter.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.objs;
+
+import java.io.Serializable;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.config.ConfigKey;
+
+/** A wrapper around a {@link ConfigKey} which will be added to an {@link Entity},
+ * providing additional information for rendering in a UI */
+public interface SpecParameter<T> extends Serializable {
+    /** Short name, to be used in UI */
+    String getLabel();
+    /** Whether visible by default in UI, not all inputs may be visible at once */
+    boolean isPinned();
+    /** All config key info for this spec parameter;
+     * this is the config key which is added to the defined type */
+    ConfigKey<T> getConfigKey();
+    /** An optional sensor which may also be added to the defined type */
+    @Nullable AttributeSensor<?> getSensor();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.java
new file mode 100644
index 0000000..5b1e2fa
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/policy/Policy.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.api.policy;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.PolicyMemento;
+import org.apache.brooklyn.api.objs.Configurable;
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+import org.apache.brooklyn.config.ConfigKey;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Policies implement actions and thus must be suspendable; policies should continue to evaluate their sensors
+ * and indicate their desired planned action even if they aren't invoking them
+ */
+public interface Policy extends EntityAdjunct, Rebindable, Configurable {
+    /**
+     * A unique id for this policy.
+     */
+    @Override
+    String getId();
+
+    /**
+     * Information about the type of this entity; analogous to Java's object.getClass.
+     */
+    @Beta
+    PolicyType getPolicyType();
+
+    /**
+     * Resume the policy
+     */
+    void resume();
+
+    /**
+     * Suspend the policy
+     */
+    void suspend();
+    
+    /**
+     * Whether the policy is suspended
+     */
+    boolean isSuspended();
+    
+    /**
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().set(key, val)}
+     */
+    @Deprecated
+    <T> T setConfig(ConfigKey<T> key, T val);
+    
+    /**
+     * Users are strongly discouraged from calling or overriding this method.
+     * It is for internal calls only, relating to persisting/rebinding entities.
+     * This method may change (or be removed) in a future release without notice.
+     */
+    @Override
+    @Beta
+    RebindSupport<PolicyMemento> getRebindSupport();
+    
+    @Override
+    RelationSupport<Policy> relations();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.java
new file mode 100644
index 0000000..a139d5d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/policy/PolicySpec.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.api.policy;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+
+/**
+ * Gives details of a policy to be created. It describes the policy's configuration, and is
+ * reusable to create multiple policies with the same configuration.
+ * 
+ * To create a PolicySpec, it is strongly encouraged to use {@code create(...)} methods.
+ * 
+ * @param <T> The type of policy to be created
+ * 
+ * @author aled
+ */
+public class PolicySpec<T extends Policy> extends AbstractBrooklynObjectSpec<T,PolicySpec<T>> {
+
+    private final static long serialVersionUID = 1L;
+
+
+    /**
+     * Creates a new {@link PolicySpec} instance for a policy of the given type. The returned 
+     * {@link PolicySpec} can then be customized.
+     * 
+     * @param type A {@link Policy} class
+     */
+    public static <T extends Policy> PolicySpec<T> create(Class<T> type) {
+        return new PolicySpec<T>(type);
+    }
+    
+    /**
+     * Creates a new {@link PolicySpec} instance with the given config, for a policy of the given type.
+     * 
+     * This is primarily for groovy code; equivalent to {@code PolicySpec.create(type).configure(config)}.
+     * 
+     * @param config The spec's configuration (see {@link PolicySpec#configure(Map)}).
+     * @param type   A {@link Policy} class
+     */
+    public static <T extends Policy> PolicySpec<T> create(Map<?,?> config, Class<T> type) {
+        return PolicySpec.create(type).configure(config);
+    }
+    
+    protected PolicySpec(Class<T> type) {
+        super(type);
+    }
+    
+    protected void checkValidType(Class<? extends T> type) {
+        checkIsImplementation(type, Policy.class);
+        checkIsNewStyleImplementation(type);
+    }
+    
+    public PolicySpec<T> uniqueTag(String uniqueTag) {
+        flags.put("uniqueTag", uniqueTag);
+        return this;
+    }
+        
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.java
new file mode 100644
index 0000000..2ba99c6
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/policy/PolicyType.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.api.policy;
+
+import org.apache.brooklyn.api.objs.BrooklynType;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives type information for a {@link Policy}. It is immutable.
+ * 
+ * For policies that can support config keys etc being added on-the-fly,
+ * then this PolicyType will be a snapshot and subsequent snapshots will
+ * include the changes.
+ * 
+ * @since 0.5
+ */
+@Beta
+public interface PolicyType extends BrooklynType {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java
new file mode 100644
index 0000000..54162f2
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/relations/RelationshipType.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.api.relations;
+
+import org.apache.brooklyn.api.relations.RelationshipType;
+
+
+public interface RelationshipType<SourceType,TargetType> {
+
+    public String getRelationshipTypeName();
+    public Class<SourceType> getSourceType();
+    public Class<TargetType> getTargetType();
+    
+    public String getSourceName();
+    public String getSourceNamePlural();
+
+    public String getTargetName();
+    public String getTargetNamePlural();
+
+    public RelationshipType<TargetType,SourceType> getInverseRelationshipType();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.java
new file mode 100644
index 0000000..e200920
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/AttributeSensor.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.api.sensor;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * The interface implemented by attribute sensors.
+ */
+public interface AttributeSensor<T> extends Sensor<T> {
+    
+    /**
+     * @since 0.7.0
+     */
+    @Beta
+    public enum SensorPersistenceMode {
+        /**
+         * Indicates that this sensor should be persisted, and its value should be read from
+         * persisted state on rebind.
+         */
+        REQUIRED,
+        
+        /**
+         * Indicates that this sensor should not be persisted; therefore its value for any entity
+         * will be null immediately after rebind.
+         */
+        NONE;
+    }
+    
+    /**
+     * The persistence mode of this sensor, to determine its behaviour for rebind.
+     * 
+     * @since 0.7.0
+     */
+    SensorPersistenceMode getPersistenceMode();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
new file mode 100644
index 0000000..3fde2a5
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Enricher.java
@@ -0,0 +1,61 @@
+/*
+ * 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.api.sensor;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.EnricherMemento;
+import org.apache.brooklyn.api.objs.Configurable;
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+import org.apache.brooklyn.api.policy.Policy;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Publishes metrics for an entity, e.g. aggregating information from other sensors/entities.
+ *
+ * Has some similarities to {@link Policy}. However, enrichers specifically do not invoke
+ * effectors and should only function to publish new metrics.
+ */
+public interface Enricher extends EntityAdjunct, Rebindable, Configurable {
+    /**
+     * A unique id for this enricher.
+     */
+    @Override
+    String getId();
+
+    /**
+     * Information about the type of this entity; analogous to Java's object.getClass.
+     */
+    @Beta
+    EnricherType getEnricherType();
+
+    /**
+     * Users are strongly discouraged from calling or overriding this method.
+     * It is for internal calls only, relating to persisting/rebinding entities.
+     * This method may change (or be removed) in a future release without notice.
+     */
+    @Override
+    @Beta
+    RebindSupport<EnricherMemento> getRebindSupport();
+
+    @Override
+    RelationSupport<Enricher> relations();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
new file mode 100644
index 0000000..ae50e2d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherSpec.java
@@ -0,0 +1,140 @@
+/*
+ * 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.api.sensor;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+
+/**
+ * Gives details of an enricher to be created. It describes the enricher's configuration, and is
+ * reusable to create multiple enrichers with the same configuration.
+ * 
+ * To create an EnricherSpec, it is strongly encouraged to use {@code create(...)} methods.
+ * 
+ * @param <T> The type of enricher to be created
+ * 
+ * @author aled
+ */
+public class EnricherSpec<T extends Enricher> extends AbstractBrooklynObjectSpec<T,EnricherSpec<T>> {
+
+    private static final long serialVersionUID = -6012873926010992062L;
+
+    /**
+     * Creates a new {@link EnricherSpec} instance for an enricher of the given type. The returned 
+     * {@link EnricherSpec} can then be customized.
+     * 
+     * @param type A {@link Enricher} class
+     */
+    public static <T extends Enricher> EnricherSpec<T> create(Class<? extends T> type) {
+        return new EnricherSpec<T>(type);
+    }
+    
+    /**
+     * Creates a new {@link EnricherSpec} instance with the given config, for an enricher of the given type.
+     * 
+     * This is primarily for groovy code; equivalent to {@code EnricherSpec.create(type).configure(config)}.
+     * 
+     * @param config The spec's configuration (see {@link EnricherSpec#configure(Map)}).
+     * @param type   An {@link Enricher} class
+     */
+    public static <T extends Enricher> EnricherSpec<T> create(Map<?,?> config, Class<? extends T> type) {
+        return EnricherSpec.create(type).configure(config);
+    }
+    
+    protected EnricherSpec(Class<? extends T> type) {
+        super(type);
+    }
+    
+    protected void checkValidType(Class<? extends T> type) {
+        checkIsImplementation(type, Enricher.class);
+        checkIsNewStyleImplementation(type);
+    }
+    
+    public EnricherSpec<T> uniqueTag(String uniqueTag) {
+        flags.put("uniqueTag", uniqueTag);
+        return this;
+    }
+    
+    public abstract static class ExtensibleEnricherSpec<T extends Enricher,K extends ExtensibleEnricherSpec<T,K>> extends EnricherSpec<T> {
+        private static final long serialVersionUID = -3649347642882809739L;
+        
+        protected ExtensibleEnricherSpec(Class<? extends T> type) {
+            super(type);
+        }
+
+        @SuppressWarnings("unchecked")
+        protected K self() {
+            // we override the AbstractBrooklynObjectSpec method -- it's a different K here because
+            // EnricherSpec does not contain a parametrisable generic return type (Self)
+            return (K) this;
+        }
+        
+        @Override
+        public K uniqueTag(String uniqueTag) {
+            super.uniqueTag(uniqueTag);
+            return self();
+        }
+
+        @Override
+        public K configure(Map<?, ?> val) {
+            super.configure(val);
+            return self();
+        }
+
+        @Override
+        public K configure(CharSequence key, Object val) {
+            super.configure(key, val);
+            return self();
+        }
+
+        @Override
+        public <V> K configure(ConfigKey<V> key, V val) {
+            super.configure(key, val);
+            return self();
+        }
+
+        @Override
+        public <V> K configureIfNotNull(ConfigKey<V> key, V val) {
+            super.configureIfNotNull(key, val);
+            return self();
+        }
+
+        @Override
+        public <V> K configure(ConfigKey<V> key, Task<? extends V> val) {
+            super.configure(key, val);
+            return self();
+        }
+
+        @Override
+        public <V> K configure(HasConfigKey<V> key, V val) {
+            super.configure(key, val);
+            return self();
+        }
+
+        @Override
+        public <V> K configure(HasConfigKey<V> key, Task<? extends V> val) {
+            super.configure(key, val);
+            return self();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.java
new file mode 100644
index 0000000..e8aff97
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/EnricherType.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.api.sensor;
+
+import org.apache.brooklyn.api.objs.BrooklynType;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives type information for an {@link Enricher}. It is immutable.
+ * 
+ * For enrichers that can support config keys etc being added on-the-fly,
+ * then this EnricherType will be a snapshot and subsequent snapshots will
+ * include the changes.
+ * 
+ * @since 0.6
+ */
+@Beta
+public interface EnricherType extends BrooklynType {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
new file mode 100644
index 0000000..d50e092
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Feed.java
@@ -0,0 +1,74 @@
+/*
+ * 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.api.sensor;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento;
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+
+import com.google.common.annotations.Beta;
+
+/** 
+ * A sensor feed.
+ * These generally poll or subscribe to get sensor values for an entity.
+ * They make it easy to poll over http, jmx, etc.
+ * 
+ * Assumes:
+ *   <ul>
+ *     <li>There will not be concurrent calls to start and stop.
+ *     <li>There will only be one call to start and that will be done immediately after construction,
+ *         in the same thread.
+ *     <li>Once stopped, the feed will not be re-started.
+ *   </ul>
+ */
+@Beta
+public interface Feed extends EntityAdjunct, Rebindable {
+
+    /** 
+     * True if everything has been _started_ (or it is starting) but not stopped,
+     * even if it is suspended; see also {@link #isActive()}
+     */
+    boolean isActivated();
+    
+    void start();
+
+    /** suspends this feed (stops the poller, or indicates that the feed should start in a state where the poller is stopped) */
+    void suspend();
+
+    boolean isSuspended();
+
+    /** resumes this feed if it has been suspended and not stopped */
+    void resume();
+    
+    void stop();
+
+    /**
+     * Users are strongly discouraged from calling or overriding this method.
+     * It is for internal calls only, relating to persisting/rebinding entities.
+     * This method may change (or be removed) in a future release without notice.
+     */
+    @Override
+    @Beta
+    RebindSupport<FeedMemento> getRebindSupport();
+    
+    @Override
+    RelationSupport<Feed> relations();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.java
new file mode 100644
index 0000000..e658028
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/Sensor.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.api.sensor;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+import com.google.common.reflect.TypeToken;
+
+/**
+ * The interface implemented by concrete sensors.
+ * 
+ * A sensor is a container for a piece of data of a particular type, and exists in a hierarchical namespace.
+ * The name of the sensor is described as a set of tokens separated by dots.
+ * 
+ * @see SensorEvent
+ */
+public interface Sensor<T> extends Serializable {
+    /**
+     * Returns the Java {@link Class} for the sensor data.
+     * <p>
+     * This returns a "super" of T only in the case where T is generified, 
+     * and in such cases it returns the Class instance for the unadorned T ---
+     * i.e. for List&lt;String&gt; this returns Class<List> ---
+     * this is of course because there is no actual Class&lt;List&lt;String&gt;&gt; instance.
+     */
+    Class<? super T> getType();
+    
+    /**
+     * Returns the Guava TypeToken (including generics info)
+     */
+    TypeToken<T> getTypeToken();
+    
+    /**
+     * Returns the type of the sensor data, as a {@link String} representation of the class name.
+     * (Useful for contexts where Type is not accessible.)
+     */
+    String getTypeName();
+
+    /**
+     * Returns the name of the sensor, in a dot-separated namespace.
+     */
+    String getName();
+    
+    /**
+     * Returns the constituent parts of the sensor name as a {@link List}.
+     */
+    List<String> getNameParts();
+ 
+    /**
+     * Returns the description of the sensor, for display.
+     */
+    String getDescription();
+ 
+    /**
+     * Create a new {@link SensorEvent} object for a specific {@link Entity} and data point.
+     */
+    SensorEvent<T> newEvent(Entity entity, T value);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.java
new file mode 100644
index 0000000..02a7fef
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEvent.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.api.sensor;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/**
+ * A tuple representing a piece of data from a {@link Sensor} on an {@link Entity}.
+ */
+public interface SensorEvent<T> {
+    /**
+     * The {@link Entity} where the data originated.
+     */
+    Entity getSource();
+ 
+    /**
+     * The {@link Sensor} describing the data.
+     */
+    Sensor<T> getSensor();
+ 
+    /**
+     * The value for the {@link Sensor} data.
+     */
+    T getValue();
+
+    /**
+     * The time this data was published, as a UTC time in milliseconds (e.g. as returned
+     * by {@link System#currentTimeMillis()}.
+     */
+    long getTimestamp();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.java
new file mode 100644
index 0000000..65fe81c
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/sensor/SensorEventListener.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.api.sensor;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/**
+ * A listener for {@link SensorEvent}s on an {@link Entity}.
+ */
+public interface SensorEventListener<T> {
+    
+    public static final SensorEventListener<Object> NOOP = new SensorEventListener<Object>() {
+        @Override public void onEvent(SensorEvent<Object> event) {
+        }
+    };
+    
+    /**
+     * The {@link SensorEvent} handler method.
+     */
+    void onEvent(SensorEvent<T> event);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java
new file mode 100644
index 0000000..17a7fb3
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java
@@ -0,0 +1,78 @@
+/*
+ * 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.api.typereg;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Predicate;
+
+
+public interface BrooklynTypeRegistry {
+
+    public enum RegisteredTypeKind {
+        /** a registered type which will create an {@link AbstractBrooklynObjectSpec} (e.g. {@link EntitySpec}) 
+         * for the type registered (e.g. the {@link Entity} instance) */
+        SPEC,
+        /** a registered type which will create the java type described */
+        BEAN 
+        // note: additional kinds should have the visitor in core/RegisteredTypeKindVisitor updated
+        // to flush out all places which want to implement support for all kinds 
+    }
+    
+    Iterable<RegisteredType> getAll();
+    Iterable<RegisteredType> getMatching(Predicate<? super RegisteredType> filter);
+
+    /** @return The item matching the given given 
+     * {@link RegisteredType#getSymbolicName() symbolicName} 
+     * and optionally {@link RegisteredType#getVersion()},
+     * taking the best version if the version is null or a default marker,
+     * returning null if no matches are found. */
+    RegisteredType get(String symbolicName, String version);
+    /** as {@link #get(String, String)} but the given string here 
+     * is allowed to match any of:
+     * <li>the given string as an ID including version (<code>"name:version"</code>) 
+     * <li>the symbolic name unversioned, or
+     * <li>an alias */
+    RegisteredType get(String symbolicNameWithOptionalVersion);
+
+    /** as {@link #get(String)} but further filtering for the additional context */
+    public RegisteredType get(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context);
+    /** returns a wrapper of the result of {@link #get(String, RegisteredTypeLoadingContext)} 
+     * including a detailed message if absent */
+    public Maybe<RegisteredType> getMaybe(String symbolicNameOrAliasWithOptionalVersion, RegisteredTypeLoadingContext context);
+
+    // NB the seemingly more correct generics <T,SpecT extends AbstractBrooklynObjectSpec<T,SpecT>> 
+    // cause compile errors, not in Eclipse, but in maven (?) 
+    // TODO do these belong here, or in a separate master TypePlanTransformer ?  see also BrooklynTypePlanTransformer
+    @Beta
+    <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpec(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType);
+    @Beta
+    <SpecT extends AbstractBrooklynObjectSpec<?,?>> SpecT createSpecFromPlan(@Nullable String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<SpecT> optionalSpecSuperType);
+    @Beta
+    <T> T createBean(RegisteredType type, @Nullable RegisteredTypeLoadingContext optionalContext, @Nullable Class<T> optionalResultSuperType);
+    @Beta
+    <T> T createBeanFromPlan(String planFormat, Object planData, @Nullable RegisteredTypeLoadingContext optionalConstraint, @Nullable Class<T> optionalBeanSuperType);
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.java
new file mode 100644
index 0000000..e8b278b
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/typereg/OsgiBundleWithUrl.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.api.typereg;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public interface OsgiBundleWithUrl {
+    
+    public String getSymbolicName();
+    public String getVersion();
+    
+    /** where this bundle can be downloaded; typically required unless we are guaranteed the bundle will be manually installed */
+    public String getUrl();
+    
+    /** @return true if we have a name and version for this bundle;
+     * false if not, e.g. if we only know the URL and we haven't loaded it yet */
+    public boolean isNameResolved();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
new file mode 100644
index 0000000..29b64d3
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredType.java
@@ -0,0 +1,96 @@
+/*
+ * 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.api.typereg;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.Identifiable;
+import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind;
+
+import com.google.common.annotations.Beta;
+
+public interface RegisteredType extends Identifiable {
+    
+    @Override String getId();
+    
+    RegisteredTypeKind getKind();
+    
+    String getSymbolicName();
+    String getVersion();
+
+    Collection<OsgiBundleWithUrl> getLibraries();
+
+    String getDisplayName();
+    String getDescription();
+    String getIconUrl();
+
+    /** @return all declared supertypes or super-interfaces of this registered type,
+     * consisting of a collection of {@link Class} or {@link RegisteredType}
+     * <p>
+     * This should normally include at least one {@link Class} object:
+     * For beans, this should include the java type that the {@link BrooklynTypeRegistry} will create. 
+     * For specs, this should refer to the {@link BrooklynObject} type that the created spec will point at 
+     * (e.g. the concrete {@link Entity}, not the {@link EntitySpec}).
+     * <p>
+     * This may not necessarily return the most specific java class or classes;
+     * such as if the concrete type is private and callers should know only about a particular public interface,
+     * or if precise type details are unavailable and all that is known at creation is some higher level interface/supertype
+     * (e.g. this may return {@link Entity} even though the spec points at a specific subclass,
+     * for instance because the YAML has not yet been parsed or OSGi bundles downloaded).
+     * <p>
+     * This may include other registered types such as marker interfaces.
+     */
+    @Beta
+    Set<Object> getSuperTypes();
+
+    /**
+     * @return True if the item has been deprecated (i.e. its use is discouraged)
+     */
+    boolean isDeprecated();
+    
+    /**
+     * @return True if the item has been disabled (i.e. its use is forbidden, except for pre-existing apps)
+     */
+    boolean isDisabled();
+
+    /** Alias words defined for this type */
+    Set<String> getAliases();
+
+    /** Tags attached to this item */
+    Set<Object> getTags();
+    
+    /** @return implementation details, so that the framework can find a suitable {@link BrooklynTypePlanTransformer} 
+     * which can then use this object to instantiate this type */
+    TypeImplementationPlan getPlan();
+    
+    public interface TypeImplementationPlan {
+        /** hint which {@link BrooklynTypePlanTransformer} instance(s) can be used, if known;
+         * this may be null if the relevant transformer was not declared when created,
+         * but in general we should look to determine the kind as early as possible 
+         * and use that to retrieve the appropriate such transformer */
+        String getPlanFormat();
+        /** data for the implementation; may be more specific */
+        Object getPlanData();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.java
new file mode 100644
index 0000000..d37666e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/typereg/RegisteredTypeLoadingContext.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.api.typereg;
+
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind;
+
+public interface RegisteredTypeLoadingContext {
+    
+    /** The kind required, if specified. */
+    @Nullable public RegisteredTypeKind getExpectedKind();
+    
+    /** A java super-type or interface that should be filtered for; 
+     * for specs, this refers to the target type, not the spec 
+     * (eg {@link Entity} not {@link EntitySpec}). 
+     * If nothing is specified, this returns {@link Object}'s class. */
+    @Nonnull public Class<?> getExpectedJavaSuperType();
+    
+    /** encountered types, so that during resolution, 
+     * if we have already attempted to resolve a given type,
+     * the instantiator can avoid recursive cycles */
+    @Nonnull public Set<String> getAlreadyEncounteredTypes();
+    
+    /** A loader to use, supplying additional search paths */
+    @Nullable public BrooklynClassLoadingContext getLoader();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/.gitattributes
----------------------------------------------------------------------
diff --git a/brooklyn-server/.gitattributes b/brooklyn-server/.gitattributes
deleted file mode 100644
index 7920d0e..0000000
--- a/brooklyn-server/.gitattributes
+++ /dev/null
@@ -1,6 +0,0 @@
-#Don't auto-convert line endings for shell scripts on Windows (breaks the scripts)
-* text=auto
-*.sh text eol=lf
-*.bat text eol=crlf
-*.ps1 text eol=crlf
-*.ini text eol=crlf

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/.gitignore
----------------------------------------------------------------------
diff --git a/brooklyn-server/.gitignore b/brooklyn-server/.gitignore
deleted file mode 100644
index ed439f2..0000000
--- a/brooklyn-server/.gitignore
+++ /dev/null
@@ -1,32 +0,0 @@
-\#*\#
-*~
-*.bak
-*.swp
-*.swo
-.DS_Store
-
-atlassian-ide-plugin.xml
-*.class
-
-target/
-test-output/
-
-.project
-.classpath
-.settings/
-.metadata/
-
-.idea/
-*.iml
-
-nbactions.xml
-nb-configuration.xml
-
-prodDb.*
-
-*.log
-brooklyn*.log.*
-
-*brooklyn-persisted-state/
-
-ignored

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/LICENSE
----------------------------------------------------------------------
diff --git a/brooklyn-server/LICENSE b/brooklyn-server/LICENSE
deleted file mode 100644
index 3d8f4e7..0000000
--- a/brooklyn-server/LICENSE
+++ /dev/null
@@ -1,455 +0,0 @@
-
-This software is distributed under the Apache License, version 2.0. See (1) below.
-This software is copyright (c) The Apache Software Foundation and contributors.
-
-Contents:
-
-  (1) This software license: Apache License, version 2.0
-  (2) Notices for bundled software
-  (3) Licenses for bundled software
-
-
----------------------------------------------------
-
-(1) This software license: Apache License, version 2.0
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-
----------------------------------------------------
-
-(2) Notices for bundled software
-
-This project includes the software: async.js
-  Available at: https://github.com/p15martin/google-maps-hello-world/blob/master/js/libs/async.js
-  Developed by: Miller Medeiros (https://github.com/millermedeiros/)
-  Version used: 0.1.1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Miller Medeiros (2011)
-
-This project includes the software: backbone.js
-  Available at: http://backbonejs.org
-  Developed by: DocumentCloud Inc. (http://www.documentcloud.org/)
-  Version used: 1.0.0
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2013)
-
-This project includes the software: bootstrap.js
-  Available at: http://twitter.github.com/bootstrap/javascript.html#transitions
-  Version used: 2.0.4
-  Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
-  Copyright (c) Twitter, Inc. (2012)
-
-This project includes the software: handlebars.js
-  Available at: https://github.com/wycats/handlebars.js
-  Developed by: Yehuda Katz (https://github.com/wycats/)
-  Inclusive of: handlebars*.js
-  Version used: 1.0-rc1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Yehuda Katz (2012)
-
-This project includes the software: jQuery JavaScript Library
-  Available at: http://jquery.com/
-  Developed by: The jQuery Foundation (http://jquery.org/)
-  Inclusive of: jquery.js
-  Version used: 1.7.2
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) John Resig (2005-2011)
-  Includes code fragments from sizzle.js:
-    Copyright (c) The Dojo Foundation
-    Available at http://sizzlejs.com
-    Used under the MIT license
-
-This project includes the software: jQuery BBQ: Back Button & Query Library
-  Available at: http://benalman.com/projects/jquery-bbq-plugin/
-  Developed by: "Cowboy" Ben Alman (http://benalman.com/)
-  Inclusive of: jquery.ba-bbq*.js
-  Version used: 1.2.1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) "Cowboy" Ben Alman (2010)"
-
-This project includes the software: DataTables Table plug-in for jQuery
-  Available at: http://www.datatables.net/
-  Developed by: SpryMedia Ltd (http://sprymedia.co.uk/)
-  Inclusive of: jquery.dataTables.{js,css}
-  Version used: 1.9.4
-  Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause)
-  Copyright (c) Allan Jardine (2008-2012)
-
-This project includes the software: jQuery Form Plugin
-  Available at: https://github.com/malsup/form
-  Developed by: Mike Alsup (http://malsup.com/)
-  Inclusive of: jquery.form.js
-  Version used: 3.09
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) M. Alsup (2006-2013)
-
-This project includes the software: jQuery Wiggle
-  Available at: https://github.com/jordanthomas/jquery-wiggle
-  Inclusive of: jquery.wiggle.min.js
-  Version used: swagger-ui:1.0.1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) WonderGroup and Jordan Thomas (2010)
-  Previously online at http://labs.wondergroup.com/demos/mini-ui/index.html.
-  The version included here is from the Swagger UI distribution.
-
-This project includes the software: js-uri
-  Available at: http://code.google.com/p/js-uri/
-  Developed by: js-uri contributors (https://code.google.com/js-uri)
-  Inclusive of: URI.js
-  Version used: 0.1
-  Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause)
-  Copyright (c) js-uri contributors (2013)
-
-This project includes the software: js-yaml.js
-  Available at: https://github.com/nodeca/
-  Developed by: Vitaly Puzrin (https://github.com/nodeca/)
-  Version used: 3.2.7
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Vitaly Puzrin (2011-2015)
-
-This project includes the software: marked.js
-  Available at: https://github.com/chjj/marked
-  Developed by: Christopher Jeffrey (https://github.com/chjj)
-  Version used: 0.3.1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Christopher Jeffrey (2011-2014)
-
-This project includes the software: moment.js
-  Available at: http://momentjs.com
-  Developed by: Tim Wood (http://momentjs.com)
-  Version used: 2.1.0
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Tim Wood, Iskren Chernev, Moment.js contributors (2011-2014)
-
-This project includes the software: RequireJS
-  Available at: http://requirejs.org/
-  Developed by: The Dojo Foundation (http://dojofoundation.org/)
-  Inclusive of: require.js, text.js
-  Version used: 2.0.6
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) The Dojo Foundation (2010-2012)
-
-This project includes the software: RequireJS (r.js maven plugin)
-  Available at: http://github.com/jrburke/requirejs
-  Developed by: The Dojo Foundation (http://dojofoundation.org/)
-  Inclusive of: r.js
-  Version used: 2.1.6
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) The Dojo Foundation (2009-2013)
-  Includes code fragments for source-map and other functionality:
-    Copyright (c) The Mozilla Foundation and contributors (2011)
-    Used under the BSD 2-Clause license.
-  Includes code fragments for parse-js and other functionality:
-    Copyright (c) Mihai Bazon (2010, 2012)
-    Used under the BSD 2-Clause license.
-  Includes code fragments for uglifyjs/consolidator:
-    Copyright (c) Robert Gust-Bardon (2012)
-    Used under the BSD 2-Clause license.
-  Includes code fragments for the esprima parser:
-    Copyright (c):
-      Ariya Hidayat (2011, 2012)
-      Mathias Bynens (2012)
-      Joost-Wim Boekesteijn (2012)
-      Kris Kowal (2012)
-      Yusuke Suzuki (2012)
-      Arpad Borsos (2012)
-    Used under the BSD 2-Clause license.
-
-This project includes the software: Swagger UI
-  Available at: https://github.com/swagger-api/swagger-ui
-  Inclusive of: swagger*.{js,css,html}
-  Version used: 2.1.4
-  Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
-  Copyright (c) SmartBear Software (2011-2015)
-
-This project includes the software: typeahead.js
-  Available at: https://github.com/twitter/typeahead.js
-  Developed by: Twitter, Inc (http://twitter.com)
-  Version used: 0.10.5
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Twitter, Inc. and other contributors (2013-2014)
-
-This project includes the software: underscore.js
-  Available at: http://underscorejs.org
-  Developed by: DocumentCloud Inc. (http://www.documentcloud.org/)
-  Inclusive of: underscore*.{js,map}
-  Version used: 1.4.4
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2009-2013)
-
-This project includes the software: underscore.js:1.7.0
-  Available at: http://underscorejs.org
-  Developed by: DocumentCloud Inc. (http://www.documentcloud.org/)
-  Inclusive of: underscore*.{js,map}
-  Version used: 1.7.0
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (2009-2014)
-
-This project includes the software: ZeroClipboard
-  Available at: http://zeroclipboard.org/
-  Developed by: ZeroClipboard contributors (https://github.com/zeroclipboard)
-  Inclusive of: ZeroClipboard.*
-  Version used: 1.3.1
-  Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
-  Copyright (c) Jon Rohan, James M. Greene (2014)
-
-
----------------------------------------------------
-
-(3) Licenses for bundled software
-
-Contents:
-
-  The BSD 2-Clause License
-  The BSD 3-Clause License ("New BSD")
-  The MIT License ("MIT")
-
-
-The BSD 2-Clause License
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions are met:
-  
-  1. Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-  
-  2. Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-  
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  
-
-The BSD 3-Clause License ("New BSD")
-
-  Redistribution and use in source and binary forms, with or without modification,
-  are permitted provided that the following conditions are met:
-  
-  1. Redistributions of source code must retain the above copyright notice, 
-  this list of conditions and the following disclaimer.
-  
-  2. Redistributions in binary form must reproduce the above copyright notice, 
-  this list of conditions and the following disclaimer in the documentation 
-  and/or other materials provided with the distribution.
-  
-  3. Neither the name of the copyright holder nor the names of its contributors 
-  may be used to endorse or promote products derived from this software without 
-  specific prior written permission.
-  
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
-  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
-  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
-  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-  POSSIBILITY OF SUCH DAMAGE.
-  
-
-The MIT License ("MIT")
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy
-  of this software and associated documentation files (the "Software"), to deal
-  in the Software without restriction, including without limitation the rights
-  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  copies of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-  
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-  
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  THE SOFTWARE.
-  
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/NOTICE
----------------------------------------------------------------------
diff --git a/brooklyn-server/NOTICE b/brooklyn-server/NOTICE
deleted file mode 100644
index f790f13..0000000
--- a/brooklyn-server/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Brooklyn
-Copyright 2014-2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/README.md
----------------------------------------------------------------------
diff --git a/brooklyn-server/README.md b/brooklyn-server/README.md
deleted file mode 100644
index 07f69e6..0000000
--- a/brooklyn-server/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-
-# [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/)
-
-### Apache Brooklyn Server Sub-Project
-
-This repo contains the core elements to run a Brooklyn server,
-from the API and utils through to the core implementation and the REST server.

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/pom.xml b/brooklyn-server/api/pom.xml
deleted file mode 100644
index f1994f4..0000000
--- a/brooklyn-server/api/pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-    
-    <artifactId>brooklyn-api</artifactId>
-    <name>Brooklyn API</name>
-    
-    <description>
-        API classes for Brooklyn
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-test-support</artifactId>
-            <scope>test</scope>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-    
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
deleted file mode 100644
index b47d4b1..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
+++ /dev/null
@@ -1,141 +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.api.catalog;
-
-import java.util.Collection;
-import java.util.NoSuchElementException;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Predicate;
-
-public interface BrooklynCatalog {
-    /** 
-     * Version set in catalog when creator does not supply a version, to mean a low priority item;
-     * and used when requesting to indicate the best version.
-     * (See {@link #getCatalogItem(String, String)} for discussion of the best version.)
-     */
-    static String DEFAULT_VERSION = "0.0.0_DEFAULT_VERSION";
-
-    /** @return The item matching the given given 
-     * {@link CatalogItem#getSymbolicName() symbolicName} 
-     * and optionally {@link CatalogItem#getVersion()},
-     * taking the best version if the version is {@link #DEFAULT_VERSION} or null,
-     * returning null if no matches are found. */
-    CatalogItem<?,?> getCatalogItem(String symbolicName, String version);
-
-    /** @return Deletes the item with the given {@link CatalogItem#getSymbolicName()
-     * symbolicName} and version
-     * @throws NoSuchElementException if not found */
-    void deleteCatalogItem(String symbolicName, String version);
-
-    /** variant of {@link #getCatalogItem(String, String)} which checks (and casts) type for convenience
-     * (returns null if type does not match) */
-    <T,SpecT> CatalogItem<T,SpecT> getCatalogItem(Class<T> type, String symbolicName, String version);
-
-    /** @return All items in the catalog */
-    <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems();
-
-    /** convenience for filtering items in the catalog; see CatalogPredicates for useful filters */
-    <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems(Predicate<? super CatalogItem<T,SpecT>> filter);
-
-    /** persists the catalog item to the object store, if persistence is enabled */
-    public void persist(CatalogItem<?, ?> catalogItem);
-
-    /** @return The classloader which should be used to load classes and entities;
-     * this includes all the catalog's classloaders in the right order.
-     * This is a wrapper which will update as the underlying catalog items change,
-     * so it is safe for callers to keep a handle on this. */
-    public ClassLoader getRootClassLoader();
-
-    /** creates a spec for the given catalog item, throwing exceptions if any problems */
-    // TODO this should be cached on the item and renamed getSpec(...), else we re-create it too often (every time catalog is listed)
-    <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createSpec(CatalogItem<T, SpecT> item);
-
-    /**
-     * Adds an item (represented in yaml) to the catalog.
-     * Fails if the same version exists in catalog.
-     *
-     * @throws IllegalArgumentException if the yaml was invalid
-     * @deprecated since 0.7.0 use {@link #addItems(String, boolean)}
-     */
-    @Deprecated
-    CatalogItem<?,?> addItem(String yaml);
-    
-    /**
-     * Adds an item (represented in yaml) to the catalog.
-     * 
-     * @param forceUpdate If true allows catalog update even when an
-     * item exists with the same symbolicName and version
-     *
-     * @throws IllegalArgumentException if the yaml was invalid
-     * @deprecated since 0.7.0 use {@link #addItems(String, boolean)}
-     */
-    @Deprecated
-    CatalogItem<?,?> addItem(String yaml, boolean forceUpdate);
-    
-    /**
-     * Adds items (represented in yaml) to the catalog.
-     * Fails if the same version exists in catalog.
-     *
-     * @throws IllegalArgumentException if the yaml was invalid
-     */
-    Iterable<? extends CatalogItem<?,?>> addItems(String yaml);
-    
-    /**
-     * Adds items (represented in yaml) to the catalog.
-     * 
-     * @param forceUpdate If true allows catalog update even when an
-     * item exists with the same symbolicName and version
-     *
-     * @throws IllegalArgumentException if the yaml was invalid
-     */
-    Iterable<? extends CatalogItem<?,?>> addItems(String yaml, boolean forceUpdate);
-    
-    /**
-     * adds an item to the 'manual' catalog;
-     * this does not update the classpath or have a record to the java Class
-     *
-     * @deprecated since 0.7.0 Construct catalogs with yaml (referencing OSGi bundles) instead
-     */
-    // TODO maybe this should stay on the API? -AH Apr 2015 
-    @Deprecated
-    void addItem(CatalogItem<?,?> item);
-
-    /**
-     * Creates a catalog item and adds it to the 'manual' catalog,
-     * with the corresponding Class definition (loaded by a classloader)
-     * registered and available in the classloader.
-     * <p>
-     * Note that the class will be available for this session only,
-     * although the record of the item will appear in the catalog DTO if exported,
-     * so it is recommended to edit the 'manual' catalog DTO if using it to
-     * generate a catalog, either adding the appropriate classpath URL or removing this entry.
-     *
-     * @deprecated since 0.7.0 Construct catalogs with OSGi bundles instead.
-     * This is used in a handful of tests which should be rewritten to refer to OSGi bundles.
-     */
-    @Deprecated
-    @VisibleForTesting
-    CatalogItem<?,?> addItem(Class<?> clazz);
-
-    void reset(Collection<CatalogItem<?, ?>> entries);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java
deleted file mode 100644
index 1c6b680..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.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 org.apache.brooklyn.api.catalog;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/** 
- * annotation that can be placed on an Application (template), entity or policy 
- * to give metadata for when used in a catalog and to indicate inclusion in annotation-scanned catalogs
- * <p>
- * the "id" field used in the catalog is not exposed here but is always taken as the Class.getName() of the annotated item
- * if loaded from an annotation.  (the "type" field unsurprisingly is given the same value).  
- * {@link #name()}, if not supplied, is the SimpleName of the class.
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
-public @interface Catalog {
-
-    String name() default "";
-    String description() default "";
-    String iconUrl() default "";
-    
-}


[47/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
new file mode 100644
index 0000000..16ff913
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/ManagementPlaneSyncRecordPersister.java
@@ -0,0 +1,68 @@
+/*
+ * 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.api.mgmt.ha;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
+import org.apache.brooklyn.util.time.Duration;
+
+import com.google.common.annotations.Beta;
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Controls the persisting and reading back of mementos relating to the management plane.
+ * This state does not relate to the entities being managed.
+ * 
+ * @see {@link HighAvailabilityManager#setPersister(ManagementPlaneSyncRecordPersister)} for its use in management-node failover
+ * 
+ * @since 0.7.0
+ */
+@Beta
+public interface ManagementPlaneSyncRecordPersister {
+
+    /**
+     * Analogue to {@link BrooklynMementoPersister#loadMemento(org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext)}
+     * <p>
+     * Note that this method is *not* thread safe.
+     */
+    ManagementPlaneSyncRecord loadSyncRecord() throws IOException;
+    
+    void delta(Delta delta);
+
+    void stop();
+
+    @VisibleForTesting
+    void waitForWritesCompleted(Duration timeout) throws InterruptedException, TimeoutException;
+    
+    public interface Delta {
+        public enum MasterChange {
+            NO_CHANGE,
+            SET_MASTER,
+            CLEAR_MASTER
+        }
+        Collection<ManagementNodeSyncRecord> getNodes();
+        Collection<String> getRemovedNodeIds();
+        MasterChange getMasterChange();
+        String getNewMasterOrNull();
+        String getExpectedMasterToClear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
new file mode 100644
index 0000000..320c264
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ha/MementoCopyMode.java
@@ -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.
+ */
+package org.apache.brooklyn.api.mgmt.ha;
+
+public enum MementoCopyMode {
+    /** Use items currently managed at this node */ 
+    LOCAL,
+    /** Use items as stored in the remote persistence store */ 
+    REMOTE, 
+    /** Auto-detect whether to use {@link #LOCAL} or {@link #REMOTE} depending on the
+     * HA mode of this management node (usually {@link #LOCAL} for master and {@link #REMOTE} otherwise)*/ 
+    AUTO 
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.java
new file mode 100644
index 0000000..ce26a82
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/ChangeListener.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.api.mgmt.rebind;
+
+import org.apache.brooklyn.api.objs.BrooklynObject;
+
+/**
+ * Listener to be notified of changes within brooklyn, so that the new state
+ * of the entity/location/policy can be persisted.
+ * 
+ * Users are not expected to implement this class. It is for use by the {@link RebindManager}.
+ * 
+ * @author aled
+ */
+public interface ChangeListener {
+
+    public static final ChangeListener NOOP = new ChangeListener() {
+        @Override public void onChanged(BrooklynObject instance) {}
+        @Override public void onManaged(BrooklynObject instance) {}
+        @Override public void onUnmanaged(BrooklynObject instance) {}
+    };
+
+    void onManaged(BrooklynObject instance);
+    
+    void onUnmanaged(BrooklynObject instance);
+    
+    void onChanged(BrooklynObject instance);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.java
new file mode 100644
index 0000000..759bca6
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/PersistenceExceptionHandler.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.api.mgmt.rebind;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.BrooklynObjectType;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Handler called on all exceptions to do with persistence.
+ * 
+ * @author aled
+ */
+@Beta
+public interface PersistenceExceptionHandler {
+
+    void stop();
+
+    void onGenerateMementoFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
+    
+    void onPersistMementoFailed(Memento memento, Exception e);
+    
+    void onPersistRawMementoFailed(BrooklynObjectType type, String id, Exception e);
+
+    void onDeleteMementoFailed(String id, Exception e);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.java
new file mode 100644
index 0000000..d928da0
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindContext.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.api.mgmt.rebind;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives access to things that are being currently rebinding. This is used during a
+ * rebind to wire everything back together again, e.g. to find the necessary entity 
+ * instances even before they are available through 
+ * {@code managementContext.getEntityManager().getEnties()}.
+ * <p>
+ * Users are not expected to implement this class. It is for use by {@link Rebindable} 
+ * instances, and will generally be created by the {@link RebindManager}.
+ * <p>
+ */
+@Beta
+public interface RebindContext {
+
+    /** Returns an unmodifiable view of all objects by ID */ 
+    Map<String,BrooklynObject> getAllBrooklynObjects();
+    
+    Class<?> loadClass(String typeName) throws ClassNotFoundException;
+    
+    RebindExceptionHandler getExceptionHandler();
+    
+    boolean isReadOnly(BrooklynObject item);
+    
+    LookupContext lookup();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.java
new file mode 100644
index 0000000..574a680
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindExceptionHandler.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.api.mgmt.rebind;
+
+import java.util.List;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.BrooklynObjectType;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.Feed;
+
+import com.google.common.annotations.Beta;
+import org.apache.brooklyn.config.ConfigKey;
+
+/**
+ * Handler called on all exceptions to do with rebind.
+ * A handler instance is linked to a single rebind pass;
+ * it should not be invoked after {@link #onDone()}.
+ * <p>
+ * {@link #onStart()} must be invoked before the run.
+ * {@link #onDone()} must be invoked after a successful run, and it may throw.
+ * <p>
+ * Implementations may propagate errors or may catch them until {@link #onDone()} is invoked,
+ * and that may throw or report elsewhere, as appropriate.
+ * 
+ * @author aled
+ */
+@Beta
+public interface RebindExceptionHandler {
+
+    void onLoadMementoFailed(BrooklynObjectType type, String msg, Exception e);
+    
+    /**
+     * @return the entity to use in place of the missing one, or null (if hasn't thrown an exception)
+     */
+    Entity onDanglingEntityRef(String id);
+
+    /**
+     * @return the location to use in place of the missing one, or null (if hasn't thrown an exception)
+     */
+    Location onDanglingLocationRef(String id);
+
+    /**
+     * @return the policy to use in place of the missing one, or null (if hasn't thrown an exception)
+     */
+    Policy onDanglingPolicyRef(String id);
+
+    /**
+     * @return the enricher to use in place of the missing one, or null (if hasn't thrown an exception)
+     */
+    Enricher onDanglingEnricherRef(String id);
+
+    /**
+     * @return the feed to use in place of the missing one, or null (if hasn't thrown an exception)
+     */
+    Feed onDanglingFeedRef(String id);
+    
+    /**
+     * @return the catalog item to use in place of the missing one
+     */
+    CatalogItem<?, ?> onDanglingCatalogItemRef(String id);
+
+    /**
+     * @return the item to use in place of the missing one
+     */
+    BrooklynObject onDanglingUntypedItemRef(String id);
+
+    void onCreateFailed(BrooklynObjectType type, String id, String instanceType, Exception e);
+
+    void onNotFound(BrooklynObjectType type, String id);
+
+    void onRebindFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
+
+    void onAddConfigFailed(EntityMemento type, ConfigKey<?> value, Exception e);
+
+    void onAddPolicyFailed(EntityLocal entity, Policy policy, Exception e);
+
+    void onAddEnricherFailed(EntityLocal entity, Enricher enricher, Exception e);
+
+    void onAddFeedFailed(EntityLocal entity, Feed feed, Exception e);
+
+    void onManageFailed(BrooklynObjectType type, BrooklynObject instance, Exception e);
+
+    /** invoked for any high-level, unexpected, or otherwise uncaught failure;
+     * may be invoked on catching above errors */
+    RuntimeException onFailed(Exception e);
+
+    /** invoked before the rebind pass */
+    void onStart(RebindContext context);
+    
+    /** invoked after the complete rebind pass, always on success and possibly on failure */
+    void onDone();
+    
+    List<Exception> getExceptions();
+    List<String> getWarnings();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.java
new file mode 100644
index 0000000..c1441db
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindManager.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.api.mgmt.rebind;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeoutException;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Application;
+import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoRawData;
+import org.apache.brooklyn.util.time.Duration;
+
+import com.google.common.annotations.Beta;
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Manages the persisting of brooklyn's state, and recreating that state, e.g. on
+ * brooklyn restart.
+ * 
+ * Users are not expected to implement this class, or to call methods on it directly.
+ */
+public interface RebindManager {
+    
+    // FIXME Should we be calling managementContext.getRebindManager().rebind, using a
+    // new empty instance of managementContext?
+    //
+    // Or is that a risky API because you could call it on a non-empty managementContext?
+    
+    public enum RebindFailureMode {
+        FAIL_FAST,
+        FAIL_AT_END,
+        CONTINUE;
+    }
+    
+    public void setPersister(BrooklynMementoPersister persister);
+
+    public void setPersister(BrooklynMementoPersister persister, PersistenceExceptionHandler exceptionHandler);
+
+    @VisibleForTesting
+    public BrooklynMementoPersister getPersister();
+
+    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
+    public List<Application> rebind();
+    
+    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
+    public List<Application> rebind(ClassLoader classLoader);
+    /** @deprecated since 0.7; use {@link #rebind(ClassLoader, RebindExceptionHandler, ManagementNodeState)} */ @Deprecated
+    public List<Application> rebind(ClassLoader classLoader, RebindExceptionHandler exceptionHandler);
+    /** Causes this management context to rebind, loading data from the given backing store.
+     * use wisely, as this can cause local entities to be completely lost, or will throw in many other situations.
+     * in general it may be invoked for a new node becoming {@link ManagementNodeState#MASTER} 
+     * or periodically for a node in {@link ManagementNodeState#HOT_STANDBY} or {@link ManagementNodeState#HOT_BACKUP}. */
+    @Beta
+    public List<Application> rebind(ClassLoader classLoader, RebindExceptionHandler exceptionHandler, ManagementNodeState mode);
+
+    public BrooklynMementoRawData retrieveMementoRawData();
+
+    public ChangeListener getChangeListener();
+
+    /**
+     * Starts the background persisting of state
+     * (if persister is set; otherwise will start persisting as soon as persister is set). 
+     * Until this is called, no data will be persisted although entities can be rebinded.
+     */
+    public void startPersistence();
+
+    /** Stops the background persistence of state. 
+     * Waits for any current persistence to complete. */
+    public void stopPersistence();
+
+    /**
+     * Perform an initial load of state read-only and starts a background process 
+     * reading (mirroring) state periodically.
+     */
+    public void startReadOnly(ManagementNodeState mode);
+    /** Stops the background reading (mirroring) of state. 
+     * Interrupts any current activity and waits for it to cease. */
+    public void stopReadOnly();
+    
+    /** Starts the appropriate background processes, {@link #startPersistence()} if {@link ManagementNodeState#MASTER},
+     * {@link #startReadOnly()} if {@link ManagementNodeState#HOT_STANDBY} or {@link ManagementNodeState#HOT_BACKUP} */
+    public void start();
+    /** Stops the appropriate background processes, {@link #stopPersistence()} or {@link #stopReadOnly()},
+     * waiting for activity there to cease (interrupting in the case of {@link #stopReadOnly()}). */
+    public void stop();
+    
+    @VisibleForTesting
+    /** waits for any needed or pending writes to complete */
+    public void waitForPendingComplete(Duration duration, boolean canTrigger) throws InterruptedException, TimeoutException;
+    /** Forcibly performs persistence, in the foreground 
+     * @deprecated since 0.7.0; use {@link #forcePersistNow(boolean, PersistenceExceptionHandler)}, 
+     * default parameter here is false to mean incremental, with null/default exception handler */
+    @VisibleForTesting
+    public void forcePersistNow();
+    /** Forcibly performs persistence, in the foreground, either full (all entities) or incremental;
+     * if no exception handler specified, the default one from the persister is used.
+     * <p>
+     * Note that full persistence does *not* delete items; incremental should normally be sufficient.
+     * (A clear then full persistence would have the same effect, but that is risky in a production
+     * setting if the process fails after the clear!) */
+    @VisibleForTesting
+    public void forcePersistNow(boolean full, @Nullable PersistenceExceptionHandler exceptionHandler);
+    
+    /** Whether the management state has changed to a state where a rebind is needed
+     * but we are still awaiting the first run; 
+     * ie state is master or hot, but list of apps is not yet accurate */
+    public boolean isAwaitingInitialRebind();
+
+    /** Metrics about rebind, last success, etc. */
+    public Map<String,Object> getMetrics();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java
new file mode 100644
index 0000000..2e8fdbf
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/RebindSupport.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api.mgmt.rebind;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
+
+/**
+ * Supporter instance for behaviour related to rebinding a given entity/location/policy.
+ * 
+ * For example, the brooklyn framework may call {@code entity.getRebindSupport().getMemento()}
+ * and persist this using a {@link BrooklynMementoPersister}. Later (e.g. after a brooklyn
+ * restart) a new entity instance may be created and populated by the framework calling 
+ * {@code entity.getRebindSupport().reconstruct(rebindContext, memento)}.
+ * 
+ * @author aled
+ */
+public interface RebindSupport<T extends Memento> {
+
+    /**
+     * Creates a memento representing this entity's current state. This is useful for when restarting brooklyn.
+     */
+    T getMemento();
+
+    /**
+     * Reconstructs this entity, given a memento of its state. Sets the internal state 
+     * (including id and config keys), and sets the parent/children/locations of this entity.
+     * 
+     * Implementations should be very careful to not invoke or inspect these other entities/locations,
+     * as they may also be being reconstructed at this time.
+     * 
+     * Called during rebind, after creation and before the call to start management.
+     */
+    void reconstruct(RebindContext rebindContext, T memento);
+
+    void addPolicies(RebindContext rebindContext, T Memento);
+    
+    void addEnrichers(RebindContext rebindContext, T Memento);
+    
+    void addFeeds(RebindContext rebindContext, T Memento);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.java
new file mode 100644
index 0000000..301e8e0
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/Rebindable.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.api.mgmt.rebind;
+
+import org.apache.brooklyn.api.mgmt.rebind.mementos.Memento;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Indicates that this can be recreated, e.g. after a brooklyn restart, and by
+ * using a {@link Memento} it can repopulate the brooklyn objects. The purpose
+ * of the rebind is to reconstruct and reconnect the brooklyn objects, including
+ * binding them to external resources.
+ * 
+ * Users are strongly discouraged to call or use this interface.
+ * It is for internal use only, relating to persisting/rebinding entities.
+ * This interface may change (or be removed) in a future release without notice.
+ */
+@Beta
+public interface Rebindable {
+
+    public RebindSupport<?> getRebindSupport();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java
new file mode 100644
index 0000000..1c66c70
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMemento.java
@@ -0,0 +1,64 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Represents an entire persisted Brooklyn management context, with all its entities and locations.
+ * 
+ * The referential integrity of this memento is not guaranteed. For example, an entity memento might
+ * reference a child entity that does not exist. This is an inevitable consequence of not using a
+ * stop-the-world persistence strategy, and is essential for a distributed brooklyn to be performant.
+ * 
+ * Code using this memento should be tolerant of such inconsistencies (e.g. log a warning about the 
+ * missing entity, and then ignore dangling references when constructing the entities/locations, so
+ * that code will not subsequently get NPEs when iterating over children for example).
+ * 
+ * @author aled
+ */
+public interface BrooklynMemento extends Serializable {
+
+    public EntityMemento getEntityMemento(String id);
+    public LocationMemento getLocationMemento(String id);
+    public PolicyMemento getPolicyMemento(String id);
+    public EnricherMemento getEnricherMemento(String id);
+    public FeedMemento getFeedMemento(String id);
+    public CatalogItemMemento getCatalogItemMemento(String id);
+
+    public Collection<String> getApplicationIds();
+    public Collection<String> getTopLevelLocationIds();
+
+    public Collection<String> getEntityIds();
+    public Collection<String> getLocationIds();
+    public Collection<String> getPolicyIds();
+    public Collection<String> getEnricherIds();
+    public Collection<String> getFeedIds();
+    public Collection<String> getCatalogItemIds();
+
+    public Map<String, EntityMemento> getEntityMementos();
+    public Map<String, LocationMemento> getLocationMementos();
+    public Map<String, PolicyMemento> getPolicyMementos();
+    public Map<String, EnricherMemento> getEnricherMementos();
+    public Map<String, FeedMemento> getFeedMementos();
+    public Map<String, CatalogItemMemento> getCatalogItemMementos();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
new file mode 100644
index 0000000..2efc6f6
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoManifest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.brooklyn.api.objs.Identifiable;
+
+/**
+ * Represents a manifest of the entities etc in the overall memento.
+ * 
+ * @author aled
+ */
+public interface BrooklynMementoManifest extends Serializable {
+    public interface EntityMementoManifest extends Identifiable{
+        public String getId();
+        public String getType();
+        public String getParent();
+        public String getCatalogItemId();
+    }
+
+    public Map<String, EntityMementoManifest> getEntityIdToManifest();
+
+    public Map<String, String> getLocationIdToType();
+
+    public Map<String, String> getPolicyIdToType();
+
+    public Map<String, String> getEnricherIdToType();
+
+    public Map<String, String> getFeedIdToType();
+    
+    public CatalogItemMemento getCatalogItemMemento(String id);
+
+    public Collection<String> getCatalogItemIds();
+
+    public Map<String, CatalogItemMemento> getCatalogItemMementos();
+
+    public boolean isEmpty();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
new file mode 100644
index 0000000..03673fd
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoPersister.java
@@ -0,0 +1,138 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Set;
+import java.util.concurrent.TimeoutException;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.api.mgmt.rebind.PersistenceExceptionHandler;
+import org.apache.brooklyn.api.mgmt.rebind.RebindExceptionHandler;
+import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.BrooklynObjectType;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.Feed;
+import org.apache.brooklyn.util.time.Duration;
+
+import com.google.common.annotations.Beta;
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Controls the persisting and reading back of mementos. Used by {@link RebindManager} 
+ * to support brooklyn restart.
+ */
+public interface BrooklynMementoPersister {
+
+    public static interface LookupContext {
+        ManagementContext lookupManagementContext();
+        Entity lookupEntity(String id);
+        Location lookupLocation(String id);
+        Policy lookupPolicy(String id);
+        Enricher lookupEnricher(String id);
+        Feed lookupFeed(String id);
+        CatalogItem<?, ?> lookupCatalogItem(String id);
+        
+        /** retrieve the item with the given ID, optionally ensuring it is of the indicated type; null if not found */
+        BrooklynObject lookup(@Nullable BrooklynObjectType type, String objectId);
+        /** like {@link #lookup(BrooklynObjectType, String)} but doesn't record an exception if not found */
+        BrooklynObject peek(@Nullable BrooklynObjectType type, String objectId);
+    }
+    
+    /**
+     * Loads raw data contents of the mementos.
+     * <p>
+     * Some classes (esp deprecated ones) may return null here,
+     * meaning that the {@link #loadMementoManifest(BrooklynMementoRawData, RebindExceptionHandler)}
+     * and {@link #loadMemento(BrooklynMementoRawData, LookupContext, RebindExceptionHandler)} methods
+     * will populate the raw data via another source.
+     */
+    BrooklynMementoRawData loadMementoRawData(RebindExceptionHandler exceptionHandler);
+
+    /**
+     * Loads minimal manifest information (almost entirely *not* deserialized).
+     * Implementations should load the raw data if {@link BrooklynMementoRawData} is not supplied,
+     * but callers are encouraged to supply that for optimal performance.
+     */
+    BrooklynMementoManifest loadMementoManifest(@Nullable BrooklynMementoRawData mementoData, RebindExceptionHandler exceptionHandler) throws IOException;
+
+     /**
+      * Retrieves the memento class, containing deserialized objects (but not the {@link BrooklynObject} class).
+      * Implementations should load the raw data if {@link BrooklynMementoRawData} is not supplied,
+      * but callers are encouraged to supply that for optimal performance.
+      * <p>
+      * Note that this method is *not* thread safe.
+      */
+    BrooklynMemento loadMemento(@Nullable BrooklynMementoRawData mementoData, LookupContext lookupContext, RebindExceptionHandler exceptionHandler) throws IOException;
+
+    /** applies a full checkpoint (write) of all state */  
+    void checkpoint(BrooklynMementoRawData newMemento, PersistenceExceptionHandler exceptionHandler);
+    /** applies a partial write of state delta */  
+    void delta(Delta delta, PersistenceExceptionHandler exceptionHandler);
+    /** inserts an additional delta to be written on the next delta request */
+    @Beta
+    void queueDelta(Delta delta);
+
+    void enableWriteAccess();
+    void disableWriteAccess(boolean graceful);
+    /** permanently shuts down all access to the remote store */
+    void stop(boolean graceful);
+
+    @VisibleForTesting
+    void waitForWritesCompleted(Duration timeout) throws InterruptedException, TimeoutException;
+
+    String getBackingStoreDescription();
+    
+    /** All methods on this interface are unmodifiable by the caller. Sub-interfaces may introduce modifiers. */
+    // NB: the type-specific methods aren't actually used anymore; we could remove them to simplify the impl (and use a multiset there)
+    public interface Delta {
+        Collection<LocationMemento> locations();
+        Collection<EntityMemento> entities();
+        Collection<PolicyMemento> policies();
+        Collection<EnricherMemento> enrichers();
+        Collection<FeedMemento> feeds();
+        Collection<CatalogItemMemento> catalogItems();
+        
+        Collection<String> removedLocationIds();
+        Collection<String> removedEntityIds();
+        Collection<String> removedPolicyIds();
+        Collection<String> removedEnricherIds();
+        Collection<String> removedFeedIds();
+        Collection<String> removedCatalogItemIds();
+        
+        Collection<? extends Memento> getObjectsOfType(BrooklynObjectType type);
+        Collection<String> getRemovedIdsOfType(BrooklynObjectType type);
+    }
+    
+    @Beta
+    public interface MutableDelta extends Delta {
+        void add(BrooklynObjectType type, Memento memento);
+        void addAll(BrooklynObjectType type, Iterable<? extends Memento> memento);
+        void removed(BrooklynObjectType type, Set<String> removedIdsOfType);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.java
new file mode 100644
index 0000000..804304d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/BrooklynMementoRawData.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.api.mgmt.rebind.mementos;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.brooklyn.api.objs.BrooklynObjectType;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.Maps;
+
+/**
+ * Represents the raw persisted data.
+ */
+@Beta
+public class BrooklynMementoRawData {
+
+    // TODO Should this be on an interface?
+    // The file-based (or object-store based) structure for storing data may well change; is this representation sufficient?
+
+    public static Builder builder() {
+        return new Builder();
+    }
+    
+    public static class Builder {
+        protected String brooklynVersion;
+        protected final Map<String, String> entities = Maps.newConcurrentMap();
+        protected final Map<String, String> locations = Maps.newConcurrentMap();
+        protected final Map<String, String> policies = Maps.newConcurrentMap();
+        protected final Map<String, String> enrichers = Maps.newConcurrentMap();
+        protected final Map<String, String> feeds = Maps.newConcurrentMap();
+        protected final Map<String, String> catalogItems = Maps.newConcurrentMap();
+        
+        public Builder brooklynVersion(String val) {
+            brooklynVersion = val; return this;
+        }
+        public Builder entity(String id, String val) {
+            entities.put(id, val); return this;
+        }
+        public Builder entities(Map<String, String> vals) {
+            entities.putAll(vals); return this;
+        }
+        public Builder location(String id, String val) {
+            locations.put(id, val); return this;
+        }
+        public Builder locations(Map<String, String> vals) {
+            locations.putAll(vals); return this;
+        }
+        public Builder policy(String id, String val) {
+            policies.put(id, val); return this;
+        }
+        public Builder policies(Map<String, String> vals) {
+            policies.putAll(vals); return this;
+        }
+        public Builder enricher(String id, String val) {
+            enrichers.put(id, val); return this;
+        }
+        public Builder enrichers(Map<String, String> vals) {
+            enrichers.putAll(vals); return this;
+        }
+        public Builder feed(String id, String val) {
+            feeds.put(id, val); return this;
+        }
+        public Builder feeds(Map<String, String> vals) {
+            feeds.putAll(vals); return this;
+        }
+        public Builder catalogItem(String id, String val) {
+            catalogItems.put(id, val); return this;
+        }
+        public Builder catalogItems(Map<String, String> vals) {
+            catalogItems.putAll(vals); return this;
+        }
+        
+        public Builder put(BrooklynObjectType type, String id, String val) {
+            switch (type) {
+            case ENTITY: return entity(id, val);
+            case LOCATION: return location(id, val);
+            case POLICY: return policy(id, val);
+            case ENRICHER: return enricher(id, val);
+            case FEED: return feed(id, val);
+            case CATALOG_ITEM: return catalogItem(id, val);
+            case UNKNOWN:
+            default:
+                throw new IllegalArgumentException(type+" not supported");
+            }
+        }
+        public Builder putAll(BrooklynObjectType type, Map<String,String> vals) {
+            switch (type) {
+            case ENTITY: return entities(vals);
+            case LOCATION: return locations(vals);
+            case POLICY: return policies(vals);
+            case ENRICHER: return enrichers(vals);
+            case FEED: return feeds(vals);
+            case CATALOG_ITEM: return catalogItems(vals);
+            case UNKNOWN:
+            default:
+                throw new IllegalArgumentException(type+" not supported");
+            }
+        }
+
+        public BrooklynMementoRawData build() {
+            return new BrooklynMementoRawData(this);
+        }
+    }
+
+    private final Map<String, String> entities;
+    private final Map<String, String> locations;
+    private final Map<String, String> policies;
+    private final Map<String, String> enrichers;
+    private final Map<String, String> feeds;
+    private final Map<String, String> catalogItems;
+    
+    private BrooklynMementoRawData(Builder builder) {
+        entities = builder.entities;
+        locations = builder.locations;
+        policies = builder.policies;
+        enrichers = builder.enrichers;
+        feeds = builder.feeds;
+        catalogItems = builder.catalogItems;
+    }
+
+    public Map<String, String> getEntities() {
+        return Collections.unmodifiableMap(entities);
+    }
+
+    public Map<String, String> getLocations() {
+        return Collections.unmodifiableMap(locations);
+    }
+
+    public Map<String, String> getPolicies() {
+        return Collections.unmodifiableMap(policies);
+    }
+
+    public Map<String, String> getEnrichers() {
+        return Collections.unmodifiableMap(enrichers);
+    }
+    
+    public Map<String, String> getFeeds() {
+        return Collections.unmodifiableMap(feeds);
+    }
+    
+    public Map<String, String> getCatalogItems() {
+        return Collections.unmodifiableMap(catalogItems);
+    }
+    
+    // to handle reset catalog
+    @Beta
+    public void clearCatalogItems() {
+        catalogItems.clear();
+    }
+    
+    public boolean isEmpty() {
+        return entities.isEmpty() && locations.isEmpty() && policies.isEmpty() && enrichers.isEmpty() && feeds.isEmpty() && catalogItems.isEmpty();
+    }
+    
+    public Map<String, String> getObjectsOfType(BrooklynObjectType type) {
+        switch (type) {
+        case ENTITY: return getEntities();
+        case LOCATION: return getLocations();
+        case POLICY: return getPolicies();
+        case ENRICHER: return getEnrichers();
+        case FEED: return getFeeds();
+        case CATALOG_ITEM: return getCatalogItems();
+        default:
+            throw new IllegalArgumentException("Type "+type+" not supported");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
new file mode 100644
index 0000000..57fbb8d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.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.api.mgmt.rebind.mementos;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.objs.SpecParameter;
+
+public interface CatalogItemMemento extends Memento {
+
+    String getDescription();
+
+    String getSymbolicName();
+
+    String getIconUrl();
+
+    String getVersion();
+
+    String getPlanYaml();
+
+    String getJavaType();
+
+    List<SpecParameter<?>> getParameters();
+
+    Collection<CatalogItem.CatalogBundle> getLibraries();
+
+    CatalogItem.CatalogItemType getCatalogItemType();
+
+    Class<?> getCatalogItemJavaType();
+
+    Class<?> getSpecType();
+
+    boolean isDeprecated();
+
+    boolean isDisabled();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
new file mode 100644
index 0000000..c6b7e8c
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EnricherMemento.java
@@ -0,0 +1,33 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+
+/**
+ * Represents the state of an enricher, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ */
+public interface EnricherMemento extends Memento {
+
+    Map<String, Object> getConfig();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.java
new file mode 100644
index 0000000..4c74695
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/EntityMemento.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.api.mgmt.rebind.mementos;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.config.ConfigKey;
+
+/**
+ * Represents the state of an entity, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ * 
+ * @author aled
+ */
+public interface EntityMemento extends Memento, TreeNode {
+
+    /** all dynamic effectors (ie differences between those registered on the entity type */ 
+    public List<Effector<?>> getEffectors();
+
+    public Map<ConfigKey<?>, Object> getConfig();
+
+    /** true if the entity is top-level (parentless) and an application
+     * (there may be parentless "orphaned" entities, for which this is false,
+     * and "application" instances nested inside other apps, for which this is again)
+     */
+    public boolean isTopLevelApp();
+    
+    public Map<String, Object> getConfigUnmatched();
+    
+    public Map<AttributeSensor<?>, Object> getAttributes();
+
+    /**
+     * The ids of the member entities, if this is a Group; otherwise empty.
+     * 
+     * @see Group.getMembers()
+     */
+    public List<String> getMembers();
+    
+    /**
+     * The ids of the locations for this entity.
+     */
+    public List<String> getLocations();
+
+    /**
+     * The ids of the policies of this entity.
+     */
+    public Collection<String> getPolicies();
+
+    /**
+     * The ids of the enrichers of this entity.
+     */
+    public Collection<String> getEnrichers();
+
+    /**
+     * The ids of the sensor feeds attached to this entity.
+     */
+    public Collection<String> getFeeds();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
new file mode 100644
index 0000000..52424c3
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/FeedMemento.java
@@ -0,0 +1,33 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+
+/**
+ * Represents the state of a feed, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ */
+public interface FeedMemento extends Memento {
+
+    Map<String, Object> getConfig();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java
new file mode 100644
index 0000000..016db01
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/LocationMemento.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.api.mgmt.rebind.mementos;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+
+/**
+ * Represents the state of a location, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ * 
+ * @author aled
+ */
+public interface LocationMemento extends TreeNode, Memento {
+
+    Map<String, Object> getLocationConfig();
+    Set<String> getLocationConfigUnused();
+    String getLocationConfigDescription();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.java
new file mode 100644
index 0000000..5911f28
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/Memento.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.api.mgmt.rebind.mementos;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+
+/**
+ * Represents the internal state of something in brooklyn, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ * 
+ * @author aled
+ */
+public interface Memento extends Serializable {
+
+    /**
+     * The version of brooklyn used when this memento was generated.
+     */
+    String getBrooklynVersion();
+    
+    String getId();
+    
+    public String getType();
+    
+    public String getCatalogItemId();
+    
+    public String getDisplayName();
+    
+    /**
+     * A (weakly-typed) property set for this memento.
+     * These can be used to avoid sub-classing the entity memento, but developers can sub-class to get strong typing if desired.
+     * 
+     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather than requiring "custom fields"
+     */
+    @Deprecated
+    public Object getCustomField(String name);
+
+    /**
+     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather than requiring "custom fields"
+     */
+    @Deprecated
+    public Map<String, ? extends Object> getCustomFields();
+    
+    public String toVerboseString();
+    
+    public void injectTypeClass(Class<?> clazz);
+    
+    /**
+     * Returns the injected type class, or null if not injected.
+     * <p>
+     * This is useful for ensuring the correct classloader is used (e.g. for {@link EntityMemento} 
+     * previously calling {@code EntityTypes.getDefinedSensors(getType())}. 
+     */
+    public Class<?> getTypeClass();
+
+    public Collection<Object> getTags();
+    
+    public Map<String,Set<String>> getRelations();
+    
+    /** Null for {@link Entity}, but important for adjuncts; see {@link EntityAdjunct#getUniqueTag()} */
+    public String getUniqueTag();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.java
new file mode 100644
index 0000000..bfec7af
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/PolicyMemento.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.api.mgmt.rebind.mementos;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+
+/**
+ * Represents the state of an policy, so that it can be reconstructed (e.g. after restarting brooklyn).
+ * 
+ * @see RebindSupport
+ * 
+ * @author aled
+ */
+public interface PolicyMemento extends Memento {
+
+    Map<String, Object> getConfig();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
new file mode 100644
index 0000000..cde6a34
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/TreeNode.java
@@ -0,0 +1,48 @@
+/*
+ * 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.api.mgmt.rebind.mementos;
+
+import java.util.List;
+
+/**
+ * A simple tree structure, where a node references a parent and children using their ids.
+ * 
+ * e.g. could be used to represent the entity hierarchy within mementos, where the 
+ * String is the id of parent/child entities.
+ * 
+ * @author aled
+ */
+public interface TreeNode {
+
+    /**
+     * The id of this node in the tree. This id will be used by the parent's getChildren(), 
+     * and by each child's getParent().
+     */
+    String getId();
+    
+    /**
+     * The id of the parent entity, or null if none.
+     */
+    String getParent();
+    
+    /**
+     * The ids of the children.
+     */
+    List<String> getChildren();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
new file mode 100644
index 0000000..b42bc58
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObject.java
@@ -0,0 +1,169 @@
+/*
+ * 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.api.objs;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.Group;
+import org.apache.brooklyn.api.mgmt.SubscriptionContext;
+import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
+import org.apache.brooklyn.api.mgmt.SubscriptionManager;
+import org.apache.brooklyn.api.relations.RelationshipType;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Super-type of entity, location, policy and enricher.
+ */
+public interface BrooklynObject extends Identifiable, Configurable {
+    
+    /**
+     * A display name; recommended to be a concise single-line description.
+     */
+    String getDisplayName();
+
+    /**
+     * The catalog item ID this object was loaded from.
+     * <p>
+     * This can be used to understand the appropriate classloading context,
+     * such as for versioning purposes, as well as meta-information such as 
+     * branding (maybe you can even get an icon) and 
+     * potentially things like resource lifecycle (if a software version is being sunsetted).
+     * <p>
+     * In some cases this may be set heuristically from context and so may not be accurate.
+     * Callers can set an explicit catalog item ID if inferencing is not correct.
+     */
+    String getCatalogItemId();
+    
+    /** 
+     * Tags are arbitrary objects which can be attached to an entity for subsequent reference.
+     * They must not be null (as {@link ImmutableMap} may be used under the covers; also there is little point!);
+     * and they should be amenable to our persistence (on-disk serialization) and our JSON serialization in the REST API.
+     */
+    TagSupport tags();
+
+    /**
+     * Subscriptions are the mechanism for receiving notifications of sensor-events (e.g. attribute-changed) from 
+     * other entities.
+     */
+    SubscriptionSupport subscriptions();
+
+    /**
+     * Relations specify a typed, directed connection between two entities.
+     * Generic type is overridden in sub-interfaces.
+     */
+    public RelationSupport<?> relations();
+    
+    public interface TagSupport {
+        /**
+         * @return An immutable copy of the set of tags on this entity. 
+         * Note {@link #containsTag(Object)} will be more efficient,
+         * and {@link #addTag(Object)} and {@link #removeTag(Object)} will not work on the returned set.
+         */
+        @Nonnull Set<Object> getTags();
+        
+        boolean containsTag(@Nonnull Object tag);
+        
+        boolean addTag(@Nonnull Object tag);
+        
+        boolean addTags(@Nonnull Iterable<?> tags);
+        
+        boolean removeTag(@Nonnull Object tag);
+    }
+    
+    @Beta
+    public interface SubscriptionSupport {
+        /**
+         * Allow us to subscribe to data from a {@link Sensor} on another entity.
+         * 
+         * @return a subscription id which can be used to unsubscribe
+         *
+         * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
+         */
+        @Beta
+        <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+     
+        /**
+         * Allow us to subscribe to data from a {@link Sensor} on another entity.
+         * 
+         * @return a subscription id which can be used to unsubscribe
+         *
+         * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
+         */
+        @Beta
+        <T> SubscriptionHandle subscribe(Map<String, ?> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+        /** @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
+        @Beta
+        <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+     
+        /** @see SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener) */
+        @Beta
+        <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+        /**
+         * Unsubscribes from the given producer.
+         *
+         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
+         */
+        @Beta
+        boolean unsubscribe(Entity producer);
+
+        /**
+         * Unsubscribes the given handle.
+         *
+         * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
+         */
+        @Beta
+        boolean unsubscribe(Entity producer, SubscriptionHandle handle);
+        
+        /**
+         * Unsubscribes the given handle.
+         * 
+         * It is (currently) more efficient to also pass in the producer -
+         * see {@link SubscriptionSupport#unsubscribe(Entity, SubscriptionHandle)} 
+         */
+        boolean unsubscribe(SubscriptionHandle handle);
+    }
+    
+    public interface RelationSupport<T extends BrooklynObject> {
+        /** Adds a relationship of the given type from this object pointing at the given target, 
+         * and ensures that the inverse relationship (if there is one) is present at the target pointing back at this object. 
+         */
+        public <U extends BrooklynObject> void add(RelationshipType<? super T,? super U> relationship, U target);
+        
+        /** Removes any and all relationships of the given type from this object pointing at the given target,
+         * and ensures that the inverse relationships (if there are one) are also removed. 
+         */
+        public <U extends BrooklynObject> void remove(RelationshipType<? super T,? super U> relationship, U target);
+        
+        /** @return the {@link RelationshipType}s originating from this object */
+        public Set<RelationshipType<? super T,? extends BrooklynObject>> getRelationshipTypes();
+        
+        /** @return the {@link BrooklynObject}s which are targets of the given {@link RelationshipType} */
+        public <U extends BrooklynObject> Set<U> getRelations(RelationshipType<? super T,U> relationshipType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
new file mode 100644
index 0000000..e0ef84c
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynObjectType.java
@@ -0,0 +1,79 @@
+/*
+ * 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.api.objs;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.EnricherSpec;
+import org.apache.brooklyn.api.sensor.Feed;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.CaseFormat;
+
+@Beta
+public enum BrooklynObjectType {
+    // these are correctly type-checked by i can't tell how to get java not to warn!
+    @SuppressWarnings("unchecked") ENTITY(Entity.class, EntitySpec.class, "entities"),
+    @SuppressWarnings("unchecked") LOCATION(Location.class, LocationSpec.class, "locations"),
+    @SuppressWarnings("unchecked") POLICY(Policy.class, PolicySpec.class, "policies"),
+    @SuppressWarnings("unchecked") ENRICHER(Enricher.class, EnricherSpec.class, "enrichers"),
+    FEED(Feed.class, null, "feeds"),
+    CATALOG_ITEM(CatalogItem.class, null, "catalog"),
+    UNKNOWN(null, null, "unknown");
+    
+    private final Class<? extends BrooklynObject> interfaceType;
+    private final Class<? extends AbstractBrooklynObjectSpec<?,?>> specType;
+    private final String subPathName;
+    
+    <T extends BrooklynObject,K extends AbstractBrooklynObjectSpec<T,K>> BrooklynObjectType(Class<T> interfaceType, Class<K> specType, String subPathName) {
+        this.interfaceType = interfaceType;
+        this.specType = specType;
+        this.subPathName = subPathName;
+    }
+    public String toCamelCase() {
+        return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, this.name());
+    }
+
+    public String getSubPathName() {
+        return subPathName;
+    }
+    
+    public Class<? extends BrooklynObject> getInterfaceType() {
+        return interfaceType;
+    }
+    
+    public Class<? extends AbstractBrooklynObjectSpec<?, ?>> getSpecType() {
+        return specType;
+    }
+    
+    public static BrooklynObjectType of(BrooklynObject instance) {
+        for (BrooklynObjectType t: values()) {
+            if (t.getInterfaceType()!=null && t.getInterfaceType().isInstance(instance))
+                return t;
+        }
+        return UNKNOWN;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java
new file mode 100644
index 0000000..72d0be9
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/BrooklynType.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api.objs;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.apache.brooklyn.config.ConfigKey;
+
+/**
+ * Gives type information for a {@link BrooklynObject}. It is an immutable snapshot.
+ * 
+ * It reflects a given brooklyn object at the time the snapshot was created: if anything
+ * were added or removed on-the-fly then those changes will be included in subsequent
+ * snapshots. Therefore instances of a given class could have different {@link BrooklynType}s.
+ */
+// TODO rename as BrooklynObjectSignature or BrooklynObjectMetadata;
+// or (perhaps better and easier to retire deprecated usage, if that is required?)
+// introduce new mechanism for storing accessing this information
+public interface BrooklynType extends Serializable {
+
+    /**
+     * The type name of this entity (normally the fully qualified class name).
+     */
+    String getName();
+    
+    /**
+     * The simple type name of this entity (normally the unqualified class name).
+     */
+    String getSimpleName();
+
+    /**
+     * ConfigKeys available on this entity.
+     */
+    Set<ConfigKey<?>> getConfigKeys();
+    
+    /**
+     * The ConfigKey with the given name, or null if not found.
+     */
+    ConfigKey<?> getConfigKey(String name);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java
new file mode 100644
index 0000000..d7f2935
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/Configurable.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.api.objs;
+
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Something that has mutable config, such as an entity or policy.
+ * 
+ * @author aled
+ */
+public interface Configurable {
+
+    // FIXME Moved from core project to api project, as part of moving EntityLocal.
+    // (though maybe it's fine here?)
+
+    /**
+     * @return the old value, or null if there was not one
+     * @deprecated since 0.7.0; use {@link ConfigurationSupport#set(ConfigKey, Object)}, such as {@code config().set(key, val)} 
+     */
+    @Deprecated
+    public <T> T setConfig(ConfigKey<T> key, T val);
+
+    /**
+     * Convenience for calling {@link ConfigurationSupport#get(ConfigKey)},
+     * via code like {@code config().get(key)}.
+     * 
+     * @since 0.9.0
+     */
+    <T> T getConfig(ConfigKey<T> key);
+
+    ConfigurationSupport config();
+    
+    @Beta
+    public interface ConfigurationSupport {
+
+        /**
+         * Gets the given configuration value for this entity, in the following order of precedence:
+         * <ol>
+         *   <li> value (including null) explicitly set on the entity
+         *   <li> value (including null) explicitly set on an ancestor (inherited)
+         *   <li> a default value (including null) on the best equivalent static key of the same name declared on the entity
+         *        (where best equivalence is defined as preferring a config key which extends another, 
+         *        as computed in EntityDynamicType.getConfigKeys)
+         *   <li> a default value (including null) on the key itself
+         *   <li> null
+         * </ol>
+         */
+        <T> T get(ConfigKey<T> key);
+        
+        /**
+         * @see {@link #getConfig(ConfigKey)}
+         */
+        <T> T get(HasConfigKey<T> key);
+
+        /**
+         * Sets the config to the given value.
+         */
+        <T> T set(ConfigKey<T> key, T val);
+        
+        /**
+         * @see {@link #setConfig(HasConfigKey, Object)}
+         */
+        <T> T set(HasConfigKey<T> key, T val);
+        
+        /**
+         * Sets the config to the value returned by the task.
+         * 
+         * Returns immediately without blocking; subsequent calls to {@link #getConfig(ConfigKey)} 
+         * will execute the task, and block until the task completes.
+         * 
+         * @see {@link #setConfig(ConfigKey, Object)}
+         */
+        <T> T set(ConfigKey<T> key, Task<T> val);
+        
+        /**
+         * @see {@link #setConfig(ConfigKey, Task)}
+         */
+        <T> T set(HasConfigKey<T> key, Task<T> val);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java b/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java
new file mode 100644
index 0000000..674d7f2
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/EntityAdjunct.java
@@ -0,0 +1,53 @@
+/*
+ * 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.api.objs;
+
+import javax.annotation.Nullable;
+
+/**
+ * EntityAdjuncts are supplementary logic that can be attached to Entities, 
+ * such as providing sensor enrichment or event-driven policy behavior
+ */
+public interface EntityAdjunct extends BrooklynObject {
+    /**
+     * A unique id for this adjunct, typically created by the system with no meaning
+     */
+    @Override
+    String getId();
+
+    /**
+     * Whether the adjunct is destroyed
+     */
+    boolean isDestroyed();
+    
+    /**
+     * Whether the adjunct is available/active, ie started and not stopped or interrupted
+     */
+    boolean isRunning();
+    
+    /**
+     * An optional tag used to identify adjuncts with a specific purpose, typically created by the caller.
+     * This is used to prevent multiple instances with the same purpose from being created,
+     * and to access and customize adjuncts so created.
+     * <p>
+     * This will be included in the call to {@link #getTags()}.
+     */
+    @Nullable String getUniqueTag();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java b/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
new file mode 100644
index 0000000..3d13337
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/objs/HasShortName.java
@@ -0,0 +1,26 @@
+/*
+ * 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.api.objs;
+
+public interface HasShortName {
+
+    /** gets a short name, for human-friendly identification e.g. inside the name of a VM */
+    String getShortName();
+    
+}


[37/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampResolver.java
deleted file mode 100644
index 5639945..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampResolver.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.brooklyn.spi.creation;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.api.typereg.RegisteredTypeLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.collect.ImmutableSet;
-
-class CampResolver {
-
-    private ManagementContext mgmt;
-    private RegisteredType type;
-    private RegisteredTypeLoadingContext context;
-
-    // TODO we have a few different modes, detailed below; this logic should be moved to the new transformer
-    // and allow specifying which modes are permitted to be in effect?
-//    /** whether to allow parsing of the 'full' syntax for applications,
-//     * where items are wrapped in a "services:" block, and if the wrapper is an application,
-//     * to promote it */
-//    boolean allowApplicationFullSyntax = true;
-//
-//    /** whether to allow parsing of the legacy 'full' syntax, 
-//     * where a non-application items are wrapped:
-//     * <li> in a "services:" block for entities,
-//     * <li> in a "brooklyn.locations" or "brooklyn.policies" block for locations and policies */
-//    boolean allowLegacyFullSyntax = true;
-//
-//    /** whether to allow parsing of the type syntax, where an item is a map with a "type:" field,
-//     * i.e. not wrapped in any "services:" or "brooklyn.{locations,policies}" block */
-//    boolean allowTypeSyntax = true;
-
-    public CampResolver(ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext context) {
-        this.mgmt = mgmt;
-        this.type = type;
-        this.context = context;
-    }
-
-    public AbstractBrooklynObjectSpec<?, ?> createSpec() {
-        // TODO new-style approach:
-        //            AbstractBrooklynObjectSpec<?, ?> spec = RegisteredTypes.newSpecInstance(mgmt, /* 'type' key */);
-        //            spec.configure(keysAndValues);
-        return createSpecFromFull(mgmt, type, context.getExpectedJavaSuperType(), context.getAlreadyEncounteredTypes(), context.getLoader());
-    }
-
-    static AbstractBrooklynObjectSpec<?, ?> createSpecFromFull(ManagementContext mgmt, RegisteredType item, Class<?> expectedType, Set<String> parentEncounteredTypes, BrooklynClassLoadingContext loaderO) {
-        // for this method, a prefix "services" or "brooklyn.{location,policies}" is required at the root;
-        // we now prefer items to come in "{ type: .. }" format, except for application roots which
-        // should have a "services: [ ... ]" block (and which may subsequently be unwrapped)
-        BrooklynClassLoadingContext loader = CatalogUtils.newClassLoadingContext(mgmt, item, loaderO);
-
-        Set<String> encounteredTypes;
-        // symbolicName could be null if coming from the catalog parser where it tries to load before knowing the id
-        if (item.getSymbolicName() != null) {
-            encounteredTypes = ImmutableSet.<String>builder()
-                .addAll(parentEncounteredTypes)
-                .add(item.getSymbolicName())
-                .build();
-        } else {
-            encounteredTypes = parentEncounteredTypes;
-        }
-
-        AbstractBrooklynObjectSpec<?, ?> spec;
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        MutableSet<Object> supers = MutableSet.copyOf(item.getSuperTypes());
-        supers.addIfNotNull(expectedType);
-        if (RegisteredTypes.isAnyTypeSubtypeOf(supers, Policy.class)) {
-            spec = CampInternalUtils.createPolicySpec(planYaml, loader, encounteredTypes);
-        } else if (RegisteredTypes.isAnyTypeSubtypeOf(supers, Location.class)) {
-            spec = CampInternalUtils.createLocationSpec(planYaml, loader, encounteredTypes);
-        } else if (RegisteredTypes.isAnyTypeSubtypeOf(supers, Application.class)) {
-            spec = createEntitySpecFromServicesBlock(planYaml, loader, encounteredTypes, true);
-        } else if (RegisteredTypes.isAnyTypeSubtypeOf(supers, Entity.class)) {
-            spec = createEntitySpecFromServicesBlock(planYaml, loader, encounteredTypes, false);
-        } else {
-            throw new IllegalStateException("Cannot detect spec type from "+item.getSuperTypes()+" for "+item+"\n"+planYaml);
-        }
-        if (expectedType!=null && !expectedType.isAssignableFrom(spec.getType())) {
-            throw new IllegalStateException("Creating spec from "+item+", got "+spec.getType()+" which is incompatible with expected "+expectedType);                
-        }
-
-        ((AbstractBrooklynObjectSpec<?, ?>)spec).catalogItemIdIfNotNull(item.getId());
-
-        if (Strings.isBlank( ((AbstractBrooklynObjectSpec<?, ?>)spec).getDisplayName() ))
-            ((AbstractBrooklynObjectSpec<?, ?>)spec).displayName(item.getDisplayName());
-
-        return spec;
-    }
- 
-    private static EntitySpec<?> createEntitySpecFromServicesBlock(String plan, BrooklynClassLoadingContext loader, Set<String> encounteredTypes, boolean isApplication) {
-        CampPlatform camp = CampInternalUtils.getCampPlatform(loader.getManagementContext());
-
-        AssemblyTemplate at = CampInternalUtils.registerDeploymentPlan(plan, loader, camp);
-        AssemblyTemplateInstantiator instantiator = CampInternalUtils.getInstantiator(at);
-        if (instantiator instanceof AssemblyTemplateSpecInstantiator) {
-            EntitySpec<? extends Application> appSpec = ((AssemblyTemplateSpecInstantiator)instantiator).createApplicationSpec(at, camp, loader, encounteredTypes);
-
-            // above will unwrap but only if it's an Application (and it's permitted); 
-            // but it doesn't know whether we need an App or if an Entity is okay  
-            if (!isApplication) return EntityManagementUtils.unwrapEntity(appSpec);
-            // if we need an App then definitely *don't* unwrap here because
-            // the instantiator will have done that, and it knows if the plan
-            // specified a wrapped app explicitly (whereas we don't easily know that here!)
-            return appSpec;
-            
-        } else {
-            throw new IllegalStateException("Unable to instantiate YAML; invalid type or parameters in plan:\n"+plan);
-        }
-
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampToSpecTransformer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampToSpecTransformer.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampToSpecTransformer.java
deleted file mode 100644
index 01b721a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampToSpecTransformer.java
+++ /dev/null
@@ -1,110 +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.brooklyn.spi.creation;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.plan.PlanNotRecognizedException;
-import org.apache.brooklyn.core.plan.PlanToSpecTransformer;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Deprecated /** @deprecated since 0.9.0 use CampTypePlanTransformer */
-public class CampToSpecTransformer implements PlanToSpecTransformer {
-
-    public static final String YAML_CAMP_PLAN_TYPE = "org.apache.brooklyn.camp/yaml";
-
-    private static final Logger log = LoggerFactory.getLogger(CampToSpecTransformer.class);
-    
-    private ManagementContext mgmt;
-
-    @Override
-    public String getShortDescription() {
-        return "Brooklyn OASIS CAMP interpreter";
-    }
-
-    @Override
-    public boolean accepts(String mime) {
-        return YAML_CAMP_PLAN_TYPE.equals(mime);
-    }
-
-    @Override
-    public EntitySpec<? extends Application> createApplicationSpec(String plan) {
-        try {
-            CampPlatform camp = CampInternalUtils.getCampPlatform(mgmt);
-            BrooklynClassLoadingContext loader = JavaBrooklynClassLoadingContext.create(mgmt);
-            AssemblyTemplate at = CampInternalUtils.registerDeploymentPlan(plan, loader, camp);
-            AssemblyTemplateInstantiator instantiator = CampInternalUtils.getInstantiator(at);
-            if (instantiator instanceof AssemblyTemplateSpecInstantiator) {
-                return ((AssemblyTemplateSpecInstantiator) instantiator).createApplicationSpec(at, camp, loader, MutableSet.<String>of());
-            } else {
-                // The unknown instantiator can create the app (Assembly), but not a spec.
-                // Currently, all brooklyn plans should produce the above.
-                if (at.getPlatformComponentTemplates()==null || at.getPlatformComponentTemplates().isEmpty()) {
-                    if (at.getCustomAttributes().containsKey(BrooklynCampReservedKeys.BROOKLYN_CATALOG))
-                        throw new IllegalArgumentException("Unrecognized application blueprint format: expected an application, not a brooklyn.catalog");
-                    throw new PlanNotRecognizedException("Unrecognized application blueprint format: no services defined");
-                }
-                // map this (expected) error to a nicer message
-                throw new PlanNotRecognizedException("Unrecognized application blueprint format");
-            }
-        } catch (Exception e) {
-            // TODO how do we figure out that the plan is not supported vs. invalid to wrap in a PlanNotRecognizedException?
-            if (log.isDebugEnabled())
-                log.debug("Failed to create entity from CAMP spec:\n" + plan, e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    @Override
-    public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec(CatalogItem<T, SpecT> item, Set<String> encounteredTypes) {
-        // Ignore old-style java type catalog items - there is a different (deprecated) transformer for that
-        if (item.getPlanYaml() == null) {
-            throw new PlanNotRecognizedException("Old style catalog item " + item + " not supported.");
-        }
-        if (encounteredTypes.contains(item.getSymbolicName())) {
-            throw new IllegalStateException("Already encountered types " + encounteredTypes + " must not contain catalog item being resolver " + item.getSymbolicName());
-        }
-
-        // Not really clear what should happen to the top-level attributes, ignored until a good use case appears.
-        return (SpecT) CampResolver.createSpecFromFull(mgmt, RegisteredTypes.of(item), item.getCatalogItemJavaType(), encounteredTypes, null);
-    }
-
-    @Override
-    public void setManagementContext(ManagementContext mgmt) {
-        this.mgmt = mgmt;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampTypePlanTransformer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampTypePlanTransformer.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampTypePlanTransformer.java
deleted file mode 100644
index afeba41..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/CampTypePlanTransformer.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.brooklyn.spi.creation;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.api.typereg.RegisteredType.TypeImplementationPlan;
-import org.apache.brooklyn.api.typereg.RegisteredTypeLoadingContext;
-import org.apache.brooklyn.core.typereg.AbstractFormatSpecificTypeImplementationPlan;
-import org.apache.brooklyn.core.typereg.AbstractTypePlanTransformer;
-import org.apache.brooklyn.core.typereg.BasicTypeImplementationPlan;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.collect.ImmutableList;
-
-public class CampTypePlanTransformer extends AbstractTypePlanTransformer {
-
-    private static final List<String> FORMATS = ImmutableList.of("brooklyn-camp");
-    // TODO any use in having these formats? if not, remove. Nov 2015.
-    // , "camp", "brooklyn");
-    
-    public static final String FORMAT = FORMATS.get(0);
-    
-    public CampTypePlanTransformer() {
-        super(FORMAT, "OASIS CAMP / Brooklyn", "The Apache Brooklyn implementation of the OASIS CAMP blueprint plan format and extensions");
-    }
-
-    @Override
-    protected double scoreForNullFormat(Object planData, RegisteredType type, RegisteredTypeLoadingContext context) {
-        Maybe<Map<?,?>> plan = RegisteredTypes.getAsYamlMap(planData);
-        if (plan.isAbsent()) return 0;
-        if (plan.get().containsKey("services")) return 0.8;
-        if (plan.get().containsKey("type")) return 0.4;
-        // TODO these should become legacy
-        if (plan.get().containsKey("brooklyn.locations")) return 0.7;
-        if (plan.get().containsKey("brooklyn.policies")) return 0.7;
-        return 0;
-    }
-
-    @Override
-    protected double scoreForNonmatchingNonnullFormat(String planFormat, Object planData, RegisteredType type, RegisteredTypeLoadingContext context) {
-        if (FORMATS.contains(planFormat.toLowerCase())) return 0.9;
-        return 0;
-    }
-
-    @Override
-    protected AbstractBrooklynObjectSpec<?, ?> createSpec(RegisteredType type, RegisteredTypeLoadingContext context) throws Exception {
-        // TODO cache
-        return new CampResolver(mgmt, type, context).createSpec();
-    }
-
-    @Override
-    protected Object createBean(RegisteredType type, RegisteredTypeLoadingContext context) throws Exception {
-        // beans not supported by this?
-        return null;
-    }
-
-    @Override
-    public double scoreForTypeDefinition(String formatCode, Object catalogData) {
-        // TODO catalog parsing
-        return 0;
-    }
-
-    @Override
-    public List<RegisteredType> createFromTypeDefinition(String formatCode, Object catalogData) {
-        // TODO catalog parsing
-        return null;
-    }
-
-    public static class CampTypeImplementationPlan extends AbstractFormatSpecificTypeImplementationPlan<String> {
-        public CampTypeImplementationPlan(TypeImplementationPlan otherPlan) {
-            super(FORMATS.get(0), String.class, otherPlan);
-        }
-        public CampTypeImplementationPlan(String planData) {
-            this(new BasicTypeImplementationPlan(FORMATS.get(0), planData));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/EntitySpecConfiguration.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/EntitySpecConfiguration.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/EntitySpecConfiguration.java
deleted file mode 100644
index 5714523..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/EntitySpecConfiguration.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.brooklyn.spi.creation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Maps;
-
-/**
- * Captures the {@link EntitySpec} configuration defined in YAML. 
- * 
- * This class does not parse that output; it just stores it.
- */
-public class EntitySpecConfiguration {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(EntitySpecConfiguration.class);
-
-    private Map<String, Object> specConfiguration;
-
-    public EntitySpecConfiguration(Map<String, ?> specConfiguration) {
-        this.specConfiguration = Maps.newHashMap(checkNotNull(specConfiguration, "specConfiguration"));
-    }
-
-    public Map<String, Object> getSpecConfiguration() {
-        return specConfiguration;
-    }
-    
-    /**
-     * Allows BrooklynComponentTemplateResolver to traverse the configuration and resolve any entity specs
-     */
-    public void setSpecConfiguration(Map<String, Object> specConfiguration) {
-       this.specConfiguration =  specConfiguration;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
deleted file mode 100644
index 83f907b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.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 org.apache.brooklyn.camp.brooklyn.spi.creation.service;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
-import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-import org.apache.brooklyn.core.resolve.entity.AbstractEntitySpecResolver;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This converts {@link PlatformComponentTemplate} instances whose type is prefixed {@code brooklyn:}
- * to Brooklyn {@link EntitySpec} instances.
- * 
- * @deprecated since 0.9.0, use {@link AbstractEntitySpecResolver} instead
- */
-@Deprecated
-public class BrooklynServiceTypeResolver implements ServiceTypeResolver {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(ServiceTypeResolver.class);
-    
-    public BrooklynServiceTypeResolver() {
-    }
-    
-    @Override
-    public String getTypePrefix() { return DEFAULT_TYPE_PREFIX; }
-
-    @Override
-    public String getBrooklynType(String serviceType) {
-        return Strings.removeFromStart(serviceType, getTypePrefix() + ":").trim();
-    }
-
-    @Nullable
-    @Override
-    public CatalogItem<Entity,EntitySpec<?>> getCatalogItem(BrooklynComponentTemplateResolver resolver, String serviceType) {
-        String type = getBrooklynType(serviceType);
-        if (type != null) {
-            return getCatalogItemImpl(resolver.getManagementContext(),  type);
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public <T extends Entity> void decorateSpec(BrooklynComponentTemplateResolver resolver, EntitySpec<T> spec) {
-    }
-
-    protected CatalogItem<Entity,EntitySpec<?>> getCatalogItemImpl(ManagementContext mgmt, String brooklynType) {
-        brooklynType = DeserializingClassRenamesProvider.findMappedName(brooklynType);
-        return CatalogUtils.getCatalogItemOptionalVersion(mgmt, Entity.class,  brooklynType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CampServiceSpecResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CampServiceSpecResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CampServiceSpecResolver.java
deleted file mode 100644
index 091a4f4..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CampServiceSpecResolver.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.brooklyn.spi.creation.service;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.resolve.entity.DelegatingEntitySpecResolver;
-import org.apache.brooklyn.core.resolve.entity.EntitySpecResolver;
-
-import com.google.common.collect.ImmutableList;
-
-public class CampServiceSpecResolver extends DelegatingEntitySpecResolver {
-
-    public CampServiceSpecResolver(ManagementContext mgmt, List<EntitySpecResolver> overridingResolvers) {
-        super(getCampResolvers(mgmt, overridingResolvers));
-    }
-
-    private static List<EntitySpecResolver> getCampResolvers(ManagementContext mgmt, List<EntitySpecResolver> overridingResolvers) {
-        List<EntitySpecResolver> resolvers = ImmutableList.<EntitySpecResolver>builder()
-                .addAll(overridingResolvers)
-                .addAll(getRegisteredResolvers())
-                .add(new UrlServiceSpecResolver())
-                .build();
-        for (EntitySpecResolver resolver : resolvers) {
-            resolver.setManagementContext(mgmt);
-        }
-        return resolvers;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolver.java
deleted file mode 100644
index 14f855a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolver.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 org.apache.brooklyn.camp.brooklyn.spi.creation.service;
-
-import java.util.ServiceLoader;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
-import org.apache.brooklyn.core.resolve.entity.EntitySpecResolver;
-
-/**
- * Resolves and decorates {@link EntitySpec entity specifications} based on the {@code serviceType} in a template.
- * <p>
- * The {@link #getTypePrefix()} method returns a string that should match the beginning of the
- * service type. The resolver implementation will use the rest of the service type information
- * to create and decorate an approprate {@link EntitySpec entity}.
- * <p>
- * The resolvers are loaded using the {@link ServiceLoader} mechanism, allowing external libraries
- * to add extra service type implementations that will be picked up at runtime.
- *
- * @see BrooklynServiceTypeResolver
- * @see ChefServiceTypeResolver
- * 
- * @deprecated since 0.9.0, {@link EntitySpecResolver} instead.
- */
-@Deprecated
-public interface ServiceTypeResolver {
-
-    String DEFAULT_TYPE_PREFIX = "brooklyn";
-
-    /**
-     * The service type prefix the resolver is responsible for.
-     */
-    String getTypePrefix();
-
-    /**
-     * The name of the Java type that Brooklyn will instantiate to create the
-     * service. This can be generated from parts of the service type information
-     * or may be a fixed value.
-     */
-    String getBrooklynType(String serviceType);
-
-    /**
-     * Returns the {@link CatalogItem} if there is one for the given type.
-     * <p>
-     * If no type, callers should fall back to default classloading.
-     */
-    CatalogItem<Entity, EntitySpec<?>> getCatalogItem(BrooklynComponentTemplateResolver resolver, String serviceType);
-
-    /**
-     * Takes the provided {@link EntitySpec} and decorates it appropriately for the service type.
-     * <p>
-     * This includes setting configuration and adding policies, enrichers and initializers.
-     *
-     * @see BrooklynServiceTypeResolver#decorateSpec(BrooklynComponentTemplateResolver, EntitySpec)
-     */
-    <T extends Entity> void decorateSpec(BrooklynComponentTemplateResolver resolver, EntitySpec<T> spec);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverAdaptor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverAdaptor.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverAdaptor.java
deleted file mode 100644
index d4cf6e9..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverAdaptor.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.brooklyn.spi.creation.service;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
-import org.apache.brooklyn.core.resolve.entity.AbstractEntitySpecResolver;
-import org.apache.brooklyn.core.resolve.entity.EntitySpecResolver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Splitter;
-
-@SuppressWarnings("deprecation")
-public class ServiceTypeResolverAdaptor extends AbstractEntitySpecResolver {
-    private static final Logger log = LoggerFactory.getLogger(ServiceTypeResolverAdaptor.class);
-    private ServiceTypeResolver serviceTypeResolver;
-    private BrooklynComponentTemplateResolver resolver;
-
-    public ServiceTypeResolverAdaptor(BrooklynComponentTemplateResolver resolver, ServiceTypeResolver serviceTypeResolver) {
-        super(serviceTypeResolver.getTypePrefix());
-        this.serviceTypeResolver = serviceTypeResolver;
-        this.resolver = resolver;
-    }
-
-    @Override
-    public boolean accepts(String type, BrooklynClassLoadingContext loader) {
-        if (type.indexOf(':') != -1) {
-            String prefix = Splitter.on(":").splitToList(type).get(0);
-            return prefix.equals(serviceTypeResolver.getTypePrefix());
-        } else {
-            return false;
-        }
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    @Override
-    public EntitySpec<?> resolve(String type, BrooklynClassLoadingContext loader, Set<String> encounteredTypes) {
-        // Assume this is interface! Only known implementation is DockerServiceTypeResolver.
-        String brooklynType = serviceTypeResolver.getBrooklynType(type);
-        Class<? extends Entity> javaType = loader.loadClass(brooklynType, Entity.class);
-        if (!javaType.isInterface()) {
-            log.warn("Using " + ServiceTypeResolver.class.getSimpleName() + " with a non-interface type - this usage is not supported. Use " + EntitySpecResolver.class.getSimpleName() + " instead.");
-        }
-        EntitySpec<?> spec = EntitySpec.create((Class)javaType);
-        serviceTypeResolver.decorateSpec(resolver, spec);
-        return spec;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/UrlServiceSpecResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/UrlServiceSpecResolver.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/UrlServiceSpecResolver.java
deleted file mode 100644
index 62f079f..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/UrlServiceSpecResolver.java
+++ /dev/null
@@ -1,81 +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.brooklyn.spi.creation.service;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
-import org.apache.brooklyn.core.resolve.entity.EntitySpecResolver;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.net.Urls;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** Specific to CAMP because linked plans are assumed to be CAMP format. No type discovery available. */
-public class UrlServiceSpecResolver implements EntitySpecResolver {
-    private static final Logger log = LoggerFactory.getLogger(UrlServiceSpecResolver.class);
-
-    @Override
-    public String getName() {
-        return "url";
-    }
-
-    @Override
-    public boolean accepts(String type, BrooklynClassLoadingContext loader) {
-        String protocol = Urls.getProtocol(type);
-        return protocol != null &&
-            BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST.contains(protocol);
-    }
-
-    @Override
-    public EntitySpec<?> resolve(String type, BrooklynClassLoadingContext loader, Set<String> encounteredTypes) {
-        String yaml;
-        try {
-            yaml = ResourceUtils.create(this).getResourceAsString(type);
-        } catch (Exception e) {
-            log.warn("AssemblyTemplate type " + type + " looks like a URL that can't be fetched.", e);
-            return null;
-        }
-        if (encounteredTypes.contains(type)) {
-            throw new IllegalStateException("URL " + type + " is self referential.");
-        }
-        
-        // Referenced specs are expected to be CAMP format as well.
-        // TODO somehow specify to allow full syntax for services
-        EntitySpec<?> item = loader.getManagementContext().getTypeRegistry().createSpecFromPlan(
-            CampTypePlanTransformer.FORMAT,
-            yaml,
-            RegisteredTypeLoadingContexts.loaderAlreadyEncountered(loader, encounteredTypes, type), 
-            EntitySpec.class);
-        return item;
-    }
-
-    @Override
-    public void setManagementContext(ManagementContext managementContext) {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
deleted file mode 100644
index 48a0283..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java
+++ /dev/null
@@ -1,155 +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.brooklyn.spi.dsl;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.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.config.ConfigKey;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.core.task.BasicExecutionContext;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/** provide an object suitable to resolve chained invocations in a parsed YAML / Deployment Plan DSL,
- * which also implements {@link DeferredSupplier} so that they can be resolved when needed
- * (e.g. when entity-lookup and execution contexts are available).
- * <p>
- * implementations of this abstract class are expected to be immutable,
- * as instances must support usage in multiple {@link Assembly} instances 
- * created from a single {@link AssemblyTemplate}  
- * <p>
- * subclasses which return a deferred value are typically only
- * resolvable in the context of a {@link Task} on an {@link Entity}; 
- * these should be only used as the value of a {@link ConfigKey} set in the YAML,
- * and should not accessed until after the components / entities are created 
- * and are being started.
- * (TODO the precise semantics of this are under development.)
- * 
- * The threading model is that only one thread can call {@link #get()} at a time. An interruptible
- * lock is obtained using {@link #lock} for the duration of that method. It is important to not
- * use {@code synchronized} because that is not interruptible - if someone tries to get the value
- * and interrupts after a short wait, then we must release the lock immediately and return.
- * <p>
- **/
-public abstract class BrooklynDslDeferredSupplier<T> implements DeferredSupplier<T>, TaskFactory<Task<T>>, Serializable {
-
-    private static final long serialVersionUID = -8789624905412198233L;
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynDslDeferredSupplier.class);
-
-    /**
-     * Lock to be used, rather than {@code synchronized} blocks, for anything long-running.
-     * Use {@link #getLock()} rather than this field directly, to ensure it is reinitialised 
-     * after rebinding.
-     * 
-     * @see https://issues.apache.org/jira/browse/BROOKLYN-214
-     */
-    private transient ReentrantLock lock;
-    
-    // TODO json of this object should *be* this, not wrapped this ($brooklyn:literal is a bit of a hack, though it might work!)
-    @JsonInclude
-    @JsonProperty(value="$brooklyn:literal")
-    // currently marked transient because it's only needed for logging
-    private transient Object dsl = "(gone)";
-
-    public BrooklynDslDeferredSupplier() {
-        PlanInterpretationNode sourceNode = BrooklynDslInterpreter.currentNode();
-        dsl = sourceNode!=null ? sourceNode.getOriginalValue() : null;
-        lock = new ReentrantLock();
-    }
-    
-    /** returns the current entity; for use in implementations of {@link #get()} */
-    protected final static EntityInternal entity() {
-        return (EntityInternal) BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-    }
-
-    /**
-     * Returns the current management context; for use in implementations of {@link #get()} that are not associated
-     * with an entity.
-     */
-    protected final static ManagementContextInternal managementContext() {
-        return (ManagementContextInternal) BrooklynTaskTags.getManagementContext(Tasks.current());
-    }
-
-    @Override
-    public final T get() {
-        try {
-            getLock().lockInterruptibly();
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
-        
-        try {
-            if (log.isDebugEnabled())
-                log.debug("Queuing task to resolve "+dsl+", called by "+Tasks.current());
-
-            EntityInternal entity = (EntityInternal) BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
-            ExecutionContext exec =
-                    (entity != null) ? entity.getExecutionContext()
-                                     : BasicExecutionContext.getCurrentExecutionContext();
-            if (exec == null) {
-                throw new IllegalStateException("No execution context available to resolve " + dsl);
-            }
-
-            Task<T> task = newTask();
-            T result = exec.submit(task).get();
-
-            if (log.isDebugEnabled())
-                log.debug("Resolved "+result+" from "+dsl);
-            return result;
-
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        } finally {
-            getLock().unlock();
-        }
-    }
-
-    // Use this method, rather than the direct field, to ensure it is initialised after rebinding.
-    protected ReentrantLock getLock() {
-        synchronized (this) {
-            if (lock == null) {
-                lock = new ReentrantLock();
-            }
-        }
-        return lock;
-    }
-
-    @Override
-    public abstract Task<T> newTask();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
deleted file mode 100644
index f43d33c..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslInterpreter.java
+++ /dev/null
@@ -1,193 +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.brooklyn.spi.dsl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-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.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
-
-/**
- * {@link PlanInterpreter} which understands the $brooklyn DSL
- */
-public class BrooklynDslInterpreter extends PlanInterpreterAdapter {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynDslInterpreter.class);
-
-    @Override
-    public boolean isInterestedIn(PlanInterpretationNode node) {
-        return node.matchesPrefix("$brooklyn:") || node.getNewValue() instanceof FunctionWithArgs;
-    }
-
-    private static ThreadLocal<PlanInterpretationNode> currentNode = new ThreadLocal<PlanInterpretationNode>();
-    /** returns the current node, stored in a thread-local, to populate the dsl field of {@link BrooklynDslDeferredSupplier} instances */
-    public static PlanInterpretationNode currentNode() {
-        return currentNode.get();
-    }
-    /** sets the current node */
-    public static void currentNode(PlanInterpretationNode node) {
-        currentNode.set(node);
-    }
-    public static void currentNodeClear() {
-        currentNode.set(null);
-    }
-    
-    @Override
-    public void applyYamlPrimitive(PlanInterpretationNode node) {
-        String expression = node.getNewValue().toString();
-
-        try {
-            currentNode.set(node);
-            Object parsedNode = new DslParser(expression).parse();
-            if ((parsedNode instanceof FunctionWithArgs) && ((FunctionWithArgs)parsedNode).getArgs()==null) {
-                if (node.getRoleInParent() == Role.MAP_KEY) {
-                    node.setNewValue(parsedNode);
-                    // will be handled later
-                } else {
-                    throw new IllegalStateException("Invalid function-only expression '"+((FunctionWithArgs)parsedNode).getFunction()+"'");
-                }
-            } else {
-                node.setNewValue( evaluate(parsedNode, true) );
-            }
-        } catch (Exception e) {
-            log.warn("Error evaluating node (rethrowing) '"+expression+"': "+e);
-            Exceptions.propagateIfFatal(e);
-            throw new IllegalArgumentException("Error evaluating node '"+expression+"'", e);
-        } finally {
-            currentNodeClear();
-        }
-    }
-    
-    @Override
-    public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut,
-            PlanInterpretationNode key, PlanInterpretationNode value) {
-        if (key.getNewValue() instanceof FunctionWithArgs) {
-            try {
-                currentNode.set(node);
-
-                FunctionWithArgs f = (FunctionWithArgs) key.getNewValue();
-                if (f.getArgs()!=null)
-                    throw new IllegalStateException("Invalid map key function "+f.getFunction()+"; should not have arguments if taking arguments from map");
-
-                // means evaluation acts on values
-                List<Object> args = new ArrayList<Object>();
-                if (value.getNewValue() instanceof Iterable<?>) {
-                    for (Object vi: (Iterable<?>)value.getNewValue())
-                        args.add(vi);
-                } else {
-                    args.add(value.getNewValue());
-                }
-
-                try {
-                    // TODO in future we should support functions of the form 'Maps.clear', 'Maps.reset', 'Maps.remove', etc;
-                    // default approach only supported if mapIn has single item and mapOut is empty
-                    if (mapIn.size()!=1) 
-                        throw new IllegalStateException("Map-entry DSL syntax only supported with single item in map, not "+mapIn);
-                    if (mapOut.size()!=0) 
-                        throw new IllegalStateException("Map-entry DSL syntax only supported with empty output map-so-far, not "+mapOut);
-
-                    node.setNewValue( evaluate(new FunctionWithArgs(f.getFunction(), args), false) );
-                    return false;
-                } catch (Exception e) {
-                    log.warn("Error evaluating map-entry (rethrowing) '"+f.getFunction()+args+"': "+e);
-                    Exceptions.propagateIfFatal(e);
-                    throw new IllegalArgumentException("Error evaluating map-entry '"+f.getFunction()+args+"'", e);
-                }
-
-            } finally {
-                currentNodeClear();
-            }
-        }
-        return super.applyMapEntry(node, mapIn, mapOut, key, value);
-    }
-
-    public Object evaluate(Object f, boolean deepEvaluation) {
-        if (f instanceof FunctionWithArgs) {
-            return evaluateOn(BrooklynDslCommon.class, (FunctionWithArgs) f, deepEvaluation);
-        }
-        
-        if (f instanceof List) {
-            Object o = BrooklynDslCommon.class;
-            for (Object i: (List<?>)f) {
-                o = evaluateOn( o, (FunctionWithArgs)i, deepEvaluation );
-            }
-            return o;
-        }
-
-        if (f instanceof QuotedString) {
-            return ((QuotedString)f).unwrapped();
-        }
-
-        throw new IllegalArgumentException("Unexpected element in parse tree: '"+f+"' (type "+(f!=null ? f.getClass() : null)+")");
-    }
-    
-    public Object evaluateOn(Object o, FunctionWithArgs f, boolean deepEvaluation) {
-        if (f.getArgs()==null)
-            throw new IllegalStateException("Invalid function-only expression '"+f.getFunction()+"'");
-
-        Class<?> clazz;
-        if (o instanceof Class) {
-            clazz = (Class<?>)o;
-        } else {
-            clazz = o.getClass();
-        }
-        if (!(clazz.getPackage().getName().startsWith(BrooklynDslCommon.class.getPackage().getName())))
-            throw new IllegalArgumentException("Not permitted to invoke function on '"+clazz+"' (outside allowed package scope)");
-        
-        String fn = f.getFunction();
-        fn = Strings.removeFromStart(fn, "$brooklyn:");
-        if (fn.startsWith("function.")) {
-            // If the function name starts with 'function.', then we look for the function in BrooklynDslCommon.Functions
-            // As all functions in BrooklynDslCommon.Functions are static, we don't need to worry whether a class
-            // or an instance was passed into this method
-            o = BrooklynDslCommon.Functions.class;
-            fn = Strings.removeFromStart(fn, "function.");
-        }
-        try {
-            List<Object> args = new ArrayList<>();
-            for (Object arg: f.getArgs()) {
-                args.add( deepEvaluation ? evaluate(arg, true) : arg );
-            }
-            Optional<Object> v = Reflections.invokeMethodWithArgs(o, fn, args);
-            if (v.isPresent()) return v.get();
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            throw Exceptions.propagate(new InvocationTargetException(e, "Error invoking '"+fn+"' on '"+o+"'"));
-        }
-        
-        throw new IllegalArgumentException("No such function '"+fn+"' on "+o);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslUtils.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslUtils.java
deleted file mode 100644
index f75b0f9..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslUtils.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 org.apache.brooklyn.camp.brooklyn.spi.dsl;
-
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-
-import com.google.common.collect.Iterables;
-
-public class DslUtils {
-
-    /** true iff none of the args are deferred / tasks */
-    public static boolean resolved(Iterable<Object> args) {
-        return resolved(Iterables.toArray(args, Object.class));
-    }
-
-    /** true iff none of the args are deferred / tasks */
-    public static boolean resolved(final Object... args) {
-        boolean allResolved = true;
-        for (Object arg: args) {
-            if (arg instanceof DeferredSupplier<?>) {
-                allResolved = false;
-                break;
-            }
-        }
-        return allResolved;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
deleted file mode 100644
index 88a1f1d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
+++ /dev/null
@@ -1,438 +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.brooklyn.spi.dsl.methods;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.api.mgmt.TaskFactory;
-import org.apache.brooklyn.api.objs.Configurable;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynYamlTypeInstantiator;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.EntitySpecConfiguration;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.DslUtils;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent.Scope;
-import org.apache.brooklyn.core.config.external.ExternalConfigSupplier;
-import org.apache.brooklyn.core.entity.EntityDynamicType;
-import org.apache.brooklyn.core.mgmt.internal.ExternalConfigSupplierRegistry;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.ClassCoercionException;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.commons.beanutils.BeanUtils;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/** static import functions which can be used in `$brooklyn:xxx` contexts */
-public class BrooklynDslCommon {
-
-    // Access specific entities
-
-    public static DslComponent entity(String id) {
-        return new DslComponent(Scope.GLOBAL, id);
-    }
-    public static DslComponent parent() {
-        return new DslComponent(Scope.PARENT, null);
-    }
-    public static DslComponent child(String id) {
-        return new DslComponent(Scope.CHILD, id);
-    }
-    public static DslComponent sibling(String id) {
-        return new DslComponent(Scope.SIBLING, id);
-    }
-    public static DslComponent descendant(String id) {
-        return new DslComponent(Scope.DESCENDANT, id);
-    }
-    public static DslComponent ancestor(String id) {
-        return new DslComponent(Scope.ANCESTOR, id);
-    }
-    public static DslComponent root() {
-        return new DslComponent(Scope.ROOT, null);
-    }
-    public static DslComponent scopeRoot() {
-        return new DslComponent(Scope.SCOPE_ROOT, null);
-    }
-    // prefer the syntax above to the below now, but not deprecating the below
-    public static DslComponent component(String id) {
-        return component("global", id);
-    }
-    public static DslComponent component(String scope, String id) {
-        if (!DslComponent.Scope.isValid(scope)) {
-            throw new IllegalArgumentException(scope + " is not a valid scope");
-        }
-        return new DslComponent(DslComponent.Scope.fromString(scope), id);
-    }
-
-    // Access things on entities
-
-    public static BrooklynDslDeferredSupplier<?> config(String keyName) {
-        return new DslComponent(Scope.THIS, "").config(keyName);
-    }
-
-    public static BrooklynDslDeferredSupplier<?> attributeWhenReady(String sensorName) {
-        return new DslComponent(Scope.THIS, "").attributeWhenReady(sensorName);
-    }
-
-    /** Returns a {@link Sensor}, looking up the sensor on the context if available and using that,
-     * or else defining an untyped (Object) sensor */
-    public static BrooklynDslDeferredSupplier<Sensor<?>> sensor(String sensorName) {
-        return new DslComponent(Scope.THIS, "").sensor(sensorName);
-    }
-    
-    /** Returns a {@link Sensor} declared on the type (e.g. entity class) declared in the first argument. */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static Sensor<?> sensor(String clazzName, String sensorName) {
-        try {
-            // TODO Should use catalog's classloader, rather than Class.forName; how to get that? Should we return a future?!
-            String mappedClazzName = DeserializingClassRenamesProvider.findMappedName(clazzName);
-            Class<?> clazz = Class.forName(mappedClazzName);
-            
-            Sensor<?> sensor;
-            if (Entity.class.isAssignableFrom(clazz)) {
-                sensor = new EntityDynamicType((Class<? extends Entity>) clazz).getSensor(sensorName);
-            } else {
-                // Some non-entity classes (e.g. ServiceRestarter policy) declare sensors that other
-                // entities/policies/enrichers may wish to reference.
-                Map<String,Sensor<?>> sensors = EntityDynamicType.findSensors((Class)clazz, null);
-                sensor = sensors.get(sensorName);
-            }
-            if (sensor == null) {
-                // TODO could extend API to return a sensor of the given type; useful but makes API ambiguous in theory (unlikely in practise, but still...)
-                throw new IllegalArgumentException("Sensor " + sensorName + " not found on class " + clazzName);
-            }
-            return sensor;
-        } catch (ClassNotFoundException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    // Build complex things
-
-    public static EntitySpecConfiguration entitySpec(Map<String, Object> arguments) {
-        return new EntitySpecConfiguration(arguments);
-    }
-
-    /**
-     * Return an instance of the specified class with its fields set according
-     * to the {@link Map} or a {@link BrooklynDslDeferredSupplier} if the arguments are not
-     * yet fully resolved.
-     */
-    @SuppressWarnings("unchecked")
-    public static Object object(Map<String, Object> arguments) {
-        ConfigBag config = ConfigBag.newInstance(arguments);
-        String typeName = BrooklynYamlTypeInstantiator.InstantiatorFromKey.extractTypeName("object", config).orNull();
-        Map<String,Object> objectFields = (Map<String, Object>) config.getStringKeyMaybe("object.fields").or(MutableMap.of());
-        Map<String,Object> brooklynConfig = (Map<String, Object>) config.getStringKeyMaybe(BrooklynCampReservedKeys.BROOKLYN_CONFIG).or(MutableMap.of());
-        try {
-            // TODO Should use catalog's classloader, rather than Class.forName; how to get that? Should we return a future?!
-            String mappedTypeName = DeserializingClassRenamesProvider.findMappedName(typeName);
-            Class<?> type = Class.forName(mappedTypeName);
-            
-            if (!Reflections.hasNoArgConstructor(type)) {
-                throw new IllegalStateException(String.format("Cannot construct %s bean: No public no-arg constructor available", type));
-            }
-            if ((objectFields.isEmpty() || DslUtils.resolved(objectFields.values())) &&
-                    (brooklynConfig.isEmpty() || DslUtils.resolved(brooklynConfig.values()))) {
-                return DslObject.create(type, objectFields, brooklynConfig);
-            } else {
-                return new DslObject(type, objectFields, brooklynConfig);
-            }
-        } catch (ClassNotFoundException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    // String manipulation
-
-    /** Return the expression as a literal string without any further parsing. */
-    public static Object literal(Object expression) {
-        return expression;
-    }
-
-    /**
-     * Returns a formatted string or a {@link BrooklynDslDeferredSupplier} if the arguments
-     * are not yet fully resolved.
-     */
-    public static Object formatString(final String pattern, final Object...args) {
-        if (DslUtils.resolved(args)) {
-            // if all args are resolved, apply the format string now
-            return String.format(pattern, args);
-        } else {
-            return new DslFormatString(pattern, args);
-        }
-    }
-
-    public static Object regexReplacement(final Object source, final Object pattern, final Object replacement) {
-        if (DslUtils.resolved(Arrays.asList(source, pattern, replacement))) {
-            return (new Functions.RegexReplacer(String.valueOf(pattern), String.valueOf(replacement))).apply(String.valueOf(source));
-        } else {
-            return new DslRegexReplacement(source, pattern, replacement);
-        }
-    }
-
-    /**
-     * Deferred execution of String formatting.
-     *
-     * @see DependentConfiguration#formatString(String, Object...)
-     */
-    protected static class DslFormatString extends BrooklynDslDeferredSupplier<String> {
-
-        private static final long serialVersionUID = -4849297712650560863L;
-
-        private String pattern;
-        private Object[] args;
-
-        public DslFormatString(String pattern, Object ...args) {
-            this.pattern = pattern;
-            this.args = args;
-        }
-
-        @Override
-        public Task<String> newTask() {
-            return DependentConfiguration.formatString(pattern, args);
-        }
-
-        @Override
-        public String toString() {
-            return "$brooklyn:formatString("+
-                JavaStringEscapes.wrapJavaString(pattern)+
-                (args==null || args.length==0 ? "" : ","+Strings.join(args, ","))+")";
-        }
-    }
-
-
-
-    protected static class DslRegexReplacement extends BrooklynDslDeferredSupplier<String> {
-
-        private Object source;
-        private Object pattern;
-        private Object replacement;
-
-        public DslRegexReplacement(Object source, Object pattern, Object replacement) {
-            this.pattern = pattern;
-            this.replacement = replacement;
-            this.source = source;
-        }
-
-        @Override
-        public Task<String> newTask() {
-            return DependentConfiguration.regexReplacement(source, pattern, replacement);
-        }
-
-        @Override
-        public String toString() {
-            return String.format("$brooklyn:regexReplace(%s:%s:%s)",source, pattern, replacement);
-        }
-    }
-
-    /** @deprecated since 0.7.0; use {@link DslFormatString} */
-    @SuppressWarnings("serial")
-    @Deprecated
-    protected static class FormatString extends DslFormatString {
-        public FormatString(String pattern, Object[] args) {
-            super(pattern, args);
-        }
-    }
-
-    /** Deferred execution of Object creation. */
-    protected static class DslObject extends BrooklynDslDeferredSupplier<Object> {
-
-        private static final long serialVersionUID = 8878388748085419L;
-
-        private Class<?> type;
-        private Map<String,Object> fields, config;
-
-        public DslObject(Class<?> type, Map<String,Object> fields,  Map<String,Object> config) {
-            this.type = type;
-            this.fields = MutableMap.copyOf(fields);
-            this.config = MutableMap.copyOf(config);
-        }
-
-        @SuppressWarnings("unchecked")
-        @Override
-        public Task<Object> newTask() {
-            List<TaskAdaptable<Object>> tasks = Lists.newLinkedList();
-            for (Object value : Iterables.concat(fields.values(), config.values())) {
-                if (value instanceof TaskAdaptable) {
-                    tasks.add((TaskAdaptable<Object>) value);
-                } else if (value instanceof TaskFactory) {
-                    tasks.add(((TaskFactory<TaskAdaptable<Object>>) value).newTask());
-                }
-            }
-            Map<String,?> flags = MutableMap.<String,String>of("displayName", "building '"+type+"' with "+tasks.size()+" task"+(tasks.size()!=1?"s":""));
-            return DependentConfiguration.transformMultiple(flags, new Function<List<Object>, Object>() {
-                        @Override
-                        public Object apply(List<Object> input) {
-                            Iterator<Object> values = input.iterator();
-                            for (String name : fields.keySet()) {
-                                Object value = fields.get(name);
-                                if (value instanceof TaskAdaptable || value instanceof TaskFactory) {
-                                    fields.put(name, values.next());
-                                } else if (value instanceof DeferredSupplier) {
-                                    fields.put(name, ((DeferredSupplier<?>) value).get());
-                                }
-                            }
-                            for (String name : config.keySet()) {
-                                Object value = config.get(name);
-                                if (value instanceof TaskAdaptable || value instanceof TaskFactory) {
-                                    config.put(name, values.next());
-                                } else if (value instanceof DeferredSupplier) {
-                                    config.put(name, ((DeferredSupplier<?>) value).get());
-                                }
-                            }
-                            return create(type, fields, config);
-                        }
-                    }, tasks);
-        }
-
-        public static <T> T create(Class<T> type, Map<String,?> fields, Map<String,?> config) {
-            try {
-                T bean;
-                try {
-                    bean = (T) TypeCoercions.coerce(fields, type);
-                } catch (ClassCoercionException ex) {
-                    bean = Reflections.invokeConstructorWithArgs(type).get();
-                    BeanUtils.populate(bean, fields);
-                }
-                if (bean instanceof Configurable && config.size() > 0) {
-                    ConfigBag brooklyn = ConfigBag.newInstance(config);
-                    FlagUtils.setFieldsFromFlags(bean, brooklyn);
-                    FlagUtils.setAllConfigKeys((Configurable) bean, brooklyn, true);
-                }
-                return bean;
-            } catch (Exception e) {
-                throw Exceptions.propagate(e);
-            }
-        }
-
-        @Override
-        public String toString() {
-            return "$brooklyn:object(\""+type.getName()+"\")";
-        }
-    }
-
-    /**
-     * Defers to management context's {@link ExternalConfigSupplierRegistry} to resolve values at runtime.
-     * The name of the appropriate {@link ExternalConfigSupplier} is captured, along with the key of
-     * the desired config value.
-     */
-    public static DslExternal external(final String providerName, final String key) {
-        return new DslExternal(providerName, key);
-    }
-    protected final static class DslExternal extends BrooklynDslDeferredSupplier<Object> {
-        private static final long serialVersionUID = -3860334240490397057L;
-        private final String providerName;
-        private final String key;
-
-        public DslExternal(String providerName, String key) {
-            this.providerName = providerName;
-            this.key = key;
-        }
-
-        @Override
-        public Task<Object> newTask() {
-            return Tasks.<Object>builder()
-                .displayName("resolving external configuration: '" + key + "' from provider '" + providerName + "'")
-                .dynamic(false)
-                .body(new Callable<Object>() {
-                    @Override
-                    public Object call() throws Exception {
-                        ManagementContextInternal managementContext = DslExternal.managementContext();
-                        return managementContext.getExternalConfigProviderRegistry().getConfig(providerName, key);
-                    }
-                })
-                .build();
-        }
-
-        @Override
-        public String toString() {
-            return "$brooklyn:external("+providerName+", "+key+")";
-        }
-    }
-
-    public static class Functions {
-        public static Object regexReplacement(final Object pattern, final Object replacement) {
-            if (DslUtils.resolved(pattern, replacement)) {
-                return new RegexReplacer(String.valueOf(pattern), String.valueOf(replacement));
-            } else {
-                return new DslRegexReplacer(pattern, replacement);
-            }
-        }
-
-        public static class RegexReplacer implements Function<String, String> {
-            private final String pattern;
-            private final String replacement;
-
-            public RegexReplacer(String pattern, String replacement) {
-                this.pattern = pattern;
-                this.replacement = replacement;
-            }
-
-            @Nullable
-            @Override
-            public String apply(@Nullable String s) {
-                return s == null ? null : Strings.replaceAllRegex(s, pattern, replacement);
-            }
-        }
-
-        protected static class DslRegexReplacer extends BrooklynDslDeferredSupplier<Function<String, String>> {
-
-            private Object pattern;
-            private Object replacement;
-
-            public DslRegexReplacer(Object pattern, Object replacement) {
-                this.pattern = pattern;
-                this.replacement = replacement;
-            }
-
-            @Override
-            public Task<Function<String, String>> newTask() {
-                return DependentConfiguration.regexReplacement(pattern, replacement);
-            }
-
-            @Override
-            public String toString() {
-                return String.format("$brooklyn:regexReplace(%s:%s)", pattern, replacement);
-            }
-        }
-    }
-
-}


[28/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-policies.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-policies.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-policies.yaml
deleted file mode 100644
index ff06f5b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-referencing-policies.yaml
+++ /dev/null
@@ -1,133 +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.
-#
-# Creates an application with the following structure, with each entity (including the application) having 
-# a policy with references to all other entities (including itself and the app) via config keys
-#
-#                              app
-#                          (app policy)
-#                               |
-#                        -------|-------
-#                        |             |
-#                     entity1       entity2
-#                   (e1 policy)   (e2 policy)
-#                        |
-#                 -------|-------
-#                 |             |
-#               child1        child2
-#             (c1 policy)   (c2 policy)
-#                 |
-#          -------|-------
-#          |             |
-#       gchild1       gchild2
-#     (g1 policy)   (g2 policy) 
-name: test-referencing-policies
-description: Test multi-layer application with each entity having a policy referencing all other entities
-origin: https://github.com/apache/incubator-brooklyn
-id: app1
-brooklyn.policies:
-  - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
-services:
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e1
-  name: entity 1
-  brooklyn.policies:
-  - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
-  brooklyn.children:
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c1
-      name: child 1
-      brooklyn.policies:
-      - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-        brooklyn.config:
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2")
-      brooklyn.children:
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc1
-        name: grandchild 1
-        brooklyn.policies:
-        - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-          brooklyn.config:
-            test.reference.app: $brooklyn:component("app1")
-            test.reference.entity1: $brooklyn:component("e1")
-            test.reference.entity2: $brooklyn:component("e2")
-            test.reference.child1: $brooklyn:component("c1")
-            test.reference.child2: $brooklyn:component("c2")
-            test.reference.grandchild1: $brooklyn:component("gc1")
-            test.reference.grandchild2: $brooklyn:component("gc2")
-      - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-        id: gc2
-        name: grandchild 2
-        brooklyn.policies:
-        - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-          brooklyn.config:
-            test.reference.app: $brooklyn:component("app1")
-            test.reference.entity1: $brooklyn:component("e1")
-            test.reference.entity2: $brooklyn:component("e2")
-            test.reference.child1: $brooklyn:component("c1")
-            test.reference.child2: $brooklyn:component("c2")
-            test.reference.grandchild1: $brooklyn:component("gc1")
-            test.reference.grandchild2: $brooklyn:component("gc2") 
-    - serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-      id: c2
-      name: child 2
-      brooklyn.policies:
-      - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-        brooklyn.config:
-          test.reference.app: $brooklyn:component("app1")
-          test.reference.entity1: $brooklyn:component("e1")
-          test.reference.entity2: $brooklyn:component("e2")
-          test.reference.child1: $brooklyn:component("c1")
-          test.reference.child2: $brooklyn:component("c2")
-          test.reference.grandchild1: $brooklyn:component("gc1")
-          test.reference.grandchild2: $brooklyn:component("gc2")
-- serviceType: org.apache.brooklyn.camp.brooklyn.ReferencingYamlTestEntity
-  id: e2
-  name: entity 2
-  brooklyn.policies:
-  - policyType: org.apache.brooklyn.camp.brooklyn.TestReferencingPolicy
-    brooklyn.config:
-      test.reference.app: $brooklyn:component("app1")
-      test.reference.entity1: $brooklyn:component("e1")
-      test.reference.entity2: $brooklyn:component("e2")
-      test.reference.child1: $brooklyn:component("c1")
-      test.reference.child2: $brooklyn:component("c2")
-      test.reference.grandchild1: $brooklyn:component("gc1")
-      test.reference.grandchild2: $brooklyn:component("gc2")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-tomcat-https.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-tomcat-https.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-tomcat-https.yaml
deleted file mode 100644
index 83a0fc6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/test-tomcat-https.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.
-#
-name: Test Tomcat HTTPS
-location: localhost
-services:
-- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
-  war: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
-  enabledProtocols: [https]
-  httpsSsl:
-    url: classpath://org/apache/brooklyn/entity/webapp/sample-java-keystore.jks
-    alias: myname
-    password: mypass

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/vanilla-bash-netcat-w-client.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/vanilla-bash-netcat-w-client.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/vanilla-bash-netcat-w-client.yaml
deleted file mode 100644
index 82a6f40..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/vanilla-bash-netcat-w-client.yaml
+++ /dev/null
@@ -1,96 +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.
-#
-# should be the same as what's in the docs, apart from this line
-
-name: Simple Netcat with Client
-
-location: localhost
-
-services:
-
-# the netcat server instance, running in listener mode (-l)
-- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
-  id: netcat-server
-  name: Simple Netcat Server
-  launch.command: |
-    echo hello | nc -l 4321 >> server-input &
-    echo $! > $PID_FILE
-
-  # a failure detector and a service restarter work together
-  brooklyn.enrichers:
-  - type: org.apache.brooklyn.policy.ha.ServiceFailureDetector
-    brooklyn.config:
-      # wait 15s after service fails before propagating failure
-      serviceFailedStabilizationDelay: 15s
-
-  brooklyn.policies:
-  - policyType: org.apache.brooklyn.policy.ha.ServiceRestarter
-    brooklyn.config:
-      # repeated failures in a time window can cause the restarter to abort,
-      # propagating the failure; a time window of 0 will mean it always restarts!
-      failOnRecurringFailuresInThisDuration: 0
-      
-  brooklyn.initializers:
-  # two sensors, recording the data sent to this netcat server:
-  
-  - type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
-    brooklyn.config:
-      name: output.last
-      command: tail -1 server-input
-      period: 100ms
-      
-  - type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
-    brooklyn.config:
-      name: output.all
-      command: cat server-input
-      period: 100ms
-
-# a client to hit netcat
-- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
-  name: Simple Pinger
-  
-  # set the hostname of the netcat instance as an env var for the scripts 
-  env:
-    TARGET_HOSTNAME: $brooklyn:component("netcat-server").attributeWhenReady("host.name")
-    
-  # start/check/stop are no-op
-  launch.command: ""
-  checkRunning.command: ""
-  stop.command: ""
-  
-  brooklyn.initializers:
-  # but there is a sample effector which runs nc in client mode
-  
-  - type: org.apache.brooklyn.core.effector.ssh.SshCommandEffector
-    brooklyn.config:
-      name: sayHiNetcat
-      description: Echo a small hello string to the netcat entity
-      command: |
-        echo $message | nc $TARGET_HOSTNAME 4321
-      parameters:
-        message:
-          description: The string to pass to netcat
-          defaultValue: hi netcat
-
-# and add an enricher at the root so all sensors from netcat-server are visible on the root
-brooklyn.enrichers:
-- enricherType: org.apache.brooklyn.enricher.stock.Propagator
-  brooklyn.config:
-    enricher.producer: $brooklyn:component("netcat-server")
-    enricher.propagating.propagatingAll: true

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/visitors-creation-script.sql
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/visitors-creation-script.sql b/brooklyn-server/camp/camp-brooklyn/src/test/resources/visitors-creation-script.sql
deleted file mode 100644
index a324d2e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/visitors-creation-script.sql
+++ /dev/null
@@ -1,41 +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.
---
-create database visitors;
-use visitors;
-
-# not necessary to create user if we grant (and not supported in some dialects)
-create user 'brooklyn' identified by 'br00k11n';
-
-grant usage on *.* to 'brooklyn'@'%' identified by 'br00k11n';
-
-# ''@localhost is sometimes set up, overriding brooklyn@'%', so do a second explicit grant
-grant usage on *.* to 'brooklyn'@'localhost' identified by 'br00k11n';
-
-grant all privileges on visitors.* to 'brooklyn'@'%';
-
-flush privileges;
-
-CREATE TABLE MESSAGES (
-        id BIGINT NOT NULL AUTO_INCREMENT,
-        NAME VARCHAR(30) NOT NULL,
-        MESSAGE VARCHAR(400) NOT NULL,
-        PRIMARY KEY (ID)
-    );
-
-INSERT INTO MESSAGES values (default, 'Isaac Asimov', 'I grew up in Brooklyn' );

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-app.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-app.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-app.yaml
deleted file mode 100644
index 33da321..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-app.yaml
+++ /dev/null
@@ -1,21 +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: Basic app
-services:
-- name: service
-  type: org.apache.brooklyn.entity.stock.BasicApplication

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-bundle-without-libraries.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-bundle-without-libraries.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-bundle-without-libraries.yaml
deleted file mode 100644
index b961708..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-bundle-without-libraries.yaml
+++ /dev/null
@@ -1,19 +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.
-#
-services:
-- type: org.apache.brooklyn.test.osgi.entities.SimpleEntity

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-catalog.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-catalog.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-catalog.yaml
deleted file mode 100644
index 545fd1a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-catalog.yaml
+++ /dev/null
@@ -1,21 +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: Basic app
-services:
-- name: service
-  type: yaml.basic:0.1.2

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-entity.yaml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-entity.yaml b/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-entity.yaml
deleted file mode 100644
index c9b1c55..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/resources/yaml-ref-entity.yaml
+++ /dev/null
@@ -1,21 +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: Basic entity
-services:
-- name: service
-  type: org.apache.brooklyn.entity.stock.BasicEntity

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/pom.xml b/brooklyn-server/camp/camp-server/pom.xml
deleted file mode 100644
index 502c83e..0000000
--- a/brooklyn-server/camp/camp-server/pom.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <artifactId>camp-server</artifactId>
-
-    <name>CAMP Server</name>
-    <description>
-        REST Server classes for CAMP server implementation
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn.camp</groupId>
-        <artifactId>camp-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn.camp</groupId>
-            <artifactId>camp-base</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn.camp</groupId>
-            <artifactId>camp-base</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <scope>test</scope>
-        </dependency>
-        
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <!-- jackson-core and jackson-annotations are pulled in from this, with the right version -->
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.jaxrs</groupId>
-            <artifactId>jackson-jaxrs-json-provider</artifactId>
-        </dependency>
-        
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-json</artifactId>
-              <exclusions>
-                <exclusion>
-                    <groupId>com.sun.xml.bind</groupId>
-                    <artifactId>jaxb-impl</artifactId>
-                </exclusion>
-            </exclusions>               
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-multipart</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.validation</groupId>
-            <artifactId>validation-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-rest-swagger</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <!-- ATTN: this moves the dependency version from 1.9.2 to 1.9.13 -->
-        <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-core-asl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        
-        <!-- TODO have a camp.log / logging module -->
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-logback-xml</artifactId>
-            <version>${project.version}</version>
-            <!-- optional so that this project has logging; dependencies may redeclare or supply their own -->
-            <optional>true</optional>
-        </dependency>
-        
-        
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApiErrorDto.java
deleted file mode 100644
index a65dbe1..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
deleted file mode 100644
index 9a3ddda..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java
+++ /dev/null
@@ -1,68 +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.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 {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java
deleted file mode 100644
index 25ed367..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.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.server.dto;
-
-import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
-import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
-
-public class ApplicationComponentTemplateDto extends ResourceDto {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
deleted file mode 100644
index 25a7989..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java
+++ /dev/null
@@ -1,73 +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.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 {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
deleted file mode 100644
index 3a7273f..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java
+++ /dev/null
@@ -1,68 +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.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 {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoBase.java
deleted file mode 100644
index fbf48ca..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/DtoCustomAttributes.java
deleted file mode 100644
index 0b7e320..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 org.apache.brooklyn.camp.server.dto;
-
-import java.util.Map;
-
-import org.apache.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/LinkDto.java
deleted file mode 100644
index d12de65..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java
deleted file mode 100644
index 9e8ef73..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.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 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 {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java
deleted file mode 100644
index f605890..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.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.server.dto;
-
-import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
-import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
-
-public class PlatformComponentTemplateDto extends ResourceDto {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
deleted file mode 100644
index 62a6aba..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java
+++ /dev/null
@@ -1,127 +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.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 {
-
-    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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
deleted file mode 100644
index cf5ca25..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ResourceDto.java
+++ /dev/null
@@ -1,111 +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.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 org.apache.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
deleted file mode 100644
index 0c99377..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampRestResources.java
+++ /dev/null
@@ -1,69 +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.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 com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-import com.google.common.collect.Iterables;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
-
-public class CampRestResources {
-
-    public static Iterable<AbstractCampRestResource> getCampRestResources() {
-        List<AbstractCampRestResource> resources = new ArrayList<>();
-        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<>();
-        resources.add(new ApidocRestResource());
-        return resources;
-    }
-
-    public static Iterable<Object> getMiscResources() {
-        List<Object> resources = new ArrayList<>();
-        resources.add(new SwaggerSerializers());
-        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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
deleted file mode 100644
index 0ad6bc2..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
+++ /dev/null
@@ -1,192 +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.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.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.net.Networking;
-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 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;
-import org.eclipse.jetty.server.NetworkConnector;
-import org.eclipse.jetty.server.ServerConnector;
-
-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;
-        NetworkConnector networkConnector = (NetworkConnector) server.getConnectors()[0];
-        return networkConnector.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);
-
-            // 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 server = new Server(threadPool);
-
-            ServerConnector httpConnector = new ServerConnector(server);
-            httpConnector.setPort(port);
-            server.addConnector(httpConnector);
-
-            server.setHandler(context);
-
-            try {
-                server.start();
-            } catch (Exception e) {
-                throw Exceptions.propagate(e);
-            } 
-            log.info("CAMP REST server started ("+summary+") on");
-            log.info("  http://localhost:"+httpConnector.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AbstractCampRestResource.java
deleted file mode 100644
index ed8a09c..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApidocRestResource.java
deleted file mode 100644
index 3c5f96d..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-import javax.ws.rs.Path;
-
-
-@Path(ApidocRestResource.API_URI_PATH)
-@Api("Web API Documentation")
-public class ApidocRestResource extends org.apache.brooklyn.rest.apidoc.ApiListingResource {
-
-    public static final String API_URI_PATH = PlatformRestResource.CAMP_URI_PATH + "/apidoc";
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java
deleted file mode 100644
index 5b2df5b..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(ApplicationComponentRestResource.URI_PATH)
-@Api("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",
-        response = ApplicationComponentDto.class)
-    @GET
-    public ApplicationComponentDto get(
-            @ApiParam(value = "ID of item being retrieved", required = true)
-            @PathParam("id") String id) {
-        return dto().adapt(lookup(camp().applicationComponents(), id));
-    }
-
-}


[50/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 13f1272..07f69e6 100644
--- a/README.md
+++ b/README.md
@@ -1,39 +1,7 @@
 
-### HISTORIC REPO: Apache Brooklyn has graduated!
+# [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/)
 
-This is the historical **incubator** repo for Apache Brooklyn. 
-This version of the codebase is no longer active. 
-
-**You're probably in the wrong place.**
-
-Visit:
-
-* **The Active Codebase**: at [http://github.com/apache/brooklyn/](http://github.com/apache/brooklyn/)
-* **The Apache Brooklyn Homepage**: at [http://brooklyn.apache.org/](http://brooklyn.apache.org/)
-
-### About the Incubator Project
-
-Apache Brooklyn was in the Apache Incubator until the end of 2015, on version `0.9.0-SNAPSHOT`.
-At this time it graduated to become a top-level Apache Software Foundation project,
-and the code moved from `incubator-brooklyn` to `brooklyn` and several other projects `brooklyn-*`.
-
-Versions `0.8.0-incubating` and before can be found in and built from this repo,
-along with the last commit to `0.9.0-SNAPSHOT` from which development has continued
-in `apache/brooklyn` and sub-projects.
-
-The sub-directories in this project correspond to multiple separate repositories now in the `apache` org.
-The link above to **[the Active Codebase](http://github.com/apache/brooklyn/)** started life exactly 
-as a copy of [`brooklyn/`](brooklyn/) in this folder, 
-as an uber-project for the other `brooklyn-*` folders, including the `server` and the `ui`,
-which are now top-level repos in the `apache` org.
-
-
-### To Build
-
-This historic version of the code can be built with:
-
-    mvn clean install
-
-This creates a build of the last incubator SNAPSHOT version in `usage/dist/target/brooklyn-dist`. Run 
-with `bin/brooklyn launch`. Although really you probably want **[the Active Codebase](http://github.com/apache/brooklyn/)**.
+### Apache Brooklyn Server Sub-Project
 
+This repo contains the core elements to run a Brooklyn server,
+from the API and utils through to the core implementation and the REST server.

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 0000000..f1994f4
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    
+    <artifactId>brooklyn-api</artifactId>
+    <name>Brooklyn API</name>
+    
+    <description>
+        API classes for Brooklyn
+    </description>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.findbugs</groupId>
+            <artifactId>jsr305</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-test-support</artifactId>
+            <scope>test</scope>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java b/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
new file mode 100644
index 0000000..b47d4b1
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/catalog/BrooklynCatalog.java
@@ -0,0 +1,141 @@
+/*
+ * 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.api.catalog;
+
+import java.util.Collection;
+import java.util.NoSuchElementException;
+
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Predicate;
+
+public interface BrooklynCatalog {
+    /** 
+     * Version set in catalog when creator does not supply a version, to mean a low priority item;
+     * and used when requesting to indicate the best version.
+     * (See {@link #getCatalogItem(String, String)} for discussion of the best version.)
+     */
+    static String DEFAULT_VERSION = "0.0.0_DEFAULT_VERSION";
+
+    /** @return The item matching the given given 
+     * {@link CatalogItem#getSymbolicName() symbolicName} 
+     * and optionally {@link CatalogItem#getVersion()},
+     * taking the best version if the version is {@link #DEFAULT_VERSION} or null,
+     * returning null if no matches are found. */
+    CatalogItem<?,?> getCatalogItem(String symbolicName, String version);
+
+    /** @return Deletes the item with the given {@link CatalogItem#getSymbolicName()
+     * symbolicName} and version
+     * @throws NoSuchElementException if not found */
+    void deleteCatalogItem(String symbolicName, String version);
+
+    /** variant of {@link #getCatalogItem(String, String)} which checks (and casts) type for convenience
+     * (returns null if type does not match) */
+    <T,SpecT> CatalogItem<T,SpecT> getCatalogItem(Class<T> type, String symbolicName, String version);
+
+    /** @return All items in the catalog */
+    <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems();
+
+    /** convenience for filtering items in the catalog; see CatalogPredicates for useful filters */
+    <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems(Predicate<? super CatalogItem<T,SpecT>> filter);
+
+    /** persists the catalog item to the object store, if persistence is enabled */
+    public void persist(CatalogItem<?, ?> catalogItem);
+
+    /** @return The classloader which should be used to load classes and entities;
+     * this includes all the catalog's classloaders in the right order.
+     * This is a wrapper which will update as the underlying catalog items change,
+     * so it is safe for callers to keep a handle on this. */
+    public ClassLoader getRootClassLoader();
+
+    /** creates a spec for the given catalog item, throwing exceptions if any problems */
+    // TODO this should be cached on the item and renamed getSpec(...), else we re-create it too often (every time catalog is listed)
+    <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createSpec(CatalogItem<T, SpecT> item);
+
+    /**
+     * Adds an item (represented in yaml) to the catalog.
+     * Fails if the same version exists in catalog.
+     *
+     * @throws IllegalArgumentException if the yaml was invalid
+     * @deprecated since 0.7.0 use {@link #addItems(String, boolean)}
+     */
+    @Deprecated
+    CatalogItem<?,?> addItem(String yaml);
+    
+    /**
+     * Adds an item (represented in yaml) to the catalog.
+     * 
+     * @param forceUpdate If true allows catalog update even when an
+     * item exists with the same symbolicName and version
+     *
+     * @throws IllegalArgumentException if the yaml was invalid
+     * @deprecated since 0.7.0 use {@link #addItems(String, boolean)}
+     */
+    @Deprecated
+    CatalogItem<?,?> addItem(String yaml, boolean forceUpdate);
+    
+    /**
+     * Adds items (represented in yaml) to the catalog.
+     * Fails if the same version exists in catalog.
+     *
+     * @throws IllegalArgumentException if the yaml was invalid
+     */
+    Iterable<? extends CatalogItem<?,?>> addItems(String yaml);
+    
+    /**
+     * Adds items (represented in yaml) to the catalog.
+     * 
+     * @param forceUpdate If true allows catalog update even when an
+     * item exists with the same symbolicName and version
+     *
+     * @throws IllegalArgumentException if the yaml was invalid
+     */
+    Iterable<? extends CatalogItem<?,?>> addItems(String yaml, boolean forceUpdate);
+    
+    /**
+     * adds an item to the 'manual' catalog;
+     * this does not update the classpath or have a record to the java Class
+     *
+     * @deprecated since 0.7.0 Construct catalogs with yaml (referencing OSGi bundles) instead
+     */
+    // TODO maybe this should stay on the API? -AH Apr 2015 
+    @Deprecated
+    void addItem(CatalogItem<?,?> item);
+
+    /**
+     * Creates a catalog item and adds it to the 'manual' catalog,
+     * with the corresponding Class definition (loaded by a classloader)
+     * registered and available in the classloader.
+     * <p>
+     * Note that the class will be available for this session only,
+     * although the record of the item will appear in the catalog DTO if exported,
+     * so it is recommended to edit the 'manual' catalog DTO if using it to
+     * generate a catalog, either adding the appropriate classpath URL or removing this entry.
+     *
+     * @deprecated since 0.7.0 Construct catalogs with OSGi bundles instead.
+     * This is used in a handful of tests which should be rewritten to refer to OSGi bundles.
+     */
+    @Deprecated
+    @VisibleForTesting
+    CatalogItem<?,?> addItem(Class<?> clazz);
+
+    void reset(Collection<CatalogItem<?, ?>> entries);
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java b/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java
new file mode 100644
index 0000000..1c6b680
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/catalog/Catalog.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.catalog;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** 
+ * annotation that can be placed on an Application (template), entity or policy 
+ * to give metadata for when used in a catalog and to indicate inclusion in annotation-scanned catalogs
+ * <p>
+ * the "id" field used in the catalog is not exposed here but is always taken as the Class.getName() of the annotated item
+ * if loaded from an annotation.  (the "type" field unsurprisingly is given the same value).  
+ * {@link #name()}, if not supplied, is the SimpleName of the class.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface Catalog {
+
+    String name() default "";
+    String description() default "";
+    String iconUrl() default "";
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java
new file mode 100644
index 0000000..88d72cb
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogConfig.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.api.catalog;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD })
+public @interface CatalogConfig {
+
+    /** a label to be displayed when a config key is exposed as editable in the catalog */ 
+    String label();
+    
+    /** a priority used to determine the order in which config keys are displayed when presenting as editable in the catalog;
+     * a higher value appears higher in the list. the default is 1.
+     * (negative values may be used to indicate advanced config which might not be shown unless requested.) */ 
+    double priority() default 1;
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
new file mode 100644
index 0000000..795e393
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java
@@ -0,0 +1,153 @@
+/*
+ * 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.api.catalog;
+
+import java.util.Collection;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Application;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public interface CatalogItem<T,SpecT> extends BrooklynObject, Rebindable {
+    
+    public static enum CatalogItemType {
+        TEMPLATE, 
+        ENTITY, 
+        POLICY,
+        LOCATION;
+        
+        public static CatalogItemType ofSpecClass(Class<? extends AbstractBrooklynObjectSpec<?, ?>> type) {
+            if (type==null) return null;
+            if (PolicySpec.class.isAssignableFrom(type)) return POLICY;
+            if (LocationSpec.class.isAssignableFrom(type)) return LOCATION;
+            if (EntitySpec.class.isAssignableFrom(type)) return ENTITY;
+            return null;
+        }
+        public static CatalogItemType ofTargetClass(Class<? extends BrooklynObject> type) {
+            if (type==null) return null;
+            if (Policy.class.isAssignableFrom(type)) return POLICY;
+            if (Location.class.isAssignableFrom(type)) return LOCATION;
+            if (Application.class.isAssignableFrom(type)) return TEMPLATE;
+            if (Entity.class.isAssignableFrom(type)) return ENTITY;
+            return null;
+        }
+    }
+    
+    public static interface CatalogBundle extends OsgiBundleWithUrl {
+        /** @deprecated since 0.9.0, use {@link #isNameResolved()} */
+        public boolean isNamed();
+    }
+
+    /**
+     * @throws UnsupportedOperationException; config not supported for catalog items
+     */
+    @Override
+    ConfigurationSupport config();
+
+    /**
+     * @throws UnsupportedOperationException; subscriptions are not supported for catalog items
+     */
+    @Override
+    SubscriptionSupport subscriptions();
+
+    /** @deprecated since 0.7.0 in favour of {@link CatalogBundle}, kept for rebind compatibility */
+    @Deprecated
+    public static interface CatalogItemLibraries {
+        Collection<String> getBundles();
+    }
+
+    public CatalogItemType getCatalogItemType();
+
+    /** @return The high-level type of this entity, e.g. Entity (not a specific Entity class) */
+    public Class<T> getCatalogItemJavaType();
+
+    /** @return The type of the spec e.g. EntitySpec corresponding to {@link #getCatalogItemJavaType()} */
+    public Class<SpecT> getSpecType();
+    
+    /**
+     * @return The underlying java type of the item represented, if not described via a YAML spec.
+     * Normally null (and the type comes from yaml).
+     * @deprecated since 0.9.0. Use plan based items instead ({@link #getPlanYaml()})
+     */
+    @Deprecated
+    @Nullable public String getJavaType();
+
+    /** @deprecated since 0.7.0. Use {@link #getDisplayName} */
+    @Deprecated
+    public String getName();
+
+    /** @deprecated since 0.7.0. Use {@link #getSymbolicName} */
+    @Deprecated
+    public String getRegisteredTypeName();
+
+    @Nullable public String getDescription();
+
+    @Nullable public String getIconUrl();
+
+    public String getSymbolicName();
+
+    public String getVersion();
+
+    public Collection<CatalogBundle> getLibraries();
+
+    public String toXmlString();
+
+    /** @return The underlying YAML for this item, if known; 
+     * currently including `services:` or `brooklyn.policies:` prefix (but this will likely be removed) */
+    @Nullable public String getPlanYaml();
+
+    @Override
+    RebindSupport<CatalogItemMemento> getRebindSupport();
+    
+    /** Built up from {@link #getSymbolicName()} and {@link #getVersion()}.
+     * 
+     * (It is a bit self-referential having this method on this type of {@link BrooklynObject},
+     * but it is easier this than making the interface hierarchy more complicated.) */
+    @Override
+    public String getCatalogItemId();
+
+    public void setDeprecated(boolean deprecated);
+
+    public void setDisabled(boolean disabled);
+
+    /**
+     * @return True if the item has been deprecated (i.e. its use is discouraged)
+     */
+    boolean isDeprecated();
+    
+    /**
+     * @return True if the item has been disabled (i.e. its use is forbidden, except for pre-existing apps)
+     */
+    boolean isDisabled();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java b/api/src/main/java/org/apache/brooklyn/api/effector/Effector.java
new file mode 100644
index 0000000..82ce6ee
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/effector/Effector.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.api.effector;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.management.MBeanOperationInfo;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/**
+ * An operation of some kind, carried out by an {@link Entity}.
+ *
+ * Similar to the concepts in the JMX {@link MBeanOperationInfo} class.
+ */
+public interface Effector<T> extends Serializable {
+    /**
+     * human-friendly name of the effector (although frequently this uses java method naming convention)
+     */
+    String getName();
+
+    Class<T> getReturnType();
+
+    /**
+     * canonical name of return type (in case return type does not resolve after serialization)
+     */
+    String getReturnTypeName();
+
+    /**
+     * parameters expected by method, including name and type, optional description and default value
+     */
+    List<ParameterType<?>> getParameters();
+
+    /**
+     * optional description for the effector
+     */
+    String getDescription();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java b/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
new file mode 100644
index 0000000..7f0736d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/effector/ParameterType.java
@@ -0,0 +1,48 @@
+/*
+ * 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.api.effector;
+
+import java.io.Serializable;
+
+import javax.management.MBeanParameterInfo;
+
+/**
+ * Similar to the concepts in the JMX {@link MBeanParameterInfo} class.
+ *
+ * @see Effector
+ */
+public interface ParameterType<T> extends Serializable {
+    
+    public String getName();
+
+    public Class<T> getParameterClass();
+
+    /**
+     * The canonical name of the parameter class; especially useful if the class 
+     * cannot be resolved after deserialization. 
+     */
+    public String getParameterClassName();
+
+    public String getDescription();
+
+    /**
+     * @return The default value for this parameter, if not supplied during an effector call.
+     */
+    public T getDefaultValue();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Application.java b/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
new file mode 100644
index 0000000..402d004
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/Application.java
@@ -0,0 +1,34 @@
+/*
+ * 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.api.entity;
+
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+
+
+/**
+ * An application is the root of the entity hierarchy. In the parent-child relationship, it is
+ * the top-level entity under which the application's entities are all places.
+ * 
+ * The recommended ways to write a new application are to either extend {@link org.apache.brooklyn.entity.factory.ApplicationBuilder} 
+ * or to extend {@link org.apache.brooklyn.core.entity.AbstractApplication}.
+ */
+public interface Application extends Entity {
+    
+    ManagementContext getManagementContext();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
new file mode 100644
index 0000000..14d3c23
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
@@ -0,0 +1,442 @@
+/*
+ * 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.api.entity;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.objs.BrooklynObject;
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.EnricherSpec;
+import org.apache.brooklyn.api.sensor.Feed;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+
+/**
+ * The basic interface for a Brooklyn entity.
+ * <p>
+ * Implementors of entities are strongly encouraged to extend {@link org.apache.brooklyn.core.entity.AbstractEntity}.
+ * <p>
+ * To instantiate an entity, see {@code managementContext.getEntityManager().createEntity(entitySpec)}.
+ * Also see {@link org.apache.brooklyn.core.entity.factory.ApplicationBuilder}, 
+ * {@link org.apache.brooklyn.core.entity.AbstractEntity#addChild(EntitySpec)}, and
+ * {@link org.apache.brooklyn.api.entity.EntitySpec}.
+ * <p>
+ * 
+ * @see org.apache.brooklyn.core.entity.AbstractEntity
+ */
+public interface Entity extends BrooklynObject {
+    /**
+     * The unique identifier for this entity.
+     */
+    @Override
+    String getId();
+    
+    /**
+     * Returns the creation time for this entity, in UTC.
+     */
+    long getCreationTime();
+    
+    /**
+     * A display name; recommended to be a concise single-line description.
+     */
+    String getDisplayName();
+    
+    /** 
+     * A URL pointing to an image which can be used to represent this entity.
+     */
+    @Nullable String getIconUrl();
+    
+    /**
+     * Information about the type of this entity; analogous to Java's object.getClass.
+     */
+    EntityType getEntityType();
+    
+    /**
+     * @return the {@link Application} this entity is registered with, or null if not registered.
+     */
+    Application getApplication();
+
+    /**
+     * @return the id of the {@link Application} this entity is registered with, or null if not registered.
+     */
+    String getApplicationId();
+
+    /**
+     * The parent of this entity, null if no parent.
+     *
+     * The parent is normally the entity responsible for creating/destroying/managing this entity.
+     *
+     * @see #setParent(Entity)
+     * @see #clearParent
+     */
+    Entity getParent();
+    
+    /** 
+     * Return the entities that are children of (i.e. "owned by") this entity
+     */
+    Collection<Entity> getChildren();
+    
+    /**
+     * Sets the entity's display name.
+     */
+    void setDisplayName(String displayName);
+
+    /**
+     * Sets the parent (i.e. "owner") of this entity. Returns this entity, for convenience.
+     *
+     * @see #getParent
+     * @see #clearParent
+     */
+    Entity setParent(Entity parent);
+    
+    /**
+     * Clears the parent (i.e. "owner") of this entity. Also cleans up any references within its parent entity.
+     *
+     * @see #getParent
+     * @see #setParent
+     */
+    void clearParent();
+    
+    /** 
+     * Add a child {@link Entity}, and set this entity as its parent,
+     * returning the added child.
+     * <p>
+     * As with {@link #addChild(EntitySpec)} the child is <b>not</b> brought under management
+     * as part of this call.  It should not be managed prior to this call either.
+     */
+    <T extends Entity> T addChild(T child);
+    
+    /** 
+     * Creates an {@link Entity} from the given spec and adds it, setting this entity as the parent,
+     * returning the added child.
+     * <p>
+     * The added child is <b>not</b> managed as part of this call, even if the parent is managed,
+     * so if adding post-management an explicit call to manage the child will be needed;
+     * see the convenience method <code>Entities.manage(...)</code>. 
+     * */
+    <T extends Entity> T addChild(EntitySpec<T> spec);
+    
+    /** 
+     * Removes the specified child {@link Entity}; its parent will be set to null.
+     * 
+     * @return True if the given entity was contained in the set of children
+     */
+    boolean removeChild(Entity child);
+    
+    /**
+     * @return an immutable thread-safe view of the policies.
+     * 
+     * @deprecated since 0.9.0; see {@link PolicySupport#getPolicies()}
+     */
+    @Deprecated
+    Collection<Policy> getPolicies();
+    
+    /**
+     * @return an immutable thread-safe view of the enrichers.
+     * 
+     * @deprecated since 0.9.0; see {@link EnricherSupport#getEnrichers()}
+     */
+    @Deprecated
+    Collection<Enricher> getEnrichers();
+    
+    /**
+     * The {@link Collection} of {@link Group}s that this entity is a member of.
+     *
+     * Groupings can be used to allow easy management/monitoring of a group of entities.
+     * 
+     * @deprecated since 0.9.0; see {@link GroupSupport#getGroups()} and {@link #groups()}
+     */
+    @Deprecated
+    Collection<Group> getGroups();
+
+    /**
+     * Add this entity as a member of the given {@link Group}. Called by framework.
+     * <p>
+     * Users should call {@link Group#addMember(Entity)} instead; this method will then 
+     * automatically be called. However, the reverse is not true (calling this method will 
+     * not tell the group; this behaviour may change in a future release!)
+     * 
+     * @deprecated since 0.9.0; see {@link GroupSupport#add()} and {@link #groups()}
+     */
+    @Deprecated
+    void addGroup(Group group);
+
+    /**
+     * Removes this entity as a member of the given {@link Group}. Called by framework.
+     * <p>
+     * Users should call {@link Group#removeMember(Entity)} instead; this method will then 
+     * automatically be called. However, the reverse is not true (calling this method will 
+     * not tell the group; this behaviour may change in a future release!)
+     * 
+     * @deprecated since 0.9.0; see {@link GroupSupport#remove()} and {@link #groups()}
+     */
+    @Deprecated
+    void removeGroup(Group group);
+
+    /**
+     * Return all the {@link Location}s this entity is deployed to.
+     */
+    Collection<Location> getLocations();
+
+    /**
+     * Convenience for calling {@link SensorSupport#get(AttributeSensor)},
+     * via code like {@code sensors().get(key)}.
+     */
+    <T> T getAttribute(AttributeSensor<T> sensor);
+    
+    /**
+     * @see {@link #getConfig(ConfigKey)}
+     */
+    <T> T getConfig(HasConfigKey<T> key);
+    
+    /**
+     * Returns the uncoerced value for this config key as set on this entity, if available,
+     * not following any inheritance chains and not taking any default.
+     * 
+     * @deprecated since 0.7.0; use {@code ((EntityInternal)entity).config().getRaw()} or
+     *             {@code ((EntityInternal)entity).config().getLocalRaw()}
+     */
+    @Deprecated
+    Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited);
+    
+    /**
+     * @see {@link #getConfigRaw(ConfigKey, boolean)}.
+     * 
+     * @deprecated since 0.7.0
+     */
+    @Deprecated
+    Maybe<Object> getConfigRaw(HasConfigKey<?> key, boolean includeInherited);
+
+    /**
+     * Invokes the given effector, with the given parameters to that effector.
+     */
+    <T> Task<T> invoke(Effector<T> eff, Map<String,?> parameters);
+    
+    /**
+     * Adds the given policy to this entity. Also calls policy.setEntity if available.
+     * 
+     * @deprecated since 0.9.0; see {@link PolicySupport#add(Policy)}
+     */
+    @Deprecated
+    void addPolicy(Policy policy);
+    
+    /**
+     * Adds the given policy to this entity. Also calls policy.setEntity if available.
+     * 
+     * @deprecated since 0.9.0; see {@link PolicySupport#add(PolicySpec)}
+     */
+    @Deprecated
+    <T extends Policy> T addPolicy(PolicySpec<T> policy);
+    
+    /**
+     * Removes the given policy from this entity. 
+     * @return True if the policy existed at this entity; false otherwise
+     * 
+     * @deprecated since 0.9.0; see {@link PolicySupport#remove(Policy)}
+     */
+    @Deprecated
+    boolean removePolicy(Policy policy);
+    
+    /**
+     * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
+     * 
+     * @deprecated since 0.9.0; see {@link EnricherSupport#add(Enricher)}
+     */
+    @Deprecated
+    void addEnricher(Enricher enricher);
+    
+    /**
+     * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
+     * 
+     * @deprecated since 0.9.0; see {@link EnricherSupport#add(EnricherSpec)}
+     */
+    @Deprecated
+    <T extends Enricher> T addEnricher(EnricherSpec<T> enricher);
+    
+    /**
+     * Removes the given enricher from this entity. 
+     * @return True if the policy enricher at this entity; false otherwise
+     * 
+     * @deprecated since 0.9.0; see {@link EnricherSupport#remove(Enricher)}
+     */
+    @Deprecated
+    boolean removeEnricher(Enricher enricher);
+    
+    /**
+     * Adds the given feed to this entity. Also calls feed.setEntity if available.
+     */
+    <T extends Feed> T addFeed(T feed);
+    
+    SensorSupport sensors();
+
+    PolicySupport policies();
+
+    EnricherSupport enrichers();
+
+    GroupSupport groups();
+
+    @Override
+    RelationSupport<Entity> relations();
+    
+    @Beta
+    public interface SensorSupport {
+
+        /**
+         * Gets the value of the given attribute on this entity, or null if has not been set.
+         *
+         * Attributes can be things like workrate and status information, as well as
+         * configuration (e.g. url/jmxHost/jmxPort), etc.
+         */
+        <T> T get(AttributeSensor<T> key);
+
+        /**
+         * Sets the {@link AttributeSensor} data for the given attribute to the specified value.
+         * 
+         * This can be used to "enrich" the entity, such as adding aggregated information, 
+         * rolling averages, etc.
+         * 
+         * @return the old value for the attribute (possibly {@code null})
+         */
+        <T> T set(AttributeSensor<T> attribute, T val);
+
+        /**
+         * Atomically modifies the {@link AttributeSensor}, ensuring that only one modification is done
+         * at a time.
+         * 
+         * If the modifier returns {@link Maybe#absent()} then the attribute will be
+         * left unmodified, and the existing value will be returned.
+         * 
+         * For details of the synchronization model used to achieve this, refer to the underlying 
+         * attribute store (e.g. AttributeMap).
+         * 
+         * @return the old value for the attribute (possibly {@code null})
+         * @since 0.7.0-M2
+         */
+        @Beta
+        <T> T modify(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier);
+
+        /**
+         * Emits a {@link SensorEvent} event on behalf of this entity (as though produced by this entity).
+         * <p>
+         * Note that for attribute sensors it is nearly always recommended to use setAttribute, 
+         * as this method will not update local values.
+         */
+        <T> void emit(Sensor<T> sensor, T value);
+    }
+    
+    public interface AdjunctSupport<T extends EntityAdjunct> extends Iterable<T> {
+        /**
+         * @return A read-only thread-safe iterator over all the instances.
+         */
+        Iterator<T> iterator();
+        
+        int size();
+        boolean isEmpty();
+        
+        /**
+         * Adds an instance.
+         */
+        void add(T val);
+        
+        /**
+         * Removes an instance.
+         */
+        boolean remove(T val);
+    }
+    
+    @Beta
+    public interface PolicySupport extends AdjunctSupport<Policy> {
+        /**
+         * Adds the given policy to this entity. Also calls policy.setEntity if available.
+         */
+        @Override
+        void add(Policy policy);
+        
+        /**
+         * Removes the given policy from this entity. 
+         * @return True if the policy existed at this entity; false otherwise
+         */
+        @Override
+        boolean remove(Policy policy);
+        
+        /**
+         * Adds the given policy to this entity. Also calls policy.setEntity if available.
+         */
+        <T extends Policy> T add(PolicySpec<T> enricher);
+    }
+    
+    @Beta
+    public interface EnricherSupport extends AdjunctSupport<Enricher> {
+        /**
+         * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
+         */
+        @Override
+        void add(Enricher enricher);
+        
+        /**
+         * Removes the given enricher from this entity. 
+         * @return True if the policy enricher at this entity; false otherwise
+         */
+        @Override
+        boolean remove(Enricher enricher);
+        
+        /**
+         * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
+         */
+        <T extends Enricher> T add(EnricherSpec<T> enricher);
+    }
+
+    /**
+     * For managing/querying the group membership of this entity. 
+     * 
+     * Groupings can be used to allow easy management/monitoring of a group of entities.
+     * 
+     * To add/remove this entity from a group, users should call {@link Group#addMember(Entity)} 
+     * and {@link Group#removeMember(Entity)}. In a future release, add/remove methods may be
+     * added here.
+     */
+    @Beta
+    public interface GroupSupport extends Iterable<Group> {
+        /**
+         * A read-only thread-safe iterator over all the {@link Group}s that this entity is a member of.
+         */
+        @Override
+        Iterator<Group> iterator();
+        
+        int size();
+        boolean isEmpty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.java
new file mode 100644
index 0000000..a9f407a
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntityInitializer.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.api.entity;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.objs.EntityAdjunct;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.sensor.Feed;
+
+/** 
+ * Instances of this class supply logic which can be used to initialize entities. 
+ * These can be added to an {@link EntitySpec} programmatically, or declared as part
+ * of YAML recipes in a <code>brooklyn.initializers</code> section.
+ * In the case of the latter, implementing classes should define a no-arg constructor
+ * or a {@link Map} constructor so that YAML parameters can be supplied.
+ * <p>
+ * Note that initializers are only invoked on first creation; they are not called 
+ * during a rebind. Instead, the typical pattern is that initializers will create
+ * {@link EntityAdjunct} instances such as {@link Policy} and {@link Feed}
+ * which will be attached during rebind.
+ **/ 
+public interface EntityInitializer {
+    
+    /** Applies initialization logic to a just-built entity.
+     * Invoked immediately after the "init" call on the AbstractEntity constructed.
+     * 
+     * @param entity guaranteed to be the actual implementation instance, 
+     * thus guaranteed to be castable to EntityInternal which is often desired,
+     * or to the type at hand (it is not even a proxy)
+     */
+    public void apply(EntityLocal entity);
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
new file mode 100644
index 0000000..aeb7249
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntityLocal.java
@@ -0,0 +1,175 @@
+/*
+ * 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.api.entity;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.mgmt.SubscriptionContext;
+import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
+import org.apache.brooklyn.api.mgmt.SubscriptionManager;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+import org.apache.brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+
+/** 
+ * Extended Entity interface for use in places where the caller should have certain privileges,
+ * such as setting attribute values, adding policies, etc.
+ * 
+ * FIXME Moved from core project to api project because of bug in groovy's covariant return types.
+ * EntityDriver needs to return EntityLocal rather than Entity, to avoid changing a whole load
+ * of sub-types.
+ * FIXME Add {@link setAttribute(AttributeSensorAndConfigKey<?,T>)} back in if/when move it back,
+ * or if we extract an interface for AttributeSensorAndConfigKey.
+ * 
+ * @deprecated since 0.9.0; use {@link Entity} or {@link org.apache.brooklyn.core.entity.EntityInternal}
+ */
+public interface EntityLocal extends Entity {
+    
+    // FIXME Rename to something other than EntityLocal.
+    // Separate out what is specific to "local jvm", and what is here for an SPI rather than API.
+
+    /**
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
+     */
+    @Deprecated
+    <T> T setConfig(ConfigKey<T> key, T val);
+    
+    /**
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
+     */
+    @Deprecated
+    <T> T setConfig(ConfigKey<T> key, Task<T> val);
+    
+    /**
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
+     */
+    @Deprecated
+    <T> T setConfig(HasConfigKey<T> key, T val);
+    
+    /**
+     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().set(key, val)}
+     */
+    @Deprecated
+    <T> T setConfig(HasConfigKey<T> key, Task<T> val);
+
+    /**
+     * @deprecated since 0.8.0; use {@link SensorSupport#set(AttributeSensor, Object)} via code like {@code sensors().set(attribute, val)}.
+     */
+    <T> T setAttribute(AttributeSensor<T> attribute, T val);
+
+    /**
+     * @deprecated since 0.8.0; use {@link SensorSupport#modify(AttributeSensor, Function)} via code like {@code sensors().modify(attribute, modifier)}.
+     */
+    @Beta
+    <T> T modifyAttribute(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier);
+
+    /**
+     * @deprecated since 0.8.0; use {@link SensorSupport#emit(Sensor, Object)} via code like {@code sensors().emit(sensor, val)}.
+     */
+    <T> void emit(Sensor<T> sensor, T value);
+    
+    /**
+     * @deprecated in 0.5; use {@link #getConfig(ConfigKey)}
+     */
+    <T> T getConfig(ConfigKey<T> key, T defaultValue);
+    
+    /**
+     * @deprecated in 0.5; use {@link #getConfig(HasConfigKey)}
+     */
+    <T> T getConfig(HasConfigKey<T> key, T defaultValue);
+
+    /**
+     * Allow us to subscribe to data from a {@link Sensor} on another entity.
+     * 
+     * @return a subscription id which can be used to unsubscribe
+     *
+     * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
+     * 
+     * @deprecated since 0.9.0; see {@link SubscriptionSupportInternal#getSubscriptionContext()}, e.g. with {@code subscriptions().getSubscriptionContext()}
+     */
+    @Deprecated
+    @Beta
+    <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+    /**
+     * @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)
+     * 
+     * @deprecated since 0.9.0; see {@link SubscriptionSupport#subscribeToChildren(Entity, Sensor, SensorEventListener)}, e.g. with {@code subscriptions().subscribeToChildren(...)}
+     */
+    @Deprecated
+    @Beta
+    <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener);
+ 
+    /**
+     * @see SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener)
+     * 
+     * @deprecated since 0.9.0; see {@link SubscriptionSupport#subscribeToMembers(Entity, Sensor, SensorEventListener)}, e.g. with {@code subscriptions().subscribeToMembers(...)}
+     */
+    @Deprecated
+    @Beta
+    <T> SubscriptionHandle subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener);
+
+    /**
+     * Unsubscribes from the given producer.
+     *
+     * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
+     * 
+     * @deprecated since 0.9.0; see {@link SubscriptionSupport#unsubscribe(Entity)}, e.g. with {@code subscriptions().unsubscribe(...)}
+     */
+    @Deprecated
+    @Beta
+    boolean unsubscribe(Entity producer);
+
+    /**
+     * Unsubscribes the given handle.
+     *
+     * @see SubscriptionContext#unsubscribe(SubscriptionHandle)
+     * 
+     * @deprecated since 0.9.0; see {@link SubscriptionSupport#unsubscribe(Entity, SubscriptionHandle)}, e.g. with {@code subscriptions().unsubscribe(...)}
+     */
+    @Deprecated
+    @Beta
+    boolean unsubscribe(Entity producer, SubscriptionHandle handle);
+
+    /**
+     * Removes all policy from this entity. 
+     * @return True if any policies existed at this entity; false otherwise
+     * 
+     * @deprecated since 0.9.0; see {@link PolicySupportInternal#removeAllPolicies()}, e.g. {@code ((EntityInternal)entity).policies().removeAllPolicies()}
+     */
+    @Deprecated
+    boolean removeAllPolicies();
+    
+    /**
+     * Removes all enricher from this entity.
+     * Use with caution as some entities automatically register enrichers; this will remove those enrichers as well.
+     * @return True if any enrichers existed at this entity; false otherwise
+     * 
+     * @deprecated since 0.9.0; see {@link EnricherSupportInternal#removeAllEnrichers()}, e.g. {@code ((EntityInternal)entity).enrichers().removeAllEnrichers()}
+     */
+    @Deprecated
+    boolean removeAllEnrichers();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
new file mode 100644
index 0000000..58cf946
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
@@ -0,0 +1,401 @@
+/*
+ * 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.api.entity;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.policy.Policy;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.Enricher;
+import org.apache.brooklyn.api.sensor.EnricherSpec;
+import org.apache.brooklyn.util.collections.MutableList;
+
+import com.google.common.base.Function;
+import com.google.common.base.Throwables;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Gives details of an entity to be created. It describes the entity's configuration, and is
+ * reusable to create multiple entities with the same configuration.
+ * 
+ * To create an EntitySpec, it is strongly encouraged to use {@link #create(Class)} etc.
+ * Users who need to implement this are strongly encouraged to extend 
+ * {@link org.apache.brooklyn.api.entity.EntitySpec}.
+ * 
+ * @param <T> The type of entity to be created
+ * 
+ * @author aled
+ */
+public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,EntitySpec<T>> {
+
+    private static final long serialVersionUID = -2247153452919128990L;
+    
+    /**
+     * Creates a new {@link EntitySpec} instance for an entity of the given type. The returned 
+     * {@link EntitySpec} can then be customized.
+     * 
+     * @param type An {@link Entity} interface
+     */
+    public static <T extends Entity> EntitySpec<T> create(Class<T> type) {
+        return new EntitySpec<T>(type);
+    }
+    
+    /**
+     * Creates a new {@link EntitySpec} instance for an entity of the given type. The returned 
+     * {@link EntitySpec} can then be customized.
+     * 
+     * @param type     An {@link Entity} interface
+     * @param implType An {@link Entity} implementation, which implements the {@code type} interface
+     */
+    public static <T extends Entity, U extends T> EntitySpec<T> create(Class<T> type, Class<U> implType) {
+        return new EntitySpec<T>(type).impl(implType);
+    }
+    
+    /**
+     * Creates a new {@link EntitySpec} instance with the given config, for an entity of the given type.
+     * 
+     * This is primarily for groovy code; equivalent to {@code EntitySpec.create(type).configure(config)}.
+     * 
+     * @param config The spec's configuration (see {@link EntitySpec#configure(Map)}).
+     * @param type   An {@link Entity} interface
+     */
+    public static <T extends Entity> EntitySpec<T> create(Map<?,?> config, Class<T> type) {
+        return EntitySpec.create(type).configure(config);
+    }
+    
+    /**
+     * Copies entity spec so its configuration can be overridden without modifying the 
+     * original entity spec.
+     */
+    public static <T extends Entity> EntitySpec<T> create(EntitySpec<T> spec) {
+        return create(spec.getType()).copyFrom(spec);
+    }
+    
+    public static <T extends Entity> EntitySpec<T> newInstance(Class<T> type) {
+        return new EntitySpec<T>(type);
+    }
+
+    private Class<? extends T> impl;
+    private Entity parent;
+    private final List<Policy> policies = Lists.newArrayList();
+    private final List<PolicySpec<?>> policySpecs = Lists.newArrayList();
+    private final List<Enricher> enrichers = Lists.newArrayList();
+    private final List<EnricherSpec<?>> enricherSpecs = Lists.newArrayList();
+    private final List<Location> locations = Lists.newArrayList();
+    private final Set<Class<?>> additionalInterfaces = Sets.newLinkedHashSet();
+    private final List<EntityInitializer> entityInitializers = Lists.newArrayList();
+    private final List<EntitySpec<?>> children = Lists.newArrayList();
+    private final List<Entity> members = Lists.newArrayList();
+    private final List<Group> groups = Lists.newArrayList();
+    private volatile boolean immutable;
+    
+    public EntitySpec(Class<T> type) {
+        super(type);
+    }
+
+    @Override
+    protected EntitySpec<T> copyFrom(EntitySpec<T> otherSpec) {
+        super.copyFrom(otherSpec)
+                .additionalInterfaces(otherSpec.getAdditionalInterfaces())
+                .policySpecs(otherSpec.getPolicySpecs())
+                .policies(otherSpec.getPolicies())
+                .enricherSpecs(otherSpec.getEnricherSpecs())
+                .enrichers(otherSpec.getEnrichers())
+                .addInitializers(otherSpec.getInitializers())
+                .children(copyFromSpecs(otherSpec.getChildren()))
+                .members(otherSpec.getMembers())
+                .groups(otherSpec.getGroups())
+                .locations(otherSpec.getLocations());
+        
+        if (otherSpec.getParent() != null) parent(otherSpec.getParent());
+        if (otherSpec.getImplementation() != null) impl(otherSpec.getImplementation());
+        
+        return this;
+    }
+
+    private List<EntitySpec<?>> copyFromSpecs(List<EntitySpec<?>> children) {
+        return Lists.<EntitySpec<?>,EntitySpec<?>>transform(children, new Function<EntitySpec<?>, EntitySpec<?>>() {
+            @Nullable
+            @Override
+            public EntitySpec<?> apply(@Nullable EntitySpec<?> entitySpec) {
+                return create(entitySpec);
+            }
+        });
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Class<T> getType() {
+        return (Class<T>)super.getType();
+    }
+    
+    @Override
+    protected void checkValidType(Class<? extends T> type) {
+        // EntitySpec does nothing.  Other specs do check it's an implementation etc.
+    }
+    
+    /**
+     * @return The implementation of the entity; if not null. this overrides any defaults or other configuration
+     * 
+     * @see ImplementedBy on the entity interface classes for how defaults are defined.
+     * @see EntityTypeRegistry for how implementations can be defined globally
+     */
+    @Nullable
+    public Class<? extends T> getImplementation() {
+        return impl;
+    }
+    
+    /**
+     * @return Additional interfaces (other than just {@link #getType()}) that this entity implements; 
+     *         important for when accessing entity through a proxy to determine which interfaces the proxy exposes.
+     */
+    public Set<Class<?>> getAdditionalInterfaces() {
+        return additionalInterfaces;
+    }
+
+    /** @return {@link EntityInitializer} objects which customize the entity to be created */
+    public List<EntityInitializer> getInitializers() {
+        return entityInitializers;
+    }
+    
+    public List<EntitySpec<?>> getChildren() {
+        return children;
+    }
+    
+    public List<Entity> getMembers() {
+        return members;
+    }
+    
+    public List<Group> getGroups() {
+        return groups;
+    }
+    
+    /**
+     * @return The entity's parent
+     */
+    public Entity getParent() {
+        return parent;
+    }
+
+    public List<PolicySpec<?>> getPolicySpecs() {
+        return policySpecs;
+    }
+    
+    public List<Policy> getPolicies() {
+        return policies;
+    }
+    
+    public List<EnricherSpec<?>> getEnricherSpecs() {
+        return enricherSpecs;
+    }
+    
+    public List<Enricher> getEnrichers() {
+        return enrichers;
+    }
+    
+    public List<Location> getLocations() {
+        return locations;
+    }
+
+    public EntitySpec<T> impl(Class<? extends T> val) {
+        checkMutable();
+        checkIsImplementation(checkNotNull(val, "impl"), getType());
+        checkIsNewStyleImplementation(val);
+        impl = val;
+        return this;
+    }
+
+    public EntitySpec<T> additionalInterfaces(Class<?>... vals) {
+        checkMutable();
+        for (Class<?> val : vals) {
+            additionalInterfaces.add(val);
+        }
+        return this;
+    }
+
+    public EntitySpec<T> additionalInterfaces(Iterable<Class<?>> val) {
+        checkMutable();
+        additionalInterfaces.addAll(Sets.newLinkedHashSet(val));
+        return this;
+    }
+
+    public EntitySpec<T> addInitializer(EntityInitializer initializer) {
+        checkMutable();
+        entityInitializers.add(initializer);
+        return this;
+    }
+        
+    public EntitySpec<T> addInitializers(Iterable<? extends EntityInitializer> initializers) {
+        checkMutable();
+        Iterables.addAll(entityInitializers, initializers);
+        return this;
+    }
+
+    /** The supplied class must have a public no-arg constructor. */
+    public EntitySpec<T> addInitializer(Class<? extends EntityInitializer> initializerType) {
+        checkMutable();
+        try {
+            entityInitializers.add(initializerType.newInstance());
+        } catch (Exception e) {
+            throw Throwables.propagate(e);
+        }
+        return this;
+    }
+
+    public EntitySpec<T> children(Iterable<? extends EntitySpec<?>> children) {
+        checkMutable();
+        Iterables.addAll(this.children, children);
+        return this;
+    }
+
+    /** The supplied class must have a public no-arg constructor. */
+    public EntitySpec<T> child(EntitySpec<?> child) {
+        checkMutable();
+        children.add(child);
+        return this;
+    }
+
+    public EntitySpec<T> members(Iterable<? extends Entity> members) {
+        checkMutable();
+        Iterables.addAll(this.members, members);
+        return this;
+    }
+
+    public EntitySpec<T> member(Entity member) {
+        checkMutable();
+        members.add(member);
+        return this;
+    }
+
+    public EntitySpec<T> groups(Iterable<? extends Group> groups) {
+        checkMutable();
+        Iterables.addAll(this.groups, groups);
+        return this;
+    }
+
+    public EntitySpec<T> group(Group group) {
+        checkMutable();
+        groups.add(group);
+        return this;
+    }
+
+    public EntitySpec<T> parent(Entity val) {
+        checkMutable();
+        parent = checkNotNull(val, "parent");
+        return this;
+    }
+
+    /** adds a policy to the spec */
+    public <V> EntitySpec<T> policy(Policy val) {
+        checkMutable();
+        policies.add(checkNotNull(val, "policy"));
+        return this;
+    }
+
+    /** adds a policy to the spec */
+    public <V> EntitySpec<T> policy(PolicySpec<?> val) {
+        checkMutable();
+        policySpecs.add(checkNotNull(val, "policySpec"));
+        return this;
+    }
+
+    /** adds the supplied policies to the spec */
+    public <V> EntitySpec<T> policySpecs(Iterable<? extends PolicySpec<?>> val) {
+        checkMutable();
+        policySpecs.addAll(MutableList.copyOf(checkNotNull(val, "policySpecs")));
+        return this;
+    }
+    
+    /** adds the supplied policies to the spec */
+    public <V> EntitySpec<T> policies(Iterable<? extends Policy> val) {
+        checkMutable();
+        policies.addAll(MutableList.copyOf(checkNotNull(val, "policies")));
+        return this;
+    }
+    
+    /** adds a policy to the spec */
+    public <V> EntitySpec<T> enricher(Enricher val) {
+        checkMutable();
+        enrichers.add(checkNotNull(val, "enricher"));
+        return this;
+    }
+
+    /** adds a policy to the spec */
+    public <V> EntitySpec<T> enricher(EnricherSpec<?> val) {
+        checkMutable();
+        enricherSpecs.add(checkNotNull(val, "enricherSpec"));
+        return this;
+    }
+
+    /** adds the supplied policies to the spec */
+    public <V> EntitySpec<T> enricherSpecs(Iterable<? extends EnricherSpec<?>> val) {
+        checkMutable();
+        enricherSpecs.addAll(MutableList.copyOf(checkNotNull(val, "enricherSpecs")));
+        return this;
+    }
+    
+    /** adds the supplied policies to the spec */
+    public <V> EntitySpec<T> enrichers(Iterable<? extends Enricher> val) {
+        checkMutable();
+        enrichers.addAll(MutableList.copyOf(checkNotNull(val, "enrichers")));
+        return this;
+    }
+    
+    /** adds a location to the spec */
+    public <V> EntitySpec<T> location(Location val) {
+        checkMutable();
+        locations.add(checkNotNull(val, "location"));
+        return this;
+    }
+    
+    /** clears locations defined in the spec */
+    public <V> EntitySpec<T> clearLocations() {
+        checkMutable();
+        locations.clear();
+        return this;        
+    }
+    
+    /** adds the supplied locations to the spec */
+    public <V> EntitySpec<T> locations(Iterable<? extends Location> val) {
+        checkMutable();
+        locations.addAll(MutableList.copyOf(checkNotNull(val, "locations")));
+        return this;
+    }
+
+    /** "seals" this spec, preventing any future changes */
+    public EntitySpec<T> immutable() {
+        immutable = true;
+        return this;
+    }
+
+    private void checkMutable() {
+        if (immutable) throw new IllegalStateException("Cannot modify immutable entity spec "+this);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
new file mode 100644
index 0000000..1c3f7b5
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntityType.java
@@ -0,0 +1,73 @@
+/*
+ * 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.api.entity;
+
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.objs.BrooklynType;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.util.guava.Maybe;
+
+/**
+ * Gives type information for an {@link Entity}. It is an immutable snapshot.
+ * 
+ * It reflects a given entity at the time the snapshot was created: if sensors
+ * were added or removed on-the-fly then those changes will be included in subsequent
+ * snapshots. Therefore instances of a given class of entity could have different 
+ * EntityTypes.
+ */
+public interface EntityType extends BrooklynType {
+
+    /**
+     * Sensors available on this entity.
+     */
+    Set<Sensor<?>> getSensors();
+    
+    /**
+     * Effectors available on this entity.
+     */
+    Set<Effector<?>> getEffectors();
+
+    /** @return an effector with the given name, if it exists.
+     */
+    public Maybe<Effector<?>> getEffectorByName(String name);
+        
+    /**
+     * @return the matching effector on this entity
+     * @throws NoSuchElementException If there is no exact match for this signature
+     * <p>
+     * @deprecated since 0.7.0 use {@link #getEffectorByName(String)};
+     * use of multiple effectors with the same name is not supported by the EntityDynamicType implementation,
+     * so should be discouraged.  overloading can be achieved by inspecting the parameters map. 
+     */
+    @Deprecated
+    Effector<?> getEffector(String name, Class<?>... parameterTypes);
+
+    /**
+     * The Sensor with the given name, or null if not found.
+     */
+    Sensor<?> getSensor(String name);
+    
+    /**
+     * @return True if has the sensor with the given name; false otherwise.
+     */
+    boolean hasSensor(String name);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.java
new file mode 100644
index 0000000..4747e5b
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntityTypeRegistry.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.api.entity;
+
+import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
+import org.apache.brooklyn.api.entity.drivers.EntityDriver;
+import org.apache.brooklyn.api.location.Location;
+
+/**
+ * A registry of the entity implementations to be used when creating an entity of a given type.
+ * 
+ * A given implementation can only be associated with one entity type interface.
+ */
+public interface EntityTypeRegistry {
+
+    /**
+     * Returns the implementation to be used for the given entity type.
+     *
+     * @param entity the {@link DriverDependentEntity} to create the {@link EntityDriver} for.
+     * @param location the {@link Location} where the {@link DriverDependentEntity} is running.
+     * @param <D>
+     * @return the creates EntityDriver.
+     * @throws IllegalArgumentException If no implementation registered, and the given interface is not annotated with {@link ImplementedBy}
+     * @throws IllegalStateException If the given type is not an interface, or if the implementation class is not a concrete class implementing it
+     */
+    <T extends Entity> Class<? extends T> getImplementedBy(Class<T> type);
+
+    /**
+     * Returns the interface of this entity implementation.
+     * E.g. for use as the fully qualified name in {@code entity.getEntityType().getName()}.
+     * 
+     * @throws IllegalArgumentException If no interface is registered against this implementation, 
+     *         and no super-type of the class is annotated with {@link ImplementedBy} to point at the given class
+     */
+    <T extends Entity> Class<? super T> getEntityTypeOf(Class<T> type);
+
+    /**
+     * Registers the implementation to use for a given entity type.
+     * 
+     * The implementation must be a non-abstract class implementing the given type, and must 
+     * have a no-argument constructor.
+     * 
+     * @throws IllegalArgumentException If this implementation has already been registered for a different type
+     * @throws IllegalStateException If the implClazz is not a concrete class, or does not implement type
+     */
+    <T extends Entity> EntityTypeRegistry registerImplementation(Class<T> type, Class<? extends T> implClazz);
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/Group.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Group.java b/api/src/main/java/org/apache/brooklyn/api/entity/Group.java
new file mode 100644
index 0000000..05f80e1
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/Group.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.api.entity;
+
+import java.util.Collection;
+
+/**
+ * An {@link Entity} that groups together other entities.
+ * 
+ * The grouping can be for any purpose, such as allowing easy management/monitoring of
+ * a group of entities. The grouping could be static (i.e. a fixed set of entities)
+ * or dynamic (i.e. contains all entities that match some filter).
+ */
+public interface Group extends Entity {
+    
+    /**
+     * Return the entities that are members of this group.
+     */
+    Collection<Entity> getMembers();
+
+    /**
+     * @return True if it is a member of this group.
+     */
+    boolean hasMember(Entity member);
+
+    /**
+     * Adds the given member, returning true if this modifies the set of members (i.e. it was not already a member).
+     */
+    boolean addMember(Entity member);
+ 
+    /**
+     * Removes the given member, returning true if this modifies the set of members (i.e. it was a member).
+     */
+    boolean removeMember(Entity member);
+    
+    /**
+     * @return The number of members in this group.
+     */
+    Integer getCurrentSize();
+    
+    /** As {@link #addChild(EntitySpec)} followed by {@link #addMember(Entity)} */
+    <T extends Entity> T addMemberChild(EntitySpec<T> spec);
+    
+    /** As {@link #addChild(Entity)} followed by {@link #addMember(Entity)} */
+    <T extends Entity> T addMemberChild(T child);
+    
+    /** As in super, but note this does NOT by default add it as a member; see {@link #addMemberChild(EntitySpec)} */
+    @Override
+    <T extends Entity> T addChild(EntitySpec<T> spec);
+    
+    /** As in super, but note this does NOT by default add it as a member; see {@link #addMemberChild(Entity)} */
+    @Override
+    <T extends Entity> T addChild(T child);
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java b/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.java
new file mode 100644
index 0000000..f0ee6a1
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/ImplementedBy.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.api.entity;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * A pointer to the default implementation of an entity.
+ * 
+ * A common naming convention is for the implementation class to have the suffix "Impl",
+ * but this is not required.
+ * 
+ * See {@link EntityTypeRegistry} for how to override the implementation to be used, if
+ * the class referenced by this annotation is not desired.
+ * 
+ * @author aled
+ */
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface ImplementedBy {
+
+  /**
+   * The implementation type.
+   */
+  Class<? extends Entity> value();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.java
new file mode 100644
index 0000000..b59e9cc
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/DriverDependentEntity.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.api.entity.drivers;
+
+import javax.annotation.Nullable;
+
+import org.apache.brooklyn.api.entity.Entity;
+
+/**
+ * An Entity that needs to have a driver.
+ *
+ * @param <D>
+ */
+public interface DriverDependentEntity<D extends EntityDriver> extends Entity {
+
+    Class<D> getDriverInterface();
+    
+    @Nullable D getDriver();
+    
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
new file mode 100644
index 0000000..e2bb0bd
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.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.api.entity.drivers;
+
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * The EntityDriver provides an abstraction between the Entity and the environment (the {@link Location} it is running
+ * in, so that an entity is not tightly coupled to a specific Location. E.g. you could have a TomcatEntity that uses
+ * a TomcatDriver (an interface) and you could have different driver implementations like the
+ * TomcatSshDriver/TomcatWindowsDriver and if in the future support for Puppet needs to be added, a TomcatPuppetDriver
+ * could be added.
+ *
+ * @author Peter Veentjer.
+ * @see DriverDependentEntity
+ * @see EntityDriverManager
+ */
+public interface EntityDriver {
+
+    /**
+     * The entity instance that this is a driver for.
+     * 
+     * FIXME The signature of this will change to return Entity instead of EntityLocal.
+     * This is a temporary workaround for groovy not supporting covariant return types,
+     * see http://jira.codehaus.org/browse/GROOVY-5418. It is fixed in groovy 2.0.4 so
+     * we will need to upgrade from 1.8.6 first.
+     */
+    @Beta
+    EntityLocal getEntity();
+
+    /**
+     * The location the entity is running in.
+     */
+    Location getLocation();
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
new file mode 100644
index 0000000..b2ad37e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.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.api.entity.drivers;
+
+import org.apache.brooklyn.api.location.Location;
+
+/**
+ * Responsible for creating a driver for a given entity/location. Also used for customizing which 
+ * type of driver should be used by entities in given locations.
+ * 
+ * The idea is that an entity should not be tightly coupled to a specific driver implementation, 
+ * so that there is flexibility for driver changes, without changing the entity itself. The 
+ * advantage is that drivers can easily be reconfigured, replaced or new drivers for different 
+ * environments can be added, without needing to modify Brooklyn.
+ * 
+ * To obtain an instance of a driver, use {@link #build(DriverDependentEntity, Location)}.
+ * This will use the registered driver types, or if one is not registered will fallback to the 
+ * default strategy.
+ */
+public interface EntityDriverManager {
+
+    /**
+     * Builds a new {@link EntityDriver} for the given entity/location.
+     *
+     * @param entity the {@link DriverDependentEntity} to create the {@link EntityDriver} for.
+     * @param location the {@link Location} where the {@link DriverDependentEntity} is running.
+     * @param <D>
+     * @return the creates EntityDriver.
+     */
+    <D extends EntityDriver> D build(DriverDependentEntity<D> entity, Location location);
+    
+    <D extends EntityDriver> void registerDriver(Class<D> driverInterface, Class<? extends Location> locationClazz, Class<? extends D> driverClazz);
+}


[14/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
deleted file mode 100644
index e64e41e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
+++ /dev/null
@@ -1,639 +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.core.entity.lifecycle;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec.ExtensibleEnricherSpec;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynLogging;
-import org.apache.brooklyn.core.BrooklynLogging.LoggingLevel;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.enricher.AbstractEnricher;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityAdjuncts;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition;
-import org.apache.brooklyn.enricher.stock.AbstractMultipleSensorAggregator;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.enricher.stock.UpdatingMap;
-import org.apache.brooklyn.util.collections.CollectionFunctionals;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.collections.QuorumCheck;
-import org.apache.brooklyn.util.core.task.ValueResolver;
-import org.apache.brooklyn.util.guava.Functionals;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.repeat.Repeater;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-
-/** Logic, sensors and enrichers, and conveniences, for computing service status */ 
-public class ServiceStateLogic {
-
-    private static final Logger log = LoggerFactory.getLogger(ServiceStateLogic.class);
-    
-    public static final AttributeSensor<Boolean> SERVICE_UP = Attributes.SERVICE_UP;
-    public static final AttributeSensor<Map<String,Object>> SERVICE_NOT_UP_INDICATORS = Attributes.SERVICE_NOT_UP_INDICATORS;
-    public static final AttributeSensor<Map<String,Object>> SERVICE_NOT_UP_DIAGNOSTICS = Attributes.SERVICE_NOT_UP_DIAGNOSTICS;
-    
-    public static final AttributeSensor<Lifecycle> SERVICE_STATE_ACTUAL = Attributes.SERVICE_STATE_ACTUAL;
-    public static final AttributeSensor<Lifecycle.Transition> SERVICE_STATE_EXPECTED = Attributes.SERVICE_STATE_EXPECTED;
-    public static final AttributeSensor<Map<String,Object>> SERVICE_PROBLEMS = Attributes.SERVICE_PROBLEMS;
-
-    /** static only; not for instantiation */
-    private ServiceStateLogic() {}
-
-    public static <TKey,TVal> TVal getMapSensorEntry(EntityLocal entity, AttributeSensor<Map<TKey,TVal>> sensor, TKey key) {
-        Map<TKey, TVal> map = entity.getAttribute(sensor);
-        if (map==null) return null;
-        return map.get(key);
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static <TKey,TVal> void clearMapSensorEntry(EntityLocal entity, AttributeSensor<Map<TKey,TVal>> sensor, TKey key) {
-        updateMapSensorEntry(entity, sensor, key, (TVal)Entities.REMOVE);
-    }
-
-    /** update the given key in the given map sensor */
-    public static <TKey,TVal> void updateMapSensorEntry(EntityLocal entity, AttributeSensor<Map<TKey,TVal>> sensor, final TKey key, final TVal v) {
-        /*
-         * Important to *not* modify the existing attribute value; must make a copy, modify that, and publish.
-         * This is because a Propagator enricher will set this same value on another entity. There was very
-         * strange behaviour when this was done for a SERVICE_UP_INDICATORS sensor - the updates done here 
-         * applied to the attribute of both entities!
-         * 
-         * Need to do this update atomically (i.e. sequentially) because there is no threading control for
-         * what is calling updateMapSensorEntity. It is called directly on start, on initialising enrichers,
-         * and in event listeners. These calls could be concurrent.
-         */
-        Function<Map<TKey,TVal>, Maybe<Map<TKey,TVal>>> modifier = new Function<Map<TKey,TVal>, Maybe<Map<TKey,TVal>>>() {
-            @Override public Maybe<Map<TKey, TVal>> apply(Map<TKey, TVal> map) {
-                boolean created = (map==null);
-                if (created) map = MutableMap.of();
-                
-                boolean changed;
-                if (v == Entities.REMOVE) {
-                    changed = map.containsKey(key);
-                    if (changed) {
-                        map = MutableMap.copyOf(map);
-                        map.remove(key);
-                    }
-                } else {
-                    TVal oldV = map.get(key);
-                    if (oldV==null) {
-                        changed = (v!=null || !map.containsKey(key));
-                    } else {
-                        changed = !oldV.equals(v);
-                    }
-                    if (changed) {
-                        map = MutableMap.copyOf(map);
-                        map.put(key, (TVal)v);
-                    }
-                }
-                if (changed || created) {
-                    return Maybe.of(map);
-                } else {
-                    return Maybe.absent();
-                }
-            }
-        };
-        
-        if (!Entities.isNoLongerManaged(entity)) { 
-            entity.sensors().modify(sensor, modifier);
-        }
-    }
-    
-    public static void setExpectedState(Entity entity, Lifecycle state) {
-        if (state==Lifecycle.RUNNING) {
-            Boolean up = ((EntityInternal)entity).getAttribute(Attributes.SERVICE_UP);
-            if (!Boolean.TRUE.equals(up) && !Boolean.TRUE.equals(Entities.isReadOnly(entity))) {
-                // pause briefly to allow any recent problem-clearing processing to complete
-                Stopwatch timer = Stopwatch.createStarted();
-                boolean nowUp = Repeater.create()
-                        .every(ValueResolver.REAL_QUICK_PERIOD)
-                        .limitTimeTo(ValueResolver.PRETTY_QUICK_WAIT)
-                        .until(entity, EntityPredicates.attributeEqualTo(Attributes.SERVICE_UP, true))
-                        .run();
-                if (nowUp) {
-                    log.debug("Had to wait "+Duration.of(timer)+" for "+entity+" "+Attributes.SERVICE_UP+" to be true before setting "+state);
-                } else {
-                    log.warn("Service is not up when setting "+state+" on "+entity+"; delayed "+Duration.of(timer)+" "
-                        + "but "+Attributes.SERVICE_UP+" did not recover from "+up+"; not-up-indicators="+entity.getAttribute(Attributes.SERVICE_NOT_UP_INDICATORS));
-                }
-            }
-        }
-        ((EntityInternal)entity).sensors().set(Attributes.SERVICE_STATE_EXPECTED, new Lifecycle.Transition(state, new Date()));
-        
-        Maybe<Enricher> enricher = EntityAdjuncts.tryFindWithUniqueTag(entity.enrichers(), ComputeServiceState.DEFAULT_ENRICHER_UNIQUE_TAG);
-        if (enricher.isPresent() && enricher.get() instanceof ComputeServiceState) {
-            ((ComputeServiceState)enricher.get()).onEvent(null);
-        }
-    }
-    public static Lifecycle getExpectedState(Entity entity) {
-        Transition expected = entity.getAttribute(Attributes.SERVICE_STATE_EXPECTED);
-        if (expected==null) return null;
-        return expected.getState();
-    }
-    public static boolean isExpectedState(Entity entity, Lifecycle state) {
-        return getExpectedState(entity)==state;
-    }
-    
-    public static class ServiceNotUpLogic {
-        public static final String DEFAULT_ENRICHER_UNIQUE_TAG = "service.isUp if no service.notUp.indicators";
-        
-        /** static only; not for instantiation */
-        private ServiceNotUpLogic() {}
-        
-        public static final EnricherSpec<?> newEnricherForServiceUpIfNotUpIndicatorsEmpty() {
-            return Enrichers.builder()
-                .transforming(SERVICE_NOT_UP_INDICATORS).<Object>publishing(Attributes.SERVICE_UP)
-                .suppressDuplicates(true)
-                .computing(
-                    Functionals.<Map<String,?>>
-                        ifNotEquals(null).<Object>apply(Functions.forPredicate(CollectionFunctionals.<String>mapSizeEquals(0)))
-                        .defaultValue(Entities.REMOVE) )
-                .uniqueTag(DEFAULT_ENRICHER_UNIQUE_TAG)
-                .build();
-        }
-        
-        /** puts the given value into the {@link Attributes#SERVICE_NOT_UP_INDICATORS} map as if the 
-         * {@link UpdatingMap} enricher for the given key */
-        public static void updateNotUpIndicator(EntityLocal entity, String key, Object value) {
-            updateMapSensorEntry(entity, Attributes.SERVICE_NOT_UP_INDICATORS, key, value);
-        }
-        /** clears any entry for the given key in the {@link Attributes#SERVICE_NOT_UP_INDICATORS} map */
-        public static void clearNotUpIndicator(EntityLocal entity, String key) {
-            clearMapSensorEntry(entity, Attributes.SERVICE_NOT_UP_INDICATORS, key);
-        }
-        /** as {@link #updateNotUpIndicator(EntityLocal, String, Object)} using the given sensor as the key */
-        public static void updateNotUpIndicator(EntityLocal entity, Sensor<?> sensor, Object value) {
-            updateMapSensorEntry(entity, Attributes.SERVICE_NOT_UP_INDICATORS, sensor.getName(), value);
-        }
-        /** as {@link #clearNotUpIndicator(EntityLocal, String)} using the given sensor as the key */
-        public static void clearNotUpIndicator(EntityLocal entity, Sensor<?> sensor) {
-            clearMapSensorEntry(entity, Attributes.SERVICE_NOT_UP_INDICATORS, sensor.getName());
-        }
-
-        public static void updateNotUpIndicatorRequiringNonEmptyList(EntityLocal entity, AttributeSensor<? extends Collection<?>> collectionSensor) {
-            Collection<?> nodes = entity.getAttribute(collectionSensor);
-            if (nodes==null || nodes.isEmpty()) ServiceNotUpLogic.updateNotUpIndicator(entity, collectionSensor, "Should have at least one entry");
-            else ServiceNotUpLogic.clearNotUpIndicator(entity, collectionSensor);
-        }
-        public static void updateNotUpIndicatorRequiringNonEmptyMap(EntityLocal entity, AttributeSensor<? extends Map<?,?>> mapSensor) {
-            Map<?, ?> nodes = entity.getAttribute(mapSensor);
-            if (nodes==null || nodes.isEmpty()) ServiceNotUpLogic.updateNotUpIndicator(entity, mapSensor, "Should have at least one entry");
-            else ServiceNotUpLogic.clearNotUpIndicator(entity, mapSensor);
-        }
-        
-    }
-    
-    /** Enricher which sets {@link Attributes#SERVICE_STATE_ACTUAL} on changes to 
-     * {@link Attributes#SERVICE_STATE_EXPECTED}, {@link Attributes#SERVICE_PROBLEMS}, and {@link Attributes#SERVICE_UP}
-     * <p>
-     * The default implementation uses {@link #computeActualStateWhenExpectedRunning(Map, Boolean)} if the last expected transition
-     * was to {@link Lifecycle#RUNNING} and 
-     * {@link #computeActualStateWhenNotExpectedRunning(Map, Boolean, org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition)} otherwise.
-     * If these methods return null, the {@link Attributes#SERVICE_STATE_ACTUAL} sensor will be cleared (removed).
-     * Either of these methods can be overridden for custom logic, and that custom enricher can be created using 
-     * {@link ServiceStateLogic#newEnricherForServiceState(Class)} and added to an entity.
-     */
-    public static class ComputeServiceState extends AbstractEnricher implements SensorEventListener<Object> {
-        
-        public static final String DEFAULT_ENRICHER_UNIQUE_TAG = "service.state.actual";
-
-        public ComputeServiceState() {}
-        public ComputeServiceState(Map<?,?> flags) { super(flags); }
-            
-        @Override
-        public void init() {
-            super.init();
-            if (uniqueTag==null) uniqueTag = DEFAULT_ENRICHER_UNIQUE_TAG;
-        }
-        
-        @Override
-        public void setEntity(EntityLocal entity) {
-            super.setEntity(entity);
-            if (suppressDuplicates==null) {
-                // only publish on changes, unless it is configured otherwise
-                suppressDuplicates = true;
-            }
-            
-            subscriptions().subscribe(entity, SERVICE_PROBLEMS, this);
-            subscriptions().subscribe(entity, SERVICE_UP, this);
-            subscriptions().subscribe(entity, SERVICE_STATE_EXPECTED, this);
-            onEvent(null);
-        }
-
-        @Override
-        public void onEvent(@Nullable SensorEvent<Object> event) {
-            Preconditions.checkNotNull(entity, "Cannot handle subscriptions or compute state until associated with an entity");
-            
-            Map<String, Object> serviceProblems = entity.getAttribute(SERVICE_PROBLEMS);
-            Boolean serviceUp = entity.getAttribute(SERVICE_UP);
-            Lifecycle.Transition serviceExpected = entity.getAttribute(SERVICE_STATE_EXPECTED);
-            
-            if (serviceExpected!=null && serviceExpected.getState()==Lifecycle.RUNNING) {
-                setActualState( computeActualStateWhenExpectedRunning(serviceProblems, serviceUp) );
-            } else {
-                setActualState( computeActualStateWhenNotExpectedRunning(serviceProblems, serviceUp, serviceExpected) );
-            }
-        }
-
-        protected Lifecycle computeActualStateWhenExpectedRunning(Map<String, Object> problems, Boolean serviceUp) {
-            if (Boolean.TRUE.equals(serviceUp) && (problems==null || problems.isEmpty())) {
-                return Lifecycle.RUNNING;
-            } else {
-                if (!Lifecycle.ON_FIRE.equals(entity.getAttribute(SERVICE_STATE_ACTUAL))) {
-                    BrooklynLogging.log(log, BrooklynLogging.levelDependingIfReadOnly(entity, LoggingLevel.WARN, LoggingLevel.TRACE, LoggingLevel.DEBUG),
-                        "Setting "+entity+" "+Lifecycle.ON_FIRE+" due to problems when expected running, up="+serviceUp+", "+
-                            (problems==null || problems.isEmpty() ? "not-up-indicators: "+entity.getAttribute(SERVICE_NOT_UP_INDICATORS) : "problems: "+problems));
-                }
-                return Lifecycle.ON_FIRE;
-            }
-        }
-        
-        protected Lifecycle computeActualStateWhenNotExpectedRunning(Map<String, Object> problems, Boolean up, Lifecycle.Transition stateTransition) {
-            if (stateTransition!=null) {
-                // if expected state is present but not running, just echo the expected state (ignore problems and up-ness)
-                return stateTransition.getState();
-                
-            } else if (problems!=null && !problems.isEmpty()) {
-                // if there is no expected state, then if service is not up, say stopped, else say on fire (whether service up is true or not present)
-                if (Boolean.FALSE.equals(up)) {
-                    return Lifecycle.STOPPED;
-                } else {
-                    BrooklynLogging.log(log, BrooklynLogging.levelDependingIfReadOnly(entity, LoggingLevel.WARN, LoggingLevel.TRACE, LoggingLevel.DEBUG),
-                        "Setting "+entity+" "+Lifecycle.ON_FIRE+" due to problems when expected "+stateTransition+" / up="+up+": "+problems);
-                    return Lifecycle.ON_FIRE;
-                }
-            } else {
-                // no expected transition and no problems
-                // if the problems map is non-null, then infer from service up;
-                // if there is no problems map, then leave unchanged (user may have set it explicitly)
-                if (problems!=null)
-                    return (up==null ? null /* remove if up is not set */ : 
-                        up ? Lifecycle.RUNNING : Lifecycle.STOPPED);
-                else
-                    return entity.getAttribute(SERVICE_STATE_ACTUAL);
-            }
-        }
-
-        protected void setActualState(@Nullable Lifecycle state) {
-            if (log.isTraceEnabled()) log.trace("{} setting actual state {}", this, state);
-            if (((EntityInternal)entity).getManagementSupport().isNoLongerManaged()) {
-                // won't catch everything, but catches some
-                BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(entity),
-                    entity+" is no longer managed when told to set actual state to "+state+"; suppressing");
-                return;
-            }
-            emit(SERVICE_STATE_ACTUAL, (state==null ? Entities.REMOVE : state));
-        }
-
-    }
-    
-    public static final EnricherSpec<?> newEnricherForServiceStateFromProblemsAndUp() {
-        return newEnricherForServiceState(ComputeServiceState.class);
-    }
-    public static final EnricherSpec<?> newEnricherForServiceState(Class<? extends Enricher> type) {
-        return EnricherSpec.create(type);
-    }
-    
-    public static class ServiceProblemsLogic {
-        /** static only; not for instantiation */
-        private ServiceProblemsLogic() {}
-        
-        /** puts the given value into the {@link Attributes#SERVICE_PROBLEMS} map as if the 
-         * {@link UpdatingMap} enricher for the given sensor reported this value */
-        public static void updateProblemsIndicator(EntityLocal entity, Sensor<?> sensor, Object value) {
-            updateMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, sensor.getName(), value);
-        }
-        /** clears any entry for the given sensor in the {@link Attributes#SERVICE_PROBLEMS} map */
-        public static void clearProblemsIndicator(EntityLocal entity, Sensor<?> sensor) {
-            clearMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, sensor.getName());
-        }
-        /** as {@link #updateProblemsIndicator(EntityLocal, Sensor, Object)} */
-        public static void updateProblemsIndicator(EntityLocal entity, Effector<?> eff, Object value) {
-            updateMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, eff.getName(), value);
-        }
-        /** as {@link #clearProblemsIndicator(EntityLocal, Sensor)} */
-        public static void clearProblemsIndicator(EntityLocal entity, Effector<?> eff) {
-            clearMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, eff.getName());
-        }
-        /** as {@link #updateProblemsIndicator(EntityLocal, Sensor, Object)} */
-        public static void updateProblemsIndicator(EntityLocal entity, String key, Object value) {
-            updateMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, key, value);
-        }
-        /** as {@link #clearProblemsIndicator(EntityLocal, Sensor)} */
-        public static void clearProblemsIndicator(EntityLocal entity, String key) {
-            clearMapSensorEntry(entity, Attributes.SERVICE_PROBLEMS, key);
-        }
-    }
-    
-    public static class ComputeServiceIndicatorsFromChildrenAndMembers extends AbstractMultipleSensorAggregator<Void> implements SensorEventListener<Object> {
-        /** standard unique tag identifying instances of this enricher at runtime, also used for the map sensor if no unique tag specified */
-        public final static String DEFAULT_UNIQUE_TAG = "service-lifecycle-indicators-from-children-and-members";
-        
-        /** as {@link #DEFAULT_UNIQUE_TAG}, but when a second distinct instance is responsible for computing service up */
-        public final static String DEFAULT_UNIQUE_TAG_UP = "service-not-up-indicators-from-children-and-members";
-
-        public static final ConfigKey<QuorumCheck> UP_QUORUM_CHECK = ConfigKeys.builder(QuorumCheck.class, "enricher.service_state.children_and_members.quorum.up")
-            .description("Logic for checking whether this service is up, based on children and/or members, defaulting to allowing none but if there are any requiring at least one to be up")
-            .defaultValue(QuorumCheck.QuorumChecks.atLeastOneUnlessEmpty())
-            .inheritance(ConfigInheritance.NONE)
-            .build();
-        public static final ConfigKey<QuorumCheck> RUNNING_QUORUM_CHECK = ConfigKeys.builder(QuorumCheck.class, "enricher.service_state.children_and_members.quorum.running") 
-            .description("Logic for checking whether this service is healthy, based on children and/or members running, defaulting to requiring none to be ON-FIRE")
-            .defaultValue(QuorumCheck.QuorumChecks.all())
-            .inheritance(ConfigInheritance.NONE)
-            .build();
-        // TODO items below should probably also have inheritance NONE ?
-        public static final ConfigKey<Boolean> DERIVE_SERVICE_NOT_UP = ConfigKeys.newBooleanConfigKey("enricher.service_state.children_and_members.service_up.publish", "Whether to derive a service-not-up indicator from children", true);
-        public static final ConfigKey<Boolean> DERIVE_SERVICE_PROBLEMS = ConfigKeys.newBooleanConfigKey("enricher.service_state.children_and_members.service_problems.publish", "Whether to derive a service-problem indicator from children", true);
-        public static final ConfigKey<Boolean> IGNORE_ENTITIES_WITH_SERVICE_UP_NULL = ConfigKeys.newBooleanConfigKey("enricher.service_state.children_and_members.ignore_entities.service_up_null", "Whether to ignore children reporting null values for service up", true);
-        @SuppressWarnings("serial")
-        public static final ConfigKey<Set<Lifecycle>> IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES = ConfigKeys.newConfigKey(new TypeToken<Set<Lifecycle>>() {},
-            "enricher.service_state.children_and_members.ignore_entities.service_state_values", 
-            "Service states (including null) which indicate an entity should be ignored when looking at children service states; anything apart from RUNNING not in this list will be treated as not healthy (by default just ON_FIRE will mean not healthy)", 
-            MutableSet.<Lifecycle>builder().addAll(Lifecycle.values()).add(null).remove(Lifecycle.RUNNING).remove(Lifecycle.ON_FIRE).build().asUnmodifiable());
-
-        protected String getKeyForMapSensor() {
-            return Preconditions.checkNotNull(super.getUniqueTag());
-        }
-
-        @Override
-        protected void setEntityLoadingConfig() {
-            fromChildren = true;
-            fromMembers = true;
-            // above sets default
-            super.setEntityLoadingConfig();
-            if (isAggregatingMembers() && (!(entity instanceof Group))) {
-                if (fromChildren) fromMembers=false;
-                else throw new IllegalStateException("Cannot monitor only members for non-group entity "+entity+": "+this);
-            }
-            Preconditions.checkNotNull(getKeyForMapSensor());
-        }
-
-        @Override
-        protected void setEntityLoadingTargetConfig() {
-            if (getConfig(TARGET_SENSOR)!=null)
-                throw new IllegalArgumentException("Must not set "+TARGET_SENSOR+" when using "+this);
-        }
-
-        @Override
-        public void setEntity(EntityLocal entity) {
-            super.setEntity(entity);
-            if (suppressDuplicates==null) {
-                // only publish on changes, unless it is configured otherwise
-                suppressDuplicates = true;
-            }
-        }
-
-        final static Set<ConfigKey<?>> RECONFIGURABLE_KEYS = ImmutableSet.<ConfigKey<?>>of(
-            UP_QUORUM_CHECK, RUNNING_QUORUM_CHECK,
-            DERIVE_SERVICE_NOT_UP, DERIVE_SERVICE_NOT_UP, 
-            IGNORE_ENTITIES_WITH_SERVICE_UP_NULL, IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES);
-        
-        @Override
-        protected <T> void doReconfigureConfig(ConfigKey<T> key, T val) {
-            if (RECONFIGURABLE_KEYS.contains(key)) {
-                return;
-            } else {
-                super.doReconfigureConfig(key, val);
-            }
-        }
-        
-        @Override
-        protected void onChanged() {
-            super.onChanged();
-            if (entity != null && isRunning())
-                onUpdated();
-        }
-        
-        private final List<Sensor<?>> SOURCE_SENSORS = ImmutableList.<Sensor<?>>of(SERVICE_UP, SERVICE_STATE_ACTUAL);
-        @Override
-        protected Collection<Sensor<?>> getSourceSensors() {
-            return SOURCE_SENSORS;
-        }
-
-        @Override
-        protected void onUpdated() {
-            if (entity==null || !Entities.isManaged(entity)) {
-                // either invoked during setup or entity has become unmanaged; just ignore
-                BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(entity),
-                    "Ignoring {} onUpdated when entity is not in valid state ({})", this, entity);
-                return;
-            }
-
-            // override superclass to publish multiple sensors
-            if (getConfig(DERIVE_SERVICE_PROBLEMS)) {
-                updateMapSensor(SERVICE_PROBLEMS, computeServiceProblems());
-            }
-
-            if (getConfig(DERIVE_SERVICE_NOT_UP)) {
-                updateMapSensor(SERVICE_NOT_UP_INDICATORS, computeServiceNotUp());
-            }
-        }
-
-        protected Object computeServiceNotUp() {
-            Map<Entity, Boolean> values = getValues(SERVICE_UP);
-            List<Entity> violators = MutableList.of();
-            boolean ignoreNull = getConfig(IGNORE_ENTITIES_WITH_SERVICE_UP_NULL);
-            Set<Lifecycle> ignoreStates = getConfig(IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES);
-            int entries=0;
-            int numUp=0;
-            for (Map.Entry<Entity, Boolean> state: values.entrySet()) {
-                if (ignoreNull && state.getValue()==null)
-                    continue;
-                entries++;
-                Lifecycle entityState = state.getKey().getAttribute(SERVICE_STATE_ACTUAL);
-                
-                if (Boolean.TRUE.equals(state.getValue())) numUp++;
-                else if (!ignoreStates.contains(entityState)) {
-                    violators.add(state.getKey());
-                }
-            }
-
-            QuorumCheck qc = getConfig(UP_QUORUM_CHECK);
-            if (qc!=null) {
-                if (qc.isQuorate(numUp, violators.size()+numUp))
-                    // quorate
-                    return null;
-
-                if (values.isEmpty()) return "No entities present";
-                if (entries==0) return "No entities publishing service up";
-                if (violators.isEmpty()) return "Not enough entities";
-            } else {
-                if (violators.isEmpty())
-                    return null;
-            }
-
-            if (violators.size()==1) return violators.get(0)+" is not up";
-            if (violators.size()==entries) return "None of the entities are up";
-            return violators.size()+" entities are not up, including "+violators.get(0);
-        }
-
-        protected Object computeServiceProblems() {
-            Map<Entity, Lifecycle> values = getValues(SERVICE_STATE_ACTUAL);
-            int numRunning=0;
-            List<Entity> onesNotHealthy=MutableList.of();
-            Set<Lifecycle> ignoreStates = getConfig(IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES);
-            for (Map.Entry<Entity,Lifecycle> state: values.entrySet()) {
-                if (state.getValue()==Lifecycle.RUNNING) numRunning++;
-                else if (!ignoreStates.contains(state.getValue())) 
-                    onesNotHealthy.add(state.getKey());
-            }
-
-            QuorumCheck qc = getConfig(RUNNING_QUORUM_CHECK);
-            if (qc!=null) {
-                if (qc.isQuorate(numRunning, onesNotHealthy.size()+numRunning))
-                    // quorate
-                    return null;
-
-                if (onesNotHealthy.isEmpty())
-                    return "Not enough entities running to be quorate";
-            } else {
-                if (onesNotHealthy.isEmpty())
-                    return null;
-            }
-
-            return "Required entit"+Strings.ies(onesNotHealthy.size())+" not healthy: "+
-                (onesNotHealthy.size()>3 ? onesNotHealthy.get(0)+" and "+(onesNotHealthy.size()-1)+" others"
-                    : Strings.join(onesNotHealthy, ", "));
-        }
-
-        protected void updateMapSensor(AttributeSensor<Map<String, Object>> sensor, Object value) {
-            if (log.isTraceEnabled()) log.trace("{} updating map sensor {} with {}", new Object[] { this, sensor, value });
-
-            if (value!=null) {
-                updateMapSensorEntry(entity, sensor, getKeyForMapSensor(), value);
-            } else {
-                clearMapSensorEntry(entity, sensor, getKeyForMapSensor());
-            }
-        }
-
-        /** not used; see specific `computeXxx` methods, invoked by overridden onUpdated */
-        @Override
-        protected Object compute() {
-            return null;
-        }
-    }
-    
-    public static class ComputeServiceIndicatorsFromChildrenAndMembersSpec extends ExtensibleEnricherSpec<ComputeServiceIndicatorsFromChildrenAndMembers,ComputeServiceIndicatorsFromChildrenAndMembersSpec> {
-        private static final long serialVersionUID = -607444925297963712L;
-        
-        protected ComputeServiceIndicatorsFromChildrenAndMembersSpec() {
-            this(ComputeServiceIndicatorsFromChildrenAndMembers.class);
-        }
-        
-        protected ComputeServiceIndicatorsFromChildrenAndMembersSpec(Class<? extends ComputeServiceIndicatorsFromChildrenAndMembers> clazz) {
-            super(clazz);
-        }
-
-        public void addTo(Entity entity) {
-            entity.enrichers().add(this);
-        }
-
-        public ComputeServiceIndicatorsFromChildrenAndMembersSpec checkChildrenAndMembers() {
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_MEMBERS, true);
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_CHILDREN, true);
-            return self();
-        }
-        public ComputeServiceIndicatorsFromChildrenAndMembersSpec checkMembersOnly() {
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_MEMBERS, true);
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_CHILDREN, false);
-            return self();
-        }
-        public ComputeServiceIndicatorsFromChildrenAndMembersSpec checkChildrenOnly() {
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_MEMBERS, false);
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.FROM_CHILDREN, true);
-            return self();
-        }
-
-        public ComputeServiceIndicatorsFromChildrenAndMembersSpec requireUpChildren(QuorumCheck check) {
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.UP_QUORUM_CHECK, check);
-            return self();
-        }
-        public ComputeServiceIndicatorsFromChildrenAndMembersSpec requireRunningChildren(QuorumCheck check) {
-            configure(ComputeServiceIndicatorsFromChildrenAndMembers.RUNNING_QUORUM_CHECK, check);
-            return self();
-        }
-    }
-
-    /** provides the default {@link ComputeServiceIndicatorsFromChildrenAndMembers} enricher, 
-     * using the default unique tag ({@link ComputeServiceIndicatorsFromChildrenAndMembers#DEFAULT_UNIQUE_TAG}),
-     * configured here to require none on fire, and either no children or at least one up child,
-     * the spec can be further configured as appropriate */
-    public static ComputeServiceIndicatorsFromChildrenAndMembersSpec newEnricherFromChildren() {
-        return new ComputeServiceIndicatorsFromChildrenAndMembersSpec()
-            .uniqueTag(ComputeServiceIndicatorsFromChildrenAndMembers.DEFAULT_UNIQUE_TAG);
-    }
-
-    /** as {@link #newEnricherFromChildren()} but only publishing service not-up indicators, 
-     * using a different unique tag ({@link ComputeServiceIndicatorsFromChildrenAndMembers#DEFAULT_UNIQUE_TAG_UP}),
-     * listening to children only, ignoring lifecycle/service-state,
-     * and using the same logic 
-     * (viz looking only at children (not members) and requiring either no children or at least one child up) by default */
-    public static ComputeServiceIndicatorsFromChildrenAndMembersSpec newEnricherFromChildrenUp() {
-        return newEnricherFromChildren()
-            .uniqueTag(ComputeServiceIndicatorsFromChildrenAndMembers.DEFAULT_UNIQUE_TAG_UP)
-            .checkChildrenOnly()
-            .configure(ComputeServiceIndicatorsFromChildrenAndMembers.DERIVE_SERVICE_PROBLEMS, false);
-    }
-    
-    /** as {@link #newEnricherFromChildren()} but only publishing service problems,
-     * listening to children and members, ignoring service up,
-     * and using the same logic 
-     * (viz looking at children and members and requiring none are on fire) by default */
-    public static ComputeServiceIndicatorsFromChildrenAndMembersSpec newEnricherFromChildrenState() {
-        return newEnricherFromChildren()
-            .configure(ComputeServiceIndicatorsFromChildrenAndMembers.DERIVE_SERVICE_NOT_UP, false);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
deleted file mode 100644
index 388eb17..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.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.core.entity.trait;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
-import org.apache.brooklyn.core.sensor.Sensors;
-
-/**
- * A collection of entities that can change.
- */
-public interface Changeable {
-
-    AttributeSensor<Integer> GROUP_SIZE = Sensors.newIntegerSensor("group.members.count", "Number of members");
-
-    BasicNotificationSensor<Entity> MEMBER_ADDED = new BasicNotificationSensor<Entity>(Entity.class, "group.members.added", "Entity added to group members");
-    BasicNotificationSensor<Entity> MEMBER_REMOVED = new BasicNotificationSensor<Entity>(Entity.class, "group.members.removed", "Entity removed from group members");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/MemberReplaceable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/MemberReplaceable.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/MemberReplaceable.java
deleted file mode 100644
index 238e261..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/MemberReplaceable.java
+++ /dev/null
@@ -1,45 +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.core.entity.trait;
-
-import java.util.NoSuchElementException;
-
-import org.apache.brooklyn.core.annotation.Effector;
-import org.apache.brooklyn.core.annotation.EffectorParam;
-import org.apache.brooklyn.core.effector.MethodEffector;
-import org.apache.brooklyn.entity.group.StopFailedRuntimeException;
-
-public interface MemberReplaceable {
-
-    MethodEffector<String> REPLACE_MEMBER = new MethodEffector<String>(MemberReplaceable.class, "replaceMember");
-
-    /**
-     * Replaces the entity with the given ID, if it is a member.
-     * <p>
-     * First adds a new member, then removes this one. 
-     *
-     * @param memberId entity id of a member to be replaced
-     * @return the id of the new entity
-     * @throws NoSuchElementException If entity cannot be resolved, or it is not a member
-     * @throws StopFailedRuntimeException If stop failed, after successfully starting replacement
-     */
-    @Effector(description="Replaces the entity with the given ID, if it is a member; first adds a new member, then removes this one. "+
-            "Returns id of the new entity; or throws exception if couldn't be replaced.")
-    String replaceMember(@EffectorParam(name="memberId", description="The entity id of a member to be replaced") String memberId);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Resizable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Resizable.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Resizable.java
deleted file mode 100644
index 36e6ba8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Resizable.java
+++ /dev/null
@@ -1,68 +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.core.entity.trait;
-
-
-import org.apache.brooklyn.core.annotation.Effector;
-import org.apache.brooklyn.core.annotation.EffectorParam;
-import org.apache.brooklyn.core.effector.MethodEffector;
-
-/**
- * Defines an entity group that can be re-sized dynamically.
- * <p/>
- * By invoking the {@link #resize(Integer)} effector, the number of child nodes
- * can be reduced (by shutting down some of them) or increased (by provisioning new entities.)
- */
-public interface Resizable {
-
-    /**
-     * Indicates that resizing up to the desired size is not possible - only resized to the 
-     * {@link Resizable#getCurrentSize()}, because there is insufficient capacity.
-     */
-    public static class InsufficientCapacityException extends RuntimeException {
-        private static final long serialVersionUID = 953230498564942446L;
-        
-        public InsufficientCapacityException(String msg) {
-            super(msg);
-        }
-        public InsufficientCapacityException(String msg, Throwable cause) {
-            super(msg, cause);
-        }
-    }
-    
-    MethodEffector<Integer> RESIZE = new MethodEffector<Integer>(Resizable.class, "resize");
-
-    /**
-     * Grow or shrink this entity to the desired size.
-     *
-     * @param desiredSize the new size of the entity group.
-     * @return the new size of the group.
-     * 
-     * @throws InsufficientCapacityException If the request was to grow, but there is no capacity to grow to
-     *         the desired size.
-     */
-    @Effector(description="Changes the size of the entity (e.g. the number of nodes in a cluster)")
-    Integer resize(@EffectorParam(name="desiredSize", description="The new size of the cluster") Integer desiredSize);
-
-    /**
-     * @return the current size of the group.
-     */
-    Integer getCurrentSize();
-}
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Startable.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Startable.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Startable.java
deleted file mode 100644
index 96812ce..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/Startable.java
+++ /dev/null
@@ -1,123 +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.core.entity.trait;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.annotation.EffectorParam;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.effector.MethodEffector;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This interface describes an {@link org.apache.brooklyn.api.entity.Entity} that can be started and stopped.
- *
- * The {@link Effector}s are {@link #START}, {@link #STOP} and {@link #RESTART}. The start effector takes
- * a collection of {@link Location} objects as an argument which will cause the entity to be started or stopped in all
- * these locations. The other effectors will stop or restart the entity in the location(s) it is already running in.
- */
-public interface Startable {
-
-    
-    AttributeSensor<Boolean> SERVICE_UP = Attributes.SERVICE_UP;
-
-    public static class StartEffectorBody extends EffectorBody<Void> {
-        public static final ConfigKey<Object> LOCATIONS = ConfigKeys.newConfigKey(Object.class, "locations",
-            "The location or locations to start in, as a string, a location object, a list of strings, "
-            + "or a list of location objects");
-        @Override public Void call(ConfigBag parameters) {
-            parameters.put(LOCATIONS, entity().getManagementContext().getLocationRegistry().resolveList(parameters.get(LOCATIONS)));
-            return new MethodEffector<Void>(Startable.class, "start").call(entity(), parameters.getAllConfig());
-        }
-    }
-
-    public static class StopEffectorBody extends EffectorBody<Void> {
-        private static final Logger log = LoggerFactory.getLogger(Startable.class);
-        
-        @Override public Void call(ConfigBag parameters) {
-            if (!parameters.isEmpty()) {
-                log.warn("Parameters "+parameters+" not supported for call to "+entity()+" - "+Tasks.current());
-            }
-            
-            return new MethodEffector<Void>(Startable.class, "stop").call(entity(), parameters.getAllConfig());
-        }
-    }
-
-    public static class RestartEffectorBody extends EffectorBody<Void> {
-        private static final Logger log = LoggerFactory.getLogger(Startable.class);
-
-        @Override public Void call(ConfigBag parameters) {
-            if (!parameters.isEmpty()) {
-                log.warn("Parameters "+parameters+" not supported for call to "+entity()+" - "+Tasks.current());
-            }
-            return new MethodEffector<Void>(Startable.class, "restart").call(entity(), parameters.getAllConfig());
-        }
-    }
-
-    org.apache.brooklyn.api.effector.Effector<Void> START = Effectors.effector(new MethodEffector<Void>(Startable.class, "start"))
-        // override start to take strings etc
-        .parameter(StartEffectorBody.LOCATIONS)
-        .impl(new StartEffectorBody())
-        .build();
-    
-    org.apache.brooklyn.api.effector.Effector<Void> STOP = Effectors.effector(new MethodEffector<Void>(Startable.class, "stop"))
-        .impl(new StopEffectorBody())
-        .build();
-    
-    org.apache.brooklyn.api.effector.Effector<Void> RESTART = Effectors.effector(new MethodEffector<Void>(Startable.class, "restart"))
-        .impl(new RestartEffectorBody())
-        .build();
-
-    /**
-     * Start the entity in the given collection of locations.
-     * <p>
-     * Some entities may define custom {@link Effector} implementations which support
-     * a richer set of parameters.  See the entity-specific {@link #START} effector declaration.
-     */
-    @org.apache.brooklyn.core.annotation.Effector(description="Start the process/service represented by an entity")
-    void start(@EffectorParam(name="locations") Collection<? extends Location> locations);
-
-    /**
-     * Stop the entity.
-     * <p>
-     * Some entities may define custom {@link Effector} implementations which support
-     * a richer set of parameters.  See the entity-specific {@link #STOP} effector declaration.
-     */
-    @org.apache.brooklyn.core.annotation.Effector(description="Stop the process/service represented by an entity")
-    void stop();
-
-    /**
-     * Restart the entity.
-     * <p>
-     * Some entities may define custom {@link Effector} implementations which support
-     * a richer set of parameters.  See the entity-specific {@link #RESTART} effector declaration.
-     */
-    @org.apache.brooklyn.core.annotation.Effector(description="Restart the process/service represented by an entity")
-    void restart();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/StartableMethods.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/StartableMethods.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/StartableMethods.java
deleted file mode 100644
index b49d259..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/trait/StartableMethods.java
+++ /dev/null
@@ -1,125 +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.core.entity.trait;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.exceptions.CompoundRuntimeException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class StartableMethods {
-
-    public static final Logger log = LoggerFactory.getLogger(StartableMethods.class);
-        
-    private StartableMethods() {}
-
-    /** Common implementation for start in parent nodes; just invokes start on all children of the entity */
-    public static void start(EntityLocal e, Collection<? extends Location> locations) {
-        log.debug("Starting entity "+e+" at "+locations);
-        DynamicTasks.queueIfPossible(startingChildren(e, locations)).orSubmitAsync(e).getTask().getUnchecked();
-    }
-    
-    /** Common implementation for stop in parent nodes; just invokes stop on all children of the entity */
-    public static void stop(EntityLocal e) {
-        log.debug("Stopping entity "+e);
-        DynamicTasks.queueIfPossible(stoppingChildren(e)).orSubmitAsync(e).getTask().getUnchecked();
-        if (log.isDebugEnabled()) log.debug("Stopped entity "+e);
-    }
-
-    /** Common implementation for restart in parent nodes; just invokes restart on all children of the entity */
-    public static void restart(EntityLocal e) {
-        log.debug("Restarting entity "+e);
-        DynamicTasks.queueIfPossible(restartingChildren(e)).orSubmitAsync(e).getTask().getUnchecked();
-        if (log.isDebugEnabled()) log.debug("Restarted entity "+e);
-    }
-    
-    private static <T extends Entity> Iterable<T> filterStartableManagedEntities(Iterable<T> contenders) {
-        return Iterables.filter(contenders, Predicates.and(Predicates.instanceOf(Startable.class), EntityPredicates.isManaged()));
-    }
-
-    public static void stopSequentially(Iterable<? extends Startable> entities) {
-        List<Exception> exceptions = Lists.newArrayList();
-        List<Startable> failedEntities = Lists.newArrayList();
-        
-        for (final Startable entity : entities) {
-            if (!Entities.isManaged((Entity)entity)) {
-                log.debug("Not stopping {} because it is not managed; continuing", entity);
-                continue;
-            }
-            try {
-                TaskAdaptable<Void> task = TaskTags.markInessential(Effectors.invocation((Entity)entity, Startable.STOP, Collections.emptyMap()));
-                DynamicTasks.submit(task, (Entity)entity).getUnchecked();
-            } catch (Exception e) {
-                log.warn("Error stopping "+entity+"; continuing with shutdown", e);
-                exceptions.add(e);
-                failedEntities.add(entity);
-            }
-        }
-        
-        if (exceptions.size() > 0) {
-            throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions);
-        }
-    }
-
-    /** unsubmitted task for starting children of the given entity at the same location as the entity */
-    public static TaskAdaptable<?> startingChildren(Entity entity) {
-        return startingChildren(entity, entity.getLocations());
-    }
-    /** unsubmitted task for starting children of the given entity at the given location */
-    public static TaskAdaptable<?> startingChildren(Entity entity, Location location) {
-        return startingChildren(entity, Collections.singleton(location));
-    }
-    /** unsubmitted task for starting children of the given entity at the given locations */
-    public static TaskAdaptable<?> startingChildren(Entity entity, Iterable<? extends Location> locations) {
-        return Effectors.invocation(Startable.START, MutableMap.of("locations", locations), filterStartableManagedEntities(entity.getChildren()));
-    }
-
-    /** unsubmitted task for stopping children of the given entity */
-    public static TaskAdaptable<?> stoppingChildren(Entity entity) {
-        return Effectors.invocation(Startable.STOP, Collections.emptyMap(), filterStartableManagedEntities(entity.getChildren()));
-    }
-
-    /** unsubmitted task for restarting children of the given entity */
-    public static TaskAdaptable<?> restartingChildren(Entity entity, ConfigBag parameters) {
-        return Effectors.invocation(Startable.RESTART, parameters.getAllConfig(), filterStartableManagedEntities(entity.getChildren()));
-    }
-    /** as {@link #restartingChildren(Entity, ConfigBag)} with no parameters */
-    public static TaskAdaptable<?> restartingChildren(Entity entity) {
-        return restartingChildren(entity, ConfigBag.EMPTY);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AbstractFeed.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AbstractFeed.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AbstractFeed.java
deleted file mode 100644
index 5b057dd..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AbstractFeed.java
+++ /dev/null
@@ -1,246 +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.core.feed;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.rebind.BasicFeedRebindSupport;
-import org.apache.brooklyn.core.objs.AbstractEntityAdjunct;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** 
- * Captures common fields and processes for sensor feeds.
- * These generally poll or subscribe to get sensor values for an entity.
- * They make it easy to poll over http, jmx, etc.
- */
-public abstract class AbstractFeed extends AbstractEntityAdjunct implements Feed {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractFeed.class);
-
-    public static final ConfigKey<Boolean> ONLY_IF_SERVICE_UP = ConfigKeys.newBooleanConfigKey("feed.onlyIfServiceUp", "", false);
-    
-    private final Object pollerStateMutex = new Object();
-    private transient volatile Poller<?> poller;
-    private transient volatile boolean activated;
-    private transient volatile boolean suspended;
-
-    public AbstractFeed() {
-    }
-    
-    /**
-     * @deprecated since 0.7.0; use no-arg constructor; call {@link #setEntity(EntityLocal)}
-     */
-    @Deprecated
-    public AbstractFeed(EntityLocal entity) {
-        this(entity, false);
-    }
-    
-    /**
-     * @deprecated since 0.7.0; use no-arg constructor; call {@link #setEntity(EntityLocal)} and {@code setConfig(ONLY_IF_SERVICE_UP, onlyIfServiceUp)}
-     */
-    @Deprecated
-    public AbstractFeed(EntityLocal entity, boolean onlyIfServiceUp) {
-        this.entity = checkNotNull(entity, "entity");
-        setConfig(ONLY_IF_SERVICE_UP, onlyIfServiceUp);
-    }
-
-    // Ensure idempotent, as called in builders (in case not registered with entity), and also called
-    // when registering with entity
-    @Override
-    public void setEntity(EntityLocal entity) {
-        super.setEntity(entity);
-        if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_FEED_REGISTRATION_PROPERTY)) {
-            ((EntityInternal)entity).feeds().addFeed(this);
-        }
-    }
-
-    protected void initUniqueTag(String uniqueTag, Object ...valsForDefault) {
-        if (Strings.isNonBlank(uniqueTag)) this.uniqueTag = uniqueTag;
-        else this.uniqueTag = getDefaultUniqueTag(valsForDefault);
-    }
-
-    protected String getDefaultUniqueTag(Object ...valsForDefault) {
-        StringBuilder sb = new StringBuilder();
-        sb.append(JavaClassNames.simpleClassName(this));
-        if (valsForDefault.length==0) {
-            sb.append("@");
-            sb.append(hashCode());
-        } else if (valsForDefault.length==1 && valsForDefault[0] instanceof Collection){
-            sb.append(Strings.toUniqueString(valsForDefault[0], 80));
-        } else {
-            sb.append("[");
-            boolean first = true;
-            for (Object x: valsForDefault) {
-                if (!first) sb.append(";");
-                else first = false;
-                sb.append(Strings.toUniqueString(x, 80));
-            }
-            sb.append("]");
-        }
-        return sb.toString(); 
-    }
-
-    @Override
-    public void start() {
-        if (log.isDebugEnabled()) log.debug("Starting feed {} for {}", this, entity);
-        if (activated) { 
-            throw new IllegalStateException(String.format("Attempt to start feed %s of entity %s when already running", 
-                    this, entity));
-        }
-        if (poller != null) {
-            throw new IllegalStateException(String.format("Attempt to re-start feed %s of entity %s", this, entity));
-        }
-        
-        poller = new Poller<Object>(entity, getConfig(ONLY_IF_SERVICE_UP));
-        activated = true;
-        preStart();
-        synchronized (pollerStateMutex) {
-            // don't start poller if we are suspended
-            if (!suspended) {
-                poller.start();
-            }
-        }
-    }
-
-    @Override
-    public void suspend() {
-        synchronized (pollerStateMutex) {
-            if (activated && !suspended) {
-                poller.stop();
-            }
-            suspended = true;
-        }
-    }
-    
-    @Override
-    public void resume() {
-        synchronized (pollerStateMutex) {
-            if (activated && suspended) {
-                poller.start();
-            }
-            suspended = false;
-        }
-    }
-    
-    @Override
-    public void destroy() {
-        stop();
-    }
-
-    @Override
-    public void stop() {
-        if (!activated) { 
-            log.debug("Ignoring attempt to stop feed {} of entity {} when not running", this, entity);
-            return;
-        }
-        if (log.isDebugEnabled()) log.debug("stopping feed {} for {}", this, entity);
-        
-        activated = false;
-        preStop();
-        synchronized (pollerStateMutex) {
-            if (!suspended) {
-                poller.stop();
-            }
-        }
-        postStop();
-        super.destroy();
-    }
-
-    @Override
-    public boolean isActivated() {
-        return activated;
-    }
-    
-    public EntityLocal getEntity() {
-        return entity;
-    }
-    
-    protected boolean isConnected() {
-        // TODO Default impl will result in multiple logs for same error if becomes unreachable
-        // (e.g. if ssh gets NoRouteToHostException, then every AttributePollHandler for that
-        // feed will log.warn - so if polling for 10 sensors/attributes will get 10 log messages).
-        // Would be nice if reduced this logging duplication.
-        // (You can reduce it by providing a better 'isConnected' implementation of course.)
-        return isRunning() && entity!=null && !((EntityInternal)entity).getManagementSupport().isNoLongerManaged();
-    }
-
-    @Override
-    public boolean isSuspended() {
-        return suspended;
-    }
-
-    @Override
-    public boolean isRunning() {
-        return isActivated() && !isSuspended() && !isDestroyed() && getPoller()!=null && getPoller().isRunning();
-    }
-
-    @Override
-    public RebindSupport<FeedMemento> getRebindSupport() {
-        return new BasicFeedRebindSupport(this);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public RelationSupportInternal<Feed> relations() {
-        return (RelationSupportInternal<Feed>) super.relations();
-    }
-    
-    @Override
-    protected void onChanged() {
-        // TODO Auto-generated method stub
-    }
-
-    /**
-     * For overriding.
-     */
-    protected void preStart() {
-    }
-    
-    /**
-     * For overriding.
-     */
-    protected void preStop() {
-    }
-    
-    /**
-     * For overriding.
-     */
-    protected void postStop() {
-    }
-    
-    /**
-     * For overriding, where sub-class can change return-type generics!
-     */
-    protected Poller<?> getPoller() {
-        return poller;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
deleted file mode 100644
index a82f5d9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
+++ /dev/null
@@ -1,248 +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.core.feed;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle.Transition;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-
-/**
- * Handler for when polling an entity's attribute. On each poll result the entity's attribute is set.
- * 
- * Calls to onSuccess and onError will happen sequentially, but may be called from different threads 
- * each time. Note that no guarantees of a synchronized block exist, so additional synchronization 
- * would be required for the Java memory model's "happens before" relationship.
- * 
- * @author aled
- */
-public class AttributePollHandler<V> implements PollHandler<V> {
-
-    public static final Logger log = LoggerFactory.getLogger(AttributePollHandler.class);
-
-    private final FeedConfig<V,?,?> config;
-    private final EntityLocal entity;
-    @SuppressWarnings("rawtypes")
-    private final AttributeSensor sensor;
-    private final AbstractFeed feed;
-    private final boolean suppressDuplicates;
-    
-    // allow 30 seconds before logging at WARN, if there has been no success yet;
-    // after success WARN immediately
-    // TODO these should both be configurable
-    private Duration logWarningGraceTimeOnStartup = Duration.THIRTY_SECONDS;
-    private Duration logWarningGraceTime = Duration.millis(0);
-    
-    // internal state to look after whether to log warnings
-    private volatile Long lastSuccessTime = null;
-    private volatile Long currentProblemStartTime = null;
-    private volatile boolean currentProblemLoggedAsWarning = false;
-    private volatile boolean lastWasProblem = false;
-
-    
-    public AttributePollHandler(FeedConfig<V,?,?> config, EntityLocal entity, AbstractFeed feed) {
-        this.config = checkNotNull(config, "config");
-        this.entity = checkNotNull(entity, "entity");
-        this.sensor = checkNotNull(config.getSensor(), "sensor");
-        this.feed = checkNotNull(feed, "feed");
-        this.suppressDuplicates = config.getSupressDuplicates();
-    }
-
-    @Override
-    public boolean checkSuccess(V val) {
-        // Always true if no checkSuccess predicate was configured.
-        return !config.hasCheckSuccessHandler() || config.getCheckSuccess().apply(val);
-    }
-
-    @Override
-    public void onSuccess(V val) {
-        if (lastWasProblem) {
-            if (currentProblemLoggedAsWarning) { 
-                log.info("Success (following previous problem) reading "+getBriefDescription());
-            } else {
-                log.debug("Success (following previous problem) reading "+getBriefDescription());
-            }
-            lastWasProblem = false;
-            currentProblemStartTime = null;
-            currentProblemLoggedAsWarning = false;
-        }
-        lastSuccessTime = System.currentTimeMillis();
-        if (log.isTraceEnabled()) log.trace("poll for {} got: {}", new Object[] {getBriefDescription(), val});
-        
-        try {
-            setSensor(transformValueOnSuccess(val));
-        } catch (Exception e) {
-            if (feed.isConnected()) {
-                log.warn("unable to compute "+getBriefDescription()+"; on val="+val, e);
-            } else {
-                if (log.isDebugEnabled()) log.debug("unable to compute "+getBriefDescription()+"; val="+val+" (when inactive)", e);
-            }
-        }
-    }
-
-    /** allows post-processing, such as applying a success handler; 
-     * default applies the onSuccess handler (which is recommended) */
-    protected Object transformValueOnSuccess(V val) {
-        return config.hasSuccessHandler() ? config.getOnSuccess().apply(val) : val;
-    }
-
-    @Override
-    public void onFailure(V val) {
-        if (!config.hasFailureHandler()) {
-            onException(new Exception("checkSuccess of "+this+" for "+getBriefDescription()+" was false but poller has no failure handler"));
-        } else {
-            logProblem("failure", val);
-
-            try {
-                setSensor(config.hasFailureHandler() ? config.getOnFailure().apply((V)val) : val);
-            } catch (Exception e) {
-                if (feed.isConnected()) {
-                    log.warn("Error computing " + getBriefDescription() + "; val=" + val+": "+ e, e);
-                } else {
-                    if (log.isDebugEnabled())
-                        log.debug("Error computing " + getBriefDescription() + "; val=" + val + " (when inactive)", e);
-                }
-            }
-        }
-    }
-
-    @Override
-    public void onException(Exception exception) {
-        if (!feed.isConnected()) {
-            if (log.isTraceEnabled()) log.trace("Read of {} in {} gave exception (while not connected or not yet connected): {}", new Object[] {this, getBriefDescription(), exception});
-        } else {
-            logProblem("exception", exception);
-        }
-
-        if (config.hasExceptionHandler()) {
-            try {
-                setSensor( config.getOnException().apply(exception) );
-            } catch (Exception e) {
-                if (feed.isConnected()) {
-                    log.warn("unable to compute "+getBriefDescription()+"; on exception="+exception, e);
-                } else {
-                    if (log.isDebugEnabled()) log.debug("unable to compute "+getBriefDescription()+"; exception="+exception+" (when inactive)", e);
-                }
-            }
-        }
-    }
-
-    protected void logProblem(String type, Object val) {
-        if (lastWasProblem && currentProblemLoggedAsWarning) {
-            if (log.isTraceEnabled())
-                log.trace("Recurring {} reading {} in {}: {}", new Object[] {type, this, getBriefDescription(), val});
-        } else {
-            long nowTime = System.currentTimeMillis();
-            // get a non-volatile value
-            Long currentProblemStartTimeCache = currentProblemStartTime;
-            long expiryTime = 
-                    (lastSuccessTime!=null && !isTransitioningOrStopped()) ? lastSuccessTime+logWarningGraceTime.toMilliseconds() :
-                    currentProblemStartTimeCache!=null ? currentProblemStartTimeCache+logWarningGraceTimeOnStartup.toMilliseconds() :
-                    nowTime+logWarningGraceTimeOnStartup.toMilliseconds();
-            if (!lastWasProblem) {
-                if (expiryTime <= nowTime) {
-                    currentProblemLoggedAsWarning = true;
-                    if (entity==null || !Entities.isNoLongerManaged(entity)) {
-                        log.warn("Read of " + getBriefDescription() + " gave " + type + ": " + val);
-                    } else {
-                        log.debug("Read of " + getBriefDescription() + " gave " + type + ": " + val);
-                    }
-                    if (log.isDebugEnabled() && val instanceof Throwable)
-                        log.debug("Trace for "+type+" reading "+getBriefDescription()+": "+val, (Throwable)val);
-                } else {
-                    if (log.isDebugEnabled())
-                        log.debug("Read of " + getBriefDescription() + " gave " + type + " (in grace period): " + val);
-                }
-                lastWasProblem = true;
-                currentProblemStartTime = nowTime;
-            } else {
-                if (expiryTime <= nowTime) {
-                    currentProblemLoggedAsWarning = true;
-                    log.warn("Read of " + getBriefDescription() + " gave " + type + 
-                            " (grace period expired, occurring for "+Duration.millis(nowTime - currentProblemStartTimeCache)+
-                            (config.hasExceptionHandler() ? "" : ", no exception handler set for sensor")+
-                            ")"+
-                            ": " + val);
-                    if (log.isDebugEnabled() && val instanceof Throwable)
-                        log.debug("Trace for "+type+" reading "+getBriefDescription()+": "+val, (Throwable)val);
-                } else {
-                    if (log.isDebugEnabled()) 
-                        log.debug("Recurring {} reading {} in {} (still in grace period): {}", new Object[] {type, this, getBriefDescription(), val});
-                }
-            }
-        }
-    }
-
-    protected boolean isTransitioningOrStopped() {
-        if (entity==null) return false;
-        Transition expected = entity.getAttribute(Attributes.SERVICE_STATE_EXPECTED);
-        if (expected==null) return false;
-        return (expected.getState()==Lifecycle.STARTING || expected.getState()==Lifecycle.STOPPING || expected.getState()==Lifecycle.STOPPED);
-    }
-
-    @SuppressWarnings("unchecked")
-    protected void setSensor(Object v) {
-        if (Entities.isNoLongerManaged(entity)) {
-            if (Tasks.isInterrupted()) return;
-            log.warn(""+entity+" is not managed; feed "+this+" setting "+sensor+" to "+v+" at this time is not supported ("+Tasks.current()+")");
-        }
-        
-        if (v == FeedConfig.UNCHANGED) {
-            // nothing
-        } else if (v == FeedConfig.REMOVE) {
-            ((EntityInternal)entity).removeAttribute(sensor);
-        } else if (sensor == FeedConfig.NO_SENSOR) {
-            // nothing
-        } else {
-            Object coercedV = TypeCoercions.coerce(v, sensor.getType());
-            if (suppressDuplicates && Objects.equal(coercedV, entity.getAttribute(sensor))) {
-                // no change; nothing
-            } else {
-                entity.sensors().set(sensor, coercedV);
-            }
-        }
-    }
-
-    @Override
-    public String toString() {
-        return super.toString()+"["+getDescription()+"]";
-    }
-    
-    @Override
-    public String getDescription() {
-        return sensor.getName()+" @ "+entity.getId()+" <- "+config;
-    }
-    
-    protected String getBriefDescription() {
-        return ""+entity+"->"+(sensor==FeedConfig.NO_SENSOR ? "(dynamic sensors)" : ""+sensor);
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/ConfigToAttributes.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/ConfigToAttributes.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/ConfigToAttributes.java
deleted file mode 100644
index dc81d2a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/ConfigToAttributes.java
+++ /dev/null
@@ -1,59 +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.core.feed;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.TemplatedStringAttributeSensorAndConfigKey;
-
-
-/** Simple config adapter for setting {@link AttributeSensorAndConfigKey} sensor values from the config value or config default */ 
-public class ConfigToAttributes {
-
-    //normally just applied once, statically, not registered...
-    public static void apply(EntityLocal entity) {
-        for (Sensor<?> it : entity.getEntityType().getSensors()) {
-            if (it instanceof AttributeSensorAndConfigKey) {
-                apply(entity, (AttributeSensorAndConfigKey<?,?>)it);
-            }
-        }
-    }
-
-    /**
-     * Convenience for ensuring an individual sensor is set from its config key
-     * (e.g. sub-classes of DynamicWebAppCluster that don't want to set HTTP_PORT etc!)
-     */
-    public static <T> T apply(EntityLocal entity, AttributeSensorAndConfigKey<?,T> key) {
-        T v = entity.getAttribute(key);
-        if (v!=null) return v;
-        v = key.getAsSensorValue(entity);
-        if (v!=null) entity.sensors().set(key, v);
-        return v;
-    }
-
-    /**
-     * Convenience for transforming a config value (e.g. processing a {@link TemplatedStringAttributeSensorAndConfigKey}),
-     * outside of the context of an entity.
-     */
-    public static <T> T transform(ManagementContext managementContext, AttributeSensorAndConfigKey<?,T> key) {
-        return key.getAsSensorValue(managementContext);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/DelegatingPollHandler.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/DelegatingPollHandler.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/DelegatingPollHandler.java
deleted file mode 100644
index fae7dd6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/feed/DelegatingPollHandler.java
+++ /dev/null
@@ -1,96 +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.core.feed;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * A poll handler that delegates each call to a set of poll handlers.
- * 
- * @author aled
- */
-public class DelegatingPollHandler<V> implements PollHandler<V> {
-
-    private final List<AttributePollHandler<? super V>> delegates;
-
-    public DelegatingPollHandler(Iterable<AttributePollHandler<? super V>> delegates) {
-        super();
-        this.delegates = ImmutableList.copyOf(delegates);
-    }
-
-    @Override
-    public boolean checkSuccess(V val) {
-        for (AttributePollHandler<? super V> delegate : delegates) {
-            if (!delegate.checkSuccess(val))
-                return false;
-        }
-        return true;
-    }
-
-    @Override
-    public void onSuccess(V val) {
-        for (AttributePollHandler<? super V> delegate : delegates) {
-            delegate.onSuccess(val);
-        }
-    }
-
-    @Override
-    public void onFailure(V val) {
-        for (AttributePollHandler<? super V> delegate : delegates) {
-            delegate.onFailure(val);
-        }
-    }
-
-    @Override
-    public void onException(Exception exception) {
-        for (AttributePollHandler<? super V> delegate : delegates) {
-            delegate.onException(exception);
-        }
-    }
-    
-    @Override
-    public String toString() {
-        return super.toString()+"["+getDescription()+"]";
-    }
-    
-    @Override
-    public String getDescription() {
-        if (delegates.isEmpty())
-            return "(empty delegate list)";
-        if (delegates.size()==1) 
-            return delegates.get(0).getDescription();
-        StringBuilder sb = new StringBuilder();
-        sb.append("[");
-        int count = 0;
-        for (AttributePollHandler<? super V> delegate : delegates) {
-            if (count>0) sb.append("; ");
-            sb.append(delegate.getDescription());
-            if (count>2) {
-                sb.append("; ...");
-                break;
-            }
-            count++;
-        }
-        sb.append("]");
-        return sb.toString();
-    }
-    
-}


[15/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadSubstituters.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadSubstituters.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadSubstituters.java
deleted file mode 100644
index 64a081c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/DownloadSubstituters.java
+++ /dev/null
@@ -1,172 +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.core.entity.drivers.downloads;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-
-import freemarker.cache.StringTemplateLoader;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-public class DownloadSubstituters {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DownloadSubstituters.class);
-
-    static {
-        // TODO in Freemarker 2.4 SLF4J may be auto-selected and we can remove this;
-        // for now, we need it somewhere, else we get j.u.l logging; 
-        // since this is the main place it is used, let's do it here
-        try {
-            LOG.debug("Configuring Freemarker logging for Brooklyn to use SLF4J");
-            System.setProperty(freemarker.log.Logger.SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY, freemarker.log.Logger.LIBRARY_NAME_SLF4J);
-        } catch (Exception e) {
-            LOG.warn("Error setting Freemarker logging: "+e, e);
-        }
-    }
-    
-    private DownloadSubstituters() {}
-    
-    /**
-     * Converts the basevalue by substituting things in the form ${key} for values specific
-     * to a given entity driver. The keys used are:
-     * <ul>
-     *   <li>driver: the driver instance (e.g. can do freemarker.org stuff like ${driver.osTag} to call {@code driver.getOsTag()})
-     *   <li>entity: the entity instance
-     *   <li>type: the fully qualified type name of the entity
-     *   <li>simpletype: the unqualified type name of the entity
-     *   <li>addon: the name of the add-on, or null if for the entity's main artifact
-     *   <li>version: the version for this entity (or of the add-on), or not included if null
-     * </ul>
-     * 
-     * Additional substitution keys (and values) can be defined using {@link DownloadRequirement#getProperties()}; these
-     * override the default substitutions listed above.
-     */
-    public static String substitute(DownloadRequirement req, String basevalue) {
-        return substitute(basevalue, getBasicSubstitutions(req));
-    }
-
-    public static Map<String,Object> getBasicSubstitutions(DownloadRequirement req) {
-        EntityDriver driver = req.getEntityDriver();
-        String addon = req.getAddonName();
-        Map<String, ?> props = req.getProperties();
-        
-        if (addon == null) {
-            return MutableMap.<String,Object>builder()
-                    .putAll(getBasicEntitySubstitutions(driver))
-                    .putAll(props)
-                    .build();
-        } else {
-            return MutableMap.<String,Object>builder()
-                    .putAll(getBasicAddonSubstitutions(driver, addon))
-                    .putAll(props)
-                    .build();
-        }
-    }
-    
-    public static Map<String,Object> getBasicEntitySubstitutions(EntityDriver driver) {
-        Entity entity = driver.getEntity();
-        String type = entity.getEntityType().getName();
-        String simpleType = type.substring(type.lastIndexOf(".")+1);
-        String version = entity.getConfig(BrooklynConfigKeys.SUGGESTED_VERSION);
-        
-        return MutableMap.<String,Object>builder()
-                .put("entity", entity)
-                .put("driver", driver)
-                .put("type", type)
-                .put("simpletype", simpleType)
-                .putIfNotNull("version", version)
-                .build();
-    }
-
-    public static Map<String,Object> getBasicAddonSubstitutions(EntityDriver driver, String addon) {
-        return MutableMap.<String,Object>builder()
-                .putAll(getBasicEntitySubstitutions(driver))
-                .put("addon", addon)
-                .build();
-    }
-
-    public static String substitute(String basevalue, Map<String,?> substitutions) {
-        try {
-            Configuration cfg = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
-            StringTemplateLoader templateLoader = new StringTemplateLoader();
-            templateLoader.putTemplate("config", basevalue);
-            cfg.setTemplateLoader(templateLoader);
-            Template template = cfg.getTemplate("config");
-            
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            Writer out = new OutputStreamWriter(baos);
-            template.process(substitutions, out);
-            out.flush();
-            
-            return new String(baos.toByteArray());
-        } catch (IOException e) {
-            LOG.warn("Error processing template '"+basevalue+"'", e);
-            throw Exceptions.propagate(e);
-        } catch (TemplateException e) {
-            throw new IllegalArgumentException("Failed to process driver download '"+basevalue+"'", e);
-        }
-    }
-
-    public static Function<DownloadRequirement, DownloadTargets> substituter(Function<? super DownloadRequirement, String> basevalueProducer, Function<? super DownloadRequirement, ? extends Map<String,?>> subsProducer) {
-        // FIXME Also need default subs (entity, driver, simpletype, etc)
-        return new Substituter(basevalueProducer, subsProducer);
-    }
-
-    protected static class Substituter implements Function<DownloadRequirement, DownloadTargets> {
-        private final Function<? super DownloadRequirement, String> basevalueProducer;
-        private final Function<? super DownloadRequirement, ? extends Map<String,?>> subsProducer;
-        
-        Substituter(Function<? super DownloadRequirement, String> baseValueProducer, Function<? super DownloadRequirement, ? extends Map<String,?>> subsProducer) {
-            this.basevalueProducer = checkNotNull(baseValueProducer, "basevalueProducer");
-            this.subsProducer = checkNotNull(subsProducer, "subsProducer");
-        }
-        
-        @Override
-        public DownloadTargets apply(DownloadRequirement input) {
-            String basevalue = basevalueProducer.apply(input);
-            Map<String, ?> subs = subsProducer.apply(input);
-            String result = (basevalue != null) ? substitute(basevalue, subs) : null;
-            return (result != null) ? BasicDownloadTargets.builder().addPrimary(result).build() : BasicDownloadTargets.empty();
-        }
-        
-        @Override public String toString() {
-            return Objects.toStringHelper(this).add("basevalue", basevalueProducer).add("subs", subsProducer).toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/FilenameProducers.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/FilenameProducers.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/FilenameProducers.java
deleted file mode 100644
index 18240f1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/drivers/downloads/FilenameProducers.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.core.entity.drivers.downloads;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadRequirement;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager.DownloadTargets;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.base.Function;
-
-public class FilenameProducers {
-
-    public static String inferFilename(String target) {
-        String result = target.substring(target.lastIndexOf("/")+1);
-        result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result;
-        if (!result.contains("."))
-            // require a full stop, else assume it isn't a filename
-            return null;
-        return result;
-    }
-
-    public static Function<DownloadRequirement, String> fromFilenameProperty() {
-        return new Function<DownloadRequirement, String>() {
-            @Override public String apply(@Nullable DownloadRequirement req) {
-                Object filename = req.getProperties().get("filename");
-                return (filename != null) ? filename.toString() : null;
-            }
-        };
-    }
-    
-    public static Function<DownloadRequirement, String> firstPrimaryTargetOf(final Function<DownloadRequirement, DownloadTargets> producer) {
-        return new Function<DownloadRequirement, String>() {
-            @Override public String apply(@Nullable DownloadRequirement req) {
-                DownloadTargets targets = producer.apply(req);
-                List<String> primaryTargets = targets.getPrimaryLocations();
-                for (String primaryTarget : primaryTargets) {
-                    String result = inferFilename(primaryTarget);
-                    if (!Strings.isBlank(result)) return result;
-                }
-                return null;
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/AbstractConfigurableEntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/AbstractConfigurableEntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/AbstractConfigurableEntityFactory.java
deleted file mode 100644
index 6b41e4b..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/AbstractConfigurableEntityFactory.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 org.apache.brooklyn.core.entity.factory;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractConfigurableEntityFactory<T extends Entity> implements ConfigurableEntityFactory<T>, Serializable {
-    private static final Logger log = LoggerFactory.getLogger(AbstractConfigurableEntityFactory.class);
-    
-    protected final Map config = new LinkedHashMap();
-
-    public AbstractConfigurableEntityFactory(){
-        this(new HashMap());
-    }
-
-    public AbstractConfigurableEntityFactory(Map flags) {
-        this.config.putAll(flags);
-
-    }
-    public AbstractConfigurableEntityFactory<T> configure(Map flags) {
-        config.putAll(flags);
-        return this;
-    }
-
-    public AbstractConfigurableEntityFactory<T> configure(ConfigKey key, Object value) {
-        config.put(key, value);
-        return this;
-    }
-
-    public AbstractConfigurableEntityFactory<T> configure(ConfigKey.HasConfigKey key, Object value) {
-        return setConfig(key.getConfigKey(), value);
-    }
-
-    public AbstractConfigurableEntityFactory<T> setConfig(ConfigKey key, Object value) {
-        return configure(key, value);
-    }
-
-    public AbstractConfigurableEntityFactory<T> setConfig(ConfigKey.HasConfigKey key, Object value) {
-        return configure(key.getConfigKey(), value);
-    }
-
-    public T newEntity(Entity parent){
-        return newEntity(new HashMap(),parent);
-    }
-
-    public T newEntity(Map flags, Entity parent) {
-        Map flags2 = new HashMap();
-        flags2.putAll(config);
-        flags2.putAll(flags);
-        T result = newEntity2(flags2, parent);
-        // we rely increasingly on init, which factory doesn't call; really should remove factories!
-        log.warn("Deprecated legacy compatibility, using factory (init will not be invoked): "+result);
-        return result;
-    }
-
-    public abstract T newEntity2(Map flags, Entity parent);
-}
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ApplicationBuilder.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ApplicationBuilder.java
deleted file mode 100644
index 66f4795..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ApplicationBuilder.java
+++ /dev/null
@@ -1,249 +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.core.entity.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.EntityManager;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Experimental mechanism for defining/building applications. In future releases, this
- * API will change. Its concepts will most likely be merged with a TOSCA implementation
- * and with {@link EntitySpec}.
- *
- * For building an application. Users can sub-class and override doBuild(), putting the logic for  
- * creating and wiring together entities in there.
- * 
- * The builder is mutable; a given instance should be used to build only a single application.
- * Once {@link #manage()} has been called, the application will be built and no additional configuration
- * should be performed through this builder.  
- * 
- * Example (simplified) code for sub-classing is:
- * <pre>
- * {@code
- *   app = new ApplicationBuilder() {
- *       //@Override
- *       public void doBuild() {
- *           MySqlNode db = addChild(EntitySpec.create(MySqlNode.class)));
- *           JBoss7Server as = addChild(EntitySpec.create(JBoss7Server.class)
- *                   .configure(HTTP_PORT, "8080+")
- *                   .configure(javaSysProp("brooklyn.example.db.url"), attributeWhenReady(db, MySqlNode.MYSQL_URL));
- *       }
- *   }.manage();
- * }
- * </pre>
- * 
- * @author aled
- * 
- * @deprecated since 0.9.0; use {@link EntitySpec} and {@link EntityManager#createEntity(EntitySpec)}, having 
- *             added the children to the spec etc.
- */
-@Deprecated
-@Beta
-public abstract class ApplicationBuilder {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(ApplicationBuilder.class);
-
-    @SuppressWarnings("unchecked")
-    @Beta
-    /** @deprecated since 0.7.0 the management context should normally be passed in;
-     * for TestApplication also see TestApplication.Factory.newManagedInstanceForTests() */ 
-    @Deprecated
-    public static <T extends StartableApplication> T newManagedApp(Class<T> type) {
-        if (type.isInterface()) {
-            return (T) newManagedApp(EntitySpec.create(type));
-        } else {
-            return (T) newManagedApp(EntitySpec.create(StartableApplication.class, type));
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static <T extends StartableApplication> T newManagedApp(EntitySpec<T> spec) {
-        return (T) new ApplicationBuilder(spec) {
-            @Override protected void doBuild() {
-            }
-        }.manage();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Beta
-    public static <T extends StartableApplication> T newManagedApp(Class<T> type, ManagementContext managementContext) {
-        if (type.isInterface()) {
-            return (T) newManagedApp(EntitySpec.create(type), managementContext);
-        } else {
-            return (T) newManagedApp(EntitySpec.create(StartableApplication.class, type), managementContext);
-        }
-    }
-
-    /** @deprecated class can be removed; users of this convenience method can now simply do mgmt.getEntityManager().createEntity(spec) */ 
-    @SuppressWarnings("unchecked")
-    @Beta
-    public static <T extends StartableApplication> T newManagedApp(EntitySpec<T> spec, ManagementContext managementContext) {
-        return (T) new ApplicationBuilder(spec) {
-            @Override protected void doBuild() {
-            }
-        }.manage(managementContext);
-    }
-
-    protected volatile boolean managed = false;
-    protected final AtomicBoolean inManage = new AtomicBoolean(false);
-    private EntitySpec<? extends StartableApplication> appSpec;
-    private ManagementContext managementContext;
-    private StartableApplication app;
-    
-    public ApplicationBuilder() {
-        this.appSpec = EntitySpec.create(BasicApplication.class);
-    }
-
-    public ApplicationBuilder(EntitySpec<? extends StartableApplication> appSpec) {
-        this.appSpec = EntitySpec.create(appSpec);
-    }
-
-    public final ApplicationBuilder appDisplayName(String val) {
-        checkPreManage();
-        appSpec.displayName(val);
-        return this;
-    }
-    
-    protected final <T extends Entity> T createEntity(EntitySpec<T> spec) {
-        checkDuringManage();
-        EntityManager entityManager = managementContext.getEntityManager();
-        return entityManager.createEntity(spec);
-    }
-
-    /**
-     * Adds the given entity as a child of the application being built.
-     * To be called during {@link #doBuild()}.
-     */
-    protected final <T extends Entity> T addChild(T entity) {
-        checkDuringManage();
-        return app.addChild(entity);
-    }
-
-    /**
-     * Returns the type of the application being built.
-     */
-    public final Class<? extends StartableApplication> getType() {
-        return appSpec.getType();
-    }
-    
-    /**
-     * Configures the application instance.
-     */
-    public final ApplicationBuilder configure(Map<?,?> config) {
-        checkPreManage();
-        appSpec.configure(config);
-        return this;
-    }
-    
-    /**
-     * Adds the given entity as a child of the application being built.
-     */
-    protected final <T extends Entity> T addChild(EntitySpec<T> spec) {
-        checkDuringManage();
-        return addChild(createEntity(spec));
-    }
-    
-    protected final <T extends Entity> T addChild(Map<?,?> config, Class<T> type) {
-        checkDuringManage();
-        EntitySpec<T> spec = EntitySpec.create(type).configure(config);
-        return addChild(createEntity(spec));
-    }
-    
-    protected final ManagementContext getManagementContext() {
-        return checkNotNull(managementContext, "must only be called after manage()");
-    }
-
-    protected final StartableApplication getApp() {
-        return checkNotNull(app, "must only be called after manage()");
-    }
-
-    /**
-     * For overriding, to create and wire together entities.
-     */
-    protected abstract void doBuild();
-
-    /**
-     * Creates a new {@link ManagementContext}, and then builds and manages the application.
-     * 
-     * @see #manage(ManagementContext)
-     */
-    public final StartableApplication manage() {
-        return manage(Entities.newManagementContext());
-    }
-    
-    /**
-     * Builds and manages the application, calling the user's {@link #doBuild()} method.
-     * 
-     * @throws IllegalStateException If already managed, or if called during {@link #doBuild()}, or if 
-     *                               multiple concurrent calls
-     */
-    public final StartableApplication manage(ManagementContext managementContext) {
-        if (!inManage.compareAndSet(false, true)) {
-            throw new IllegalStateException("Concurrent and re-entrant calls to manage() forbidden on "+this);
-        }
-        try {
-            checkNotManaged();
-            this.managementContext = managementContext;
-            this.app = managementContext.getEntityManager().createEntity(appSpec);
-            doBuild();
-            // not needed with 0.9.0 (TODO - remove when confirmed)
-//            Entities.startManagement(app, managementContext);
-            managed = true;
-            return app;
-        } finally {
-            inManage.set(false);
-        }
-    }
-    
-    protected void checkPreManage() {
-        if (inManage.get()) {
-            throw new IllegalStateException("Builder being managed; cannot perform operation during call to manage(), or in doBuild()");
-        }
-        if (managed) {
-            throw new IllegalStateException("Builder already managed; cannot perform operation after call to manage()");
-        }
-    }
-    
-    protected void checkNotManaged() {
-        if (managed) {
-            throw new IllegalStateException("Builder already managed; cannot perform operation after call to manage()");
-        }
-    }
-    
-    protected void checkDuringManage() {
-        if (!inManage.get() || app == null) {
-            throw new IllegalStateException("Operation only permitted during manage, e.g. called from doBuild() of "+this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/BasicConfigurableEntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/BasicConfigurableEntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/BasicConfigurableEntityFactory.java
deleted file mode 100644
index 8f6e3f6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/BasicConfigurableEntityFactory.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 org.apache.brooklyn.core.entity.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Throwables;
-
-/** @deprecated since 0.7.0; use EntitySpec instead, as per {@link EntityFactory} javadoc */
-@Deprecated
-public class BasicConfigurableEntityFactory<T extends Entity> extends AbstractConfigurableEntityFactory<T> {
-    private transient Class<? extends T> clazz;
-    private final String clazzName;
-
-    public BasicConfigurableEntityFactory(Class<? extends T> clazz) {
-        this(new HashMap(), clazz);
-    }
-
-    public BasicConfigurableEntityFactory(Map flags, Class<? extends T> clazz) {
-        super(flags);
-        this.clazz = checkNotNull(clazz, "clazz");
-        this.clazzName = DeserializingClassRenamesProvider.findMappedName(clazz.getName());
-    }
-
-    public T newEntity2(Map flags, Entity parent) {
-        try {
-            Constructor<? extends T> constructor = clazz.getConstructor(Map.class, Entity.class);
-            return constructor.newInstance(flags, parent);
-        } catch (InstantiationException e) {
-            throw Throwables.propagate(e);
-        } catch (IllegalAccessException e) {
-            throw Throwables.propagate(e);
-        } catch (InvocationTargetException e) {
-            throw Throwables.propagate(e);
-        } catch (NoSuchMethodException e) {
-            throw Throwables.propagate(e);
-        }
-    }
-    
-    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
-        s.defaultReadObject();
-        clazz = (Class<T>) getClass().getClassLoader().loadClass(clazzName);
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("type", clazzName).toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ClosureEntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ClosureEntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ClosureEntityFactory.java
deleted file mode 100644
index df0cf26..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ClosureEntityFactory.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 org.apache.brooklyn.core.entity.factory;
-
-import groovy.lang.Closure;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-public class ClosureEntityFactory<T extends Entity> extends AbstractConfigurableEntityFactory<T> {
-    private final Closure<T> closure;
-
-    public ClosureEntityFactory(Closure<T> closure){
-        this(new HashMap(),closure);
-    }
-
-    public ClosureEntityFactory(Map flags, Closure<T> closure) {
-        super(flags);
-        this.closure = closure;
-    }
-
-    public T newEntity2(Map flags, Entity parent) {
-        if (closure.getMaximumNumberOfParameters()>1)
-            return closure.call(flags, parent);
-        else {
-            //leaving out the parent is discouraged
-            T entity = closure.call(flags);
-            if(parent!=null && entity.getParent()==null){
-                entity.setParent(parent);
-            }
-
-            return entity;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactory.java
deleted file mode 100644
index af5fba3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactory.java
+++ /dev/null
@@ -1,33 +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.core.entity.factory;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-
-public interface ConfigurableEntityFactory<T extends Entity> extends EntityFactory<T> {
-   ConfigurableEntityFactory<T> configure(Map flags);
-   ConfigurableEntityFactory<T> configure(ConfigKey key, Object value);
-   ConfigurableEntityFactory<T> configure(ConfigKey.HasConfigKey key, Object value);
-   
-   ConfigurableEntityFactory<T> setConfig(ConfigKey key, Object value);
-   ConfigurableEntityFactory<T> setConfig(ConfigKey.HasConfigKey key, Object value);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactoryFromEntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactoryFromEntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactoryFromEntityFactory.java
deleted file mode 100644
index 1fc36c3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/ConfigurableEntityFactoryFromEntityFactory.java
+++ /dev/null
@@ -1,45 +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.core.entity.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-public class ConfigurableEntityFactoryFromEntityFactory<T extends Entity> extends AbstractConfigurableEntityFactory<T> {
-
-   private final EntityFactory<? extends T> factory;
-
-    public ConfigurableEntityFactoryFromEntityFactory(EntityFactory<? extends T> entityFactory){
-        this(new HashMap(),entityFactory);
-    }
-
-    public ConfigurableEntityFactoryFromEntityFactory(Map flags, EntityFactory<? extends T> factory) {
-        super(flags);
-        this.factory = checkNotNull(factory, "factory");
-    }
-
-    @Override
-    public T newEntity2(Map flags, Entity parent) {
-        return factory.newEntity(flags, parent);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactory.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactory.java
deleted file mode 100644
index 2f4ede7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactory.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 org.apache.brooklyn.core.entity.factory;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * A Factory for creating entities.
- *
- * @deprecated since 0.7.0; use EntitySpec instead, as the factory does not put the entity through the initialization process */
-@Deprecated
-public interface EntityFactory<T extends Entity> {
-    T newEntity(Map flags, Entity parent);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactoryForLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactoryForLocation.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactoryForLocation.java
deleted file mode 100644
index 79f72d7..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/factory/EntityFactoryForLocation.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.core.entity.factory;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-
-/**
- * dispatch interface to allow an EntityFactory to indicate it might be able to discover
- * other factories for specific locations (e.g. if the location implements a custom entity-aware interface)
- */
-public interface EntityFactoryForLocation<T extends Entity> {
-    ConfigurableEntityFactory<T> newFactoryForLocation(Location l);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/ConfigMapViewWithStringKeys.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/ConfigMapViewWithStringKeys.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/ConfigMapViewWithStringKeys.java
deleted file mode 100644
index 7d91af4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/ConfigMapViewWithStringKeys.java
+++ /dev/null
@@ -1,130 +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.core.entity.internal;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Sets;
-
-/**
- * Internal class that presents a view over a ConfigMap, so it looks like a Map (with the
- * keys being the config key names).
- */
-@Beta
-public class ConfigMapViewWithStringKeys implements Map<String,Object> {
-
-    private org.apache.brooklyn.config.ConfigMap target;
-
-    public ConfigMapViewWithStringKeys(org.apache.brooklyn.config.ConfigMap target) {
-        this.target = target;
-    }
-    
-    @Override
-    public int size() {
-        return target.getAllConfig().size();
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return target.getAllConfig().isEmpty();
-    }
-
-    @Override
-    public boolean containsKey(Object key) {
-        return keySet().contains(key);
-    }
-
-    @Override
-    public boolean containsValue(Object value) {
-        return values().contains(value);
-    }
-
-    @Override
-    public Object get(Object key) {
-        return target.getConfig(new BasicConfigKey<Object>(Object.class, (String)key));
-    }
-
-    @Override
-    public Object put(String key, Object value) {
-        throw new UnsupportedOperationException("This view is read-only");
-    }
-
-    @Override
-    public Object remove(Object key) {
-        throw new UnsupportedOperationException("This view is read-only");
-    }
-
-    @Override
-    public void putAll(Map<? extends String, ? extends Object> m) {
-        throw new UnsupportedOperationException("This view is read-only");
-    }
-
-    @Override
-    public void clear() {
-        throw new UnsupportedOperationException("This view is read-only");
-    }
-
-    @Override
-    public Set<String> keySet() {
-        LinkedHashSet<String> result = Sets.newLinkedHashSet();
-        Set<Map.Entry<ConfigKey<?>, Object>> set = target.getAllConfig().entrySet();
-        for (final Map.Entry<ConfigKey<?>, Object> entry: set) {
-            result.add(entry.getKey().getName());
-        }
-        return result;
-    }
-
-    @Override
-    public Collection<Object> values() {
-        return target.getAllConfig().values();
-    }
-
-    @Override
-    public Set<Map.Entry<String, Object>> entrySet() {
-        LinkedHashSet<Map.Entry<String, Object>> result = Sets.newLinkedHashSet();
-        Set<Map.Entry<ConfigKey<?>, Object>> set = target.getAllConfig().entrySet();
-        for (final Map.Entry<ConfigKey<?>, Object> entry: set) {
-            result.add(new Map.Entry<String, Object>() {
-                @Override
-                public String getKey() {
-                    return entry.getKey().getName();
-                }
-
-                @Override
-                public Object getValue() {
-                    return entry.getValue();
-                }
-
-                @Override
-                public Object setValue(Object value) {
-                    return entry.setValue(value);
-                }
-            });
-        }
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityConfigMap.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityConfigMap.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityConfigMap.java
deleted file mode 100644
index da209e1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityConfigMap.java
+++ /dev/null
@@ -1,319 +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.core.entity.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.brooklyn.util.groovy.GroovyJavaMethods.elvis;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.Sanitizer;
-import org.apache.brooklyn.core.config.StructuredConfigKey;
-import org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.internal.ConfigKeySelfExtracting;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public class EntityConfigMap extends AbstractConfigMapImpl {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EntityConfigMap.class);
-
-    /** entity against which config resolution / task execution will occur */
-    private final AbstractEntity entity;
-
-    /**
-     * Map of configuration information that is defined at start-up time for the entity. These
-     * configuration parameters are shared and made accessible to the "children" of this
-     * entity.
-     */
-    private final Map<ConfigKey<?>,Object> inheritedConfig = Collections.synchronizedMap(new LinkedHashMap<ConfigKey<?>, Object>());
-    // TODO do we really want to have *both* bags and maps for these?  danger that they get out of synch.
-    // have added some logic (Oct 2014) so that the same changes are applied to both, in most places at least;
-    // i (alex) think we should prefer ConfigBag (the input keys don't matter, it is more a question of retrieval keys),
-    // but first we need ConfigBag to support StructuredConfigKeys 
-    private final ConfigBag localConfigBag;
-    private final ConfigBag inheritedConfigBag;
-
-    public EntityConfigMap(AbstractEntity entity) {
-        // Not using ConcurrentMap, because want to (continue to) allow null values.
-        // Could use ConcurrentMapAcceptingNullVals (with the associated performance hit on entrySet() etc).
-        this(entity, Collections.synchronizedMap(Maps.<ConfigKey<?>, Object>newLinkedHashMap()));
-    }
-    
-    public EntityConfigMap(AbstractEntity entity, Map<ConfigKey<?>, Object> storage) {
-        this.entity = checkNotNull(entity, "entity must be specified");
-        this.ownConfig = checkNotNull(storage, "storage map must be specified");
-        
-        // TODO store ownUnused in backing-storage
-        this.localConfigBag = ConfigBag.newInstance();
-        this.inheritedConfigBag = ConfigBag.newInstance();
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T> T getConfig(ConfigKey<T> key, T defaultValue) {
-        // FIXME What about inherited task in config?!
-        //              alex says: think that should work, no?
-        // FIXME What if someone calls getConfig on a task, before setting parent app?
-        //              alex says: not supported (throw exception, or return the task)
-        
-        // In case this entity class has overridden the given key (e.g. to set default), then retrieve this entity's key
-        // TODO If ask for a config value that's not in our configKeys, should we really continue with rest of method and return key.getDefaultValue?
-        //      e.g. SshBasedJavaAppSetup calls setAttribute(JMX_USER), which calls getConfig(JMX_USER)
-        //           but that example doesn't have a default...
-        ConfigKey<T> ownKey = entity!=null ? (ConfigKey<T>)elvis(entity.getEntityType().getConfigKey(key.getName()), key) : key;
-        
-        ConfigInheritance inheritance = key.getInheritance();
-        if (inheritance==null) inheritance = ownKey.getInheritance(); 
-        if (inheritance==null) {
-            // TODO we could warn by introducing a temporary "ALWAYS_BUT_WARNING" instance
-            inheritance = getDefaultInheritance(); 
-        }
-        
-        // TODO We're notifying of config-changed because currently persistence needs to know when the
-        // attributeWhenReady is complete (so it can persist the result).
-        // Long term, we'll just persist tasks properly so the call to onConfigChanged will go!
-
-        // Don't use groovy truth: if the set value is e.g. 0, then would ignore set value and return default!
-        if (ownKey instanceof ConfigKeySelfExtracting) {
-            Object rawval = ownConfig.get(key);
-            T result = null;
-            boolean complete = false;
-            if (((ConfigKeySelfExtracting<T>)ownKey).isSet(ownConfig)) {
-                ExecutionContext exec = entity.getExecutionContext();
-                result = ((ConfigKeySelfExtracting<T>)ownKey).extractValue(ownConfig, exec);
-                complete = true;
-            } else if (isInherited(ownKey, inheritance) && 
-                    ((ConfigKeySelfExtracting<T>)ownKey).isSet(inheritedConfig)) {
-                ExecutionContext exec = entity.getExecutionContext();
-                result = ((ConfigKeySelfExtracting<T>)ownKey).extractValue(inheritedConfig, exec);
-                complete = true;
-            } else if (localConfigBag.containsKey(ownKey)) {
-                // TODO configBag.get doesn't handle tasks/attributeWhenReady - it only uses TypeCoercions
-                result = localConfigBag.get(ownKey);
-                complete = true;
-            } else if (isInherited(ownKey, inheritance) && 
-                    inheritedConfigBag.containsKey(ownKey)) {
-                result = inheritedConfigBag.get(ownKey);
-                complete = true;
-            }
-
-            if (rawval instanceof Task) {
-                entity.getManagementSupport().getEntityChangeListener().onConfigChanged(key);
-            }
-            if (complete) {
-                return result;
-            }
-        } else {
-            LOG.warn("Config key {} of {} is not a ConfigKeySelfExtracting; cannot retrieve value; returning default", ownKey, this);
-        }
-        return TypeCoercions.coerce((defaultValue != null) ? defaultValue : ownKey.getDefaultValue(), key.getTypeToken());
-    }
-
-    private <T> boolean isInherited(ConfigKey<T> key) {
-        return isInherited(key, key.getInheritance());
-    }
-    private <T> boolean isInherited(ConfigKey<T> key, ConfigInheritance inheritance) {
-        if (inheritance==null) inheritance = getDefaultInheritance(); 
-        return inheritance.isInherited(key, entity.getParent(), entity);
-    }
-    private ConfigInheritance getDefaultInheritance() {
-        return ConfigInheritance.ALWAYS; 
-    }
-
-    @Override
-    public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited) {
-        if (ownConfig.containsKey(key)) return Maybe.of(ownConfig.get(key));
-        if (includeInherited && inheritedConfig.containsKey(key)) return Maybe.of(inheritedConfig.get(key));
-        return Maybe.absent();
-    }
-    
-    /** an immutable copy of the config visible at this entity, local and inherited (preferring local) */
-    public Map<ConfigKey<?>,Object> getAllConfig() {
-        Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(inheritedConfig.size()+ownConfig.size());
-        result.putAll(inheritedConfig);
-        result.putAll(ownConfig);
-        return Collections.unmodifiableMap(result);
-    }
-
-    /** an immutable copy of the config defined at this entity, ie not inherited */
-    public Map<ConfigKey<?>,Object> getLocalConfig() {
-        Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(ownConfig.size());
-        result.putAll(ownConfig);
-        return Collections.unmodifiableMap(result);
-    }
-    
-    /** Creates an immutable copy of the config visible at this entity, local and inherited (preferring local), including those that did not match config keys */
-    public ConfigBag getAllConfigBag() {
-        return ConfigBag.newInstanceCopying(localConfigBag)
-                .putAll(ownConfig)
-                .putIfAbsent(inheritedConfig)
-                .putIfAbsent(inheritedConfigBag)
-                .seal();
-    }
-
-    /** Creates an immutable copy of the config defined at this entity, ie not inherited, including those that did not match config keys */
-    public ConfigBag getLocalConfigBag() {
-        return ConfigBag.newInstanceCopying(localConfigBag)
-                .putAll(ownConfig)
-                .seal();
-    }
-
-    @SuppressWarnings("unchecked")
-    public Object setConfig(ConfigKey<?> key, Object v) {
-        Object val = coerceConfigVal(key, v);
-        Object oldVal;
-        if (key instanceof StructuredConfigKey) {
-            oldVal = ((StructuredConfigKey)key).applyValueToMap(val, ownConfig);
-            // TODO ConfigBag does not handle structured config keys; quick fix is to remove (and should also remove any subkeys;
-            // as it stands if someone set string a.b.c in the config bag then removed structured key a.b, then got a.b.c they'd get a vale);
-            // long term fix is to support structured config keys in ConfigBag, at which point i think we could remove ownConfig altogether
-            localConfigBag.remove(key);
-        } else {
-            oldVal = ownConfig.put(key, val);
-            localConfigBag.put((ConfigKey<Object>)key, v);
-        }
-        entity.config().refreshInheritedConfigOfChildren();
-        return oldVal;
-    }
-    
-    public void setLocalConfig(Map<ConfigKey<?>, ?> vals) {
-        ownConfig.clear();
-        localConfigBag.clear();
-        ownConfig.putAll(vals);
-        localConfigBag.putAll(vals);
-    }
-    
-    public void setInheritedConfig(Map<ConfigKey<?>, ?> valsO, ConfigBag configBagVals) {
-        Map<ConfigKey<?>, ?> vals = filterUninheritable(valsO);
-        
-        inheritedConfig.clear();
-        inheritedConfig.putAll(vals);
-
-        // The configBagVals contains all inherited, including strings that did not match a config key on the parent.
-        // They might match a config-key on this entity though, so need to check that:
-        //   - if it matches one of our keys, set it in inheritedConfig
-        //   - otherwise add it to our inheritedConfigBag
-        Set<String> valKeyNames = Sets.newLinkedHashSet();
-        for (ConfigKey<?> key : vals.keySet()) {
-            valKeyNames.add(key.getName());
-        }
-        Map<String,Object> valsUnmatched = MutableMap.<String,Object>builder()
-                .putAll(configBagVals.getAllConfig())
-                .removeAll(valKeyNames)
-                .build();
-        inheritedConfigBag.clear();
-        Map<ConfigKey<?>, SetFromFlag> annotatedConfigKeys = FlagUtils.getAnnotatedConfigKeys(entity.getClass());
-        Map<String, ConfigKey<?>> renamedConfigKeys = Maps.newLinkedHashMap();
-        for (Map.Entry<ConfigKey<?>, SetFromFlag> entry: annotatedConfigKeys.entrySet()) {
-            String rename = entry.getValue().value();
-            if (rename != null) {
-                renamedConfigKeys.put(rename, entry.getKey());
-            }
-        }
-        for (Map.Entry<String,Object> entry : valsUnmatched.entrySet()) {
-            String name = entry.getKey();
-            Object value = entry.getValue();
-            ConfigKey<?> key = renamedConfigKeys.get(name);
-            if (key == null) key = entity.getEntityType().getConfigKey(name);
-            if (key != null) {
-                if (!isInherited(key)) {
-                    // no-op
-                } else if (inheritedConfig.containsKey(key)) {
-                    LOG.warn("Entity "+entity+" inherited duplicate config for key "+key+", via explicit config and string name "+name+"; using value of key");
-                } else {
-                    inheritedConfig.put(key, value);
-                }
-            } else {
-                // a config bag has discarded the keys, so we must assume default inheritance for things given that way
-                // unless we can infer a key; not a big deal, as we should have the key in inheritedConfig for everything
-                // which originated with a key ... but still, it would be nice to clean up the use of config bag!
-                inheritedConfigBag.putStringKey(name, value);
-            }
-        }
-    }
-    
-    private Map<ConfigKey<?>, ?> filterUninheritable(Map<ConfigKey<?>, ?> vals) {
-        Map<ConfigKey<?>, Object> result = Maps.newLinkedHashMap();
-        for (Map.Entry<ConfigKey<?>, ?> entry : vals.entrySet()) {
-            if (isInherited(entry.getKey())) {
-                result.put(entry.getKey(), entry.getValue());
-            }
-        }
-        return result;
-    }
-    
-    public void addToLocalBag(Map<String,?> vals) {
-        localConfigBag.putAll(vals);
-        // quick fix for problem that ownConfig can get out of synch
-        ownConfig.putAll(localConfigBag.getAllConfigAsConfigKeyMap());
-    }
-
-    public void removeFromLocalBag(String key) {
-        localConfigBag.remove(key);
-        ownConfig.remove(key);
-    }
-
-    public void clearInheritedConfig() {
-        inheritedConfig.clear();
-        inheritedConfigBag.clear();
-    }
-
-    @Override
-    public EntityConfigMap submap(Predicate<ConfigKey<?>> filter) {
-        EntityConfigMap m = new EntityConfigMap(entity, Maps.<ConfigKey<?>, Object>newLinkedHashMap());
-        for (Map.Entry<ConfigKey<?>,Object> entry: inheritedConfig.entrySet())
-            if (filter.apply(entry.getKey()))
-                m.inheritedConfig.put(entry.getKey(), entry.getValue());
-        synchronized (ownConfig) {
-            for (Map.Entry<ConfigKey<?>,Object> entry: ownConfig.entrySet())
-                if (filter.apply(entry.getKey()))
-                    m.ownConfig.put(entry.getKey(), entry.getValue());
-        }
-        return m;
-    }
-
-    @Override
-    public String toString() {
-        Map<ConfigKey<?>, Object> sanitizeConfig;
-        synchronized (ownConfig) {
-            sanitizeConfig = Sanitizer.sanitize(ownConfig);
-        }
-        return super.toString()+"[own="+sanitizeConfig+"; inherited="+Sanitizer.sanitize(inheritedConfig)+"]";
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityTransientCopyInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityTransientCopyInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityTransientCopyInternal.java
deleted file mode 100644
index 09a8fdf..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/internal/EntityTransientCopyInternal.java
+++ /dev/null
@@ -1,121 +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.core.entity.internal;
-
-import java.util.Collection;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityType;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento;
-import org.apache.brooklyn.api.objs.BrooklynObject.TagSupport;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityInternal.FeedSupport;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagementSupport;
-import org.apache.brooklyn.core.objs.proxy.EntityProxyImpl;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * Selected methods from {@link EntityInternal} and parents which are permitted
- * for entities being loaded in read-only mode, enforced by {@link EntityProxyImpl}.
- * <p>
- * Some of these methods do expose write capabilities, but such modifications are likely
- * to be temporary, discarded on next rebind. Callers must take care with any such invocations.
- * (The primary intent of this interface is to catch and prevent *most* such invocations!)
- */
-@Beta
-public interface EntityTransientCopyInternal {
-
-    // TODO For feeds() and config(), need to ensure mutator methods on returned object are not invoked.
-    
-    // from Entity
-    
-    String getId();
-    long getCreationTime();
-    String getDisplayName();
-    @Nullable String getIconUrl();
-    EntityType getEntityType();
-    Application getApplication();
-    String getApplicationId();
-    Entity getParent();
-    Collection<Entity> getChildren();
-    Collection<Policy> getPolicies();
-    Collection<Enricher> getEnrichers();
-    Collection<Group> getGroups();
-    Collection<Location> getLocations();
-    <T> T getAttribute(AttributeSensor<T> sensor);
-    <T> T getConfig(ConfigKey<T> key);
-    <T> T getConfig(HasConfigKey<T> key);
-    Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited);
-    Maybe<Object> getConfigRaw(HasConfigKey<?> key, boolean includeInherited);
-    TagSupport tags();
-    String getCatalogItemId();
-
-    
-    // from entity local
-    
-    @Deprecated <T> T getConfig(ConfigKey<T> key, T defaultValue);
-    @Deprecated <T> T getConfig(HasConfigKey<T> key, T defaultValue);
-
-    
-    // from EntityInternal:
-    
-    @Deprecated EntityConfigMap getConfigMap();
-    @Deprecated Map<ConfigKey<?>,Object> getAllConfig();
-    // for rebind mainly:
-    @Deprecated ConfigBag getAllConfigBag();
-    @Deprecated ConfigBag getLocalConfigBag();
-    @SuppressWarnings("rawtypes")
-    Map<AttributeSensor, Object> getAllAttributes();
-    EntityManagementSupport getManagementSupport();
-    ManagementContext getManagementContext();
-    Effector<?> getEffector(String effectorName);
-    @Deprecated FeedSupport getFeedSupport();
-    FeedSupport feeds();
-    RebindSupport<EntityMemento> getRebindSupport();
-    // for REST calls on read-only entities which want to resolve values
-    ExecutionContext getExecutionContext();
-    void setCatalogItemId(String id);
-    
-    /** more methods, but which are only on selected entities */
-    public interface SpecialEntityTransientCopyInternal {
-        // from Group
-        Collection<Entity> getMembers();
-        boolean hasMember(Entity member);
-        Integer getCurrentSize();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/Lifecycle.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/Lifecycle.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/Lifecycle.java
deleted file mode 100644
index 68b316e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/Lifecycle.java
+++ /dev/null
@@ -1,187 +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.core.entity.lifecycle;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.text.StringFunctions;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-
-/**
- * An enumeration representing the status of an {@link org.apache.brooklyn.api.entity.Entity}.
- */
-public enum Lifecycle {
-    /**
-     * The entity has just been created.
-     *
-     * This stage encompasses the contruction. Once this stage is
-     * complete, the basic set of sensors will be available, apart from any that require the entity to be active or
-     * deployed to a {@link Location}.
-     */
-    CREATED,
-
-    /**
-     * The entity is starting.
-     * <p>
-     * This stage is typically entered when the {@link Startable#START} effector 
-     * is called, to undertake the startup operations from the management plane.
-     * When this completes the entity will normally transition to 
-     * {@link Lifecycle#RUNNING}. 
-     */
-    STARTING,
-
-    /**
-     * The entity service is expected to be running. In healthy operation, {@link Attributes#SERVICE_UP} will be true,
-     * or will shortly be true if all service start actions have been completed and we are merely waiting for it to be running. 
-     */
-    RUNNING,
-
-    /**
-     * The entity is stopping.
-     *
-     * This stage is activated when the 
-     * {@link Startable#STOP} effector is called. The entity service is stopped. 
-     * Sensors that provide data from the running entity may be cleared and subscriptions cancelled.
-     */
-    STOPPING,
-
-    /**
-     * The entity is not expected to be active.
-     *
-     * This stage is entered when an entity is stopped, or may be entered when an entity is 
-     * fully created but not started. It may or may not be removed from the location(s) it was assigned,
-     * and it will typically not be providing new sensor data apart.
-     */
-    STOPPED,
-
-    /**
-     * The entity is destroyed.
-     *
-     * The entity will be unmanaged and removed from any groups and from its parent.
-     */
-    DESTROYED,
-
-    /**
-     * Entity error state.
-     *
-     * This stage is reachable from any other stage if an error occurs or an exception is thrown.
-     */
-    ON_FIRE;
-
-    /**
-     * The text representation of the {@link #name()}.
-     *
-     * This is formatted as lower case characters, with hyphens instead of spaces.
-     */
-    public String value() {
-       return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
-    }
-
-    /** @see #value() */
-    @Override
-    public String toString() { return value(); }
-
-    /**
-     * Creates a {@link Lifecycle} from a text representation.
-     *
-     * This accepts the text representations output by the {@link #value()} method for each entry.
-     *
-     * @see #value()
-     */
-    public static Lifecycle fromValue(String v) {
-       try {
-          return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
-       } catch (IllegalArgumentException iae) {
-          return ON_FIRE;
-       }
-    }
-    
-    public static class Transition implements Serializable {
-        private static final long serialVersionUID = 603419184398753502L;
-        
-        final Lifecycle state;
-        final long timestampUtc;
-        
-        public Transition(Lifecycle state, Date timestamp) {
-            this.state = Preconditions.checkNotNull(state, "state");
-            this.timestampUtc = Preconditions.checkNotNull(timestamp, "timestamp").getTime();
-        }
-        
-        public Lifecycle getState() {
-            return state;
-        }
-        public Date getTimestamp() {
-            return new Date(timestampUtc);
-        }
-        
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(state, timestampUtc);
-        }
-        
-        @Override
-        public boolean equals(Object obj) {
-            if (!(obj instanceof Transition)) return false;
-            if (!state.equals(((Transition)obj).getState())) return false;
-            if (timestampUtc != ((Transition)obj).timestampUtc) return false;
-            return true;
-        }
-        
-        @Override
-        public String toString() {
-            return state+" @ "+timestampUtc+" / "+new Date(timestampUtc);
-        }
-    }
-    
-    protected static class TransitionCoalesceFunction implements Function<String, Transition> {
-        private static final Pattern TRANSITION_PATTERN = Pattern.compile("^([\\w-]+)\\s+@\\s+(\\d+).*");
-
-        @Override
-        public Transition apply(final String input) {
-            if (input != null) {
-                Matcher m = TRANSITION_PATTERN.matcher(input);
-                if (m.matches()) {
-                    Lifecycle state = Lifecycle.valueOf(m.group(1).toUpperCase().replace('-', '_'));
-                    long time = Long.parseLong(m.group(2));
-                    return new Transition(state, new Date(time));
-                } else {
-                    throw new IllegalStateException("Serialized Lifecycle.Transition can't be parsed: " + input);
-                }
-            } else {
-                return null;
-            }
-        }
-    }
-
-    static {
-        TypeCoercions.registerAdapter(String.class, Transition.class, new TransitionCoalesceFunction());
-        RendererHints.register(Transition.class, RendererHints.displayValue(StringFunctions.toStringFunction()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/PolicyDescriptor.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/PolicyDescriptor.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/PolicyDescriptor.java
deleted file mode 100644
index ee063cb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/PolicyDescriptor.java
+++ /dev/null
@@ -1,68 +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.core.entity.lifecycle;
-
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-
-import com.google.common.base.Objects;
-
-/** Emitted as part of {@link AbstractEntity#POLICY_ADDED} and {@link AbstractEntity#POLICY_REMOVED} */
-public class PolicyDescriptor {
-
-    private final String id;
-    private final String type;
-    private final String name;
-
-    public PolicyDescriptor(Policy policy) {
-        this.id = policy.getId();
-        this.type = policy.getPolicyType().getName();
-        this.name = policy.getDisplayName();
-    }
-    public String getId() {
-        return id;
-    }
-    
-    public String getPolicyType() {
-        return type;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof PolicyDescriptor)) {
-            return false;
-        }
-        PolicyDescriptor o = (PolicyDescriptor) other;
-        return Objects.equal(id, o.id) && Objects.equal(type, o.type) && Objects.equal(name, o.name);
-    }
-    
-    @Override
-    public int hashCode() {
-        return id.hashCode();
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("id", id).add("type", type).add("name",  name).omitNullValues().toString();
-    }
-}


[23/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDto.java
deleted file mode 100644
index 6f2aba8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLibrariesDto.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 org.apache.brooklyn.core.catalog.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-
-import com.google.common.collect.ImmutableList;
-
-@Deprecated
-public class CatalogLibrariesDto implements CatalogItem.CatalogItemLibraries {
-
-    private final Collection<String> bundles;
-
-    public CatalogLibrariesDto() {
-        this.bundles = Collections.emptyList();
-    }
-
-    public CatalogLibrariesDto(Collection<String> bundles) {
-        this.bundles = bundles;
-    }
-
-    /**
-     * @return An immutable copy of the bundle URLs referenced by this object
-     */
-    @Override
-    public Collection<String> getBundles() {
-        if (bundles == null) {
-            // can be null on deserialization
-            return Collections.emptyList();
-        }
-        return ImmutableList.copyOf(bundles);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLocationItemDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLocationItemDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLocationItemDto.java
deleted file mode 100644
index c8206ce..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogLocationItemDto.java
+++ /dev/null
@@ -1,43 +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.core.catalog.internal;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-
-
-public class CatalogLocationItemDto extends CatalogItemDtoAbstract<Location,LocationSpec<?>> {
-    
-    @Override
-    public CatalogItemType getCatalogItemType() {
-        return CatalogItemType.LOCATION;
-    }
-
-    @Override
-    public Class<Location> getCatalogItemJavaType() {
-        return Location.class;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public Class<LocationSpec<?>> getSpecType() {
-        return (Class)LocationSpec.class;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogPolicyItemDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogPolicyItemDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogPolicyItemDto.java
deleted file mode 100644
index 1c7e6fe..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogPolicyItemDto.java
+++ /dev/null
@@ -1,43 +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.core.catalog.internal;
-
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-
-
-public class CatalogPolicyItemDto extends CatalogItemDtoAbstract<Policy,PolicySpec<?>> {
-    
-    @Override
-    public CatalogItemType getCatalogItemType() {
-        return CatalogItemType.POLICY;
-    }
-
-    @Override
-    public Class<Policy> getCatalogItemJavaType() {
-        return Policy.class;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public Class<PolicySpec<?>> getSpecType() {
-        return (Class)PolicySpec.class;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogTemplateItemDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogTemplateItemDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogTemplateItemDto.java
deleted file mode 100644
index 688b814..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogTemplateItemDto.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 org.apache.brooklyn.core.catalog.internal;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.EntitySpec;
-
-public class CatalogTemplateItemDto extends CatalogItemDtoAbstract<Application,EntitySpec<? extends Application>> {
-
-    @Override
-    public CatalogItemType getCatalogItemType() {
-        return CatalogItemType.TEMPLATE;
-    }
-
-    @Override
-    public Class<Application> getCatalogItemJavaType() {
-        return Application.class;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Override
-    public Class<EntitySpec<? extends Application>> getSpecType() {
-        return (Class)EntitySpec.class;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
deleted file mode 100644
index dce5493..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
+++ /dev/null
@@ -1,321 +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.core.catalog.internal;
-
-import java.util.Collection;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.core.BrooklynLogging;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog.BrooklynLoaderTracker;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContextSequential;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.mgmt.classloading.OsgiBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.RebindTracker;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Time;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Stopwatch;
-
-public class CatalogUtils {
-    private static final Logger log = LoggerFactory.getLogger(CatalogUtils.class);
-
-    public static final char VERSION_DELIMITER = ':';
-
-    public static BrooklynClassLoadingContext newClassLoadingContext(ManagementContext mgmt, CatalogItem<?, ?> item) {
-        // TODO getLibraries() should never be null but sometimes it is still
-        // e.g. run CatalogResourceTest without the above check
-        if (item.getLibraries() == null) {
-            log.debug("CatalogItemDtoAbstract.getLibraries() is null.", new Exception("Trace for null CatalogItemDtoAbstract.getLibraries()"));
-        }
-        return newClassLoadingContext(mgmt, item.getId(), item.getLibraries());
-    }
-    
-    public static BrooklynClassLoadingContext newClassLoadingContext(ManagementContext mgmt, RegisteredType item) {
-        return newClassLoadingContext(mgmt, item.getId(), item.getLibraries(), null);
-    }
-    
-    /** made @Beta in 0.9.0 because we're not sure to what extent to support stacking loaders; 
-     * only a couple places currently rely on such stacking, in general the item and the bundles *are* the context,
-     * and life gets hard if we support complex stacking! */
-    @Beta 
-    public static BrooklynClassLoadingContext newClassLoadingContext(ManagementContext mgmt, RegisteredType item, BrooklynClassLoadingContext loader) {
-        return newClassLoadingContext(mgmt, item.getId(), item.getLibraries(), loader);
-    }
-    
-    public static BrooklynClassLoadingContext getClassLoadingContext(Entity entity) {
-        ManagementContext mgmt = ((EntityInternal)entity).getManagementContext();
-        String catId = entity.getCatalogItemId();
-        if (Strings.isBlank(catId)) return JavaBrooklynClassLoadingContext.create(mgmt);
-        Maybe<RegisteredType> cat = RegisteredTypes.tryValidate(mgmt.getTypeRegistry().get(catId), RegisteredTypeLoadingContexts.spec(Entity.class));
-        if (cat.isNull()) {
-            log.warn("Cannot load "+catId+" to get classloader for "+entity+"; will try with standard loader, but might fail subsequently");
-            return JavaBrooklynClassLoadingContext.create(mgmt);
-        }
-        return newClassLoadingContext(mgmt, cat.get());
-    }
-
-    public static BrooklynClassLoadingContext newClassLoadingContext(@Nullable ManagementContext mgmt, String catalogItemId, Collection<? extends OsgiBundleWithUrl> libraries) {
-        return newClassLoadingContext(mgmt, catalogItemId, libraries, null);
-    }
-    
-    @Deprecated /** @deprecated since 0.9.0; becoming private because we should now always have a registered type callers can pass instead of the catalog item id */
-    public static BrooklynClassLoadingContext newClassLoadingContext(@Nullable ManagementContext mgmt, String catalogItemId, Collection<? extends OsgiBundleWithUrl> libraries, BrooklynClassLoadingContext loader) {
-        BrooklynClassLoadingContextSequential result = new BrooklynClassLoadingContextSequential(mgmt);
-
-        if (libraries!=null && !libraries.isEmpty()) {
-            result.add(new OsgiBrooklynClassLoadingContext(mgmt, catalogItemId, libraries));
-        }
-
-        if (loader !=null) {
-            // TODO determine whether to support stacking
-            result.add(loader);
-        }
-        BrooklynClassLoadingContext threadLocalLoader = BrooklynLoaderTracker.getLoader();
-        if (threadLocalLoader != null) {
-            // TODO and determine if this is needed/wanted
-            result.add(threadLocalLoader);
-        }
-
-        result.addSecondary(JavaBrooklynClassLoadingContext.create(mgmt));
-        return result;
-    }
-
-    /**
-     * @deprecated since 0.7.0 only for legacy catalog items which provide a non-osgi loader; see {@link #newDefault(ManagementContext)}
-     */ @Deprecated
-    public static BrooklynClassLoadingContext newClassLoadingContext(@Nullable ManagementContext mgmt, String catalogItemId, Collection<CatalogBundle> libraries, ClassLoader customClassLoader) {
-        BrooklynClassLoadingContextSequential result = new BrooklynClassLoadingContextSequential(mgmt);
-
-        if (libraries!=null && !libraries.isEmpty()) {
-            result.add(new OsgiBrooklynClassLoadingContext(mgmt, catalogItemId, libraries));
-        }
-
-        BrooklynClassLoadingContext loader = BrooklynLoaderTracker.getLoader();
-        if (loader != null) {
-            result.add(loader);
-        }
-
-        result.addSecondary(JavaBrooklynClassLoadingContext.create(mgmt, customClassLoader));
-        return result;
-    }
-
-    /**
-     * Registers all bundles with the management context's OSGi framework.
-     */
-    public static void installLibraries(ManagementContext managementContext, @Nullable Collection<CatalogBundle> libraries) {
-        if (libraries == null) return;
-
-        ManagementContextInternal mgmt = (ManagementContextInternal) managementContext;
-        if (!libraries.isEmpty()) {
-            Maybe<OsgiManager> osgi = mgmt.getOsgiManager();
-            if (osgi.isAbsent()) {
-                throw new IllegalStateException("Unable to load bundles "+libraries+" because OSGi is not running.");
-            }
-            if (log.isDebugEnabled()) 
-                logDebugOrTraceIfRebinding(log, 
-                    "Loading bundles in {}: {}", 
-                    new Object[] {managementContext, Joiner.on(", ").join(libraries)});
-            Stopwatch timer = Stopwatch.createStarted();
-            for (CatalogBundle bundleUrl : libraries) {
-                osgi.get().registerBundle(bundleUrl);
-            }
-            if (log.isDebugEnabled()) 
-                logDebugOrTraceIfRebinding(log, 
-                    "Registered {} bundles in {}",
-                    new Object[]{libraries.size(), Time.makeTimeStringRounded(timer)});
-        }
-    }
-
-    /** Scans the given {@link BrooklynClassLoadingContext} to detect what catalog item id is in effect. */
-    public static String getCatalogItemIdFromLoader(BrooklynClassLoadingContext loader) {
-        if (loader instanceof OsgiBrooklynClassLoadingContext) {
-            return ((OsgiBrooklynClassLoadingContext)loader).getCatalogItemId();
-        } else {
-            return null;
-        }
-    }
-
-    public static void setCatalogItemIdOnAddition(Entity entity, BrooklynObject itemBeingAdded) {
-        if (entity.getCatalogItemId()!=null) {
-            if (itemBeingAdded.getCatalogItemId()==null) {
-                if (log.isDebugEnabled())
-                    BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(entity),
-                        "Catalog item addition: "+entity+" from "+entity.getCatalogItemId()+" applying its catalog item ID to "+itemBeingAdded);
-                ((BrooklynObjectInternal)itemBeingAdded).setCatalogItemId(entity.getCatalogItemId());
-            } else {
-                if (!itemBeingAdded.getCatalogItemId().equals(entity.getCatalogItemId())) {
-                    // not a problem, but something to watch out for
-                    log.debug("Cross-catalog item detected: "+entity+" from "+entity.getCatalogItemId()+" has "+itemBeingAdded+" from "+itemBeingAdded.getCatalogItemId());
-                }
-            }
-        } else if (itemBeingAdded.getCatalogItemId()!=null) {
-            if (log.isDebugEnabled())
-                BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(entity),
-                    "Catalog item addition: "+entity+" without catalog item ID has "+itemBeingAdded+" from "+itemBeingAdded.getCatalogItemId());
-        }
-    }
-
-    @Beta
-    public static void logDebugOrTraceIfRebinding(Logger log, String message, Object ...args) {
-        if (RebindTracker.isRebinding())
-            log.trace(message, args);
-        else
-            log.debug(message, args);
-    }
-
-    public static boolean looksLikeVersionedId(String versionedId) {
-        if (versionedId==null) return false;
-        int fi = versionedId.indexOf(VERSION_DELIMITER);
-        if (fi<0) return false;
-        int li = versionedId.lastIndexOf(VERSION_DELIMITER);
-        if (li!=fi) {
-            // if multiple colons, we say it isn't a versioned reference; the prefix in that case must understand any embedded versioning scheme
-            // this fixes the case of:  http://localhost:8080
-            return false;
-        }
-        String candidateVersion = versionedId.substring(li+1);
-        if (!candidateVersion.matches("[0-9]+(|(\\.|_).*)")) {
-            // version must start with a number, followed if by anything with full stop or underscore before any other characters
-            // e.g.  foo:1  or foo:1.1  or foo:1_SNAPSHOT all supported, but not e.g. foo:bar (or chef:cookbook or docker:my/image)
-            return false;
-        }
-        return true;
-    }
-
-    /** @deprecated since 0.9.0 use {@link #getSymbolicNameFromVersionedId(String)} */
-    // all uses removed
-    @Deprecated
-    public static String getIdFromVersionedId(String versionedId) {
-        return getSymbolicNameFromVersionedId(versionedId);
-    }
-    
-    public static String getSymbolicNameFromVersionedId(String versionedId) {
-        if (versionedId == null) return null;
-        int versionDelimiterPos = versionedId.lastIndexOf(VERSION_DELIMITER);
-        if (versionDelimiterPos != -1) {
-            return versionedId.substring(0, versionDelimiterPos);
-        } else {
-            return null;
-        }
-    }
-
-    public static String getVersionFromVersionedId(String versionedId) {
-        if (versionedId == null) return null;
-        int versionDelimiterPos = versionedId.lastIndexOf(VERSION_DELIMITER);
-        if (versionDelimiterPos != -1) {
-            return versionedId.substring(versionDelimiterPos+1);
-        } else {
-            return null;
-        }
-    }
-
-    public static String getVersionedId(String id, String version) {
-        // TODO null checks
-        return id + VERSION_DELIMITER + version;
-    }
-
-    /** @deprecated since 0.9.0 use {@link BrooklynTypeRegistry#get(String, org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind, Class)} */
-    // only a handful of items remaining, and those require a CatalogItem
-    public static CatalogItem<?, ?> getCatalogItemOptionalVersion(ManagementContext mgmt, String versionedId) {
-        if (versionedId == null) return null;
-        if (looksLikeVersionedId(versionedId)) {
-            String id = getSymbolicNameFromVersionedId(versionedId);
-            String version = getVersionFromVersionedId(versionedId);
-            return mgmt.getCatalog().getCatalogItem(id, version);
-        } else {
-            return mgmt.getCatalog().getCatalogItem(versionedId, BrooklynCatalog.DEFAULT_VERSION);
-        }
-    }
-
-    public static boolean isBestVersion(ManagementContext mgmt, CatalogItem<?,?> item) {
-        RegisteredType best = RegisteredTypes.getBestVersion(mgmt.getTypeRegistry().getMatching(
-            RegisteredTypePredicates.symbolicName(item.getSymbolicName())));
-        if (best==null) return false;
-        return (best.getVersion().equals(item.getVersion()));
-    }
-
-    /** @deprecated since 0.9.0 use {@link BrooklynTypeRegistry#get(String, org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind, Class)} */
-    // only a handful of items remaining, and those require a CatalogItem
-    public static <T,SpecT> CatalogItem<T, SpecT> getCatalogItemOptionalVersion(ManagementContext mgmt, Class<T> type, String versionedId) {
-        if (looksLikeVersionedId(versionedId)) {
-            String id = getSymbolicNameFromVersionedId(versionedId);
-            String version = getVersionFromVersionedId(versionedId);
-            return mgmt.getCatalog().getCatalogItem(type, id, version);
-        } else {
-            return mgmt.getCatalog().getCatalogItem(type, versionedId, BrooklynCatalog.DEFAULT_VERSION);
-        }
-    }
-
-    /** @deprecated since it was introduced in 0.9.0; TBD where this should live */
-    public static void setDeprecated(ManagementContext mgmt, String symbolicNameAndOptionalVersion, boolean newValue) {
-        RegisteredType item = mgmt.getTypeRegistry().get(symbolicNameAndOptionalVersion);
-        Preconditions.checkNotNull(item, "No such item: " + symbolicNameAndOptionalVersion);
-        setDeprecated(mgmt, item.getSymbolicName(), item.getVersion(), newValue);
-    }
-    
-    /** @deprecated since it was introduced in 0.9.0; TBD where this should live */
-    public static void setDisabled(ManagementContext mgmt, String symbolicNameAndOptionalVersion, boolean newValue) {
-        RegisteredType item = mgmt.getTypeRegistry().get(symbolicNameAndOptionalVersion);
-        Preconditions.checkNotNull(item, "No such item: "+symbolicNameAndOptionalVersion);
-        setDisabled(mgmt, item.getSymbolicName(), item.getVersion(), newValue);
-    }
-    
-    /** @deprecated since it was introduced in 0.9.0; TBD where this should live */
-    @Deprecated
-    public static void setDeprecated(ManagementContext mgmt, String symbolicName, String version, boolean newValue) {
-        CatalogItem<?, ?> item = mgmt.getCatalog().getCatalogItem(symbolicName, version);
-        Preconditions.checkNotNull(item, "No such item: "+symbolicName+" v "+version);
-        item.setDeprecated(newValue);
-        mgmt.getCatalog().persist(item);
-    }
-
-    /** @deprecated since it was introduced in 0.9.0; TBD where this should live */
-    @Deprecated
-    public static void setDisabled(ManagementContext mgmt, String symbolicName, String version, boolean newValue) {
-        CatalogItem<?, ?> item = mgmt.getCatalog().getCatalogItem(symbolicName, version);
-        Preconditions.checkNotNull(item, "No such item: "+symbolicName+" v "+version);
-        item.setDisabled(newValue);
-        mgmt.getCatalog().persist(item);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogXmlSerializer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogXmlSerializer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogXmlSerializer.java
deleted file mode 100644
index 3cf686e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogXmlSerializer.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 org.apache.brooklyn.core.catalog.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
-import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider;
-import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
-import org.apache.brooklyn.util.core.xstream.EnumCaseForgivingSingleValueConverter;
-import org.apache.brooklyn.util.core.xstream.XmlSerializer;
-
-public class CatalogXmlSerializer extends XmlSerializer<Object> {
-
-    @SuppressWarnings("deprecation")
-    public CatalogXmlSerializer() {
-        super(DeserializingClassRenamesProvider.loadDeserializingClassRenames());
-        
-        xstream.addDefaultImplementation(ArrayList.class, Collection.class);
-       
-        //Doesn't work well for non-standard lists, like Lists.transform results
-        xstream.aliasType("list", List.class);
-        xstream.aliasType("map", Map.class);
-
-        xstream.useAttributeFor("id", String.class);
-
-        xstream.aliasType("catalog", CatalogDto.class);
-        xstream.useAttributeFor(CatalogDto.class, "url");
-        xstream.addImplicitCollection(CatalogDto.class, "catalogs", CatalogDto.class);
-        xstream.addImplicitCollection(CatalogDto.class, "entries", CatalogTemplateItemDto.class);
-        xstream.addImplicitCollection(CatalogDto.class, "entries", CatalogEntityItemDto.class);
-        xstream.addImplicitCollection(CatalogDto.class, "entries", CatalogPolicyItemDto.class);
-        xstream.addImplicitCollection(CatalogDto.class, "entries", CatalogLocationItemDto.class);
-
-        xstream.aliasType("template", CatalogTemplateItemDto.class);
-        xstream.aliasType("entity", CatalogEntityItemDto.class);
-        xstream.aliasType("policy", CatalogPolicyItemDto.class);
-        xstream.aliasType("location", CatalogPolicyItemDto.class);
-
-        xstream.aliasField("registeredType", CatalogItemDtoAbstract.class, "symbolicName");
-        xstream.aliasAttribute(CatalogItemDtoAbstract.class, "displayName", "name");
-        xstream.useAttributeFor(CatalogItemDtoAbstract.class, "type");
-        xstream.useAttributeFor(CatalogItemDtoAbstract.class, "version");
-        xstream.aliasType("bundle", CatalogBundleDto.class);
-        xstream.registerConverter(new CatalogBundleConverter(xstream.getMapper(), xstream.getReflectionProvider()));
-
-        xstream.useAttributeFor(CatalogClasspathDto.class, "scan");
-        xstream.addImplicitCollection(CatalogClasspathDto.class, "entries", "entry", String.class);
-        xstream.registerConverter(new EnumCaseForgivingSingleValueConverter(CatalogScanningModes.class));
-
-        // Note: the management context is being omitted because it is unnecessary for
-        // representations of catalogues generated with this serializer.
-        xstream.omitField(AbstractBrooklynObject.class, "managementContext");
-        xstream.omitField(AbstractBrooklynObject.class, "_legacyConstruction");
-        xstream.omitField(AbstractBrooklynObject.class, "hasWarnedOfNoManagementContextWhenPersistRequested");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/JavaCatalogToSpecTransformer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/JavaCatalogToSpecTransformer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/JavaCatalogToSpecTransformer.java
deleted file mode 100644
index 4e15d24..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/JavaCatalogToSpecTransformer.java
+++ /dev/null
@@ -1,111 +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.core.catalog.internal;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.core.objs.BasicSpecParameter;
-import org.apache.brooklyn.core.plan.PlanNotRecognizedException;
-import org.apache.brooklyn.core.plan.PlanToSpecTransformer;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Instantiates classes from a registered type which simply
- * defines the java class name and OSGi bundles to use.
- * <p>
- * This is used where a {@link RegisteredType} is defined simply with the name of a java class
- * (no YAML etc); and for legacy old-style (c0.7.0) catalog items (defined in catalog.xml only)
- * with structure, only a single type.
- */
-public class JavaCatalogToSpecTransformer implements PlanToSpecTransformer {
-    private static final Logger log = LoggerFactory.getLogger(JavaCatalogToSpecTransformer.class);
-
-    private ManagementContext mgmt;
-
-    @Override
-    public void setManagementContext(ManagementContext mgmt) {
-        this.mgmt = mgmt;
-    }
-
-    @Override
-    public String getShortDescription() {
-        return "Java type instantiator";
-    }
-
-    @Override
-    public boolean accepts(String planType) {
-        return false;
-    }
-
-    @Override
-    public EntitySpec<? extends Application> createApplicationSpec(String plan) throws PlanNotRecognizedException {
-        throw new PlanNotRecognizedException(getClass().getName() + " doesn't parse application plans.");
-    }
-
-    @Override
-    public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec(
-            CatalogItem<T, SpecT> item, Set<String> encounteredTypes) throws PlanNotRecognizedException {
-        @SuppressWarnings("deprecation")
-        String javaType = item.getJavaType();
-        if (javaType != null) {
-            log.warn("Deprecated functionality (since 0.9.0). Using old-style xml catalog items with java type attribute for " + item);
-            Class<?> type;
-            try {
-                // java types were deprecated before we added osgi support so this isn't necessary,
-                // but it doesn't hurt (and if we re-instate a class+bundle approach for RegisteredType 
-                // we will want to do this)
-                type = CatalogUtils.newClassLoadingContext(mgmt, item).loadClass(javaType);
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                throw new IllegalStateException("Unable to load old-style java catalog item type " + javaType + " for item " + item, e);
-            }
-            AbstractBrooklynObjectSpec<?,?> spec;
-            if (Entity.class.isAssignableFrom(type)) {
-                @SuppressWarnings("unchecked")
-                Class<Entity> entityType = (Class<Entity>)type;
-                spec = EntitySpec.create(entityType)
-                        .parameters(BasicSpecParameter.fromClass(mgmt, entityType));
-            } else if (Policy.class.isAssignableFrom(type)) {
-                @SuppressWarnings("unchecked")
-                Class<Policy> policyType = (Class<Policy>)type;
-                spec = PolicySpec.create(policyType);
-            } else {
-                throw new IllegalStateException("Catalog item " + item + " java type " + javaType + " is not a Brooklyn supported object.");
-            }
-            spec.catalogItemId(item.getCatalogItemId());
-            @SuppressWarnings("unchecked")
-            SpecT untypedSpc = (SpecT) spec;
-            return untypedSpc;
-        } else {
-            throw new PlanNotRecognizedException(getClass().getName() + " parses only old-style catalog items containing javaType");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/BasicConfigKey.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/BasicConfigKey.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/BasicConfigKey.java
deleted file mode 100644
index f158c2c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/BasicConfigKey.java
+++ /dev/null
@@ -1,327 +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.core.config;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.util.core.internal.ConfigKeySelfExtracting;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.TypeTokens;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-import com.google.common.reflect.TypeToken;
-
-public class BasicConfigKey<T> implements ConfigKeySelfExtracting<T>, Serializable {
-    
-    private static final Logger log = LoggerFactory.getLogger(BasicConfigKey.class);
-    private static final long serialVersionUID = -1762014059150215376L;
-    
-    private static final Splitter dots = Splitter.on('.');
-
-    public static <T> Builder<T> builder(TypeToken<T> type) {
-        return new Builder<T>().type(type);
-    }
-
-    public static <T> Builder<T> builder(Class<T> type) {
-        return new Builder<T>().type(type);
-    }
-
-    public static <T> Builder<T> builder(TypeToken<T> type, String name) {
-        return new Builder<T>().type(type).name(name);
-    }
-
-    public static <T> Builder<T> builder(Class<T> type, String name) {
-        return new Builder<T>().type(type).name(name);
-    }
-
-    public static <T> Builder<T> builder(ConfigKey<T> key) {
-        return new Builder<T>()
-            .name(checkNotNull(key.getName(), "name"))
-            .type(checkNotNull(key.getTypeToken(), "type"))
-            .description(key.getDescription())
-            .defaultValue(key.getDefaultValue())
-            .reconfigurable(key.isReconfigurable())
-            .inheritance(key.getInheritance())
-            .constraint(key.getConstraint());
-    }
-
-    public static class Builder<T> {
-        private String name;
-        private TypeToken<T> type;
-        private String description;
-        private T defaultValue;
-        private boolean reconfigurable;
-        private Predicate<? super T> constraint = Predicates.alwaysTrue();
-        private ConfigInheritance inheritance;
-        
-        public Builder<T> name(String val) {
-            this.name = val; return this;
-        }
-        public Builder<T> type(Class<T> val) {
-            this.type = TypeToken.of(val); return this;
-        }
-        public Builder<T> type(TypeToken<T> val) {
-            this.type = val; return this;
-        }
-        public Builder<T> description(String val) {
-            this.description = val; return this;
-        }
-        public Builder<T> defaultValue(T val) {
-            this.defaultValue = val; return this;
-        }
-        public Builder<T> reconfigurable(boolean val) {
-            this.reconfigurable = val; return this;
-        }
-        public Builder<T> inheritance(ConfigInheritance val) {
-            this.inheritance = val; return this;
-        }
-        @Beta
-        public Builder<T> constraint(Predicate<? super T> constraint) {
-            this.constraint = checkNotNull(constraint, "constraint"); return this;
-        }
-        public BasicConfigKey<T> build() {
-            return new BasicConfigKey<T>(this);
-        }
-        
-        public String getName() {
-            return name;
-        }
-        public String getDescription() {
-            return description;
-        }
-    }
-    
-    private String name;
-    private TypeToken<T> typeToken;
-    private Class<? super T> type;
-    private String description;
-    private T defaultValue;
-    private boolean reconfigurable;
-    private ConfigInheritance inheritance;
-    private Predicate<? super T> constraint;
-
-    // FIXME In groovy, fields were `public final` with a default constructor; do we need the gson?
-    public BasicConfigKey() { /* for gson */ }
-
-    public BasicConfigKey(Class<T> type, String name) {
-        this(TypeToken.of(type), name);
-    }
-
-    public BasicConfigKey(Class<T> type, String name, String description) {
-        this(TypeToken.of(type), name, description);
-    }
-
-    public BasicConfigKey(Class<T> type, String name, String description, T defaultValue) {
-        this(TypeToken.of(type), name, description, defaultValue);
-    }
-
-    public BasicConfigKey(TypeToken<T> type, String name) {
-        this(type, name, name, null);
-    }
-    
-    public BasicConfigKey(TypeToken<T> type, String name, String description) {
-        this(type, name, description, null);
-    }
-    
-    public BasicConfigKey(TypeToken<T> type, String name, String description, T defaultValue) {
-        this.description = description;
-        this.name = checkNotNull(name, "name");
-        
-        this.type = TypeTokens.getRawTypeIfRaw(checkNotNull(type, "type"));
-        this.typeToken = TypeTokens.getTypeTokenIfNotRaw(type);
-        
-        this.defaultValue = defaultValue;
-        this.reconfigurable = false;
-        this.constraint = Predicates.alwaysTrue();
-    }
-
-    public BasicConfigKey(Builder<T> builder) {
-        this.name = checkNotNull(builder.name, "name");
-        this.type = TypeTokens.getRawTypeIfRaw(checkNotNull(builder.type, "type"));
-        this.typeToken = TypeTokens.getTypeTokenIfNotRaw(builder.type);
-        this.description = builder.description;
-        this.defaultValue = builder.defaultValue;
-        this.reconfigurable = builder.reconfigurable;
-        this.inheritance = builder.inheritance;
-        // Note: it's intentionally possible to have default values that are not valid
-        // per the configured constraint. If validity were checked here any class that
-        // contained a weirdly-defined config key would fail to initialise.
-        this.constraint = checkNotNull(builder.constraint, "constraint");
-    }
-
-    /** @see ConfigKey#getName() */
-    @Override public String getName() { return name; }
-
-    /** @see ConfigKey#getTypeName() */
-    @Override public String getTypeName() { return getType().getName(); }
-
-    /** @see ConfigKey#getType() */
-    @Override public Class<? super T> getType() { return TypeTokens.getRawType(typeToken, type); }
-
-    /** @see ConfigKey#getTypeToken() */
-    @Override public TypeToken<T> getTypeToken() { return TypeTokens.getTypeToken(typeToken, type); }
-    
-    /** @see ConfigKey#getDescription() */
-    @Override public String getDescription() { return description; }
-
-    /** @see ConfigKey#getDefaultValue() */
-    @Override public T getDefaultValue() { return defaultValue; }
-
-    /** @see ConfigKey#hasDefaultValue() */
-    @Override public boolean hasDefaultValue() {
-        return defaultValue != null;
-    }
-
-    /** @see ConfigKey#isReconfigurable() */
-    @Override
-    public boolean isReconfigurable() {
-        return reconfigurable;
-    }
-    
-    /** @see ConfigKey#getInheritance() */
-    @Override @Nullable
-    public ConfigInheritance getInheritance() {
-        return inheritance;
-    }
-
-    /** @see ConfigKey#getConstraint() */
-    @Override @Nonnull
-    public Predicate<? super T> getConstraint() {
-        // Could be null after rebinding
-        if (constraint != null) {
-            return constraint;
-        } else {
-            return Predicates.alwaysTrue();
-        }
-    }
-
-    /** @see ConfigKey#isValueValid(T) */
-    @Override
-    public boolean isValueValid(T value) {
-        // The likeliest source of an exception is a constraint from Guava that expects a non-null input.
-        try {
-            return getConstraint().apply(value);
-        } catch (Exception e) {
-            log.debug("Suppressing exception when testing validity of " + this, e);
-            return false;
-        }
-    }
-
-    /** @see ConfigKey#getNameParts() */
-    @Override public Collection<String> getNameParts() {
-        return Lists.newArrayList(dots.split(name));
-    }
- 
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) return true;
-        if (!(obj instanceof BasicConfigKey)) return false;
-        BasicConfigKey<?> o = (BasicConfigKey<?>) obj;
-        
-        return Objects.equal(name,  o.name);
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(name);
-    }
-    
-    @Override
-    public String toString() {
-        return String.format("%s[ConfigKey:%s]", name, getTypeName());
-    }
-
-    /**
-     * Retrieves the value corresponding to this config key from the given map.
-     * Could be overridden by more sophisticated config keys, such as MapConfigKey etc.
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public T extractValue(Map<?,?> vals, ExecutionContext exec) {
-        Object v = vals.get(this);
-        try {
-            return (T) resolveValue(v, exec);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-    @Override
-    public boolean isSet(Map<?,?> vals) {
-        return vals.containsKey(this);
-    }
-    
-    protected Object resolveValue(Object v, ExecutionContext exec) throws ExecutionException, InterruptedException {
-        if (v instanceof Collection || v instanceof Map) {
-            return Tasks.resolveDeepValue(v, Object.class, exec, "config "+name);
-        } else {
-            return Tasks.resolveValue(v, getType(), exec, "config "+name);
-        }
-    }
-
-    /** used to record a key which overwrites another; only needed at disambiguation time 
-     * if a class declares a key and an equivalent one (often inherited) which overwrites it.
-     * See org.apache.brooklyn.core.entity.ConfigEntityInheritanceTest, and uses of this class, for more explanation.
-     */
-    public static class BasicConfigKeyOverwriting<T> extends BasicConfigKey<T> {
-        private static final long serialVersionUID = -3458116971918128018L;
-
-        private final ConfigKey<T> parentKey;
-
-        /** builder here should be based on the same key passed in as parent */
-        @Beta
-        public BasicConfigKeyOverwriting(Builder<T> builder, ConfigKey<T> parent) {
-            super(builder);
-            parentKey = parent;
-            Preconditions.checkArgument(Objects.equal(builder.name, parent.getName()), "Builder must use key of the same name.");
-        }
-        
-        public BasicConfigKeyOverwriting(ConfigKey<T> key, T defaultValue) {
-            this(builder(key).defaultValue(defaultValue), key);
-        }
-        
-        public BasicConfigKeyOverwriting(ConfigKey<T> key, String newDescription, T defaultValue) {
-            this(builder(key).description(newDescription).defaultValue(defaultValue), key);
-        }
-        
-        public ConfigKey<T> getParentKey() {
-            return parentKey;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigConstraints.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigConstraints.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigConstraints.java
deleted file mode 100644
index c508349..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigConstraints.java
+++ /dev/null
@@ -1,195 +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.core.config;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.objs.AbstractEntityAdjunct;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.core.objs.BrooklynObjectPredicate;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * Checks configuration constraints on entities and their adjuncts.
- *
- * @since 0.9.0
- */
-public abstract class ConfigConstraints<T extends BrooklynObject> {
-
-    public static final Logger LOG = LoggerFactory.getLogger(ConfigConstraints.class);
-
-    private final T brooklynObject;
-
-    /**
-     * Checks all constraints of all config keys available to an entity.
-     * <p>
-     * If a constraint is a {@link BrooklynObjectPredicate} then
-     * {@link BrooklynObjectPredicate#apply(Object, BrooklynObject)} will be used.
-     */
-    public static void assertValid(Entity entity) {
-        Iterable<ConfigKey<?>> violations = new EntityConfigConstraints(entity).getViolations();
-        if (!Iterables.isEmpty(violations)) {
-            throw new ConstraintViolationException(errorMessage(entity, violations));
-        }
-    }
-
-    /**
-     * Checks all constraints of all config keys available to an entity adjunct.
-     * <p>
-     * If a constraint is a {@link BrooklynObjectPredicate} then
-     * {@link BrooklynObjectPredicate#apply(Object, BrooklynObject)} will be used.
-     */
-    public static void assertValid(EntityAdjunct adjunct) {
-        Iterable<ConfigKey<?>> violations = new EntityAdjunctConstraints(adjunct).getViolations();
-        if (!Iterables.isEmpty(violations)) {
-            throw new ConstraintViolationException(errorMessage(adjunct, violations));
-        }
-    }
-
-    public static <T> void assertValid(Entity entity, ConfigKey<T> key, T value) {
-        if (!new EntityConfigConstraints(entity).isValueValid(key, value)) {
-            throw new ConstraintViolationException("Invalid value for " + key + " on " + entity + ": " + value);
-        }
-    }
-
-    public static <T> void assertValid(Location location, ConfigKey<T> key, T value) {
-        if (!new LocationConfigConstraints(location).isValueValid(key, value)) {
-            throw new ConstraintViolationException("Invalid value for " + key + " on " + location + ": " + value);
-        }
-    }
-
-    private static String errorMessage(BrooklynObject object, Iterable<ConfigKey<?>> violations) {
-        StringBuilder message = new StringBuilder("Error configuring ")
-                .append(object.getDisplayName())
-                .append(": [");
-        Iterator<ConfigKey<?>> it = violations.iterator();
-        while (it.hasNext()) {
-            ConfigKey<?> config = it.next();
-            message.append(config.getName())
-                    .append(":")
-                    .append(config.getConstraint());
-            if (it.hasNext()) {
-                message.append(", ");
-            }
-        }
-        return message.append("]").toString();
-    }
-
-    public ConfigConstraints(T brooklynObject) {
-        this.brooklynObject = brooklynObject;
-    }
-
-    abstract Iterable<ConfigKey<?>> getBrooklynObjectTypeConfigKeys();
-
-    public Iterable<ConfigKey<?>> getViolations() {
-        return validateAll();
-    }
-
-    @SuppressWarnings("unchecked")
-    private Iterable<ConfigKey<?>> validateAll() {
-        List<ConfigKey<?>> violating = Lists.newLinkedList();
-        Iterable<ConfigKey<?>> configKeys = getBrooklynObjectTypeConfigKeys();
-        LOG.trace("Checking config keys on {}: {}", getBrooklynObject(), configKeys);
-        for (ConfigKey<?> configKey : configKeys) {
-            BrooklynObjectInternal.ConfigurationSupportInternal configInternal = getConfigurationSupportInternal();
-            // getNonBlocking method coerces the value to the config key's type.
-            Maybe<?> maybeValue = configInternal.getNonBlocking(configKey);
-            if (maybeValue.isPresent()) {
-                // Cast is safe because the author of the constraint on the config key had to
-                // keep its type to Predicte<? super T>, where T is ConfigKey<T>.
-                ConfigKey<Object> ck = (ConfigKey<Object>) configKey;
-                if (!isValueValid(ck, maybeValue.get())) {
-                    violating.add(configKey);
-                }
-            }
-        }
-        return violating;
-    }
-
-    @SuppressWarnings("unchecked")
-    <V> boolean isValueValid(ConfigKey<V> configKey, V value) {
-        try {
-            Predicate<? super V> po = configKey.getConstraint();
-            if (po instanceof BrooklynObjectPredicate) {
-                return BrooklynObjectPredicate.class.cast(po).apply(value, brooklynObject);
-            } else {
-                return po.apply(value);
-            }
-        } catch (Exception e) {
-            LOG.debug("Error checking constraint on " + configKey.getName(), e);
-        }
-        return true;
-    }
-
-    private BrooklynObjectInternal.ConfigurationSupportInternal getConfigurationSupportInternal() {
-        return ((BrooklynObjectInternal) brooklynObject).config();
-    }
-
-    protected T getBrooklynObject() {
-        return brooklynObject;
-    }
-
-    private static class EntityConfigConstraints extends ConfigConstraints<Entity> {
-        public EntityConfigConstraints(Entity brooklynObject) {
-            super(brooklynObject);
-        }
-
-        @Override
-        Iterable<ConfigKey<?>> getBrooklynObjectTypeConfigKeys() {
-            return getBrooklynObject().getEntityType().getConfigKeys();
-        }
-    }
-
-    private static class EntityAdjunctConstraints extends ConfigConstraints<EntityAdjunct> {
-        public EntityAdjunctConstraints(EntityAdjunct brooklynObject) {
-            super(brooklynObject);
-        }
-
-        @Override
-        Iterable<ConfigKey<?>> getBrooklynObjectTypeConfigKeys() {
-            return ((AbstractEntityAdjunct) getBrooklynObject()).getAdjunctType().getConfigKeys();
-        }
-    }
-
-    private static class LocationConfigConstraints extends ConfigConstraints<Location> {
-        public LocationConfigConstraints(Location brooklynObject) {
-            super(brooklynObject);
-        }
-
-        @Override
-        Iterable<ConfigKey<?>> getBrooklynObjectTypeConfigKeys() {
-            return Collections.emptyList();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
deleted file mode 100644
index ecc1ec0..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
+++ /dev/null
@@ -1,273 +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.core.config;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey.BasicConfigKeyOverwriting;
-import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.TemplatedStringAttributeSensorAndConfigKey;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Preconditions;
-import com.google.common.reflect.TypeToken;
-
-
-/**
- * Dictionary of {@link ConfigKey} entries.
- */
-public class ConfigKeys {
-
-    private static final Logger log = LoggerFactory.getLogger(ConfigKeys.class);
-    
-    public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name) {
-        return new BasicConfigKey<T>(type, name);
-    }
-
-    public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name, String description) {
-        return new BasicConfigKey<T>(type, name, description);
-    }
-
-    public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name) {
-        return new BasicConfigKey<T>(type, name);
-    }
-
-    public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name, String description) {
-        return new BasicConfigKey<T>(type, name, description);
-    }
-
-    public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name, String description, T defaultValue) {
-        return new BasicConfigKey<T>(type, name, description, defaultValue);
-    }
-
-    public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name, String description, T defaultValue) {
-        return new BasicConfigKey<T>(type, name, description, defaultValue);
-    }
-
-    public static <T> AttributeSensorAndConfigKey<T,T> newSensorAndConfigKey(Class<T> type, String name, String description) {
-        return new BasicAttributeSensorAndConfigKey<T>(type, name, description);
-    }
-
-    public static <T> AttributeSensorAndConfigKey<T,T> newSensorAndConfigKey(Class<T> type, String name, String description, T defaultValue) {
-        return new BasicAttributeSensorAndConfigKey<T>(type, name, description, defaultValue);
-    }
-
-    public static <T> AttributeSensorAndConfigKey<T,T> newSensorAndConfigKey(TypeToken<T> type, String name, String description) {
-        return new BasicAttributeSensorAndConfigKey<T>(type, name, description);
-    }
-
-    public static <T> AttributeSensorAndConfigKey<T,T> newSensorAndConfigKey(TypeToken<T> type, String name, String description, T defaultValue) {
-        return new BasicAttributeSensorAndConfigKey<T>(type, name, description, defaultValue);
-    }
-
-    public static AttributeSensorAndConfigKey<String,String> newStringSensorAndConfigKey(String name, String description) {
-        return new BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey(name, description);
-    }
-
-    public static AttributeSensorAndConfigKey<String,String> newStringSensorAndConfigKey(String name, String description, String defaultValue) {
-        return new BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey(name, description, defaultValue);
-    }
-
-    public static AttributeSensorAndConfigKey<String,String> newTemplateSensorAndConfigKey(String name, String description) {
-        return new TemplatedStringAttributeSensorAndConfigKey(name, description);
-    }
-
-    public static AttributeSensorAndConfigKey<String,String> newTemplateSensorAndConfigKey(String name, String description, String defaultValue) {
-        return new TemplatedStringAttributeSensorAndConfigKey(name, description, defaultValue);
-    }
-
-    public static AttributeSensorAndConfigKey<Integer,Integer> newIntegerSensorAndConfigKey(String name, String description) {
-        return new BasicAttributeSensorAndConfigKey.IntegerAttributeSensorAndConfigKey(name, description);
-    }
-
-    public static AttributeSensorAndConfigKey<Integer,Integer> newIntegerSensorAndConfigKey(String name, String description, Integer defaultValue) {
-        return new BasicAttributeSensorAndConfigKey.IntegerAttributeSensorAndConfigKey(name, description, defaultValue);
-    }
-
-    public static PortAttributeSensorAndConfigKey newPortSensorAndConfigKey(String name, String description) {
-        return new PortAttributeSensorAndConfigKey(name, description);
-    }
-
-    public static PortAttributeSensorAndConfigKey newPortSensorAndConfigKey(String name, String description, Object defaultValue) {
-        return new PortAttributeSensorAndConfigKey(name, description, defaultValue);
-    }
-
-    /** Infers the type from the default value */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static <T> ConfigKey<T> newConfigKey(String name, String description, @Nonnull T defaultValue) {
-        return new BasicConfigKey<T>((Class)Preconditions.checkNotNull(defaultValue, 
-                "Type must be exlicit for ConfigKey if defaultValue is null").getClass(), 
-                name, description, defaultValue);
-    }
-
-    public static <T> BasicConfigKey.Builder<T> builder(Class<T> type) {
-        return BasicConfigKey.builder(type);
-    }
-    public static <T> BasicConfigKey.Builder<T> builder(TypeToken<T> type) {
-        return BasicConfigKey.builder(type);
-    }
-    public static <T> BasicConfigKey.Builder<T> builder(Class<T> type, String name) {
-        return BasicConfigKey.builder(type, name);
-    }
-    public static <T> BasicConfigKey.Builder<T> builder(TypeToken<T> type, String name) {
-        return BasicConfigKey.builder(type, name);
-    }
-
-    // ---- extensions to keys
-    
-    public static <T> ConfigKey<T> newConfigKeyWithDefault(ConfigKey<T> parent, T defaultValue) {
-        return new BasicConfigKeyOverwriting<T>(parent, defaultValue);
-    }
-
-    public static <T> ConfigKey<T> newConfigKeyWithDefault(ConfigKey<T> parent, String newDescription, T defaultValue) {
-        return new BasicConfigKeyOverwriting<T>(parent, newDescription, defaultValue);
-    }
-
-    public static <T> ConfigKey<T> newConfigKeyRenamed(String newName, ConfigKey<T> key) {
-        return new BasicConfigKey<T>(key.getTypeToken(), newName, key.getDescription(), key.getDefaultValue());
-    }
-
-    public static <T> ConfigKey<T> newConfigKeyWithPrefix(String prefix, ConfigKey<T> key) {
-        return newConfigKeyRenamed(prefix+key.getName(), key);
-    }
-
-    public static <T> ConfigKey<T> newConfigKeyWithPrefixRemoved(String prefix, ConfigKey<T> key) {
-        if (key.getName().startsWith(prefix)) {
-            return newConfigKeyRenamed(key.getName().substring(prefix.length()), key);
-        } else {
-            throw new IllegalArgumentException("key "+key+" does not start with prefix "+prefix);
-        }
-    }
-
-    /** converts the name of the key from one case-strategy (e.g. lowerCamel) to andother (e.g. lower-hyphen) */
-    public static <T> ConfigKey<T> convert(ConfigKey<T> key, CaseFormat inputCaseStrategy, CaseFormat outputCaseStrategy) {
-        return newConfigKeyRenamed(inputCaseStrategy.to(outputCaseStrategy, key.getName()), key);
-    }
-
-    // ---- typed keys
-
-    public static ConfigKey<String> newStringConfigKey(String name) {
-        return newConfigKey(String.class, name);
-    }
-    public static ConfigKey<String> newStringConfigKey(String name, String description) {
-        return newConfigKey(String.class, name, description);
-    }
-    public static ConfigKey<String> newStringConfigKey(String name, String description, String defaultValue) {
-        return newConfigKey(String.class, name, description, defaultValue);
-    }
-    
-    public static ConfigKey<Integer> newIntegerConfigKey(String name) {
-        return newConfigKey(Integer.class, name);
-    }
-    public static ConfigKey<Integer> newIntegerConfigKey(String name, String description) {
-        return newConfigKey(Integer.class, name, description);
-    }
-    public static ConfigKey<Integer> newIntegerConfigKey(String name, String description, Integer defaultValue) {
-        return newConfigKey(Integer.class, name, description, defaultValue);
-    }
-    
-    public static ConfigKey<Long> newLongConfigKey(String name) {
-        return newConfigKey(Long.class, name);
-    }
-    public static ConfigKey<Long> newLongConfigKey(String name, String description) {
-        return newConfigKey(Long.class, name, description);
-    }
-    public static ConfigKey<Long> newLongConfigKey(String name, String description, Long defaultValue) {
-        return newConfigKey(Long.class, name, description, defaultValue);
-    }
-    
-    public static ConfigKey<Double> newDoubleConfigKey(String name) {
-        return newConfigKey(Double.class, name);
-    }
-    public static ConfigKey<Double> newDoubleConfigKey(String name, String description) {
-        return newConfigKey(Double.class, name, description);
-    }
-    public static ConfigKey<Double> newDoubleConfigKey(String name, String description, Double defaultValue) {
-        return newConfigKey(Double.class, name, description, defaultValue);
-    }
-    
-    public static ConfigKey<Boolean> newBooleanConfigKey(String name) {
-        return newConfigKey(Boolean.class, name);
-    }
-    public static ConfigKey<Boolean> newBooleanConfigKey(String name, String description) {
-        return newConfigKey(Boolean.class, name, description);
-    }
-    public static ConfigKey<Boolean> newBooleanConfigKey(String name, String description, Boolean defaultValue) {
-        return newConfigKey(Boolean.class, name, description, defaultValue);
-    }
-    
-    public static ConfigKey<Duration> newDurationConfigKey(String name) {
-        return newConfigKey(Duration.class, name);
-    }
-    public static ConfigKey<Duration> newDurationConfigKey(String name, String description) {
-        return newConfigKey(Duration.class, name, description);
-    }
-    public static ConfigKey<Duration> newDurationConfigKey(String name, String description, Duration defaultValue) {
-        return newConfigKey(Duration.class, name, description, defaultValue);
-    }
-    
-    public static class DynamicKeys {
-
-        // TODO see below
-//        public static final ConfigKey<String> TYPE = ConfigKeys.newStringConfigKey("type");
-        public static final ConfigKey<String> NAME = ConfigKeys.newStringConfigKey("name");
-        public static final ConfigKey<String> DESCRIPTION = ConfigKeys.newStringConfigKey("description");
-        public static final ConfigKey<Object> DEFAULT_VALUE = ConfigKeys.newConfigKey(Object.class, "defaultValue");
-        
-        public static ConfigKey<?> newInstance(ConfigBag keyDefs) {
-            String typeName = Strings.toString(keyDefs.getStringKey("type"));
-            if (Strings.isNonBlank(typeName)) {
-                // TODO dynamic typing - see TYPE key commented out above; also see AddSensor.getType for type lookup
-                log.warn("Setting 'type' is not currently supported for dynamic config keys; ignoring in definition of "+keyDefs);
-            }
-            
-            Class<Object> type = Object.class;
-            String name = keyDefs.get(NAME);
-            String description = keyDefs.get(DESCRIPTION);
-            Object defaultValue = keyDefs.get(DEFAULT_VALUE);
-            return newConfigKey(type, name, description, defaultValue);
-        }
-        
-        /** creates a new {@link ConfigKey} given a map describing it */
-        public static ConfigKey<?> newInstance(Map<?,?> keyDefs) {
-            return newInstance(ConfigBag.newInstance(keyDefs));
-        }
-        
-        /** creates a new {@link ConfigKey} given a name (e.g. as a key in a larger map) and a map of other definition attributes */
-        public static ConfigKey<?> newNamedInstance(String name, Map<?,?> keyDefs) {
-            ConfigBag defs = ConfigBag.newInstance(keyDefs);
-            String oldName = defs.put(NAME, name);
-            if (oldName!=null && !oldName.equals(name))
-                log.warn("Dynamic key '"+oldName+"' being overridden as key '"+name+"' in "+keyDefs);
-            return newInstance(defs);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigPredicates.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigPredicates.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigPredicates.java
deleted file mode 100644
index a2f5bec..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigPredicates.java
+++ /dev/null
@@ -1,157 +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.core.config;
-
-import java.util.regex.Pattern;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.util.guava.SerializablePredicate;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.apache.brooklyn.util.text.WildcardGlobs;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-@SuppressWarnings("serial")
-public class ConfigPredicates {
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Predicate<ConfigKey<?>> startingWithOld(final String prefix) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<ConfigKey<?>>() {
-            @Override
-            public boolean apply(@Nullable ConfigKey<?> input) {
-                return (input != null) && input.getName().startsWith(prefix);
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Predicate<ConfigKey<?>> matchingGlobOld(final String glob) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<ConfigKey<?>>() {
-            @Override
-            public boolean apply(@Nullable ConfigKey<?> input) {
-                return (input != null) && WildcardGlobs.isGlobMatched(glob, input.getName());
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Predicate<ConfigKey<?>> matchingRegexOld(final String regex) {
-        // TODO PERSISTENCE WORKAROUND
-        final Pattern p = Pattern.compile(regex);
-        return new Predicate<ConfigKey<?>>() {
-            @Override
-            public boolean apply(@Nullable ConfigKey<?> input) {
-                return (input != null) && p.matcher(input.getName()).matches();
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Predicate<ConfigKey<?>> nameMatchingOld(final Predicate<String> filter) {
-        // TODO PERSISTENCE WORKAROUND
-        return new Predicate<ConfigKey<?>>() {
-            @Override
-            public boolean apply(@Nullable ConfigKey<?> input) {
-                return (input != null) && filter.apply(input.getName());
-            }
-        };
-    }
-
-    /** @deprecated since 0.9.0; use {@link #nameStartsWith(String)} */
-    public static Predicate<ConfigKey<?>> startingWith(final String prefix) {
-        return nameStartsWith(prefix);
-    }
-
-    /** @deprecated since 0.9.0; use {@link #nameMatchesGlob(String)} */
-    public static Predicate<ConfigKey<?>> matchingGlob(final String glob) {
-        return nameMatchesGlob(glob);
-    }
-
-    /** @deprecated since 0.9.0; use {@link #nameMatchesRegex(String)} */
-    public static Predicate<ConfigKey<?>> matchingRegex(final String regex) {
-        return nameMatchesRegex(regex);
-    }
-
-    /** @deprecated since 0.9.0; use {@link #nameSatisfies(Predicate)} */
-    public static Predicate<ConfigKey<?>> nameMatching(final Predicate<String> filter) {
-        return nameSatisfies(filter);
-    }
-
-    /**
-     * @since 0.9.0
-     */
-    public static Predicate<ConfigKey<?>> nameStartsWith(final String prefix) {
-        return nameSatisfies(StringPredicates.startsWith(prefix));
-    }
-
-    /**
-     * @since 0.9.0
-     */
-    public static Predicate<ConfigKey<?>> nameMatchesGlob(final String glob) {
-        return nameSatisfies(StringPredicates.matchesGlob(glob));
-    }
-
-    /**
-     * @since 0.9.0
-     */
-    public static Predicate<ConfigKey<?>> nameMatchesRegex(final String regex) {
-        return nameSatisfies(StringPredicates.matchesRegex(regex));
-    }
-
-    /**
-     * @since 0.9.0
-     */
-    public static Predicate<ConfigKey<?>> nameEqualTo(final String val) {
-        return nameSatisfies(Predicates.equalTo(val));
-    }
-    
-    /**
-     * @since 0.9.0
-     */
-    public static Predicate<ConfigKey<?>> nameSatisfies(final Predicate<? super String> condition) {
-        return new NameSatisfies(condition);
-    }
-    
-    /**
-     * @since 0.9.0
-     */
-    protected static class NameSatisfies implements SerializablePredicate<ConfigKey<?>> {
-        protected final Predicate<? super String> condition;
-        protected NameSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable ConfigKey<?> input) {
-            return (input != null) && condition.apply(input.getName());
-        }
-        @Override
-        public String toString() {
-            return "displayNameSatisfies("+condition+")";
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigUtils.java
deleted file mode 100644
index 80d06b9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConfigUtils.java
+++ /dev/null
@@ -1,129 +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.core.config;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.config.ConfigUtils;
-import org.apache.brooklyn.core.config.WrappedConfigKey;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicate;
-
-@SuppressWarnings({"unchecked"})
-public class ConfigUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(ConfigUtils.class);
-    
-    public static <T> T getRequiredConfig(Entity entity, ConfigKey<T> key) {
-        T result = entity.getConfig(key);
-        if (result==null) throw new IllegalStateException("Configuration "+key+" is required");
-        return result;
-    }
-    
-    /** prepends the given prefix to the key.  prefix will typically end with a ".".
-     * this is useful for configuration purposes when a subsystem uses a short-name config (e.g. "user")
-     * but in entity config or at the root (brooklyn.properties) there are longer names (e.g. "brooklyn.ssh.config.user"),
-     * and we wish to convert from the shorter names to the longer names. */
-    public static <T> ConfigKey<T> prefixedKey(String prefix, ConfigKey<T> key) {
-        return ConfigKeys.newConfigKeyWithPrefix(prefix, key);
-    }
-    
-    /** removes the given prefix from the key for configuration purposes; logs warning and does nothing if there is no such prefix.
-     * prefix will typically end with a ".".
-     * this is useful for configuration purposes when a subsystem uses a short-name config (e.g. "user")
-     * but in entity config or at the root (brooklyn.properties) there are longer names (e.g. "brooklyn.ssh.config.user"),
-     * and we wish to convert from the longer names to the short-name. */
-    public static <T> ConfigKey<T> unprefixedKey(String prefix, ConfigKey<T> key) {
-        String newName = key.getName();
-        if (newName.startsWith(prefix)) newName = newName.substring(prefix.length());
-        else log.warn("Cannot remove prefix "+prefix+" from key "+key+" (ignoring)");
-        return new BasicConfigKey<T>(key.getTypeToken(), newName, key.getDescription(), key.getDefaultValue());
-    }
-    
-    
-    public static BrooklynProperties loadFromFile(String file) {
-        BrooklynProperties result = BrooklynProperties.Factory.newEmpty();
-        if (file!=null) result.addFrom(new File(file));
-        return result;
-    }
-    
-    public static BrooklynProperties filterFor(BrooklynProperties properties, Predicate<? super String> filter) {
-        BrooklynProperties result = BrooklynProperties.Factory.newEmpty();
-        for (String k: (Collection<String>)properties.keySet()) {
-            if (filter.apply(k)) {
-                result.put(k, properties.get(k));
-            }
-        }
-        return result;
-    }
-    
-    public static BrooklynProperties filterForPrefix(BrooklynProperties properties, String prefix) {
-        BrooklynProperties result = BrooklynProperties.Factory.newEmpty();
-        for (String k: (Collection<String>)properties.keySet()) {
-            if (k.startsWith(prefix)) {
-                result.put(k, properties.get(k));
-            }
-        }
-        return result;
-    }
-    
-    /** prefix generally ends with a full stop */
-    public static BrooklynProperties filterForPrefixAndStrip(Map<String,?> properties, String prefix) {
-        BrooklynProperties result = BrooklynProperties.Factory.newEmpty();
-        for (String k: properties.keySet()) {
-            if (k.startsWith(prefix)) {
-                result.put(k.substring(prefix.length()), properties.get(k));
-            }
-        }
-        return result;
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static Set<HasConfigKey<?>> getStaticKeysOnClass(Class<?> type) {
-        Set<HasConfigKey<?>> result = new LinkedHashSet<ConfigKey.HasConfigKey<?>>();
-        for (Field f: type.getFields()) {
-            try {
-                if ((f.getModifiers() & Modifier.STATIC)==0)
-                    continue;
-                if (ConfigKey.class.isAssignableFrom(f.getType()))
-                    result.add(new WrappedConfigKey((ConfigKey<?>) f.get(null)));
-                else if (HasConfigKey.class.isAssignableFrom(f.getType()))
-                    result.add((HasConfigKey<?>) f.get(null));
-            } catch (Exception e) {
-                log.error("Error retrieving config key for field "+f+" on class "+type+"; rethrowing", e);
-                throw Exceptions.propagate(e);
-            }
-        }
-        return Collections.unmodifiableSet(result);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConstraintViolationException.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConstraintViolationException.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConstraintViolationException.java
deleted file mode 100644
index 55c7f07..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/config/ConstraintViolationException.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 org.apache.brooklyn.core.config;
-
-/**
- * A {@link ConstraintViolationException} indicates one or more problems applying
- * values for {@link org.apache.brooklyn.config.ConfigKey ConfigKeys} when creating
- * a {@link org.apache.brooklyn.api.objs.BrooklynObject}.
- */
-public class ConstraintViolationException extends RuntimeException {
-    private static final long serialVersionUID = -6719912119648996815L;
-
-    public ConstraintViolationException(String message) {
-        super(message);
-    }
-
-    public ConstraintViolationException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}


[08/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
deleted file mode 100644
index 718b97e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
+++ /dev/null
@@ -1,85 +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.core.location.dynamic;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-
-/**
- * An entity that owns a particular location.
- * <p>
- * The entity should be able to dynamically create an instance of the required type of location, and will manage
- * the lifecycle of the location in parallel with its own.
- *
- * @param L the location type
- * @param E the entity type
- */
-@Beta
-public interface LocationOwner<L extends Location & DynamicLocation<E, L>, E extends Entity & LocationOwner<L, E>> {
-
-    @SetFromFlag("locationPrefix")
-    ConfigKey<String> LOCATION_NAME_PREFIX = ConfigKeys.newStringConfigKey(
-            "entity.dynamicLocation.prefix", "The name prefix for the location owned by this entity", "dynamic");
-
-    @SetFromFlag("locationSuffix")
-    ConfigKey<String> LOCATION_NAME_SUFFIX = ConfigKeys.newStringConfigKey(
-            "entity.dynamicLocation.suffix", "The name suffix for the location owned by this entity");
-
-    @SetFromFlag("locationName")
-    BasicAttributeSensorAndConfigKey<String> LOCATION_NAME = new BasicAttributeSensorAndConfigKey<String>(String.class,
-            "entity.dynamicLocation.name", "The name of the location owned by this entity (default is auto-generated using prefix and suffix keys)");
-
-    ConfigKey<Map<String, Object>> LOCATION_FLAGS = ConfigKeys.newConfigKey(new TypeToken<Map<String, Object>>() { },
-            "entity.dynamicLocation.flags", "Extra creation flags for the Location owned by this entity",
-            ImmutableMap.<String, Object>of());
-
-    AttributeSensor<Location> DYNAMIC_LOCATION = Sensors.newSensor(Location.class,
-            "entity.dynamicLocation", "The location owned by this entity");
-
-    AttributeSensor<String> LOCATION_SPEC = Sensors.newStringSensor(
-            "entity.dynamicLocation.spec", "The specification string for the location owned by this entity");
-
-    AttributeSensor<Boolean> DYNAMIC_LOCATION_STATUS = Sensors.newBooleanSensor(
-            "entity.dynamicLocation.status", "The status of the location owned by this entity");
-
-    AttributeSensor<LocationDefinition> LOCATION_DEFINITION = Sensors.newSensor(
-        LocationDefinition.class, "entity.dynamicLocation.definition", "The location definition for the location owned by this entity");
-
-    L getDynamicLocation();
-
-    L createLocation(Map<String, ?> flags);
-
-    boolean isLocationAvailable();
-
-    void deleteLocation();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/GeoBytesHostGeoLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/GeoBytesHostGeoLookup.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/GeoBytesHostGeoLookup.java
deleted file mode 100644
index 3e46720..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/GeoBytesHostGeoLookup.java
+++ /dev/null
@@ -1,104 +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.core.location.geo;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.brooklyn.util.net.Networking;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** @deprecated Mar 2015 - the API has changed; GetLocation now discouraged for free access, and valuepairs.txt not supported */
-@Deprecated
-public class GeoBytesHostGeoLookup implements HostGeoLookup {
-
-    public static final Logger log = LoggerFactory.getLogger(GeoBytesHostGeoLookup.class);
-    
-    /*
-    curl "http://www.geobytes.com/IpLocator.htm?GetLocation&template=valuepairs.txt&IpAddress=geobytes.com"
-    known=1
-    countryid=254
-    country=United States
-    fips104=US
-    iso2=US
-    iso3=USA
-    ison=840
-    internet=US
-    comment=
-    regionid=142
-    region=Maryland
-    code=MD
-    adm1code=    
-    cityid=8909
-    city=Baltimore
-    latitude=39.2894
-    longitude=-76.6384
-    timezone=-05:00
-    dmaid=512
-    dma=512
-    market=Baltimore
-    certainty=78
-    isproxy=false
-    mapbytesremaining=Free
-    */
-    
-    public String getPropertiesLookupUrlForPublicIp(String ip) {
-        return "http://www.geobytes.com/IpLocator.htm?GetLocation&template=valuepairs.txt&IpAddress="+ip.trim();
-    }
-
-    public String getPropertiesLookupUrlForLocalhost() {
-        return "http://www.geobytes.com/IpLocator.htm?GetLocation&template=valuepairs.txt";
-    }
-
-    /** returns URL to get properties for the given address (assuming localhost if address is on a subnet) */
-    public String getPropertiesLookupUrlFor(InetAddress address) {
-        if (Networking.isPrivateSubnet(address)) return getPropertiesLookupUrlForLocalhost();
-        return getPropertiesLookupUrlForPublicIp(address.getHostAddress());
-    }
-    
-    private static boolean LOGGED_GEO_LOOKUP_UNAVAILABLE = false;
-    
-    public HostGeoInfo getHostGeoInfo(InetAddress address) throws MalformedURLException, IOException {
-        String url = getPropertiesLookupUrlFor(address);
-        if (log.isDebugEnabled())
-            log.debug("Geo info lookup for "+address+" at "+url);
-        Properties props = new Properties();
-        try {
-            props.load( new URL(url).openStream() );
-            HostGeoInfo geo = new HostGeoInfo(address.getHostName(), props.getProperty("city")+" ("+props.getProperty("iso2")+")", 
-                Double.parseDouble(props.getProperty("latitude")), Double.parseDouble(props.getProperty("longitude")));
-            log.info("Geo info lookup for "+address+" returned: "+geo);
-            return geo;
-        } catch (Exception e) {
-            // may be web not available, or gateway giving us funny crap
-            if (log.isDebugEnabled())
-                log.debug("Geo info lookup for "+address+" failed: "+e);
-            if (!LOGGED_GEO_LOOKUP_UNAVAILABLE) {
-                LOGGED_GEO_LOOKUP_UNAVAILABLE = true;
-                log.info("Geo info lookup unavailable (for "+address+"; cause "+e+")");
-            }
-            return null;
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HasHostGeoInfo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HasHostGeoInfo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HasHostGeoInfo.java
deleted file mode 100644
index 97e64d5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HasHostGeoInfo.java
+++ /dev/null
@@ -1,25 +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.core.location.geo;
-
-public interface HasHostGeoInfo {
-
-    HostGeoInfo getHostGeoInfo();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
deleted file mode 100644
index f99b41d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
+++ /dev/null
@@ -1,216 +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.core.location.geo;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.AddressableLocation;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.location.LocationConfigKeys;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.internal.BrooklynSystemProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-
-/**
- * Encapsulates geo-IP information for a given host.
- */
-public class HostGeoInfo implements Serializable {
-    
-    private static final long serialVersionUID = -5866759901535266181L;
-
-    public static final Logger log = LoggerFactory.getLogger(HostGeoInfo.class);
-
-    /** the IP address */
-    public final String address;
-    
-    public final String displayName;
-    
-    public final double latitude;
-    public final double longitude;
-    
-    private static Maybe<HostGeoLookup> cachedLookup = null;
-
-    public static HostGeoInfo create(String address, String displayName, double latitude, double longitude) {
-        return new HostGeoInfo(address, displayName, latitude, longitude);
-    }
-    
-    public static HostGeoInfo fromIpAddress(InetAddress address) {
-        try {
-            HostGeoLookup lookup = getDefaultLookup();
-            if (lookup!=null)
-                return lookup.getHostGeoInfo(address);
-        } catch (Exception e) {
-            if (log.isDebugEnabled())
-                log.debug("unable to look up geo DNS info for "+address, e);
-        }
-        return null;
-    }
-
-    @Nullable
-    public static HostGeoLookup getDefaultLookup() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-        if (cachedLookup==null) {
-            cachedLookup = Maybe.of(findHostGeoLookupImpl());
-        }                
-        return cachedLookup.get();
-    }
-    
-    public static void clearCachedLookup() {
-        cachedLookup = null;
-    }
-    
-    /** returns null if cannot be set */
-    public static HostGeoInfo fromLocation(Location l) {
-        if (l==null) return null;
-        
-        Location la = l;
-        HostGeoInfo resultFromLocation = null;
-        while (la!=null) {
-            if (la instanceof HasHostGeoInfo) {
-                resultFromLocation = ((HasHostGeoInfo)l).getHostGeoInfo();
-                if (resultFromLocation!=null) break;
-            }
-            la = la.getParent();
-        }
-        if (resultFromLocation!=null && l==la) {
-            // from the location
-            return resultFromLocation;
-        }
-        // resultFromLocation may be inherited, in which case we will copy it later
-        
-        InetAddress address = findIpAddress(l);
-        Object latitude = l.getConfig(LocationConfigKeys.LATITUDE);
-        Object longitude = l.getConfig(LocationConfigKeys.LONGITUDE);
-
-        if (resultFromLocation!=null && (latitude == null || longitude == null)) {
-            latitude = resultFromLocation.latitude;
-            longitude = resultFromLocation.longitude;            
-        }
-        if (address!=null && (latitude == null || longitude == null)) {
-            HostGeoInfo geo = fromIpAddress(address);
-            if (geo==null) return null;
-            latitude = geo.latitude;
-            longitude = geo.longitude;
-        }
-        
-        if (latitude==null || longitude==null)
-            return null;
-        
-        Exception error=null;
-        try {
-            latitude = TypeCoercions.castPrimitive(latitude, Double.class);
-            longitude = TypeCoercions.castPrimitive(longitude, Double.class);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            error = e;
-        }
-        if (error!=null || !(latitude instanceof Double) || !(longitude instanceof Double))
-            throw new IllegalArgumentException("Location "+l+" specifies invalid type of lat/long: " +
-                    "lat="+latitude+" (type "+(latitude==null ? null : latitude.getClass())+"); " +
-                    "lon="+longitude+" (type "+(longitude==null ? null : longitude.getClass())+")", error);
-        
-        HostGeoInfo result = new HostGeoInfo(address!=null ? address.getHostAddress() : null, l.getDisplayName(), (Double) latitude, (Double) longitude);
-        if (l instanceof AbstractLocation) {
-            ((AbstractLocation)l).setHostGeoInfo(result);
-        }
-        return result;
-    }
-
-    @Deprecated
-    private static boolean warnedLegacy = false;
-    
-    private static HostGeoLookup findHostGeoLookupImpl() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-        String type = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getValue();
-        if (type==null) {
-            type = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL_LEGACY.getValue();
-            if (type!=null && !warnedLegacy) {
-                warnedLegacy = true;
-                log.warn("Using deprecated host-geo-lookup property "+BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL_LEGACY+"; "
-                    + "set "+BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL+" instead");
-            }
-        }
-        /* utrace seems more accurate than geobytes, and it gives a report of how many tokens are left;
-         * but maxmind if it's installed locally is even better (does not require remote lookup),
-         * so use it if available */
-        if (type==null) {
-            if (MaxMind2HostGeoLookup.getDatabaseReader()!=null)
-                return new MaxMind2HostGeoLookup();
-            log.debug("Using Utrace remote for geo lookup because MaxMind2 is not available");
-            return new UtraceHostGeoLookup();
-        }
-        if (type.isEmpty()) return null;
-        return (HostGeoLookup) Class.forName(type).newInstance();
-    }
-
-    public static HostGeoInfo fromEntity(Entity e) {
-        for (Location l : e.getLocations()) {
-            HostGeoInfo hgi = fromLocation(l);
-            if (hgi != null)
-                return hgi;
-        }
-        return null;
-    }
-    
-    public static InetAddress findIpAddress(Location l) {
-        if (l == null)
-            return null;
-        if (l instanceof AddressableLocation)
-            return ((AddressableLocation) l).getAddress();
-        return findIpAddress(l.getParent());
-    }
-    
-    public HostGeoInfo(String address, String displayName, double latitude, double longitude) {
-        this.address = address;
-        this.displayName = displayName==null ? "" : displayName;
-        this.latitude = latitude;
-        this.longitude = longitude;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-    
-    @Override
-    public String toString() {
-        return "HostGeoInfo["+displayName+": "+(address!=null ? address : "(no-address)")+" at ("+latitude+","+longitude+")]";
-    }
-    
-    @Override
-    public boolean equals(Object o) {
-        // Slight cheat: only includes the address + displayName field (displayName to allow overloading localhost etc)
-        return (o instanceof HostGeoInfo) && Objects.equal(address, ((HostGeoInfo) o).address)
-                && Objects.equal(displayName, ((HostGeoInfo) o).displayName);
-    }
-    
-    @Override
-    public int hashCode() {
-        // Slight cheat: only includes the address + displayName field (displayName to allow overloading localhost etc)
-        return Objects.hashCode(address, displayName);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoLookup.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoLookup.java
deleted file mode 100644
index ec25e07..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoLookup.java
+++ /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.
- */
-package org.apache.brooklyn.core.location.geo;
-
-import java.net.InetAddress;
-
-public interface HostGeoLookup {
-
-    public HostGeoInfo getHostGeoInfo(InetAddress address) throws Exception;
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/LocalhostExternalIpLoader.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/LocalhostExternalIpLoader.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/LocalhostExternalIpLoader.java
deleted file mode 100644
index f6623fc..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/LocalhostExternalIpLoader.java
+++ /dev/null
@@ -1,208 +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.core.location.geo;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Durations;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Predicates;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class LocalhostExternalIpLoader {
-
-    public static final Logger LOG = LoggerFactory.getLogger(LocalhostExternalIpLoader.class);
-
-    /**
-     * Mutex to guard access to retrievingLocalExternalIp.
-     */
-    private static final Object mutex = new Object();
-    /**
-     * When null there is no ongoing attempt to load the external IP address. Either no attempt has been made or the
-     * last attempt has been completed.
-     * When set there is an ongoing attempt to load the external IP address. New attempts to lookup the external IP
-     * address should wait on this latch instead of making another attempt to load the IP address.
-     */
-    private static CountDownLatch retrievingLocalExternalIp;
-    /**
-     * Cached external IP address of localhost. Null if either no attempt has been made to resolve the address or the
-     * last attempt failed.
-     */
-    private static volatile String localExternalIp;
-
-    private static class IpLoader implements Callable<String> {
-        private static final Pattern ipPattern = Pattern.compile(
-                "\\b((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\b");
-        final String url;
-
-        protected IpLoader(String url) {
-            this.url = url;
-        }
-
-        @Override
-        public String call() {
-            String response = ResourceUtils.create(LocalhostExternalIpLoader.class)
-                    .getResourceAsString(url).trim();
-            return postProcessResponse(response);
-        }
-
-        String postProcessResponse(String response) {
-            Matcher matcher = ipPattern.matcher(response);
-            boolean matched = matcher.find();
-            if (!matched) {
-                LOG.error("No IP address matched in output from {}: {}", url, response);
-                return null;
-            } else {
-                return matcher.group();
-            }
-        }
-    }
-
-    @VisibleForTesting
-    static List<String> getIpAddressWebsites() {
-        String file = new ResourceUtils(LocalhostExternalIpLoader.class)
-                .getResourceAsString("classpath://org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt");
-        Iterable<String> lines = Splitter.on('\n')
-                .omitEmptyStrings()
-                .trimResults()
-                .split(file);
-        List<String> urls = Lists.newArrayList(Iterables.filter(lines, Predicates.not(StringPredicates.startsWith("#"))));
-        Collections.shuffle(urls);
-        return urls;
-    }
-
-    @VisibleForTesting
-    static String getIpAddressFrom(String url) {
-        return new IpLoader(url).call();
-    }
-    
-    /** As {@link #getLocalhostIpWithin(Duration)} but returning 127.0.0.1 if not accessible */
-    public static String getLocalhostIpQuicklyOrDefault() {
-        String result = doLoad(Duration.seconds(2));
-        if (result==null) return "127.0.0.1";
-        return result;
-    }
-
-    /** As {@link #getLocalhostIpWithin(Duration)} but without the time limit cut-off, failing if the load gives an error. */
-    public static String getLocalhostIpWaiting() {
-        return getLocalhostIpWithin(null);
-    }
-
-    /**
-     * Attempts to load the public IP address of localhost, failing if the load
-     * does not complete within the given duration.
-     * @return The public IP address of localhost
-     */
-    public static String getLocalhostIpWithin(Duration timeout) {
-        String result = doLoad(timeout);
-        if (result == null) {
-            throw new IllegalStateException("Unable to retrieve external IP for localhost; network may be down or slow or remote service otherwise not responding");
-        }
-        return result;
-    }
-
-    /**
-     * Requests URLs returned by {@link #getIpAddressWebsites()} until one returns an IP address or all URLs have been tried.
-     * The address is assumed to be the external IP address of localhost.
-     * @param blockFor The maximum duration to wait for the IP address to be resolved.
-     *                 An indefinite way if null.
-     * @return A string in IPv4 format, or null if no such address could be ascertained.
-     */
-    private static String doLoad(Duration blockFor) {
-        // Check for a cached external IP address
-        final String resolvedIp = localExternalIp;
-        if (resolvedIp != null) {
-            return resolvedIp;
-        }
-
-        // Check for an ongoing attempt to load an external IP address
-        final boolean startAttemptToLoadIp;
-        final CountDownLatch attemptToRetrieveLocalExternalIp;
-        synchronized (mutex) {
-            if (retrievingLocalExternalIp == null) {
-                retrievingLocalExternalIp = new CountDownLatch(1);
-                startAttemptToLoadIp = true;
-            }
-            else {
-                startAttemptToLoadIp = false;
-            }
-            attemptToRetrieveLocalExternalIp = retrievingLocalExternalIp;
-        }
-
-        // Attempt to load the external IP address in private thread, otherwise blocks for 30s+ on dodgy network!
-        // (we can skip it if someone else is doing it, we have synch lock so we'll get notified)
-        if (startAttemptToLoadIp) {
-            final List<String> candidateUrls = getIpAddressWebsites();
-            if (candidateUrls.isEmpty()) {
-                LOG.debug("No candidate URLs to use to determine external IP of localhost");
-                return null;
-            }
-
-            new Thread() {
-                public void run() {
-                    for (String url : candidateUrls) {
-                        try {
-                            LOG.debug("Looking up external IP of this host from {} in private thread {}", url, Thread.currentThread());
-                            final String loadedIp = new IpLoader(url).call();
-                            localExternalIp = loadedIp;
-                            LOG.debug("Finished looking up external IP of this host from {} in private thread, result {}", url, loadedIp);
-                            break;
-                        } catch (Throwable t) {
-                            LOG.debug("Unable to look up external IP of this host from {}, probably offline {})", url, t);
-                        }
-                    }
-
-                    attemptToRetrieveLocalExternalIp.countDown();
-
-                    synchronized (mutex) {
-                        retrievingLocalExternalIp = null;
-                    }
-                }
-            }.start();
-        }
-
-        try {
-            if (blockFor!=null) {
-                Durations.await(attemptToRetrieveLocalExternalIp, blockFor);
-            } else {
-                attemptToRetrieveLocalExternalIp.await();
-            }
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
-
-        return localExternalIp;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/MaxMind2HostGeoLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/MaxMind2HostGeoLookup.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/MaxMind2HostGeoLookup.java
deleted file mode 100644
index 1880441..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/MaxMind2HostGeoLookup.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 org.apache.brooklyn.core.location.geo;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-
-import org.apache.brooklyn.util.internal.BrooklynSystemProperties;
-import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.Lists;
-import com.maxmind.geoip2.DatabaseReader;
-import com.maxmind.geoip2.model.CityResponse;
-import com.maxmind.geoip2.record.Subdivision;
-
-public class MaxMind2HostGeoLookup implements HostGeoLookup {
-
-    public static final Logger log = LoggerFactory.getLogger(MaxMind2HostGeoLookup.class);
-    
-    static final String MAXMIND_DB_URL = "http://dev.maxmind.com/geoip/geoip2/geolite2/#Downloads";
-    // TODO this should be configurable from system property or brooklyn.properties
-    // TODO and should use properties BrooklynServerConfig.MGMT_BASE_DIR (but hard to get mgmt properties here!)
-    static final String MAXMIND_DB_PATH = System.getProperty("user.home")+"/"+".brooklyn/"+"GeoLite2-City.mmdb";
-    
-    static boolean lookupFailed = false;
-    static DatabaseReader databaseReader = null;
-    
-    public static synchronized DatabaseReader getDatabaseReader() {
-        if (databaseReader!=null) return databaseReader;
-        try {
-            File f = new File(MAXMIND_DB_PATH);
-            databaseReader = new DatabaseReader.Builder(f).build();
-        } catch (IOException e) {
-            lookupFailed = true;
-            log.debug("MaxMind geo lookup unavailable; either download and unpack the latest "+
-                    "binary from "+MAXMIND_DB_URL+" into "+MAXMIND_DB_PATH+", "+
-                    "or specify a different HostGeoLookup implementation with the key "+
-                    BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getPropertyName()+" (error trying to read: "+e+")");
-        }
-        return databaseReader;
-    }
-    
-    public HostGeoInfo getHostGeoInfo(InetAddress address) throws MalformedURLException, IOException {
-        if (lookupFailed) return null;
-        
-        DatabaseReader ll = getDatabaseReader();
-        if (ll==null) return null;
-        
-        InetAddress extAddress = address;
-        if (Networking.isPrivateSubnet(extAddress)) extAddress = InetAddress.getByName(LocalhostExternalIpLoader.getLocalhostIpQuicklyOrDefault());
-        
-        try {
-            CityResponse l = ll.city(extAddress);
-            if (l==null) {
-                if (log.isDebugEnabled()) log.debug("Geo info failed to find location for address {}, using {}", extAddress, ll);
-                return null;
-            }
-            
-            StringBuilder name = new StringBuilder();
-            
-            if (l.getCity()!=null && l.getCity().getName()!=null) name.append(l.getCity().getName());
-            
-            if (l.getSubdivisions()!=null) {
-                for (Subdivision subd: Lists.reverse(l.getSubdivisions())) {
-                    if (name.length()>0) name.append(", ");
-                    // prefer e.g. USA state codes over state names
-                    if (!Strings.isBlank(subd.getIsoCode())) 
-                        name.append(subd.getIsoCode());
-                    else
-                        name.append(subd.getName());
-                }
-            }
-            
-            if (l.getCountry()!=null) {
-                if (name.length()==0) {
-                    name.append(l.getCountry().getName());
-                } else {
-                    name.append(" ("); name.append(l.getCountry().getIsoCode()); name.append(")");
-                }
-            }
-
-            
-            HostGeoInfo geo = new HostGeoInfo(address.getHostName(), name.toString(), l.getLocation().getLatitude(), l.getLocation().getLongitude());
-            log.debug("Geo info lookup (MaxMind DB) for "+address+" returned: "+geo);
-            return geo;
-        } catch (Exception e) {
-            if (log.isDebugEnabled())
-                log.debug("Geo info lookup failed: "+e);
-            throw Throwables.propagate(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/UtraceHostGeoLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/UtraceHostGeoLookup.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/UtraceHostGeoLookup.java
deleted file mode 100644
index 5026ac4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/geo/UtraceHostGeoLookup.java
+++ /dev/null
@@ -1,209 +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.core.location.geo;
-
-import groovy.util.Node;
-import groovy.util.NodeList;
-import groovy.util.XmlParser;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Durations;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-
-public class UtraceHostGeoLookup implements HostGeoLookup {
-
-
-    /*
-     * 
-http://xml.utrace.de/?query=88.198.156.18 
-(IP address or hostname)
-
-The XML result is as follows:
-
-<?xml version="1.0" encoding="iso-8869-1"?>
-<results>
-<result>
-<ip>88.198.156.18</ip>
-<host>utrace.de</host>
-<isp>Hetzner Online AG</isp>
-<org>Pagedesign GmbH</org>
-<region>Hamburg</region>
-<countrycode>DE</countrycode>
-<latitude>53.5499992371</latitude>
-<longitude>10</longitude>
-<queries>10</queries>
-</result>
-</results>
-
-Note the queries count field -- you are permitted 100 per day.
-Beyond this you get blacklisted and requests may time out, or return none.
-(This may last for several days once blacklisting, not sure how long.)
-     */
-    
-    /** after failures, subsequent retries within this time interval are blocked */
-    private static final Duration RETRY_INTERVAL = Duration.FIVE_MINUTES;
-    /** requests taking longer than this period are deemed to have timed out and failed;
-     * set reasonably low so that if we are blacklisted for making too many requests,
-     * the call to get geo info does not take very long */
-    private static final Duration REQUEST_TIMEOUT = Duration.seconds(3);
-    
-    public static final Logger log = LoggerFactory.getLogger(UtraceHostGeoLookup.class);
-    
-    public String getLookupUrlForPublicIp(String ip) {
-        return "http://xml.utrace.de/?query="+ip.trim();
-    }
-
-    /**
-     * @deprecated since 0.7.0. Use {@link LocalhostExternalIpLoader} instead.
-     */
-    @Deprecated
-    public static String getLocalhostExternalIp() {
-        return LocalhostExternalIpLoader.getLocalhostIpWithin(Duration.seconds(2));
-    }
-    
-    /**
-     * @deprecated since 0.7.0. Use {@link LocalhostExternalIpLoader} instead.
-     */
-    @Deprecated
-    public static String getLocalhostExternalIpImpl() {
-        return LocalhostExternalIpLoader.getLocalhostIpWithin(Duration.seconds(2));
-    }
-    
-    public String getLookupUrlForLocalhost() {
-        return getLookupUrlForPublicIp(LocalhostExternalIpLoader.getLocalhostIpQuicklyOrDefault());
-    }
-
-    /** returns URL to get properties for the given address (assuming localhost if address is on a subnet) */
-    public String getLookupUrlFor(InetAddress address) {
-        if (Networking.isPrivateSubnet(address)) return getLookupUrlForLocalhost();
-        return getLookupUrlForPublicIp(address.getHostAddress());
-    }
-    
-    private static boolean LOGGED_GEO_LOOKUP_UNAVAILABLE = false;
-    private static long LAST_FAILURE_UTC = -1;
-    
-    /** does the {@link #retrieveHostGeoInfo(InetAddress)}, but in the background with a default timeout */
-    public HostGeoInfo getHostGeoInfo(InetAddress address) throws MalformedURLException, IOException {
-        if (Duration.sinceUtc(LAST_FAILURE_UTC).compareTo(RETRY_INTERVAL) < 0) {
-            // wait at least 60s since a failure
-            return null;
-        }
-        return getHostGeoInfo(address, REQUEST_TIMEOUT);
-    }
-    
-    /** does a {@link #retrieveHostGeoInfo(InetAddress)} with a timeout (returning null, interrupting, and setting failure time) */
-    public HostGeoInfo getHostGeoInfo(final InetAddress address, Duration timeout) throws MalformedURLException, IOException {
-        final AtomicReference<HostGeoInfo> result = new AtomicReference<HostGeoInfo>();
-        Thread lt = new Thread() {
-            public void run() {
-                try {
-                    result.set(retrieveHostGeoInfo(address));
-                } catch (Exception e) {
-                    log.warn("Error computing geo info for "+address+"; internet issues or too many requests to (free) servers for "+JavaClassNames.simpleClassName(UtraceHostGeoLookup.this)+": "+e);
-                    log.debug("Detail of host geo error: "+e, e);
-                }
-            }
-        };
-        lt.start();
-
-        try {
-            Durations.join(lt, timeout);
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
-        
-        if (lt.isAlive()) {
-            // interrupt and set the failure time so that subsequent attempts do not face this timeout
-            lt.interrupt();
-            LAST_FAILURE_UTC = System.currentTimeMillis();
-            log.debug("Geo info lookup for "+address+" timed out after "+timeout);
-        }
-        
-        return result.get();
-    }
-    
-    public HostGeoInfo retrieveHostGeoInfo(InetAddress address) throws MalformedURLException, IOException {
-        String url = getLookupUrlFor(address);
-        if (log.isDebugEnabled())
-            log.debug("Geo info lookup for "+address+" at "+url);
-        Node xml;
-        try {
-            xml = new XmlParser().parse(getLookupUrlFor(address));
-        } catch (Exception e) {
-            LAST_FAILURE_UTC = System.currentTimeMillis();
-            if (log.isDebugEnabled())
-                log.debug("Geo info lookup for "+address+" failed: "+e);
-            if (!LOGGED_GEO_LOOKUP_UNAVAILABLE) {
-                LOGGED_GEO_LOOKUP_UNAVAILABLE = true;
-                log.info("Geo info lookup unavailable (for "+address+"; cause "+e+")");
-            }
-            return null;
-        }
-        try {
-            String org = getXmlResultsField(xml, "org").trim();
-            if (org.isEmpty()) org = getXmlResultsField(xml, "isp").trim();
-            String region = getXmlResultsField(xml, "region").trim();
-            if (!org.isEmpty()) {
-                if (!region.isEmpty()) region = org+", "+region;
-                else region = org;
-            }
-            if (region.isEmpty()) region = getXmlResultsField(xml, "isp").trim();
-            if (region.isEmpty()) region = address.toString();
-            HostGeoInfo geo = new HostGeoInfo(address.getHostName(), 
-                    region+
-                    " ("+getXmlResultsField(xml, "countrycode")+")", 
-                    Double.parseDouble(""+getXmlResultsField(xml, "latitude")), 
-                    Double.parseDouble(""+getXmlResultsField(xml, "longitude")));
-            log.info("Geo info lookup for "+address+" returned: "+geo);
-            return geo;
-        } catch (Exception e) {
-            if (log.isDebugEnabled())
-                log.debug("Geo info lookup failed, for "+address+" at "+url+", due to "+e+"; response is "+xml);
-            throw Throwables.propagate(e);
-        }
-    }
-    
-    @Nullable
-    private static Node getFirstChild(Node xml, String field) {
-        if (xml==null) return null;
-        NodeList nl = (NodeList)xml.get(field);
-        if (nl==null || nl.isEmpty()) return null;
-        return (Node)nl.get(0);
-    }
-    @Nonnull
-    private static String getXmlResultsField(Node xml, String field) {
-        Node f1 = getFirstChild(getFirstChild(xml, "result"), field);
-        if (f1==null) return "";
-        return f1.text();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationDynamicType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationDynamicType.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationDynamicType.java
deleted file mode 100644
index 59f0d34..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationDynamicType.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.core.location.internal;
-
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.objs.BrooklynDynamicType;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationType;
-
-public class LocationDynamicType extends BrooklynDynamicType<Location, AbstractLocation> {
-
-    public LocationDynamicType(AbstractLocation location) {
-        super(location);
-    }
-    
-    public LocationType getSnapshot() {
-        return (LocationType) super.getSnapshot();
-    }
-
-    @Override
-    protected LocationTypeSnapshot newSnapshot() {
-        return new LocationTypeSnapshot(name, value(configKeys));
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationInternal.java
deleted file mode 100644
index 5c83f2d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationInternal.java
+++ /dev/null
@@ -1,96 +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.core.location.internal;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento;
-import org.apache.brooklyn.config.ConfigInheritance;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Information about locations private to Brooklyn.
- */
-public interface LocationInternal extends BrooklynObjectInternal, Location {
-
-    @Beta
-    public static final ConfigKey<String> ORIGINAL_SPEC = ConfigKeys.newStringConfigKey("spec.original", "The original spec used to instantiate a location");
-    @Beta
-    public static final ConfigKey<String> FINAL_SPEC = ConfigKeys.newStringConfigKey("spec.final", "The actual spec (in a chain) which instantiates a location");
-    @Beta
-    public static final ConfigKey<String> NAMED_SPEC_NAME = ConfigKeys.newStringConfigKey("spec.named.name", "The name on the (first) named spec in a chain");
-    
-    /**
-     * Registers the given extension for the given type. If an extension already existed for
-     * this type, then this will override it.
-     * 
-     * @throws NullPointerException if extensionType or extension are null
-     * @throws IllegalArgumentException if extension does not implement extensionType
-     */
-    <T> void addExtension(Class<T> extensionType, T extension);
-
-    /**
-     * Get a record of the metadata of this location.
-     * <p/>
-     * <p>Metadata records are used to record an audit trail of events relating to location usage
-     * (for billing purposes, for example). Implementations (and subclasses) should override this
-     * method to return information useful for this purpose.</p>
-     *
-     * @return
-     */
-    public Map<String, String> toMetadataRecord();
-
-    /**
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getLocalBag()}
-     */
-    @Deprecated
-    ConfigBag getLocalConfigBag();
-
-    /**
-     * Returns all config, including that inherited from parents.
-     * 
-     * This method does not respect {@link ConfigInheritance} and so usage is discouraged.
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getBag()}
-     */
-    @Deprecated
-    ConfigBag getAllConfigBag();
-
-    /**
-     * Users are strongly discouraged from calling or overriding this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    RebindSupport<LocationMemento> getRebindSupport();
-    
-    @Override
-    RelationSupportInternal<Location> relations();
-    
-    ManagementContext getManagementContext();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationTypeSnapshot.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationTypeSnapshot.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationTypeSnapshot.java
deleted file mode 100644
index 1c45da2..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/internal/LocationTypeSnapshot.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.core.location.internal;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.sensor.EnricherType;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.objs.BrooklynTypeSnapshot;
-
-public class LocationTypeSnapshot extends BrooklynTypeSnapshot implements EnricherType {
-    
-    private static final long serialVersionUID = 9150132836104748237L;
-
-    LocationTypeSnapshot(String name, Map<String, ConfigKey<?>> configKeys) {
-        super(name, configKeys);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        return (obj instanceof LocationTypeSnapshot) && super.equals(obj);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java
deleted file mode 100644
index 0ddc79a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java
+++ /dev/null
@@ -1,138 +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.core.mgmt;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.util.collections.MutableList;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-
-/** @since 0.7.0 some strongly typed tags for reference; note these may migrate elsewhere! */
-@Beta
-public class BrooklynTags {
-
-    public static final String YAML_SPEC_KIND = "yaml_spec";
-    public static final String NOTES_KIND = "notes";
-    
-    public static class NamedStringTag implements Serializable {
-        private static final long serialVersionUID = 7932098757009051348L;
-        @JsonProperty final String kind;
-        @JsonProperty final String contents;
-        public NamedStringTag(@JsonProperty("kind") String kind, @JsonProperty("contents") String contents) {
-            this.kind = kind;
-            this.contents = contents;
-        }
-        @Override
-        public String toString() {
-            return kind+"["+contents+"]";
-        }
-        
-        public String getKind() {
-            return kind;
-        }
-        public String getContents() {
-            return contents;
-        }
-    }
-
-    public static class ListTag<T> {
-        @JsonIgnore
-        final List<T> list;
-
-        public ListTag(List<T> list) {
-            this.list = list;
-        }
-
-        public List<T> getList() {
-            return list;
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (this == o) return true;
-            if (o == null || getClass() != o.getClass()) return false;
-            ListTag<?> that = (ListTag<?>) o;
-            return list == null ? that.list == null : list.equals(that.list);
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(list);
-        }
-    }
-
-    public static class TraitsTag extends ListTag<String> {
-        public TraitsTag(List<Class<?>> interfaces) {
-            // The transformed list is a view, meaning that it references
-            // the instances list. This means that it will serialize 
-            // the list of classes along with the anonymous function which
-            // is not what we want. Force eager evaluation instead, using
-            // a simple list, supported by {@link CatalogXmlSerializer}.
-            super(new ArrayList<String>(
-                Lists.transform(interfaces, new Function<Class<?>, String>() {
-                    @Override public String apply(Class<?> input) {
-                        return input.getName();
-                    }
-                })));
-        }
-
-        @JsonProperty("traits")
-        public List<String> getTraits() {
-            return super.list;
-        }
-    }
-
-    public static NamedStringTag newYamlSpecTag(String contents) {
-        return new NamedStringTag(YAML_SPEC_KIND, contents);
-    }
-
-    public static NamedStringTag newNotesTag(String contents) {
-        return new NamedStringTag(NOTES_KIND, contents);
-    }
-
-    public static TraitsTag newTraitsTag(List<Class<?>> interfaces) {
-        return new TraitsTag(interfaces);
-    }
-    
-    public static NamedStringTag findFirst(String kind, Iterable<Object> tags) {
-        for (Object object: tags) {
-            if (object instanceof NamedStringTag && kind.equals(((NamedStringTag)object).kind))
-                return (NamedStringTag) object;
-        }
-        return null;
-    }
-
-    public static List<NamedStringTag> findAll(String kind, Iterable<Object> tags) {
-        List<NamedStringTag> result = MutableList.of();
-        for (Object object: tags) {
-            if (object instanceof NamedStringTag && kind.equals(((NamedStringTag)object).kind))
-                result.add( (NamedStringTag) object );
-        }
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java
deleted file mode 100644
index 1fba49d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java
+++ /dev/null
@@ -1,455 +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.core.mgmt;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ExecutionManager;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.MemoryUsageTracker;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.text.StringEscapes.BashStringEscapes;
-import org.apache.brooklyn.util.text.Strings;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Functions;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableSet;
-
-/** Provides utilities for making Tasks easier to work with in Brooklyn.
- * Main thing at present is to supply (and find) wrapped entities for tasks to understand the
- * relationship of the entity to the task.
- * TODO Longer term it would be better to remove 'tags' on Tasks and use a strongly typed context object.
- * (Tags there are used mainly for determining who called it (caller), what they called it on (target entity),
- * and what type of task it is (effector, schedule/sensor, etc).)
- */
-public class BrooklynTaskTags extends TaskTags {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynTaskTags.WrappedEntity.class);
-
-    /** Tag for tasks which are running on behalf of the management server, rather than any entity */
-    public static final String BROOKLYN_SERVER_TASK_TAG = "BROOKLYN-SERVER";
-    /** Tag for a task which represents an effector */
-    public static final String EFFECTOR_TAG = "EFFECTOR";
-    /** Tag for a task which *is* interesting, in contrast to {@link #TRANSIENT_TASK_TAG} */
-    public static final String NON_TRANSIENT_TASK_TAG = "NON-TRANSIENT";
-    /** indicates a task is transient, roughly that is to say it is uninteresting -- 
-     * specifically this means it can be GC'd as soon as it is completed, 
-     * and that it need not appear in some task lists;
-     * often used for framework lifecycle events and sensor polling */
-    public static final String TRANSIENT_TASK_TAG = "TRANSIENT";
-
-    // ------------- entity tags -------------------------
-    
-    public static class WrappedEntity {
-        public final String wrappingType;
-        public final Entity entity;
-        protected WrappedEntity(String wrappingType, Entity entity) {
-            Preconditions.checkNotNull(wrappingType);
-            Preconditions.checkNotNull(entity);
-            this.wrappingType = wrappingType;
-            this.entity = entity;
-        }
-        @Override
-        public String toString() {
-            return "Wrapped["+wrappingType+":"+entity+"]";
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(entity, wrappingType);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (this==obj) return true;
-            if (!(obj instanceof WrappedEntity)) return false;
-            return 
-                Objects.equal(entity, ((WrappedEntity)obj).entity) &&
-                Objects.equal(wrappingType, ((WrappedEntity)obj).wrappingType);
-        }
-    }
-    
-    public static final String CONTEXT_ENTITY = "contextEntity";
-    public static final String CALLER_ENTITY = "callerEntity";
-    public static final String TARGET_ENTITY = "targetEntity";
-    
-    public static WrappedEntity tagForContextEntity(Entity entity) {
-        return new WrappedEntity(CONTEXT_ENTITY, entity);
-    }
-    
-    public static WrappedEntity tagForCallerEntity(Entity entity) {
-        return new WrappedEntity(CALLER_ENTITY, entity);
-    }
-    
-    public static WrappedEntity tagForTargetEntity(Entity entity) {
-        return new WrappedEntity(TARGET_ENTITY, entity);
-    }
-
-    public static Entity getWrappedEntityOfType(Task<?> t, String wrappingType) {
-        if (t==null) return null;
-        return getWrappedEntityOfType(t.getTags(), wrappingType);
-    }
-    public static Entity getWrappedEntityOfType(Collection<?> tags, String wrappingType) {
-        for (Object x: tags)
-            if ((x instanceof WrappedEntity) && ((WrappedEntity)x).wrappingType.equals(wrappingType))
-                return ((WrappedEntity)x).entity;
-        return null;
-    }
-
-    public static Entity getContextEntity(Task<?> task) {
-        return getWrappedEntityOfType(task, CONTEXT_ENTITY);
-    }
-
-    public static Entity getTargetOrContextEntity(Task<?> t) {
-        if (t==null) return null;
-        Entity result = getWrappedEntityOfType(t, CONTEXT_ENTITY);
-        if (result!=null) return result;
-        result = getWrappedEntityOfType(t, TARGET_ENTITY);
-        if (result!=null) {
-            log.warn("Context entity found by looking at target entity tag, not context entity");
-            return result;
-        }
-        
-        result = Tasks.tag(t, Entity.class, false);
-        if (result!=null) {
-            log.warn("Context entity found by looking at 'Entity' tag, not wrapped entity");
-        }
-        return result;
-    }
-    
-    public static Set<Task<?>> getTasksInEntityContext(ExecutionManager em, Entity e) {
-        return em.getTasksWithTag(tagForContextEntity(e));
-    }
-
-    public static ManagementContext getManagementContext(Task<?> task) {
-        for (Object tag : task.getTags())
-            if ((tag instanceof ManagementContext))
-                return (ManagementContext) tag;
-        return null;
-    }
-
-    // ------------- stream tags -------------------------
-
-    public static class WrappedStream {
-        public final String streamType;
-        public final Supplier<String> streamContents;
-        public final Supplier<Integer> streamSize;
-        protected WrappedStream(String streamType, Supplier<String> streamContents, Supplier<Integer> streamSize) {
-            Preconditions.checkNotNull(streamType);
-            Preconditions.checkNotNull(streamContents);
-            this.streamType = streamType;
-            this.streamContents = streamContents;
-            this.streamSize = streamSize != null ? streamSize : Suppliers.<Integer>ofInstance(streamContents.get().length());
-        }
-        protected WrappedStream(String streamType, ByteArrayOutputStream stream) {
-            Preconditions.checkNotNull(streamType);
-            Preconditions.checkNotNull(stream);
-            this.streamType = streamType;
-            this.streamContents = Strings.toStringSupplier(stream);
-            this.streamSize = Streams.sizeSupplier(stream);
-        }
-        // fix for https://github.com/FasterXML/jackson-databind/issues/543 (which also applies to codehaus jackson)
-        @JsonProperty
-        public Integer getStreamSize() {
-            return streamSize.get();
-        }
-        // there is a stream api so don't return everything unless explicitly requested!
-        @JsonProperty("streamContents")
-        public String getStreamContentsAbbreviated() {
-            return Strings.maxlenWithEllipsis(streamContents.get(), 80);
-        }
-        @Override
-        public String toString() {
-            return "Stream["+streamType+"/"+Strings.makeSizeString(streamSize.get())+"]";
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(streamContents, streamType);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (!(obj instanceof WrappedStream)) return false;
-            return 
-                Objects.equal(streamContents, ((WrappedStream)obj).streamContents) &&
-                Objects.equal(streamType, ((WrappedStream)obj).streamType);
-        }
-    }
-    
-    public static final String STREAM_STDIN = "stdin";
-    public static final String STREAM_STDOUT = "stdout";
-    public static final String STREAM_STDERR = "stderr";
-    /** not a stream, but inserted with the same mechanism */
-    public static final String STREAM_ENV = "env";
-    
-    private static final Maybe<ByteArrayOutputStream> STREAM_GARBAGE_COLLECTED_MAYBE = Maybe.of(Streams.byteArrayOfString("<contents-garbage-collected>"));
-
-    /** creates a tag suitable for marking a stream available on a task */
-    public static WrappedStream tagForStream(String streamType, ByteArrayOutputStream stream) {
-        return new WrappedStream(streamType, stream);
-    }
-    /** creates a tag suitable for marking a stream available on a task, but which might be GC'd */
-    public static WrappedStream tagForStreamSoft(String streamType, ByteArrayOutputStream stream) {
-        MemoryUsageTracker.SOFT_REFERENCES.track(stream, stream.size());
-        Maybe<ByteArrayOutputStream> weakStream = Maybe.softThen(stream, STREAM_GARBAGE_COLLECTED_MAYBE);
-        return new WrappedStream(streamType,
-            Suppliers.compose(Functions.toStringFunction(), weakStream),
-            Suppliers.compose(Streams.sizeFunction(), weakStream));
-    }
-
-    /** creates a tag suitable for marking a stream available on a task */
-    public static WrappedStream tagForStream(String streamType, Supplier<String> contents, Supplier<Integer> size) {
-        return new WrappedStream(streamType, contents, size);
-    }
-    
-    /** creates a tag suitable for attaching a snapshot of an environment var map as a "stream" on a task;
-     * mainly for use with STREAM_ENV */ 
-    public static WrappedStream tagForEnvStream(String streamEnv, Map<?, ?> env) {
-        StringBuilder sb = new StringBuilder();
-        for (Map.Entry<?,?> kv: env.entrySet()) {
-            Object val = kv.getValue();
-            sb.append(kv.getKey()+"=" +
-                (val!=null ? BashStringEscapes.wrapBash(val.toString()) : "") + "\n");
-        }
-        return BrooklynTaskTags.tagForStream(BrooklynTaskTags.STREAM_ENV, Streams.byteArrayOfString(sb.toString()));
-    }
-
-    /** returns the set of tags indicating the streams available on a task */
-    public static Set<WrappedStream> streams(Task<?> task) {
-        Set<WrappedStream> result = new LinkedHashSet<BrooklynTaskTags.WrappedStream>();
-        for (Object tag: task.getTags()) {
-            if (tag instanceof WrappedStream) {
-                result.add((WrappedStream)tag);
-            }
-        }
-        return ImmutableSet.copyOf(result);
-    }
-
-    /** returns the tag for the indicated stream, or null */
-    public static WrappedStream stream(Task<?> task, String streamType) {
-        if (task==null) return null;
-        for (Object tag: task.getTags())
-            if ((tag instanceof WrappedStream) && ((WrappedStream)tag).streamType.equals(streamType))
-                return (WrappedStream)tag;
-        return null;
-    }
-
-    // ------ misc
-    
-    public static void setInessential(Task<?> task) { addTagDynamically(task, INESSENTIAL_TASK); }
-    public static void setTransient(Task<?> task) { addTagDynamically(task, TRANSIENT_TASK_TAG); }
-    public static boolean isTransient(Task<?> task) { 
-        if (hasTag(task, TRANSIENT_TASK_TAG)) return true;
-        if (hasTag(task, NON_TRANSIENT_TASK_TAG)) return false;
-        if (task.getSubmittedByTask()!=null) return isTransient(task.getSubmittedByTask());
-        return false;
-    }
-    public static boolean isSubTask(Task<?> task) { return hasTag(task, SUB_TASK_TAG); }
-    public static boolean isEffectorTask(Task<?> task) { return hasTag(task, EFFECTOR_TAG); }
-    
-    // ------ effector tags
-    
-    public static class EffectorCallTag {
-        protected final String entityId;
-        protected final String effectorName;
-        protected transient ConfigBag parameters;
-        protected EffectorCallTag(String entityId, String effectorName, ConfigBag parameters) {
-            this.entityId = checkNotNull(entityId, "entityId");
-            this.effectorName = checkNotNull(effectorName, "effectorName");
-            this.parameters = parameters;
-        }
-        public String toString() {
-            return EFFECTOR_TAG+"@"+entityId+":"+effectorName;
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(entityId, effectorName);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) return true;
-            if (!(obj instanceof EffectorCallTag)) return false;
-            EffectorCallTag other = (EffectorCallTag) obj;
-            return 
-                Objects.equal(entityId, other.entityId) && 
-                Objects.equal(effectorName, other.effectorName);
-        }
-        public String getEntityId() {
-            return entityId;
-        }
-        public String getEffectorName() {
-            return effectorName;
-        }
-        public ConfigBag getParameters() {
-            return parameters;
-        }
-        public void setParameters(ConfigBag parameters) {
-            this.parameters = parameters;
-        }
-    }
-    
-    public static EffectorCallTag tagForEffectorCall(Entity entity, String effectorName, ConfigBag parameters) {
-        return new EffectorCallTag(entity.getId(), effectorName, parameters);
-    }
-    
-    /**
-     * checks if the given task is part of the given effector call on the given entity;
-     * @param task  the task to check (false if null)
-     * @param entity  the entity where this effector task should be running, or any entity if null
-     * @param effector  the effector (matching name) where this task should be running, or any effector if null
-     * @param allowNestedEffectorCalls  whether to match ancestor effector calls, e.g. if eff1 calls eff2,
-     *   and we are checking eff2, whether to match eff1
-     * @return whether the given task is part of the given effector
-     */
-    public static boolean isInEffectorTask(Task<?> task, @Nullable Entity entity, @Nullable Effector<?> effector, boolean allowNestedEffectorCalls) {
-        Task<?> t = task;
-        while (t!=null) {
-            Set<Object> tags = t.getTags();
-            if (tags.contains(EFFECTOR_TAG)) {
-                for (Object tag: tags) {
-                    if (tag instanceof EffectorCallTag) {
-                        EffectorCallTag et = (EffectorCallTag)tag;
-                        if (entity!=null && !et.getEntityId().equals(entity.getId()))
-                            continue;
-                        if (effector!=null && !et.getEffectorName().equals(effector.getName()))
-                            continue;
-                        return true;
-                    }
-                }
-                if (!allowNestedEffectorCalls) return false;
-            }
-            t = t.getSubmittedByTask();
-        }
-        return false;
-    }
-
-    /**
-     * finds the task up the {@code child} hierarchy handling the {@code effector} call,
-     * returns null if one doesn't exist. 
-     */
-    @Beta
-    public static Task<?> getClosestEffectorTask(Task<?> child, Effector<?> effector) {
-        Task<?> t = child;
-        while (t != null) {
-            Set<Object> tags = t.getTags();
-            if (tags.contains(EFFECTOR_TAG)) {
-                for (Object tag: tags) {
-                    if (tag instanceof EffectorCallTag) {
-                        EffectorCallTag et = (EffectorCallTag) tag;
-                        if (effector != null && !et.getEffectorName().equals(effector.getName()))
-                            continue;
-                        return t;
-                    }
-                }
-            }
-            t = t.getSubmittedByTask();
-        }
-        return null;
-    }
-
-    /** finds the first {@link EffectorCallTag} tag on this tag, or optionally on submitters, or null */
-    public static EffectorCallTag getEffectorCallTag(Task<?> task, boolean recurse) {
-        Task<?> t = task;
-        while (t!=null) {
-            for (Object tag: t.getTags()) {
-                if (tag instanceof EffectorCallTag)
-                    return (EffectorCallTag)tag;
-            }
-            if (!recurse)
-                return null;
-            t = t.getSubmittedByTask();
-        }
-        return null;
-    }
-
-    /** finds the first {@link EffectorCallTag} tag on this tag or a submitter, and returns the effector name */
-    public static String getEffectorName(Task<?> task) {
-        EffectorCallTag result = getEffectorCallTag(task, true);
-        return (result == null) ? null : result.getEffectorName();
-    }
-
-    public static ConfigBag getEffectorParameters(Task<?> task) {
-        EffectorCallTag result = getEffectorCallTag(task, true);
-        return (result == null) ? null : result.getParameters();
-    }
-
-    public static ConfigBag getCurrentEffectorParameters() {
-        return getEffectorParameters(Tasks.current());
-    }
-    
-    public static void setEffectorParameters(Task<?> task, ConfigBag parameters) {
-        EffectorCallTag result = getEffectorCallTag(task, true);
-        if (result == null) {
-            throw new IllegalStateException("No EffectorCallTag found, is the task an effector? Task: " + task);
-        }
-        result.setParameters(parameters);
-    }
-    // ---------------- entitlement tags ----------------
-    
-    public static class EntitlementTag {
-        private EntitlementContext entitlementContext;
-    }
-
-    public static EntitlementContext getEntitlement(Task<?> task) {
-        if (task==null) return null;
-        return getEntitlement(task.getTags());
-    }
-    
-    public static EntitlementContext getEntitlement(Collection<?> tags) {
-        if (tags==null) return null;
-        for (Object tag: tags) {
-            if (tag instanceof EntitlementTag) {
-                return ((EntitlementTag)tag).entitlementContext;
-            }
-        }
-        return null;
-    }
-    
-    public static EntitlementContext getEntitlement(EntitlementTag tag) {
-        if (tag==null) return null;
-        return tag.entitlementContext;
-    }
-    
-    public static EntitlementTag tagForEntitlement(EntitlementContext context) {
-        EntitlementTag tag = new EntitlementTag();
-        tag.entitlementContext = context;
-        return tag;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTasks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTasks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTasks.java
deleted file mode 100644
index e38c34f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTasks.java
+++ /dev/null
@@ -1,25 +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.core.mgmt;
-
-
-/** @deprecated since 0.7.0 use {@link BrooklynTaskTags} */
-@Deprecated
-public class BrooklynTasks extends BrooklynTaskTags {
-}


[27/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java
deleted file mode 100644
index 32c626e..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(ApplicationComponentTemplateRestResource.URI_PATH)
-@Api("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",
-        response = ApplicationComponentTemplateDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java
deleted file mode 100644
index 892cdb5..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.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.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(AssemblyRestResource.URI_PATH)
-@Api("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",
-            response = AssemblyDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java
deleted file mode 100644
index c3ccae6..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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.util.exceptions.Exceptions;
-
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(AssemblyTemplateRestResource.URI_PATH)
-@Api("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",
-            response = AssemblyTemplateDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java
deleted file mode 100644
index 77d20dc..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(PlatformComponentRestResource.URI_PATH)
-@Api("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",
-            response = PlatformComponentDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java
deleted file mode 100644
index b334757..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path(PlatformComponentTemplateRestResource.URI_PATH)
-@Api("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",
-            response = PlatformComponentTemplateDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java
deleted file mode 100644
index 9d98877..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.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 org.apache.brooklyn.camp.server.rest.resource;
-
-import io.swagger.annotations.Api;
-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 io.swagger.annotations.ApiOperation;
-
-//import io.brooklyn.camp.rest.apidoc.Apidoc;
-
-@Path(PlatformRestResource.CAMP_URI_PATH)
-@Api("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",
-            response = PlatformDto.class)
-    @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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampJsons.java
deleted file mode 100644
index cd61b0c..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 org.apache.brooklyn.camp.server.rest.util;
-
-import org.apache.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestContext.java
deleted file mode 100644
index 66d6cf8..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/CampRestGuavas.java
deleted file mode 100644
index 22758a4..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/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 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(); }
-            };
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
deleted file mode 100644
index c745053..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
+++ /dev/null
@@ -1,175 +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.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 org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java b/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
deleted file mode 100644
index 964ae34..0000000
--- a/brooklyn-server/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
+++ /dev/null
@@ -1,59 +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.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
deleted file mode 100644
index 476f23e..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
deleted file mode 100644
index 6c5cabf..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/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 org.apache.brooklyn.camp.server.dto;
-
-import java.io.IOException;
-
-import org.apache.brooklyn.camp.server.dto.DtoCustomAttributes;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
deleted file mode 100644
index e326faa..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/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 org.apache.brooklyn.camp.server.dto;
-
-import java.io.IOException;
-
-import org.apache.brooklyn.camp.server.dto.LinkDto;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
deleted file mode 100644
index eb9f552..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
deleted file mode 100644
index dd7a01c..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/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 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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
deleted file mode 100644
index f0d2138..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
+++ /dev/null
@@ -1,43 +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.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
deleted file mode 100644
index f283f5c..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
+++ /dev/null
@@ -1,84 +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.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.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.net.Urls;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.reporters.Files;
-
-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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java b/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
deleted file mode 100644
index 114324d..0000000
--- a/brooklyn-server/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.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.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/brooklyn-server/blob/d03f254b/brooklyn-server/camp/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/pom.xml b/brooklyn-server/camp/pom.xml
deleted file mode 100644
index 579c473..0000000
--- a/brooklyn-server/camp/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>pom</packaging>
-
-    <groupId>org.apache.brooklyn.camp</groupId>
-    <artifactId>camp-parent</artifactId>
-
-    <name>CAMP Server Parent Project</name>
-    <description>
-        Parent/Root Project for Oasis CAMP Server modules
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <modules>
-        <module>camp-base</module>
-        <module>camp-server</module>
-        <module>camp-brooklyn</module>
-    </modules>
-
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/pom.xml b/brooklyn-server/core/pom.xml
deleted file mode 100644
index 3be573d..0000000
--- a/brooklyn-server/core/pom.xml
+++ /dev/null
@@ -1,321 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <artifactId>brooklyn-core</artifactId>
-
-    <name>Brooklyn Core</name>
-    <description>
-        Entity implementation classes, events, and other core elements
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-rt-felix</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-groovy</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>net.schmizz</groupId>
-            <artifactId>sshj</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>xstream</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-mapper-asl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.gson</groupId>
-            <artifactId>gson</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-ext-jdk15on</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpkix-jdk15on</artifactId>
-            <scope>compile</scope>
-            <exclusions>
-                <!-- provided by bcprov-ext instead -->
-                <exclusion>
-                    <groupId>org.bouncycastle</groupId>
-                    <artifactId>bcprov-jdk15on</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.reflections</groupId>
-            <artifactId>reflections</artifactId>
-            <exclusions>
-              <exclusion>
-                <groupId>com.google.guava</groupId>
-                <artifactId>guava</artifactId>
-              </exclusion>
-              <exclusion>
-                <groupId>xml-apis</groupId>
-                <artifactId>xml-apis</artifactId>
-              </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.freemarker</groupId>
-            <artifactId>freemarker</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.codehaus.groovy</groupId>
-            <artifactId>groovy-all</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpcore</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-core-asl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.maxmind.geoip2</groupId>
-            <artifactId>geoip2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-tools</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.google.mockwebserver</groupId>
-            <artifactId>mockwebserver</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-security</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.jayway.jsonpath</groupId>
-            <artifactId>json-path</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.beust</groupId>
-            <artifactId>jcommander</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-       <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-rt-osgi</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <inherited>true</inherited>
-                <configuration>
-                    <fork>true</fork>
-                    <verbose>false</verbose>
-                </configuration>
-                <executions>
-                    <!-- 
-                      Compile only Groovy files with the eclipse-groovy compiler.
-                      Java files compiled by default-testCompile execution inherited from parent.
-                    -->
-                    <execution>
-                        <id>groovy-testCompile</id>
-                        <phase>test-compile</phase>
-                        <goals>
-                          <goal>testCompile</goal>
-                        </goals>
-                        <configuration>
-                            <compilerId>groovy-eclipse-compiler</compilerId>
-                            <includes>
-                              <include>**/*.groovy</include>
-                            </includes>
-                            <fork>true</fork>
-                            <verbose>false</verbose>
-                            <source>${java.version}</source>
-                            <target>${java.version}</target>
-                        </configuration>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.codehaus.groovy</groupId>
-                        <artifactId>groovy-eclipse-compiler</artifactId>
-                        <version>2.9.1-01</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.codehaus.groovy</groupId>
-                        <artifactId>groovy-eclipse-batch</artifactId>
-                        <version>2.4.3-01</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <supportedProjectTypes>
-                        <supportedProjectType>jar</supportedProjectType>
-                    </supportedProjectTypes>
-                    <instructions>
-                        <Export-Package>brooklyn.*,org.apache.brooklyn.*</Export-Package>
-                        <Import-Package>
-                            !org.apache.brooklyn.rt.felix,
-                            !org.apache.felix.framework,
-                            *
-                        </Import-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-        <pluginManagement>
-            <plugins>
-                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
-                <plugin>
-                    <groupId>org.eclipse.m2e</groupId>
-                    <artifactId>lifecycle-mapping</artifactId>
-                    <version>1.0.0</version>
-                    <configuration>
-                        <lifecycleMappingMetadata>
-                            <pluginExecutions>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.apache.maven.plugins</groupId>
-                                        <artifactId>maven-compiler-plugin</artifactId>
-                                        <versionRange>[3.3,)</versionRange>
-                                        <goals>
-                                            <goal>testCompile</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore></ignore>
-                                    </action>
-                                </pluginExecution>
-                            </pluginExecutions>
-                        </lifecycleMappingMetadata>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynFeatureEnablement.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynFeatureEnablement.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynFeatureEnablement.java
deleted file mode 100644
index 1fb4767..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/BrooklynFeatureEnablement.java
+++ /dev/null
@@ -1,209 +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.core;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.util.core.internal.ssh.ShellTool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Maps;
-
-/**
- * For enabling/disabling experimental features.
- * They can be enabled via java system properties, or by explicitly calling {@link #setEnablement(String, boolean)}.
- * <p>
- * For example, start brooklyn with {@code -Dbrooklyn.experimental.feature.policyPersistence=true}
- * 
- * @author aled
- */
-@Beta
-public class BrooklynFeatureEnablement {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BrooklynFeatureEnablement.class);
-
-    public static final String FEATURE_PROPERTY_PREFIX = "brooklyn.experimental.feature";
-    
-    public static final String FEATURE_POLICY_PERSISTENCE_PROPERTY = FEATURE_PROPERTY_PREFIX+".policyPersistence";
-    
-    public static final String FEATURE_ENRICHER_PERSISTENCE_PROPERTY = FEATURE_PROPERTY_PREFIX+".enricherPersistence";
-
-    public static final String FEATURE_FEED_PERSISTENCE_PROPERTY = FEATURE_PROPERTY_PREFIX+".feedPersistence";
-    
-    /** whether feeds are automatically registered when set on entities, so that they are persisted */
-    public static final String FEATURE_FEED_REGISTRATION_PROPERTY = FEATURE_PROPERTY_PREFIX+".feedRegistration";
-
-    public static final String FEATURE_CATALOG_PERSISTENCE_PROPERTY = FEATURE_PROPERTY_PREFIX+".catalogPersistence";
-    
-    /** whether the default standby mode is {@link HighAvailabilityMode#HOT_STANDBY} or falling back to the traditional
-     * {@link HighAvailabilityMode#STANDBY} */
-    public static final String FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY = FEATURE_PROPERTY_PREFIX+".defaultStandbyIsHot";
-    
-    /** whether to attempt to use {@link BrooklynStorage} (datagrid) as a backing store for data;
-     * note this is <b>not</b> compatible with {@link #FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY} 
-     * which uses a blob/file store and a larger-granularity rebind process than was intended with the datagrid */
-    /* not sure if we still even need this? now the rebind/read-only feature reloads on demand from the persistence store;
-     * the data-grid backing  */
-    public static final String FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE = FEATURE_PROPERTY_PREFIX+".useBrooklynLiveObjectsDatagridStorage";
-
-    /**
-     * Renaming threads can really helps with debugging etc; however it's a massive performance hit (2x)
-     * <p>
-     * We get 55000 tasks per sec with this off, 28k/s with this on.
-     * <p>
-     * Defaults to false if system property is not set.
-     */
-    public static final String FEATURE_RENAME_THREADS = "brooklyn.executionManager.renameThreads";
-
-    /**
-     * When rebinding to state created from very old versions, the catalogItemId properties will be missing which
-     * results in errors when OSGi bundles are used. When enabled the code tries to infer the catalogItemId from
-     * <ul>
-     *   <li> parent entities
-     *   <li> catalog items matching the type that needs to be deserialized
-     *   <li> iterating through all catalog items and checking if they can provide the needed type
-     * </ul>
-     */
-    public static final String FEATURE_BACKWARDS_COMPATIBILITY_INFER_CATALOG_ITEM_ON_REBIND = "brooklyn.backwardCompatibility.feature.inferCatalogItemOnRebind";
-    
-    /**
-     * When rebinding, an entity could reference a catalog item that no longer exists. This option 
-     * will automatically update the catalog item reference to what is inferred as the most 
-     * suitable catalog symbolicName:version.
-     */
-    public static final String FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND = "brooklyn.quickfix.fixDanglingCatalogItemOnRebind";
-    
-    /**
-     * When executing over ssh, whether to support the "async exec" approach, or only the classic approach.
-     * 
-     * If this feature is disabled, then even if the {@link ShellTool#PROP_EXEC_ASYNC} is configured it
-     * will still use the classic ssh approach.
-     */
-    public static final String FEATURE_SSH_ASYNC_EXEC = FEATURE_PROPERTY_PREFIX+".ssh.asyncExec";
-
-    public static final String FEATURE_VALIDATE_LOCATION_SSH_KEYS = "brooklyn.validate.locationSshKeys";
-    
-    private static final Map<String, Boolean> FEATURE_ENABLEMENTS = Maps.newLinkedHashMap();
-
-    private static final Object MUTEX = new Object();
-
-    static void setDefaults() {
-        // Idea is here one can put experimental features that are *enabled* by default, but 
-        // that can be turned off via system properties, or vice versa.
-        // Typically this is useful where a feature is deemed risky!
-        
-        setDefault(FEATURE_POLICY_PERSISTENCE_PROPERTY, true);
-        setDefault(FEATURE_ENRICHER_PERSISTENCE_PROPERTY, true);
-        setDefault(FEATURE_FEED_PERSISTENCE_PROPERTY, true);
-        setDefault(FEATURE_FEED_REGISTRATION_PROPERTY, false);
-        setDefault(FEATURE_CATALOG_PERSISTENCE_PROPERTY, true);
-        setDefault(FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY, false);
-        setDefault(FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE, false);
-        setDefault(FEATURE_RENAME_THREADS, false);
-        setDefault(FEATURE_BACKWARDS_COMPATIBILITY_INFER_CATALOG_ITEM_ON_REBIND, true);
-        setDefault(FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND, false);
-        setDefault(FEATURE_SSH_ASYNC_EXEC, false);
-        setDefault(FEATURE_VALIDATE_LOCATION_SSH_KEYS, true);
-    }
-    
-    static {
-        setDefaults();
-    }
-    
-    /**
-     * Initialises the feature-enablement from brooklyn properties. For each
-     * property, prefer a system-property if present; otherwise use the value 
-     * from brooklyn properties.
-     */
-    public static void init(BrooklynProperties props) {
-        boolean changed = false;
-        for (Map.Entry<String, Object> entry : props.asMapWithStringKeys().entrySet()) {
-            String property = entry.getKey();
-            if (property.startsWith(FEATURE_PROPERTY_PREFIX)) {
-                if (!FEATURE_ENABLEMENTS.containsKey(property)) {
-                    Object rawVal = System.getProperty(property);
-                    if (rawVal == null) {
-                        rawVal = entry.getValue();
-                    }
-                    boolean val = Boolean.parseBoolean(""+rawVal);
-                    FEATURE_ENABLEMENTS.put(property, val);
-                    
-                    changed = true;
-                    LOG.debug("Init feature enablement of "+property+" set to "+val);
-                }
-            }
-        }
-        if (!changed) {
-            LOG.debug("Init feature enablement did nothing, as no settings in brooklyn properties");
-        }
-    }
-    
-    public static boolean isEnabled(String property) {
-        synchronized (MUTEX) {
-            if (!FEATURE_ENABLEMENTS.containsKey(property)) {
-                String rawVal = System.getProperty(property);
-                boolean val = Boolean.parseBoolean(rawVal);
-                FEATURE_ENABLEMENTS.put(property, val);
-            }
-            return FEATURE_ENABLEMENTS.get(property);
-        }
-    }
-
-    public static boolean enable(String property) {
-        return setEnablement(property, true);
-    }
-    
-    public static boolean disable(String property) {
-        return setEnablement(property, false);
-    }
-    
-    public static boolean setEnablement(String property, boolean val) {
-        synchronized (MUTEX) {
-            boolean oldVal = isEnabled(property);
-            FEATURE_ENABLEMENTS.put(property, val);
-            return oldVal;
-        }
-    }
-    
-    public static void setDefault(String property, boolean val) {
-        synchronized (MUTEX) {
-            if (!FEATURE_ENABLEMENTS.containsKey(property)) {
-                String rawVal = System.getProperty(property);
-                if (rawVal == null) {
-                    FEATURE_ENABLEMENTS.put(property, val);
-                    LOG.debug("Default enablement of "+property+" set to "+val);
-                } else {
-                    LOG.debug("Not setting default enablement of "+property+" to "+val+", because system property is "+rawVal);
-                }
-            }
-        }
-    }
-    
-    static void clearCache() {
-        synchronized (MUTEX) {
-            FEATURE_ENABLEMENTS.clear();
-            setDefaults();
-        }
-    }
-}


[30/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
deleted file mode 100644
index d83711c..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
+++ /dev/null
@@ -1,282 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.BrooklynTags;
-import org.apache.brooklyn.core.mgmt.BrooklynTags.NamedStringTag;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.testng.Assert;
-import org.testng.TestListenerAdapter;
-import org.testng.TestNG;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-
-public class CatalogYamlTemplateTest extends AbstractYamlTest {
-    
-    private static final String SIMPLE_ENTITY_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY;
-
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        RegisteredType item = makeItem();
-        Assert.assertTrue(RegisteredTypePredicates.IS_APPLICATION.apply(item), "item: "+item);
-        String yaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        Assert.assertTrue(yaml.indexOf("sample comment")>=0,
-            "YAML did not include original comments; it was:\n"+yaml);
-        Assert.assertFalse(yaml.indexOf("description")>=0,
-            "YAML included metadata which should have been excluded; it was:\n"+yaml);
-
-        deleteCatalogEntity("t1");
-    }
-
-    @Test
-    public void testAddCatalogItemAndCheckSource() throws Exception {
-        // this will fail with the Eclipse TestNG plugin -- use the static main instead to run in eclipse!
-        // see Yamls.KnownClassVersionException for details
-        
-        RegisteredType item = makeItem();
-        String yaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        Assert.assertTrue(yaml.indexOf("sample comment")>=0,
-            "YAML did not include original comments; it was:\n"+yaml);
-        Assert.assertFalse(yaml.indexOf("description")>=0,
-            "YAML included metadata which should have been excluded; it was:\n"+yaml);
-
-        deleteCatalogEntity("t1");
-    }
-
-    public void testServiceTypeEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t1",
-                "  item_type: template",
-                "  name: myT1",
-                "  item:",
-                "    services:",
-                "    - type: " + TestEntity.class.getName());
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t2",
-                "  item_type: template",
-                "  name: myT2",
-                "  item:",
-                "    services:",
-                "    - type: t1",
-                "    - type: t1");
-
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: t2");
-        waitForApplicationTasks(app);
-        
-        Entities.dumpInfo(app);
-        Entity t1a = Iterables.get(app.getChildren(), 0);
-        Entity t1b = Iterables.get(app.getChildren(), 1);
-        assertEquals(app.getChildren().size(), 2);
-        assertEquals(t1a.getChildren().size(), 0);
-        assertEquals(t1b.getChildren().size(), 0);
-        
-        assertTrue(app instanceof BasicApplication);
-        assertTrue(t1a instanceof TestEntity);
-        assertTrue(t1b instanceof TestEntity);
-    }
-
-    @Test
-    public void testChildEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t1",
-                "  item_type: template",
-                "  name: myT1",
-                "  item:",
-                "    services:",
-                "    - type: " + TestEntity.class.getName());
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t2",
-                "  item_type: template",
-                "  name: myT2",
-                "  item:",
-                "    services:",
-                "    - type: " + TestEntity.class.getName(),
-                "      brooklyn.children:",
-                "      - type: t1");
-
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: t2");
-        waitForApplicationTasks(app);
-        
-        Entities.dumpInfo(app);
-        Entity t2 = Iterables.getOnlyElement(app.getChildren());
-        Entity t1 = Iterables.getOnlyElement(t2.getChildren());
-        assertEquals(t1.getChildren().size(), 0);
-        
-        assertTrue(app instanceof BasicApplication);
-        assertTrue(t1 instanceof TestEntity);
-        assertTrue(t2 instanceof TestEntity);
-    }
-
-    @Test
-    public void testMemberSpecEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t1",
-                "  item_type: template",
-                "  name: myT1",
-                "  item:",
-                "    services:",
-                "    - type: " + TestEntity.class.getName());
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: t2",
-                "  item_type: template",
-                "  name: myT2",
-                "  item:",
-                "    services:",
-                "    - type: " + DynamicCluster.class.getName(),
-                "      brooklyn.config:",
-                "        memberSpec:",
-                "          $brooklyn:entitySpec:",
-                "            type: t1",
-                "        cluster.initial.size: 1");
-
-        Entity app = createAndStartApplication(
-                "location: localhost",
-                "services:",
-                "- type: t2");
-        waitForApplicationTasks(app);
-        
-        Entities.dumpInfo(app);
-        DynamicCluster t2 = (DynamicCluster) Iterables.getOnlyElement(app.getChildren());
-        Entity t1 = Iterables.getOnlyElement(t2.getMembers());
-        assertEquals(t1.getChildren().size(), 0);
-        
-        assertTrue(app instanceof BasicApplication);
-        assertTrue(t2 instanceof DynamicCluster);
-        assertTrue(t1 instanceof TestEntity);
-    }
-
-    @Test
-    public void testMetadataOnSpecCreatedFromItem() throws Exception {
-        makeItem();
-        EntitySpec<? extends Application> spec = EntityManagementUtils.createEntitySpecForApplication(mgmt(), 
-            "services: [ { type: t1 } ]\n" +
-            "location: localhost");
-        
-        List<NamedStringTag> yamls = BrooklynTags.findAll(BrooklynTags.YAML_SPEC_KIND, spec.getTags());
-        Assert.assertEquals(yamls.size(), 1, "Expected 1 yaml tag; instead had: "+yamls);
-        String yaml = Iterables.getOnlyElement(yamls).getContents();
-        Asserts.assertStringContains(yaml, "services:", "t1", "localhost");
-        
-        EntitySpec<?> child = Iterables.getOnlyElement( spec.getChildren() );
-        Assert.assertEquals(child.getType().getName(), SIMPLE_ENTITY_TYPE);
-        Assert.assertEquals(child.getCatalogItemId(), "t1:"+TEST_VERSION);
-    }
-    
-    @Test
-    public void testMetadataOnSpecCreatedFromItemReferencingAnApp() throws Exception {
-        // this nested ref to an app caused nested plan contents also to be recorded,
-        // due to how tags are merged. the *first* one is the most important, however,
-        // and ordering of tags should guarantee that.
-        // similarly ensure we get the right outermost non-null catalog item id.
-        addCatalogItems(
-              "brooklyn.catalog:",
-              "  version: '1'",
-              "  items:",
-              "  - id: app1",
-              "    name: myApp1",
-              "    item:",
-              "      type: org.apache.brooklyn.entity.stock.BasicApplication",
-              "      brooklyn.config: { foo: bar }",
-              "  - id: app1r",
-              "    item_type: template",
-              "    item:",
-              "      services:",
-              "      - type: app1",
-              "        brooklyn.config:",
-              "          foo: boo"
-            );
-        
-        EntitySpec<? extends Application> spec = EntityManagementUtils.createEntitySpecForApplication(mgmt(),
-            "services: [ { type: app1r } ]\n" +
-            "location: localhost");
-        
-        List<NamedStringTag> yamls = BrooklynTags.findAll(BrooklynTags.YAML_SPEC_KIND, spec.getTags());
-        Assert.assertTrue(yamls.size() >= 1, "Expected at least 1 yaml tag; instead had: "+yamls);
-        String yaml = yamls.iterator().next().getContents();
-        Asserts.assertStringContains(yaml, "services:", "type: app1r", "localhost");
-        
-        Assert.assertEquals(spec.getChildren().size(), 0);
-        Assert.assertEquals(spec.getType(), BasicApplication.class);
-        Assert.assertEquals(ConfigBag.newInstance(spec.getConfig()).getStringKey("foo"), "boo");
-        Assert.assertEquals(spec.getCatalogItemId(), "app1r:1");
-    }
-    
-    private RegisteredType makeItem() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: t1",
-            "  item_type: template",
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    services:",
-            "    # this sample comment should be included",
-            "    - type: " + SIMPLE_ENTITY_TYPE);
-
-        return mgmt().getTypeRegistry().get("t1", TEST_VERSION);
-    }
-
-    // convenience for running in eclipse when the TestNG plugin drags in old version of snake yaml
-    public static void main(String[] args) {
-        TestListenerAdapter tla = new TestListenerAdapter();
-        TestNG testng = new TestNG();
-        testng.setTestClasses(new Class[] { CatalogYamlTemplateTest.class });
-        testng.addListener(tla);
-        testng.run();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
deleted file mode 100644
index 440c114..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
+++ /dev/null
@@ -1,269 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-public class CatalogYamlVersioningTest extends AbstractYamlTest {
-    
-    private BrooklynTypeRegistry types;
-    
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() {
-        super.setUp();
-        types = mgmt().getTypeRegistry();
-    }
-
-    @Test
-    public void testAddItem() {
-        String symbolicName = "sampleId";
-        String version = "0.1.0";
-        addCatalogEntity(symbolicName, version);
-        assertSingleCatalogItem(symbolicName, version);
-    }
-
-    @Test
-    public void testAddUnversionedItem() {
-        String symbolicName = "sampleId";
-        addCatalogEntity(symbolicName, null);
-        assertSingleCatalogItem(symbolicName, BasicBrooklynCatalog.NO_VERSION);
-    }
-
-    @Test
-    public void testAddSameVersionFailsWhenIconIsDifferent() {
-        String symbolicName = "sampleId";
-        String version = "0.1.0";
-        addCatalogEntity(symbolicName, version);
-        addCatalogEntity(symbolicName, version);
-        try {
-            addCatalogEntity(symbolicName, version, BasicEntity.class.getName(), "classpath:/another/icon.png");
-            fail("Expected to fail");
-        } catch (IllegalStateException e) {
-            assertEquals(e.getMessage(), "Updating existing catalog entries is forbidden: " + symbolicName + ":" + version + ". Use forceUpdate argument to override.");
-        }
-    }
-    
-    @Test
-    public void testAddSameVersionForce() {
-        String symbolicName = "sampleId";
-        String version = "0.1.0";
-        addCatalogEntity(symbolicName, version);
-        forceCatalogUpdate();
-        String expectedType = "org.apache.brooklyn.entity.stock.BasicApplication";
-        addCatalogEntity(symbolicName, version, expectedType);
-        RegisteredType item = types.get(symbolicName, version);
-        String yaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        assertTrue(yaml.contains(expectedType), "Version not updated:\n"+yaml);
-    }
-    
-    @Test
-    public void testGetLatest() {
-        String symbolicName = "sampleId";
-        String v1 = "0.1.0";
-        String v2 = "0.2.0";
-        addCatalogEntity(symbolicName, v1);
-        addCatalogEntity(symbolicName, v2);
-        RegisteredType item = types.get(symbolicName, BasicBrooklynCatalog.DEFAULT_VERSION);
-        assertEquals(item.getVersion(), v2);
-    }
-    
-    @Test
-    public void testGetLatestStable() {
-        String symbolicName = "sampleId";
-        String v1 = "0.1.0";
-        String v2 = "0.2.0-SNAPSHOT";
-        addCatalogEntity(symbolicName, v1);
-        addCatalogEntity(symbolicName, v2);
-        RegisteredType item = types.get(symbolicName, BasicBrooklynCatalog.DEFAULT_VERSION);
-        assertEquals(item.getVersion(), v1);
-    }
-
-    @Test
-    public void testDelete() {
-        String symbolicName = "sampleId";
-        String version = "0.1.0";
-        addCatalogEntity(symbolicName, version);
-        
-        Iterable<RegisteredType> matches;
-        matches = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        assertTrue(matches.iterator().hasNext());
-        
-        mgmt().getCatalog().deleteCatalogItem(symbolicName, version);
-        matches = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        assertFalse(matches.iterator().hasNext());
-    }
-    
-    @Test
-    public void testDeleteDefault() {
-        String symbolicName = "sampleId";
-        addCatalogEntity(symbolicName, null);
-
-        Iterable<RegisteredType> matches;
-        matches = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        assertTrue(matches.iterator().hasNext());
-        
-        mgmt().getCatalog().deleteCatalogItem(symbolicName, BasicBrooklynCatalog.NO_VERSION);
-        matches = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        assertFalse(matches.iterator().hasNext());
-    }
-    
-    @Test
-    public void testList() {
-        String symbolicName = "sampleId";
-        String v1 = "0.1.0";
-        String v2 = "0.2.0-SNAPSHOT";
-        addCatalogEntity(symbolicName, v1);
-        addCatalogEntity(symbolicName, v2);
-        Iterable<RegisteredType> items = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        assertEquals(Iterables.size(items), 2);
-    }
-    
-    @Test
-    public void testVersionedReference() throws Exception {
-        String symbolicName = "sampleId";
-        String parentName = "parentId";
-        String v1 = "0.1.0";
-        String v2 = "0.2.0";
-        String expectedType = BasicApplication.class.getName();
-
-        addCatalogEntity(symbolicName, v1, expectedType);
-        addCatalogEntity(symbolicName, v2);
-        addCatalogEntity(parentName, v1, symbolicName + ":" + v1);
-
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + parentName + ":" + v1);
-
-        assertEquals(app.getEntityType().getName(), expectedType);
-    }
-
-    @Test
-    public void testUnversionedReference() throws Exception {
-        String symbolicName = "sampleId";
-        String parentName = "parentId";
-        String v1 = "0.1.0";
-        String v2 = "0.2.0";
-        String expectedType = BasicApplication.class.getName();
-
-        addCatalogEntity(symbolicName, v1);
-        addCatalogEntity(symbolicName, v2, expectedType);
-        addCatalogEntity(parentName, v1, symbolicName);
-
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + parentName + ":" + v1);
-
-        assertEquals(app.getEntityType().getName(), expectedType);
-    }
-
-    private void doTestVersionedReferenceJustAdded(boolean isVersionImplicitSyntax) throws Exception {
-        addCatalogItems(            "brooklyn.catalog:",
-            "  version: 0.9",
-            "  items:",
-            "  - id: referrent",
-            "    item:",
-            "      type: "+BasicEntity.class.getName(),
-            "  - id: referrent",
-            "    version: 1.1",
-            "    item:",
-            "      type: "+BasicEntity.class.getName(),
-            "      brooklyn.config: { foo: bar }",
-            "  - id: referrer",
-            "    version: 1.0",
-            "    item:",
-            (isVersionImplicitSyntax ? 
-                "      type: referrent:1.1" :
-                "      type: referrent\n" +
-                "      version: 1.1"));
-        
-        Iterable<RegisteredType> items = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo("referrer")));
-        Assert.assertEquals(Iterables.size(items), 1, "Wrong number of: "+items);
-        RegisteredType item = Iterables.getOnlyElement(items);
-        Assert.assertEquals(item.getVersion(), "1.0");
-        
-        Entity app = createAndStartApplication(
-            "services:",
-            (isVersionImplicitSyntax ? 
-                "- type: referrer:1.0" :
-                "- type: referrer\n" +
-                "  version: 1.0") );
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertTrue(child instanceof BasicEntity, "Wrong child: "+child);
-        Assert.assertEquals(child.getConfig(ConfigKeys.newStringConfigKey("foo")), "bar");
-    }
-
-    @Test
-    public void testVersionedReferenceJustAddedExplicitVersion() throws Exception {
-        doTestVersionedReferenceJustAdded(false);
-    }
-    
-    @Test
-    public void testVersionedReferenceJustAddedImplicitVersionSyntax() throws Exception {
-        doTestVersionedReferenceJustAdded(true);
-    }
-    
-    private void assertSingleCatalogItem(String symbolicName, String version) {
-        Iterable<RegisteredType> items = types.getMatching(RegisteredTypePredicates.symbolicName(Predicates.equalTo(symbolicName)));
-        RegisteredType item = Iterables.getOnlyElement(items);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        assertEquals(item.getVersion(), version);
-    }
-    
-    private void addCatalogEntity(String symbolicName, String version) {
-        addCatalogEntity(symbolicName, version, BasicEntity.class.getName());
-    }
-
-    private void addCatalogEntity(String symbolicName, String version, String type) {
-        addCatalogEntity(symbolicName, version, type, "classpath://path/to/myicon.jpg");
-    }
-    
-    private void addCatalogEntity(String symbolicName, String version, String type, String iconUrl) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: "+iconUrl,
-            (version != null ? "  version: " + version : ""),
-            "",
-            "services:",
-            "- type: " + type);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
deleted file mode 100644
index 869ebc0..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
+++ /dev/null
@@ -1,156 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.objs.SpecParameter;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-import com.google.common.reflect.TypeToken;
-
-public class SpecParameterParsingTest  extends AbstractYamlTest {
-    
-    @Test
-    public void testYamlInputsParsed() {
-        String itemId = add(
-                "brooklyn.catalog:",
-                "  id: test.inputs",
-                "  version: 0.0.1",
-                "  item: ",
-                "    type: "+ BasicApplication.class.getName(),
-                "    brooklyn.parameters:",
-                "    - simple",
-                "    - name: explicit_name",
-                "    - name: third_input",
-                "      type: integer");
-        EntitySpec<?> item = mgmt().getTypeRegistry().createSpec(mgmt().getTypeRegistry().get(itemId), null, EntitySpec.class);
-        List<SpecParameter<?>> inputs = item.getParameters();
-        assertEquals(inputs.size(), 3);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-        assertEquals(firstInput.isPinned(), true);
-        assertEquals(firstInput.getConfigKey().getName(), "simple");
-        assertEquals(firstInput.getConfigKey().getTypeToken(), TypeToken.of(String.class));
-        
-        SpecParameter<?> secondInput = inputs.get(1);
-        assertEquals(secondInput.getLabel(), "explicit_name");
-        assertEquals(secondInput.isPinned(), true);
-        assertEquals(secondInput.getConfigKey().getName(), "explicit_name");
-        assertEquals(secondInput.getConfigKey().getTypeToken(), TypeToken.of(String.class));
-        
-        SpecParameter<?> thirdInput = inputs.get(2);
-        assertEquals(thirdInput.getLabel(), "third_input");
-        assertEquals(thirdInput.isPinned(), true);
-        assertEquals(thirdInput.getConfigKey().getName(), "third_input");
-        assertEquals(thirdInput.getConfigKey().getTypeToken(), TypeToken.of(Integer.class));
-    }
-
-    @Test
-    public void testOsgiType() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String itemId = add(
-                "brooklyn.catalog:",
-                "  id: test.inputs",
-                "  version: 0.0.1",
-                "  libraries:",
-                "  - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH,
-                "  item: ",
-                "    type: "+ BasicApplication.class.getName(),
-                "    brooklyn.parameters:",
-                "    - name: simple",
-                "      type: " + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(itemId);
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-        assertTrue(firstInput.isPinned());
-        assertEquals(firstInput.getConfigKey().getName(), "simple");
-        assertEquals(firstInput.getConfigKey().getTypeToken().getRawType().getName(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY);
-    }
-
-    @Test
-    public void testOsgiClassScanned() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH);
-
-        addMulti("brooklyn.catalog:",
-            "    items:",
-            "    - scanJavaAnnotations: true",
-            "      version: 2.0.test_java",
-            "      libraries:",
-            "      - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH,
-            "      - classpath://" + OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY);
-        assertEquals(item.getVersion(), "2.0.test_java");
-        assertEquals(item.getLibraries().size(), 2);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        if (inputs.isEmpty()) Assert.fail("no inputs (if you're in the IDE, mvn clean install may need to be run to rebuild osgi test JARs)");
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> input = inputs.get(0);
-        assertEquals(input.getLabel(), "more_config");
-        assertFalse(input.isPinned());
-        assertEquals(input.getConfigKey().getName(), "more_config");
-    }
-
-    private String add(String... def) {
-        return Iterables.getOnlyElement(addMulti(def));
-    }
-
-    private Iterable<String> addMulti(String... def) {
-        return Iterables.transform(catalog.addItems(Joiner.on('\n').join(def)),
-            new Function<CatalogItem<?,?>, String>() {
-                @Override
-                public String apply(CatalogItem<?, ?> input) {
-                    return input.getId();
-                }
-            });
-    }
-
-    private AbstractBrooklynObjectSpec<?, ?> createSpec(String itemId) {
-        RegisteredType item = mgmt().getTypeRegistry().get(itemId);
-        Assert.assertNotNull(item, "Could not load: "+itemId);
-        return createSpec(item);
-    }
-    
-    private AbstractBrooklynObjectSpec<?, ?> createSpec(RegisteredType item) {
-        return mgmt().getTypeRegistry().createSpec(item, null, EntitySpec.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
deleted file mode 100644
index 1f7ba48..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
+++ /dev/null
@@ -1,379 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.SpecParameter;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.objs.BasicSpecParameter;
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.testng.SkipException;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-public class SpecParameterUnwrappingTest extends AbstractYamlTest {
-    private static final String SYMBOLIC_NAME = "my.catalog.app.id.load";
-
-    private static final ConfigKey<String> SHARED_CONFIG = ConfigKeys.newStringConfigKey("sample.config");
-    public static class ConfigAppForTest extends AbstractApplication {
-        public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG;
-    }
-    public static class ConfigEntityForTest extends AbstractEntity {
-        public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG;
-    }
-    public static class ConfigPolicyForTest extends AbstractPolicy {
-        public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG;
-    }
-    public static class ConfigLocationForTest extends AbstractLocation {
-        public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG;
-    }
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        // Don't need OSGi
-        return LocalManagementContextForTests.newInstance();
-    }
-
-    @DataProvider(name="brooklynTypes")
-    public Object[][] brooklynTypes() {
-        return new Object[][] {
-            {ConfigEntityForTest.class},
-            {ConfigPolicyForTest.class},
-            {ConfigLocationForTest.class}};
-    }
-
-    @Test(dataProvider = "brooklynTypes")
-    public void testParameters(Class<? extends BrooklynObject> testClass) {
-        addCatalogItems("brooklyn.catalog:",
-                        "  id: " + SYMBOLIC_NAME,
-                        "  version: " + TEST_VERSION,
-                        "  item:",
-                        "    type: " + testClass.getName(),
-                        "    brooklyn.parameters:",
-                        "    - simple");
-
-        ConfigKey<String> SIMPLE_CONFIG = ConfigKeys.newStringConfigKey("simple");
-        SpecParameter<String> SIMPLE_PARAM = new BasicSpecParameter<>("simple", true, SIMPLE_CONFIG);
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
-        assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableList.of(SIMPLE_PARAM));
-    }
-
-    @Test(dataProvider = "brooklynTypes")
-    public void testDefaultParameters(Class<? extends BrooklynObject> testClass) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + SYMBOLIC_NAME,
-            "  version: " + TEST_VERSION,
-            "  item:",
-            "    type: "+ testClass.getName());
-
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        AbstractBrooklynObjectSpec<?, ?> spec = createSpec(item);
-        assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(),testClass)));
-    }
-
-    @Test
-    public void testRootParametersUnwrapped() {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + SYMBOLIC_NAME,
-                "  version: " + TEST_VERSION,
-                "  item:",
-                "    services:",
-                "    - type: " + ConfigEntityForTest.class.getName(),
-                "    brooklyn.parameters:",
-                "    - simple");
-
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test(dataProvider="brooklynTypes")
-    public void testDepentantCatalogsInheritParameters(Class<? extends BrooklynObject> type) {
-        if (type == ConfigLocationForTest.class) {
-            //TODO
-            throw new SkipException("Locations don't inherit parameters, should migrate to the type registry first");
-        }
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: paramItem",
-                "    item:",
-                "      type: " + type.getName(),
-                "      brooklyn.parameters:",
-                "      - simple",
-                "  - id: " + SYMBOLIC_NAME,
-                "    item:",
-                "      type: paramItem:" + TEST_VERSION);
-
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test(dataProvider="brooklynTypes")
-    public void testDepentantCatalogsOverrideParameters(Class<? extends BrooklynObject> type) {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: paramItem",
-                "    item:",
-                "      type: " + type.getName(),
-                "      brooklyn.parameters:",
-                "      - simple",
-                "  - id: " + SYMBOLIC_NAME,
-                "    item:",
-                // Don't set explicit version, not supported by locations
-                "      type: paramItem",
-                "      brooklyn.parameters:",
-                "      - override");
-
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "override");
-    }
-
-    @Test
-    public void testChildEntitiyHasParameters() {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + SYMBOLIC_NAME,
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - item:",
-                "      type: " + ConfigEntityForTest.class.getName(),
-                "      brooklyn.children:",
-                "      - type: " + ConfigEntityForTest.class.getName(),
-                "        brooklyn.parameters:",
-                "        - simple");
-
-        CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
-        @SuppressWarnings({ "rawtypes", "unchecked"})
-        EntitySpec<?> parentSpec = (EntitySpec<?>) catalog.createSpec((CatalogItem)item);
-        EntitySpec<?> spec = parentSpec.getChildren().get(0);
-        SpecParameter<?> firstInput = spec.getParameters().get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test
-    public void testAppSpecInheritsCatalogParameters() {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: " + SYMBOLIC_NAME,
-                "    item:",
-                "      type: " + BasicApplication.class.getName(),
-                "      brooklyn.parameters:",
-                "      - simple");
-
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "services:",
-                "- type: " + ver(SYMBOLIC_NAME));
-        List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 1);
-        SpecParameter<?> firstInput = params.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-
-    @Test
-    public void testAppSpecInheritsCatalogRootParameters() {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: " + SYMBOLIC_NAME,
-                "    item:",
-                "      type: " + BasicApplication.class.getName(),
-                "      brooklyn.parameters:",
-                "      - simple");
-
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "services:",
-                "- type: " + ver(SYMBOLIC_NAME));
-        List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 1);
-        SpecParameter<?> firstInput = params.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test
-    public void testAppSpecInheritsCatalogRootParametersWithServices() {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: " + SYMBOLIC_NAME,
-                "    item:",
-                "      brooklyn.parameters:",
-                "      - simple",
-                "      services:",
-                "      - type: " + BasicApplication.class.getName());
-
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "services:",
-                "- type: " + ver(SYMBOLIC_NAME));
-        List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 1);
-        SpecParameter<?> firstInput = params.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test
-    public void testUnresolvedCatalogItemParameters() {
-        // Insert template which is not instantiatable during catalog addition due to
-        // missing dependencies, but the spec can be created (the
-        // dependencies are already parsed).
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  version: " + TEST_VERSION,
-                "  items:",
-                "  - id: " + SYMBOLIC_NAME,
-                "    itemType: template",
-                "    item:",
-                "      services:",
-                "      - type: basic-app",
-                "  - id: basic-app",
-                "    item:",
-                "      type: " + ConfigAppForTest.class.getName());
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "services:",
-                "- type: " + ver(SYMBOLIC_NAME));
-        List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 2); // sample + defaultDisplayName
-        assertEquals(ImmutableSet.copyOf(params), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(), ConfigAppForTest.class)));
-    }
-
-    @Test
-    public void testParametersCoercedOnSetAndReferences() throws Exception {
-        Integer testValue = Integer.valueOf(55);
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + SYMBOLIC_NAME,
-                "  version: " + TEST_VERSION,
-                "  item:",
-                "    type: " + BasicApplication.class.getName(),
-                "    brooklyn.parameters:",
-                "    - name: num",
-                "      type: integer",
-                "    brooklyn.children:",
-                "    - type: " + ConfigEntityForTest.class.getName(),
-                "      brooklyn.config:",
-                "        refConfig: $brooklyn:scopeRoot().config(\"num\")",
-                "    - type: " + ConfigEntityForTest.class.getName(),
-                "      brooklyn.config:",
-                "        refConfig: $brooklyn:config(\"num\")"); //inherited config
-
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "  brooklyn.children:",
-                "  - type: " + ver(SYMBOLIC_NAME),
-                "    brooklyn.config:",
-                "      num: \"" + testValue + "\"");
-
-        Entity scopeRoot = Iterables.getOnlyElement(app.getChildren());
-
-        ConfigKey<Object> numKey = ConfigKeys.newConfigKey(Object.class, "num");
-        assertEquals(scopeRoot.config().get(numKey), testValue);
-
-        ConfigKey<Object> refConfigKey = ConfigKeys.newConfigKey(Object.class, "refConfig");
-
-        Iterator<Entity> childIter = scopeRoot.getChildren().iterator();
-        Entity c1 = childIter.next();
-        assertEquals(c1.config().get(refConfigKey), testValue);
-        Entity c2 = childIter.next();
-        assertEquals(c2.config().get(refConfigKey), testValue);
-        assertFalse(childIter.hasNext());
-    }
-
-    @Test
-    public void testAppRootParameters() throws Exception {
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "brooklyn.parameters:",
-                "- simple",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @Test
-    public void testAppServiceParameters() throws Exception {
-        EntitySpec<? extends Application> spec = createAppSpec(
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "  brooklyn.parameters:",
-                "  - simple");
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 1);
-        SpecParameter<?> firstInput = inputs.get(0);
-        assertEquals(firstInput.getLabel(), "simple");
-    }
-
-    @SuppressWarnings({"unchecked", "rawtypes"})
-    private AbstractBrooklynObjectSpec<?, ?> createSpec(CatalogItem<?, ?> item) {
-        return (AbstractBrooklynObjectSpec<?,?>) catalog.createSpec((CatalogItem)item);
-    }
-
-    private EntitySpec<? extends Application> createAppSpec(String... lines) {
-        return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(lines));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicApp.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicApp.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicApp.java
deleted file mode 100644
index ccd52e4..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicApp.java
+++ /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.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-
-@ImplementedBy(TestBasicAppImpl.class)
-public interface TestBasicApp extends BasicApplication {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicAppImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicAppImpl.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicAppImpl.java
deleted file mode 100644
index 358f2c7..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/TestBasicAppImpl.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 org.apache.brooklyn.camp.brooklyn.catalog;
-
-import org.apache.brooklyn.entity.stock.BasicApplicationImpl;
-
-public class TestBasicAppImpl extends BasicApplicationImpl implements TestBasicApp {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
deleted file mode 100644
index 360b705..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
+++ /dev/null
@@ -1,67 +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.brooklyn.policy;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.test.Asserts;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-public class CreatePasswordSensorIntegrationTest extends AbstractYamlTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CreatePasswordSensorIntegrationTest.class);
-    AttributeSensor<String> PASSWORD_1 = Sensors.newStringSensor("test.password.1", "Host name as known internally in " +
-            "the subnet where it is running (if different to host.name)");
-    AttributeSensor<String> PASSWORD_2 = Sensors.newStringSensor("test.password.2", "Host name as known internally in " +
-            "the subnet where it is running (if different to host.name)");
-
-    @Test(groups = "Integration")
-    public void testProvisioningProperties() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("EmptySoftwareProcessWithPassword.yaml"));
-
-        waitForApplicationTasks(app);
-        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptySoftwareProcess.class));
-
-        assertPasswordLength(entity, PASSWORD_1, 15);
-
-        assertPasswordOnlyContains(entity, PASSWORD_2, "abc");
-
-    }
-
-    private void assertPasswordOnlyContains(EmptySoftwareProcess entity, AttributeSensor<String> password, String acceptableChars) {
-        String attribute_2 = entity.getAttribute(password);
-        for (char c : attribute_2.toCharArray()) {
-            Asserts.assertTrue(acceptableChars.indexOf(c) != -1);
-        }
-    }
-
-    private void assertPasswordLength(EmptySoftwareProcess entity, AttributeSensor<String> password, int expectedLength) {
-        String attribute_1 = entity.getAttribute(password);
-        Asserts.assertEquals(attribute_1.length(), expectedLength);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverTest.java
deleted file mode 100644
index cbaccf0..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ServiceTypeResolverTest.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 org.apache.brooklyn.camp.brooklyn.spi.creation.service;
-
-import static org.testng.Assert.assertEquals;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.testng.annotations.Test;
-
-
-public class ServiceTypeResolverTest extends AbstractYamlTest {
-    
-    @Test
-    public void testAddCatalogItemVerySimple() throws Exception {
-        EntitySpec<?> spec = createAppEntitySpec(
-                "services:",
-                "- type: \"test-resolver:" + BasicEntity.class.getName() + "\"");
-        assertEquals(spec.getChildren().get(0).getFlags().get("resolver"), TestServiceTypeResolver.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/TestServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/TestServiceTypeResolver.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/TestServiceTypeResolver.java
deleted file mode 100644
index 7fd6d8a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/TestServiceTypeResolver.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 org.apache.brooklyn.camp.brooklyn.spi.creation.service;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.util.text.Strings;
-
-@SuppressWarnings("deprecation")
-public class TestServiceTypeResolver implements ServiceTypeResolver {
-
-    private static final String PREFIX = "test-resolver";
-
-    @Override
-    public String getTypePrefix() {
-        return PREFIX;
-    }
-
-    @Override
-    public String getBrooklynType(String serviceType) {
-        return Strings.removeFromStart(serviceType, PREFIX + ":");
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public CatalogItem<Entity, EntitySpec<?>> getCatalogItem(BrooklynComponentTemplateResolver resolver, String serviceType) {
-        return (CatalogItem<Entity, EntitySpec<?>>) CatalogUtils.getCatalogItemOptionalVersion(resolver.getManagementContext(), getBrooklynType(serviceType));
-    }
-
-    @Override
-    public <T extends Entity> void decorateSpec(BrooklynComponentTemplateResolver resolver, EntitySpec<T> spec) {
-        spec.configure("resolver", TestServiceTypeResolver.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslParseTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslParseTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslParseTest.java
deleted file mode 100644
index ca754c5..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslParseTest.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 org.apache.brooklyn.camp.brooklyn.spi.dsl;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-
-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.util.text.StringEscapes.JavaStringEscapes;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-@Test
-public class DslParseTest {
-
-    public void testParseString() {
-        assertEquals(new DslParser("\"hello world\"").parse(), new QuotedString(JavaStringEscapes.wrapJavaString("hello world")));
-    }
-
-    public void testParseNoArgFunction() {
-        Object fx = new DslParser("f()").parse();
-        fx = Iterables.getOnlyElement( (List<?>)fx );
-        assertEquals( ((FunctionWithArgs)fx).getFunction(), "f" );
-        assertEquals( ((FunctionWithArgs)fx).getArgs(), ImmutableList.of());
-    }
-    
-    public void testParseOneArgFunction() {
-        Object fx = new DslParser("f(\"x\")").parse();
-        fx = Iterables.getOnlyElement( (List<?>)fx );
-        assertEquals( ((FunctionWithArgs)fx).getFunction(), "f" );
-        assertEquals( ((FunctionWithArgs)fx).getArgs(), Arrays.asList(new QuotedString("\"x\"")) );
-    }
-    
-    public void testParseMultiArgMultiTypeFunction() {
-        // TODO Parsing "f(\"x\", 1)" fails, because it interprets 1 as a function rather than a number. Is that expected?
-        Object fx = new DslParser("f(\"x\", \"y\")").parse();
-        fx = Iterables.getOnlyElement( (List<?>)fx );
-        assertEquals( ((FunctionWithArgs)fx).getFunction(), "f" );
-        assertEquals( ((FunctionWithArgs)fx).getArgs(), ImmutableList.of(new QuotedString("\"x\""), new QuotedString("\"y\"")));
-    }
-
-    
-    public void testParseFunctionChain() {
-        Object fx = new DslParser("f(\"x\").g()").parse();
-        assertTrue(((List<?>)fx).size() == 2, ""+fx);
-        Object fx1 = ((List<?>)fx).get(0);
-        Object fx2 = ((List<?>)fx).get(1);
-        assertEquals( ((FunctionWithArgs)fx1).getFunction(), "f" );
-        assertEquals( ((FunctionWithArgs)fx1).getArgs(), ImmutableList.of(new QuotedString("\"x\"")) );
-        assertEquals( ((FunctionWithArgs)fx2).getFunction(), "g" );
-        assertTrue( ((FunctionWithArgs)fx2).getArgs().isEmpty() );
-    }
-    
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampPlatformWithJustBrooklynMgmt.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampPlatformWithJustBrooklynMgmt.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampPlatformWithJustBrooklynMgmt.java
deleted file mode 100644
index 20681a6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampPlatformWithJustBrooklynMgmt.java
+++ /dev/null
@@ -1,41 +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.brooklyn.test.lite;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.BasicCampPlatform;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.HasBrooklynManagementContext;
-
-public class CampPlatformWithJustBrooklynMgmt extends BasicCampPlatform implements HasBrooklynManagementContext {
-
-    private ManagementContext mgmt;
-
-    public CampPlatformWithJustBrooklynMgmt(ManagementContext mgmt) {
-        this.mgmt = mgmt;
-        ((BrooklynProperties)mgmt.getConfig()).put(BrooklynCampConstants.CAMP_PLATFORM, this);
-    }
-    
-    @Override
-    public ManagementContext getBrooklynManagementContext() {
-        return mgmt;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
deleted file mode 100644
index 9cd6bc5..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
+++ /dev/null
@@ -1,261 +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.brooklyn.test.lite;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-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;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.AddChildrenEffector;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-/** Tests of lightweight CAMP integration. Since the "real" integration is in brooklyn-camp project,
- * but some aspects of CAMP we want to be able to test here. */
-public class CampYamlLiteTest {
-    private static final String TEST_VERSION = "0.1.2";
-
-    private static final Logger log = LoggerFactory.getLogger(CampYamlLiteTest.class);
-    
-    protected LocalManagementContext mgmt;
-    protected CampPlatformWithJustBrooklynMgmt platform;
-    
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() {
-        mgmt = LocalManagementContextForTests.newInstanceWithOsgi();
-        platform = new CampPlatformWithJustBrooklynMgmt(mgmt);
-        MockWebPlatform.populate(platform, TestAppAssemblyInstantiator.class);
-    }
-    
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() {
-        if (mgmt!=null) mgmt.terminate();
-    }
-    
-    /** based on {@link PdpYamlTest} for parsing,
-     * then creating a {@link TestAppAssembly} */
-    @Test
-    public void testYamlServiceMatchAndBrooklynInstantiate() throws Exception {
-        Reader input = new InputStreamReader(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
-        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-        log.info("AT is:\n"+at.toString());
-        Assert.assertEquals(at.getName(), "sample");
-        Assert.assertEquals(at.getPlatformComponentTemplates().links().size(), 1);
-        
-        // now use brooklyn to instantiate - note it won't be faithful, but it will set some config keys
-        Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-        
-        TestApplication app = ((TestAppAssembly)assembly).getBrooklynApp();
-        Assert.assertEquals( app.getConfig(TestEntity.CONF_NAME), "sample" );
-        Map<String, String> map = app.getConfig(TestEntity.CONF_MAP_THING);
-        Assert.assertEquals( map.get("desc"), "Tomcat sample JSP and servlet application." );
-        
-        Assert.assertEquals( app.getChildren().size(), 1 );
-        Entity svc = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertEquals( svc.getConfig(TestEntity.CONF_NAME), "Hello WAR" );
-        map = svc.getConfig(TestEntity.CONF_MAP_THING);
-        Assert.assertEquals( map.get("type"), MockWebPlatform.APPSERVER.getType() );
-        // desc ensures we got the information from the matcher, as this value is NOT in the yaml
-        Assert.assertEquals( map.get("desc"), MockWebPlatform.APPSERVER.getDescription() );
-    }
-
-    /** based on {@link PdpYamlTest} for parsing,
-     * then creating a {@link TestAppAssembly} */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Test
-    public void testAddChildrenEffector() throws Exception {
-        String childYaml = Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
-        AddChildrenEffector newEff = new AddChildrenEffector(ConfigBag.newInstance()
-            .configure(AddChildrenEffector.EFFECTOR_NAME, "add_tomcat")
-            .configure(AddChildrenEffector.BLUEPRINT_YAML, childYaml)
-            .configure(AddChildrenEffector.EFFECTOR_PARAMETER_DEFS, MutableMap.of("war", (Object)MutableMap.of(
-                "defaultValue", "foo.war"))) ) ;
-        TestApplication app = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class).addInitializer(newEff));
-
-        // test adding, with a parameter
-        Task<List> task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.of("war", "foo.bar"));
-        List result = task.get();
-        
-        Entity newChild = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.bar");
-        
-        Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
-        Entities.unmanage(newChild);
-        
-        // and test default value
-        task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.<String,Object>of());
-        result = task.get();
-        
-        newChild = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.war");
-        
-        Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
-        Entities.unmanage(newChild);
-    }
-
-    @Test
-    public void testYamlServiceForCatalog() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        CatalogItem<?, ?> realItem = Iterables.getOnlyElement(mgmt.getCatalog().addItems(Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"))));
-        Iterable<CatalogItem<Object, Object>> retrievedItems = mgmt.getCatalog()
-                .getCatalogItems(CatalogPredicates.symbolicName(Predicates.equalTo("catalog-name")));
-        
-        Assert.assertEquals(Iterables.size(retrievedItems), 1, "Wrong retrieved items: "+retrievedItems);
-        CatalogItem<Object, Object> retrievedItem = Iterables.getOnlyElement(retrievedItems);
-        Assert.assertEquals(retrievedItem, realItem);
-
-        Collection<CatalogBundle> bundles = retrievedItem.getLibraries();
-        Assert.assertEquals(bundles.size(), 1);
-        CatalogBundle bundle = Iterables.getOnlyElement(bundles);
-        Assert.assertEquals(bundle.getUrl(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL);
-        Assert.assertEquals(bundle.getVersion(), "0.1.0");
-
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        EntitySpec<?> spec1 = (EntitySpec<?>) mgmt.getCatalog().createSpec((CatalogItem)retrievedItem);
-        assertNotNull(spec1);
-        Assert.assertEquals(spec1.getConfig().get(TestEntity.CONF_NAME), "sample");
-        
-        // TODO other assertions, about children
-    }
-
-    @Test
-    public void testRegisterCustomEntityWithBundleWhereEntityIsFromCoreAndIconFromBundle() throws IOException {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id";
-        String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
-        String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
-
-        mgmt.getCatalog().addItems(yaml);
-
-        assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
-    }
-
-    @Test
-    public void testResetXmlWithCustomEntity() throws IOException {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id";
-        String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
-        String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
-
-        LocalManagementContext mgmt2 = LocalManagementContextForTests.newInstanceWithOsgi();
-        try {
-            CampPlatformWithJustBrooklynMgmt platform2 = new CampPlatformWithJustBrooklynMgmt(mgmt2);
-            MockWebPlatform.populate(platform2, TestAppAssemblyInstantiator.class);
-
-            mgmt2.getCatalog().addItems(yaml);
-            String xml = ((BasicBrooklynCatalog) mgmt2.getCatalog()).toXmlString();
-            ((BasicBrooklynCatalog) mgmt.getCatalog()).reset(CatalogDto.newDtoFromXmlContents(xml, "copy of temporary catalog"));
-        } finally {
-            mgmt2.terminate();
-        }
-
-        assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
-    }
-
-    private String getSampleMyCatalogAppYaml(String symbolicName, String bundleUrl) {
-        return "brooklyn.catalog:\n" +
-                "  id: " + symbolicName + "\n" +
-                "  name: My Catalog App\n" +
-                "  description: My description\n" +
-                "  icon_url: classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif\n" +
-                "  version: " + TEST_VERSION + "\n" +
-                "  libraries:\n" +
-                "  - url: " + bundleUrl + "\n" +
-                "\n" +
-                "services:\n" +
-                "- type: io.camp.mock:AppServer\n";
-    }
-
-    private void assertMgmtHasSampleMyCatalogApp(String symbolicName, String bundleUrl) {
-        RegisteredType item = mgmt.getTypeRegistry().get(symbolicName);
-        assertNotNull(item, "failed to load item with id=" + symbolicName + " from catalog. Entries were: " +
-                Joiner.on(",").join(mgmt.getTypeRegistry().getAll()));
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        RegisteredTypes.tryValidate(item, RegisteredTypeLoadingContexts.spec(Entity.class)).get();
-        
-        // stored as yaml, not java
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        assertNotNull(planYaml);
-        Assert.assertTrue(planYaml.contains("io.camp.mock:AppServer"));
-
-        // and let's check we have libraries
-        Collection<OsgiBundleWithUrl> libs = item.getLibraries();
-        assertEquals(libs.size(), 1);
-        OsgiBundleWithUrl bundle = Iterables.getOnlyElement(libs);
-        assertEquals(bundle.getUrl(), bundleUrl);
-
-        // now let's check other things on the item
-        assertEquals(item.getDisplayName(), "My Catalog App");
-        assertEquals(item.getDescription(), "My description");
-        assertEquals(item.getIconUrl(), "classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif");
-
-        // and confirm we can resolve ICON
-        byte[] iconData = Streams.readFully(ResourceUtils.create(CatalogUtils.newClassLoadingContext(mgmt, item)).getResourceFromUrl(item.getIconUrl()));
-        assertEquals(iconData.length, 43);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssembly.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssembly.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssembly.java
deleted file mode 100644
index 877c00b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/TestAppAssembly.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.brooklyn.test.lite;
-
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-
-public class TestAppAssembly extends Assembly {
-
-    private TestApplication brooklynApp;
-
-    public TestAppAssembly(TestApplication brooklynApp) {
-        this.brooklynApp = brooklynApp;
-    }
-    
-    public TestApplication getBrooklynApp() {
-        return brooklynApp;
-    }
-    
-}


[05/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordPersisterToObjectStore.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordPersisterToObjectStore.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordPersisterToObjectStore.java
deleted file mode 100644
index 18bc5cc..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/ManagementPlaneSyncRecordPersisterToObjectStore.java
+++ /dev/null
@@ -1,364 +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.core.mgmt.ha;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister;
-import org.apache.brooklyn.core.mgmt.ha.dto.BasicManagementNodeSyncRecord;
-import org.apache.brooklyn.core.mgmt.ha.dto.ManagementPlaneSyncRecordImpl;
-import org.apache.brooklyn.core.mgmt.persist.MementoSerializer;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.RetryingMementoSerializer;
-import org.apache.brooklyn.core.mgmt.persist.StoreObjectAccessorLocking;
-import org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializer;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore.StoreObjectAccessorWithLock;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.Maps;
-
-/**
- * Structure of files is:
- * <ul>
- *   <li>{@code plane/} - top-level directory
- *     <ul>
- *       <li>{@code master} - contains the id of the management-node that is currently master
- *       <li>{@code change.log} - log of changes made
- *       <li>{@code nodes/} - sub-directory, containing one file per management-node
- *         <ul>
- *           <li>{@code a9WiuVKp} - file named after the management-node's id, containing the management node's current state
- *           <li>{@code E1eDXQF3}
- *         </ul>
- *     </ul>
- * </ul>
- * 
- * All writes are done synchronously.
- * 
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public class ManagementPlaneSyncRecordPersisterToObjectStore implements ManagementPlaneSyncRecordPersister {
-
-    // TODO Multiple node appending to change.log could cause strange interleaving, or perhaps even data loss?
-    // But this file is not critical to functionality.
-
-    // TODO Should ManagementPlaneSyncRecordPersister.Delta be different so can tell what is a significant event,
-    // and thus log it in change.log - currently only subset of significant things being logged.
-
-    private static final Logger LOG = LoggerFactory.getLogger(ManagementPlaneSyncRecordPersisterToObjectStore.class);
-
-    private static final Duration SHUTDOWN_TIMEOUT = Duration.TEN_SECONDS;
-    private static final Duration SYNC_WRITE_TIMEOUT = Duration.TEN_SECONDS;
-    public static final String NODES_SUB_PATH = "nodes";
-
-    // TODO Leak if we go through lots of managers; but tiny!
-    private final ConcurrentMap<String, StoreObjectAccessorWithLock> nodeWriters = Maps.newConcurrentMap();
-
-    private StoreObjectAccessorWithLock masterWriter;
-    private StoreObjectAccessorWithLock changeLogWriter;
-
-    private ManagementContext mgmt;
-    private final PersistenceObjectStore objectStore;
-    private final MementoSerializer<Object> serializer;
-
-    private static final int MAX_SERIALIZATION_ATTEMPTS = 5;
-
-    private boolean started = false;
-    private volatile boolean running = true;
-
-    protected final AtomicLong checkpointLogCount = new AtomicLong();
-    private static final int INITIAL_LOG_WRITES = 5;
-    
-    @VisibleForTesting
-    /** allows, when testing, to be able to override file times / blobstore times with time from the ticker */
-    private boolean preferRemoteTimestampInMemento = false;
-
-    /**
-     * @param mgmt not used much at present but handy to ensure we know it so that obj store is prepared
-     * @param objectStore the objectStore use to read/write management-plane data;
-     *   this must have been {@link PersistenceObjectStore#prepareForSharedUse(org.apache.brooklyn.core.mgmt.persist.PersistMode, HighAvailabilityMode)}
-     * @param classLoader ClassLoader to use when deserializing data
-     */
-    public ManagementPlaneSyncRecordPersisterToObjectStore(ManagementContext mgmt, PersistenceObjectStore objectStore, ClassLoader classLoader) {
-        this.mgmt = mgmt;
-        this.objectStore = checkNotNull(objectStore, "objectStore");
-
-        MementoSerializer<Object> rawSerializer = new XmlMementoSerializer<Object>(checkNotNull(classLoader, "classLoader"));
-        this.serializer = new RetryingMementoSerializer<Object>(rawSerializer, MAX_SERIALIZATION_ATTEMPTS);
-
-        objectStore.createSubPath(NODES_SUB_PATH);
-
-        LOG.debug("ManagementPlaneMemento-persister will use store "+objectStore);
-    }
-
-    protected synchronized void init() {
-        if (!started) {
-            started = true;
-            //Leading slash causes problems in SL, it's not a correct file name so remove it.
-            //But once removed we can't load the master file from existing persistence stores.
-            //Try to detect if the old file exists, if so use old-style names, otherwise use the correct names.
-            masterWriter = new StoreObjectAccessorLocking(objectStore.newAccessor("/master"));
-            if (masterWriter.get() != null) {
-                changeLogWriter = new StoreObjectAccessorLocking(objectStore.newAccessor("/change.log"));
-            } else {
-                masterWriter = new StoreObjectAccessorLocking(objectStore.newAccessor("master"));
-                changeLogWriter = new StoreObjectAccessorLocking(objectStore.newAccessor("change.log"));
-            }
-        }
-    }
-
-    @VisibleForTesting
-    public void preferRemoteTimestampInMemento() {
-        preferRemoteTimestampInMemento = true;
-    }
-    
-    @Override
-    public void stop() {
-        running = false;
-        try {
-            for (StoreObjectAccessorWithLock writer : nodeWriters.values()) {
-                try {
-                    writer.waitForCurrentWrites(SHUTDOWN_TIMEOUT);
-                } catch (TimeoutException e) {
-                    LOG.warn("Timeout during shutdown, waiting for write of "+writer+"; continuing");
-                }
-            }
-            try {
-                masterWriter.waitForCurrentWrites(SHUTDOWN_TIMEOUT);
-            } catch (TimeoutException e) {
-                LOG.warn("Timeout during shutdown, waiting for write of "+masterWriter+"; continuing");
-            }
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    public ManagementPlaneSyncRecord loadSyncRecord() throws IOException {
-        if (!running) {
-            throw new IllegalStateException("Persister not running; cannot load memento from "+ objectStore.getSummaryName());
-        }
-        init();
-        
-        // Note this is called a lot - every time we check the heartbeats
-        if (LOG.isTraceEnabled()) LOG.trace("Loading management-plane memento from {}", objectStore.getSummaryName());
-
-        Stopwatch stopwatch = Stopwatch.createStarted();
-
-        ManagementPlaneSyncRecordImpl.Builder builder = ManagementPlaneSyncRecordImpl.builder();
-
-        // Be careful about order: if the master-file says nodeX then nodeX's file must have an up-to-date timestamp.
-        // Therefore read master file first, followed by the other node-files.
-        String masterNodeId = masterWriter.get();
-        if (masterNodeId == null) {
-            LOG.debug("No master-memento deserialized from file "+masterWriter+"; ignoring and continuing (normal on startup, should cause an error later in live operation)");
-        } else {
-            builder.masterNodeId(masterNodeId);
-        }
-
-        // Load node-files
-        List<String> nodeFiles = objectStore.listContentsWithSubPath(NODES_SUB_PATH);
-        LOG.trace("Loading nodes from {}; {} nodes.",
-                new Object[]{objectStore.getSummaryName(), nodeFiles.size()});
-
-        for (String nodeFile : nodeFiles) {
-            PersistenceObjectStore.StoreObjectAccessor objectAccessor = objectStore.newAccessor(nodeFile);
-            String nodeContents = null;
-            Exception problem = null;
-            try {
-                nodeContents = objectAccessor.get();
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                problem = e;
-            }
-            if (problem!=null || Strings.isBlank(nodeContents)) {
-                // happens if node has gone away, or if FileBasedObjectStore.moveFile is not atomic, 
-                // i.e. it has deleted but not updated it yet
-                if (objectAccessor.exists()) {
-                    throw Exceptions.propagate(new IllegalStateException("Node record "+nodeFile+" could not be read when "+mgmt.getManagementNodeId()+" was scanning", problem));
-                } else {
-                    LOG.warn("Node record "+nodeFile+" went away while "+mgmt.getManagementNodeId()+" was scanning, ignoring (it has probably been terminated)");
-                    // if file was deleted, silently ignore
-                    continue;
-                }
-            }
-            ManagementNodeSyncRecord memento = (ManagementNodeSyncRecord) serializer.fromString(nodeContents);
-            if (memento == null) {
-                // shouldn't happen
-                throw Exceptions.propagate(new IllegalStateException("Node record "+nodeFile+" could not be deserialized when "+mgmt.getManagementNodeId()+" was scanning: "+nodeContents, problem));
-            } else {
-                if (memento.getRemoteTimestamp()!=null && preferRemoteTimestampInMemento) {
-                    // in test mode, the remote timestamp is stored in the file
-                } else {
-                    if (memento.getRemoteTimestamp()!=null) {
-                        LOG.debug("Ignoring remote timestamp in memento file ("+memento+"); looks like this data has been manually copied in");
-                    }
-                    Date lastModifiedDate = objectAccessor.getLastModifiedDate();
-                    ((BasicManagementNodeSyncRecord)memento).setRemoteTimestamp(lastModifiedDate!=null ? lastModifiedDate.getTime() : null);
-                }
-                builder.node(memento);
-            }
-        }
-
-        if (LOG.isDebugEnabled()) LOG.trace("Loaded management-plane memento; {} nodes, took {}",
-            nodeFiles.size(),
-            Time.makeTimeStringRounded(stopwatch.elapsed(TimeUnit.MILLISECONDS)));
-        return builder.build();
-    }
-    
-    @Override
-    public void delta(Delta delta) {
-        if (!running) {
-            if (LOG.isDebugEnabled()) LOG.debug("Persister not running; ignoring checkpointed delta of manager-memento");
-            return;
-        }
-        init();
-        
-        Stopwatch stopwatch = Stopwatch.createStarted();
-        if (LOG.isTraceEnabled()) LOG.trace("Checkpointing delta of manager-memento; updating {}", delta);
-        
-        for (ManagementNodeSyncRecord m : delta.getNodes()) {
-            persist(m);
-        }
-        for (String id : delta.getRemovedNodeIds()) {
-            deleteNode(id);
-        }
-        switch (delta.getMasterChange()) {
-        case NO_CHANGE:
-            break; // no-op
-        case SET_MASTER:
-            persistMaster(checkNotNull(delta.getNewMasterOrNull()), null);
-            break;
-        case CLEAR_MASTER:
-            persistMaster("", delta.getExpectedMasterToClear());
-            break; // no-op
-        default:
-            throw new IllegalStateException("Unknown state for master-change: "+delta.getMasterChange());
-        }
-        if (LOG.isDebugEnabled() && shouldLogCheckpoint()) LOG.debug("Checkpointed delta of manager-memento in "+Time.makeTimeStringRounded(stopwatch)+": "+delta);
-    }
-
-    private void persistMaster(String nodeId, String optionalExpectedId) {
-        if (optionalExpectedId!=null) {
-            String currentRemoteMaster = masterWriter.get();
-            if (currentRemoteMaster==null) {
-                // okay to have nothing at remote
-            } else if (!currentRemoteMaster.trim().equals(optionalExpectedId.trim())) {
-                LOG.warn("Master at server is "+(Strings.isBlank(currentRemoteMaster) ? "<none>" : currentRemoteMaster)+"; expected "+optionalExpectedId+" "
-                    + (Strings.isNonBlank(nodeId) ? "and would set as "+nodeId : "and would clear") 
-                    + ", so not applying (yet)");
-                return;
-            }
-        }
-        masterWriter.put(nodeId);
-        try {
-            masterWriter.waitForCurrentWrites(SYNC_WRITE_TIMEOUT);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-        changeLogWriter.append(Time.makeDateString() + ": set master to " + nodeId + "\n");
-        try {
-            changeLogWriter.waitForCurrentWrites(SYNC_WRITE_TIMEOUT);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    @VisibleForTesting
-    public void waitForWritesCompleted(Duration timeout) throws InterruptedException, TimeoutException {
-        for (StoreObjectAccessorWithLock writer : nodeWriters.values()) {
-            writer.waitForCurrentWrites(timeout);
-        }
-        masterWriter.waitForCurrentWrites(timeout);
-    }
-
-    public void checkpoint(ManagementPlaneSyncRecord record) {
-        init();
-        for (ManagementNodeSyncRecord node : record.getManagementNodes().values()) {
-            // Check included in case the node in the memento is the one being initialised by
-            // BrooklynLauncher in the copy state command.
-            if (!ManagementNodeState.INITIALIZING.equals(node.getStatus()) && node.getNodeId() != null) {
-                persist(node);
-            }
-        }
-    }
-
-    private void persist(ManagementNodeSyncRecord node) {
-        StoreObjectAccessorWithLock writer = getOrCreateNodeWriter(node.getNodeId());
-        boolean fileExists = writer.exists();
-        writer.put(serializer.toString(node));
-        try {
-            writer.waitForCurrentWrites(SYNC_WRITE_TIMEOUT);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-        if (!fileExists) {
-            changeLogWriter.append(Time.makeDateString()+": created node "+node.getNodeId()+"\n");
-        }
-        if (node.getStatus() == ManagementNodeState.TERMINATED || node.getStatus() == ManagementNodeState.FAILED) {
-            changeLogWriter.append(Time.makeDateString()+": set node "+node.getNodeId()+" status to "+node.getStatus()+"\n");
-        }
-    }
-    
-    private void deleteNode(String nodeId) {
-        getOrCreateNodeWriter(nodeId).delete();
-        changeLogWriter.append(Time.makeDateString()+": deleted node "+nodeId+"\n");
-    }
-
-    private StoreObjectAccessorWithLock getOrCreateNodeWriter(String nodeId) {
-        PersistenceObjectStore.StoreObjectAccessorWithLock writer = nodeWriters.get(nodeId);
-        if (writer == null) {
-            nodeWriters.putIfAbsent(nodeId, 
-                new StoreObjectAccessorLocking(objectStore.newAccessor(NODES_SUB_PATH+"/"+nodeId)));
-            writer = nodeWriters.get(nodeId);
-        }
-        return writer;
-    }
-
-    protected boolean shouldLogCheckpoint() {
-        long logCount = checkpointLogCount.incrementAndGet();
-        return (logCount < INITIAL_LOG_WRITES) || (logCount % 1000 == 0);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/MasterChooser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/MasterChooser.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/MasterChooser.java
deleted file mode 100644
index 0209fa2..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/MasterChooser.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 org.apache.brooklyn.core.mgmt.ha;
-
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.Beta;
-
-/**
- * For choosing which management node to promote, when master detected as failed or stopped.
- * 
- * @since 0.7.0
- * 
- * @author aled
- */
-@Beta
-public interface MasterChooser {
-
-    ManagementNodeSyncRecord choose(ManagementPlaneSyncRecord memento, Duration heartbeatTimeout, String ownNodeId);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
deleted file mode 100644
index ba56b98..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
+++ /dev/null
@@ -1,300 +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.core.mgmt.ha;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynVersion;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.core.server.BrooklynServerPaths;
-import org.apache.brooklyn.rt.felix.EmbeddedFelixFramework;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.osgi.Osgis;
-import org.apache.brooklyn.util.core.osgi.Osgis.BundleFinder;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.os.Os.DeletionResult;
-import org.apache.brooklyn.util.repeat.Repeater;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.launch.Framework;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-public class OsgiManager {
-
-    private static final Logger log = LoggerFactory.getLogger(OsgiManager.class);
-    
-    public static final ConfigKey<Boolean> USE_OSGI = BrooklynServerConfig.USE_OSGI;
-    
-    /* see Osgis for info on starting framework etc */
-    
-    protected ManagementContext mgmt;
-    protected Framework framework;
-    protected File osgiCacheDir;
-
-    public OsgiManager(ManagementContext mgmt) {
-        this.mgmt = mgmt;
-    }
-
-    public void start() {
-        try {
-            osgiCacheDir = BrooklynServerPaths.getOsgiCacheDirCleanedIfNeeded(mgmt);
-            
-            // any extra OSGi startup args could go here
-            framework = Osgis.getFramework(osgiCacheDir.getAbsolutePath(), false);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    public void stop() {
-        Osgis.ungetFramework(framework);
-        if (BrooklynServerPaths.isOsgiCacheForCleaning(mgmt, osgiCacheDir)) {
-            // See exception reported in https://issues.apache.org/jira/browse/BROOKLYN-72
-            // We almost always fail to delete he OSGi temp directory due to a concurrent modification.
-            // Therefore keep trying.
-            final AtomicReference<DeletionResult> deletionResult = new AtomicReference<DeletionResult>();
-            Repeater.create("Delete OSGi cache dir")
-                    .until(new Callable<Boolean>() {
-                        @Override
-                        public Boolean call() {
-                            deletionResult.set(Os.deleteRecursively(osgiCacheDir));
-                            return deletionResult.get().wasSuccessful();
-                        }})
-                    .limitTimeTo(Duration.ONE_SECOND)
-                    .backoffTo(Duration.millis(50))
-                    .run();
-            if (deletionResult.get().getThrowable()!=null) {
-                log.debug("Unable to delete "+osgiCacheDir+" (possibly being modified concurrently?): "+deletionResult.get().getThrowable());
-            }
-        }
-        osgiCacheDir = null;
-        framework = null;
-    }
-
-    public synchronized void registerBundle(CatalogBundle bundle) {
-        try {
-            if (checkBundleInstalledThrowIfInconsistent(bundle)) {
-                return;
-            }
-
-            Bundle b = Osgis.install(framework, bundle.getUrl());
-
-            checkCorrectlyInstalled(bundle, b);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            throw new IllegalStateException("Bundle from "+bundle.getUrl()+" failed to install: " + e.getMessage(), e);
-        }
-    }
-
-    private void checkCorrectlyInstalled(CatalogBundle bundle, Bundle b) {
-        String nv = b.getSymbolicName()+":"+b.getVersion().toString();
-
-        if (!isBundleNameEqualOrAbsent(bundle, b)) {
-            throw new IllegalStateException("Bundle already installed as "+nv+" but user explicitly requested "+bundle);
-        }
-
-        List<Bundle> matches = Osgis.bundleFinder(framework)
-                .symbolicName(b.getSymbolicName())
-                .version(b.getVersion().toString())
-                .findAll();
-        if (matches.isEmpty()) {
-            log.error("OSGi could not find bundle "+nv+" in search after installing it from "+bundle.getUrl());
-        } else if (matches.size()==1) {
-            log.debug("Bundle from "+bundle.getUrl()+" successfully installed as " + nv + " ("+b+")");
-        } else {
-            log.warn("OSGi has multiple bundles matching "+nv+", when just installed from "+bundle.getUrl()+": "+matches+"; "
-                + "brooklyn will prefer the URL-based bundle for top-level references but any dependencies or "
-                + "import-packages will be at the mercy of OSGi. "
-                + "It is recommended to use distinct versions for different bundles, and the same URL for the same bundles.");
-        }
-    }
-
-    private boolean checkBundleInstalledThrowIfInconsistent(CatalogBundle bundle) {
-        String bundleUrl = bundle.getUrl();
-        if (bundleUrl != null) {
-            Maybe<Bundle> installedBundle = Osgis.bundleFinder(framework).requiringFromUrl(bundleUrl).find();
-            if (installedBundle.isPresent()) {
-                Bundle b = installedBundle.get();
-                String nv = b.getSymbolicName()+":"+b.getVersion().toString();
-                if (!isBundleNameEqualOrAbsent(bundle, b)) {
-                    throw new IllegalStateException("User requested bundle " + bundle + " but already installed as "+nv);
-                } else {
-                    log.trace("Bundle from "+bundleUrl+" already installed as "+nv+"; not re-registering");
-                }
-                return true;
-            }
-        } else {
-            Maybe<Bundle> installedBundle = Osgis.bundleFinder(framework).symbolicName(bundle.getSymbolicName()).version(bundle.getVersion()).find();
-            if (installedBundle.isPresent()) {
-                log.trace("Bundle "+bundle+" installed from "+installedBundle.get().getLocation());
-            } else {
-                throw new IllegalStateException("Bundle "+bundle+" not previously registered, but URL is empty.");
-            }
-            return true;
-        }
-        return false;
-    }
-
-    public static boolean isBundleNameEqualOrAbsent(CatalogBundle bundle, Bundle b) {
-        return !bundle.isNameResolved() ||
-                (bundle.getSymbolicName().equals(b.getSymbolicName()) &&
-                bundle.getVersion().equals(b.getVersion().toString()));
-    }
-
-    public <T> Maybe<Class<T>> tryResolveClass(String type, OsgiBundleWithUrl... osgiBundles) {
-        return tryResolveClass(type, Arrays.asList(osgiBundles));
-    }
-    public <T> Maybe<Class<T>> tryResolveClass(String type, Iterable<? extends OsgiBundleWithUrl> osgiBundles) {
-        Map<OsgiBundleWithUrl,Throwable> bundleProblems = MutableMap.of();
-        Set<String> extraMessages = MutableSet.of();
-        for (OsgiBundleWithUrl osgiBundle: osgiBundles) {
-            try {
-                Maybe<Bundle> bundle = findBundle(osgiBundle);
-                if (bundle.isPresent()) {
-                    Bundle b = bundle.get();
-                    Class<T> clazz;
-                    //Extension bundles don't support loadClass.
-                    //Instead load from the app classpath.
-                    if (EmbeddedFelixFramework.isExtensionBundle(b)) {
-                        @SuppressWarnings("unchecked")
-                        Class<T> c = (Class<T>)Class.forName(type);
-                        clazz = c;
-                    } else {
-                        @SuppressWarnings("unchecked")
-                        Class<T> c = (Class<T>)b.loadClass(type);
-                        clazz = c;
-                    }
-                    return Maybe.of(clazz);
-                } else {
-                    bundleProblems.put(osgiBundle, ((Maybe.Absent<?>)bundle).getException());
-                }
-                
-            } catch (Exception e) {
-                // should come from classloading now; name formatting or missing bundle errors will be caught above 
-                Exceptions.propagateIfFatal(e);
-                bundleProblems.put(osgiBundle, e);
-
-                Throwable cause = e.getCause();
-                if (cause != null && cause.getMessage().contains("Unresolved constraint in bundle")) {
-                    if (BrooklynVersion.INSTANCE.getVersionFromOsgiManifest()==null) {
-                        extraMessages.add("No brooklyn-core OSGi manifest available. OSGi will not work.");
-                    }
-                    if (BrooklynVersion.isDevelopmentEnvironment()) {
-                        extraMessages.add("Your development environment may not have created necessary files. Doing a maven build then retrying may fix the issue.");
-                    }
-                    if (!extraMessages.isEmpty()) log.warn(Strings.join(extraMessages, " "));
-                    log.warn("Unresolved constraint resolving OSGi bundle "+osgiBundle+" to load "+type+": "+cause.getMessage());
-                    if (log.isDebugEnabled()) log.debug("Trace for OSGi resolution failure", e);
-                }
-            }
-        }
-        if (bundleProblems.size()==1) {
-            Throwable error = Iterables.getOnlyElement(bundleProblems.values());
-            if (error instanceof ClassNotFoundException && error.getCause()!=null && error.getCause().getMessage()!=null) {
-                error = Exceptions.collapseIncludingAllCausalMessages(error);
-            }
-            return Maybe.absent("Unable to resolve class "+type+" in "+Iterables.getOnlyElement(bundleProblems.keySet())
-                + (extraMessages.isEmpty() ? "" : " ("+Strings.join(extraMessages, " ")+")"), error);
-        } else {
-            return Maybe.absent(Exceptions.create("Unable to resolve class "+type+": "+bundleProblems
-                + (extraMessages.isEmpty() ? "" : " ("+Strings.join(extraMessages, " ")+")"), bundleProblems.values()));
-        }
-    }
-
-    public Maybe<Bundle> findBundle(OsgiBundleWithUrl catalogBundle) {
-        //Either fail at install time when the user supplied name:version is different
-        //from the one reported from the bundle
-        //or
-        //Ignore user supplied name:version when URL is supplied to be able to find the
-        //bundle even if it's with a different version.
-        //
-        //For now we just log a warning if there's a version discrepancy at install time,
-        //so prefer URL if supplied.
-        BundleFinder bundleFinder = Osgis.bundleFinder(framework);
-        if (catalogBundle.getUrl() != null) {
-            bundleFinder.requiringFromUrl(catalogBundle.getUrl());
-        } else {
-            bundleFinder.symbolicName(catalogBundle.getSymbolicName()).version(catalogBundle.getVersion());
-        }
-        return bundleFinder.find();
-    }
-
-    /**
-     * Iterates through catalogBundles until one contains a resource with the given name.
-     */
-    public URL getResource(String name, Iterable<? extends OsgiBundleWithUrl> osgiBundles) {
-        for (OsgiBundleWithUrl osgiBundle: osgiBundles) {
-            try {
-                Maybe<Bundle> bundle = findBundle(osgiBundle);
-                if (bundle.isPresent()) {
-                    URL result = bundle.get().getResource(name);
-                    if (result!=null) return result;
-                }
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @return URL's to all resources matching the given name (using {@link Bundle#getResources(String)} in the referenced osgi bundles.
-     */
-    public Iterable<URL> getResources(String name, Iterable<? extends OsgiBundleWithUrl> osgiBundles) {
-        Set<URL> resources = Sets.newLinkedHashSet();
-        for (OsgiBundleWithUrl catalogBundle : osgiBundles) {
-            try {
-                Maybe<Bundle> bundle = findBundle(catalogBundle);
-                if (bundle.isPresent()) {
-                    Enumeration<URL> result = bundle.get().getResources(name);
-                    resources.addAll(Collections.list(result));
-                }
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-            }
-        }
-        return resources;
-    }
-
-    public Framework getFramework() {
-        return framework;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java
deleted file mode 100644
index d8f18b1..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java
+++ /dev/null
@@ -1,194 +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.core.mgmt.ha.dto;
-
-import java.io.Serializable;
-import java.net.URI;
-
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.core.BrooklynVersion;
-import org.apache.brooklyn.util.time.Time;
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-
-import com.google.common.base.Objects;
-
-/**
- * Represents the state of a management node within the Brooklyn management plane
- * (DTO class).
- * 
- * @author aled
- */
-@JsonAutoDetect(fieldVisibility=Visibility.ANY, getterVisibility=Visibility.NONE)
-public class BasicManagementNodeSyncRecord implements ManagementNodeSyncRecord, Serializable {
-
-    private static final long serialVersionUID = 4918161834047884244L;
-
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        private String brooklynVersion = BrooklynVersion.get();
-        protected String nodeId;
-        protected URI uri;
-        protected ManagementNodeState status;
-        protected Long priority;
-        protected long localTimestamp;
-        protected Long remoteTimestamp;
-
-        protected Builder self() {
-            return (Builder) this;
-        }
-        public Builder brooklynVersion(String val) {
-            brooklynVersion = val; return self();
-        }
-        public Builder nodeId(String val) {
-            nodeId = val; return self();
-        }
-        public Builder uri(URI val) {
-            uri = val; return self();
-        }
-        public Builder status(ManagementNodeState val) {
-            status = val; return self();
-        }
-        public Builder priority(Long val) {
-            priority = val; return self();
-        }
-        public Builder localTimestamp(long val) {
-            localTimestamp = val; return self();
-        }
-        public Builder remoteTimestamp(Long val) {
-            remoteTimestamp = val; return self();
-        }
-        public Builder from(ManagementNodeSyncRecord other) {
-            return from(other, false);
-        }
-        public Builder from(ManagementNodeSyncRecord other, boolean ignoreNulls) {
-            if (ignoreNulls && other==null) return this;
-            if (other.getBrooklynVersion()!=null) brooklynVersion = other.getBrooklynVersion();
-            if (other.getNodeId()!=null) nodeId = other.getNodeId();
-            if (other.getUri()!=null) uri = other.getUri();
-            if (other.getStatus()!=null) status = other.getStatus();
-            if (other.getPriority()!=null) priority = other.getPriority();
-            if (other.getLocalTimestamp()>0) localTimestamp = other.getLocalTimestamp();
-            if (other.getRemoteTimestamp()!=null) remoteTimestamp = other.getRemoteTimestamp();
-            return this;
-        }
-        public ManagementNodeSyncRecord build() {
-            return new BasicManagementNodeSyncRecord(this);
-        }
-    }
-    
-    private String brooklynVersion;
-    private String nodeId;
-    private URI uri;
-    private ManagementNodeState status;
-    private Long priority;
-    private Long localTimestamp;
-    private Long remoteTimestamp;
-    
-    /** @deprecated since 0.7.0, use {@link #localTimestamp} or {@link #remoteTimestamp},
-     * but kept (or rather added back in) to support deserializing previous instances */
-    @Deprecated
-    private Long timestampUtc;
-
-
-    // for de-serialization
-    @SuppressWarnings("unused")
-    private BasicManagementNodeSyncRecord() {
-    }
-
-    // Trusts the builder to not mess around with mutability concurrently with build().
-    protected BasicManagementNodeSyncRecord(Builder builder) {
-        brooklynVersion = builder.brooklynVersion;
-        nodeId = builder.nodeId;
-        uri = builder.uri;
-        status = builder.status;
-        priority = builder.priority;
-        localTimestamp = builder.localTimestamp;
-        remoteTimestamp = builder.remoteTimestamp;
-    }
-
-    @Override
-    public String getBrooklynVersion() {
-        return brooklynVersion;
-    }
-    
-    @Override
-    public String getNodeId() {
-        return nodeId;
-    }
-    
-    @Override
-    public URI getUri() {
-        return uri;
-    }
-    
-    @Override
-    public ManagementNodeState getStatus() {
-        return status;
-    }
-    
-    @Override
-    public Long getPriority() {
-        return priority;
-    }
-    
-    @Override
-    public long getLocalTimestamp() {
-        if (localTimestamp!=null) return localTimestamp;
-        if (timestampUtc!=null) return timestampUtc;
-        throw new NullPointerException("localTimestamp not known for "+getNodeId());
-    }
-    
-    @Override
-    public Long getRemoteTimestamp() {
-        return remoteTimestamp;
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("nodeId", getNodeId())
-                .add("status", getStatus()).toString();
-    }
-    
-    @Override
-    public String toVerboseString() {
-        return Objects.toStringHelper(this)
-                .omitNullValues()
-                .add("brooklynVersion", getBrooklynVersion())
-                .add("nodeId", getNodeId())
-                .add("uri", getUri())
-                .add("status", getStatus())
-                .add("priority", getPriority())
-                .add("localTimestamp", getLocalTimestamp()+"="+Time.makeDateString(getLocalTimestamp()))
-                .add("remoteTimestamp", getRemoteTimestamp()+(getRemoteTimestamp()==null ? "" : 
-                    "="+Time.makeDateString(getRemoteTimestamp())))
-                .toString();
-    }
-
-    /** used here for store to inject remote timestamp */
-    public void setRemoteTimestamp(Long remoteTimestamp) {
-        this.remoteTimestamp = remoteTimestamp;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/ManagementPlaneSyncRecordImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/ManagementPlaneSyncRecordImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/ManagementPlaneSyncRecordImpl.java
deleted file mode 100644
index dd89320..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/ManagementPlaneSyncRecordImpl.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 org.apache.brooklyn.core.mgmt.ha.dto;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord;
-import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-public class ManagementPlaneSyncRecordImpl implements ManagementPlaneSyncRecord, Serializable {
-
-    private static final long serialVersionUID = -4207907303446336973L;
-
-    public static Builder builder() {
-        return new Builder();
-    }
-    
-    public static class Builder {
-        protected String masterNodeId;
-        protected final Map<String,ManagementNodeSyncRecord> nodes = MutableMap.of();
-        
-        public Builder masterNodeId(String val) {
-            masterNodeId = val; return this;
-        }
-        public Builder nodes(Iterable<ManagementNodeSyncRecord> vals) {
-            checkState(!Iterables.contains(checkNotNull(vals, "nodes must not be null"), null),  "nodes must not contain null: %s", vals);
-            for (ManagementNodeSyncRecord val: vals) nodes.put(val.getNodeId(), val);
-            return this;
-        }
-        public Builder node(ManagementNodeSyncRecord val) {
-            checkNotNull(val, "node must not be null"); 
-            nodes.put(val.getNodeId(), val);
-            return this;
-        }
-        public ManagementPlaneSyncRecord build() {
-            return new ManagementPlaneSyncRecordImpl(this);
-        }
-    }
-
-    private String masterNodeId;
-    private Map<String, ManagementNodeSyncRecord> managementNodes;
-    
-    private ManagementPlaneSyncRecordImpl(Builder builder) {
-        masterNodeId = builder.masterNodeId;
-        managementNodes = Maps.newLinkedHashMap();
-        for (ManagementNodeSyncRecord node : builder.nodes.values()) {
-            checkState(!managementNodes.containsKey(node.getNodeId()), "duplicate nodeId %s", node.getNodeId());
-            managementNodes.put(node.getNodeId(), node);
-        }
-    }
-
-    @Override
-    public String getMasterNodeId() {
-        return masterNodeId;
-    }
-    
-    @Override
-    public Map<String, ManagementNodeSyncRecord> getManagementNodes() {
-        return managementNodes;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("masterNodeId", masterNodeId)
-                .add("nodes", managementNodes.keySet())
-                .toString();
-    }
-
-    @Override
-    public String toVerboseString() {
-        return toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
deleted file mode 100644
index da9fcae..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
+++ /dev/null
@@ -1,522 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.lang.String.format;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.drivers.EntityDriverManager;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolverManager;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityManager;
-import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.config.StringConfigMap;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.drivers.BasicEntityDriverManager;
-import org.apache.brooklyn.core.entity.drivers.downloads.BasicDownloadsManager;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.internal.storage.DataGrid;
-import org.apache.brooklyn.core.internal.storage.DataGridFactory;
-import org.apache.brooklyn.core.internal.storage.impl.BrooklynStorageImpl;
-import org.apache.brooklyn.core.internal.storage.impl.inmemory.InMemoryDataGridFactory;
-import org.apache.brooklyn.core.location.BasicLocationRegistry;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl;
-import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl;
-import org.apache.brooklyn.core.typereg.BasicBrooklynTypeRegistry;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.BasicExecutionContext;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.groovy.GroovyJavaMethods;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-
-public abstract class AbstractManagementContext implements ManagementContextInternal {
-    private static final Logger log = LoggerFactory.getLogger(AbstractManagementContext.class);
-
-    private static DataGridFactory loadDataGridFactory(BrooklynProperties properties) {
-        String clazzName = properties.getFirst(DataGridFactory.class.getName());
-        if(clazzName == null){
-            clazzName = InMemoryDataGridFactory.class.getName();
-        }
-
-        Class<?> clazz;
-        try{
-            //todo: which classloader should we use?
-            clazz = LocalManagementContext.class.getClassLoader().loadClass(clazzName);
-        }catch(ClassNotFoundException e){
-            throw new IllegalStateException(format("Could not load class [%s]",clazzName),e);
-        }
-
-        Object instance;
-        try {
-            instance = clazz.newInstance();
-        } catch (InstantiationException e) {
-            throw new IllegalStateException(format("Could not instantiate class [%s]",clazzName),e);
-        } catch (IllegalAccessException e) {
-            throw new IllegalStateException(format("Could not instantiate class [%s]",clazzName),e);
-        }
-
-        if(!(instance instanceof DataGridFactory)){
-            throw new IllegalStateException(format("Class [%s] not an instantiate of class [%s]",clazzName, DataGridFactory.class.getName()));
-        }
-
-        return (DataGridFactory)instance;
-    }
-
-    static {
-        ResourceUtils.addClassLoaderProvider(new Function<Object, BrooklynClassLoadingContext>() {
-            @Override
-            public BrooklynClassLoadingContext apply(@Nullable Object input) {
-                if (input instanceof EntityInternal) {
-                    EntityInternal internal = (EntityInternal)input;
-                    if (internal.getCatalogItemId() != null) {
-                        RegisteredType item = internal.getManagementContext().getTypeRegistry().get(internal.getCatalogItemId());
-
-                        if (item != null) {
-                            return CatalogUtils.newClassLoadingContext(internal.getManagementContext(), item);
-                        } else {
-                            log.error("Can't find catalog item " + internal.getCatalogItemId() +
-                                    " used for instantiating entity " + internal +
-                                    ". Falling back to application classpath.");
-                        }
-                    }
-                    return apply(internal.getManagementSupport());
-                }
-                
-                if (input instanceof EntityManagementSupport)
-                    return apply(((EntityManagementSupport)input).getManagementContext());
-                if (input instanceof ManagementContext)
-                    return JavaBrooklynClassLoadingContext.create((ManagementContext) input);
-                return null;
-            }
-        });
-    }
-
-    private final AtomicLong totalEffectorInvocationCount = new AtomicLong();
-
-    protected DeferredBrooklynProperties configMap;
-    protected BasicLocationRegistry locationRegistry;
-    protected final BasicBrooklynCatalog catalog;
-    protected final BrooklynTypeRegistry typeRegistry;
-    protected ClassLoader baseClassLoader;
-    protected Iterable<URL> baseClassPathForScanning;
-
-    private final RebindManager rebindManager;
-    private final HighAvailabilityManager highAvailabilityManager;
-    
-    protected volatile BrooklynGarbageCollector gc;
-
-    private final EntityDriverManager entityDriverManager;
-    protected DownloadResolverManager downloadsManager;
-
-    protected EntitlementManager entitlementManager;
-
-    private final BrooklynStorage storage;
-
-    protected final ExternalConfigSupplierRegistry configSupplierRegistry;
-
-    private volatile boolean running = true;
-    protected boolean startupComplete = false;
-    protected final List<Throwable> errors = Collections.synchronizedList(MutableList.<Throwable>of());
-
-    protected Maybe<URI> uri = Maybe.absent();
-    protected CatalogInitialization catalogInitialization;
-
-    public AbstractManagementContext(BrooklynProperties brooklynProperties){
-        this(brooklynProperties, null);
-    }
-
-    public AbstractManagementContext(BrooklynProperties brooklynProperties, DataGridFactory datagridFactory) {
-        this.configMap = new DeferredBrooklynProperties(brooklynProperties, this);
-        this.entityDriverManager = new BasicEntityDriverManager();
-        this.downloadsManager = BasicDownloadsManager.newDefault(configMap);
-        if (datagridFactory == null) {
-            datagridFactory = loadDataGridFactory(brooklynProperties);
-        }
-        DataGrid datagrid = datagridFactory.newDataGrid(this);
-
-        this.catalog = new BasicBrooklynCatalog(this);
-        this.typeRegistry = new BasicBrooklynTypeRegistry(this);
-        
-        this.storage = new BrooklynStorageImpl(datagrid);
-        this.rebindManager = new RebindManagerImpl(this); // TODO leaking "this" reference; yuck
-        this.highAvailabilityManager = new HighAvailabilityManagerImpl(this); // TODO leaking "this" reference; yuck
-        
-        this.entitlementManager = Entitlements.newManager(this, brooklynProperties);
-        this.configSupplierRegistry = new BasicExternalConfigSupplierRegistry(this); // TODO leaking "this" reference; yuck
-    }
-
-    @Override
-    public void terminate() {
-        highAvailabilityManager.stop();
-        running = false;
-        rebindManager.stop();
-        storage.terminate();
-        // Don't unmanage everything; different entities get given their events at different times 
-        // so can cause problems (e.g. a group finds out that a member is unmanaged, before the
-        // group itself has been told that it is unmanaged).
-    }
-    
-    @Override
-    public boolean isRunning() {
-        return running;
-    }
-    
-    @Override
-    public boolean isStartupComplete() {
-        return startupComplete;
-    }
-
-    @Override
-    public BrooklynStorage getStorage() {
-        return storage;
-    }
-    
-    @Override
-    public RebindManager getRebindManager() {
-        return rebindManager;
-    }
-
-    @Override
-    public HighAvailabilityManager getHighAvailabilityManager() {
-        return highAvailabilityManager;
-    }
-
-    @Override
-    public long getTotalEffectorInvocations() {
-        return totalEffectorInvocationCount.get();
-    }
-    
-    @Override
-    public ExecutionContext getExecutionContext(Entity e) {
-        // BEC is a thin wrapper around EM so fine to create a new one here; but make sure it gets the real entity
-        if (e instanceof AbstractEntity) {
-            ImmutableSet<Object> tags = ImmutableSet.<Object>of(
-                    BrooklynTaskTags.tagForContextEntity(e),
-                    this
-            );
-            return new BasicExecutionContext(MutableMap.of("tags", tags), getExecutionManager());
-        } else {
-            return ((EntityInternal)e).getManagementSupport().getExecutionContext();
-        }
-    }
-
-    @Override
-    public ExecutionContext getServerExecutionContext() {
-        // BEC is a thin wrapper around EM so fine to create a new one here
-        ImmutableSet<Object> tags = ImmutableSet.<Object>of(
-                this,
-                BrooklynTaskTags.BROOKLYN_SERVER_TASK_TAG
-        );
-        return new BasicExecutionContext(MutableMap.of("tags", tags), getExecutionManager());
-    }
-
-    @Override
-    public SubscriptionContext getSubscriptionContext(Entity e) {
-        // BSC is a thin wrapper around SM so fine to create a new one here
-        return new BasicSubscriptionContext(getSubscriptionManager(), e);
-    }
-
-    @Override
-    public SubscriptionContext getSubscriptionContext(Location loc) {
-        // BSC is a thin wrapper around SM so fine to create a new one here
-        return new BasicSubscriptionContext(getSubscriptionManager(), loc);
-    }
-
-    @Override
-    public EntityDriverManager getEntityDriverManager() {
-        return entityDriverManager;
-    }
-
-    @Override
-    public DownloadResolverManager getEntityDownloadsManager() {
-        return downloadsManager;
-    }
-    
-    @Override
-    public EntitlementManager getEntitlementManager() {
-        return entitlementManager;
-    }
-    
-    protected abstract void manageIfNecessary(Entity entity, Object context);
-
-    @Override
-    public <T> Task<T> invokeEffector(final Entity entity, final Effector<T> eff, @SuppressWarnings("rawtypes") final Map parameters) {
-        return runAtEntity(entity, eff, parameters);
-    }
-    
-    protected <T> T invokeEffectorMethodLocal(Entity entity, Effector<T> eff, Object args) {
-        assert isManagedLocally(entity) : "cannot invoke effector method at "+this+" because it is not managed here";
-        totalEffectorInvocationCount.incrementAndGet();
-        Object[] transformedArgs = EffectorUtils.prepareArgsForEffector(eff, args);
-        return GroovyJavaMethods.invokeMethodOnMetaClass(entity, eff.getName(), transformedArgs);
-    }
-
-    /**
-     * Method for entity to make effector happen with correct semantics (right place, right task context),
-     * when a method is called on that entity.
-     * @throws ExecutionException 
-     */
-    @Override
-    public <T> T invokeEffectorMethodSync(final Entity entity, final Effector<T> eff, final Object args) throws ExecutionException {
-        try {
-            Task<?> current = Tasks.current();
-            if (current == null || !entity.equals(BrooklynTaskTags.getContextEntity(current)) || !isManagedLocally(entity)) {
-                manageIfNecessary(entity, eff.getName());
-                // Wrap in a task if we aren't already in a task that is tagged with this entity
-                Task<T> task = runAtEntity( EffectorUtils.getTaskFlagsForEffectorInvocation(entity, eff, 
-                            ConfigBag.newInstance().configureStringKey("args", args)),
-                        entity, 
-                        new Callable<T>() {
-                            public T call() {
-                                return invokeEffectorMethodLocal(entity, eff, args);
-                            }});
-                return task.get();
-            } else {
-                return invokeEffectorMethodLocal(entity, eff, args);
-            }
-        } catch (Exception e) {
-            // don't need to attach any message or warning because the Effector impl hierarchy does that (see calls to EffectorUtils.handleException)
-            throw new ExecutionException(e);
-        }
-    }
-
-    /**
-     * Whether the master entity record is local, and sensors and effectors can be properly accessed locally.
-     */ 
-    public abstract boolean isManagedLocally(Entity e);
-    
-    /**
-     * Causes the indicated runnable to be run at the right location for the given entity.
-     *
-     * Returns the actual task (if it is local) or a proxy task (if it is remote);
-     * if management for the entity has not yet started this may start it.
-     * 
-     * @deprecated since 0.6.0 use effectors (or support {@code runAtEntity(Entity, Effector, Map)} if something else is needed);
-     * (Callable with Map flags is too open-ended, bothersome to support, and not used much) 
-     */
-    @Deprecated
-    public abstract <T> Task<T> runAtEntity(@SuppressWarnings("rawtypes") Map flags, Entity entity, Callable<T> c);
-
-    /** Runs the given effector in the right place for the given entity.
-     * The task is immediately submitted in the background, but also recorded in the queueing context (if present)
-     * so it appears as a child, but marked inessential so it does not fail the parent task, who will ordinarily
-     * call {@link Task#get()} on the object and may do their own failure handling. 
-     */
-    protected abstract <T> Task<T> runAtEntity(final Entity entity, final Effector<T> eff, @SuppressWarnings("rawtypes") final Map parameters);
-
-    @Override
-    public StringConfigMap getConfig() {
-        return configMap;
-    }
-
-    @Override
-    public BrooklynProperties getBrooklynProperties() {
-        return configMap;
-    }
-
-    private final Object locationRegistrySemaphore = new Object();
-    
-    @Override
-    public LocationRegistry getLocationRegistry() {
-        // NB: can deadlock if synched on whole LMC
-        synchronized (locationRegistrySemaphore) {
-            if (locationRegistry==null) locationRegistry = new BasicLocationRegistry(this);
-            return locationRegistry;
-        }
-    }
-
-    @Override
-    public BrooklynCatalog getCatalog() {
-        if (!getCatalogInitialization().hasRunAnyInitialization()) {
-            // catalog init is needed; normally this will be done from start sequence,
-            // but if accessed early -- and in tests -- we will load it here
-            getCatalogInitialization().setManagementContext(this);
-            getCatalogInitialization().populateUnofficial(catalog);
-        }
-        return catalog;
-    }
-    
-    @Override
-    public BrooklynTypeRegistry getTypeRegistry() {
-        return typeRegistry;
-    }
-    
-    @Override
-    public ClassLoader getCatalogClassLoader() {
-        // catalog does not have to be initialized
-        return catalog.getRootClassLoader();
-    }
-
-    /**
-     * Optional class-loader that this management context should use as its base,
-     * as the first-resort in the catalog, and for scanning (if scanning the default in the catalog).
-     * In most instances the default classloader (ManagementContext.class.getClassLoader(), assuming
-     * this was in the JARs used at boot time) is fine, and in those cases this method normally returns null.
-     * (Surefire does some weird stuff, but the default classloader is fine for loading;
-     * however it requires a custom base classpath to be set for scanning.)
-     */
-    @Override
-    public ClassLoader getBaseClassLoader() {
-        return baseClassLoader;
-    }
-    
-    /** See {@link #getBaseClassLoader()}.  Only settable once and must be invoked before catalog is loaded. */
-    public void setBaseClassLoader(ClassLoader cl) {
-        if (baseClassLoader==cl) return;
-        if (baseClassLoader!=null) throw new IllegalStateException("Cannot change base class loader (in "+this+")");
-        if (catalog!=null) throw new IllegalStateException("Cannot set base class after catalog has been loaded (in "+this+")");
-        this.baseClassLoader = cl;
-    }
-    
-    /** Optional mechanism for setting the classpath which should be scanned by the catalog, if the catalog
-     * is scanning the default classpath.  Usually it infers the right thing, but some classloaders
-     * (e.g. surefire) do funny things which the underlying org.reflections.Reflections library can't see in to.
-     * <p>
-     * This should normally be invoked early in the server startup.  Setting it after the catalog is loaded will not
-     * take effect without an explicit internal call to do so.  Once set, it can be changed prior to catalog loading
-     * but it cannot be <i>changed</i> once the catalog is loaded.
-     * <p>
-     * ClasspathHelper.forJavaClassPath() is often a good argument to pass, and is used internally in some places
-     * when no items are found on the catalog. */
-    @Override
-    public void setBaseClassPathForScanning(Iterable<URL> urls) {
-        if (Objects.equal(baseClassPathForScanning, urls)) return;
-        if (baseClassPathForScanning != null) {
-            if (catalog==null)
-                log.warn("Changing scan classpath to "+urls+" from "+baseClassPathForScanning);
-            else
-                throw new IllegalStateException("Cannot change base class path for scanning (in "+this+")");
-        }
-        this.baseClassPathForScanning = urls;
-    }
-    /** 
-     * @see #setBaseClassPathForScanning(Iterable)
-     */
-    @Override
-    public Iterable<URL> getBaseClassPathForScanning() {
-        return baseClassPathForScanning;
-    }
-
-    public BrooklynGarbageCollector getGarbageCollector() {
-        return gc;
-    }
-
-    @Override
-    public void setManagementNodeUri(URI uri) {
-        this.uri = Maybe.of(checkNotNull(uri, "uri"));
-    }
-
-    @Override
-    public Maybe<URI> getManagementNodeUri() {
-        return uri;
-    }
-    
-    private Object catalogInitMutex = new Object();
-    @Override
-    public CatalogInitialization getCatalogInitialization() {
-        synchronized (catalogInitMutex) {
-            if (catalogInitialization!=null) return catalogInitialization;
-            CatalogInitialization ci = new CatalogInitialization();
-            setCatalogInitialization(ci);
-            return ci;
-        }
-    }
-    
-    @Override
-    public void setCatalogInitialization(CatalogInitialization catalogInitialization) {
-        synchronized (catalogInitMutex) {
-            Preconditions.checkNotNull(catalogInitialization, "initialization must not be null");
-            if (this.catalogInitialization!=null && this.catalogInitialization != catalogInitialization)
-                throw new IllegalStateException("Changing catalog init from "+this.catalogInitialization+" to "+catalogInitialization+"; changes not permitted");
-            catalogInitialization.setManagementContext(this);
-            this.catalogInitialization = catalogInitialization;
-        }
-    }
-    
-    public BrooklynObject lookup(String id) {
-        return lookup(id, BrooklynObject.class);
-    }
-    
-    @SuppressWarnings("unchecked")
-    public <T extends BrooklynObject> T lookup(String id, Class<T> type) {
-        Object result;
-        result = getEntityManager().getEntity(id);
-        if (result!=null && type.isInstance(result)) return (T)result;
-        
-        result = getLocationManager().getLocation(id);
-        if (result!=null && type.isInstance(result)) return (T)result;
-
-        // TODO policies, enrichers, feeds
-        return null;
-    }
-
-    @Override
-    public List<Throwable> errors() {
-        return errors;
-    }
-
-    /** @since 0.8.0 */
-    @Override
-    public ExternalConfigSupplierRegistry getExternalConfigProviderRegistry() {
-        return configSupplierRegistry;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractSubscriptionManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractSubscriptionManager.java
deleted file mode 100644
index dc454e2..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractSubscriptionManager.java
+++ /dev/null
@@ -1,141 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-
-public abstract class AbstractSubscriptionManager implements SubscriptionManager {
-
-    // TODO Perhaps could use guava's SynchronizedSetMultimap? But need to check its synchronization guarantees.
-    //      That would replace the utils used for subscriptionsBySubscriber etc.
-    
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractSubscriptionManager.class);
-
-    /** performs the actual subscription; should return the subscription parameter as the handle */
-    protected abstract <T> SubscriptionHandle subscribe(Map<String, Object> flags, Subscription<T> s);
-    /** performs the actual publishing -- ie distribution to subscriptions */
-    public abstract <T> void publish(final SensorEvent<T> event);
-
-    public static class EntitySensorToken {
-        Entity e;
-        Sensor<?> s;
-        String sName;
-        public EntitySensorToken(Entity e, Sensor<?> s) {
-            this.e = e;
-            this.s = s;
-            this.sName = (s == null) ? null : checkNotNull(s.getName(), "sensor must have non-null name: %s", s);
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(e, sName);
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) return true;
-            if (!(obj instanceof EntitySensorToken)) return false;
-            if (!Objects.equal(e, ((EntitySensorToken)obj).e)) return false;
-            if (!Objects.equal(sName, ((EntitySensorToken)obj).sName)) return false;
-            return true;
-        }
-        @Override
-        public String toString() {
-            return (e != null ? e.getId() :  "*")+":"+(s != null ? sName : "*");
-        }
-    }
-    static Object makeEntitySensorToken(Entity e, Sensor<?> s) {
-        return new EntitySensorToken(e, s);
-    }
-    static Object makeEntitySensorToken(SensorEvent<?> se) {
-        return makeEntitySensorToken(se.getSource(), se.getSensor());
-    }
-    
-    /** @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener) */
-    public final <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribe(Collections.<String,Object>emptyMap(), producer, sensor, listener);
-    }
- 
-    /**
-     * This implementation handles the following flags, in addition to those described in the {@link SubscriptionManager}
-     * interface:
-     * <ul>
-     * <li>subscriberExecutionManagerTag - a tag to pass to execution manager (without setting any execution semantics / TaskPreprocessor);
-     *      if not supplied and there is a subscriber, this will be inferred from the subscriber and set up with SingleThreadedScheduler
-     * <li>eventFilter - a Predicate&lt;SensorEvent&gt; instance to filter what events are delivered
-     * </ul>
-     * 
-     * @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)
-     */
-    public final <T> SubscriptionHandle subscribe(Map<String, Object> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribe(flags, new Subscription<T>(producer, sensor, listener));
-    }
-        
-    /** @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
-    public final <T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribeToChildren(Collections.<String,Object>emptyMap(), parent, sensor, listener);
-    }
-
-    /** @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener) */
-    public final  <T> SubscriptionHandle subscribeToChildren(Map<String, Object> flags, final Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        Predicate<SensorEvent<T>> eventFilter = new Predicate<SensorEvent<T>>() {
-            public boolean apply(SensorEvent<T> input) {
-                return parent != null && input.getSource() != null && parent.equals(input.getSource().getParent());
-            }
-        };
-        flags.put("eventFilter", eventFilter);
-        return subscribe(flags, null, sensor, listener);
-    }
-
-    /** @see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener) */
-    public final <T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        return subscribeToMembers(Collections.<String,Object>emptyMap(), parent, sensor, listener);
-    }
-
-    /** @see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener) */
-    public final  <T> SubscriptionHandle subscribeToMembers(Map<String, Object> flags, final Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
-        Predicate<SensorEvent<T>> eventFilter = new Predicate<SensorEvent<T>>() {
-            public boolean apply(SensorEvent<T> input) {
-                return parent.getMembers().contains(input.getSource());
-            }
-        };
-        flags.put("eventFilter", eventFilter);
-        return subscribe(flags, null, sensor, listener);
-    }
-
-    protected <T> Object getSubscriber(Map<String, Object> flags, Subscription<T> s) {
-        return s.subscriber!=null ? s.subscriber : flags.containsKey("subscriber") ? flags.remove("subscriber") : s.listener;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AccessManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AccessManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AccessManager.java
deleted file mode 100644
index c2130ed..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AccessManager.java
+++ /dev/null
@@ -1,41 +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.core.mgmt.internal;
-
-import org.apache.brooklyn.api.mgmt.AccessController;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public interface AccessManager {
-
-    AccessController getAccessController();
-    
-    boolean isLocationProvisioningAllowed();
-
-    boolean isLocationManagementAllowed();
-
-    boolean isEntityManagementAllowed();
-
-    void setLocationProvisioningAllowed(boolean allowed);
-    
-    void setLocationManagementAllowed(boolean allowed);
-    
-    void setEntityManagementAllowed(boolean allowed);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AsyncCollectionChangeAdapter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AsyncCollectionChangeAdapter.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AsyncCollectionChangeAdapter.java
deleted file mode 100644
index 3ffdf5f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AsyncCollectionChangeAdapter.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 org.apache.brooklyn.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.api.mgmt.ExecutionManager;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.BasicExecutionManager;
-import org.apache.brooklyn.util.core.task.SingleThreadedScheduler;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AsyncCollectionChangeAdapter<Item> implements CollectionChangeListener<Item> {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(AsyncCollectionChangeAdapter.class);
-
-    private final ExecutionManager executor;
-    private final CollectionChangeListener<Item> delegate;
-    
-    public AsyncCollectionChangeAdapter(ExecutionManager executor, CollectionChangeListener<Item> delegate) {
-        this.executor = checkNotNull(executor, "executor");
-        this.delegate = checkNotNull(delegate, "delegate");
-        ((BasicExecutionManager) executor).setTaskSchedulerForTag(delegate, SingleThreadedScheduler.class);
-    }
-
-    @Override
-    public void onItemAdded(final Item item) {
-        executor.submit(MutableMap.of("tag", delegate), new Runnable() {
-            public void run() {
-                try {
-                    delegate.onItemAdded(item);
-                } catch (Throwable t) {
-                    LOG.warn("Error notifying listener of itemAdded("+item+")", t);
-                    Exceptions.propagate(t);
-                }
-            }
-        });
-    }
-    
-    @Override
-    public void onItemRemoved(final Item item) {
-        executor.submit(MutableMap.of("tag", delegate), new Runnable() {
-            public void run() {
-                try {
-                    delegate.onItemRemoved(item);
-                } catch (Throwable t) {
-                    LOG.warn("Error notifying listener of itemAdded("+item+")", t);
-                    Exceptions.propagate(t);
-                }
-            }
-        });
-    }
-
-    @Override
-    public int hashCode() {
-        return delegate.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        return (other instanceof AsyncCollectionChangeAdapter) && 
-                delegate.equals(((AsyncCollectionChangeAdapter<?>) other).delegate);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java
deleted file mode 100644
index 6b261db..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BasicExternalConfigSupplierRegistry.java
+++ /dev/null
@@ -1,125 +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.core.mgmt.internal;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.config.ConfigPredicates;
-import org.apache.brooklyn.core.config.ConfigUtils;
-import org.apache.brooklyn.core.config.external.ExternalConfigSupplier;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
-
-/**
- * Simple registry implementation.
- *
- * Permits a number of {@link ExternalConfigSupplier} instances to be registered, each with a unique name, for future
- * (deferred) lookup of configuration values.
- */
-public class BasicExternalConfigSupplierRegistry implements ExternalConfigSupplierRegistry {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BasicExternalConfigSupplierRegistry.class);
-
-    private final Map<String, ExternalConfigSupplier> providersByName = Maps.newLinkedHashMap();
-    private final Object providersMapMutex = new Object();
-
-    public BasicExternalConfigSupplierRegistry(ManagementContext mgmt) {
-        updateFromBrooklynProperties(mgmt);
-    }
-
-    @Override
-    public void addProvider(String name, ExternalConfigSupplier supplier) {
-        synchronized (providersMapMutex) {
-            if (providersByName.containsKey(name))
-                throw new IllegalArgumentException("Provider already registered with name '" + name + "'");
-            providersByName.put(name, supplier);
-        }
-        LOG.info("Added external config supplier named '" + name + "': " + supplier);
-    }
-
-    @Override
-    public void removeProvider(String name) {
-        synchronized (providersMapMutex) {
-            ExternalConfigSupplier supplier = providersByName.remove(name);
-            LOG.info("Removed external config supplier named '" + name + "': " + supplier);
-        }
-    }
-
-    @Override
-    public String getConfig(String providerName, String key) {
-        synchronized (providersMapMutex) {
-            ExternalConfigSupplier provider = providersByName.get(providerName);
-            if (provider == null)
-                throw new IllegalArgumentException("No provider found with name '" + providerName + "'");
-            return provider.get(key);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private void updateFromBrooklynProperties(ManagementContext mgmt) {
-        // form is:
-        //     brooklyn.external.<name> : fully.qualified.ClassName
-        //     brooklyn.external.<name>.<key> : <value>
-        //     brooklyn.external.<name>.<key> : <value>
-        //     brooklyn.external.<name>.<key> : <value>
-
-        String EXTERNAL_PROVIDER_PREFIX = "brooklyn.external.";
-        Map<String, Object> externalProviderProperties = mgmt.getConfig().submap(ConfigPredicates.startingWith(EXTERNAL_PROVIDER_PREFIX)).asMapWithStringKeys();
-        ClassLoader classloader = mgmt.getCatalogClassLoader();
-        List<Exception> exceptions = new LinkedList<Exception>();
-
-        for (String key : externalProviderProperties.keySet()) {
-            String strippedKey = key.substring(EXTERNAL_PROVIDER_PREFIX.length());
-            if (strippedKey.contains("."))
-                continue;
-
-            String name = strippedKey;
-            String providerClassname = (String) externalProviderProperties.get(key);
-            Map<String, Object> config = ConfigUtils.filterForPrefixAndStrip(externalProviderProperties, key + ".");
-
-            try {
-                Optional<ExternalConfigSupplier> configSupplier = Reflections.invokeConstructorWithArgs(classloader, providerClassname, mgmt, name, config);
-                if (!configSupplier.isPresent()) {
-                    configSupplier = Reflections.invokeConstructorWithArgs(classloader, providerClassname, mgmt, name);
-                }
-                if (!configSupplier.isPresent()) {
-                    throw new IllegalStateException("No matching constructor found in "+providerClassname);
-                }
-                
-                addProvider(name, configSupplier.get());
-
-            } catch (Exception e) {
-                LOG.error("Failed to instantiate external config supplier named '" + name + "': " + e, e);
-                exceptions.add(e);
-            }
-        }
-
-        if (!exceptions.isEmpty())
-            Exceptions.propagate(exceptions);
-    }
-
-}


[09/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerClient.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerClient.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerClient.java
deleted file mode 100644
index b0baa01..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerClient.java
+++ /dev/null
@@ -1,413 +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.core.location.access;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.net.HostAndPort;
-
-/**
- * @deprecated since 0.7.0; just use the {@link PortForwardManager}, or a direct reference to its impl {@link PortForwardManagerImpl}
- */
-@Deprecated
-public class PortForwardManagerClient implements PortForwardManager {
-
-    protected final Supplier<PortForwardManager> delegateSupplier;
-    private transient volatile PortForwardManager _delegate;
-    
-    protected PortForwardManagerClient(Supplier<PortForwardManager> supplier) {
-        this.delegateSupplier = supplier;
-    }
-    
-    /** creates an instance given a supplier; 
-     * the supplier should be brooklyn-persistable, that is to say
-     * references should be in terms of entities/locations 
-     * which can retrieve an authoritative source even under cloning */
-    public static PortForwardManager fromSupplier(Supplier<PortForwardManager> supplier) {
-        return new PortForwardManagerClient(supplier);
-    }
-
-    /** creates an instance given an entity and an interface method it implements to retrieve the PortForwardManager */ 
-    public static PortForwardManager fromMethodOnEntity(final Entity entity, final String getterMethodOnEntity) {
-        Preconditions.checkNotNull(entity);
-        Preconditions.checkNotNull(getterMethodOnEntity);
-        return new PortForwardManagerClient(new Supplier<PortForwardManager>() {
-            @Override
-            public PortForwardManager get() {
-                PortForwardManager result;
-                try {
-                    result = (PortForwardManager) entity.getClass().getMethod(getterMethodOnEntity).invoke(entity);
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    throw new IllegalStateException("Cannot invoke "+getterMethodOnEntity+" on "+entity+" ("+entity.getClass()+"): "+e, e);
-                }
-                if (result==null)
-                    throw new IllegalStateException("No PortForwardManager available via "+getterMethodOnEntity+" on "+entity+" (returned null)");
-                return result;
-            }
-        });
-    }
-
-    /** creates an instance given an entity and {@link AttributeSensor} to retrieve the PortForwardManager */ 
-    public static PortForwardManager fromAttributeOnEntity(final Entity entity, final AttributeSensor<PortForwardManager> attributeOnEntity) {
-        Preconditions.checkNotNull(entity);
-        Preconditions.checkNotNull(attributeOnEntity);
-        return new PortForwardManagerClient(new Supplier<PortForwardManager>() {
-            @Override
-            public PortForwardManager get() {
-                PortForwardManager result = entity.getAttribute(attributeOnEntity);
-                if (result==null)
-                    throw new IllegalStateException("No PortForwardManager available via "+attributeOnEntity+" on "+entity+" (returned null)");
-                return result;
-            }
-        });
-    }
-    
-    protected PortForwardManager getDelegate() {
-        if (_delegate==null) {
-            _delegate = delegateSupplier.get();
-        }
-        return _delegate;
-    }
-
-    @Override
-    public int acquirePublicPort(String publicIpId) {
-        return getDelegate().acquirePublicPort(publicIpId);
-    }
-
-    @Override
-    public void associate(String publicIpId, HostAndPort publicEndpoint, Location l, int privatePort) {
-        getDelegate().associate(publicIpId, publicEndpoint, l, privatePort);
-    }
-
-    @Override
-    public void associate(String publicIpId, HostAndPort publicEndpoint, int privatePort) {
-        getDelegate().associate(publicIpId, publicEndpoint, privatePort);
-    }
-
-    @Override
-    public HostAndPort lookup(Location l, int privatePort) {
-        return getDelegate().lookup(l, privatePort);
-    }
-
-    @Override
-    public HostAndPort lookup(String publicIpId, int privatePort) {
-        return getDelegate().lookup(publicIpId, privatePort);
-    }
-
-    @Override
-    public boolean forgetPortMapping(String publicIpId, int publicPort) {
-        return getDelegate().forgetPortMapping(publicIpId, publicPort);
-    }
-
-    @Override
-    public boolean forgetPortMappings(Location location) {
-        return getDelegate().forgetPortMappings(location);
-    }
-
-    @Override
-    public boolean forgetPortMappings(String publicIpId) {
-        return getDelegate().forgetPortMappings(publicIpId);
-    }
-
-    @Override
-    public String getId() {
-        return getDelegate().getId();
-    }
-
-    @Override
-    public String getScope() {
-        return getDelegate().getScope();
-    }
-
-    @Override
-    public void addAssociationListener(AssociationListener listener, Predicate<? super AssociationMetadata> filter) {
-        getDelegate().addAssociationListener(listener, filter);
-    }
-
-    @Override
-    public void removeAssociationListener(AssociationListener listener) {
-        getDelegate().removeAssociationListener(listener);
-    }
-
-    @Override
-    public String toVerboseString() {
-        return getClass().getName()+"[wrapping="+getDelegate().toVerboseString()+"]";
-    }
-
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Deprecated
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Reserves a unique public port for the purpose of forwarding to the given target,
-     * associated with a given location for subsequent lookup purpose.
-     * <p>
-     * If already allocated, returns the previously allocated.
-     * 
-     * @deprecated since 0.7.0; use {@link #acquirePublicPort(String)}, and then use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Override
-    @Deprecated
-    public int acquirePublicPort(String publicIpId, Location l, int privatePort) {
-        return getDelegate().acquirePublicPort(publicIpId, l, privatePort);
-    }
-
-    /** 
-     * Returns old mapping if it existed, null if it is new.
-     * 
-     * @deprecated since 0.7.0; use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Override
-    @Deprecated
-    public PortMapping acquirePublicPortExplicit(String publicIpId, int publicPort) {
-        return getDelegate().acquirePublicPortExplicit(publicIpId, publicPort);
-    }
-
-    /**
-     * Records a location and private port against a publicIp and public port,
-     * to support {@link #lookup(Location, int)}.
-     * <p>
-     * Superfluous if {@link #acquirePublicPort(String, Location, int)} was used,
-     * but strongly recommended if {@link #acquirePublicPortExplicit(String, int)} was used
-     * e.g. if the location is not known ahead of time.
-     * 
-     * @deprecated Use {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Override
-    @Deprecated
-    public void associate(String publicIpId, int publicPort, Location l, int privatePort) {
-        getDelegate().associate(publicIpId, publicPort, l, privatePort);
-    }
-
-    /**
-     * Records a public hostname or address to be associated with the given publicIpId for lookup purposes.
-     * <p>
-     * Conceivably this may have to be access-location specific.
-     * 
-     * @deprecated Use {@link #associate(String, HostAndPort, int)} or {@link #associate(String, HostAndPort, Location, int)}
-     */
-    @Override
-    @Deprecated
-    public void recordPublicIpHostname(String publicIpId, String hostnameOrPublicIpAddress) {
-        getDelegate().recordPublicIpHostname(publicIpId, hostnameOrPublicIpAddress);
-    }
-
-    /**
-     * Returns a recorded public hostname or address.
-     * 
-     * @deprecated Use {@link #lookup(String, int)} or {@link #lookup(Location, int)}
-     */
-    @Override
-    @Deprecated
-    public String getPublicIpHostname(String publicIpId) {
-        return getDelegate().getPublicIpHostname(publicIpId);
-    }
-    
-    /**
-     * Clears a previous call to {@link #recordPublicIpHostname(String, String)}.
-     * 
-     * @deprecated Use {@link #forgetPortMapping(String, int)} or {@link #forgetPortMapping(Location, int)}
-     */
-    @Override
-    @Deprecated
-    public boolean forgetPublicIpHostname(String publicIpId) {
-        return getDelegate().forgetPublicIpHostname(publicIpId);
-    }
-
-    @Override
-    @Deprecated
-    public boolean isClient() {
-        return true;
-    }
-
-
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Deprecated; just internal
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    /** 
-     * Returns the port mapping for a given publicIpId and public port.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public PortMapping getPortMappingWithPublicSide(String publicIpId, int publicPort) {
-        return getDelegate().getPortMappingWithPublicSide(publicIpId, publicPort);
-    }
-
-    /** 
-     * Returns the subset of port mappings associated with a given public IP ID.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public Collection<PortMapping> getPortMappingWithPublicIpId(String publicIpId) {
-        return getDelegate().getPortMappingWithPublicIpId(publicIpId);
-    }
-
-    /** 
-     * @see #forgetPortMapping(String, int)
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public boolean forgetPortMapping(PortMapping m) {
-        return getDelegate().forgetPortMapping(m);
-    }
-
-    /**
-     * Returns the public host and port for use accessing the given mapping.
-     * <p>
-     * Conceivably this may have to be access-location specific.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public HostAndPort getPublicHostAndPort(PortMapping m) {
-        return getDelegate().getPublicHostAndPort(m);
-    }
-
-    /** 
-     * Returns the subset of port mappings associated with a given location.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public Collection<PortMapping> getLocationPublicIpIds(Location l) {
-        return getDelegate().getLocationPublicIpIds(l);
-    }
-        
-    /** 
-     * Returns the mapping to a given private port, or null if none.
-     * 
-     * @deprecated since 0.7.0; this method will be internal only
-     */
-    @Override
-    @Deprecated
-    public PortMapping getPortMappingWithPrivateSide(Location l, int privatePort) {
-        return getDelegate().getPortMappingWithPrivateSide(l, privatePort);
-    }
-    
-    @Override
-    public String toString() {
-        return getClass().getName()+"[id="+getId()+"]";
-    }
-
-    @Override
-    public String getDisplayName() {
-        return getDelegate().getDisplayName();
-    }
-
-    @Override
-    public Location getParent() {
-        return getDelegate().getParent();
-    }
-
-    @Override
-    public Collection<Location> getChildren() {
-        return getDelegate().getChildren();
-    }
-
-    @Override
-    public void setParent(Location newParent) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean containsLocation(Location potentialDescendent) {
-        return getDelegate().containsLocation(potentialDescendent);
-    }
-
-    @Override
-    public <T> T getConfig(ConfigKey<T> key) {
-        return getDelegate().getConfig(key);
-    }
-
-    @Override
-    public <T> T getConfig(HasConfigKey<T> key) {
-        return getDelegate().getConfig(key);
-    }
-
-    @Override
-    public boolean hasConfig(ConfigKey<?> key, boolean includeInherited) {
-        return getDelegate().hasConfig(key, includeInherited);
-    }
-
-    @Override
-    public Map<String, Object> getAllConfig(boolean includeInherited) {
-        return getDelegate().getAllConfig(includeInherited);
-    }
-
-    @Override
-    public boolean hasExtension(Class<?> extensionType) {
-        return getDelegate().hasExtension(extensionType);
-    }
-
-    @Override
-    public <T> T getExtension(Class<T> extensionType) {
-        return getDelegate().getExtension(extensionType);
-    }
-
-    @Override
-    public String getCatalogItemId() {
-        return getDelegate().getCatalogItemId();
-    }
-
-    @Override
-    public TagSupport tags() {
-        return getDelegate().tags();
-    }
-
-    @Override
-    public RelationSupport<Location> relations() {
-        return getDelegate().relations();
-    }
-    
-    @Override
-    public <T> T setConfig(ConfigKey<T> key, T val) {
-        return getDelegate().config().set(key, val);
-    }
-
-    @Override
-    public ConfigurationSupport config() {
-        return getDelegate().config();
-    }
-    
-    @Override
-    public SubscriptionSupport subscriptions() {
-        return getDelegate().subscriptions();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerImpl.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerImpl.java
deleted file mode 100644
index 30be900..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerImpl.java
+++ /dev/null
@@ -1,505 +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.core.location.access;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.rebind.RebindContext;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.mgmt.rebind.BasicLocationRebindSupport;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.net.HostAndPort;
-
-/**
- * 
- * @author aled
- *
- * TODO This implementation is not efficient, and currently has a cap of about 50000 rules.
- * Need to improve the efficiency and scale.
- * A quick win could be to use a different portReserved counter for each publicIpId,
- * when calling acquirePublicPort?
- * 
- * TODO Callers need to be more careful in acquirePublicPort for which ports are actually in use.
- * If multiple apps sharing the same public-ip (e.g. in the same vcloud-director vOrg) then they 
- * must not allocate the same public port (e.g. ensure they share the same PortForwardManager
- * by using the same scope in 
- * {@code managementContext.getLocationRegistry().resolve("portForwardManager(scope=global)")}.
- * However, this still doesn't check if the port is *actually* available. For example, if a
- * different Brooklyn instance is also deploying there then we can get port conflicts, or if 
- * some ports in that range are already in use (e.g. due to earlier dev/test runs) then this
- * will not be respected. Callers should probably figure out the port number themselves, but
- * that also leads to concurrency issues.
- * 
- * TODO The publicIpId means different things to different callers:
- * <ul>
- *   <li> In acquirePublicPort() it is (often?) an identifier of the actual public ip.
- *   <li> In later calls to associate(), it is (often?) an identifier for the target machine
- *        such as the jcloudsMachine.getJcloudsId().
- * </ul>
- */
-@SuppressWarnings("serial")
-public class PortForwardManagerImpl extends AbstractLocation implements PortForwardManager {
-
-    private static final Logger log = LoggerFactory.getLogger(PortForwardManagerImpl.class);
-    
-    protected final Map<String,PortMapping> mappings = new LinkedHashMap<String,PortMapping>();
-
-    private final Map<AssociationListener, Predicate<? super AssociationMetadata>> associationListeners = new ConcurrentHashMap<AssociationListener, Predicate<? super AssociationMetadata>>();
-
-    @Deprecated
-    protected final Map<String,String> publicIpIdToHostname = new LinkedHashMap<String,String>();
-    
-    // horrible hack -- see javadoc above
-    private final AtomicInteger portReserved = new AtomicInteger(11000);
-
-    private final Object mutex = new Object();
-    
-    public PortForwardManagerImpl() {
-        super();
-        if (isLegacyConstruction()) {
-            log.warn("Deprecated construction of "+PortForwardManagerImpl.class.getName()+"; instead use location resolver");
-        }
-    }
-    
-    @Override
-    public void init() {
-        super.init();
-        Integer portStartingPoint;
-        Object rawPort = getAllConfigBag().getStringKey(PORT_FORWARD_MANAGER_STARTING_PORT.getName());
-        if (rawPort != null) {
-            portStartingPoint = getConfig(PORT_FORWARD_MANAGER_STARTING_PORT);
-        } else {
-            portStartingPoint = getManagementContext().getConfig().getConfig(PORT_FORWARD_MANAGER_STARTING_PORT);
-        }
-        portReserved.set(portStartingPoint);
-        log.debug(this+" set initial port to "+portStartingPoint);
-    }
-
-    // TODO Need to use attributes for these so they are persisted (once a location is an entity),
-    // rather than this deprecated approach of custom fields.
-    @Override
-    public RebindSupport<LocationMemento> getRebindSupport() {
-        return new BasicLocationRebindSupport(this) {
-            @Override public LocationMemento getMemento() {
-                Map<String, PortMapping> mappingsCopy;
-                Map<String,String> publicIpIdToHostnameCopy;
-                synchronized (mutex) {
-                    mappingsCopy = MutableMap.copyOf(mappings);
-                    publicIpIdToHostnameCopy = MutableMap.copyOf(publicIpIdToHostname);
-                }
-                return getMementoWithProperties(MutableMap.<String,Object>of(
-                        "mappings", mappingsCopy, 
-                        "portReserved", portReserved.get(), 
-                        "publicIpIdToHostname", publicIpIdToHostnameCopy));
-            }
-            @Override
-            protected void doReconstruct(RebindContext rebindContext, LocationMemento memento) {
-                super.doReconstruct(rebindContext, memento);
-                mappings.putAll( Preconditions.checkNotNull((Map<String, PortMapping>) memento.getCustomField("mappings"), "mappings was not serialized correctly"));
-                portReserved.set( (Integer)memento.getCustomField("portReserved"));
-                publicIpIdToHostname.putAll( Preconditions.checkNotNull((Map<String, String>)memento.getCustomField("publicIpIdToHostname"), "publicIpIdToHostname was not serialized correctly") );
-            }
-        };
-    }
-    
-    @Override
-    public int acquirePublicPort(String publicIpId) {
-        int port;
-        synchronized (mutex) {
-            // far too simple -- see javadoc above
-            port = getNextPort();
-            
-            // TODO When delete deprecated code, stop registering PortMapping until associate() is called
-            PortMapping mapping = new PortMapping(publicIpId, port, null, -1);
-            log.debug(this+" allocating public port "+port+" on "+publicIpId+" (no association info yet)");
-            
-            mappings.put(makeKey(publicIpId, port), mapping);
-        }
-        onChanged();
-        return port;
-    }
-
-    protected int getNextPort() {
-        // far too simple -- see javadoc above
-        return portReserved.getAndIncrement();
-    }
-    
-    @Override
-    public void associate(String publicIpId, HostAndPort publicEndpoint, Location l, int privatePort) {
-        associateImpl(publicIpId, publicEndpoint, l, privatePort);
-        emitAssociationCreatedEvent(publicIpId, publicEndpoint, l, privatePort);
-    }
-
-    @Override
-    public void associate(String publicIpId, HostAndPort publicEndpoint, int privatePort) {
-        associateImpl(publicIpId, publicEndpoint, null, privatePort);
-        emitAssociationCreatedEvent(publicIpId, publicEndpoint, null, privatePort);
-    }
-
-    protected void associateImpl(String publicIpId, HostAndPort publicEndpoint, Location l, int privatePort) {
-        synchronized (mutex) {
-            String publicIp = publicEndpoint.getHostText();
-            int publicPort = publicEndpoint.getPort();
-            recordPublicIpHostname(publicIpId, publicIp);
-            PortMapping mapping = new PortMapping(publicIpId, publicEndpoint, l, privatePort);
-            PortMapping oldMapping = getPortMappingWithPublicSide(publicIpId, publicPort);
-            log.debug(this+" associating public "+publicEndpoint+" on "+publicIpId+" with private port "+privatePort+" at "+l+" ("+mapping+")"
-                    +(oldMapping == null ? "" : " (overwriting "+oldMapping+" )"));
-            mappings.put(makeKey(publicIpId, publicPort), mapping);
-        }
-        onChanged();
-    }
-
-    private void emitAssociationCreatedEvent(String publicIpId, HostAndPort publicEndpoint, Location location, int privatePort) {
-        AssociationMetadata metadata = new AssociationMetadata(publicIpId, publicEndpoint, location, privatePort);
-        for (Map.Entry<AssociationListener, Predicate<? super AssociationMetadata>> entry : associationListeners.entrySet()) {
-            if (entry.getValue().apply(metadata)) {
-                try {
-                    entry.getKey().onAssociationCreated(metadata);
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.warn("Exception thrown when emitting association creation event " + metadata, e);
-                }
-            }
-        }
-    }
-
-    @Override
-    public HostAndPort lookup(Location l, int privatePort) {
-        synchronized (mutex) {
-            for (PortMapping m: mappings.values()) {
-                if (l.equals(m.target) && privatePort == m.privatePort)
-                    return getPublicHostAndPort(m);
-            }
-        }
-        return null;
-    }
-    
-    @Override
-    public HostAndPort lookup(String publicIpId, int privatePort) {
-        synchronized (mutex) {
-            for (PortMapping m: mappings.values()) {
-                if (publicIpId.equals(m.publicIpId) && privatePort==m.privatePort)
-                    return getPublicHostAndPort(m);
-            }
-        }
-        return null;
-    }
-    
-    @Override
-    public boolean forgetPortMapping(String publicIpId, int publicPort) {
-        PortMapping old;
-        synchronized (mutex) {
-            old = mappings.remove(makeKey(publicIpId, publicPort));
-            if (old != null) {
-                emitAssociationDeletedEvent(associationMetadataFromPortMapping(old));
-            }
-            log.debug("cleared port mapping for "+publicIpId+":"+publicPort+" - "+old);
-        }
-        if (old != null) onChanged();
-        return (old != null);
-    }
-    
-    @Override
-    public boolean forgetPortMappings(Location l) {
-        List<PortMapping> result = Lists.newArrayList();
-        synchronized (mutex) {
-            for (Iterator<PortMapping> iter = mappings.values().iterator(); iter.hasNext();) {
-                PortMapping m = iter.next();
-                if (l.equals(m.target)) {
-                    iter.remove();
-                    result.add(m);
-                    emitAssociationDeletedEvent(associationMetadataFromPortMapping(m));
-                }
-            }
-        }
-        if (log.isDebugEnabled()) log.debug("cleared all port mappings for "+l+" - "+result);
-        if (!result.isEmpty()) {
-            onChanged();
-        }
-        return !result.isEmpty();
-    }
-    
-    @Override
-    public boolean forgetPortMappings(String publicIpId) {
-        List<PortMapping> result = Lists.newArrayList();
-        synchronized (mutex) {
-            for (Iterator<PortMapping> iter = mappings.values().iterator(); iter.hasNext();) {
-                PortMapping m = iter.next();
-                if (publicIpId.equals(m.publicIpId)) {
-                    iter.remove();
-                    result.add(m);
-                    emitAssociationDeletedEvent(associationMetadataFromPortMapping(m));
-                }
-            }
-        }
-        if (log.isDebugEnabled()) log.debug("cleared all port mappings for "+publicIpId+" - "+result);
-        if (!result.isEmpty()) {
-            onChanged();
-        }
-        return !result.isEmpty();
-    }
-
-    private void emitAssociationDeletedEvent(AssociationMetadata metadata) {
-        for (Map.Entry<AssociationListener, Predicate<? super AssociationMetadata>> entry : associationListeners.entrySet()) {
-            if (entry.getValue().apply(metadata)) {
-                try {
-                    entry.getKey().onAssociationDeleted(metadata);
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.warn("Exception thrown when emitting association creation event " + metadata, e);
-                }
-            }
-        }
-    }
-    
-    @Override
-    protected ToStringHelper string() {
-        int size;
-        synchronized (mutex) {
-            size = mappings.size();
-        }
-        return super.string().add("scope", getScope()).add("mappingsSize", size);
-    }
-
-    @Override
-    public String toVerboseString() {
-        String mappingsStr;
-        synchronized (mutex) {
-            mappingsStr = mappings.toString();
-        }
-        return string().add("mappings", mappingsStr).toString();
-    }
-
-    @Override
-    public String getScope() {
-        return checkNotNull(getConfig(SCOPE), "scope");
-    }
-
-    @Override
-    public boolean isClient() {
-        return false;
-    }
-
-    @Override
-    public void addAssociationListener(AssociationListener listener, Predicate<? super AssociationMetadata> filter) {
-        associationListeners.put(listener, filter);
-    }
-
-    @Override
-    public void removeAssociationListener(AssociationListener listener) {
-        associationListeners.remove(listener);
-    }
-
-    protected String makeKey(String publicIpId, int publicPort) {
-        return publicIpId+":"+publicPort;
-    }
-
-    private AssociationMetadata associationMetadataFromPortMapping(PortMapping portMapping) {
-        String publicIpId = portMapping.getPublicEndpoint().getHostText();
-        HostAndPort publicEndpoint = portMapping.getPublicEndpoint();
-        Location location = portMapping.getTarget();
-        int privatePort = portMapping.getPrivatePort();
-        return new AssociationMetadata(publicIpId, publicEndpoint, location, privatePort);
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Internal state, for generating memento
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    public List<PortMapping> getPortMappings() {
-        synchronized (mutex) {
-            return ImmutableList.copyOf(mappings.values());
-        }
-    }
-    
-    public Map<String, Integer> getPortCounters() {
-        return ImmutableMap.of("global", portReserved.get());
-    }
-
-    
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Deprecated
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    @Override
-    @Deprecated
-    public PortMapping acquirePublicPortExplicit(String publicIpId, int port) {
-        PortMapping mapping = new PortMapping(publicIpId, port, null, -1);
-        log.debug("assigning explicit public port "+port+" at "+publicIpId);
-        PortMapping result;
-        synchronized (mutex) {
-            result = mappings.put(makeKey(publicIpId, port), mapping);
-        }
-        onChanged();
-        return result;
-    }
-
-    @Override
-    @Deprecated
-    public boolean forgetPortMapping(PortMapping m) {
-        return forgetPortMapping(m.publicIpId, m.publicPort);
-    }
-
-    @Override
-    @Deprecated
-    public void recordPublicIpHostname(String publicIpId, String hostnameOrPublicIpAddress) {
-        log.debug("recording public IP "+publicIpId+" associated with "+hostnameOrPublicIpAddress);
-        synchronized (mutex) {
-            String old = publicIpIdToHostname.put(publicIpId, hostnameOrPublicIpAddress);
-            if (old!=null && !old.equals(hostnameOrPublicIpAddress))
-                log.warn("Changing hostname recorded against public IP "+publicIpId+"; from "+old+" to "+hostnameOrPublicIpAddress);
-        }
-        onChanged();
-    }
-
-    @Override
-    @Deprecated
-    public String getPublicIpHostname(String publicIpId) {
-        synchronized (mutex) {
-            return publicIpIdToHostname.get(publicIpId);
-        }
-    }
-    
-    @Override
-    @Deprecated
-    public boolean forgetPublicIpHostname(String publicIpId) {
-        log.debug("forgetting public IP "+publicIpId+" association");
-        boolean result;
-        synchronized (mutex) {
-            result = (publicIpIdToHostname.remove(publicIpId) != null);
-        }
-        onChanged();
-        return result;
-    }
-
-    @Override
-    @Deprecated
-    public int acquirePublicPort(String publicIpId, Location l, int privatePort) {
-        int publicPort;
-        synchronized (mutex) {
-            PortMapping old = getPortMappingWithPrivateSide(l, privatePort);
-            // only works for 1 public IP ID per location (which is the norm)
-            if (old!=null && old.publicIpId.equals(publicIpId)) {
-                log.debug("request to acquire public port at "+publicIpId+" for "+l+":"+privatePort+", reusing old assignment "+old);
-                return old.getPublicPort();
-            }
-            
-            publicPort = acquirePublicPort(publicIpId);
-            log.debug("request to acquire public port at "+publicIpId+" for "+l+":"+privatePort+", allocating "+publicPort);
-            associateImpl(publicIpId, publicPort, l, privatePort);
-        }
-        onChanged();
-        return publicPort;
-    }
-
-    @Override
-    @Deprecated
-    public void associate(String publicIpId, int publicPort, Location l, int privatePort) {
-        synchronized (mutex) {
-            associateImpl(publicIpId, publicPort, l, privatePort);
-        }
-        onChanged();
-    }
-
-    protected void associateImpl(String publicIpId, int publicPort, Location l, int privatePort) {
-        synchronized (mutex) {
-            PortMapping mapping = new PortMapping(publicIpId, publicPort, l, privatePort);
-            PortMapping oldMapping = getPortMappingWithPublicSide(publicIpId, publicPort);
-            log.debug("associating public port "+publicPort+" on "+publicIpId+" with private port "+privatePort+" at "+l+" ("+mapping+")"
-                    +(oldMapping == null ? "" : " (overwriting "+oldMapping+" )"));
-            mappings.put(makeKey(publicIpId, publicPort), mapping);
-        }
-    }
-
-    ///////////////////////////////////////////////////////////////////////////////////
-    // Internal only; make protected when deprecated interface method removed
-    ///////////////////////////////////////////////////////////////////////////////////
-
-    @Override
-    public HostAndPort getPublicHostAndPort(PortMapping m) {
-        if (m.publicEndpoint == null) {
-            String hostname = getPublicIpHostname(m.publicIpId);
-            if (hostname==null)
-                throw new IllegalStateException("No public hostname associated with "+m.publicIpId+" (mapping "+m+")");
-            return HostAndPort.fromParts(hostname, m.publicPort);
-        } else {
-            return m.publicEndpoint;
-        }
-    }
-
-    @Override
-    public PortMapping getPortMappingWithPublicSide(String publicIpId, int publicPort) {
-        synchronized (mutex) {
-            return mappings.get(makeKey(publicIpId, publicPort));
-        }
-    }
-
-    @Override
-    public Collection<PortMapping> getPortMappingWithPublicIpId(String publicIpId) {
-        List<PortMapping> result = new ArrayList<PortMapping>();
-        synchronized (mutex) {
-            for (PortMapping m: mappings.values())
-                if (publicIpId.equals(m.publicIpId)) result.add(m);
-        }
-        return result;
-    }
-
-    /** returns the subset of port mappings associated with a given location */
-    @Override
-    public Collection<PortMapping> getLocationPublicIpIds(Location l) {
-        List<PortMapping> result = new ArrayList<PortMapping>();
-        synchronized (mutex) {
-            for (PortMapping m: mappings.values())
-                if (l.equals(m.getTarget())) result.add(m);
-        }
-        return result;
-    }
-
-    @Override
-    public PortMapping getPortMappingWithPrivateSide(Location l, int privatePort) {
-        synchronized (mutex) {
-            for (PortMapping m: mappings.values())
-                if (l.equals(m.getTarget()) && privatePort==m.privatePort) return m;
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerLocationResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerLocationResolver.java
deleted file mode 100644
index 3a52877..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerLocationResolver.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 org.apache.brooklyn.core.location.access;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.core.location.AbstractLocationResolver;
-import org.apache.brooklyn.core.location.LocationConfigUtils;
-import org.apache.brooklyn.core.location.LocationPredicates;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-public class PortForwardManagerLocationResolver extends AbstractLocationResolver {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PortForwardManagerLocationResolver.class);
-
-    public static final String PREFIX = "portForwardManager";
-
-    @Override
-    public String getPrefix() {
-        return PREFIX;
-    }
-
-    @Override
-    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
-        ConfigBag config = extractConfig(locationFlags, spec, registry);
-        Map globalProperties = registry.getProperties();
-        String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
-        String scope = config.get(PortForwardManager.SCOPE);
-
-        Optional<Location> result = Iterables.tryFind(managementContext.getLocationManager().getLocations(), 
-                Predicates.and(
-                        Predicates.instanceOf(PortForwardManager.class), 
-                        LocationPredicates.configEqualTo(PortForwardManager.SCOPE, scope)));
-        
-        if (result.isPresent()) {
-            return result.get();
-        } else {
-            PortForwardManager loc = managementContext.getLocationManager().createLocation(LocationSpec.create(PortForwardManagerImpl.class)
-                    .configure(config.getAllConfig())
-                    .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, locationFlags, globalProperties, namedLocation)));
-            
-            if (LOG.isDebugEnabled()) LOG.debug("Created "+loc+" for scope "+scope);
-            return loc;
-        }
-    }
-
-    @Override
-    protected Class<? extends Location> getLocationType() {
-        return PortForwardManager.class;
-    }
-
-    @Override
-    protected SpecParser getSpecParser() {
-        return new AbstractLocationResolver.SpecParser(getPrefix()).setExampleUsage("\"portForwardManager\" or \"portForwardManager(scope=global)\"");
-    }
-    
-    @Override
-    protected ConfigBag extractConfig(Map<?,?> locationFlags, String spec, LocationRegistry registry) {
-        ConfigBag config = super.extractConfig(locationFlags, spec, registry);
-        config.putAsStringKeyIfAbsent("name", "localhost");
-        return config;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortMapping.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortMapping.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortMapping.java
deleted file mode 100644
index 06d92cb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/access/PortMapping.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.core.location.access;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.location.Location;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.net.HostAndPort;
-
-public class PortMapping {
-
-    final String publicIpId;
-    final HostAndPort publicEndpoint;
-    final int publicPort;
-
-    final Location target;
-    final int privatePort;
-    // TODO CIDR's ?
-
-    public PortMapping(String publicIpId, HostAndPort publicEndpoint, Location target, int privatePort) {
-        this.publicIpId = checkNotNull(publicIpId, "publicIpId");
-        this.publicEndpoint = checkNotNull(publicEndpoint, "publicEndpoint");
-        this.publicPort = publicEndpoint.getPort();
-        this.target = target;
-        this.privatePort = privatePort;
-    }
-    
-    public PortMapping(String publicIpId, int publicPort, Location target, int privatePort) {
-        this.publicIpId = checkNotNull(publicIpId, "publicIpId");
-        this.publicEndpoint = null;
-        this.publicPort = publicPort;
-        this.target = target;
-        this.privatePort = privatePort;
-    }
-
-    // In a release after 0.7.0, this will no longer be @Nullable
-    @Beta
-    @Nullable
-    public HostAndPort getPublicEndpoint() {
-        return publicEndpoint;
-    }
-
-    public int getPublicPort() {
-        return publicPort;
-    }
-
-    public Location getTarget() {
-        return target;
-    }
-    
-    public int getPrivatePort() {
-        return privatePort;
-    }
-    
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("publicIpId", publicIpId+":"+publicPort)
-                .add("publicEndpoint", (publicEndpoint == null ? publicPort : publicEndpoint))
-                .add("targetLocation", target)
-                .add("targetPort", privatePort)
-                .toString();
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof PortMapping)) return false;
-        PortMapping opm = (PortMapping)obj;
-        return Objects.equal(publicIpId, opm.publicIpId) &&
-            Objects.equal(publicPort, opm.publicPort) &&
-            Objects.equal(target, opm.target) &&
-            Objects.equal(privatePort, opm.privatePort);
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(publicIpId, publicPort, target, privatePort);
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractAvailabilityZoneExtension.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractAvailabilityZoneExtension.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractAvailabilityZoneExtension.java
deleted file mode 100644
index 267f708..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractAvailabilityZoneExtension.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 org.apache.brooklyn.core.location.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-@Beta
-public abstract class AbstractAvailabilityZoneExtension implements AvailabilityZoneExtension {
-
-    protected final ManagementContext managementContext;
-    protected final AtomicReference<List<Location>> subLocations = new AtomicReference<List<Location>>();
-    private final Object mutex = new Object();
-    
-    public AbstractAvailabilityZoneExtension(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-    }
-
-    @Override
-    public List<Location> getSubLocations(int max) {
-        List<Location> all = getAllSubLocations();
-        return all.subList(0, Math.min(max, all.size()));
-    }
-
-    @Override
-    public List<Location> getSubLocationsByName(Predicate<? super String> namePredicate, int max) {
-        List<Location> result = Lists.newArrayList();
-        List<Location> all = getAllSubLocations();
-        for (Location loc : all) {
-            if (isNameMatch(loc, namePredicate)) {
-                result.add(loc);
-            }
-        }
-        return Collections.<Location>unmodifiableList(result);
-    }
-
-    @Override
-    public List<Location> getAllSubLocations() {
-        synchronized (mutex) {
-            if (subLocations.get() == null) {
-                List<Location> result = doGetAllSubLocations();
-                subLocations.set(ImmutableList.copyOf(result));
-            }
-        }
-        return subLocations.get();
-    }
-
-    /**
-     * <strong>Note</strong> this method can be called while synchronized on {@link #mutex}.
-     */
-    // TODO bad pattern, as this will likely call alien code (such as asking cloud provider?!)
-    protected abstract List<Location> doGetAllSubLocations();
-
-    protected abstract boolean isNameMatch(Location loc, Predicate<? super String> namePredicate);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractCloudMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractCloudMachineProvisioningLocation.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractCloudMachineProvisioningLocation.java
deleted file mode 100644
index 504033a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AbstractCloudMachineProvisioningLocation.java
+++ /dev/null
@@ -1,97 +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.core.location.cloud;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.api.location.MachineProvisioningLocation;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.internal.ssh.SshTool;
-
-public abstract class AbstractCloudMachineProvisioningLocation extends AbstractLocation
-implements MachineProvisioningLocation<MachineLocation>, CloudLocationConfig
-{
-   public AbstractCloudMachineProvisioningLocation() {
-      super();
-   }
-
-    /** typically wants at least ACCESS_IDENTITY and ACCESS_CREDENTIAL */
-    public AbstractCloudMachineProvisioningLocation(Map<?,?> conf) {
-        super(conf);
-    }
-
-    /** uses reflection to create an object of the same type, assuming a Map constructor;
-     * subclasses can extend and downcast the result */
-    @Override
-    public AbstractCloudMachineProvisioningLocation newSubLocation(Map<?,?> newFlags) {
-        return newSubLocation(getClass(), newFlags);
-    }
-
-    public AbstractCloudMachineProvisioningLocation newSubLocation(Class<? extends AbstractCloudMachineProvisioningLocation> type, Map<?,?> newFlags) {
-        // TODO should be able to use ConfigBag.newInstanceExtending; would require moving stuff around to api etc
-        // TODO was previously `return LocationCreationUtils.newSubLocation(newFlags, this)`; need to retest on CloudStack etc
-        return getManagementContext().getLocationManager().createLocation(LocationSpec.create(type)
-                .parent(this)
-                .configure(config().getLocalBag().getAllConfig()) // FIXME Should this just be inherited?
-                .configure(newFlags));
-    }
-    
-    @Override
-    public Map<String, Object> getProvisioningFlags(Collection<String> tags) {
-        if (tags.size() > 0) {
-            LOG.warn("Location {}, ignoring provisioning tags {}", this, tags);
-        }
-        return MutableMap.<String, Object>of();
-    }
-
-    // ---------------- utilities --------------------
-    
-    protected ConfigBag extractSshConfig(ConfigBag setup, ConfigBag alt) {
-        ConfigBag sshConfig = new ConfigBag();
-        
-        if (setup.containsKey(PASSWORD)) {
-            sshConfig.put(SshTool.PROP_PASSWORD, setup.get(PASSWORD));
-        } else if (alt.containsKey(PASSWORD)) {
-            sshConfig.put(SshTool.PROP_PASSWORD, alt.get(PASSWORD));
-        }
-        
-        if (setup.containsKey(PRIVATE_KEY_DATA)) {
-            sshConfig.put(SshTool.PROP_PRIVATE_KEY_DATA, setup.get(PRIVATE_KEY_DATA));
-        } else if (setup.containsKey(PRIVATE_KEY_FILE)) {
-            sshConfig.put(SshTool.PROP_PRIVATE_KEY_FILE, setup.get(PRIVATE_KEY_FILE));
-        } else if (alt.containsKey(PRIVATE_KEY_DATA)) {
-            sshConfig.put(SshTool.PROP_PRIVATE_KEY_DATA, alt.get(PRIVATE_KEY_DATA));
-        }
-        
-        if (setup.containsKey(PRIVATE_KEY_PASSPHRASE)) {
-            // NB: not supported in jclouds (but it is by our ssh tool)
-            sshConfig.put(SshTool.PROP_PRIVATE_KEY_PASSPHRASE, setup.get(PRIVATE_KEY_PASSPHRASE));
-        }
-
-        // TODO extract other SshTool properties ?
-        
-        return sshConfig;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AvailabilityZoneExtension.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AvailabilityZoneExtension.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AvailabilityZoneExtension.java
deleted file mode 100644
index 657438d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/AvailabilityZoneExtension.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 org.apache.brooklyn.core.location.cloud;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.location.multi.MultiLocation;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Predicate;
-
-/**
- * For a location that has sub-zones within it (e.g. an AWS region has availability zones that can be
- * mapped as sub-locations), this extension interface allows those to be accessed and used.
- * For some well-known clouds, the availability zones are automatically set, although for others they may
- * have to be configured explicitly. The "multi:(locs,...)" location descriptor (cf {@link MultiLocation}) allows
- * this to be down at runtime.
- * <p>
- * Note that only entities which are explicitly aware of the {@link AvailabilityZoneExtension}
- * will use availability zone information. For example {@link DynamicCluster} 
- * <p>
- * Implementers are strongly encouraged to extend {@link AbstractAvailabilityZoneExtension}
- * which has useful behaviour, rather than attempt to implement this interface directly.
- * 
- * @since 0.6.0
- */
-@Beta
-public interface AvailabilityZoneExtension {
-
-    List<Location> getAllSubLocations();
-
-    List<Location> getSubLocations(int max);
-
-    List<Location> getSubLocationsByName(Predicate<? super String> namePredicate, int max);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
deleted file mode 100644
index f749f64..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
+++ /dev/null
@@ -1,121 +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.core.location.cloud;
-
-import java.util.Collection;
-
-import com.google.common.annotations.Beta;
-import com.google.common.reflect.TypeToken;
-
-import org.apache.brooklyn.api.location.MachineLocationCustomizer;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.location.LocationConfigKeys;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-public interface CloudLocationConfig {
-
-    public static final ConfigKey<String> CLOUD_ENDPOINT = LocationConfigKeys.CLOUD_ENDPOINT;
-    public static final ConfigKey<String> CLOUD_REGION_ID = LocationConfigKeys.CLOUD_REGION_ID;
-    public static final ConfigKey<String> CLOUD_AVAILABILITY_ZONE_ID = LocationConfigKeys.CLOUD_AVAILABILITY_ZONE_ID;
-        
-    @SetFromFlag("identity")
-    public static final ConfigKey<String> ACCESS_IDENTITY = LocationConfigKeys.ACCESS_IDENTITY;
-    @SetFromFlag("credential")
-    public static final ConfigKey<String> ACCESS_CREDENTIAL = LocationConfigKeys.ACCESS_CREDENTIAL;
-
-    public static final ConfigKey<String> USER = LocationConfigKeys.USER;
-    
-    public static final ConfigKey<String> PASSWORD = LocationConfigKeys.PASSWORD;
-    public static final ConfigKey<String> PUBLIC_KEY_FILE = LocationConfigKeys.PUBLIC_KEY_FILE;
-    public static final ConfigKey<String> PUBLIC_KEY_DATA = LocationConfigKeys.PUBLIC_KEY_DATA;
-    public static final ConfigKey<String> PRIVATE_KEY_FILE = LocationConfigKeys.PRIVATE_KEY_FILE;
-    public static final ConfigKey<String> PRIVATE_KEY_DATA = LocationConfigKeys.PRIVATE_KEY_DATA;
-    public static final ConfigKey<String> PRIVATE_KEY_PASSPHRASE = LocationConfigKeys.PRIVATE_KEY_PASSPHRASE;
-
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PUBLIC_KEY_FILE = LocationConfigKeys.LEGACY_PUBLIC_KEY_FILE;
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PUBLIC_KEY_DATA = LocationConfigKeys.LEGACY_PUBLIC_KEY_DATA;
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_FILE = LocationConfigKeys.LEGACY_PRIVATE_KEY_FILE;
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_DATA = LocationConfigKeys.LEGACY_PRIVATE_KEY_DATA;
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_PASSPHRASE = LocationConfigKeys.LEGACY_PRIVATE_KEY_PASSPHRASE;
-
-    // default is just shy of common 64-char boundary, leaving 4 chars plus our salt allowance (default 4+1) which allows up to -12345678 by jclouds
-    public static final ConfigKey<Integer> VM_NAME_MAX_LENGTH = ConfigKeys.newIntegerConfigKey(
-        "vmNameMaxLength", "Maximum length of VM name", 60);
-
-    public static final ConfigKey<Integer> VM_NAME_SALT_LENGTH = ConfigKeys.newIntegerConfigKey(
-        "vmNameSaltLength", "Number of characters to use for a random identifier inserted in hostname "
-            + "to uniquely identify machines", 4);
-
-    public static final ConfigKey<String> POLL_FOR_FIRST_REACHABLE_ADDRESS = ConfigKeys.newStringConfigKey("pollForFirstReachableAddress", 
-            "Whether and how long to wait for reaching the VM's ip:port; "
-            + "if 'false', will default to the node's first public IP (or privae if no public IPs); "
-            + "if 'true' uses default duration; otherwise accepts a time string e.g. '5m' (the default) or a number of milliseconds", "5m");
-
-    public static final ConfigKey<String> WAIT_FOR_SSHABLE = ConfigKeys.newStringConfigKey("waitForSshable", 
-            "Whether and how long to wait for a newly provisioned VM to be accessible via ssh; " +
-            "if 'false', won't check; if 'true' uses default duration; otherwise accepts a time string e.g. '5m' (the default) or a number of milliseconds", "5m");
-
-    public static final ConfigKey<String> WAIT_FOR_WINRM_AVAILABLE = ConfigKeys.newStringConfigKey("waitForWinRmAvailable",
-            "Whether and how long to wait for a newly provisioned VM to be accessible via WinRm; " +
-                    "if 'false', won't check; if 'true' uses default duration; otherwise accepts a time string e.g. '30m' (the default) or a number of milliseconds", "30m");
-
-    public static final ConfigKey<Boolean> LOG_CREDENTIALS = ConfigKeys.newBooleanConfigKey(
-            "logCredentials", 
-            "Whether to log credentials of a new VM - strongly recommended never be used in production, as it is a big security hole!",
-            false);
-
-    public static final ConfigKey<Object> CALLER_CONTEXT = LocationConfigKeys.CALLER_CONTEXT;
-
-    public static final ConfigKey<Boolean> DESTROY_ON_FAILURE = ConfigKeys.newBooleanConfigKey("destroyOnFailure", "Whether to destroy the VM if provisioningLocation.obtain() fails", true);
-    
-    public static final ConfigKey<Object> INBOUND_PORTS = new BasicConfigKey<Object>(Object.class, "inboundPorts", 
-        "Inbound ports to be applied when creating a VM, on supported clouds " +
-            "(either a single port as a String, or an Iterable<Integer> or Integer[])", null);
-    @Beta
-    public static final ConfigKey<Object> ADDITIONAL_INBOUND_PORTS = new BasicConfigKey<Object>(Object.class, "required.ports", 
-            "Required additional ports to be applied when creating a VM, on supported clouds " +
-                    "(either a single port as an Integer, or an Iterable<Integer> or Integer[])", null);
-    
-    public static final ConfigKey<Boolean> OS_64_BIT = ConfigKeys.newBooleanConfigKey("os64Bit", 
-        "Whether to require 64-bit OS images (true), 32-bit images (false), or either (null)");
-    
-    public static final ConfigKey<Object> MIN_RAM = new BasicConfigKey<Object>(Object.class, "minRam",
-        "Minimum amount of RAM, either as string (4gb) or number of MB (4096), for use in selecting the machine/hardware profile", null);
-    
-    public static final ConfigKey<Integer> MIN_CORES = new BasicConfigKey<Integer>(Integer.class, "minCores",
-        "Minimum number of cores, for use in selecting the machine/hardware profile", null);
-    
-    public static final ConfigKey<Object> MIN_DISK = new BasicConfigKey<Object>(Object.class, "minDisk",
-        "Minimum size of disk, either as string (100gb) or number of GB (100), for use in selecting the machine/hardware profile", null);
-
-    public static final ConfigKey<String> DOMAIN_NAME = new BasicConfigKey<String>(String.class, "domainName",
-        "DNS domain where the host should be created, e.g. yourdomain.com (selected clouds only)", null);
-
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Collection<MachineLocationCustomizer>> MACHINE_LOCATION_CUSTOMIZERS = ConfigKeys.newConfigKey(
-            new TypeToken<Collection<MachineLocationCustomizer>>() {},
-            "machineCustomizers", "Optional machine customizers");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/AbstractCloudMachineNamer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/AbstractCloudMachineNamer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/AbstractCloudMachineNamer.java
deleted file mode 100644
index 7f38964..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/AbstractCloudMachineNamer.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 org.apache.brooklyn.core.location.cloud.names;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.objs.HasShortName;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.CharMatcher;
-
-/** 
- * Implements <b>most</b> of {@link CloudMachineNamer},
- * leaving just one method -- {@link #generateNewIdOfLength(int)} --
- * for subclasses to provide.
- * <p>
- * {@link CloudLocationConfig#VM_NAME_MAX_LENGTH} is used to find the VM length, 
- * unless {@link #getCustomMaxNameLength(ConfigBag)} is overridden or
- * {@link #setDefaultMachineNameMaxLength(int)} invoked on the instance supplied.
- */
-public abstract class AbstractCloudMachineNamer implements CloudMachineNamer {
-
-    int defaultMachineNameMaxLength = CloudLocationConfig.VM_NAME_MAX_LENGTH.getDefaultValue();
-    int defaultMachineNameSaltLength = CloudLocationConfig.VM_NAME_SALT_LENGTH.getDefaultValue();
-    protected String separator = "-";
-
-    public String generateNewMachineUniqueName(ConfigBag setup) {
-        return generateNewIdReservingLength(setup, 0);
-    }
-    
-    public String generateNewMachineUniqueNameFromGroupId(ConfigBag setup, String groupId) {
-        int availSaltLength = getMaxNameLength(setup) - (groupId.length() + separator.length());
-        int requestedSaltLength = getLengthForMachineUniqueNameSalt(setup, false);
-        if (availSaltLength <= 0 || requestedSaltLength <= 0) {
-            return groupId;
-        }
-            
-        return sanitize(groupId + separator + Identifiers.makeRandomId(Math.min(requestedSaltLength, availSaltLength))).toLowerCase();
-    }
-
-    public String generateNewGroupId(ConfigBag setup) {
-        return sanitize(generateNewIdReservingLength(setup, getLengthForMachineUniqueNameSalt(setup, true))).toLowerCase();
-    }
-
-    protected String generateNewIdReservingLength(ConfigBag setup, int lengthToReserve) {
-        int len = getMaxNameLength(setup);
-        // decrement by e.g. 9 chars because jclouds adds that (dash plus 8 for hex id)
-        len -= lengthToReserve;
-        if (len<=0) return "";
-        return Strings.maxlen(generateNewIdOfLength(setup, len), len);
-    }
-    
-    /** Method for subclasses to provide to construct the context-specific part of an identifier,
-     * for use in {@link #generateNewGroupId()} and {@link #generateNewMachineUniqueName()}.
-     * 
-     * @param maxLengthHint an indication of the maximum length permitted for the ID generated,
-     * supplied for implementations which wish to use this information to decide what to truncate.
-     * (This class will truncate any return values longer than this.) 
-     */
-    protected abstract String generateNewIdOfLength(ConfigBag setup, int maxLengthHint);
-
-    /** Returns the max length of a VM name for the cloud specified in setup;
-     * this value is typically decremented by 9 to make room for jclouds labels;
-     * delegates to {@link #getCustomMaxNameLength()} when 
-     * {@link CloudLocationConfig#VM_NAME_MAX_LENGTH} is not set */
-    public int getMaxNameLength(ConfigBag setup) {
-        if (setup.containsKey(CloudLocationConfig.VM_NAME_MAX_LENGTH)) {
-            // if a length is set explicitly, use that (but intercept default behaviour)
-            return setup.get(CloudLocationConfig.VM_NAME_MAX_LENGTH);
-        }
-        
-        Integer custom = getCustomMaxNameLength(setup);
-        if (custom!=null) return custom;
-        
-        // return the default
-        return defaultMachineNameMaxLength;  
-    }
-    
-    // sometimes we create salt string, sometimes jclouds does
-    public int getLengthForMachineUniqueNameSalt(ConfigBag setup, boolean includeSeparator) {
-        int saltLen;
-        if (setup.containsKey(CloudLocationConfig.VM_NAME_SALT_LENGTH)) {
-            saltLen = setup.get(CloudLocationConfig.VM_NAME_SALT_LENGTH);
-        } else {
-            // default value comes from key, but custom default can be set
-            saltLen = defaultMachineNameSaltLength;
-        }
-        
-        if (saltLen>0 && includeSeparator)
-            saltLen += separator.length();
-        
-        return saltLen;
-    }
-    
-    public AbstractCloudMachineNamer setDefaultMachineNameMaxLength(int defaultMaxLength) {
-        this.defaultMachineNameMaxLength = defaultMaxLength;
-        return this;
-    }
-
-    /** Number of chars to use or reserve for the machine identifier when constructing a group identifier;
-     * jclouds for instance uses "-" plus 8 */
-    public AbstractCloudMachineNamer setDefaultMachineNameSeparatorAndSaltLength(String separator, int defaultMachineUniqueNameSaltLength) {
-        this.separator = separator;
-        this.defaultMachineNameSaltLength = defaultMachineUniqueNameSaltLength;
-        return this;
-    }
-    
-    /** Method for overriding to provide custom logic when an explicit config key is not set for the machine length. */
-    public Integer getCustomMaxNameLength(ConfigBag setup) {
-        return null;
-    }
-
-    protected static String shortName(Object x) {
-        if (x instanceof HasShortName) {
-            return ((HasShortName)x).getShortName();
-        }
-        if (x instanceof Entity) {
-            return ((Entity)x).getDisplayName();
-        }
-        return x.toString();
-    }
-
-    @Beta //probably won't live here long-term
-    public static String sanitize(String s) {
-        return CharMatcher.inRange('A', 'Z')
-                .or(CharMatcher.inRange('a', 'z'))
-                .or(CharMatcher.inRange('0', '9'))
-                .negate()
-                .trimAndCollapseFrom(s, '-');
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
deleted file mode 100644
index 38ecbe5..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
+++ /dev/null
@@ -1,96 +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.core.location.cloud.names;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.text.StringShortener;
-import org.apache.brooklyn.util.text.Strings;
-
-/** 
- * Standard implementation of {@link CloudMachineNamer},
- * which looks at several of the properties of the context (entity)
- * and is clever about abbreviating them. */
-public class BasicCloudMachineNamer extends AbstractCloudMachineNamer {
-
-    @Override
-    protected String generateNewIdOfLength(ConfigBag setup, int len) {
-        Object context = setup.peek(CloudLocationConfig.CALLER_CONTEXT);
-        Entity entity = null;
-        if (context instanceof Entity) entity = (Entity) context;
-        
-        StringShortener shortener = Strings.shortener().separator("-");
-        shortener.append("system", "brooklyn");
-        
-        /* timeStamp replaces the previously used randId. 
-         * 
-         * timeStamp uses the standard unix timestamp represented as a 8-char hex string.
-         * 
-         * It represents the moment in time when the name is constructed. 
-         * It gives the possibility to search easily for instances, security groups, keypairs, etc
-         * based on timestamp without complicated enumeration        
-         */ 
-        shortener.append("timeStamp", Long.toString(System.currentTimeMillis() / 1000L, Character.MAX_RADIX));
-        
-        String user = System.getProperty("user.name");
-        if (!"brooklyn".equals(user))
-            // include user; unless the user is 'brooklyn', as 'brooklyn-brooklyn-' is just silly!
-            shortener.append("user", user);
-        
-        if (entity!=null) {
-            Application app = entity.getApplication();
-            if (app!=null) {
-                shortener.append("app", shortName(app))
-                        .append("appId", app.getId());
-            }
-            shortener.append("entity", shortName(entity))
-                    .append("entityId", entity.getId());
-        } else if (context!=null) {
-            shortener.append("context", context.toString());
-        }
-        
-        shortener.truncate("user", 12)
-                .truncate("app", 16)
-                .truncate("entity", 16)
-                .truncate("appId", 4)
-                .truncate("entityId", 4)
-                .truncate("context", 12);
-        
-        shortener.canTruncate("user", 8)
-                .canTruncate("app", 5)
-                .canTruncate("entity", 5)
-                .canTruncate("system", 2)
-                .canTruncate("app", 3)
-                .canTruncate("entity", 3)
-                .canRemove("app")
-                .canTruncate("user", 4)
-                .canRemove("entity")
-                .canTruncate("context", 4)
-                .canTruncate("timeStamp", 6)
-                .canRemove("user")
-                .canTruncate("appId", 2)
-                .canRemove("appId");
-        
-        String s = shortener.getStringOfMaxLength(len);
-        return sanitize(s).toLowerCase();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CloudMachineNamer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CloudMachineNamer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CloudMachineNamer.java
deleted file mode 100644
index d963a4e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CloudMachineNamer.java
+++ /dev/null
@@ -1,61 +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.core.location.cloud.names;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-/**
- * Interface used to construct names for individual cloud machines and for groups of machines.
- * <p>
- * Implementations <b>must</b> provide a constructor which takes a single argument,
- * being the {@link ConfigBag} for the context where the machine is being created
- * (usually a {@link Location}).
- * <p>
- * With that bag, the config key {@link CloudLocationConfig#CALLER_CONTEXT}
- * typically contains the {@link Entity} for which the machine is being created.   
- */
-public interface CloudMachineNamer {
-
-    /**
-     * Generate a name for a new machine, based on context.
-     * <p>
-     * The name should normally be unique, as a context might produce multiple machines,
-     * for example basing it partially on information from the context but also including some random salt.
-     */
-    public String generateNewMachineUniqueName(ConfigBag setup);
-    /**
-     * Generate a name stem for a group of machines, based on context.
-     * <p>
-     * The name does not need to be unique, as uniqueness will be applied by {@link #generateNewMachineUniqueNameFromGroupId(String)}.
-     */
-    public String generateNewGroupId(ConfigBag setup);
-    
-    /**
-     * Generate a unique name from the given name stem.
-     * <p>
-     * The name stem is normally based on context information so the usual
-     * function of this method is to apply a suffix which helps to uniquely distinguish between machines
-     * in cases where the same name stem ({@link #generateNewGroupId()}) is used for multiple machines.
-     */
-    public String generateNewMachineUniqueNameFromGroupId(ConfigBag setup, String groupId);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CustomMachineNamer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CustomMachineNamer.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CustomMachineNamer.java
deleted file mode 100644
index 0111f99..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/CustomMachineNamer.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 org.apache.brooklyn.core.location.cloud.names;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.text.TemplateProcessor;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-
-/** Provides a machine namer which looks at a location config key {@link #MACHINE_NAME_TEMPLATE}
- * to construct the hostname.
- * For instance, setting this to <code>${config.entity_hostname}</code>
- * will take the hostname from an <code>entity_hostname</code> key passed as entity <code>brooklyn.config</code>.
- * <p>
- * Note that this is not jclouds aware, so jclouds-specific cloud max lengths are not observed with this class.
- */
-public class CustomMachineNamer extends BasicCloudMachineNamer {
-    
-    public static final ConfigKey<String> MACHINE_NAME_TEMPLATE = ConfigKeys.newStringConfigKey("custom.machine.namer.machine", 
-            "Freemarker template format for custom machine name", "${entity.displayName}");
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Map<String, ?>> EXTRA_SUBSTITUTIONS = ConfigKeys.newConfigKey(new TypeToken<Map<String, ?>>() {}, 
-            "custom.machine.namer.substitutions", "Additional substitutions to be used in the template", ImmutableMap.<String, Object>of());
-    
-    @Override
-    protected String generateNewIdOfLength(ConfigBag setup, int len) {
-        Object context = setup.peek(CloudLocationConfig.CALLER_CONTEXT);
-        Entity entity = null;
-        if (context instanceof Entity) {
-            entity = (Entity) context;
-        }
-        
-        String template = setup.get(MACHINE_NAME_TEMPLATE);
-        
-        String processed;
-        if (entity == null) {
-            processed = TemplateProcessor.processTemplateContents(template, setup.get(EXTRA_SUBSTITUTIONS));
-        } else {
-            processed = TemplateProcessor.processTemplateContents(template, (EntityInternal)entity, setup.get(EXTRA_SUBSTITUTIONS));
-        }
-        
-        processed = Strings.removeFromStart(processed, "#ftl\n");
-        
-        return sanitize(processed);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/DynamicLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/DynamicLocation.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/DynamicLocation.java
deleted file mode 100644
index b04ebac..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/dynamic/DynamicLocation.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 org.apache.brooklyn.core.location.dynamic;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-import com.google.common.annotations.Beta;
-
-/**
- * A location that is created and owned by an entity at runtime.
- * <p>
- * The lifecycle of the location is managed by the owning entity.
- *
- * @param E the entity type
- * @param L the location type
- */
-@Beta
-public interface DynamicLocation<E extends Entity & LocationOwner<L, E>, L extends Location & DynamicLocation<E, L>> {
-
-    @SetFromFlag("owner")
-    ConfigKey<Entity> OWNER =
-            ConfigKeys.newConfigKey(Entity.class, "owner", "The entity owning this location");
-
-    @SetFromFlag("maxLocations")
-    ConfigKey<Integer> MAX_SUB_LOCATIONS =
-            ConfigKeys.newIntegerConfigKey("maxLocations", "The maximum number of sub-locations that can be created; 0 for unlimited", 0);
-
-    E getOwner();
-
-}


[44/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
deleted file mode 100644
index 789d282..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
+++ /dev/null
@@ -1,319 +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.api.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.Serializable;
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.mgmt.EntityManager;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.SpecParameter;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-/** Defines a spec for creating a {@link BrooklynObject}.
- * <p>
- * In addition to the contract defined by the code,
- * subclasses should provide a public static <code>create(Class)</code>
- * method to create an instance of the spec for the target type indicated by the argument. 
- * <p>
- * The spec is then passed to type-specific methods,
- * e.g. {@link EntityManager#createEntity(org.apache.brooklyn.api.entity.EntitySpec)}
- * to create a managed instance of the target type. */
-public abstract class AbstractBrooklynObjectSpec<T,SpecT extends AbstractBrooklynObjectSpec<T,SpecT>> implements Serializable {
-
-    private static final long serialVersionUID = 3010955277740333030L;
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractBrooklynObjectSpec.class);
-    
-    private final Class<? extends T> type;
-    private String displayName;
-    private String catalogItemId;
-    private Set<Object> tags = MutableSet.of();
-    private List<SpecParameter<?>> parameters = ImmutableList.of();
-
-    protected final Map<String, Object> flags = Maps.newLinkedHashMap();
-    protected final Map<ConfigKey<?>, Object> config = Maps.newLinkedHashMap();
-
-    protected AbstractBrooklynObjectSpec(Class<? extends T> type) {
-        checkValidType(type);
-        this.type = type;
-        this.catalogItemId = ApiObjectsFactory.get().getCatalogItemIdFromContext();
-    }
-    
-    @SuppressWarnings("unchecked")
-    protected SpecT self() {
-        return (SpecT) this;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("type", getType()).toString()+"@"+Integer.toHexString(System.identityHashCode(this));
-    }
-
-    protected abstract void checkValidType(Class<? extends T> type);
-    
-    public SpecT displayName(String val) {
-        displayName = val;
-        return self();
-    }
-    
-    public SpecT catalogItemId(String val) {
-        catalogItemId = val;
-        return self();
-    }
-    // TODO in many places (callers to this method) we prefer a wrapper item ID;
-    // that is right, because the wrapper's defn will refer to the wrapped,
-    // but we might need also to collect the item ID's so that *all* can be searched.
-    // e.g. if R3 references R2 which references R1 any one of these might supply config keys 
-    // referencing resources or types in their local bundles. 
-    @Beta
-    public SpecT catalogItemIdIfNotNull(String val) {
-        if (val!=null) {
-            catalogItemId = val;
-        }
-        return self();
-    }
-
-    
-    public SpecT tag(Object tag) {
-        tags.add(tag);
-        return self();
-    }
-
-    /** adds the given tags */
-    public SpecT tags(Iterable<Object> tagsToAdd) {
-        return tagsAdd(tagsToAdd);
-    }
-    /** adds the given tags */
-    public SpecT tagsAdd(Iterable<Object> tagsToAdd) {
-        Iterables.addAll(this.tags, tagsToAdd);
-        return self();
-    }
-    /** replaces tags with the given */
-    public SpecT tagsReplace(Iterable<Object> tagsToReplace) {
-        this.tags.clear();
-        Iterables.addAll(this.tags, tagsToReplace);
-        return self();
-    }
-    
-    // TODO which semantics are correct? replace has been the behaviour;
-    // add breaks tests and adds unwanted parameters,
-    // but replacing will cause some desired parameters to be lost.
-    // i (AH) think ideally the caller should remove any parameters which
-    // have been defined as config keys, and then add the others;
-    // or actually we should always add, since this is really defining the config keys,
-    // and maybe extend the SpecParameter object to be able to advertise whether
-    // it is a CatalogConfig or merely a config key, maybe introducing displayable, or even priority 
-    // (but note part of the reason for CatalogConfig.priority is that java reflection doesn't preserve field order) .
-    // see also comments on the camp SpecParameterResolver.
-    @Beta
-    public SpecT parameters(List<? extends SpecParameter<?>> parameters) {
-        return parametersReplace(parameters);
-    }
-    /** adds the given parameters */
-    @Beta
-    public SpecT parametersAdd(List<? extends SpecParameter<?>> parameters) {
-        // parameters follows immutable pattern, unlike the other fields
-        Builder<SpecParameter<?>> result = ImmutableList.<SpecParameter<?>>builder();
-        if (this.parameters!=null)
-            result.addAll(this.parameters);
-        result.addAll( checkNotNull(parameters, "parameters") );
-        this.parameters = result.build();
-        return self();
-    }
-    /** replaces parameters with the given */
-    @Beta
-    public SpecT parametersReplace(List<? extends SpecParameter<?>> parameters) {
-        this.parameters = ImmutableList.copyOf( checkNotNull(parameters, "parameters") );
-        return self();
-    }
-
-    /**
-     * @return The type (often an interface) this spec represents and which will be instantiated from it 
-     */
-    public Class<? extends T> getType() {
-        return type;
-    }
-    
-    /**
-     * @return The display name of the object
-     */
-    public final String getDisplayName() {
-        return displayName;
-    }
-    
-    public final String getCatalogItemId() {
-        return catalogItemId;
-    }
-
-    public final Set<Object> getTags() {
-        return ImmutableSet.copyOf(tags);
-    }
-
-    /** A list of configuration options that the entity supports. */
-    public final List<SpecParameter<?>> getParameters() {
-        //Could be null after rebind
-        if (parameters != null) {
-            return ImmutableList.copyOf(parameters);
-        } else {
-            return ImmutableList.of();
-        }
-    }
-
-    // TODO Duplicates method in BasicEntityTypeRegistry and InternalEntityFactory.isNewStyleEntity
-    protected final void checkIsNewStyleImplementation(Class<?> implClazz) {
-        try {
-            implClazz.getConstructor(new Class[0]);
-        } catch (NoSuchMethodException e) {
-            throw new IllegalStateException("Implementation "+implClazz+" must have a no-argument constructor");
-        } catch (SecurityException e) {
-            throw Exceptions.propagate(e);
-        }
-        
-        if (implClazz.isInterface()) throw new IllegalStateException("Implementation "+implClazz+" is an interface, but must be a non-abstract class");
-        if (Modifier.isAbstract(implClazz.getModifiers())) throw new IllegalStateException("Implementation "+implClazz+" is abstract, but must be a non-abstract class");
-    }
-    
-    // TODO Duplicates method in BasicEntityTypeRegistry
-    protected final void checkIsImplementation(Class<?> val, Class<? super T> requiredInterface) {
-        if (!requiredInterface.isAssignableFrom(val)) throw new IllegalStateException("Implementation "+val+" does not implement "+requiredInterface.getName());
-        if (val.isInterface()) throw new IllegalStateException("Implementation "+val+" is an interface, but must be a non-abstract class");
-        if (Modifier.isAbstract(val.getModifiers())) throw new IllegalStateException("Implementation "+val+" is abstract, but must be a non-abstract class");
-    }
-    
-    protected SpecT copyFrom(SpecT otherSpec) {
-        return displayName(otherSpec.getDisplayName())
-            .configure(otherSpec.getConfig())
-            .configure(otherSpec.getFlags())
-            .tags(otherSpec.getTags())
-            .catalogItemId(otherSpec.getCatalogItemId())
-            .parameters(otherSpec.getParameters());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj==null) return false;
-        if (!obj.getClass().equals(getClass())) return false;
-        AbstractBrooklynObjectSpec<?,?> other = (AbstractBrooklynObjectSpec<?,?>)obj;
-        if (!Objects.equal(getDisplayName(), other.getDisplayName())) return false;
-        if (!Objects.equal(getCatalogItemId(), other.getCatalogItemId())) return false;
-        if (!Objects.equal(getType(), other.getType())) return false;
-        if (!Objects.equal(getTags(), other.getTags())) return false;
-        if (!Objects.equal(getParameters(), other.getParameters())) return false;
-        return true;
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(getCatalogItemId(), getDisplayName(), getType(), getTags());
-    }
-
-    /** strings inserted as flags, config keys inserted as config keys; 
-     * if you want to force one or the other, create a ConfigBag and convert to the appropriate map type */
-    public SpecT configure(Map<?,?> val) {
-        for (Map.Entry<?, ?> entry: val.entrySet()) {
-            if (entry.getKey()==null) throw new NullPointerException("Null key not permitted");
-            if (entry.getKey() instanceof CharSequence)
-                flags.put(entry.getKey().toString(), entry.getValue());
-            else if (entry.getKey() instanceof ConfigKey<?>)
-                config.put((ConfigKey<?>)entry.getKey(), entry.getValue());
-            else if (entry.getKey() instanceof HasConfigKey<?>)
-                config.put(((HasConfigKey<?>)entry.getKey()).getConfigKey(), entry.getValue());
-            else {
-                log.warn("Spec "+this+" ignoring unknown config key "+entry.getKey());
-            }
-        }
-        return self();
-    }
-
-    public SpecT configure(CharSequence key, Object val) {
-        flags.put(checkNotNull(key, "key").toString(), val);
-        return self();
-    }
-    
-    public <V> SpecT configure(ConfigKey<V> key, V val) {
-        config.put(checkNotNull(key, "key"), val);
-        return self();
-    }
-
-    public <V> SpecT configureIfNotNull(ConfigKey<V> key, V val) {
-        return (val != null) ? configure(key, val) : self();
-    }
-
-    public <V> SpecT configure(ConfigKey<V> key, Task<? extends V> val) {
-        config.put(checkNotNull(key, "key"), val);
-        return self();
-    }
-
-    public <V> SpecT configure(HasConfigKey<V> key, V val) {
-        config.put(checkNotNull(key, "key").getConfigKey(), val);
-        return self();
-    }
-
-    public <V> SpecT configure(HasConfigKey<V> key, Task<? extends V> val) {
-        config.put(checkNotNull(key, "key").getConfigKey(), val);
-        return self();
-    }
-
-    public <V> SpecT removeConfig(ConfigKey<V> key) {
-        config.remove( checkNotNull(key, "key") );
-        return self();
-    }
-
-    /** Clears the config map, removing any config previously set. */
-    public void clearConfig() {
-        config.clear();
-    }
-        
-    /**
-     * @return Read-only construction flags
-     * @see SetFromFlag declarations on the policy type
-     */
-    public Map<String, ?> getFlags() {
-        return Collections.unmodifiableMap(flags);
-    }
-    
-    /**
-     * @return Read-only configuration values
-     */
-    public Map<ConfigKey<?>, Object> getConfig() {
-        return Collections.unmodifiableMap(config);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
deleted file mode 100644
index 51c0185..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactory.java
+++ /dev/null
@@ -1,61 +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.api.internal;
-
-import java.util.ServiceLoader;
-
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * This class grants access to implementations in core for operations needed in API classes.
- * The majority of the API classes are interfaces or have minimal behaviour, but there are a
- * few instances where more complex behaviour from core is desired.
- * <p>
- * This class acts as a bridge for those instances. See the concrete implementation of the
- * {@link ApiObjectsFactoryInterface} in brooklyn-core class ApiObjectsFactoryImpl.
- */
-@Beta
-public class ApiObjectsFactory {
-    
-    private static Maybe<ApiObjectsFactoryInterface> INSTANCE;
-
-    private static synchronized ApiObjectsFactoryInterface getFactoryInstance() {
-        // defer initialization to allow any other static initialization to complete,
-        // and use maybe so we (1) don't check multiple times, but (2) do throw error in the caller's stack
-        if (INSTANCE!=null) return INSTANCE.get();
-        
-        ServiceLoader<ApiObjectsFactoryInterface> LOADER = ServiceLoader.load(ApiObjectsFactoryInterface.class);
-        for (ApiObjectsFactoryInterface item : LOADER) {
-            INSTANCE = Maybe.of(item);
-            return INSTANCE.get();
-        }
-        INSTANCE = Maybe.absent("Implementation of " + ApiObjectsFactoryInterface.class + " not found on classpath; "
-            + "can be caused by IDE not copying resources, or by something else clobbering non-class resources needed for service loading");
-        return INSTANCE.get();
-    }
-
-    /**
-     * Create (if necessary) and return the concrete implementation from core for the
-     * methods exposed here. */
-    public static ApiObjectsFactoryInterface get() {
-        return getFactoryInstance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
deleted file mode 100644
index 6257524..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/internal/ApiObjectsFactoryInterface.java
+++ /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.
- */
-package org.apache.brooklyn.api.internal;
-
-/** 
- * Methods from downstream projects used in API classes at runtime. 
- * See {@link ApiObjectsFactory}. 
- */
-public interface ApiObjectsFactoryInterface {
-    
-    public String getCatalogItemIdFromContext();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
deleted file mode 100644
index 31c3b29..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
+++ /dev/null
@@ -1,43 +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.api.location;
-
-import java.net.InetAddress;
-
-/** A location that has an IP address.
- * <p>
- * This IP address may be a machine (usually the MachineLocation sub-interface), 
- * or often an entry point for a service.
- */
-public interface AddressableLocation extends Location {
-
-    /**
-     * Return the single most appropriate address for this location.
-     * (An implementation or sub-interface definition may supply more information
-     * on the precise semantics of the address.)
-     * 
-     * Should not return null, but in some "special cases" (e.g. CloudFoundryLocation it
-     * may return null if the location is not configured correctly). Users should expect
-     * a non-null result and treat null as a programming error or misconfiguration. 
-     * Implementors of this interface should strive to not return null (and then we'll
-     * remove this caveat from the javadoc!).
-     */
-    InetAddress getAddress();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
deleted file mode 100644
index 99d4fee..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
+++ /dev/null
@@ -1,41 +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.api.location;
-
-import com.google.common.annotations.Beta;
-
-/**
- * A default no-op implementation, which can be extended to override the appropriate methods.
- * 
- * Sub-classing will give the user some protection against future API changes - note that 
- * {@link MachineLocationCustomizer} is marked {@link Beta}.
- */
-@Beta
-public class BasicMachineLocationCustomizer implements MachineLocationCustomizer {
-
-    @Override
-    public void customize(MachineLocation machine) {
-        // no-op
-    }
-    
-    @Override
-    public void preRelease(MachineLocation machine) {
-        // no-op
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
deleted file mode 100644
index 7e4cc49..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.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.api.location;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 0.7.0
- */
-public interface HardwareDetails {
-
-    /**
-     * The number of CPUs on the machine
-     */
-    @Nullable
-    Integer getCpuCount();
-
-    /**
-     * Amount of RAM in megabytes
-     */
-    @Nullable
-    Integer getRam();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/Location.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/Location.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/Location.java
deleted file mode 100644
index ea43bfd..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/Location.java
+++ /dev/null
@@ -1,137 +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.api.location;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-
-/**
- * A location that an entity can be in. Examples of locations include a single machine
- * or a pool of machines, or a region within a given cloud. 
- */
-public interface Location extends BrooklynObject {
-
-    /**
-     * A unique id for this location.
-     */
-    @Override
-    String getId();
-
-    /**
-     * Get the name assigned to this location.
-     *
-     * @return the name assigned to the location.
-     * @since 0.6 (previously getName())
-     */
-    @Override
-    String getDisplayName();
-
-    /**
-     * Get the 'parent' of this location. Locations are organized into a tree hierarchy, and this method will return a reference
-     * to the parent of this location, or {@code null} if this location is the tree root.
-     *
-     * @return a reference to the parent of this location, or {@code null} if this location is the tree root.
-     * @since 0.6 (previously getParentLocation())
-     */
-    Location getParent();
-
-    /**
-     * Get the 'children' of this location. Locations are organized into a tree hierarchy, and this method will return a
-     * collection containing the children of this location. This collection is an unmodifiable view of the data.
-     *
-     * @return a collection containing the children of this location.
-     * @since 0.6 (previously getChildLocations())
-     */
-    Collection<Location> getChildren();
-
-    /**
-     * Set the 'parent' of this location. If this location was previously a child of a different location, it is removed from
-     * the other location first. It is valid to pass in {@code null} to indicate that the location should be disconnected
-     * from its parent.
-     * 
-     * Adds this location as a child of the new parent (see {@code getChildLocations()}).
-     *
-     * @param newParent the new parent location object, or {@code null} to clear the parent reference.
-     * @since 0.6 (previously setParentLocation(Location))
-     */
-    void setParent(Location newParent);
-
-    /**
-     * @return meta-data about the location (usually a long line, or a small number of lines).
-     * 
-     * @since 0.6
-     */
-    String toVerboseString();
-    
-    /**
-     * Answers true if this location equals or is an ancestor of the given location.
-     */
-    boolean containsLocation(Location potentialDescendent);
-
-    /**
-     * Convenience method for {@code config().get(key)}
-     * 
-     * @see {@link #getConfig(ConfigKey)}
-     */
-    <T> T getConfig(HasConfigKey<T> key);
-
-    /** 
-     * True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false).
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getRaw(key).isPresent()}
-     */
-    @Deprecated
-    boolean hasConfig(ConfigKey<?> key, boolean includeInherited);
-
-    /** 
-     * Returns all config set, either inherited (argument true) or locally-only (argument false).
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().getBag()}
-     */
-    @Deprecated
-    public Map<String,Object> getAllConfig(boolean includeInherited);
-    
-    /**
-     * Whether this location has support for the given extension type.
-     * See additional comments in {@link #getExtension(Class)}.
-     * 
-     * @throws NullPointerException if extensionType is null
-     */
-    boolean hasExtension(Class<?> extensionType);
-
-    /**
-     * Returns an extension of the given type. Note that the type must be an exact match for
-     * how the extension was registered (e.g. {@code getExtension(Object.class)} will not match
-     * anything, even though registered extension extend {@link Object}.
-     * <p>
-     * This will not look at extensions of {@link #getParent()}.
-     * 
-     * @throws IllegalArgumentException if this location does not support the given extension type
-     * @throws NullPointerException if extensionType is null
-     */
-    <T> T getExtension(Class<T> extensionType);
-    
-    @Override
-    RelationSupport<Location> relations();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
deleted file mode 100644
index 2bbe74c..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.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 org.apache.brooklyn.api.location;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-/**
- * Defines a location, where the {@link #getSpec()} is like a serialized representation
- * of the location so that Brooklyn can create a corresponding location.
- * 
- * Examples include a complete description (e.g. giving a list of machines in a pool), or
- * a name that matches a named location defined in the brooklyn poperties.
- * 
- * Users are not expected to implement this, or to use the interface directly. See
- * {@link LocationRegistry#resolve(String)} and {@link ManagementContext#getLocationRegistry()}.
- */
-public interface LocationDefinition {
-
-    public String getId();
-    public String getName();
-    public String getSpec();
-    public Map<String,Object> getConfig();
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
deleted file mode 100644
index de1c09d..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.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.api.location;
-
-
-/**
- * Indicates that a {@link ProvisioningLocation} is not able to provision a requested location
- */
-public class LocationNotAvailableException extends Exception {
-    private static final long serialVersionUID = 1079817235289265761L;
-    
-    public LocationNotAvailableException(String s) {
-        super(s);
-    }
-
-    public LocationNotAvailableException(String s, Throwable throwable) {
-        super(s, throwable);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
deleted file mode 100644
index 50fbc6a..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
+++ /dev/null
@@ -1,128 +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.api.location;
-
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-
-/**
- * The registry of the sorts of locations that brooklyn knows about. Given a
- * {@LocationDefinition} or a {@link String} representation of a spec, this can
- * be used to create a {@link Location} instance.
- */
-@SuppressWarnings("rawtypes")
-public interface LocationRegistry {
-
-    /** map of ID (possibly randomly generated) to the definition (spec, name, id, and props; 
-     * where spec is the spec as defined, for instance possibly another named:xxx location) */
-    public Map<String,LocationDefinition> getDefinedLocations();
-    
-    /** returns a LocationDefinition given its ID (usually a random string), or null if none */
-    public LocationDefinition getDefinedLocationById(String id);
-    
-    /** returns a LocationDefinition given its name (e.g. for named locations, supply the bit after the "named:" prefix), 
-     * or null if none */
-    public LocationDefinition getDefinedLocationByName(String name);
-
-    /** adds or updates the given defined location */
-    public void updateDefinedLocation(LocationDefinition l);
-
-    /** removes the defined location from the registry (applications running there are unaffected) */
-    public void removeDefinedLocation(String id);
-
-    /** Returns a fully populated (config etc) location from the given definition, with optional add'l flags.
-     * the location will be managed by default, unless the manage parameter is false, 
-     * or the manage parameter is null and the CREATE_UNMANAGED flag is set.
-     * <p>
-     * The manage parameter is {@link Boolean} so that null can be used to say rely on anything in the flags.
-     * 
-     * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
-    @Beta
-    public Maybe<Location> resolve(LocationDefinition ld, Boolean manage, Map locationFlags);
-    
-    /** As {@link #resolve(LocationDefinition, Boolean, Map), with the location managed, and no additional flags,
-     * unwrapping the result (throwing if not resolvable) */
-    public Location resolve(LocationDefinition l);
-
-    /** Returns a location created from the given spec, which might correspond to a definition, or created on-the-fly.
-     * Optional flags can be passed through to underlying the location. 
-     * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
-    @Beta
-    public Maybe<Location> resolve(String spec, Boolean manage, Map locationFlags);
-    
-    /** efficiently returns for inspection only a fully populated (config etc) location from the given definition; 
-     * the value might be unmanaged so it is not meant for any use other than inspection,
-     * but callers should prefer this when they don't wish to create a new location which will be managed in perpetuity!
-     * 
-     * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
-    @Deprecated
-    public Location resolveForPeeking(LocationDefinition l);
-
-    /** returns fully populated (config etc) location from the given definition, with overrides;
-     * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
-    @Deprecated
-    public Location resolve(LocationDefinition l, Map<?,?> locationFlags);
-    
-    /** See {@link #resolve(String, Boolean, Map)}; asks for the location to be managed, and supplies no additional flags,
-     * and unwraps the result (throwing if the spec cannot be resolve) */
-    public Location resolve(String spec);
-    
-    /** Returns true/false depending whether spec seems like a valid location,
-     * that is it has a chance of being resolved (depending on the spec) but NOT guaranteed,
-     * as it is not passed to the spec;
-     * see {@link #resolve(String, Boolean, Map)} which has stronger guarantees 
-     * @deprecated since 0.7.0, not really needed, and semantics are weak; use {@link #resolve(String, Boolean, Map)} */
-    @Deprecated
-    public boolean canMaybeResolve(String spec);
-    
-    /** As {@link #resolve(String, Boolean, Map)}, but unwrapped
-     * @throws NoSuchElementException if the spec cannot be resolved */
-    public Location resolve(String spec, @Nullable Map locationFlags);
-    
-    /** as {@link #resolve(String)} but returning null (never throwing)
-     * @deprecated since 0.7.0 use {@link #resolve(String, Boolean, Map)} */
-    @Deprecated
-    public Location resolveIfPossible(String spec);
-
-    /**
-     * As {@link #resolve(String)} but takes collections (of strings or locations)
-     * <p>
-     * Expects a collection of elements being individual location spec strings or locations, 
-     * and returns a list of resolved (newly created and managed) locations.
-     * <p>
-     * From 0.7.0 this no longer flattens lists (nested lists are disallowed) 
-     * or parses comma-separated elements (they are resolved as-is)
-     */
-    public List<Location> resolve(Iterable<?> spec);
-    
-    /** Takes a string, interpreted as a comma-separated (or JSON style, when you need internal double quotes or commas) list;
-     * or a list, passed to {@link #resolve(Iterable)}; or null/empty (empty list),
-     * and returns a list of resolved (created and managed) locations */
-    public List<Location> resolveList(Object specList);
-    
-    public Map getProperties();
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
deleted file mode 100644
index 4ddb5e4..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.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.api.location;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Provides a way of creating location instances of a particular type.
- */
-public interface LocationResolver {
-
-    void init(ManagementContext managementContext);
-    
-    /** the prefix that this resolver will attend to */
-    String getPrefix();
-    
-    /** whether the spec is something which should be passed to this resolver */
-    boolean accepts(String spec, LocationRegistry registry);
-
-    /**
-     * Similar to {@link #newLocationFromString(Map, String)} 
-     * but passing in a reference to the registry itself (from which the base properties are discovered)
-     * and including flags (e.g. user, key, cloud credential) which are known to be for this location.
-     * <p>
-     * introduced to support locations which refer to other locations, e.g. NamedLocationResolver  
-     **/ 
-    @SuppressWarnings("rawtypes")
-    Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry);
-
-    /** @since 0.7.0 exploring this as a mechanism to disable locations */
-    @Beta
-    public interface EnableableLocationResolver extends LocationResolver {
-        /** whether the location is enabled */
-        boolean isEnabled();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
deleted file mode 100644
index b66ebea..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
+++ /dev/null
@@ -1,168 +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.api.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.config.ConfigKey;
-
-import com.google.common.collect.Maps;
-
-/**
- * Gives details of a location to be created. It describes the location's configuration, and is
- * reusable to create multiple locations with the same configuration.
- * 
- * To create a LocationSpec, it is strongly encouraged to use {@code create(...)} methods.
- * 
- * @param <T> The type of location to be created
- * 
- * @author aled
- */
-public class LocationSpec<T extends Location> extends AbstractBrooklynObjectSpec<T,LocationSpec<T>> {
-
-    // TODO Would like to add `configure(ConfigBag)`, but `ConfigBag` is in core rather than api
-    
-    private final static long serialVersionUID = 1L;
-
-    /**
-     * Creates a new {@link LocationSpec} instance for a location of the given type. The returned 
-     * {@link LocationSpec} can then be customized.
-     * 
-     * @param type A {@link Location} class
-     */
-    public static <T extends Location> LocationSpec<T> create(Class<T> type) {
-        return new LocationSpec<T>(type);
-    }
-    
-    /**
-     * Creates a new {@link LocationSpec} instance with the given config, for a location of the given type.
-     * 
-     * This is primarily for groovy code; equivalent to {@code LocationSpec.create(type).configure(config)}.
-     * 
-     * @param config The spec's configuration (see {@link LocationSpec#configure(Map)}).
-     * @param type   A {@link Location} class
-     */
-    public static <T extends Location> LocationSpec<T> create(Map<?,?> config, Class<T> type) {
-        return LocationSpec.create(type).configure(config);
-    }
-    
-    /**
-     * Copies entity spec so its configuration can be overridden without modifying the 
-     * original entity spec.
-     */
-    public static <T extends Location> LocationSpec<T> create(LocationSpec<T> spec) {
-        // need this to get LocationSpec<T> rather than LocationSpec<? extends T>
-        @SuppressWarnings("unchecked")
-        Class<T> exactType = (Class<T>)spec.getType();
-        
-        return create(exactType).copyFrom(spec);
-    }
-
-    private String id;
-    private Location parent;
-    private final Map<Class<?>, Object> extensions = Maps.newLinkedHashMap();
-
-    protected LocationSpec(Class<T> type) {
-        super(type);
-    }
-     
-    @Override
-    protected LocationSpec<T> copyFrom(LocationSpec<T> otherSpec) {
-        LocationSpec<T> result = super.copyFrom(otherSpec).extensions(otherSpec.getExtensions());
-        if (otherSpec.getParent() != null) result.parent(otherSpec.getParent());
-        if (otherSpec.getId() != null) result.id(otherSpec.getId());
-        return result;
-    }
-    
-    protected void checkValidType(Class<? extends T> type) {
-        checkIsImplementation(type, Location.class);
-        checkIsNewStyleImplementation(type);
-    }
-
-    /**
-     * @deprecated since 0.7.0; instead let the management context pick a random+unique id
-     */
-    @Deprecated
-    public LocationSpec<T> id(String val) {
-        id = val;
-        return this;
-    }
-
-    public LocationSpec<T> parent(Location val) {
-        parent = checkNotNull(val, "parent");
-        return this;
-    }
-
-    public <E> LocationSpec<T> extension(Class<E> extensionType, E extension) {
-        extensions.put(checkNotNull(extensionType, "extensionType"), checkNotNull(extension, "extension"));
-        return this;
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public <E> LocationSpec<T> extensions(Map<Class<?>, ?> extensions) {
-        for (Map.Entry<Class<?>, ?> entry : extensions.entrySet()) {
-            extension((Class)entry.getKey(), entry.getValue());
-        }
-        return this;
-    }
-    
-    /**
-     * @return The id of the location to be created, or null if brooklyn can auto-generate an id
-     * 
-     * @deprecated since 0.7.0; instead let the management context pick a random+unique id
-     */
-    @Deprecated
-    public String getId() {
-        return id;
-    }
-    
-    /**
-     * @return The location's parent
-     */
-    public Location getParent() {
-        return parent;
-    }
-    
-    /**
-     * @return Read-only construction flags
-     * @see SetFromFlag declarations on the location type
-     */
-    public Map<String, ?> getFlags() {
-        return Collections.unmodifiableMap(flags);
-    }
-    
-    /**
-     * @return Read-only configuration values
-     */
-    public Map<ConfigKey<?>, Object> getConfig() {
-        return Collections.unmodifiableMap(config);
-    }
-        
-    /**
-     * @return Read-only extension values
-     */
-    public Map<Class<?>, Object> getExtensions() {
-        return Collections.unmodifiableMap(extensions);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
deleted file mode 100644
index 8032333..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/LocationType.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 org.apache.brooklyn.api.location;
-
-import org.apache.brooklyn.api.objs.BrooklynType;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Gives type information for a {@link Location}. It is immutable.
- 
- * @since 0.7.0
- */
-@Beta
-public interface LocationType extends BrooklynType {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
deleted file mode 100644
index ae8b1c2..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
+++ /dev/null
@@ -1,34 +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.api.location;
-
-import javax.annotation.Nonnull;
-
-/**
- * @since 0.7.0
- */
-public interface MachineDetails {
-
-    @Nonnull
-    HardwareDetails getHardwareDetails();
-
-    @Nonnull
-    OsDetails getOsDetails();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
deleted file mode 100644
index 7483ec5..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.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.api.location;
-
-import java.net.InetAddress;
-
-import org.apache.brooklyn.util.net.HasNetworkAddresses;
-
-/**
- * A location that is a machine.
- *
- * This interface marks a {@link Location} being a network node with an IP address, 
- * and supports appropriate operations on the node.
- */
-public interface MachineLocation extends AddressableLocation, HasNetworkAddresses {
-    /**
-     * @return the machine's network address.
-     */
-    InetAddress getAddress();
-
-    /** @deprecated since 0.7.0. Use getMachineDetails().getOsDetails() instead. */
-    @Deprecated
-    OsDetails getOsDetails();
-
-    /*
-     * @return hardware and operating system-specific details for the machine.
-     */
-    MachineDetails getMachineDetails();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
deleted file mode 100644
index a9b4e2e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.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 org.apache.brooklyn.api.location;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Customization hooks to allow apps to perform specific customisation of obtained machines.
- * <p>
- * Users are strongly encouraged to sub-class {@link BasicMachineLocationCustomizer}, to give
- * some protection against this {@link Beta} API changing in future releases.
- */
-@Beta
-public interface MachineLocationCustomizer {
-
-    /**
-     * Override to configure the given machine once it has been created (prior to any use).
-     */
-    void customize(MachineLocation machine);
-    
-    /**
-     * Override to handle machine-related cleanup prior to {@link MachineProvisioningLocation} 
-     * releasing the machine.
-     */
-    void preRelease(MachineLocation machine);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
deleted file mode 100644
index f7c091b..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
+++ /dev/null
@@ -1,91 +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.api.location;
-
-import java.util.Map;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Defines mixins for interesting locations.
- */
-public class MachineManagementMixins {
-    
-    public interface RichMachineProvisioningLocation<T extends MachineLocation> extends
-            MachineProvisioningLocation<T>, ListsMachines, GivesMachineMetadata, KillsMachines {}
-
-    public interface ListsMachines {
-        /**
-         * @return A map of machine ID to metadata record for all machines known in a given cloud location.
-         */
-        Map<String,MachineMetadata> listMachines();
-    }
-    
-    public interface GivesMachineMetadata {
-        /**
-         * @return the {@link MachineMetadata} for a given (brooklyn) machine location instance,
-         * or null if not matched.
-         */
-        MachineMetadata getMachineMetadata(MachineLocation location);
-    }
-    
-    public interface KillsMachines {
-        /** Kills the indicated machine; throws if not recognised or possible */
-        void killMachine(MachineLocation machine);
-        
-        /** Kills the machine indicated by the given (server-side) machine id;
-         *  note, the ID is the _cloud-service_ ID,
-         *  that is, pass in getMetadata(machineLocation).getId() not the machineLocation.getId() */
-        void killMachine(String cloudServiceId);
-    }
-    
-    /** very lightweight machine record */
-    public interface MachineMetadata {
-        /** The cloud service ID -- distinct from any Brooklyn {@link Location#getId()} */
-        String getId();
-        String getName();
-        String getPrimaryIp();
-        Boolean isRunning();
-        /** original metadata object, if available; e.g. ComputeMetadata when using jclouds */ 
-        Object getOriginalMetadata();
-    }
-
-    /**
-     * Implement to indicate that a location can suspend and resume machines.
-     */
-    @Beta
-    public interface SuspendResumeLocation extends SuspendsMachines, ResumesMachines {}
-
-    @Beta
-    public interface SuspendsMachines {
-        /**
-         * Suspend the indicated machine.
-         */
-        void suspendMachine(MachineLocation location);
-    }
-
-    @Beta
-    public interface ResumesMachines {
-        /**
-         * Resume the indicated machine.
-         */
-        MachineLocation resumeMachine(Map<?, ?> flags);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
deleted file mode 100644
index 1fcf785..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.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 org.apache.brooklyn.api.location;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * A location that is able to provision new machines within its location.
- *
- * This interface extends {@link Location} to add the ability to provision {@link MachineLocation}s in this location.
- */
-public interface MachineProvisioningLocation<T extends MachineLocation> extends ProvisioningLocation<T> {
-    /**
-     * Obtain a machine in this location.
-     * 
-     * @param flags Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers).
-     * "callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel)
-     * @return a machine that is a child of this location.
-     * @throws NoMachinesAvailableException if there are no machines available in this location (or impls may return null, but that is discouraged)
-     */
-    @Override
-    T obtain(Map<?,?> flags) throws NoMachinesAvailableException;
-
-    /**
-     * Creates a new location of the same type, but with additional creation instructions in the form of flags,
-     * e.g. for specifying subnets, security groups, etc
-     * <p>
-     * Implementers who wish to subclass this provisioning location for additional functionality
-     * in a specific cloud can use the relevant implementation of this method as a guide. 
-     */
-    MachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags);
-    
-    /**
-     * Release a previously-obtained machine.
-     *
-     * @param machine a {@link MachineLocation} previously obtained from a call to {@link #obtain()}
-     * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released.
-     */
-    @Override
-    void release(T machine);
-    
-    /**
-     * Gets flags, suitable as an argument to {@link #obtain(Map)}. The tags provided give
-     * hints about the machine required. The provisioning-location could be configured to 
-     * understand those tags. 
-     * 
-     * For example, an AWS-location could be configured to understand that a particular entity
-     * type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the 
-     * required image id.
-     *  
-     * @param tags
-     * @return
-     */
-    Map<String,Object> getProvisioningFlags(Collection<String> tags);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.java
deleted file mode 100644
index f13c1ff..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/NoMachinesAvailableException.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.api.location;
-
-
-/**
- * Indicates no machines are available in a given location.
- */
-public class NoMachinesAvailableException extends LocationNotAvailableException {
-    private static final long serialVersionUID = 1079817235289265761L;
-    
-    public NoMachinesAvailableException(String s) {
-        super(s);
-    }
-
-    public NoMachinesAvailableException(String s, Throwable throwable) {
-        super(s, throwable);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.java
deleted file mode 100644
index 9baac9e..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/OsDetails.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.api.location;
-
-import javax.annotation.Nullable;
-
-public interface OsDetails {
-
-    /** The name of the operating system, e.g. "Debian" or "Red Hat Enterprise Linux Server" */
-    @Nullable
-    String getName();
-
-    /**
-     * The version of the operating system. Generally numeric (e.g. "6.3") but occasionally
-     * alphabetic (e.g. Debian's "Squeeze").
-     */
-    @Nullable
-    String getVersion();
-
-    /** The operating system's architecture, e.g. "x86" or "x86_64" */
-    @Nullable
-    String getArch();
-
-    boolean is64bit();
-
-    boolean isWindows();
-    boolean isLinux();
-    boolean isMac();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
deleted file mode 100644
index 108f0dd..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortRange.java
+++ /dev/null
@@ -1,48 +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.api.location;
-
-/**
- * A range of ports (indicator for Location and other APIs).
- * Using methods {@code PortRanges.fromXxx(...)} this is adaptable from a number, a string, or a collection of numbers or a strings.
- * String may be of the form:
- *   <li> "80": just 80
- *   <li> "8080-8090": limited range sequentially; ie try 8080, then 8081, ..., then 8090, then give up
- *   <li> "8080-8000": as above, but descending; ie try 8080, then 8079, ..., then 8000, then give up
- *   <li> "8000+": unlimited range sequentially; ie try 8000, then 8001, then 8002, etc
- *   <li> "80,8080,8000,8080-8099": different ranges, in order; ie try 80, then 8080, then 8000, then 8080 (again), then 8081, ..., then 8099, then give up
- * Ranges (but not lists) may be preceeded by "!" to indicate a randomly selected port:
- * 
- * @see brooklyn.location.basic.PortRanges
- */
-//MAYDO could have:   <li> "~32168-65535" (or "~32168-"): try randomly selected numbers in range 32168-65535 (MAX_PORT) until all have been tried
-public interface PortRange extends Iterable<Integer> {
-    /**
-     * Whether there are any ports in the range.
-     */
-    boolean isEmpty();
-    
-    /**
-     * Note: this method is only here for use with "groovy truth". Users are strongly discouraged  
-     * from calling it directly.
-     *  
-     * @return {@code !isEmpty()}; i.e. true if there is at least one port in the range; false otherwise
-     */
-    boolean asBoolean();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.java
deleted file mode 100644
index 02c4398..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/PortSupplier.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 org.apache.brooklyn.api.location;
-
-/** Mixin interface for location which allows it to supply ports from a given range */
-public interface PortSupplier {
-
-    /**
-     * Reserve a specific port for an application. If your application requires a specific port - for example, port 80 for a web
-     * server - you should reserve this port before starting your application. Using this method, you will be able to detect if
-     * another application has already claimed this port number.
-     *
-     * @param portNumber the required port number.
-     * @return {@code true} if the port was successfully reserved; {@code false} if it has been previously reserved.
-     */
-    boolean obtainSpecificPort(int portNumber);
-
-    /**
-     * Reserve a port for your application, with a port number in a specific range. If your application requires a port, but it does
-     * not mind exactly which port number - for example, a port for internal JMX monitoring - call this method.
-     *
-     * @param range the range of acceptable port numbers.
-     * @return the port number that has been reserved, or -1 if there was no available port in the acceptable range.
-     */
-    int obtainPort(PortRange range);
-
-    /**
-     * Release a previously reserved port.
-     *
-     * @param portNumber the port number from a call to {@link #obtainPort(PortRange)} or {@link #obtainSpecificPort(int)}
-     */
-    void releasePort(int portNumber);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.java
deleted file mode 100644
index 25bd209..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/location/ProvisioningLocation.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 org.apache.brooklyn.api.location;
-
-import java.util.Map;
-
-/**
- * A location that is able to provision new locations within it.
- */
-public interface ProvisioningLocation<T extends Location> extends Location {
-    /**
-     * Obtain a new (sub)-location in the location represented by this class.
-     * 
-     * @param flags Constraints and details of the location to be provisioned
-     * @return the location provisioned
-     * @throws LocationNotAvailableException if could not provision such a location
-     */
-    T obtain(Map<?,?> flags) throws LocationNotAvailableException;
-
-    /**
-     * Release a previously-obtained location.
-     *
-     * @param location a location previously obtained
-     * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released.
-     */
-    void release(T machine);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.java
deleted file mode 100644
index 331d990..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/AccessController.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 org.apache.brooklyn.api.mgmt;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public interface AccessController {
-
-    // TODO Expect this class' methods to change, e.g. including the user doing the
-    // provisioning or the provisioning parameters such as jurisdiction
-    
-    public static class Response {
-        private static final Response ALLOWED = new Response(true, "");
-        
-        public static Response allowed() {
-            return ALLOWED;
-        }
-        
-        public static Response disallowed(String msg) {
-            return new Response(false, msg);
-        }
-        
-        private final boolean allowed;
-        private final String msg;
-
-        private Response(boolean allowed, String msg) {
-            this.allowed = allowed;
-            this.msg = msg;
-        }
-        
-        public boolean isAllowed() {
-            return allowed;
-        }
-        
-        public String getMsg() {
-            return msg;
-        }
-    }
-
-    public Response canProvisionLocation(Location provisioner);
-
-    public Response canManageLocation(Location loc);
-    
-    public Response canManageEntity(Entity entity);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
deleted file mode 100644
index fe66a5b..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/EntityManager.java
+++ /dev/null
@@ -1,126 +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.api.mgmt;
-
-import java.util.Collection;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.entity.EntityTypeRegistry;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-
-import com.google.common.base.Predicate;
-
-/**
- * For managing and querying entities.
- */
-public interface EntityManager {
-
-    /**
-     * Returns the type registry, used to identify the entity implementation when instantiating an
-     * entity of a given type.
-     * 
-     * @see EntityManager.createEntity(EntitySpec)
-     */
-    EntityTypeRegistry getEntityTypeRegistry();
-    
-    /**
-     * Creates a new entity. Management is started immediately (by this method).
-     * 
-     * @param spec
-     * @return A proxy to the created entity (rather than the actual entity itself).
-     */
-    <T extends Entity> T createEntity(EntitySpec<T> spec);
-    
-    /**
-     * Convenience (particularly for groovy code) to create an entity.
-     * Equivalent to {@code createEntity(EntitySpec.create(type).configure(config))}
-     * 
-     * @see createEntity(EntitySpec)
-     */
-    <T extends Entity> T createEntity(Map<?,?> config, Class<T> type);
-
-    /**
-     * Creates a new policy (not managed; not associated with any entity).
-     * 
-     * @param spec
-     */
-    <T extends Policy> T createPolicy(PolicySpec<T> spec);
-
-    /**
-     * Creates a new enricher (not managed; not associated with any entity).
-     * 
-     * @param spec
-     */
-    <T extends Enricher> T createEnricher(EnricherSpec<T> spec);
-
-    /**
-     * All entities under control of this management plane
-     */
-    Collection<Entity> getEntities();
-
-    /**
-     * All entities managed as part of the given application
-     */
-    Collection<Entity> getEntitiesInApplication(Application application);
-
-    /**
-     * All entities under control of this management plane that match the given filter
-     */
-    Collection<Entity> findEntities(Predicate<? super Entity> filter);
-
-    /**
-     * All entities managed as part of the given application that match the given filter
-     */
-    Collection<Entity> findEntitiesInApplication(Application application, Predicate<? super Entity> filter);
-
-    /**
-     * Returns the entity with the given identifier (may be a full instance, or a proxy to one which is remote),
-     * or null.
-     */
-    @Nullable Entity getEntity(String id);
-    
-    /** whether the entity is under management by this management context */
-    boolean isManaged(Entity entity);
-
-    /**
-     * Begins management for the given entity and its children, recursively.
-     *
-     * depending on the implementation of the management context,
-     * this might push it out to one or more remote management nodes.
-     * Manage an entity.
-     */
-    // TODO manage and unmanage without arguments should be changed to take an explicit ManagementTransitionMode
-    // (but that class is not currently in the API project)
-    void manage(Entity e);
-    
-    /**
-     * Causes the given entity and its children, recursively, to be removed from the management plane
-     * (for instance because the entity is no longer relevant)
-     */
-    void unmanage(Entity e);
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java b/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
deleted file mode 100644
index 4540240..0000000
--- a/brooklyn-server/api/src/main/java/org/apache/brooklyn/api/mgmt/ExecutionContext.java
+++ /dev/null
@@ -1,67 +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.api.mgmt;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-
-import org.apache.brooklyn.api.entity.Entity;
-
-/**
- * This is a Brooklyn extension to the Java {@link Executor}.
- * 
- * The "context" could, for example, be an {@link Entity} so that tasks executed 
- * can be annotated as executing in that context.
- */
-public interface ExecutionContext extends Executor {
-
-    /**
-     * Get the tasks executed through this context (returning an immutable set).
-     */
-    Set<Task<?>> getTasks();
-
-    /**
-     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
-     */
-    Task<?> submit(Map<?,?> properties, Runnable runnable);
-
-    /**
-     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
-     */
-    <T> Task<T> submit(Map<?,?> properties, Callable<T> callable);
-
-    /** {@link ExecutionManager#submit(Runnable) */
-    Task<?> submit(Runnable runnable);
- 
-    /** {@link ExecutionManager#submit(Callable) */
-    <T> Task<T> submit(Callable<T> callable);
-
-    /** See {@link ExecutionManager#submit(Map, TaskAdaptable)}. */
-    <T> Task<T> submit(TaskAdaptable<T> task);
-    
-    /**
-     * See {@link ExecutionManager#submit(Map, TaskAdaptable)} for properties that can be passed in.
-     */
-    <T> Task<T> submit(Map<?,?> properties, TaskAdaptable<T> task);
-
-    boolean isShutdown();
-
-}
\ No newline at end of file


[33/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
deleted file mode 100644
index 371a477..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
+++ /dev/null
@@ -1,285 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.StringReader;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.MachineLocation;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.location.multi.MultiLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class LocationsYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(LocationsYamlTest.class);
-
-    @Test
-    public void testLocationString() throws Exception {
-        String yaml = 
-                "location: localhost\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
-        assertNotNull(loc);
-    }
-
-    @Test
-    public void testLocationComplexString() throws Exception {
-        String yaml = 
-                "location: localhost:(name=myname)\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
-        assertEquals(loc.getDisplayName(), "myname");
-    }
-
-    @Test
-    public void testLocationSplitLineWithNoConfig() throws Exception {
-        String yaml = 
-                "location:\n"+
-                "  localhost\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
-        assertNotNull(loc);
-    }
-
-    @Test
-    public void testMultiLocations() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- localhost:(name=loc1)\n"+
-                "- localhost:(name=loc2)\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        List<Location> locs = ImmutableList.copyOf(app.getLocations());
-        assertEquals(locs.size(), 2, "locs="+locs);
-        LocalhostMachineProvisioningLocation loc1 = (LocalhostMachineProvisioningLocation) locs.get(0);
-        LocalhostMachineProvisioningLocation loc2 = (LocalhostMachineProvisioningLocation) locs.get(1);
-        assertEquals(loc1.getDisplayName(), "loc1");
-        assertEquals(loc2.getDisplayName(), "loc2");
-    }
-
-    @Test
-    public void testLocationConfig() throws Exception {
-        String yaml = 
-                "location:\n"+
-                "  localhost:\n"+
-                "    displayName: myname\n"+
-                "    myconfkey: myconfval\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
-        assertEquals(loc.getDisplayName(), "myname");
-        assertEquals(loc.config().getLocalBag().getStringKey("myconfkey"), "myconfval");
-    }
-
-    @Test
-    public void testMultiLocationConfig() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- localhost:\n"+
-                "    displayName: myname1\n"+
-                "    myconfkey: myconfval1\n"+
-                "- localhost:\n"+
-                "    displayName: myname2\n"+
-                "    myconfkey: myconfval2\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        List<Location> locs = ImmutableList.copyOf(app.getLocations());
-        assertEquals(locs.size(), 2, "locs="+locs);
-        LocalhostMachineProvisioningLocation loc1 = (LocalhostMachineProvisioningLocation) locs.get(0);
-        LocalhostMachineProvisioningLocation loc2 = (LocalhostMachineProvisioningLocation) locs.get(1);
-        assertEquals(loc1.getDisplayName(), "myname1");
-        assertEquals(loc1.config().getLocalBag().getStringKey("myconfkey"), "myconfval1");
-        assertEquals(loc2.getDisplayName(), "myname2");
-        assertEquals(loc2.config().getLocalBag().getStringKey("myconfkey"), "myconfval2");
-    }
-
-    // TODO Fails because PlanInterpretationContext constructor throws NPE on location's value (using ImmutableMap).
-    @Test(groups="WIP")
-    public void testLocationBlank() throws Exception {
-        String yaml = 
-                "location: \n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getLocations().isEmpty(), "locs="+app.getLocations());
-    }
-
-    @Test
-    public void testInvalidLocationAndLocations() throws Exception {
-        String yaml = 
-                "location: localhost\n"+
-                "locations:\n"+
-                "- localhost\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        try {
-            createStartWaitAndLogApplication(new StringReader(yaml));
-        } catch (Exception e) {
-            if (!e.toString().contains("Conflicting 'location' and 'locations'")) throw e;
-        }
-    }
-
-    @Test
-    public void testInvalidLocationList() throws Exception {
-        // should have used "locations:" instead of "location:"
-        String yaml = 
-                "location:\n"+
-                "- localhost\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        try {
-            createStartWaitAndLogApplication(new StringReader(yaml));
-        } catch (Exception e) {
-            if (!e.toString().contains("must be a string or map")) throw e;
-        }
-    }
-    
-    @Test
-    public void testRootLocationPassedToChild() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- localhost:(name=loc1)\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
-        assertEquals(loc.getDisplayName(), "loc1");
-    }
-
-    @Test
-    public void testByonYamlHosts() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- byon:\n"+
-                "    user: root\n"+
-                "    privateKeyFile: /tmp/key_file\n"+
-                "    hosts: \n"+
-                "    - 127.0.0.1\n"+
-                "    - brooklyn@127.0.0.2\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        FixedListMachineProvisioningLocation<?> loc = (FixedListMachineProvisioningLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
-        Assert.assertEquals(loc.getChildren().size(), 2);
-        
-        SshMachineLocation l1 = (SshMachineLocation)loc.obtain();
-        assertUserAddress(l1, "root", "127.0.0.1");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "brooklyn", "127.0.0.2");
-        Assert.assertEquals(l1.getConfig(SshMachineLocation.PRIVATE_KEY_FILE), "/tmp/key_file");
-    }
-
-    @Test
-    public void testByonYamlHostsString() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- byon:\n"+
-                "    user: root\n"+
-                "    hosts: \"{127.0.{0,127}.{1-2},brooklyn@127.0.0.127}\"\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        FixedListMachineProvisioningLocation<?> loc = (FixedListMachineProvisioningLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
-        Assert.assertEquals(loc.getChildren().size(), 5);
-        
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.0.1");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.0.2");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.127.1");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.127.2");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "brooklyn", "127.0.0.127");
-    }
-
-    @Test
-    public void testMultiByonYaml() throws Exception {
-        String yaml = 
-                "locations:\n"+
-                "- multi:\n"+
-                "   targets:\n"+
-                "   - byon:\n"+
-                "      user: root\n"+
-                "      hosts: 127.0.{0,127}.{1-2}\n"+
-                "   - byon:\n"+
-                "      user: brooklyn\n"+
-                "      hosts:\n"+
-                "      - 127.0.0.127\n"+
-                "services:\n"+
-                "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        MultiLocation<?> loc = (MultiLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
-        Assert.assertEquals(loc.getSubLocations().size(), 2);
-        
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.0.1");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.0.2");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.127.1");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "root", "127.0.127.2");
-        assertUserAddress((SshMachineLocation)loc.obtain(), "brooklyn", "127.0.0.127");
-    }
-
-    public static void assertUserAddress(MachineLocation l, String user, String address) {
-        Assert.assertEquals(l.getAddress().getHostAddress(), address);
-        if (!Strings.isBlank(user)) Assert.assertEquals(((SshMachineLocation)l).getUser(), user);        
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/MapReferenceYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/MapReferenceYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/MapReferenceYamlTest.java
deleted file mode 100644
index 176245d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/MapReferenceYamlTest.java
+++ /dev/null
@@ -1,128 +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.brooklyn;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test
-public class MapReferenceYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(MapReferenceYamlTest.class);
-
-    protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-reference-map-template.yaml", extras));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-reference-map-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertEquals(Iterables.size(app.getChildren()), 3, "Expected app to have child entity");
-        Iterable<BasicEntity> basicEntities = Iterables.filter(app.getChildren(), BasicEntity.class);
-        Iterable<TestEntity> testEntities = Iterables.filter(app.getChildren(), TestEntity.class);
-        Assert.assertEquals(Iterables.size(basicEntities), 2, "Expected app to have two basic entities");
-        Assert.assertEquals(Iterables.size(testEntities), 1, "Expected app to have one test entity");
-
-        return Iterables.getOnlyElement(testEntities);
-    }
-
-    @Test
-    public void testSingleEntity() throws Exception {
-        setupAndCheckTestEntityInBasicYamlWith();
-    }
-
-    @Test
-    public void testBrooklynConfigWithMapFunction() throws Exception {
-        final Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confMapThing.obj:",
-            "      frog: $brooklyn:formatString(\"%s\", \"frog\")",
-            "      object:",
-            "        $brooklyn:object:",
-            "          type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "      one: $brooklyn:entity(\"one\")",
-            "      two: $brooklyn:entity(\"two\")");
-
-        Map<?,?> testMap = (Map<?,?>) Entities.submit(testEntity, Tasks.builder().body(new Callable<Object>() {
-            @Override
-            public Object call() throws Exception {
-                return testEntity.getConfig(TestEntity.CONF_MAP_THING_OBJECT);
-            }
-        }).build()).get();
-        Object frog = testMap.get("frog");
-        Object one = testMap.get("one");
-        Object two = testMap.get("two");
-        Object object = testMap.get("object");
-
-        Assert.assertTrue(frog instanceof String, "Should have found a String: " + frog);
-        Assert.assertEquals(frog, "frog", "Should have found a formatted String: " + frog);
-        Assert.assertTrue(object instanceof SimpleTestPojo, "Should have found a SimpleTestPojo: " + object);
-        Assert.assertTrue(one instanceof BasicEntity, "Should have found a BasicEntity: " + one);
-        Assert.assertTrue(two instanceof BasicEntity, "Should have found a BasicEntity: " + two);
-    }
-
-    @Test
-    public void testBrooklynConfigWithPlainMapFunction() throws Exception {
-        final Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confMapPlain:",
-            "      frog: $brooklyn:formatString(\"%s\", \"frog\")",
-            "      object:",
-            "        $brooklyn:object:",
-            "          type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "      one: $brooklyn:entity(\"one\")",
-            "      two: $brooklyn:entity(\"two\")");
-
-        Map<?,?> testMap = (Map<?,?>) Entities.submit(testEntity, Tasks.builder().body(new Callable<Object>() {
-            @Override
-            public Object call() throws Exception {
-                return testEntity.getConfig(TestEntity.CONF_MAP_PLAIN);
-            }
-        }).build()).get();
-        Object frog = testMap.get("frog");
-        Object one = testMap.get("one");
-        Object two = testMap.get("two");
-        Object object = testMap.get("object");
-
-        Assert.assertTrue(frog instanceof String, "Should have found a String: " + frog);
-        Assert.assertEquals(frog, "frog", "Should have found a formatted String: " + frog);
-        Assert.assertTrue(object instanceof SimpleTestPojo, "Should have found a SimpleTestPojo: " + object);
-        Assert.assertTrue(one instanceof BasicEntity, "Should have found a BasicEntity: " + one);
-        Assert.assertTrue(two instanceof BasicEntity, "Should have found a BasicEntity: " + two);
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java
deleted file mode 100644
index 147ae1e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java
+++ /dev/null
@@ -1,283 +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.brooklyn;
-
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.objs.Configurable;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Lists;
-
-@Test
-public class ObjectsYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(ObjectsYamlTest.class);
-
-    private static final AtomicBoolean managementContextInjected = new AtomicBoolean(false);
-    private static final List<String> configKeys = Lists.newLinkedList();
-
-    public static class TestObject implements ManagementContextInjectable {
-        private String string;
-        private Integer number;
-        private Object object;
-
-        public TestObject() { }
-
-        public String getString() { return string; }
-        public void setString(String string) { this.string = string; }
-
-        public Integer getNumber() { return number; }
-        public void setNumber(Integer number) { this.number = number; }
-
-        public Object getObject() { return object; }
-        public void setObject(Object object) { this.object = object; }
-
-        @Override
-        public void setManagementContext(ManagementContext managementContext) {
-            log.info("Detected injection of {}", managementContext);
-            managementContextInjected.set(true);
-        }
-    }
-
-    public static class ConfigurableObject implements Configurable {
-        public static final ConfigKey<Integer> INTEGER = ConfigKeys.newIntegerConfigKey("config.number");
-        @SetFromFlag("object")
-        public static final ConfigKey<Object> OBJECT = ConfigKeys.newConfigKey(Object.class, "config.object");
-
-        @SetFromFlag("flag")
-        private String string;
-
-        private Integer number;
-        private Object object;
-        private Double value;
-        BasicConfigurationSupport configSupport = new BasicConfigurationSupport();
-        
-        public ConfigurableObject() { }
-
-        public String getString() { return string; }
-
-        public Integer getNumber() { return number; }
-
-        public Object getObject() { return object; }
-
-        public Double getDouble() { return value; }
-        public void setDouble(Double value) { this.value = value; }
-
-        @Override
-        public <T> T getConfig(ConfigKey<T> key) {
-            return config().get(key);
-        }
-        
-        @Override
-        public <T> T setConfig(ConfigKey<T> key, T value) {
-            return config().set(key, value);
-        }
-        
-        @Override
-        public ConfigurationSupport config() {
-            return configSupport;
-        }
-        
-        private class BasicConfigurationSupport implements ConfigurationSupport {
-            private final ConfigBag bag = new ConfigBag();
-            
-            @Override
-            public <T> T get(ConfigKey<T> key) {
-                return bag.get(key);
-            }
-
-            @Override
-            public <T> T get(HasConfigKey<T> key) {
-                return get(key.getConfigKey());
-            }
-
-            @Override
-            public <T> T set(ConfigKey<T> key, T val) {
-                log.info("Detected configuration injection for {}: {}", key.getName(), val);
-                configKeys.add(key.getName());
-                if ("config.number".equals(key.getName())) number = TypeCoercions.coerce(val, Integer.class);
-                if ("config.object".equals(key.getName())) object = val;
-                T old = bag.get(key);
-                bag.configure(key, val);
-                return old;
-            }
-
-            @Override
-            public <T> T set(HasConfigKey<T> key, T val) {
-                return set(key.getConfigKey(), val);
-            }
-
-            @Override
-            public <T> T set(ConfigKey<T> key, Task<T> val) {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public <T> T set(HasConfigKey<T> key, Task<T> val) {
-                return set(key.getConfigKey(), val);
-            }
-        }
-    }
-
-    protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws Exception {
-        managementContextInjected.set(false);
-        configKeys.clear();
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", extras));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-
-        return (TestEntity)entity;
-    }
-
-    @Test
-    public void testSingleEntity() throws Exception {
-        setupAndCheckTestEntityInBasicYamlWith();
-    }
-
-    @Test
-    public void testBrooklynObject() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confObject:",
-            "      $brooklyn:object:",
-            "        type: "+ObjectsYamlTest.class.getName()+"$TestObject",
-            "        object.fields:",
-            "          number: 7",
-            "          object:",
-            "            $brooklyn:object:",
-            "              type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "          string: \"frog\"");
-
-        Object testObject = testEntity.getConfig(TestEntity.CONF_OBJECT);
-
-        Assert.assertTrue(testObject instanceof TestObject, "Expected a TestObject: "+testObject);
-        Assert.assertTrue(managementContextInjected.get());
-        Assert.assertEquals(((TestObject) testObject).getNumber(), Integer.valueOf(7));
-        Assert.assertEquals(((TestObject) testObject).getString(), "frog");
-
-        Object testObjectObject = ((TestObject) testObject).getObject();
-        Assert.assertTrue(testObjectObject instanceof SimpleTestPojo, "Expected a SimpleTestPojo: "+testObjectObject);
-    }
-
-    @Test
-    public void testBrooklynConfigurableObject() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confObject:",
-            "      $brooklyn:object:",
-            "        type: "+ObjectsYamlTest.class.getName()+"$ConfigurableObject",
-            "        object.fields:",
-            "          double: 1.4",
-            "        brooklyn.config:",
-            "          flag: frog",
-            "          config.number: 7",
-            "          object:",
-            "            $brooklyn:object:",
-            "              type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo");
-
-        Object testObject = testEntity.getConfig(TestEntity.CONF_OBJECT);
-
-        Assert.assertTrue(testObject instanceof ConfigurableObject, "Expected a ConfigurableObject: "+testObject);
-        Assert.assertEquals(((ConfigurableObject) testObject).getDouble(), Double.valueOf(1.4));
-        Assert.assertEquals(((ConfigurableObject) testObject).getString(), "frog");
-        Assert.assertEquals(((ConfigurableObject) testObject).getNumber(), Integer.valueOf(7));
-
-        Object testObjectObject = ((ConfigurableObject) testObject).getObject();
-        Assert.assertTrue(testObjectObject instanceof SimpleTestPojo, "Expected a SimpleTestPojo: "+testObjectObject);
-
-        Assert.assertTrue(configKeys.contains(ConfigurableObject.INTEGER.getName()), "Expected INTEGER key: "+configKeys);
-        Assert.assertTrue(configKeys.contains(ConfigurableObject.OBJECT.getName()), "Expected OBJECT key: "+configKeys);
-    }
-
-    @Test
-    public void testBrooklynObjectPrefix() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confListPlain:",
-            "    - $brooklyn:object:",
-            "        objectType: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "    - $brooklyn:object:",
-            "        object_type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "    - $brooklyn:object:",
-            "        type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo");
-
-        List<?> testList = testEntity.getConfig(TestEntity.CONF_LIST_PLAIN);
-
-        Assert.assertEquals(testList.size(), 3);
-        for (Object entry : testList) {
-            Assert.assertTrue(entry instanceof SimpleTestPojo, "Expected a SimpleTestPojo: "+entry);
-        }
-    }
-
-    @Test
-    public void testBrooklynObjectWithFunction() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
-            "  brooklyn.config:",
-            "    test.confObject:",
-            "      $brooklyn:object:",
-            "        type: "+ObjectsYamlTest.class.getName()+"$TestObject",
-            "        object.fields:",
-            "          number: 7",
-            "          object:",
-            "            $brooklyn:object:",
-            "              type: org.apache.brooklyn.camp.brooklyn.SimpleTestPojo",
-            "          string:",
-            "            $brooklyn:formatString(\"%s\", \"frog\")");
-
-        Object testObject = testEntity.getConfig(TestEntity.CONF_OBJECT);
-
-        Assert.assertTrue(testObject instanceof TestObject, "Expected a TestObject: "+testObject);
-        Assert.assertTrue(managementContextInjected.get());
-        Assert.assertEquals(((TestObject) testObject).getNumber(), Integer.valueOf(7));
-        Assert.assertEquals(((TestObject) testObject).getString(), "frog");
-
-        Object testObjectObject = ((TestObject) testObject).getObject();
-        Assert.assertTrue(testObjectObject instanceof SimpleTestPojo, "Expected a SimpleTestPojo: "+testObjectObject);
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/PoliciesYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/PoliciesYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/PoliciesYamlTest.java
deleted file mode 100644
index 6bcf49f..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/PoliciesYamlTest.java
+++ /dev/null
@@ -1,214 +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.brooklyn;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-@Test
-public class PoliciesYamlTest extends AbstractYamlTest {
-    static final Logger log = LoggerFactory.getLogger(PoliciesYamlTest.class);
-
-    @Test
-    public void testWithAppPolicy() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-app-with-policy.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-app-with-policy");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertEquals(app.policies().size(), 1);
-        Policy policy = app.policies().iterator().next();
-        Assert.assertTrue(policy instanceof TestPolicy);
-        Assert.assertEquals(policy.getConfig(TestPolicy.CONF_NAME), "Name from YAML");
-        Assert.assertEquals(policy.getConfig(TestPolicy.CONF_FROM_FUNCTION), "$brooklyn: is a fun place");
-        Map<?, ?> leftoverProperties = ((TestPolicy) policy).getLeftoverProperties();
-        Assert.assertEquals(leftoverProperties.get("policyLiteralValue1"), "Hello");
-        Assert.assertEquals(leftoverProperties.get("policyLiteralValue2"), "World");
-        Assert.assertEquals(leftoverProperties.size(), 2);
-    }
-    
-    @Test
-    public void testWithEntityPolicy() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-with-policy.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-entity-with-policy");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Assert.assertEquals(app.policies().size(), 0);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity child = app.getChildren().iterator().next();
-        Assert.assertEquals(child.policies().size(), 1);
-        Policy policy = child.policies().iterator().next();
-        Assert.assertNotNull(policy);
-        Assert.assertTrue(policy instanceof TestPolicy, "policy=" + policy + "; type=" + policy.getClass());
-        Assert.assertEquals(policy.getConfig(TestPolicy.CONF_NAME), "Name from YAML");
-        Assert.assertEquals(policy.getConfig(TestPolicy.CONF_FROM_FUNCTION), "$brooklyn: is a fun place");
-        Assert.assertEquals(((TestPolicy) policy).getLeftoverProperties(),
-                ImmutableMap.of("policyLiteralValue1", "Hello", "policyLiteralValue2", "World"));
-        Assert.assertEquals(policy.getConfig(TestPolicy.TEST_ATTRIBUTE_SENSOR), TestEntity.NAME);
-    }
-    
-    @Test
-    public void testChildWithPolicy() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",
-                    "  brooklyn.config:",
-                    "    test.confName: parent entity",
-                    "  brooklyn.children:",
-                    "  - serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-                    "    name: Child Entity",
-                    "    brooklyn.policies:",
-                    "    - policyType: org.apache.brooklyn.core.test.policy.TestPolicy",
-                    "      brooklyn.config:",
-                    "        test.confName: Name from YAML",
-                    "        test.attributeSensor: $brooklyn:sensor(\"org.apache.brooklyn.core.test.entity.TestEntity\", \"test.name\")"));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity firstEntity = app.getChildren().iterator().next();
-        Assert.assertEquals(firstEntity.getChildren().size(), 1);
-        final Entity child = firstEntity.getChildren().iterator().next();
-        Assert.assertEquals(child.getChildren().size(), 0);
-
-        Assert.assertEquals(app.policies().size(), 0);
-        Assert.assertEquals(firstEntity.policies().size(), 0);
-        
-        Asserts.eventually(new Supplier<Integer>() {
-            @Override
-            public Integer get() {
-                return child.policies().size();
-            }
-        }, Predicates.<Integer> equalTo(1));
-        
-        Policy policy = child.policies().iterator().next();
-        Assert.assertTrue(policy instanceof TestPolicy);
-        Assert.assertEquals(policy.getConfig(TestPolicy.TEST_ATTRIBUTE_SENSOR), TestEntity.NAME);
-    }
-    
-    @Test
-    public void testMultiplePolicyReferences() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("test-referencing-policies.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-referencing-policies");
-        
-        Entity entity1 = null, entity2 = null, child1 = null, child2 = null, grandchild1 = null, grandchild2 = null;
-        
-        Assert.assertEquals(app.getChildren().size(), 2);
-        for (Entity child : app.getChildren()) {
-            if (child.getDisplayName().equals("entity 1"))
-                entity1 = child;
-            if (child.getDisplayName().equals("entity 2"))
-                entity2 = child;
-        }
-        Assert.assertNotNull(entity1);
-        Assert.assertNotNull(entity2);
-        
-        Assert.assertEquals(entity1.getChildren().size(), 2);
-        for (Entity child : entity1.getChildren()) {
-            if (child.getDisplayName().equals("child 1"))
-                child1 = child;
-            if (child.getDisplayName().equals("child 2"))
-                child2 = child;
-        }
-        Assert.assertNotNull(child1);
-        Assert.assertNotNull(child2);
-        
-        Assert.assertEquals(child1.getChildren().size(), 2);
-        for (Entity child : child1.getChildren()) {
-            if (child.getDisplayName().equals("grandchild 1"))
-               grandchild1 = child;
-            if (child.getDisplayName().equals("grandchild 2"))
-                grandchild2 = child;
-        }
-        Assert.assertNotNull(grandchild1);
-        Assert.assertNotNull(grandchild2);
-        
-        ImmutableSet<Policy> policies = new ImmutableSet.Builder<Policy>()
-                .add(getPolicy(app))
-                .add(getPolicy(entity1))
-                .add(getPolicy(entity2))
-                .add(getPolicy(child1))
-                .add(getPolicy(child2))
-                .add(getPolicy(grandchild1))
-                .add(getPolicy(grandchild2))
-                .build();
-        
-        Map<ConfigKey<Entity>, Entity> keyToEntity = new ImmutableMap.Builder<ConfigKey<Entity>, Entity>()
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_APP, app)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_ENTITY1, entity1)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_ENTITY2, entity2)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_CHILD1, child1)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_CHILD2, child2)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_GRANDCHILD1, grandchild1)
-                .put(ReferencingYamlTestEntity.TEST_REFERENCE_GRANDCHILD2, grandchild2)
-                .build();
-        
-        for (Policy policy : policies)
-            checkReferences(policy, keyToEntity);
-        
-    }
-    
-    private void checkReferences(final Policy policy, Map<ConfigKey<Entity>, Entity> keyToEntity) throws Exception {
-        for (final ConfigKey<Entity> key : keyToEntity.keySet()) {
-            final Entity entity = keyToEntity.get(key); // Grab an entity whose execution context we can use
-            Entity fromConfig = ((EntityInternal)entity).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() {
-                @Override
-                public Entity call() throws Exception {
-                    return (Entity) policy.getConfig(key);
-                }
-            }).get();
-            Assert.assertEquals(fromConfig, keyToEntity.get(key));
-        }
-    }
-    
-    private Policy getPolicy(Entity entity) {
-        Assert.assertEquals(entity.policies().size(), 1);
-        Policy policy = entity.policies().iterator().next();
-        Assert.assertTrue(policy instanceof TestReferencingPolicy);
-        return policy;
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
deleted file mode 100644
index bb0ea90..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
+++ /dev/null
@@ -1,180 +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.brooklyn;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-public class ReferencedYamlTest extends AbstractYamlTest {
-    
-    @Test
-    public void testReferenceEntityYamlAsPlatformComponent() throws Exception {
-        String entityName = "Reference child name";
-        Entity app = createAndStartApplication(
-            "services:",
-            "- name: " + entityName,
-            "  type: classpath://yaml-ref-entity.yaml");
-        
-        checkChildEntitySpec(app, entityName);
-    }
-
-    @Test
-    public void testAnonymousReferenceEntityYamlAsPlatformComponent() throws Exception {
-        Entity app = createAndStartApplication(
-            "services:",
-            "- type: classpath://yaml-ref-entity.yaml");
-        
-        // the name declared at the root trumps the name on the item itself
-        checkChildEntitySpec(app, "Basic entity");
-    }
-
-    @Test
-    public void testReferenceAppYamlAsPlatformComponent() throws Exception {
-        Entity app = createAndStartApplication(
-            "services:",
-            "- name: Reference child name",
-            "  type: classpath://yaml-ref-app.yaml");
-        
-        Assert.assertEquals(app.getChildren().size(), 0);
-        Assert.assertEquals(app.getDisplayName(), "Reference child name");
-
-        //child is a proxy so equality test won't do
-        Assert.assertEquals(app.getEntityType().getName(), BasicApplication.class.getName());
-    }
-
-    @Test
-    public void testReferenceYamlAsChild() throws Exception {
-        String entityName = "Reference child name";
-        Entity createAndStartApplication = createAndStartApplication(
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-            "  brooklyn.children:",
-            "  - name: " + entityName,
-            "    type: classpath://yaml-ref-entity.yaml");
-        
-        checkGrandchildEntitySpec(createAndStartApplication, entityName);
-    }
-
-    @Test
-    public void testAnonymousReferenceYamlAsChild() throws Exception {
-        Entity createAndStartApplication = createAndStartApplication(
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-            "  brooklyn.children:",
-            "  - type: classpath://yaml-ref-entity.yaml");
-        
-        checkGrandchildEntitySpec(createAndStartApplication, "Basic entity");
-    }
-
-    @Test
-    public void testCatalogReferencingYamlUrl() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: yaml.reference",
-            "  version: " + TEST_VERSION,
-            "services:",
-            "- type: classpath://yaml-ref-entity.yaml");
-        
-        String entityName = "YAML -> catalog item -> yaml url";
-        Entity app = createAndStartApplication(
-            "services:",
-            "- name: " + entityName,
-            "  type: " + ver("yaml.reference"));
-        
-        checkChildEntitySpec(app, entityName);
-    }
-
-    @Test
-    public void testYamlUrlReferencingCatalog() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: yaml.basic",
-            "  version: " + TEST_VERSION,
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-        
-        String entityName = "YAML -> yaml url -> catalog item";
-        Entity app = createAndStartApplication(
-            "services:",
-            "- name: " + entityName,
-            "  type: classpath://yaml-ref-catalog.yaml");
-        
-        checkChildEntitySpec(app, entityName);
-    }
-
-    /**
-     * Tests that a YAML referenced by URL from a catalog item
-     * will have access to the catalog item's bundles.
-     */
-    @Test
-    public void testCatalogLeaksBundlesToReferencedYaml() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String parentCatalogId = "my.catalog.app.id.url.parent";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + parentCatalogId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: classpath://yaml-ref-bundle-without-libraries.yaml");
-
-        Entity app = createAndStartApplication(
-            "services:",
-                "- type: " + ver(parentCatalogId));
-        
-        Collection<Entity> children = app.getChildren();
-        Assert.assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        Assert.assertEquals(child.getEntityType().getName(), "org.apache.brooklyn.test.osgi.entities.SimpleEntity");
-
-        deleteCatalogEntity(parentCatalogId);
-    }
-
-    private void checkChildEntitySpec(Entity app, String entityName) {
-        Collection<Entity> children = app.getChildren();
-        Assert.assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        Assert.assertEquals(child.getDisplayName(), entityName);
-        Assert.assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
-    }
-
-    private void checkGrandchildEntitySpec(Entity createAndStartApplication, String entityName) {
-        Collection<Entity> children = createAndStartApplication.getChildren();
-        Assert.assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        Collection<Entity> grandChildren = child.getChildren();
-        Assert.assertEquals(grandChildren.size(), 1);
-        Entity grandChild = Iterables.getOnlyElement(grandChildren);
-        Assert.assertEquals(grandChild.getDisplayName(), entityName);
-        Assert.assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntity.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntity.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntity.java
deleted file mode 100644
index 7a8ac59..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntity.java
+++ /dev/null
@@ -1,74 +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.brooklyn;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-
-import com.google.common.reflect.TypeToken;
-
-@ImplementedBy(ReferencingYamlTestEntityImpl.class)
-public interface ReferencingYamlTestEntity extends Entity {
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_ROOT = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.root")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_SCOPE_ROOT = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.scope_root")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_APP = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.app")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_ENTITY1 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.entity1")
-            .build();    
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_ENTITY1_ALT = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.entity1a")
-            .build();    
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_ENTITY2 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.entity2")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_CHILD1 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.child1")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_CHILD2 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.child2")
-            .build(); 
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_GRANDCHILD1 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.grandchild1")
-            .build();
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_GRANDCHILD2 = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.grandchild2")
-            .build(); 
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Entity> TEST_REFERENCE_BOGUS = BasicConfigKey.builder(new TypeToken<Entity>(){})
-            .name("test.reference.bogus")
-            .build(); 
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntityImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntityImpl.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntityImpl.java
deleted file mode 100644
index 14673bc..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencingYamlTestEntityImpl.java
+++ /dev/null
@@ -1,25 +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.brooklyn;
-
-import org.apache.brooklyn.core.entity.AbstractApplication;
-
-public class ReferencingYamlTestEntityImpl extends AbstractApplication implements ReferencingYamlTestEntity {
-   
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java
deleted file mode 100644
index a5263f6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.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 org.apache.brooklyn.camp.brooklyn;
-
-import java.io.Reader;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.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.entity.Entities;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class ReloadBrooklynPropertiesTest {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(ReloadBrooklynPropertiesTest.class);
-    
-    private ManagementContext brooklynMgmt;
-    
-    @BeforeMethod(alwaysRun=true)
-    public void setup() {
-        brooklynMgmt = new BrooklynCampPlatformLauncherNoServer().launch().getBrooklynMgmt();
-    }
-    
-    @AfterMethod(alwaysRun=true)
-    public void teardown() {
-        if (brooklynMgmt!=null) Entities.destroyAll(brooklynMgmt);
-    }
-    
-    @Test
-    public void testReloadBrooklynPropertiesNonDeploy() {
-        CampPlatform platform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM);
-        Assert.assertNotNull(platform);
-        brooklynMgmt.reloadBrooklynProperties();
-        CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM);
-        Assert.assertEquals(reloadedPlatform, platform);
-    }
-    
-    @Test
-    public void testReloadBrooklynPropertiesDeploy() {
-        brooklynMgmt.reloadBrooklynProperties();
-        CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM);
-        Assert.assertNotNull(reloadedPlatform);
-        Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml"));
-        AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input);
-        try {
-            Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform);
-            LOG.info("Test - created " + assembly);
-            final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId());
-            LOG.info("App - " + app);
-            Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-            EntityTestUtils.assertAttributeEqualsEventually(app, Startable.SERVICE_UP, true);
-        } catch (Exception e) {
-            LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e);
-            throw Exceptions.propagate(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SimpleTestPojo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SimpleTestPojo.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SimpleTestPojo.java
deleted file mode 100644
index 05e32ed..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SimpleTestPojo.java
+++ /dev/null
@@ -1,43 +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.brooklyn;
-
-/**
- * Dummy POJO for use with $brooklyn:object tests
- */
-public class SimpleTestPojo {
-    private String fieldA;
-    private String fieldB;
-
-    public String getFieldA() {
-        return fieldA;
-    }
-
-    public void setFieldA(final String fieldA) {
-        this.fieldA = fieldA;
-    }
-
-    public String getFieldB() {
-        return fieldB;
-    }
-
-    public void setFieldB(final String fieldB) {
-        this.fieldB = fieldB;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfig.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfig.java
deleted file mode 100644
index e5fb2f3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfig.java
+++ /dev/null
@@ -1,34 +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.brooklyn;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.trait.Startable;
-
-@ImplementedBy(TestEntityWithInitConfigImpl.class)
-public interface TestEntityWithInitConfig extends Entity, Startable, EntityInternal {
-    public static final ConfigKey<Entity> TEST_ENTITY = BasicConfigKey.builder(Entity.class)
-            .name("test.entity")
-            .build();
-    public Entity getEntityCachedOnInit();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfigImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfigImpl.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfigImpl.java
deleted file mode 100644
index ad0431a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestEntityWithInitConfigImpl.java
+++ /dev/null
@@ -1,58 +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.brooklyn;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestEntityWithInitConfigImpl extends AbstractEntity implements TestEntityWithInitConfig {
-
-    private static final Logger LOG = LoggerFactory.getLogger(TestEntityWithInitConfigImpl.class);
-    private Entity entityCachedOnInit;
-    
-    @Override
-    public void init() {
-        super.init();
-        entityCachedOnInit = getConfig(TEST_ENTITY);
-    }
-    
-    @Override
-    public void start(Collection<? extends Location> locations) {
-        LOG.trace("Starting {}", this);
-    }
-
-    @Override
-    public void stop() {
-        LOG.trace("Stopping {}", this);
-    }
-
-    @Override
-    public void restart() {
-        LOG.trace("Restarting {}", this);
-    }
-
-    public Entity getEntityCachedOnInit() {
-        return entityCachedOnInit;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingEnricher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingEnricher.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingEnricher.java
deleted file mode 100644
index 8468014..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingEnricher.java
+++ /dev/null
@@ -1,34 +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.brooklyn;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.enricher.AbstractEnricher;
-
-public class TestReferencingEnricher extends AbstractEnricher {
-    public static final ConfigKey<Entity> TEST_APPLICATION = new BasicConfigKey<Entity>(Entity.class, "test.reference.app");
-    public static final ConfigKey<Entity> TEST_ENTITY_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.entity1");
-    public static final ConfigKey<Entity> TEST_ENTITY_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.entity2");
-    public static final ConfigKey<Entity> TEST_CHILD_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.child1");
-    public static final ConfigKey<Entity> TEST_CHILD_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.child2");
-    public static final ConfigKey<Entity> TEST_GRANDCHILD_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.grandchild1");
-    public static final ConfigKey<Entity> TEST_GRANDCHILD_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.grandchild2");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingPolicy.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingPolicy.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingPolicy.java
deleted file mode 100644
index e8b339e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestReferencingPolicy.java
+++ /dev/null
@@ -1,34 +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.brooklyn;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-
-public class TestReferencingPolicy extends AbstractPolicy {
-    public static final ConfigKey<Entity> TEST_APPLICATION = new BasicConfigKey<Entity>(Entity.class, "test.reference.app");
-    public static final ConfigKey<Entity> TEST_ENTITY_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.entity1");
-    public static final ConfigKey<Entity> TEST_ENTITY_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.entity2");
-    public static final ConfigKey<Entity> TEST_CHILD_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.child1");
-    public static final ConfigKey<Entity> TEST_CHILD_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.child2");
-    public static final ConfigKey<Entity> TEST_GRANDCHILD_1 = new BasicConfigKey<Entity>(Entity.class, "test.reference.grandchild1");
-    public static final ConfigKey<Entity> TEST_GRANDCHILD_2 = new BasicConfigKey<Entity>(Entity.class, "test.reference.grandchild2");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestSensorAndEffectorInitializer.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestSensorAndEffectorInitializer.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestSensorAndEffectorInitializer.java
deleted file mode 100644
index 91c18ed..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/TestSensorAndEffectorInitializer.java
+++ /dev/null
@@ -1,84 +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.brooklyn;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.EntityInitializer;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.testng.Assert;
-
-import com.google.common.base.Preconditions;
-
-public class TestSensorAndEffectorInitializer implements EntityInitializer {
-
-    public static final String EFFECTOR_SAY_HELLO = "sayHello";
-    public static final String SENSOR_LAST_HELLO = "lastHello";
-    public static final String SENSOR_HELLO_DEFINED = "sensorHelloDefined";
-    public static final String SENSOR_HELLO_DEFINED_EMITTED = "sensorHelloDefinedEmitted";
-
-    protected String helloWord() { return "Hello"; }
-    
-    public void apply(EntityLocal entity) {
-        Effector<String> eff = Effectors.effector(String.class, EFFECTOR_SAY_HELLO).parameter(String.class, "name").impl(
-            new EffectorBody<String>() {
-                @Override
-                public String call(ConfigBag parameters) {
-                    Object name = parameters.getStringKey("name");
-                    entity().sensors().set(Sensors.newStringSensor(SENSOR_LAST_HELLO), ""+name);
-                    return helloWord()+" "+name;
-                }
-            }).build();
-        ((EntityInternal)entity).getMutableEntityType().addEffector(eff);
-        
-        ((EntityInternal)entity).getMutableEntityType().addSensor(Sensors.newStringSensor(SENSOR_HELLO_DEFINED));
-        
-        AttributeSensor<String> emitted = Sensors.newStringSensor(SENSOR_HELLO_DEFINED_EMITTED);
-        ((EntityInternal)entity).getMutableEntityType().addSensor(emitted);
-        entity.sensors().set(emitted, "1");
-    }
-
-    public static class TestConfigurableInitializer extends TestSensorAndEffectorInitializer {
-        public static final String HELLO_WORD = "helloWord";
-        final String helloWord;
-        public TestConfigurableInitializer(Map<String,String> params) {
-            Preconditions.checkNotNull(params);
-            if (params.containsKey(HELLO_WORD)) {
-                helloWord = params.get(HELLO_WORD);
-                Assert.assertEquals(params.size(), 1);
-            } else {
-                helloWord = "Hello";
-                Assert.assertEquals(params.size(), 0);
-            }
-        }
-        
-        @Override
-        protected String helloWord() {
-            return helloWord;
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java
deleted file mode 100644
index 52dd4cc..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.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.brooklyn;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-@Test
-public class VanillaBashNetcatYamlTest extends AbstractYamlTest {
-
-    private static final Logger log = LoggerFactory.getLogger(VanillaBashNetcatYamlTest.class);
-
-    private static final AttributeSensor<String> SENSOR_OUTPUT_ALL = Sensors.newStringSensor("output.all");
-    final static Effector<String> EFFECTOR_SAY_HI = Effectors.effector(String.class, "sayHiNetcat").buildAbstract();
-    
-    @Test(groups="Integration")
-    public void testInvocationSensorAndEnricher() throws Exception {
-        Preconditions.checkArgument(Networking.isPortAvailable(4321), "port 4321 must not be in use (no leaked nc instances) for this test to succeed!");
-        
-        Entity app = createAndStartApplication(loadYaml("vanilla-bash-netcat-w-client.yaml"));
-        waitForApplicationTasks(app);
-        
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        
-        Assert.assertEquals(app.getDisplayName(), "Simple Netcat with Client");
-        
-        // comparing by plan ID is one common way
-        Iterable<Entity> netcatI = Iterables.filter(app.getChildren(), EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, "netcat-server"));
-        Assert.assertTrue(netcatI.iterator().hasNext(), "no 'netcat-server' child of app: "+app.getChildren());
-        Entity netcat = Iterables.getOnlyElement(netcatI);
-        
-        // make sure netcat is running
-        EntityTestUtils.assertAttributeEventually(netcat, Attributes.SERVICE_STATE_ACTUAL, Predicates.equalTo(Lifecycle.RUNNING));
-        
-        // find the pinger, now comparing by name
-        Iterable<Entity> pingerI = Iterables.filter(app.getChildren(), EntityPredicates.displayNameEqualTo("Simple Pinger"));
-        Assert.assertTrue(pingerI.iterator().hasNext(), "no 'Simple Pinger' child of app: "+app.getChildren());
-        Entity pinger = Iterables.getOnlyElement(pingerI);
-
-        // invoke effector
-        Task<String> ping;
-        ping = pinger.invoke(EFFECTOR_SAY_HI, MutableMap.<String,Object>of());
-        Assert.assertEquals(ping.get().trim(), "hello");
-        // and check we get the right result 
-        EntityTestUtils.assertAttributeEventually(netcat, SENSOR_OUTPUT_ALL, StringPredicates.containsLiteral("hi netcat"));
-        log.info("invoked ping from "+pinger+" to "+netcat+", 'all' sensor shows:\n"+
-                netcat.getAttribute(SENSOR_OUTPUT_ALL));
-
-        // netcat should now fail and restart
-        EntityTestUtils.assertAttributeEventually(netcat, Attributes.SERVICE_STATE_ACTUAL, Predicates.not(Predicates.equalTo(Lifecycle.RUNNING)));
-        log.info("detected failure, state is: "+netcat.getAttribute(Attributes.SERVICE_STATE_ACTUAL));
-        EntityTestUtils.assertAttributeEventually(netcat, Attributes.SERVICE_STATE_ACTUAL, Predicates.equalTo(Lifecycle.RUNNING));
-        log.info("detected recovery, state is: "+netcat.getAttribute(Attributes.SERVICE_STATE_ACTUAL));
-
-        // invoke effector again, now with a parameter
-        ping = pinger.invoke(EFFECTOR_SAY_HI, MutableMap.<String,Object>of("message", "yo yo yo"));
-        Assert.assertEquals(ping.get().trim(), "hello");
-        // checking right result
-        EntityTestUtils.assertAttributeEventually(netcat, SENSOR_OUTPUT_ALL, StringPredicates.containsLiteral("yo yo yo"));
-        log.info("invoked ping again from "+pinger+" to "+netcat+", 'all' sensor shows:\n"+
-                netcat.getAttribute(SENSOR_OUTPUT_ALL));
-        
-        // and it's propagated to the app
-        EntityTestUtils.assertAttributeEventually(app, Sensors.newStringSensor("output.last"), StringPredicates.containsLiteral("yo yo yo"));
-        
-        log.info("after all is said and done, app is:");
-        Entities.dumpInfo(app);
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-    
-}


[34/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
deleted file mode 100644
index 337c302..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
+++ /dev/null
@@ -1,1030 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent.Scope;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityFunctions;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagerInternal;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.test.entity.TestEntityImpl;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.group.DynamicFabric;
-import org.apache.brooklyn.entity.software.base.SameServerEntity;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Functionals;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.testng.collections.Lists;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-@Test
-public class EntitiesYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(EntitiesYamlTest.class);
-
-    protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", extras));
-        waitForApplicationTasks(app);
-
-        Entities.dumpInfo(app);
-        
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-        
-        Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-        
-        return (TestEntity)entity;
-    }
-    
-    @Test
-    public void testSingleEntity() throws Exception {
-        setupAndCheckTestEntityInBasicYamlWith();
-    }
-
-    @Test
-    public void testBrooklynConfig() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  brooklyn.config:",
-            "    test.confName: Test Entity Name",
-            "    test.confMapPlain:",
-            "      foo: bar",
-            "      baz: qux",
-            "    test.confListPlain:",
-            "      - dogs",
-            "      - cats",
-            "      - badgers",
-            "    test.confSetPlain: !!set",
-            "      ? square",
-            "      ? circle",
-            "      ? triangle",
-            "    test.confMapThing:",
-            "      foo: bar",
-            "      baz: qux",
-            "    test.confListThing:",
-            "      - dogs",
-            "      - cats",
-            "      - badgers",
-            "    test.confSetThing: !!set",
-            "      ? square",
-            "      ? circle",
-            "      ? triangle",
-            "    test.confObject: 5");
-        
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Test Entity Name");
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_OBJECT), 5);
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_LIST_PLAIN), ImmutableList.of("dogs", "cats", "badgers"));
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_MAP_PLAIN), ImmutableMap.of("foo", "bar", "baz", "qux"));
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_SET_PLAIN), ImmutableSet.of("square", "circle", "triangle"));
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_LIST_THING), ImmutableList.of("dogs", "cats", "badgers"));
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_MAP_THING), ImmutableMap.of("foo", "bar", "baz", "qux"));
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_SET_THING), ImmutableSet.of("square", "circle", "triangle"));
-    }
-
-    @Test
-    public void testFlagInBrooklynConfig() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  brooklyn.config:",
-            "    confName: Foo Bar");
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testUndeclaredItemInBrooklynConfig() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  brooklyn.config:",
-            "    test.dynamic.confName: Foo Bar");
-        Assert.assertEquals(testEntity.getConfig(ConfigKeys.newStringConfigKey("test.dynamic.confName")), "Foo Bar");
-    }
-
-    @Test
-    public void testFlagAtRoot() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  confName: Foo Bar");
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testFlagAtRootEntityImpl() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- serviceType: " + TestEntityImpl.class.getName(),
-                "  confName: Foo Bar");
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testConfigKeyAtRoot() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  test.confName: Foo Bar");
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testUndeclaredItemAtRootIgnored() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  test.dynamic.confName: Foo Bar");
-        // should NOT be set (and there should be a warning in the log)
-        String dynamicConfNameValue = testEntity.getConfig(ConfigKeys.newStringConfigKey("test.dynamic.confName"));
-        Assert.assertNull(dynamicConfNameValue);
-    }
-
-    @Test
-    public void testExplicitFlags() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  brooklyn.flags:",
-            "    confName: Foo Bar");
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testExplicitFlagsEntityImpl() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- serviceType: " + TestEntityImpl.class.getName(),
-                "  brooklyn.flags:",
-                "    confName: Foo Bar");
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
-    }
-
-    @Test
-    public void testUndeclaredExplicitFlagsIgnored() throws Exception {
-        Entity testEntity = setupAndCheckTestEntityInBasicYamlWith( 
-            "  brooklyn.flags:",
-            "    test.dynamic.confName: Foo Bar");
-        String dynamicConfNameValue = testEntity.getConfig(ConfigKeys.newStringConfigKey("test.dynamic.confName"));
-        Assert.assertNull(dynamicConfNameValue);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testEmptyConfig() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",
-            "  brooklyn.config:",
-            "    test.confName: \"\"",
-            "    test.confListPlain: !!seq []",
-            "    test.confMapPlain: !!map {}",
-            "    test.confSetPlain: !!set {}",
-            "    test.confObject: \"\""));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertNotNull(entity, "Expected app to have child entity");
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-        TestEntity testEntity = (TestEntity) entity;
-        Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "");
-        List<String> list = testEntity.getConfig(TestEntity.CONF_LIST_PLAIN);
-        Assert.assertEquals(list, ImmutableList.of());
-        Map<String, String> map = testEntity.getConfig(TestEntity.CONF_MAP_PLAIN);
-        Assert.assertEquals(map, ImmutableMap.of());
-        // TODO: CONF_SET_PLAIN is being set to an empty ArrayList - may be a snakeyaml issue?
-        //        Set<String> plainSet = (Set<String>)testEntity.getConfig(TestEntity.CONF_SET_PLAIN);
-        //        Assert.assertEquals(plainSet, ImmutableSet.of());
-        Object object = testEntity.getConfig(TestEntity.CONF_OBJECT);
-        Assert.assertEquals(object, "");
-    }
-    
-    @SuppressWarnings("unchecked")
-    public void testEmptyStructuredConfig() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",
-            "  brooklyn.config:",
-            "    test.confName: \"\"",
-            "    test.confListThing: !!seq []",
-            "    test.confSetThing: !!set {}",
-            "    test.confMapThing: !!map {}"));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertNotNull(entity, "Expected app to have child entity");
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-        TestEntity testEntity = (TestEntity) entity;
-        List<String> thingList = (List<String>)testEntity.getConfig(TestEntity.CONF_LIST_THING);
-        Set<String> thingSet = (Set<String>)testEntity.getConfig(TestEntity.CONF_SET_THING);
-        Map<String, String> thingMap = (Map<String, String>)testEntity.getConfig(TestEntity.CONF_MAP_THING);
-        Assert.assertEquals(thingList, Lists.newArrayList());
-        Assert.assertEquals(thingSet, ImmutableSet.of());
-        Assert.assertEquals(thingMap, ImmutableMap.of());
-    }
-
-    @Test
-    public void testSensor() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", 
-            "  brooklyn.config:",
-            "    test.confObject: $brooklyn:sensor(\"org.apache.brooklyn.core.test.entity.TestEntity\", \"test.sequence\")"));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertNotNull(entity, "Expected app to have child entity");
-        Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
-        TestEntity testEntity = (TestEntity) entity;
-        Object object = testEntity.getConfig(TestEntity.CONF_OBJECT);
-        Assert.assertNotNull(object);
-        Assert.assertTrue(object instanceof AttributeSensor, "attributeSensor="+object);
-        Assert.assertEquals(object, TestEntity.SEQUENCE);
-    }
-
-    @Test
-    public void testSensorOnArbitraryClass() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", 
-            "  brooklyn.config:",
-            "    test.confObject: $brooklyn:sensor(\""+EntitiesYamlTest.class.getName()+"$ArbitraryClassWithSensor\", \"mysensor\")"));
-        waitForApplicationTasks(app);
-
-        log.info("App started:");
-        Entities.dumpInfo(app);
-
-        TestEntity entity = (TestEntity) app.getChildren().iterator().next();
-        Object object = entity.getConfig(TestEntity.CONF_OBJECT);
-        Assert.assertEquals(object, ArbitraryClassWithSensor.MY_SENSOR);
-    }
-    public static class ArbitraryClassWithSensor {
-        public static final AttributeSensor<String> MY_SENSOR = Sensors.newStringSensor("mysensor");
-    }
-    
-    @Test
-    public void testComponent() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",
-            "  brooklyn.config:",
-            "    test.confName: first entity",
-            "  id: te1",
-            "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-            "  name: second entity",
-            "  brooklyn.config:",
-            "    test.confObject: $brooklyn:component(\"te1\")"));
-        waitForApplicationTasks(app);
-        Entity firstEntity = null;
-        Entity secondEntity = null;
-        Assert.assertEquals(app.getChildren().size(), 2);
-        for (Entity entity : app.getChildren()) {
-            if (entity.getDisplayName().equals("testentity"))
-                firstEntity = entity;
-            else if (entity.getDisplayName().equals("second entity"))
-                secondEntity = entity;
-        }
-        final Entity[] entities = {firstEntity, secondEntity};
-        Assert.assertNotNull(entities[0], "Expected app to contain child named 'testentity'");
-        Assert.assertNotNull(entities[1], "Expected app to contain child named 'second entity'");
-        Object object = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Object>() {
-            public Object call() {
-                return entities[1].getConfig(TestEntity.CONF_OBJECT);
-            }}).get();
-        Assert.assertNotNull(object);
-        Assert.assertEquals(object, firstEntity, "Expected second entity's test.confObject to contain first entity");
-    }
-
-    @Test
-    public void testGrandchildEntities() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", 
-            "  brooklyn.config:",
-            "    test.confName: first entity",
-            "  brooklyn.children:",
-            "  - serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-            "    name: Child Entity",
-            "    brooklyn.config:",
-            "      test.confName: Name of the first Child",
-            "    brooklyn.children:",
-            "    - serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-            "      name: Grandchild Entity",
-            "      brooklyn.config:",
-            "        test.confName: Name of the Grandchild",
-            "  - serviceType: org.apache.brooklyn.core.test.entity.TestEntity",
-            "    name: Second Child",
-            "    brooklyn.config:",
-            "      test.confName: Name of the second Child"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity firstEntity = app.getChildren().iterator().next();
-        Assert.assertEquals(firstEntity.getConfig(TestEntity.CONF_NAME), "first entity");
-        Assert.assertEquals(firstEntity.getChildren().size(), 2);
-        Entity firstChild = null;
-        Entity secondChild = null;
-        for (Entity entity : firstEntity.getChildren()) {
-            if (entity.getConfig(TestEntity.CONF_NAME).equals("Name of the first Child"))
-                firstChild = entity;
-            if (entity.getConfig(TestEntity.CONF_NAME).equals("Name of the second Child"))
-                secondChild = entity;
-        }
-        Assert.assertNotNull(firstChild, "Expected a child of 'first entity' with the name 'Name of the first Child'");
-        Assert.assertNotNull(secondChild, "Expected a child of 'first entity' with the name 'Name of the second Child'");
-        Assert.assertEquals(firstChild.getChildren().size(), 1);
-        Entity grandchild = firstChild.getChildren().iterator().next();
-        Assert.assertEquals(grandchild.getConfig(TestEntity.CONF_NAME), "Name of the Grandchild");
-        Assert.assertEquals(secondChild.getChildren().size(), 0);
-    }
-
-    @Test
-    public void testWithInitConfig() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-with-init-config.yaml"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getDisplayName(), "test-entity-with-init-config");
-        TestEntityWithInitConfig testWithConfigInit = null;
-        TestEntity testEntity = null;
-        Assert.assertEquals(app.getChildren().size(), 2);
-        for (Entity entity : app.getChildren()) {
-            if (entity instanceof TestEntity)
-                testEntity = (TestEntity) entity;
-            if (entity instanceof TestEntityWithInitConfig)
-                testWithConfigInit = (TestEntityWithInitConfig) entity;
-        }
-        Assert.assertNotNull(testEntity, "Expected app to contain TestEntity child");
-        Assert.assertNotNull(testWithConfigInit, "Expected app to contain TestEntityWithInitConfig child");
-        Assert.assertEquals(testWithConfigInit.getEntityCachedOnInit(), testEntity);
-        log.info("App started:");
-        Entities.dumpInfo(app);
-    }
-
-    @Test
-    public void testMultipleReferencesJava() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("test-referencing-entities.yaml"));
-        waitForApplicationTasks(app);
-        
-        Entity root1 = Tasks.resolving(new DslComponent(Scope.ROOT, "xxx").newTask(), Entity.class).context( ((EntityInternal)app).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(root1, app);
-        
-        Entity c1 = Tasks.resolving(new DslComponent("c1").newTask(), Entity.class).context( ((EntityInternal)app).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(c1, Entities.descendants(app, EntityPredicates.displayNameEqualTo("child 1")).iterator().next());
-        
-        Entity e1 = Tasks.resolving(new DslComponent(Scope.PARENT, "xxx").newTask(), Entity.class).context( ((EntityInternal)c1).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(e1, Entities.descendants(app, EntityPredicates.displayNameEqualTo("entity 1")).iterator().next());
-        
-        Entity root2 = Tasks.resolving(new DslComponent(Scope.ROOT, "xxx").newTask(), Entity.class).context( ((EntityInternal)c1).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(root2, app);
-        
-        Entity c1a = Tasks.resolving(BrooklynDslCommon.descendant("c1").newTask(), Entity.class).context( ((EntityInternal)e1).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(c1a, c1);
-        Entity e1a = Tasks.resolving(BrooklynDslCommon.ancestor("e1").newTask(), Entity.class).context( ((EntityInternal)c1).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(e1a, e1);
-        try {
-            Tasks.resolving(BrooklynDslCommon.ancestor("c1").newTask(), Entity.class).context( ((EntityInternal)e1).getExecutionContext() ).embedResolutionInTask(true).get();
-            Assert.fail("Should not have found c1 as ancestor of e1");
-        } catch (Exception e) { /* expected */ }
-    }
-    
-    @Test
-    public void testMultipleReferences() throws Exception {
-        final Entity app = createAndStartApplication(loadYaml("test-referencing-entities.yaml"));
-        waitForApplicationTasks(app);
-        
-        Entities.dumpInfo(app);
-        
-        Assert.assertEquals(app.getDisplayName(), "test-referencing-entities");
-
-        Entity entity1 = null, entity2 = null, child1 = null, child2 = null, grandchild1 = null, grandchild2 = null;
-
-        Assert.assertEquals(app.getChildren().size(), 2);
-        for (Entity child : app.getChildren()) {
-            if (child.getDisplayName().equals("entity 1"))
-                entity1 = child;
-            if (child.getDisplayName().equals("entity 2"))
-                entity2 = child;
-        }
-        Assert.assertNotNull(entity1);
-        Assert.assertNotNull(entity2);
-
-        Assert.assertEquals(entity1.getChildren().size(), 2);
-        for (Entity child : entity1.getChildren()) {
-            if (child.getDisplayName().equals("child 1"))
-                child1 = child;
-            if (child.getDisplayName().equals("child 2"))
-                child2 = child;
-        }
-        Assert.assertNotNull(child1);
-        Assert.assertNotNull(child2);
-
-        Assert.assertEquals(child1.getChildren().size(), 2);
-        for (Entity child : child1.getChildren()) {
-            if (child.getDisplayName().equals("grandchild 1"))
-                grandchild1 = child;
-            if (child.getDisplayName().equals("grandchild 2"))
-                grandchild2 = child;
-        }
-        Assert.assertNotNull(grandchild1);
-        Assert.assertNotNull(grandchild2);
-
-        Map<ConfigKey<Entity>, Entity> keyToEntity = new ImmutableMap.Builder<ConfigKey<Entity>, Entity>()
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_ROOT, app)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_SCOPE_ROOT, app)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_APP, app)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_ENTITY1, entity1)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_ENTITY1_ALT, entity1)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_ENTITY2, entity2)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_CHILD1, child1)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_CHILD2, child2)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_GRANDCHILD1, grandchild1)
-            .put(ReferencingYamlTestEntity.TEST_REFERENCE_GRANDCHILD2, grandchild2)
-            .build();
-
-        Iterable<Entity> entitiesInApp = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Iterable<Entity>>() {
-            @Override
-            public Iterable<Entity> call() throws Exception {
-                return ((EntityManagerInternal)((EntityInternal)app).getManagementContext().getEntityManager()).getAllEntitiesInApplication((Application)app);
-            }
-        }).get();
-
-        for (Entity entityInApp : entitiesInApp) {
-            checkReferences(entityInApp, keyToEntity);
-            try {
-                getResolvedConfigInTask(entityInApp, ReferencingYamlTestEntity.TEST_REFERENCE_BOGUS);
-                Assert.fail("Should not have resolved "+ReferencingYamlTestEntity.TEST_REFERENCE_BOGUS+" at "+entityInApp);
-            } catch (Exception e) {
-                /* expected */
-            }
-        }
-    }
-    
-    @Test
-    public void testScopeReferences() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  items:",
-                "  -  id: ref_child",
-                "     item:",
-                "      type: " + ReferencingYamlTestEntity.class.getName(),
-                "      test.reference.root: $brooklyn:root()",
-                "      test.reference.scope_root: $brooklyn:scopeRoot()",
-                "      brooklyn.children:",
-                "      - type: " + ReferencingYamlTestEntity.class.getName(),
-                "        test.reference.root: $brooklyn:root()",
-                "        test.reference.scope_root: $brooklyn:scopeRoot()",
-
-                "  -  id: ref_parent",
-                "     item:",
-                "      type: " + ReferencingYamlTestEntity.class.getName(),
-                "      test.reference.root: $brooklyn:root()",
-                "      test.reference.scope_root: $brooklyn:scopeRoot()",
-                "      brooklyn.children:",
-                "      - type: " + ReferencingYamlTestEntity.class.getName(),
-                "        test.reference.root: $brooklyn:root()",
-                "        test.reference.scope_root: $brooklyn:scopeRoot()",
-                "        brooklyn.children:",
-                "        - type: ref_child");
-        Entity app = createAndStartApplication(
-                "brooklyn.config:",
-                "  test.reference.root: $brooklyn:root()",
-                "  test.reference.scope_root: $brooklyn:scopeRoot()",
-                "services:",
-                "- type: " + ReferencingYamlTestEntity.class.getName(),
-                "  test.reference.root: $brooklyn:root()",
-                "  test.reference.scope_root: $brooklyn:scopeRoot()",
-                "  brooklyn.children:",
-                "  - type: " + ReferencingYamlTestEntity.class.getName(),
-                "    test.reference.root: $brooklyn:root()",
-                "    test.reference.scope_root: $brooklyn:scopeRoot()",
-                "    brooklyn.children:",
-                "    - type: ref_parent");
-        
-        assertScopes(app, app, app);
-        Entity e1 = nextChild(app);
-        assertScopes(e1, app, app);
-        Entity e2 = nextChild(e1);
-        assertScopes(e2, app, app);
-        Entity e3 = nextChild(e2);
-        assertScopes(e3, app, e3);
-        Entity e4 = nextChild(e3);
-        assertScopes(e4, app, e3);
-        Entity e5 = nextChild(e4);
-        assertScopes(e5, app, e5);
-        Entity e6 = nextChild(e5);
-        assertScopes(e6, app, e5);
-    }
-    
-    private static Entity nextChild(Entity entity) {
-        return Iterables.getOnlyElement(entity.getChildren());
-    }
-    private static void assertScopes(Entity entity, Entity root, Entity scopeRoot) {
-        assertEquals(entity.config().get(ReferencingYamlTestEntity.TEST_REFERENCE_ROOT), root);
-        assertEquals(entity.config().get(ReferencingYamlTestEntity.TEST_REFERENCE_SCOPE_ROOT), scopeRoot);
-    }
-
-    private void checkReferences(final Entity entity, Map<ConfigKey<Entity>, Entity> keyToEntity) throws Exception {
-        for (final ConfigKey<Entity> key : keyToEntity.keySet()) {
-            try {
-                Assert.assertEquals(getResolvedConfigInTask(entity, key).get(), keyToEntity.get(key), "For entity " + entity.toString() + ":");
-            } catch (Throwable t) {
-                Exceptions.propagateIfFatal(t);
-                Assert.fail("Wrong value for "+entity+":"+key+", "+((EntityInternal)entity).config().getLocalRaw(key)+": "+t, t);
-            }
-        }
-    }
-
-    private Maybe<Entity> getResolvedConfigInTask(final Entity entity, final ConfigKey<Entity> key) {
-        return Tasks.resolving(Tasks.<Entity>builder().body(
-            Functionals.callable(Suppliers.compose(EntityFunctions.config(key), Suppliers.ofInstance(entity))) ).build())
-            .as(Entity.class)
-            .context( ((EntityInternal)entity).getExecutionContext() ).embedResolutionInTask(true)
-            .getMaybe();
-    }
-
-    public void testWithAppLocation() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
-            "location: localhost:(name=yaml name)"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getLocations().size(), 1);
-        Location location = app.getLocations().iterator().next();
-        Assert.assertNotNull(location);
-        Assert.assertEquals(location.getDisplayName(), "yaml name");
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertNotNull(entity);
-        Assert.assertEquals(entity.getLocations().size(), 0);
-    }
-
-    @Test
-    public void testWithEntityLocation() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
-            "  location: localhost:(name=yaml name)\n"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getLocations().size(), 0);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertEquals(entity.getLocations().size(), 1);
-        Location location = entity.getLocations().iterator().next();
-        Assert.assertNotNull(location);
-        Assert.assertEquals(location.getDisplayName(), "yaml name");
-        Assert.assertNotNull(entity);
-    }
-
-    @Test
-    public void testWith2AppLocations() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
-            "locations:",
-            "- localhost:(name=localhost name)",
-            "- byon:(hosts=\"1.1.1.1\", name=byon name)"));
-        waitForApplicationTasks(app);
-
-        Assert.assertEquals(app.getLocations().size(), 2);
-        Location localhostLocation = null, byonLocation = null; 
-        for (Location location : app.getLocations()) {
-            if (location.getDisplayName().equals("localhost name"))
-                localhostLocation = location;
-            else if (location.getDisplayName().equals("byon name"))
-                byonLocation = location;
-        }
-        Assert.assertNotNull(localhostLocation);
-        Assert.assertNotNull(byonLocation);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertNotNull(entity);
-        // 2016-01 locations now not set on entity unless explicitly passed to "start" 
-        Assert.assertEquals(entity.getLocations().size(), 0);
-    }
-
-    @Test
-    public void testWith2EntityLocations() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
-            "  locations:",
-            "  - localhost:(name=localhost name)",
-            "  - byon:(hosts=\"1.1.1.1\", name=byon name)"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getLocations().size(), 0);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        Assert.assertEquals(entity.getLocations().size(), 2);
-        Location localhostLocation = null, byonLocation = null; 
-        for (Location location : entity.getLocations()) {
-            if (location.getDisplayName().equals("localhost name"))
-                localhostLocation = location;
-            else if (location.getDisplayName().equals("byon name"))
-                byonLocation = location;
-        }
-        Assert.assertNotNull(localhostLocation);
-        Assert.assertNotNull(byonLocation);
-    }
-
-    @Test
-    public void testWithAppAndEntityLocations() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
-            "  location: localhost:(name=localhost name)",
-            "location: byon:(hosts=\"1.1.1.1\", name=byon name)"));
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getLocations().size(), 1);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        
-        Assert.assertEquals(entity.getLocations().size(), 1);
-        Iterator<Location> entityLocationIterator = entity.getLocations().iterator();
-        Assert.assertEquals(entityLocationIterator.next().getDisplayName(), "localhost name");
-        
-        Location appLocation = app.getLocations().iterator().next();
-        Assert.assertEquals(appLocation.getDisplayName(), "byon name");
-    }
-
-    @Test
-    public void testWithEntityLocationsAndStartInLocation() throws Exception {
-        Entity app = createAndStartApplication(Streams.readFully(loadYaml("test-entity-basic-template.yaml",  
-            "  location: localhost:(name=localhost name)")),
-            // must pass as JSON list because otherwise the comma confuses the list parser
-            MutableMap.of("locations", "[ "+JavaStringEscapes.wrapJavaString(
-                "byon:(hosts=\"1.1.1.1\", name=\"byon name\")")+" ]") );
-        waitForApplicationTasks(app);
-        Assert.assertEquals(app.getLocations().size(), 1);
-        Assert.assertEquals(app.getChildren().size(), 1);
-        Entity entity = app.getChildren().iterator().next();
-        
-        Assert.assertEquals(entity.getLocations().size(), 2);
-        Iterator<Location> entityLocationIterator = entity.getLocations().iterator();
-        Assert.assertEquals(entityLocationIterator.next().getDisplayName(), "localhost name");
-        Assert.assertEquals(entityLocationIterator.next().getDisplayName(), "byon name");
-        
-        Location appLocation = app.getLocations().iterator().next();
-        Assert.assertEquals(appLocation.getDisplayName(), "byon name");
-    }
-
-    @Test
-    public void testCreateClusterWithMemberSpec() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("test-cluster-with-member-spec.yaml"));
-        waitForApplicationTasks(app);
-        assertEquals(app.getChildren().size(), 1);
-
-        Entity clusterEntity = Iterables.getOnlyElement(app.getChildren());
-        assertTrue(clusterEntity instanceof DynamicCluster, "cluster="+clusterEntity);
-
-        DynamicCluster cluster = DynamicCluster.class.cast(clusterEntity);
-        assertEquals(cluster.getMembers().size(), 2, "members="+cluster.getMembers());
-
-        for (Entity member : cluster.getMembers()) {
-            assertTrue(member instanceof TestEntity, "member="+member);
-            assertEquals(member.getConfig(TestEntity.CONF_NAME), "yamlTest");
-        }
-    }
-
-    @Test
-    public void testCreateFabricWithLocationsAtTopLevel() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- type: org.apache.brooklyn.entity.group.DynamicFabric",
-                "  memberSpec:",
-                "    $brooklyn:entitySpec:",
-                "      type: org.apache.brooklyn.core.test.entity.TestEntity",
-                "locations:",
-                "- byon(hosts=\"1.1.1.1\")",
-                "- byon(hosts=\"1.1.1.2\")"
-                );
-
-        Entity app = createAndStartApplication(yaml);
-        waitForApplicationTasks(app);
-        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendants(app, DynamicFabric.class));
-        Iterable<TestEntity> members = Entities.descendants(fabric, TestEntity.class);
-        
-        assertEquals(Iterables.size(members), 2);
-    }
-
-    @Test
-    public void testCreateFabricWithLocationsInline() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- type: org.apache.brooklyn.entity.group.DynamicFabric",
-                "  memberSpec:",
-                "    $brooklyn:entitySpec:",
-                "      type: org.apache.brooklyn.core.test.entity.TestEntity",
-                "  locations:",
-                "  - byon(hosts=\"1.1.1.1\")",
-                "  - byon(hosts=\"1.1.1.2\")"
-                );
-
-        Entity app = createAndStartApplication(yaml);
-        waitForApplicationTasks(app);
-        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendants(app, DynamicFabric.class));
-        Iterable<TestEntity> members = Entities.descendants(fabric, TestEntity.class);
-        
-        assertEquals(Iterables.size(members), 2);
-    }
-
-    @Test
-    public void testEntitySpecConfig() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  brooklyn.config:\n"+
-                "   test.childSpec:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       brooklyn.config:\n"+
-                "         test.confName: inchildspec\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
-        assertEquals(child.getConfig(TestEntity.CONF_NAME), "inchildspec");
-    }
-
-    @Test
-    public void testEntitySpecFlags() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  confName: inParent\n"+
-                "  brooklyn.config:\n"+
-                "   test.childSpec:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       confName: inchildspec\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
-        assertEquals(child.getConfig(TestEntity.CONF_NAME), "inchildspec");
-    }
-
-    @Test
-    public void testEntitySpecExplicitFlags() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  brooklyn.flags:\n"+
-                "    confName: inParent\n"+
-                "  brooklyn.config:\n"+
-                "   test.childSpec:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       brooklyn.flags:\n"+
-                "         confName: inchildspec\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
-        assertEquals(child.getConfig(TestEntity.CONF_NAME), "inchildspec");
-    }
-
-    @Test
-    public void testEntitySpecWithChildren() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  brooklyn.config:\n"+
-                "   test.childSpec:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       brooklyn.config:\n"+
-                "         test.confName: child\n"+
-                "       brooklyn.children:\n"+
-                "       - type: org.apache.brooklyn.core.test.entity.TestEntity\n" +
-                "         brooklyn.config:\n" +
-                "           test.confName: grandchild\n" +
-                "         brooklyn.children:\n"+
-                "         - type: org.apache.brooklyn.core.test.entity.TestEntity\n" +
-                "           brooklyn.config:\n" +
-                "             test.confName: greatgrandchild\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
-        assertEquals(child.getConfig(TestEntity.CONF_NAME), "child");
-        assertEquals(child.getChildren().size(), 1, "Child entity should have exactly one child of its own");
-
-        TestEntity grandchild = (TestEntity) Iterables.getOnlyElement(child.getChildren());
-        assertEquals(grandchild.getConfig(TestEntity.CONF_NAME), "grandchild");
-        assertEquals(grandchild.getChildren().size(), 1, "Grandchild entity should have exactly one child of its own");
-
-        TestEntity greatgrandchild = (TestEntity) Iterables.getOnlyElement(grandchild.getChildren());
-        assertEquals(greatgrandchild.getConfig(TestEntity.CONF_NAME), "greatgrandchild");
-    }
-    
-    @Test
-    public void testNestedEntitySpecConfigs() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  brooklyn.config:\n"+
-                "   test.childSpec:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       brooklyn.config:\n"+
-                "         test.confName: inchildspec\n"+
-                "         test.childSpec:\n"+
-                "           $brooklyn:entitySpec:\n"+
-                "             type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "             brooklyn.config:\n"+
-                "               test.confName: ingrandchildspec\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
-        assertEquals(child.getConfig(TestEntity.CONF_NAME), "inchildspec");
-        
-        TestEntity grandchild = (TestEntity) child.createAndManageChildFromConfig();
-        assertEquals(grandchild.getConfig(TestEntity.CONF_NAME), "ingrandchildspec");
-    }
-    
-    @Test
-    public void testEntitySpecInUnmatchedConfig() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "  brooklyn.config:\n"+
-                "   key.does.not.match:\n"+
-                "     $brooklyn:entitySpec:\n"+
-                "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
-                "       brooklyn.config:\n"+
-                "         test.confName: inchildspec\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        EntitySpec<?> entitySpec = (EntitySpec<?>) entity.config().getBag().getStringKey("key.does.not.match");
-        assertEquals(entitySpec.getType(), TestEntity.class);
-        assertEquals(entitySpec.getConfig(), ImmutableMap.of(TestEntity.CONF_NAME, "inchildspec"));
-    }
-
-    @Test
-    public void testAppWithSameServerEntityStarts() throws Exception {
-        Entity app = createAndStartApplication(loadYaml("same-server-entity-test.yaml"));
-        waitForApplicationTasks(app);
-        assertNotNull(app);
-        assertEquals(app.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING, "service state");
-        assertTrue(app.getAttribute(Attributes.SERVICE_UP), "service up");
-
-        assertEquals(app.getChildren().size(), 1);
-        Entity entity = Iterables.getOnlyElement(app.getChildren());
-        assertTrue(entity instanceof SameServerEntity, "entity="+entity);
-
-        SameServerEntity sse = (SameServerEntity) entity;
-        assertEquals(sse.getChildren().size(), 2);
-        for (Entity child : sse.getChildren()) {
-            assertTrue(child instanceof BasicEntity, "child="+child);
-        }
-    }
-    
-    @Test
-    public void testEntityImplExposesAllInterfacesIncludingStartable() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntityImpl\n";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        assertTrue(entity.getCallHistory().contains("start"), "history="+entity.getCallHistory());
-    }
-
-    @Test
-    public void testEntityWithInitializer() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- type: "+TestEntity.class.getName()+"\n"+
-                "  brooklyn.initializers: [ { type: "+TestSensorAndEffectorInitializer.class.getName()+" } ]";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        Effector<?> hi = entity.getEffector(TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO);
-        Assert.assertNotNull(hi);
-        
-        Assert.assertNotNull( entity.getEntityType().getSensor(TestSensorAndEffectorInitializer.SENSOR_HELLO_DEFINED) );
-        Assert.assertNotNull( entity.getEntityType().getSensor(TestSensorAndEffectorInitializer.SENSOR_HELLO_DEFINED_EMITTED) );
-        Assert.assertNull( entity.getEntityType().getSensor(TestSensorAndEffectorInitializer.SENSOR_LAST_HELLO) );
-        
-        Assert.assertNull( entity.getAttribute(Sensors.newStringSensor(TestSensorAndEffectorInitializer.SENSOR_LAST_HELLO)) );
-        Assert.assertNull( entity.getAttribute(Sensors.newStringSensor(TestSensorAndEffectorInitializer.SENSOR_HELLO_DEFINED)) );
-        Assert.assertEquals( entity.getAttribute(Sensors.newStringSensor(TestSensorAndEffectorInitializer.SENSOR_HELLO_DEFINED_EMITTED)),
-            "1");
-        
-        Task<String> saying = entity.invoke(Effectors.effector(String.class, TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO).buildAbstract(), 
-            MutableMap.of("name", "Bob"));
-        Assert.assertEquals(saying.get(Duration.TEN_SECONDS), "Hello Bob");
-        Assert.assertEquals( entity.getAttribute(Sensors.newStringSensor(TestSensorAndEffectorInitializer.SENSOR_LAST_HELLO)),
-            "Bob");
-    }
-
-    @Test
-    public void testEntityWithConfigurableInitializerEmpty() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- type: "+TestEntity.class.getName()+"\n"+
-                "  brooklyn.initializers: [ { type: "+TestSensorAndEffectorInitializer.TestConfigurableInitializer.class.getName()+" } ]";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        Task<String> saying = entity.invoke(Effectors.effector(String.class, TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO).buildAbstract(), 
-            MutableMap.of("name", "Bob"));
-        Assert.assertEquals(saying.get(Duration.TEN_SECONDS), "Hello Bob");
-    }
-
-    @Test
-    public void testEntityWithConfigurableInitializerNonEmpty() throws Exception {
-        String yaml =
-                "services:\n"+
-                "- type: "+TestEntity.class.getName()+"\n"+
-                "  brooklyn.initializers: [ { "
-                  + "type: "+TestSensorAndEffectorInitializer.TestConfigurableInitializer.class.getName()+","
-                  + "brooklyn.config: { "+TestSensorAndEffectorInitializer.TestConfigurableInitializer.HELLO_WORD+": Hey }"
-                  + " } ]";
-        
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-        
-        Task<String> saying = entity.invoke(Effectors.effector(String.class, TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO).buildAbstract(), 
-            MutableMap.of("name", "Bob"));
-        Assert.assertEquals(saying.get(Duration.TEN_SECONDS), "Hey Bob");
-    }
-
-    @Test
-    public void testEntityTypeAsImpl() throws Exception {
-        String yaml =
-                "services:"+"\n"+
-                "- type: "+CustomTestEntityImpl.class.getName()+"\n";
-
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.getEntityType().getName(), "CustomTestEntityImpl");
-    }
-    
-    public static class CustomTestEntityImpl extends TestEntityImpl {
-        public CustomTestEntityImpl() {
-            System.out.println("in CustomTestEntityImpl");
-        }
-        @Override
-        protected String getEntityTypeName() {
-            return "CustomTestEntityImpl";
-        }
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigBrooklynPropertiesTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigBrooklynPropertiesTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigBrooklynPropertiesTest.java
deleted file mode 100644
index 39b444d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigBrooklynPropertiesTest.java
+++ /dev/null
@@ -1,146 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplier;
-import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplierWithoutMapArg;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.ConfigPredicates;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-@Test
-public class ExternalConfigBrooklynPropertiesTest extends AbstractYamlTest {
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        BrooklynProperties props = BrooklynProperties.Factory.newEmpty();
-        props.put("brooklyn.external.myprovider", MyExternalConfigSupplier.class.getName());
-        props.put("brooklyn.external.myprovider.mykey", "myval");
-        props.put("brooklyn.external.myprovider.mykey2", "myval2");
-        props.put("brooklyn.external.myproviderWithoutMapArg", MyExternalConfigSupplierWithoutMapArg.class.getName());
-        props.put("myproperty", "$brooklyn:external(\"myprovider\", \"mykey\")");
-
-        return LocalManagementContextForTests.builder(true)
-                .useProperties(props)
-                .build();
-    }
-
-    // Yaml parsing support is more generic than just external-config.
-    // Test other parsing here, even though it's not directly related to external-config.
-    @Test
-    public void testYamlLiteralFromPropertiesInLocation() throws Exception {
-        ((ManagementContextInternal)mgmt()).getBrooklynProperties().put(
-                ConfigKeys.newStringConfigKey("myDynamicProperty"), "$brooklyn:literal(\"myliteral\")");
-        
-        String val = mgmt().getConfig().getConfig(ConfigKeys.newStringConfigKey("myDynamicProperty"));
-        assertEquals(val, "myliteral");
-    }
-
-    @Test
-    public void testInvalidYamlExpression() throws Exception {
-        ((ManagementContextInternal)mgmt()).getBrooklynProperties().put(
-                ConfigKeys.newStringConfigKey("myInvalidExternal"), "$brooklyn:external");
-        
-        try {
-            String val = mgmt().getConfig().getConfig(ConfigKeys.newStringConfigKey("myInvalidExternal"));
-            Asserts.shouldHaveFailedPreviously("val="+val);
-        } catch (IllegalArgumentException e) {
-            Asserts.expectedFailureContains(e, "Error evaluating node");
-        }
-    }
-
-    @Test
-    public void testExternalisedConfigFromPropertiesInLocation() throws Exception {
-        BrooklynProperties props = ((ManagementContextInternal)mgmt()).getBrooklynProperties();
-        props.put("brooklyn.location.jclouds.aws-ec2.identity", "$brooklyn:external(\"myprovider\", \"mykey\")");
-        props.put("brooklyn.location.jclouds.aws-ec2.credential", "$brooklyn:external(\"myprovider\", \"mykey2\")");
-        
-        JcloudsLocation loc = (JcloudsLocation) mgmt().getLocationRegistry().resolve("jclouds:aws-ec2:us-east-1");
-        assertEquals(loc.getIdentity(), "myval");
-        assertEquals(loc.getCredential(), "myval2");
-    }
-
-    @Test
-    public void testExternalisedConfigInProperties() throws Exception {
-        runExternalisedConfigGetters("myproperty", "myval");
-    }
-    
-    @Test
-    public void testExternalisedConfigInAddedStringProperty() throws Exception {
-        ((ManagementContextInternal)mgmt()).getBrooklynProperties().put(
-                "myDynamicProperty", "$brooklyn:external(\"myprovider\", \"mykey\")");
-        runExternalisedConfigGetters("myDynamicProperty", "myval");
-    }
-    
-    @Test
-    public void testExternalisedConfigInAddedKeyProperty() throws Exception {
-        ((ManagementContextInternal)mgmt()).getBrooklynProperties().put(
-                ConfigKeys.newStringConfigKey("myDynamicProperty"), "$brooklyn:external(\"myprovider\", \"mykey\")");
-        runExternalisedConfigGetters("myDynamicProperty", "myval");
-    }
-    
-    @Test
-    public void testExternalisedConfigInAddedMapProperty() throws Exception {
-        ((ManagementContextInternal)mgmt()).getBrooklynProperties().addFromMap(
-                ImmutableMap.of("myDynamicProperty", "$brooklyn:external(\"myprovider\", \"mykey\")"));
-        runExternalisedConfigGetters("myDynamicProperty", "myval");
-    }
-
-    protected void runExternalisedConfigGetters(String property, String expectedVal) throws Exception {
-        runExternalisedConfigGetters(((ManagementContextInternal)mgmt()).getBrooklynProperties(), property, expectedVal, true);
-    }
-    
-    protected void runExternalisedConfigGetters(BrooklynProperties props, String property, String expectedVal, boolean testSubMap) throws Exception {
-        ExecutionContext exec = mgmt().getServerExecutionContext();
-
-        String val1 = props.getConfig(ConfigKeys.newStringConfigKey(property));
-        assertEquals(val1, expectedVal);
-        
-        DeferredSupplier<?> val2 = (DeferredSupplier<?>) props.getRawConfig(ConfigKeys.newStringConfigKey(property));
-        assertEquals(Tasks.resolveValue(val2, String.class, exec), expectedVal);
-        
-        DeferredSupplier<?> val3 = (DeferredSupplier<?>) props.getConfigRaw(ConfigKeys.newStringConfigKey(property), false).get();
-        assertEquals(Tasks.resolveValue(val3, String.class, exec), expectedVal);
-
-        DeferredSupplier<?> val4 = (DeferredSupplier<?>) props.getAllConfig().get(ConfigKeys.newStringConfigKey(property));
-        assertEquals(Tasks.resolveValue(val4, String.class, exec), expectedVal);
-        
-        String val5 = props.getFirst(property);
-        assertTrue(val5.startsWith("$brooklyn:external"), "val="+val5);
-        
-        if (testSubMap) {
-            BrooklynProperties submap = props.submap(ConfigPredicates.nameEqualTo(property));
-            runExternalisedConfigGetters(submap, property, expectedVal, false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
deleted file mode 100644
index 66d3cfe..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
+++ /dev/null
@@ -1,328 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.util.Map;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.external.AbstractExternalConfigSupplier;
-import org.apache.brooklyn.core.config.external.ExternalConfigSupplier;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.core.mgmt.internal.CampYamlParser;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-@Test
-public class ExternalConfigYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(ExternalConfigYamlTest.class);
-    
-    // Choose a small jar; it is downloaded in some tests.
-    // Pick an OSGi bundle that is not part of core brooklyn.
-    private static final String LIBRARY_URL = "https://repository.apache.org/content/groups/public/org/apache/logging/log4j/log4j-api/2.5/log4j-api-2.5.jar";
-    private static final String LIBRARY_SYMBOLIC_NAME = "org.apache.logging.log4j.api";
-    private static final String LIBRARY_VERSION = "2.5.0";
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        BrooklynProperties props = BrooklynProperties.Factory.newEmpty();
-        props.put("brooklyn.external.myprovider", MyExternalConfigSupplier.class.getName());
-        props.put("brooklyn.external.myprovider.mykey", "myval");
-        props.put("brooklyn.external.myproviderWithoutMapArg", MyExternalConfigSupplierWithoutMapArg.class.getName());
-
-        props.put("brooklyn.external.myprovider.myCatalogId", "myId");
-        props.put("brooklyn.external.myprovider.myCatalogItemType", "template");
-        props.put("brooklyn.external.myprovider.myCatalogVersion", "1.2");
-        props.put("brooklyn.external.myprovider.myCatalogDescription", "myDescription");
-        props.put("brooklyn.external.myprovider.myCatalogDisplayName", "myDisplayName");
-        props.put("brooklyn.external.myprovider.myCatalogIconUrl", "classpath:///myIconUrl.png");
-        props.put("brooklyn.external.myprovider.myCatalogLibraryUrl", LIBRARY_URL);
-        props.put("brooklyn.external.myprovider.myCatalogLibraryName", LIBRARY_SYMBOLIC_NAME);
-        props.put("brooklyn.external.myprovider.myCatalogLibraryVersion", LIBRARY_VERSION);
-
-        return LocalManagementContextForTests.builder(true)
-                .useProperties(props)
-                .disableOsgi(false)
-                .build();
-    }
-
-    @Test
-    public void testCampYamlParserHandlesExternalisedConfig() throws Exception {
-        CampYamlParser parser = mgmt().getConfig().getConfig(CampYamlParser.YAML_PARSER_KEY);
-        
-        DeferredSupplier<?> supplier = (DeferredSupplier<?>) parser.parse("$brooklyn:external(\"myprovider\", \"mykey\")");
-        
-        ExecutionContext exec = mgmt().getServerExecutionContext();
-        String result = Tasks.resolveValue(supplier, String.class, exec);
-        assertEquals(result, "myval");
-    }
-
-    @Test
-    public void testExternalisedConfigReferencedFromYaml() throws Exception {
-        ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
-
-        String yaml = Joiner.on("\n").join(
-            "services:",
-            "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-            "  brooklyn.config:",
-            "    my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
-
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
-        waitForApplicationTasks(app);
-
-        assertEquals(app.getConfig(MY_CONFIG_KEY), "myval");
-    }
-
-    @Test
-    public void testExternalisedLocationConfigReferencedFromYaml() throws Exception {
-        ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
-
-        String yaml = Joiner.on("\n").join(
-            "services:",
-            "- type: org.apache.brooklyn.core.test.entity.TestApplication",
-            "location:",
-            "  localhost:",
-            "    my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
-
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
-        waitForApplicationTasks(app);
-        assertEquals(Iterables.getOnlyElement( app.getLocations() ).config().get(MY_CONFIG_KEY), "myval");
-    }
-
-    // Will download the given catalog library jar
-    @Test(groups="Integration")
-    public void testExternalisedCatalogConfigReferencedFromYaml() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "    id: $brooklyn:external(\"myprovider\", \"myCatalogId\")",
-                "    itemType: $brooklyn:external(\"myprovider\", \"myCatalogItemType\")",
-                "    version: $brooklyn:external(\"myprovider\", \"myCatalogVersion\")",
-                "    description: $brooklyn:external(\"myprovider\", \"myCatalogDescription\")",
-                "    displayName: $brooklyn:external(\"myprovider\", \"myCatalogDisplayName\")",
-                "    iconUrl: $brooklyn:external(\"myprovider\", \"myCatalogIconUrl\")",
-                "    brooklyn.libraries:",
-                "    - $brooklyn:external(\"myprovider\", \"myCatalogLibraryUrl\")",
-                "",
-                "    item:",
-                "      services:",
-                "      - type: brooklyn.entity.database.mysql.MySqlNode");
-
-        catalog.addItems(yaml);
-
-        CatalogItem<Object, Object> item = Iterables.getOnlyElement(catalog.getCatalogItems());
-        CatalogBundle bundle = Iterables.getOnlyElement(item.getLibraries());
-        assertEquals(item.getId(), "myId:1.2");
-        assertEquals(item.getCatalogItemType(), CatalogItemType.TEMPLATE);
-        assertEquals(item.getVersion(), "1.2");
-        assertEquals(item.getDescription(), "myDescription");
-        assertEquals(item.getDisplayName(), "myDisplayName");
-        assertEquals(item.getIconUrl(), "classpath:///myIconUrl.png");
-        assertEquals(bundle.getUrl(), LIBRARY_URL);
-    }
-
-    // Will download the given catalog library jar
-    @Test(groups="Integration")
-    public void testExternalisedCatalogConfigReferencedFromYamlWithLibraryMap() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "    id: myid",
-                "    itemType: template",
-                "    version: 1.2",
-                "    description: myDescription",
-                "    displayName: myDisplayName",
-                "    iconUrl: classpath:///myIconUrl.png",
-                "    brooklyn.libraries:",
-                "    - name: $brooklyn:external(\"myprovider\", \"myCatalogLibraryName\")",
-                "      version: $brooklyn:external(\"myprovider\", \"myCatalogLibraryVersion\")",
-                "      url: $brooklyn:external(\"myprovider\", \"myCatalogLibraryUrl\")",
-                "",
-                "    item:",
-                "      services:",
-                "      - type: brooklyn.entity.database.mysql.MySqlNode");
-
-        catalog.addItems(yaml);
-
-        CatalogItem<Object, Object> item = Iterables.getOnlyElement(catalog.getCatalogItems());
-        CatalogBundle bundle = Iterables.getOnlyElement(item.getLibraries());
-        assertEquals(bundle.getUrl(), LIBRARY_URL);
-        assertEquals(bundle.getSymbolicName(), LIBRARY_SYMBOLIC_NAME);
-        assertEquals(bundle.getVersion(), LIBRARY_VERSION);
-    }
-
-    // Will download the given catalog library jar
-    // Confirms "normal" behaviour, when all values in the catalog are hard-coded rather than using external config.
-    @Test(groups="Integration")
-    public void testNonExternalisedCatalogConfigReferencedFromYaml() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: osgi.test",
-                "  itemType: template",
-                "  version: 1.3",
-                "  description: CentOS 6.6 With GUI - 1.3",
-                "  displayName: CentOS 6.6",
-                "  iconUrl: classpath:///centos.png",
-                "  brooklyn.libraries:",
-                "  - " + LIBRARY_URL,
-                "",
-                "  item:",
-                "    services:",
-                "    - type: brooklyn.entity.database.mysql.MySqlNode");
-
-        catalog.addItems(yaml);
-
-        CatalogItem<Object, Object> item = Iterables.getOnlyElement(catalog.getCatalogItems());
-        assertEquals(item.getId(), "osgi.test:1.3");
-        assertEquals(item.getCatalogItemType(), CatalogItemType.TEMPLATE);
-        assertEquals(item.getVersion(), "1.3");
-        assertEquals(item.getDescription(), "CentOS 6.6 With GUI - 1.3");
-        assertEquals(item.getDisplayName(), "CentOS 6.6");
-        assertEquals(item.getIconUrl(), "classpath:///centos.png");
-        assertEquals(Iterables.getOnlyElement(item.getLibraries()).getUrl(), LIBRARY_URL);
-    }
-
-    @Test(groups="Integration")
-    public void testExternalisedLocationConfigSetViaProvisioningPropertiesReferencedFromYaml() throws Exception {
-        String yaml = Joiner.on("\n").join(
-            "services:",
-            "- type: "+EmptySoftwareProcess.class.getName(),
-            "  provisioning.properties:",
-            "    credential: $brooklyn:external(\"myprovider\", \"mykey\")",
-            "location: localhost");
-
-        Entity app = createAndStartApplication(new StringReader(yaml));
-        waitForApplicationTasks(app);
-        Entity entity = Iterables.getOnlyElement( app.getChildren() );
-        assertEquals(Iterables.getOnlyElement( entity.getLocations() ).config().get(CloudLocationConfig.ACCESS_CREDENTIAL), "myval");
-    }
-
-    @Test
-    public void testExternalisedConfigFromSupplierWithoutMapArg() throws Exception {
-        ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
-
-        String yaml = Joiner.on("\n").join(
-            "services:",
-            "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-            "  brooklyn.config:",
-            "    my.config.key: $brooklyn:external(\"myproviderWithoutMapArg\", \"mykey\")");
-
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
-        waitForApplicationTasks(app);
-
-        assertEquals(app.getConfig(MY_CONFIG_KEY), "myHardcodedVal");
-    }
-
-    @Test
-    public void testWhenExternalisedConfigSupplierDoesNotExist() throws Exception {
-        BrooklynProperties props = BrooklynProperties.Factory.newEmpty();
-        props.put("brooklyn.external.myprovider", "wrong.classname.DoesNotExist");
-
-        try {
-            LocalManagementContextForTests.builder(true)
-                    .useProperties(props)
-                    .build();
-            fail();
-        } catch (Exception e) {
-            if (Exceptions.getFirstThrowableOfType(e, ClassNotFoundException.class) == null) {
-                throw e;
-            }
-        }
-    }
-
-    @Test
-    public void testWhenExternalisedConfigSupplierDoesNotHavingRightConstructor() throws Exception {
-        BrooklynProperties props = BrooklynProperties.Factory.newEmpty();
-        props.put("brooklyn.external.myprovider", MyExternalConfigSupplierWithWrongConstructor.class.getName());
-
-        try {
-            LocalManagementContext mgmt2 = LocalManagementContextForTests.builder(true)
-                    .useProperties(props)
-                    .build();
-            mgmt2.terminate();
-            fail();
-        } catch (Exception e) {
-            if (!e.toString().contains("No matching constructor")) {
-                throw e;
-            }
-        }
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-    public static class MyExternalConfigSupplier extends AbstractExternalConfigSupplier {
-        private final Map<String, String> conf;
-
-        public MyExternalConfigSupplier(ManagementContext mgmt, String name, Map<String, String> conf) {
-            super(mgmt, name);
-            this.conf = conf;
-        }
-
-        @Override public String get(String key) {
-            return conf.get(key);
-        }
-    }
-
-    public static class MyExternalConfigSupplierWithoutMapArg extends AbstractExternalConfigSupplier {
-        public MyExternalConfigSupplierWithoutMapArg(ManagementContext mgmt, String name) {
-            super(mgmt, name);
-        }
-
-        @Override public String get(String key) {
-            return key.equals("mykey") ? "myHardcodedVal" : null;
-        }
-    }
-
-    public static class MyExternalConfigSupplierWithWrongConstructor implements ExternalConfigSupplier {
-        public MyExternalConfigSupplierWithWrongConstructor(double d) {
-        }
-
-        @Override public String getName() {
-            return "myname";
-        }
-
-        @Override public String get(String key) {
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
deleted file mode 100644
index 75e0fc9..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
+++ /dev/null
@@ -1,123 +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.brooklyn;
-
-import java.io.File;
-import java.io.Reader;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.io.Files;
-
-@Test
-public class JavaWebAppWithDslYamlRebindIntegrationTest extends AbstractYamlTest {
-    
-    private static final Logger log = LoggerFactory.getLogger(JavaWebAppWithDslYamlRebindIntegrationTest.class);
-    
-    protected ClassLoader classLoader = getClass().getClassLoader();
-    protected File mementoDir;
-    protected Set<ManagementContext> mgmtContexts = MutableSet.of();
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        if (mementoDir!=null) throw new IllegalStateException("already created mgmt context");
-        mementoDir = Files.createTempDir();
-        log.info("Test "+getClass()+" persisting to "+mementoDir);
-
-        LocalManagementContext mgmt =
-            RebindTestUtils.newPersistingManagementContext(mementoDir, classLoader, 1);
-        mgmtContexts.add(mgmt);
-        return mgmt;
-    }
-    
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() {
-        for (ManagementContext mgmt: mgmtContexts) Entities.destroyAll(mgmt);
-        super.tearDown();
-        mementoDir = null;
-        mgmtContexts.clear();
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-    public Application rebind(Application app) throws Exception {
-        RebindTestUtils.waitForPersisted(app);
-        // optionally for good measure can also check this:
-//        RebindTestUtils.checkCurrentMementoSerializable(app);
-        Application result = RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
-        mgmtContexts.add(result.getManagementContext());
-        return result;
-    }
-
-    /** as {@link JavaWebAppsIntegrationTest#testWithDbDeploy()} but with rebind */
-    @Test(groups="Integration")
-    public void testJavaWebAppDeployAndRebind() throws Exception {
-        Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("java-web-app-and-db-with-function.yaml"));
-        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-
-        Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-        final Application app = (Application) mgmt().getEntityManager().getEntity(assembly.getId());
-
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
-        for (Task<?> t: tasks) t.blockUntilEnded();
-        Entities.dumpInfo(app);
-
-        Application app2 = rebind(app);
-        Assert.assertEquals(app2.getChildren().size(), 2);
-    }
-
-    // test for https://github.com/brooklyncentral/brooklyn/issues/1422
-    @Test(groups="Integration")
-    public void testJavaWebWithMemberSpecRebind() throws Exception {
-        Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-java-web-app-spec-and-db-with-function.yaml"));
-        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-
-        Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-        final Application app = (Application) mgmt().getEntityManager().getEntity(assembly.getId());
-
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
-        for (Task<?> t: tasks) t.blockUntilEnded();
-        Entities.dumpInfo(app);
-        
-        Application app2 = rebind(app);
-        Assert.assertEquals(app2.getChildren().size(), 2);
-    }
-
-}


[18/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
deleted file mode 100644
index 80ed765..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
+++ /dev/null
@@ -1,169 +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.core.entity;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
-import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
-import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.net.UserAndHostAndPort;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.TypeToken;
-
-/**
- * This interface should be used to access {@link Sensor} definitions.
- */
-public interface Attributes {
-    
-    BasicNotificationSensor<Void> LOCATION_CHANGED = new BasicNotificationSensor<Void>(
-            Void.class, "entity.locationChanged", "Indicates that an entity's location has been changed");
-
-    // TODO these should switch to being TemplatedStringAttributeSensorAndConfigKey
-    BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>(
-            String.class, "download.url", "URL pattern for downloading the installer (will substitute things like ${version} automatically)");
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    BasicAttributeSensorAndConfigKey<Map<String,String>> DOWNLOAD_ADDON_URLS = new BasicAttributeSensorAndConfigKey(
-            Map.class, "download.addon.urls", "URL patterns for downloading named add-ons (will substitute things like ${version} automatically)");
-
-    /*
-     * Port number attributes.
-     */
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    AttributeSensor<List<Integer>> PORT_NUMBERS = new BasicAttributeSensor(
-            List.class, "port.list", "List of port numbers");
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    AttributeSensor<List<Sensor<Integer>>> PORT_SENSORS = new BasicAttributeSensor(
-            List.class, "port.list.sensors", "List of port number attributes");
-
-    PortAttributeSensorAndConfigKey HTTP_PORT = new PortAttributeSensorAndConfigKey(
-            "http.port", "HTTP port", ImmutableList.of(8080,"18080+"));
-    
-    PortAttributeSensorAndConfigKey HTTPS_PORT = new PortAttributeSensorAndConfigKey(
-            "https.port", "HTTP port (with SSL/TLS)", ImmutableList.of(8443,"18443+"));
-                    
-    PortAttributeSensorAndConfigKey SSH_PORT = new PortAttributeSensorAndConfigKey("ssh.port", "SSH port", 22);
-    PortAttributeSensorAndConfigKey SMTP_PORT = new PortAttributeSensorAndConfigKey("smtp.port", "SMTP port", 25);
-    PortAttributeSensorAndConfigKey DNS_PORT = new PortAttributeSensorAndConfigKey("dns.port", "DNS port", 53);
-    PortAttributeSensorAndConfigKey AMQP_PORT = new PortAttributeSensorAndConfigKey("amqp.port", "AMQP port", "5672+");
-
-    /*
-     * Location/connection attributes.
-     */
-
-    AttributeSensor<String> HOSTNAME = Sensors.newStringSensor( "host.name", "Host name");
-    AttributeSensor<String> ADDRESS = Sensors.newStringSensor( "host.address", "Host IP address");
-    AttributeSensor<UserAndHostAndPort> SSH_ADDRESS = Sensors.newSensor(
-            UserAndHostAndPort.class, 
-            "host.sshAddress", 
-            "user@host:port for ssh'ing (or null if inappropriate)");
-    AttributeSensor<UserAndHostAndPort> WINRM_ADDRESS = Sensors.newSensor(
-            UserAndHostAndPort.class, 
-            "host.winrmAddress", 
-            "user@host:port for WinRM'ing (or null if inappropriate)");
-    AttributeSensor<String> SUBNET_HOSTNAME = Sensors.newStringSensor( "host.subnet.hostname", "Host name as known internally in " +
-            "the subnet where it is running (if different to host.name)");
-    AttributeSensor<String> SUBNET_ADDRESS = Sensors.newStringSensor( "host.subnet.address", "Host address as known internally in " +
-            "the subnet where it is running (if different to host.name)");
-
-    AttributeSensor<String> HOST_AND_PORT = Sensors.newStringSensor( "hostandport", "host:port" );
-
-    /*
-     * Lifecycle attributes
-     */
-    AttributeSensor<Boolean> SERVICE_UP = Sensors.newBooleanSensor("service.isUp", 
-            "Whether the service is active and availability (confirmed and monitored)");
-    
-    @SuppressWarnings("serial")
-    AttributeSensor<Map<String,Object>> SERVICE_NOT_UP_INDICATORS = Sensors.newSensor(
-        new TypeToken<Map<String,Object>>() {},
-        "service.notUp.indicators", 
-        "A map of namespaced indicators that the service is not up");
-    
-    @SuppressWarnings("serial")
-    AttributeSensor<Map<String,Object>> SERVICE_PROBLEMS = Sensors.newSensor(
-        new TypeToken<Map<String,Object>>() {},
-        "service.problems", 
-        "A map of namespaced indicators of problems with a service");
-
-    /**
-     * @since 0.8.0
-     */
-    @SuppressWarnings("serial")
-    AttributeSensor<Map<String,Object>> SERVICE_NOT_UP_DIAGNOSTICS = Sensors.newSensor(
-        new TypeToken<Map<String,Object>>() {},
-        "service.notUp.diagnostics", 
-        "A map of namespaced diagnostics, from when the service is not up");
-    
-    AttributeSensor<Lifecycle> SERVICE_STATE_ACTUAL = Sensors.newSensor(Lifecycle.class,
-            "service.state", "Actual lifecycle state of the service");
-    AttributeSensor<Lifecycle.Transition> SERVICE_STATE_EXPECTED = Sensors.newSensor(Lifecycle.Transition.class,
-            "service.state.expected", "Last controlled change to service state, indicating what the expected state should be");
-    
-    /** @deprecated since 0.7.0 use {@link #SERVICE_STATE_ACTUAL} or {@link #SERVICE_STATE_EXPECTED} as appropriate. */
-    @Deprecated
-    AttributeSensor<Lifecycle> SERVICE_STATE = SERVICE_STATE_ACTUAL;
-
-    /*
-     * Other metadata (optional)
-     */
-    
-    AttributeSensor<Integer> PID = Sensors.newIntegerSensor("pid", "Process ID for the previously launched instance");
-
-    AttributeSensor<String> LOG_FILE_LOCATION = Sensors.newStringSensor("log.location", "Log file location");
-    
-    AttributeSensor<URI> MAIN_URI = MainUri.MAIN_URI;
-
- // this class is added because the MAIN_URI relies on a static initialization which unfortunately can't be added to an interface.
-    class MainUri {
-        private final static AttributeSensor<URI> MAIN_URI = Sensors.newSensor(URI.class, "main.uri", "Main URI for contacting the service/endpoint offered by this entity");
-
-        static {
-            RendererHints.register(MAIN_URI, RendererHints.namedActionWithUrl());
-        }
-    }
-
-    /*
-     * Brooklyn management attributes (optional)
-     */
-
-    /**
-     * Used by entities registering a {@link ManagementContext.PropertiesReloadListener} to store a persistent
-     * reference to it, for use when unregistering the listener.
-     */
-    @Beta
-    AttributeSensor<ManagementContext.PropertiesReloadListener> PROPERTIES_RELOAD_LISTENER = Sensors.newSensor(
-            ManagementContext.PropertiesReloadListener.class,
-            "brooklyn.management.propertiesReloadListener", "Properties reload listener");
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
deleted file mode 100644
index 974f88c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
+++ /dev/null
@@ -1,216 +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.core.entity;
-
-import static org.apache.brooklyn.core.config.ConfigKeys.newBooleanConfigKey;
-import static org.apache.brooklyn.core.config.ConfigKeys.newConfigKey;
-import static org.apache.brooklyn.core.config.ConfigKeys.newConfigKeyWithPrefix;
-import static org.apache.brooklyn.core.config.ConfigKeys.newStringConfigKey;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.config.MapConfigKey;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.TemplatedStringAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.apache.brooklyn.util.core.internal.ssh.ShellTool;
-import org.apache.brooklyn.util.core.internal.ssh.SshTool;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-
-/** Commonly used config keys, for use in entities. Similar to {@link Attributes}.
- * See also {@link BrooklynServerConfig} for config keys for controlling the server. */
-public class BrooklynConfigKeys {
-
-    @Deprecated /** @deprecated since 0.7.0 see BrooklynServerConfig#getPeristenceDir() and BrooklynServerConfigKeys#PERSISTENCE_DIR */
-    public static final ConfigKey<String> BROOKLYN_PERSISTENCE_DIR = BrooklynServerConfig.PERSISTENCE_DIR;
-
-    @Deprecated /** @deprecated since 0.7.0 use BrooklynServerConfig routines */
-    public static final ConfigKey<String> BROOKLYN_DATA_DIR = BrooklynServerConfig.BROOKLYN_DATA_DIR;
-
-    public static final ConfigKey<String> ONBOX_BASE_DIR = newStringConfigKey("onbox.base.dir",
-            "Default base directory on target machines where Brooklyn config data is stored; " +
-            "default depends on the location, either ~/brooklyn-managed-processes or /tmp/brooklyn-${username} on localhost");
-
-    public static final ConfigKey<Boolean> SKIP_ON_BOX_BASE_DIR_RESOLUTION = ConfigKeys.newBooleanConfigKey("onbox.base.dir.skipResolution",
-            "Whether to skip on-box directory resolution (which can require ssh'ing), and just assume the directory exists; can be set on machine or on entity", 
-            false);
-
-    // TODO Rename to VERSION, instead of SUGGESTED_VERSION? And declare as BasicAttributeSensorAndConfigKey?
-    public static final ConfigKey<String> SUGGESTED_VERSION = newStringConfigKey("install.version", "Suggested version");
-
-    public static final ConfigKey<String> INSTALL_UNIQUE_LABEL = ConfigKeys.newStringConfigKey("install.unique_label",
-            "Provides a label which uniquely identifies an installation, used in the computation of the install dir; " +
-            "this should include something readable, and must include a hash of all data which differentiates an installation " +
-            "(e.g. version, plugins, etc), but should be the same where install dirs can be shared to allow for re-use");
-
-    /**
-     * Set this configuration value to true if the entity installation, customization and launch process is to be skipped entirely.
-     * <p>
-     * This is usually because the process or service the entity represents is already present and started, as part of the image
-     * being used. The {@link Startable#SERVICE_UP} attribute will be set in the usual manner.
-     * <p>
-     * If this key is set on a {@link Location} then all entities in that location will be treated in this way. This is useful
-     * when the location is configured with a particular image containing installed and running services.
-     *
-     * @see #ENTITY_RUNNING
-     */
-    public static final ConfigKey<Boolean> SKIP_ENTITY_START = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services");
-
-    /**
-     * Set this configuration value to true to skip the entity startup process as with {@link #ENTITY_STARTED} if the process or
-     * service represented by the entity is already running, otherwise proceed normally. This is determined using the driver's
-     * {@code isRunning()} method.
-     * <p>
-     * If this key is set on a {@link Location} then all entities in that location will be treated in this way, again as with {@link #ENTITY_STARTED}.
-     *
-     * @see #ENTITY_STARTED
-     */
-    public static final ConfigKey<Boolean> SKIP_ENTITY_START_IF_RUNNING = newBooleanConfigKey("entity.running", "Skip the startup process entirely, if service already running");
-
-    /**
-     * Set this configuration value to true if the entity installation, customization and launch process is to be skipped entirely.
-     * <p>
-     * This will skip the installation phase of the lifecycle, and move directl;y to customization and launching of the entity.
-     */
-    public static final ConfigKey<Boolean> SKIP_ENTITY_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software");
-
-    // The implementation in AbstractSoftwareSshDriver runs this command as an SSH command 
-    public static final ConfigKey<String> PRE_INSTALL_COMMAND = ConfigKeys.newStringConfigKey("pre.install.command",
-            "Command to be run prior to the install method being called on the driver");
-    public static final ConfigKey<String> POST_INSTALL_COMMAND = ConfigKeys.newStringConfigKey("post.install.command",
-            "Command to be run after the install method being called on the driver");
-    public static final ConfigKey<String> PRE_LAUNCH_COMMAND = ConfigKeys.newStringConfigKey("pre.launch.command",
-            "Command to be run prior to the launch method being called on the driver");
-    public static final ConfigKey<String> POST_LAUNCH_COMMAND = ConfigKeys.newStringConfigKey("post.launch.command",
-            "Command to be run after the launch method being called on the driver");
-
-    public static final MapConfigKey<Object> SHELL_ENVIRONMENT = new MapConfigKey<Object>(
-            Object.class,
-            "shell.env", 
-            "Map of environment variables to pass to the runtime shell", 
-            ImmutableMap.<String,Object>of());
-
-    public static final AttributeSensorAndConfigKey<String, String> INSTALL_DIR = new TemplatedStringAttributeSensorAndConfigKey("install.dir", "Directory for this software to be installed in",
-            "${" +
-            "config['"+ONBOX_BASE_DIR.getName()+"']!" +
-            "config['"+BROOKLYN_DATA_DIR.getName()+"']!" +
-            "'/<ERROR>-ONBOX_BASE_DIR-not-set'" +
-            "}" +
-            "/" +
-            "installs/" +
-            // the  var??  tests if it exists, passing value to ?string(if_present,if_absent)
-            // the ! provides a default value afterwards, which is never used, but is required for parsing
-            // when the config key is not available;
-            // thus the below prefers the install.unique_label, but falls back to simple name
-            // plus a version identifier *if* the version is explicitly set
-            "${(config['install.unique_label']??)?string(config['install.unique_label']!'X'," +
-            "(entity.entityType.simpleName)+" +
-            "((config['install.version']??)?string('_'+(config['install.version']!'X'),''))" +
-            ")}");
-
-    public static final AttributeSensorAndConfigKey<String, String> RUN_DIR = new TemplatedStringAttributeSensorAndConfigKey("run.dir", "Directory for this software to be run from",
-            "${" +
-            "config['"+ONBOX_BASE_DIR.getName()+"']!" +
-            "config['"+BROOKLYN_DATA_DIR.getName()+"']!" +
-            "'/<ERROR>-ONBOX_BASE_DIR-not-set'" +
-            "}" +
-            "/" +
-            "apps/${entity.applicationId}/" +
-            "entities/${entity.entityType.simpleName}_" +
-            "${entity.id}");
-
-    public static final AttributeSensorAndConfigKey<String, String> EXPANDED_INSTALL_DIR = new TemplatedStringAttributeSensorAndConfigKey(
-            "expandedinstall.dir", 
-            "Directory for installed artifacts (e.g. expanded dir after unpacking .tgz)", 
-            null);
-
-    /** @deprecated since 0.7.0; use {@link #INSTALL_DIR} */
-    public static final ConfigKey<String> SUGGESTED_INSTALL_DIR = INSTALL_DIR.getConfigKey();
-    /** @deprecated since 0.7.0; use {@link #RUN_DIR} */
-    public static final ConfigKey<String> SUGGESTED_RUN_DIR = RUN_DIR.getConfigKey();
-
-    /*
-     * Intention is to use these with DependentConfiguration.attributeWhenReady, to allow an entity's start
-     * to block until dependents are ready. This is particularly useful when we want to block until a dependent
-     * component is up, but this entity does not care about the dependent component's actual config values.
-     */
-
-    public static final ConfigKey<Boolean> PROVISION_LATCH = newBooleanConfigKey("provision.latch", "Latch for blocking location provision until ready");
-    public static final ConfigKey<Boolean> START_LATCH = newBooleanConfigKey("start.latch", "Latch for blocking start until ready");
-    public static final ConfigKey<Boolean> SETUP_LATCH = newBooleanConfigKey("setup.latch", "Latch for blocking setup until ready");
-    public static final ConfigKey<Boolean> PRE_INSTALL_RESOURCES_LATCH = newBooleanConfigKey("resources.preInstall.latch", "Latch for blocking pre-install resources until ready");
-    public static final ConfigKey<Boolean> INSTALL_RESOURCES_LATCH = newBooleanConfigKey("resources.install.latch", "Latch for blocking install resources until ready");
-    public static final ConfigKey<Boolean> INSTALL_LATCH = newBooleanConfigKey("install.latch", "Latch for blocking install until ready");
-    public static final ConfigKey<Boolean> RUNTIME_RESOURCES_LATCH = newBooleanConfigKey("resources.runtime.latch", "Latch for blocking runtime resources until ready");
-    public static final ConfigKey<Boolean> CUSTOMIZE_LATCH = newBooleanConfigKey("customize.latch", "Latch for blocking customize until ready");
-    public static final ConfigKey<Boolean> LAUNCH_LATCH = newBooleanConfigKey("launch.latch", "Latch for blocking launch until ready");
-
-    public static final ConfigKey<Duration> START_TIMEOUT = newConfigKey(
-            "start.timeout", "Time to wait for process and for SERVICE_UP before failing (in seconds, default 2m)", Duration.seconds(120));
-
-    /* selected properties from SshTool for external public access (e.g. putting on entities) */
-
-    /** Public-facing global config keys for Brooklyn are defined in ConfigKeys, 
-     * and have this prefix pre-prended to the config keys in this class. */
-    public static final String BROOKLYN_SSH_CONFIG_KEY_PREFIX = "brooklyn.ssh.config.";
-
-    /** Public-facing global config keys for Brooklyn are defined in ConfigKeys, 
-     * and have this prefix pre-prended to the config keys in this class. */
-    public static final String BROOKLYN_WINRM_CONFIG_KEY_PREFIX = "brooklyn.winrm.config.";
-
-    // some checks (this line, and a few Preconditions below) that the remote values aren't null, 
-    // because they have some funny circular references
-    static { assert BROOKLYN_SSH_CONFIG_KEY_PREFIX.equals(SshTool.BROOKLYN_CONFIG_KEY_PREFIX) : "static final initializer classload ordering problem"; }
-
-    public static final ConfigKey<String> SSH_TOOL_CLASS = newStringConfigKey(
-            BROOKLYN_SSH_CONFIG_KEY_PREFIX + "sshToolClass", 
-            "SshTool implementation to use (or null for default)", 
-            null);
-
-    public static final ConfigKey<String> WINRM_TOOL_CLASS = newStringConfigKey(
-            BROOKLYN_WINRM_CONFIG_KEY_PREFIX + "winrmToolClass", 
-            "WinRmTool implementation to use (or null for default)", 
-            null);
-
-    /**
-     * @deprecated since 0.9.0; use {@link #SSH_TOOL_CLASS}
-     */
-    @Deprecated
-    public static final ConfigKey<String> LEGACY_SSH_TOOL_CLASS = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, 
-            Preconditions.checkNotNull(SshTool.PROP_TOOL_CLASS, "static final initializer classload ordering problem"));
-
-    public static final ConfigKey<String> SSH_CONFIG_HOST = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_HOST);
-    public static final ConfigKey<Integer> SSH_CONFIG_PORT = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_PORT);
-    public static final ConfigKey<String> SSH_CONFIG_USER = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_USER);
-    public static final ConfigKey<String> SSH_CONFIG_PASSWORD = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_PASSWORD);
-
-    public static final ConfigKey<String> SSH_CONFIG_SCRIPT_DIR = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, 
-            Preconditions.checkNotNull(ShellTool.PROP_SCRIPT_DIR, "static final initializer classload ordering problem"));
-    public static final ConfigKey<String> SSH_CONFIG_SCRIPT_HEADER = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, ShellTool.PROP_SCRIPT_HEADER);
-    public static final ConfigKey<String> SSH_CONFIG_DIRECT_HEADER = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, ShellTool.PROP_DIRECT_HEADER);
-    public static final ConfigKey<Boolean> SSH_CONFIG_NO_DELETE_SCRIPT = newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, ShellTool.PROP_NO_DELETE_SCRIPT);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
deleted file mode 100644
index 9c8ebc8..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
+++ /dev/null
@@ -1,1201 +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.core.entity;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolver;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.EntityManager;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.LocationManager;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.api.mgmt.TaskFactory;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.config.Sanitizer;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.entity.trait.StartableMethods;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.location.Locations;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.BrooklynShutdownHooks;
-import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagerInternal;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.mgmt.internal.NonDeploymentManagementContext;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.core.objs.proxy.EntityProxyImpl;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.flags.FlagUtils;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.ParallelTask;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.core.task.system.SystemTasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.repeat.Repeater;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.reflect.TypeToken;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-
-/**
- * Convenience methods for working with entities.
- * <p>
- * Also see the various {@code *Methods} classes for traits,
- * such as {@link StartableMethods} for {@link Startable} implementations.
- */
-public class Entities {
-
-    private static final Logger log = LoggerFactory.getLogger(Entities.class);
-
-    /**
-     * Names that, if they appear anywhere in an attribute/config/field indicates that it
-     * may be private, so should not be logged etc.
-     * 
-     * @deprecated since 0.7; instead use {@link Sanitizer#SECRET_NAMES}
-     */
-    @Deprecated
-    public static final List<String> SECRET_NAMES = ImmutableList.of(
-            "password",
-            "passwd",
-            "credential",
-            "secret",
-            "private",
-            "access.cert",
-            "access.key");
-
-    /**
-     * Special object used by some setting methods to indicate that a value should be ignored.
-     * <p>
-     * See specific usages of this field to confirm where.
-     */
-    public static final Object UNCHANGED = new Object();
-
-    /**
-     * Special object used by some setting methods to indicate that a value should be removed.
-     * <p>
-     * See specific usages of this field to confirm where.
-     */
-    public static final Object REMOVE = new Object();
-
-    /**
-     * Invokes an {@link Effector} on multiple entities, with the named arguments from the parameters {@link Map}
-     * using the context of the provided {@link Entity}.
-     * <p>
-     * Intended for use only from the callingEntity.
-     * <p>
-     * Returns a {@link ParallelTask} containing the results from each tasks invocation. Calling
-     * {@link java.util.concurrent.Future#get() get()} on this will block until all tasks are complete,
-     * and will throw an exception if any task resulted in an error.
-     *
-     * @return {@link ParallelTask} containing results from each invocation
-     */
-    public static <T> Task<List<T>> invokeEffectorList(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<T> effector, final Map<String,?> parameters) {
-        // formulation is complicated, but it is building up a list of tasks, without blocking on them initially,
-        // but ensuring that when the parallel task is gotten it does block on all of them
-
-        if (entitiesToCall == null){
-            entitiesToCall = ImmutableList.of();
-        }
-
-        List<TaskAdaptable<T>> tasks = Lists.newArrayList();
-
-        for (final Entity entity : entitiesToCall) {
-            tasks.add( Effectors.invocation(entity, effector, parameters) );
-        }
-        ParallelTask<T> invoke = new ParallelTask<T>(
-                MutableMap.of(
-                        "displayName", effector.getName()+" (parallel)",
-                        "description", "Invoking effector \""+effector.getName()+"\" on "+tasks.size()+(tasks.size() == 1 ? " entity" : " entities"),
-                        "tag", BrooklynTaskTags.tagForCallerEntity(callingEntity)),
-                tasks);
-        TaskTags.markInessential(invoke);
-        return DynamicTasks.queueIfPossible(invoke).orSubmitAsync(callingEntity).asTask();
-    }
-
-    public static <T> Task<List<T>> invokeEffectorListWithMap(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<T> effector, final Map<String,?> parameters) {
-        return invokeEffectorList(callingEntity, entitiesToCall, effector, parameters);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> Task<List<T>> invokeEffectorListWithArgs(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<T> effector, Object ...args) {
-        return invokeEffectorListWithMap(callingEntity, entitiesToCall, effector,
-                // putting into a map, unnecessarily, as it ends up being the array again...
-                EffectorUtils.prepareArgsForEffectorAsMapFromArray(effector, args));
-    }
-
-    public static <T> Task<List<T>> invokeEffectorList(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<T> effector) {
-        return invokeEffectorList(callingEntity, entitiesToCall, effector, Collections.<String,Object>emptyMap());
-    }
-
-    public static <T> Task<T> invokeEffector(Entity callingEntity, Entity entityToCall,
-            final Effector<T> effector, final Map<String,?> parameters) {
-        Task<T> t = Effectors.invocation(entityToCall, effector, parameters).asTask();
-        TaskTags.markInessential(t);
-
-        // we pass to callingEntity for consistency above, but in exec-context it should be re-dispatched to targetEntity
-        // reassign t as the return value may be a wrapper, if it is switching execution contexts; see submitInternal's javadoc
-        t = ((EntityInternal)callingEntity).getManagementSupport().getExecutionContext().submit(
-                MutableMap.of("tag", BrooklynTaskTags.tagForCallerEntity(callingEntity)), t);
-
-        if (DynamicTasks.getTaskQueuingContext()!=null) {
-            // include it as a child (in the gui), marked inessential, because the caller is invoking programmatically
-            DynamicTasks.queue(t);
-        }
-
-        return t;
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> Task<T> invokeEffectorWithArgs(Entity callingEntity, Entity entityToCall,
-            final Effector<T> effector, Object ...args) {
-        return invokeEffector(callingEntity, entityToCall, effector,
-                EffectorUtils.prepareArgsForEffectorAsMapFromArray(effector, args));
-    }
-
-    public static <T> Task<T> invokeEffector(Entity callingEntity, Entity entityToCall,
-            final Effector<T> effector) {
-        return invokeEffector(callingEntity, entityToCall, effector, Collections.<String,Object>emptyMap());
-    }
-
-    /** Invokes in parallel if multiple, but otherwise invokes the item directly. */
-    public static Task<?> invokeEffector(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<?> effector, final Map<String,?> parameters) {
-        if (Iterables.size(entitiesToCall)==1)
-            return invokeEffector(callingEntity, entitiesToCall.iterator().next(), effector, parameters);
-        else
-            return invokeEffectorList(callingEntity, entitiesToCall, effector, parameters);
-    }
-
-    /** Invokes in parallel if multiple, but otherwise invokes the item directly. */
-    public static Task<?> invokeEffector(Entity callingEntity, Iterable<? extends Entity> entitiesToCall,
-            final Effector<?> effector) {
-        return invokeEffector(callingEntity, entitiesToCall, effector, Collections.<String,Object>emptyMap());
-    }
-
-    /**
-     * @deprecated since 0.7; instead use {@link Sanitizer#IS_SECRET_PREDICATE.apply(Object)}
-     */
-    @Deprecated
-    public static boolean isSecret(String name) {
-        return Sanitizer.IS_SECRET_PREDICATE.apply(name);
-    }
-
-    public static boolean isTrivial(Object v) {
-        if (v instanceof Maybe) {
-            if (!((Maybe<?>)v).isPresent())
-                return true;
-            v = ((Maybe<?>) v).get();
-        }
-
-        return v==null || (v instanceof Map && ((Map<?,?>)v).isEmpty()) ||
-                (v instanceof Collection && ((Collection<?>)v).isEmpty()) ||
-                (v instanceof CharSequence&& ((CharSequence)v).length() == 0);
-    }
-
-    /**
-     * @deprecated since 0.7; instead use {@link Sanitizer#sanitize(ConfigBag)}
-     */
-    @Deprecated
-    public static Map<String,Object> sanitize(ConfigBag input) {
-        return Sanitizer.sanitize(input );
-    }
-
-    /**
-     * @deprecated since 0.7; instead use {@link Sanitizer#sanitize(Map)}
-     */
-    @Deprecated
-    public static <K> Map<K,Object> sanitize(Map<K,?> input) {
-        return Sanitizer.sanitize(input);
-    }
-
-    public static void dumpInfo(Iterable<? extends Entity> entities) {
-        for (Entity e : entities) {
-            dumpInfo(e);
-        }
-    }
-
-    public static void dumpInfo(Entity e) {
-        try {
-            dumpInfo(e, new PrintWriter(System.out), "", "  ");
-        } catch (IOException exc) {
-            // system.out throwing an exception is odd, so don't have IOException on signature
-            throw new RuntimeException(exc);
-        }
-    }
-    public static void dumpInfo(Entity e, Writer out) throws IOException {
-        dumpInfo(e, out, "", "  ");
-    }
-    public static void dumpInfo(Entity e, String currentIndentation, String tab) throws IOException {
-        dumpInfo(e, new PrintWriter(System.out), currentIndentation, tab);
-    }
-    public static void dumpInfo(Entity e, Writer out, String currentIndentation, String tab) throws IOException {
-        out.append(currentIndentation+e.toString()+" "+e.getId()+"\n");
-
-        out.append(currentIndentation+tab+tab+"displayName = "+e.getDisplayName()+"\n");
-
-        out.append(currentIndentation+tab+tab+"locations = "+e.getLocations()+"\n");
-
-        Set<ConfigKey<?>> keys = Sets.newLinkedHashSet(
-            ((EntityInternal)e).config().getLocalBag().getAllConfigAsConfigKeyMap().keySet()
-            //((EntityInternal)e).getConfigMap().getLocalConfig().keySet() 
-            );
-        for (ConfigKey<?> it : sortConfigKeys(keys)) {
-            // use the official config key declared on the type if available
-            // (since the map sometimes contains <object> keys
-            ConfigKey<?> realKey = e.getEntityType().getConfigKey(it.getName());
-            if (realKey!=null) it = realKey;
-
-            Maybe<Object> mv = ((EntityInternal)e).config().getLocalRaw(it);
-            if (!isTrivial(mv)) {
-                Object v = mv.get();
-                out.append(currentIndentation+tab+tab+it.getName());
-                out.append(" = ");
-                if (isSecret(it.getName())) out.append("xxxxxxxx");
-                else if ((v instanceof Task) && ((Task<?>)v).isDone()) {
-                    if (((Task<?>)v).isError()) {
-                        out.append("ERROR in "+v);
-                    } else {
-                        try {
-                            out.append(((Task<?>)v).get() + " (from "+v+")");
-                        } catch (ExecutionException ee) {
-                            throw new IllegalStateException("task "+v+" done and !isError, but threw exception on get", ee);
-                        } catch (InterruptedException ie) {
-                            Thread.currentThread().interrupt();
-                            return;
-                        }
-                    }
-                } else out.append(""+v);
-                out.append("\n");
-            }
-        }
-
-        for (Sensor<?> it : sortSensors(e.getEntityType().getSensors())) {
-            if (it instanceof AttributeSensor) {
-                Object v = e.getAttribute((AttributeSensor<?>)it);
-                if (!isTrivial(v)) {
-                    out.append(currentIndentation+tab+tab+it.getName());
-                    out.append(": ");
-                    if (isSecret(it.getName())) out.append("xxxxxxxx");
-                    else out.append(""+v);
-                    out.append("\n");
-                }
-            }
-        }
-
-        if (e instanceof Group) {
-            StringBuilder members = new StringBuilder();
-            for (Entity it : ((Group)e).getMembers()) {
-                if (members.length()>0) members.append(", ");
-                members.append(it.getId());
-            }
-            out.append(currentIndentation+tab+tab+"Members: "+members.toString()+"\n");
-        }
-
-        if (!e.policies().isEmpty()) {
-            out.append(currentIndentation+tab+tab+"Policies:\n");
-            for (Policy policy : e.policies()) {
-                dumpInfo(policy, out, currentIndentation+tab+tab+tab, tab);
-            }
-        }
-
-        if (!e.enrichers().isEmpty()) {
-            out.append(currentIndentation+tab+tab+"Enrichers:\n");
-            for (Enricher enricher : e.enrichers()) {
-                dumpInfo(enricher, out, currentIndentation+tab+tab+tab, tab);
-            }
-        }
-
-        if (!((EntityInternal)e).feeds().getFeeds().isEmpty()) {
-            out.append(currentIndentation+tab+tab+"Feeds:\n");
-            for (Feed feed : ((EntityInternal)e).feeds().getFeeds()) {
-                dumpInfo(feed, out, currentIndentation+tab+tab+tab, tab);
-            }
-        }
-
-        for (Entity it : e.getChildren()) {
-            dumpInfo(it, out, currentIndentation+tab, tab);
-        }
-
-        out.flush();
-    }
-
-    public static void dumpInfo(Location loc) {
-        try {
-            dumpInfo(loc, new PrintWriter(System.out), "", "  ");
-        } catch (IOException exc) {
-            // system.out throwing an exception is odd, so don't have IOException on signature
-            throw new RuntimeException(exc);
-        }
-    }
-    public static void dumpInfo(Location loc, Writer out) throws IOException {
-        dumpInfo(loc, out, "", "  ");
-    }
-    public static void dumpInfo(Location loc, String currentIndentation, String tab) throws IOException {
-        dumpInfo(loc, new PrintWriter(System.out), currentIndentation, tab);
-    }
-    @SuppressWarnings("rawtypes")
-    public static void dumpInfo(Location loc, Writer out, String currentIndentation, String tab) throws IOException {
-        out.append(currentIndentation+loc.toString()+"\n");
-
-        for (Object entryO : ((LocationInternal)loc).config().getBag().getAllConfig().entrySet()) {
-            Map.Entry entry = (Map.Entry)entryO;
-            Object keyO = entry.getKey();
-            String key =
-                    keyO instanceof HasConfigKey ? ((HasConfigKey)keyO).getConfigKey().getName() :
-                    keyO instanceof ConfigKey ? ((ConfigKey)keyO).getName() :
-                    keyO == null ? null :
-                    keyO.toString();
-            Object val = entry.getValue();
-            if (!isTrivial(val)) {
-                out.append(currentIndentation+tab+tab+key);
-                out.append(" = ");
-                if (isSecret(key)) out.append("xxxxxxxx");
-                else out.append(""+val);
-                out.append("\n");
-            }
-        }
-
-        for (Map.Entry<String,?> entry : sortMap(FlagUtils.getFieldsWithFlags(loc)).entrySet()) {
-            String key = entry.getKey();
-            Object val = entry.getValue();
-            if (!isTrivial(val)) {
-                out.append(currentIndentation+tab+tab+key);
-                out.append(" = ");
-                if (isSecret(key)) out.append("xxxxxxxx");
-                else out.append(""+val);
-                out.append("\n");
-            }
-        }
-
-        for (Location it : loc.getChildren()) {
-            dumpInfo(it, out, currentIndentation+tab, tab);
-        }
-
-        out.flush();
-    }
-
-    public static void dumpInfo(Enricher enr) {
-        try {
-            dumpInfo(enr, new PrintWriter(System.out), "", "  ");
-        } catch (IOException exc) {
-            // system.out throwing an exception is odd, so don't have IOException on signature
-            throw new RuntimeException(exc);
-        }
-    }
-    public static void dumpInfo(Enricher enr, Writer out) throws IOException {
-        dumpInfo(enr, out, "", "  ");
-    }
-    public static void dumpInfo(Enricher enr, String currentIndentation, String tab) throws IOException {
-        dumpInfo(enr, new PrintWriter(System.out), currentIndentation, tab);
-    }
-    public static void dumpInfo(Enricher enr, Writer out, String currentIndentation, String tab) throws IOException {
-        out.append(currentIndentation+enr.toString()+"\n");
-
-        for (ConfigKey<?> key : sortConfigKeys(enr.getEnricherType().getConfigKeys())) {
-            Maybe<Object> val = ((BrooklynObjectInternal)enr).config().getRaw(key);
-            if (!isTrivial(val)) {
-                out.append(currentIndentation+tab+tab+key);
-                out.append(" = ");
-                if (isSecret(key.getName())) out.append("xxxxxxxx");
-                else out.append(""+val.get());
-                out.append("\n");
-            }
-        }
-
-        out.flush();
-    }
-    public static void dumpInfo(Feed feed, String currentIndentation, String tab) throws IOException {
-        dumpInfo(feed, new PrintWriter(System.out), currentIndentation, tab);
-    }
-    public static void dumpInfo(Feed feed, Writer out, String currentIndentation, String tab) throws IOException {
-        out.append(currentIndentation+feed.toString()+"\n");
-
-        // TODO create a FeedType cf EnricherType ?
-        for (ConfigKey<?> key : sortConfigKeys(((BrooklynObjectInternal)feed).config().getBag().getAllConfigAsConfigKeyMap().keySet())) {
-            Maybe<Object> val = ((BrooklynObjectInternal)feed).config().getRaw(key);
-            if (!isTrivial(val)) {
-                out.append(currentIndentation+tab+tab+key);
-                out.append(" = ");
-                if (isSecret(key.getName())) out.append("xxxxxxxx");
-                else out.append(""+val.get());
-                out.append("\n");
-            }
-        }
-
-        out.flush();
-    }
-
-    public static void dumpInfo(Policy pol) {
-        try {
-            dumpInfo(pol, new PrintWriter(System.out), "", "  ");
-        } catch (IOException exc) {
-            // system.out throwing an exception is odd, so don't have IOException on signature
-            throw new RuntimeException(exc);
-        }
-    }
-    public static void dumpInfo(Policy pol, Writer out) throws IOException {
-        dumpInfo(pol, out, "", "  ");
-    }
-    public static void dumpInfo(Policy pol, String currentIndentation, String tab) throws IOException {
-        dumpInfo(pol, new PrintWriter(System.out), currentIndentation, tab);
-    }
-    public static void dumpInfo(Policy pol, Writer out, String currentIndentation, String tab) throws IOException {
-        out.append(currentIndentation+pol.toString()+"\n");
-
-        for (ConfigKey<?> key : sortConfigKeys(pol.getPolicyType().getConfigKeys())) {
-            Maybe<Object> val = ((BrooklynObjectInternal)pol).config().getRaw(key);
-            if (!isTrivial(val)) {
-                out.append(currentIndentation+tab+tab+key);
-                out.append(" = ");
-                if (isSecret(key.getName())) out.append("xxxxxxxx");
-                else out.append(""+val.get());
-                out.append("\n");
-            }
-        }
-
-        out.flush();
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static List<Sensor<?>> sortSensors(Set<Sensor<?>> sensors) {
-        List result = new ArrayList(sensors);
-        Collections.sort(result, new Comparator<Sensor>() {
-                    @Override
-                    public int compare(Sensor arg0, Sensor arg1) {
-                        return arg0.getName().compareTo(arg1.getName());
-                    }
-
-        });
-        return result;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static List<ConfigKey<?>> sortConfigKeys(Set<ConfigKey<?>> configs) {
-        List result = new ArrayList(configs);
-        Collections.sort(result, new Comparator<ConfigKey>() {
-                    @Override
-                    public int compare(ConfigKey arg0, ConfigKey arg1) {
-                        return arg0.getName().compareTo(arg1.getName());
-                    }
-
-        });
-        return result;
-    }
-
-    public static <T> Map<String, T> sortMap(Map<String, T> map) {
-        Map<String,T> result = Maps.newLinkedHashMap();
-        List<String> order = Lists.newArrayList(map.keySet());
-        Collections.sort(order, String.CASE_INSENSITIVE_ORDER);
-
-        for (String key : order) {
-            result.put(key, map.get(key));
-        }
-        return result;
-    }
-
-    /**
-     * Returns true if the given descendant includes the given ancestor in its chain.
-     * Does <i>NOT</i> count a node as its ancestor.
-     */
-    public static boolean isAncestor(Entity descendant, Entity potentialAncestor) {
-        Entity ancestor = descendant.getParent();
-        while (ancestor != null) {
-            if (ancestor.equals(potentialAncestor)) return true;
-            ancestor = ancestor.getParent();
-        }
-        return false;
-    }
-
-    /**
-     * Checks whether the descendants of the given ancestor contains the given potentialDescendant.
-     * <p>
-     * In this test, unlike in {@link #descendants(Entity)}, an entity is not counted as a descendant.
-     * note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method.
-     */
-    public static boolean isDescendant(Entity ancestor, Entity potentialDescendant) {
-        Set<Entity> inspected = Sets.newLinkedHashSet();
-        Stack<Entity> toinspect = new Stack<Entity>();
-        toinspect.add(ancestor);
-
-        while (!toinspect.isEmpty()) {
-            Entity e = toinspect.pop();
-            if (e.getChildren().contains(potentialDescendant)) {
-                return true;
-            }
-            inspected.add(e);
-            toinspect.addAll(e.getChildren());
-            toinspect.removeAll(inspected);
-        }
-
-        return false;
-    }
-
-    /**
-     * Return all descendants of given entity matching the given predicate and optionally the entity itself.
-     *
-     * @see {@link EntityPredicates} for useful second arguments.
-     */
-    public static Iterable<Entity> descendants(Entity root, Predicate<? super Entity> matching, boolean includeSelf) {
-        Iterable<Entity> descs = Iterables.concat(Iterables.transform(root.getChildren(), new Function<Entity,Iterable<Entity>>() {
-            @Override
-            public Iterable<Entity> apply(Entity input) {
-                return descendants(input);
-            }
-        }));
-        return Iterables.filter(Iterables.concat(descs, Collections.singleton(root)), matching);
-    }
-
-    /**
-     * Returns the entity  matching the given predicate
-     *
-     * @see #descendants(Entity, Predicate, boolean)
-     */
-    public static Iterable<Entity> descendants(Entity root, Predicate<? super Entity> matching) {
-        return descendants(root, matching, true);
-    }
-
-    /**
-     * Returns the entity, its children, and all its children, and so on.
-     *
-     * @see #descendants(Entity, Predicate, boolean)
-     */
-    public static Iterable<Entity> descendants(Entity root) {
-        return descendants(root, Predicates.alwaysTrue(), true);
-    }
-
-    /**
-     * Return all descendants of given entity of the given type, potentially including the given root.
-     *
-     * @see #descendants(Entity)
-     * @see Iterables#filter(Iterable, Class)
-     */
-    public static <T extends Entity> Iterable<T> descendants(Entity root, Class<T> ofType) {
-        return Iterables.filter(descendants(root), ofType);
-    }
-
-    /** Returns the entity, its parent, its parent, and so on. */
-    public static Iterable<Entity> ancestors(final Entity root) {
-        return new Iterable<Entity>() {
-            @Override
-            public Iterator<Entity> iterator() {
-                return new Iterator<Entity>() {
-                    Entity next = root;
-                    @Override
-                    public boolean hasNext() {
-                        return next!=null;
-                    }
-                    @Override
-                    public Entity next() {
-                        Entity result = next;
-                        next = next.getParent();
-                        return result;
-                    }
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
-            }
-        };
-    }
-
-    /**
-     * Registers a {@link BrooklynShutdownHooks#invokeStopOnShutdown(Entity)} to shutdown this entity when the JVM exits.
-     * (Convenience method located in this class for easy access.)
-     */
-    public static void invokeStopOnShutdown(Entity entity) {
-        BrooklynShutdownHooks.invokeStopOnShutdown(entity);
-    }
-
-    /** convenience for starting an entity, esp a new Startable instance which has been created dynamically
-     * (after the application is started) */
-    public static void start(Entity e, Collection<? extends Location> locations) {
-        if (!isManaged(e) && !manage(e)) {
-            log.warn("Using deprecated discouraged mechanism to start management -- Entities.start(Application, Locations) -- caller should create and use the preferred management context");
-            startManagement(e);
-        }
-        if (e instanceof Startable) Entities.invokeEffector(e, e, Startable.START,
-                MutableMap.of("locations", locations)).getUnchecked();
-    }
-
-    /**
-     * Attempts to stop, destroy, and unmanage the given entity.
-     * <p>
-     * Actual actions performed will depend on the entity type and its current state.
-     */
-    public static void destroy(Entity e) {
-        if (isManaged(e)) {
-            if (isReadOnly(e)) {
-                unmanage(e);
-                log.debug("destroyed and unmanaged read-only copy of "+e);
-            } else {
-                if (e instanceof Startable) Entities.invokeEffector(e, e, Startable.STOP).getUnchecked();
-                
-                // if destroying gracefully we might also want to do this (currently gets done by GC after unmanage,
-                // which is good enough for leaks, but not sure if that's ideal for subscriptions etc)
-//                ((LocalEntityManager)e.getApplication().getManagementContext().getEntityManager()).stopTasks(e, null);
-                
-                if (e instanceof EntityInternal) ((EntityInternal)e).destroy();
-                
-                unmanage(e);
-                
-                log.debug("destroyed and unmanaged "+e+"; mgmt now "+
-                    (e.getApplicationId()==null ? "(no app)" : e.getApplication().getManagementContext())+" - managed? "+isManaged(e));
-            }
-        } else {
-            log.debug("skipping destroy of "+e+": not managed");
-        }
-    }
-
-    /** Same as {@link #destroy(Entity)} but catching all errors. */
-    public static void destroyCatching(Entity entity) {
-        try {
-            destroy(entity);
-        } catch (Exception e) {
-            log.warn("ERROR destroying "+entity+" (ignoring): "+e, e);
-            Exceptions.propagateIfFatal(e);
-        }
-    }
-
-    /** Destroys the given location. */
-    public static void destroy(Location loc) {
-        // TODO unmanage the location, if possible?
-        if (loc instanceof Closeable) {
-            Streams.closeQuietly((Closeable)loc);
-            log.debug("closed "+loc);
-        }
-    }
-
-    /** Same as {@link #destroy(Location)} but catching all errors. */
-    public static void destroyCatching(Location loc) {
-        try {
-            destroy(loc);
-        } catch (Exception e) {
-            log.warn("ERROR destroying "+loc+" (ignoring): "+e, e);
-            Exceptions.propagateIfFatal(e);
-        }
-    }
-
-    /**
-     * Stops, destroys, and unmanages all apps in the given context, and then terminates the management context.
-     * 
-     * Apps will be stopped+destroyed+unmanaged concurrently, waiting for all to complete.
-     */
-    public static void destroyAll(final ManagementContext mgmt) {
-        if (mgmt instanceof NonDeploymentManagementContext) {
-            // log here because it is easy for tests to destroyAll(app.getMgmtContext())
-            // which will *not* destroy the mgmt context if the app has been stopped!
-            log.warn("Entities.destroyAll invoked on non-deployment "+mgmt+" - not likely to have much effect! " +
-                    "(This usually means the mgmt context has been taken from an entity that has been destroyed. " +
-                    "To destroy other things on the management context ensure you keep a handle to the context " +
-                    "before the entity is destroyed, such as by creating the management context first.)");
-        }
-        if (!mgmt.isRunning()) return;
-        
-        ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
-        List<ListenableFuture<?>> futures = Lists.newArrayList();
-        final AtomicReference<Exception> error = Atomics.newReference();
-        try {
-            log.debug("destroying all apps in "+mgmt+": "+mgmt.getApplications());
-            for (final Application app: mgmt.getApplications()) {
-                futures.add(executor.submit(new Runnable() {
-                    public void run() {
-                        log.debug("destroying app "+app+" (managed? "+isManaged(app)+"; mgmt is "+mgmt+")");
-                        try {
-                            destroy(app);
-                            log.debug("destroyed app "+app+"; mgmt now "+mgmt);
-                        } catch (Exception e) {
-                            log.warn("problems destroying app "+app+" (mgmt now "+mgmt+", will rethrow at least one exception): "+e);
-                            error.compareAndSet(null, e);
-                        }
-                    }}));
-            }
-            Futures.allAsList(futures).get();
-            
-            for (Location loc : mgmt.getLocationManager().getLocations()) {
-                destroyCatching(loc);
-            }
-            if (mgmt instanceof ManagementContextInternal) {
-                ((ManagementContextInternal)mgmt).terminate();
-            }
-            if (error.get() != null) throw Exceptions.propagate(error.get());
-        } catch (Exception e) {
-            if (!mgmt.isRunning()) {
-                // we've checked this above so it would only happen if a different thread stopped it;
-                // this does happen sometimes e.g. in CliTest where the server shutdown occurs concurrently
-                log.debug("Destroying apps gave an error, but mgmt context was concurrently stopped so not really a problem; swallowing (unless fatal): "+e);
-                Exceptions.propagateIfFatal(e);
-            } else {
-                throw Exceptions.propagate(e);
-            }
-        } finally {
-            executor.shutdownNow();
-        }
-    }
-
-    /** Same as {@link #destroyAll(ManagementContext)} but catching all errors */
-    public static void destroyAllCatching(ManagementContext mgmt) {
-        try {
-            destroyAll(mgmt);
-        } catch (Exception e) {
-            log.warn("ERROR destroying "+mgmt+" (ignoring): "+e, e);
-            Exceptions.propagateIfFatal(e);
-        }
-    }
-
-    public static boolean isManaged(Entity e) {
-        return ((EntityInternal)e).getManagementSupport().isDeployed() && ((EntityInternal)e).getManagementContext().isRunning();
-    }
-
-    public static boolean isNoLongerManaged(Entity e) {
-        return ((EntityInternal)e).getManagementSupport().isNoLongerManaged();
-    }
-
-    /** as {@link EntityManagerInternal#isReadOnly(Entity)} */
-    @Beta
-    public static Boolean isReadOnly(Entity e) {
-        return ((EntityInternal)e).getManagementSupport().isReadOnly();
-    }
-
-    /** Unwraps a proxy to retrieve the real item, if available.
-     * <p>
-     * Only intended for use in tests and occasional internal usage, e.g. persistence.
-     * For normal operations, callers should ensure the method is available on an interface and accessed via the proxy. */
-    @Beta @VisibleForTesting
-    public static AbstractEntity deproxy(Entity e) {
-        if (!(Proxy.isProxyClass(e.getClass()))) {
-            log.warn("Attempt to deproxy non-proxy "+e, new Throwable("Location of attempt to deproxy non-proxy "+e));
-            return (AbstractEntity) e;
-        }
-        return (AbstractEntity) ((EntityProxyImpl)Proxy.getInvocationHandler(e)).getDelegate();
-    }
-    
-    /** 
-     * Returns the proxy form (if available) of the entity. If already a proxy, returns unmodified.
-     * 
-     * If null is passed in, then null is returned.
-     * 
-     * For legacy entities (that did not use {@link EntitySpec} or YAML for creation), the
-     * proxy may not be avilable; in which case the concrete class passed in will be returned.
-     */
-    @Beta
-    @SuppressWarnings("unchecked")
-    public static <T extends Entity> T proxy(T e) {
-        return (e == null) ? null : e instanceof Proxy ? e : (T) ((AbstractEntity)e).getProxyIfAvailable();
-    }
-    
-    /**
-     * Brings this entity under management only if its ancestor is managed.
-     * <p>
-     * Returns true if successful, otherwise returns false in the expectation that the ancestor
-     * will become managed, or throws exception if it has no parent or a non-application root.
-     *
-     * @throws IllegalStateException if {@literal e} is an {@link Application}.
-     * @see #startManagement(Entity)
-     * 
-     * @deprecated since 0.9.0; entities are automatically managed when created via {@link Entity#addChild(EntitySpec)},
-     *             or with {@link EntityManager#createEntity(EntitySpec)} (it is strongly encouraged to include the parent
-     *             if using the latter for anything but a top-level app).
-     */
-    @Deprecated
-    public static boolean manage(Entity e) {
-        if (Entities.isManaged(e)) {
-            return true; // no-op
-        }
-        
-        log.warn("Deprecated use of Entities.manage(Entity), for unmanaged entity "+e);
-        Entity o = e.getParent();
-        Entity eum = e; // Highest unmanaged ancestor
-        if (o==null) throw new IllegalArgumentException("Can't manage "+e+" because it is an orphan");
-        while (o.getParent()!=null) {
-            if (!isManaged(o)) eum = o;
-            o = o.getParent();
-        }
-        if (isManaged(o)) {
-            ((EntityInternal)o).getManagementContext().getEntityManager().manage(eum);
-            return true;
-        }
-        if (!(o instanceof Application)) {
-            throw new IllegalStateException("Can't manage "+e+" because it is not rooted at an application");
-        }
-        return false;
-    }
-
-    /**
-     * Brings this entity under management, creating a local management context if necessary,
-     * assuming root is an application.
-     * <p>
-     * Returns existing management context if there is one (non-deployment) or a new local management
-     * context if not, or throws an exception if root is not an application. Callers are recommended
-     * to use {@link #manage(Entity)} instead unless they know a plain-vanilla non-root management
-     * context is sufficient e.g. in tests.
-     * <p>
-     * <b>NOTE</b> This method may change, but is provided as a stop-gap to prevent ad-hoc things
-     * being done in the code which are even more likely to break!
-     * 
-     * @deprecated since 0.9.0; entities are automatically managed when created via {@link Entity#addChild(EntitySpec)},
-     *             or with {@link EntityManager#createEntity(EntitySpec)}.
-     */
-    @Deprecated
-    @Beta
-    public static ManagementContext startManagement(Entity e) {
-        log.warn("Deprecated use of Entities.startManagement(Entity), for entity "+e);
-        
-        Entity o = e;
-        Entity eum = e; // Highest unmanaged ancestor
-        while (o.getParent()!=null) {
-            if (!isManaged(o)) eum = o;
-            o = o.getParent();
-        }
-        if (isManaged(o)) {
-            ManagementContext mgmt = ((EntityInternal)o).getManagementContext();
-            mgmt.getEntityManager().manage(eum);
-            return mgmt;
-        }
-        if (!(o instanceof Application))
-            throw new IllegalStateException("Can't manage "+e+" because it is not rooted at an application");
-        
-        log.warn("Deprecated invocation of startManagement for "+e+" without a management context present; "
-            + "a new local management context is being created! (Not recommended unless you really know what you are doing.)");
-        ManagementContext mgmt = new LocalManagementContext();
-        mgmt.getEntityManager().manage(o);
-        return mgmt;
-    }
-
-    /**
-     * Starts managing the given (unmanaged) app, using the given management context.
-     *
-     * @see #startManagement(Entity)
-     * 
-     * @deprecated since 0.9.0; entities are automatically managed when created with 
-     *             {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like
-     *             {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}.
-     */
-    @Deprecated
-    public static ManagementContext startManagement(Application app, ManagementContext mgmt) {
-        log.warn("Deprecated use of Entities.startManagement(Application, ManagementContext), for app "+app);
-        
-        if (isManaged(app)) {
-            if (app.getManagementContext() == mgmt) {
-                // no-op; app was presumably auto-managed
-                return mgmt;
-            } else {
-                throw new IllegalStateException("Application "+app+" is already managed by "+app.getManagementContext()+", so cannot be managed by "+mgmt);
-            }
-        }
-
-        mgmt.getEntityManager().manage(app);
-        return mgmt;
-    }
-
-    /**
-     * Starts managing the given (unmanaged) app, setting the given brooklyn properties on the new
-     * management context.
-     *
-     * @see #startManagement(Entity)
-     * 
-     * @deprecated since 0.9.0; entities are automatically managed when created via {@link Entity#addChild(EntitySpec)},
-     *             or with {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like
-     *             {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}.
-     */
-    @Deprecated
-    public static ManagementContext startManagement(Application app, BrooklynProperties props) {
-        log.warn("Deprecated use of Entities.startManagement(Application, BrooklynProperties), for app "+app);
-        
-        if (isManaged(app)) {
-            throw new IllegalStateException("Application "+app+" is already managed, so can't set brooklyn properties");
-        }
-        ManagementContext mgmt = new LocalManagementContext(props);
-        mgmt.getEntityManager().manage(app);
-        return mgmt;
-    }
-
-    public static ManagementContext newManagementContext() {
-        return new LocalManagementContext();
-    }
-
-    public static ManagementContext newManagementContext(BrooklynProperties props) {
-        return new LocalManagementContext(props);
-    }
-
-    public static ManagementContext newManagementContext(Map<?,?> props) {
-        return new LocalManagementContext( BrooklynProperties.Factory.newEmpty().addFromMap(props));
-    }
-
-    public static ManagementContext getManagementContext(Entity entity) {
-        return ((EntityInternal) entity).getManagementContext();
-    }
-
-    public static void unmanage(Entity entity) {
-        if (((EntityInternal)entity).getManagementSupport().isDeployed()) {
-            ((EntityInternal)entity).getManagementContext().getEntityManager().unmanage(entity);
-        }
-    }
-
-    public static DownloadResolver newDownloader(EntityDriver driver) {
-        return newDownloader(driver, ImmutableMap.<String,Object>of());
-    }
-
-    public static DownloadResolver newDownloader(EntityDriver driver, Map<String,?> properties) {
-        EntityInternal internal = (EntityInternal) driver.getEntity();
-        return internal.getManagementContext().getEntityDownloadsManager().newDownloader(driver, properties);
-    }
-
-    public static DownloadResolver newDownloader(EntityDriver driver, String addon) {
-        return newDownloader(driver, addon, ImmutableMap.<String,Object>of());
-    }
-
-    public static DownloadResolver newDownloader(EntityDriver driver, String addon, Map<String,?> properties) {
-        EntityInternal internal = (EntityInternal) driver.getEntity();
-        return internal.getManagementContext().getEntityDownloadsManager().newDownloader(driver, addon, properties);
-    }
-
-    public static <T> Supplier<T> attributeSupplier(Entity entity, AttributeSensor<T> sensor) {
-        return EntityAndAttribute.create(entity, sensor);
-    }
-
-    public static <T> Supplier<T> attributeSupplier(EntityAndAttribute<T> tuple) { return tuple; }
-
-    public static <T> Supplier<T> attributeSupplierWhenReady(EntityAndAttribute<T> tuple) {
-        return attributeSupplierWhenReady(tuple.getEntity(), tuple.getAttribute());
-    }
-
-    @SuppressWarnings({ "unchecked", "serial" })
-    public static <T> Supplier<T> attributeSupplierWhenReady(final Entity entity, final AttributeSensor<T> sensor) {
-        final Task<T> task = DependentConfiguration.attributeWhenReady(entity, sensor);
-        return new Supplier<T>() {
-            @Override public T get() {
-                try {
-                    TypeToken<T> type = new TypeToken<T>(sensor.getType()) {};
-                    return Tasks.resolveValue(task, (Class<T>) type.getRawType(), ((EntityInternal) entity).getExecutionContext(), "attributeSupplierWhenReady");
-                } catch (Exception e) {
-                    throw Exceptions.propagate(e);
-                }
-            }
-        };
-    }
-
-    /**
-     * @since 0.6.0 Added only for backwards compatibility, where locations are being created directly.
-     * @deprecated in 0.6.0; use {@link LocationManager#createLocation(LocationSpec)} instead
-     */
-    @Deprecated
-    public static void manage(Location loc, ManagementContext managementContext) {
-        Locations.manage(loc, managementContext);
-    }
-
-    /** Fails-fast if value of the given key is null or unresolveable. */
-    public static String getRequiredUrlConfig(Entity entity, ConfigKey<String> urlKey) {
-        String url = entity.getConfig(urlKey);
-        Preconditions.checkNotNull(url, "Key %s on %s should not be null", urlKey, entity);
-        if (!ResourceUtils.create(entity).doesUrlExist(url)) {
-            throw new IllegalStateException(String.format("Key %s on %s contains unavailable URL %s", urlKey, entity, url));
-        }
-        return url;
-    }
-
-    /** @see #getRequiredUrlConfig(Entity, ConfigKey) */
-    public static String getRequiredUrlConfig(Entity entity, HasConfigKey<String> urlKey) {
-        return getRequiredUrlConfig(entity, urlKey.getConfigKey());
-    }
-
-    /** Fails-fast if value of the given URL is null or unresolveable. */
-    public static String checkRequiredUrl(Entity entity, String url) {
-        Preconditions.checkNotNull(url, "url");
-        if (!ResourceUtils.create(entity).doesUrlExist(url)) {
-            throw new IllegalStateException(String.format("URL %s on %s is unavailable", url, entity));
-        }
-        return url;
-    }
-
-    /**
-     * Submits a {@link TaskFactory} to construct its task at the entity (in a precursor task) and then to submit it.
-     * <p>
-     * Important if task construction relies on an entity being in scope (in tags, via {@link BrooklynTaskTags})
-     */
-    public static <T extends TaskAdaptable<?>> T submit(final Entity entity, final TaskFactory<T> taskFactory) {
-        // TODO it is messy to have to do this, but not sure there is a cleaner way :(
-        final Semaphore s = new Semaphore(0);
-        final AtomicReference<T> result = new AtomicReference<T>();
-        final ExecutionContext executionContext = ((EntityInternal)entity).getManagementSupport().getExecutionContext();
-        executionContext.execute(new Runnable() {
-            // TODO could give this task a name, like "create task from factory"
-            @Override
-            public void run() {
-                T t = taskFactory.newTask();
-                result.set(t);
-                s.release();
-            }
-        });
-        try {
-            s.acquire();
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
-        executionContext.submit(result.get().asTask());
-        return result.get();
-    }
-
-    /**
-     * Submits a task to run at the entity.
-     * 
-     * @return the task passed in, for fluency
-     */
-    public static <T extends TaskAdaptable<?>> T submit(final Entity entity, final T task) {
-        final ExecutionContext executionContext = ((EntityInternal)entity).getManagementSupport().getExecutionContext();
-        executionContext.submit(task.asTask());
-        return task;
-    }
-
-    /** Logs a warning if an entity has a value for a config key. */
-    public static void warnOnIgnoringConfig(Entity entity, ConfigKey<?> key) {
-        if (((EntityInternal)entity).config().getRaw(key).isPresentAndNonNull())
-            log.warn("Ignoring "+key+" set on "+entity+" ("+entity.getConfig(key)+")");
-    }
-
-    /** Waits until {@link Startable#SERVICE_UP} returns true. */
-    public static void waitForServiceUp(final Entity entity, Duration timeout) {
-        String description = "Waiting for SERVICE_UP on "+entity;
-        Tasks.setBlockingDetails(description);
-        try {
-            if (!Repeater.create(description).limitTimeTo(timeout)
-                    .rethrowException().backoffTo(Duration.ONE_SECOND)
-                    .until(new Callable<Boolean>() {
-                        public Boolean call() {
-                            return Boolean.TRUE.equals(entity.getAttribute(Startable.SERVICE_UP));
-                        }})
-                    .run()) {
-                throw new IllegalStateException("Timeout waiting for SERVICE_UP from "+entity);
-            }
-        } finally {
-            Tasks.resetBlockingDetails();
-        }
-        log.debug("Detected SERVICE_UP for software {}", entity);
-    }
-    public static void waitForServiceUp(final Entity entity, long duration, TimeUnit units) {
-        waitForServiceUp(entity, Duration.of(duration, units));
-    }
-    public static void waitForServiceUp(final Entity entity) {
-        Duration timeout = entity.getConfig(BrooklynConfigKeys.START_TIMEOUT);
-        waitForServiceUp(entity, timeout);
-    }
-
-    /**
-     * Convenience for creating and submitted a given shell command against the given mgmt context,
-     * primarily intended for use in the groovy GUI console.
-     */
-    @Beta
-    public static ProcessTaskWrapper<Integer> shell(ManagementContext mgmt, String command) {
-        ProcessTaskWrapper<Integer> t = SystemTasks.exec(command).newTask();
-        mgmt.getServerExecutionContext().submit(t).getUnchecked();
-        System.out.println(t.getStdout());
-        System.err.println(t.getStderr());
-        return t;
-    }
-
-    public static Entity catalogItemScopeRoot(Entity entity) {
-        Entity root = entity;
-        while (root.getParent() != null &&
-                root != root.getParent() &&
-                Objects.equal(root.getParent().getCatalogItemId(), root.getCatalogItemId())) {
-            root = root.getParent();
-        }
-        return root;
-    }
-
-    public static Set<Location> getAllInheritedLocations(Entity entity) {
-        Set<Location> result = MutableSet.of();
-        while (entity!=null) {
-            result.addAll(entity.getLocations());
-            entity = entity.getParent();
-        }
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAdjuncts.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAdjuncts.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAdjuncts.java
deleted file mode 100644
index fc1daf4..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAdjuncts.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.core.entity;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.objs.EntityAdjunct;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ComputeServiceIndicatorsFromChildrenAndMembers;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ComputeServiceState;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceNotUpLogic;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Convenience methods for working with entity adjunts.
- */
-public class EntityAdjuncts {
-
-    public static <T extends EntityAdjunct> Maybe<T> tryFindWithUniqueTag(Iterable<T> adjuncts, Object tag) {
-        Preconditions.checkNotNull(tag, "tag");
-        for (T adjunct: adjuncts)
-            if (tag.equals(adjunct.getUniqueTag())) 
-                return Maybe.of(adjunct);
-        return Maybe.absent("Not found with tag "+tag);
-    }
-    
-    public static final List<String> SYSTEM_ENRICHER_UNIQUE_TAGS = ImmutableList.of(
-        ServiceNotUpLogic.DEFAULT_ENRICHER_UNIQUE_TAG,
-        ComputeServiceState.DEFAULT_ENRICHER_UNIQUE_TAG,
-        ComputeServiceIndicatorsFromChildrenAndMembers.DEFAULT_UNIQUE_TAG,
-        ComputeServiceIndicatorsFromChildrenAndMembers.DEFAULT_UNIQUE_TAG_UP);
-    
-    public static List<Enricher> getNonSystemEnrichers(Entity entity) {
-        List<Enricher> result = MutableList.copyOf(entity.enrichers());
-        Iterator<Enricher> ri = result.iterator();
-        while (ri.hasNext()) {
-            if (isSystemEnricher(ri.next())) ri.remove();
-        }
-        return result;
-    }
-
-    public static boolean isSystemEnricher(Enricher enr) {
-        if (enr.getUniqueTag()==null) return false;
-        if (SYSTEM_ENRICHER_UNIQUE_TAGS.contains(enr.getUniqueTag())) return true;
-        return false;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAndAttribute.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAndAttribute.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAndAttribute.java
deleted file mode 100644
index 037722c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAndAttribute.java
+++ /dev/null
@@ -1,107 +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.core.entity;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Supplier;
-
-/**
- * A tuple containing an {@link Entity} and an {@link AttributeSensor}, which is assumed to be present on the entity.
- * <p>
- * Allows retrieval of the attribute {@link #getValue() value} or can be used instead where a {@link Supplier} for
- * the attribute value is required.
- */
-public class EntityAndAttribute<T> implements Supplier<T> {
-
-    private final Entity entity;
-    private final AttributeSensor<T> attribute;
-
-    public static <T> EntityAndAttribute<T> create(Entity entity, AttributeSensor<T> attribute) {
-        return new EntityAndAttribute<T>(entity, attribute);
-    }
-
-    /**
-     * @deprecated since 0.7.0; use {@link #create(Entity, AttributeSensor)}; this does not relate to {@link Supplier}
-     */
-    public static <T> EntityAndAttribute<T> supplier(Entity entity, AttributeSensor<T> attribute) {
-        return create(entity, attribute);
-    }
-
-    public EntityAndAttribute(Entity entity, AttributeSensor<T> attribute) {
-        this.entity = checkNotNull(entity, "entity");
-        this.attribute = checkNotNull(attribute, "attribute");
-    }
-
-    public Entity getEntity() {
-        return entity;
-    }
-
-    public AttributeSensor<T> getAttribute() {
-        return attribute;
-    }
-
-    public T getValue() {
-        return entity.getAttribute(attribute);
-    }
-
-    public void setValue(T val) {
-        ((EntityLocal)entity).sensors().set(attribute, val);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns the current value of the {@link #getAttribute() attribute} on the {@link #getEntity() entity}.
-     *
-     * @see #getValue()
-     */
-    @Override
-    public T get() {
-        return getValue();
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("entity", entity)
-                .add("attribute", attribute)
-                .toString();
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(entity, attribute);
-    }
-    
-    @Override
-    public boolean equals(Object o) {
-        if (o == null) return false;
-        if (!(o instanceof EntityAndAttribute)) return false;
-        EntityAndAttribute<?> that = (EntityAndAttribute<?>) o;
-        return Objects.equal(this.entity, that.entity) &&
-                Objects.equal(this.attribute, that.attribute);
-    }
-
-}


[11/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
deleted file mode 100644
index 60fb061..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationRegistry.java
+++ /dev/null
@@ -1,513 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.ServiceLoader;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.config.ConfigMap;
-import org.apache.brooklyn.core.config.ConfigPredicates;
-import org.apache.brooklyn.core.config.ConfigUtils;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.internal.LocalLocationManager;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.guava.Maybe.Absent;
-import org.apache.brooklyn.util.javalang.JavaClassNames;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-import org.apache.brooklyn.util.text.WildcardGlobs;
-import org.apache.brooklyn.util.text.WildcardGlobs.PhraseTreatment;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
-
-/**
- * See {@link LocationRegistry} for general description.
- * <p>
- * TODO The relationship between the catalog and the location registry is a bit messy.
- * For all existing code, the location registry is the definitive way to resolve
- * locations. 
- * <p>
- * Any location item added to the catalog must therefore be registered here.
- * Whenever an item is added to the catalog, it will automatically call 
- * {@link #updateDefinedLocation(RegisteredType)}. Similarly, when a location
- * is deleted from the catalog it will call {@link #removeDefinedLocation(RegisteredType)}.
- * <p>
- * However, the location item in the catalog has an unparsed blob of YAML, which contains
- * important things like the type and the config of the location. This is only parsed when 
- * {@link BrooklynCatalog#createSpec(CatalogItem)} is called. We therefore jump through 
- * some hoops to wire together the catalog and the registry.
- * <p>
- * To add a location to the catalog, and then to resolve a location that is in the catalog, 
- * it goes through the following steps:
- * 
- * <ol>
- *   <li>Call {@link BrooklynCatalog#addItems(String)}
- *     <ol>
- *       <li>This automatically calls {@link #updateDefinedLocation(RegisteredType)}
- *       <li>A LocationDefinition is creating, using as its id the {@link RegisteredType#getSymbolicName()}.
- *           The definition's spec is {@code brooklyn.catalog:<symbolicName>:<version>},
- *     </ol>
- *   <li>A blueprint can reference the catalog item using its symbolic name, 
- *       such as the YAML {@code location: my-new-location}.
- *       (this feels similar to the "named locations").
- *     <ol>
- *       <li>This automatically calls {@link #resolve(String)}.
- *       <li>The LocationDefinition is found by lookig up this name.
- *       <li>The {@link LocationDefiniton.getSpec()} is retrieved; the right {@link LocationResolver} is
- *           found for it.
- *       <li>This uses the {@link CatalogLocationResolver}, because the spec starts with {@code brooklyn.catalog:}.
- *       <li>This resolver extracts from the spec the <symobolicName>:<version>, and looks up the 
- *           location item using the {@link BrooklynTypeRegistry}.
- *       <li>It then creates a {@link LocationSpec} by calling {@link BrooklynTypeRegistry#createSpec(RegisteredType)}.
- *         <ol>
- *           <li>This first tries to use the type (that is in the YAML) as a simple Java class.
- *           <li>If that fails, it will resolve the type using {@link #resolve(String, Boolean, Map)}, which
- *               returns an actual location object.
- *           <li>It extracts from that location object the appropriate metadata to create a {@link LocationSpec},
- *               returns the spec and discards the location object.
- *         </ol>
- *       <li>The resolver creates the {@link Location} from the {@link LocationSpec}
- *     </ol>
- * </ol>
- * 
- * TODO There is no concept of a location version in this registry. The version
- * in the catalog is generally ignored.
- */
-@SuppressWarnings({"rawtypes","unchecked"})
-public class BasicLocationRegistry implements LocationRegistry {
-
-    // TODO save / serialize
-    // (we persist live locations, ie those in the LocationManager, but not "catalog" locations, ie those in this Registry)
-    
-    public static final Logger log = LoggerFactory.getLogger(BasicLocationRegistry.class);
-
-    /**
-     * Splits a comma-separated list of locations (names or specs) into an explicit list.
-     * The splitting is very careful to handle commas embedded within specs, to split correctly.
-     */
-    public static List<String> expandCommaSeparateLocations(String locations) {
-        return WildcardGlobs.getGlobsAfterBraceExpansion("{"+locations+"}", false, PhraseTreatment.INTERIOR_NOT_EXPANDABLE, PhraseTreatment.INTERIOR_NOT_EXPANDABLE);
-        // don't do this, it tries to expand commas inside parentheses which is not good!
-//        QuotedStringTokenizer.builder().addDelimiterChars(",").buildList((String)id);
-    }
-
-    private final ManagementContext mgmt;
-    /** map of defined locations by their ID */
-    private final Map<String,LocationDefinition> definedLocations = new LinkedHashMap<String, LocationDefinition>();
-
-    protected final Map<String,LocationResolver> resolvers = new LinkedHashMap<String, LocationResolver>();
-
-    private final Set<String> specsWarnedOnException = Sets.newConcurrentHashSet();
-
-    public BasicLocationRegistry(ManagementContext mgmt) {
-        this.mgmt = checkNotNull(mgmt, "mgmt");
-        findServices();
-        updateDefinedLocations();
-    }
-
-    protected void findServices() {
-        ServiceLoader<LocationResolver> loader = ServiceLoader.load(LocationResolver.class, mgmt.getCatalogClassLoader());
-        MutableList<LocationResolver> loadedResolvers;
-        try {
-            loadedResolvers = MutableList.copyOf(loader);
-        } catch (Throwable e) {
-            log.warn("Error loading resolvers (rethrowing): "+e);
-            throw Exceptions.propagate(e);
-        }
-        
-        for (LocationResolver r: loadedResolvers) {
-            registerResolver(r);
-        }
-        if (log.isDebugEnabled()) log.debug("Location resolvers are: "+resolvers);
-        if (resolvers.isEmpty()) log.warn("No location resolvers detected: is src/main/resources correctly included?");
-    }
-
-    /** Registers the given resolver, invoking {@link LocationResolver#init(ManagementContext)} on the argument
-     * and returning true, unless the argument indicates false for {@link LocationResolver.EnableableLocationResolver#isEnabled()} */
-    public boolean registerResolver(LocationResolver r) {
-        r.init(mgmt);
-        if (r instanceof LocationResolver.EnableableLocationResolver) {
-            if (!((LocationResolver.EnableableLocationResolver)r).isEnabled()) {
-                return false;
-            }
-        }
-        resolvers.put(r.getPrefix(), r);
-        return true;
-    }
-    
-    @Override
-    public Map<String,LocationDefinition> getDefinedLocations() {
-        synchronized (definedLocations) {
-            return ImmutableMap.<String,LocationDefinition>copyOf(definedLocations);
-        }
-    }
-    
-    @Override
-    public LocationDefinition getDefinedLocationById(String id) {
-        return definedLocations.get(id);
-    }
-
-    @Override
-    public LocationDefinition getDefinedLocationByName(String name) {
-        synchronized (definedLocations) {
-            for (LocationDefinition l: definedLocations.values()) {
-                if (l.getName().equals(name)) return l;
-            }
-            return null;
-        }
-    }
-
-    @Override
-    public void updateDefinedLocation(LocationDefinition l) {
-        synchronized (definedLocations) { 
-            definedLocations.put(l.getId(), l); 
-        }
-    }
-
-    /**
-     * Converts the given item from the catalog into a LocationDefinition, and adds it
-     * to the registry (overwriting anything already registered with the id
-     * {@link CatalogItem#getCatalogItemId()}.
-     */
-    public void updateDefinedLocation(CatalogItem<Location, LocationSpec<?>> item) {
-        String id = item.getCatalogItemId();
-        String symbolicName = item.getSymbolicName();
-        String spec = CatalogLocationResolver.NAME + ":" + id;
-        Map<String, Object> config = ImmutableMap.<String, Object>of();
-        BasicLocationDefinition locDefinition = new BasicLocationDefinition(symbolicName, symbolicName, spec, config);
-        
-        updateDefinedLocation(locDefinition);
-    }
-
-    /**
-     * Converts the given item from the catalog into a LocationDefinition, and adds it
-     * to the registry (overwriting anything already registered with the id
-     * {@link RegisteredType#getId()}.
-     */
-    public void updateDefinedLocation(RegisteredType item) {
-        String id = item.getId();
-        String symbolicName = item.getSymbolicName();
-        String spec = CatalogLocationResolver.NAME + ":" + id;
-        Map<String, Object> config = ImmutableMap.<String, Object>of();
-        BasicLocationDefinition locDefinition = new BasicLocationDefinition(symbolicName, symbolicName, spec, config);
-        
-        updateDefinedLocation(locDefinition);
-    }
-
-    public void removeDefinedLocation(CatalogItem<Location, LocationSpec<?>> item) {
-        removeDefinedLocation(item.getSymbolicName());
-    }
-    
-    @Override
-    public void removeDefinedLocation(String id) {
-        LocationDefinition removed;
-        synchronized (definedLocations) { 
-            removed = definedLocations.remove(id);
-        }
-        if (removed == null && log.isDebugEnabled()) {
-            log.debug("{} was asked to remove location with id {} but no such location was registered", this, id);
-        }
-    }
-    
-    public void updateDefinedLocations() {
-        synchronized (definedLocations) {
-            // first read all properties starting  brooklyn.location.named.xxx
-            // (would be nice to move to a better way, e.g. yaml, then deprecate this approach, but first
-            // we need ability/format for persisting named locations, and better support for adding+saving via REST/GUI)
-            int count = 0; 
-            String NAMED_LOCATION_PREFIX = "brooklyn.location.named.";
-            ConfigMap namedLocationProps = mgmt.getConfig().submap(ConfigPredicates.nameStartsWith(NAMED_LOCATION_PREFIX));
-            for (String k: namedLocationProps.asMapWithStringKeys().keySet()) {
-                String name = k.substring(NAMED_LOCATION_PREFIX.length());
-                // If has a dot, then is a sub-property of a named location (e.g. brooklyn.location.named.prod1.user=bob)
-                if (!name.contains(".")) {
-                    // this is a new named location
-                    String spec = (String) namedLocationProps.asMapWithStringKeys().get(k);
-                    // make up an ID
-                    String id = Identifiers.makeRandomId(8);
-                    Map<String, Object> config = ConfigUtils.filterForPrefixAndStrip(namedLocationProps.asMapWithStringKeys(), k+".");
-                    definedLocations.put(id, new BasicLocationDefinition(id, name, spec, config));
-                    count++;
-                }
-            }
-            if (log.isDebugEnabled())
-                log.debug("Found "+count+" defined locations from properties (*.named.* syntax): "+definedLocations.values());
-            if (getDefinedLocationByName("localhost")==null && !BasicOsDetails.Factory.newLocalhostInstance().isWindows()
-                    && LocationConfigUtils.isEnabled(mgmt, "brooklyn.location.localhost")) {
-                log.debug("Adding a defined location for localhost");
-                // add 'localhost' *first*
-                ImmutableMap<String, LocationDefinition> oldDefined = ImmutableMap.copyOf(definedLocations);
-                definedLocations.clear();
-                String id = Identifiers.makeRandomId(8);
-                definedLocations.put(id, localhost(id));
-                definedLocations.putAll(oldDefined);
-            }
-            
-            for (RegisteredType item: mgmt.getTypeRegistry().getMatching(RegisteredTypePredicates.IS_LOCATION)) {
-                updateDefinedLocation(item);
-                count++;
-            }
-        }
-    }
-    
-    @VisibleForTesting
-    void disablePersistence() {
-        // persistence isn't enabled yet anyway (have to manually save things,
-        // defining the format and file etc)
-    }
-
-    protected static BasicLocationDefinition localhost(String id) {
-        return new BasicLocationDefinition(id, "localhost", "localhost", null);
-    }
-    
-    /** to catch circular references */
-    protected ThreadLocal<Set<String>> specsSeen = new ThreadLocal<Set<String>>();
-    
-    @Override @Deprecated
-    public boolean canMaybeResolve(String spec) {
-        return getSpecResolver(spec) != null;
-    }
-
-    @Override
-    public final Location resolve(String spec) {
-        return resolve(spec, true, null).get();
-    }
-    
-    @Override @Deprecated
-    public final Location resolveIfPossible(String spec) {
-        if (!canMaybeResolve(spec)) return null;
-        return resolve(spec, null, null).orNull();
-    }
-    
-    @Deprecated /** since 0.7.0 not used */
-    public final Maybe<Location> resolve(String spec, boolean manage) {
-        return resolve(spec, manage, null);
-    }
-    
-    public Maybe<Location> resolve(String spec, Boolean manage, Map locationFlags) {
-        try {
-            locationFlags = MutableMap.copyOf(locationFlags);
-            if (manage!=null) {
-                locationFlags.put(LocalLocationManager.CREATE_UNMANAGED, !manage);
-            }
-            
-            Set<String> seenSoFar = specsSeen.get();
-            if (seenSoFar==null) {
-                seenSoFar = new LinkedHashSet<String>();
-                specsSeen.set(seenSoFar);
-            }
-            if (seenSoFar.contains(spec))
-                return Maybe.absent(Suppliers.ofInstance(new IllegalStateException("Circular reference in definition of location '"+spec+"' ("+seenSoFar+")")));
-            seenSoFar.add(spec);
-            
-            LocationResolver resolver = getSpecResolver(spec);
-
-            if (resolver != null) {
-                try {
-                    return Maybe.of(resolver.newLocationFromString(locationFlags, spec, this));
-                } catch (RuntimeException e) {
-                     return Maybe.absent(Suppliers.ofInstance(e));
-                }
-            }
-
-            // problem: but let's ensure that classpath is sane to give better errors in common IDE bogus case;
-            // and avoid repeated logging
-            String errmsg;
-            if (spec == null || specsWarnedOnException.add(spec)) {
-                if (resolvers.get("id")==null || resolvers.get("named")==null) {
-                    log.error("Standard location resolvers not installed, location resolution will fail shortly. "
-                            + "This usually indicates a classpath problem, such as when running from an IDE which "
-                            + "has not properly copied META-INF/services from src/main/resources. "
-                            + "Known resolvers are: "+resolvers.keySet());
-                    errmsg = "Unresolvable location '"+spec+"': "
-                            + "Problem detected with location resolver configuration; "
-                            + resolvers.keySet()+" are the only available location resolvers. "
-                            + "More information can be found in the logs.";
-                } else {
-                    log.debug("Location resolution failed for '"+spec+"' (if this is being loaded it will fail shortly): known resolvers are: "+resolvers.keySet());
-                    errmsg = "Unknown location '"+spec+"': "
-                            + "either this location is not recognised or there is a problem with location resolver configuration.";
-                }
-            } else {
-                // For helpful log message construction: assumes classpath will not suddenly become wrong; might happen with OSGi though!
-                if (log.isDebugEnabled()) log.debug("Location resolution failed again for '"+spec+"' (throwing)");
-                errmsg = "Unknown location '"+spec+"': "
-                        + "either this location is not recognised or there is a problem with location resolver configuration.";
-            }
-
-            return Maybe.absent(Suppliers.ofInstance(new NoSuchElementException(errmsg)));
-
-        } finally {
-            specsSeen.remove();
-        }
-    }
-
-    @Override
-    public final Location resolve(String spec, Map locationFlags) {
-        return resolve(spec, null, locationFlags).get();
-    }
-
-    protected LocationResolver getSpecResolver(String spec) {
-        int colonIndex = spec.indexOf(':');
-        int bracketIndex = spec.indexOf("(");
-        int dividerIndex = (colonIndex < 0) ? bracketIndex : (bracketIndex < 0 ? colonIndex : Math.min(bracketIndex, colonIndex));
-        String prefix = dividerIndex >= 0 ? spec.substring(0, dividerIndex) : spec;
-        LocationResolver resolver = resolvers.get(prefix);
-       
-        if (resolver == null)
-            resolver = getSpecDefaultResolver(spec);
-        
-        return resolver;
-    }
-    
-    protected LocationResolver getSpecDefaultResolver(String spec) {
-        return getSpecFirstResolver(spec, "id", "named", "jclouds");
-    }
-    protected LocationResolver getSpecFirstResolver(String spec, String ...resolversToCheck) {
-        for (String resolverId: resolversToCheck) {
-            LocationResolver resolver = resolvers.get(resolverId);
-            if (resolver!=null && resolver.accepts(spec, this))
-                return resolver;
-        }
-        return null;
-    }
-
-    /** providers default impl for {@link LocationResolver#accepts(String, LocationRegistry)} */
-    public static boolean isResolverPrefixForSpec(LocationResolver resolver, String spec, boolean argumentRequired) {
-        if (spec==null) return false;
-        if (spec.startsWith(resolver.getPrefix()+":")) return true;
-        if (!argumentRequired && spec.equals(resolver.getPrefix())) return true;
-        return false;
-    }
-
-    @Override
-    public List<Location> resolve(Iterable<?> spec) {
-        List<Location> result = new ArrayList<Location>();
-        for (Object id : spec) {
-            if (id==null) {
-                // drop a null entry
-            } if (id instanceof String) {
-                result.add(resolve((String) id));
-            } else if (id instanceof Location) {
-                result.add((Location) id);
-            } else {
-                if (id instanceof Iterable)
-                    throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; collections of collections not allowed"); 
-                throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; unsupported type "+
-                        (id == null ? "null" : id.getClass().getName())); 
-            }
-        }
-        return result;
-    }
-    
-    public List<Location> resolveList(Object l) {
-        if (l==null) l = Collections.emptyList();
-        if (l instanceof String) l = JavaStringEscapes.unwrapJsonishListIfPossible((String)l);
-        if (l instanceof Iterable) return resolve((Iterable<?>)l);
-        throw new IllegalArgumentException("Location list must be supplied as a collection or a string, not "+
-            JavaClassNames.simpleClassName(l)+"/"+l);
-    }
-    
-    @Override
-    public Location resolve(LocationDefinition ld) {
-        return resolve(ld, null, null).get();
-    }
-
-    @Override @Deprecated
-    public Location resolveForPeeking(LocationDefinition ld) {
-        // TODO should clean up how locations are stored, figuring out whether they are shared or not;
-        // or maybe better, the API calls to this might just want to get the LocationSpec objects back
-        
-        // for now we use a 'CREATE_UNMANGED' flag to prevent management (leaks and logging)
-        return resolve(ld, ConfigBag.newInstance().configure(LocalLocationManager.CREATE_UNMANAGED, true).getAllConfig());
-    }
-
-    @Override @Deprecated
-    public Location resolve(LocationDefinition ld, Map<?,?> flags) {
-        return resolveLocationDefinition(ld, flags, null);
-    }
-    
-    /** @deprecated since 0.7.0 not used (and optionalName was ignored anyway) */
-    @Deprecated
-    public Location resolveLocationDefinition(LocationDefinition ld, Map locationFlags, String optionalName) {
-        return resolve(ld, null, locationFlags).get();
-    }
-    
-    public Maybe<Location> resolve(LocationDefinition ld, Boolean manage, Map locationFlags) {
-        ConfigBag newLocationFlags = ConfigBag.newInstance(ld.getConfig())
-            .putAll(locationFlags)
-            .putIfAbsentAndNotNull(LocationInternal.NAMED_SPEC_NAME, ld.getName())
-            .putIfAbsentAndNotNull(LocationInternal.ORIGINAL_SPEC, ld.getName());
-        Maybe<Location> result = resolve(ld.getSpec(), manage, newLocationFlags.getAllConfigRaw());
-        if (result.isPresent()) 
-            return result;
-        throw new IllegalStateException("Cannot instantiate location '"+ld+"' pointing at "+ld.getSpec()+": "+
-            Exceptions.collapseText( ((Absent<?>)result).getException() ));
-    }
-
-    @Override
-    public Map getProperties() {
-        return mgmt.getConfig().asMapWithStringKeys();
-    }
-
-    @VisibleForTesting
-    public void putProperties(Map<String, ?> vals) {
-        ((ManagementContextInternal)mgmt).getBrooklynProperties().putAll(vals);
-    }
-
-    @VisibleForTesting
-    public static void setupLocationRegistryForTesting(ManagementContext mgmt) {
-        // ensure localhost is added (even on windows)
-        LocationDefinition l = mgmt.getLocationRegistry().getDefinedLocationByName("localhost");
-        if (l==null) mgmt.getLocationRegistry().updateDefinedLocation(
-                BasicLocationRegistry.localhost(Identifiers.makeRandomId(8)) );
-        
-        ((BasicLocationRegistry)mgmt.getLocationRegistry()).disablePersistence();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineDetails.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineDetails.java
deleted file mode 100644
index b0a9bcd..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineDetails.java
+++ /dev/null
@@ -1,183 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.Immutable;
-
-import org.apache.brooklyn.api.location.HardwareDetails;
-import org.apache.brooklyn.api.location.MachineDetails;
-import org.apache.brooklyn.api.location.OsDetails;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.core.task.ssh.internal.PlainSshExecTaskFactory;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
-import com.google.common.base.Splitter;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-import com.google.common.io.CharStreams;
-
-@Immutable
-public class BasicMachineDetails implements MachineDetails {
-
-    public static final Logger LOG = LoggerFactory.getLogger(BasicMachineDetails.class);
-
-    private final HardwareDetails hardwareDetails;
-    private final OsDetails osDetails;
-
-    public BasicMachineDetails(HardwareDetails hardwareDetails, OsDetails osDetails) {
-        this.hardwareDetails = checkNotNull(hardwareDetails, "hardwareDetails");
-        this.osDetails = checkNotNull(osDetails, "osDetails");
-    }
-
-    @Nonnull
-    @Override
-    public HardwareDetails getHardwareDetails() {
-        return hardwareDetails;
-    }
-
-    @Nonnull
-    @Override
-    public OsDetails getOsDetails() {
-        return osDetails;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(MachineDetails.class)
-                .add("os", osDetails)
-                .add("hardware", hardwareDetails)
-                .toString();
-    }
-
-    /**
-     * Creates a MachineDetails for the given location by SSHing to the machine and
-     * running a Bash script to gather data. Should only be called from within a
-     * task context. If this might not be the case then use {@link
-     * #taskForSshMachineLocation(SshMachineLocation)} instead.
-     */
-    @Beta
-    public static BasicMachineDetails forSshMachineLocationLive(SshMachineLocation location) {
-        return TaskTags.markInessential(DynamicTasks.queueIfPossible(taskForSshMachineLocation(location))
-                .orSubmitAsync()
-                .asTask())
-                .getUnchecked();
-    }
-
-    /**
-     * @return A task that gathers machine details by SSHing to the machine and running
-     *         a Bash script to gather data.
-     */
-    public static Task<BasicMachineDetails> taskForSshMachineLocation(SshMachineLocation location) {
-        BufferedReader reader = new BufferedReader(Streams.reader(
-                new ResourceUtils(BasicMachineDetails.class).getResourceFromUrl(
-                        "classpath://org/apache/brooklyn/location/basic/os-details.sh")));
-        List<String> script;
-        try {
-            script = CharStreams.readLines(reader);
-        } catch (IOException e) {
-            LOG.error("Error reading os-details script", e);
-            throw Throwables.propagate(e);
-        } finally {
-            try {
-                reader.close();
-            } catch (IOException e) {
-                // Not rethrowing e because it might obscure an exception caught by the first catch
-                LOG.error("Error closing os-details script reader", e);
-            }
-        }
-        Task<BasicMachineDetails> task = new PlainSshExecTaskFactory<String>(location, script)
-                .summary("Getting machine details for: " + location)
-                .requiringZeroAndReturningStdout()
-                .returning(taskToMachineDetailsFunction(location))
-                .newTask()
-                .asTask();
-
-        return task;
-    }
-
-    private static Function<ProcessTaskWrapper<?>, BasicMachineDetails> taskToMachineDetailsFunction(final SshMachineLocation location) {
-        return new Function<ProcessTaskWrapper<?>, BasicMachineDetails>() {
-            @Override
-            public BasicMachineDetails apply(ProcessTaskWrapper<?> input) {
-                if (input.getExitCode() != 0) {
-                    LOG.warn("Non-zero exit code when fetching machine details for {}; guessing anonymous linux", location);
-                    return new BasicMachineDetails(new BasicHardwareDetails(null, null),
-                            BasicOsDetails.Factory.ANONYMOUS_LINUX);
-                }
-
-                String stdout = input.getStdout();
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Found following details at {}: {}", location, stdout);
-                }
-
-                Map<String,String> details = Maps.newHashMap(Splitter.on(CharMatcher.anyOf("\r\n"))
-                        .omitEmptyStrings()
-                        .withKeyValueSeparator(":")
-                        .split(stdout));
-
-                String name = details.remove("name");
-                String version = details.remove("version");
-                String architecture = details.remove("architecture");
-                Integer ram = intOrNull(details, "ram");
-                Integer cpuCount = intOrNull(details, "cpus");
-                if (!details.isEmpty()) {
-                    LOG.debug("Unused keys from os-details script: " + Joiner.on(", ").join(details.keySet()));
-                }
-
-                OsDetails osDetails = new BasicOsDetails(name, architecture, version);
-                HardwareDetails hardwareDetails = new BasicHardwareDetails(cpuCount, ram);
-                BasicMachineDetails machineDetails = new BasicMachineDetails(hardwareDetails, osDetails);
-
-                if (LOG.isDebugEnabled())
-                    LOG.debug("Machine details for {}: {}", location, machineDetails);
-
-                return machineDetails;
-            }
-
-            private Integer intOrNull(Map<String, String> details, String key) {
-                try {
-                    return Integer.valueOf(details.remove(key));
-                } catch (NumberFormatException e) {
-                    return null;
-                }
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineMetadata.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineMetadata.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineMetadata.java
deleted file mode 100644
index 2590900..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicMachineMetadata.java
+++ /dev/null
@@ -1,84 +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.core.location;
-
-import com.google.common.base.Objects;
-
-import org.apache.brooklyn.api.location.MachineManagementMixins;
-
-public class BasicMachineMetadata implements MachineManagementMixins.MachineMetadata {
-
-    final String id, name, primaryIp;
-    final Boolean isRunning;
-    final Object originalMetadata;
-    
-    public BasicMachineMetadata(String id, String name, String primaryIp, Boolean isRunning, Object originalMetadata) {
-        super();
-        this.id = id;
-        this.name = name;
-        this.primaryIp = primaryIp;
-        this.isRunning = isRunning;
-        this.originalMetadata = originalMetadata;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getPrimaryIp() {
-        return primaryIp;
-    }
-
-    public Boolean isRunning() {
-        return isRunning;
-    }
-
-    public Object getOriginalMetadata() {
-        return originalMetadata;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(id, isRunning, name, originalMetadata, primaryIp);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
-        BasicMachineMetadata other = (BasicMachineMetadata) obj;
-        if (!Objects.equal(id, other.id)) return false;
-        if (!Objects.equal(name, other.name)) return false;
-        if (!Objects.equal(primaryIp, other.primaryIp)) return false;
-        if (!Objects.equal(isRunning, other.isRunning)) return false;
-        if (!Objects.equal(originalMetadata, other.originalMetadata)) return false;
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("id", id).add("name", name).add("originalMetadata", originalMetadata).toString();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicOsDetails.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicOsDetails.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicOsDetails.java
deleted file mode 100644
index 8060562..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/BasicOsDetails.java
+++ /dev/null
@@ -1,123 +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.core.location;
-
-import java.util.regex.Pattern;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import com.google.common.base.Objects;
-
-import org.apache.brooklyn.api.location.OsDetails;
-
-@Immutable
-public class BasicOsDetails implements OsDetails {
-
-    final String name, arch, version;
-    final boolean is64bit;
-    // (?i) forces matches to be case insensitive
-    public static final String UNIX_OS_NAME_PATTERNS = "(?i).*linux.*|centos|debian|fedora|gentoo|rhel|slackware|solaris|suse|ubuntu|coreos";
-
-    /** Sets is64Bit according to value of arch parameter. */
-    public BasicOsDetails(String name, String arch, String version) {
-       this(name, arch, version, arch != null && arch.contains("64"));
-    }
-
-    public BasicOsDetails(String name, String arch, String version, boolean is64Bit) {
-        this.name = name; this.arch = arch; this.version = version; this.is64bit = is64Bit;
-    }
-    
-    // TODO: Should be replaced with an enum like Jclouds' OsFamily and isX methods should
-    // switch against known cases
-    @Nullable
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Nullable
-    @Override
-    public String getArch() {
-        return arch;
-    }
-
-    @Nullable
-    @Override
-    public String getVersion() {
-        return version;
-    }
-
-    @Override
-    public boolean isWindows() {
-        //TODO confirm
-        return getName()!=null && getName().toLowerCase().contains("microsoft");
-    }
-
-    @Override
-    public boolean isLinux() {
-        return getName() != null && Pattern.matches(UNIX_OS_NAME_PATTERNS, getName());
-    }
-
-    @Override
-    public boolean isMac() {
-        return getName()!=null && getName().equals(OsNames.MAC_OS_X);
-    }
-
-    @Override
-    public boolean is64bit() {
-        return is64bit;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(OsDetails.class)
-                .omitNullValues()
-                .add("name", name)
-                .add("version", version)
-                .add("arch", arch)
-                .toString();
-    }
-
-    public static class OsNames {
-        public static final String MAC_OS_X = "Mac OS X";
-    }
-    
-    public static class OsArchs {
-        public static final String X_86_64 = "x86_64";
-//        public static final String X_86 = "x86";
-//        // is this standard?  or do we ever need the above?
-        public static final String I386 = "i386";
-    }
-
-    public static class OsVersions {
-        public static final String MAC_10_8 = "10.8";
-        public static final String MAC_10_9 = "10.9";
-    }
-    
-    public static class Factory {
-        public static OsDetails newLocalhostInstance() {
-            return new BasicOsDetails(System.getProperty("os.name"), System.getProperty("os.arch"), System.getProperty("os.version"));
-        }
-        
-        public static final OsDetails ANONYMOUS_LINUX = new BasicOsDetails("linux", OsArchs.I386, "unknown");
-        public static final OsDetails ANONYMOUS_LINUX_64 = new BasicOsDetails("linux", OsArchs.X_86_64, "unknown");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/CatalogLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/CatalogLocationResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/CatalogLocationResolver.java
deleted file mode 100644
index 194e946..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/CatalogLocationResolver.java
+++ /dev/null
@@ -1,83 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Given a location spec in the form {@code brooklyn.catalog:<symbolicName>:<version>}, 
- * looks up the catalog to get its definition and creates such a location.
- */
-public class CatalogLocationResolver implements LocationResolver {
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogLocationResolver.class);
-
-    public static final String NAME = "brooklyn.catalog";
-
-    private ManagementContext managementContext;
-
-    @Override
-    public void init(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-    }
-    
-    @Override
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
-        String id = spec.substring(NAME.length()+1);
-        RegisteredType item = managementContext.getTypeRegistry().get(id);
-        if (item.isDisabled()) {
-            throw new IllegalStateException("Illegal use of disabled catalog item "+item.getSymbolicName()+":"+item.getVersion());
-        } else if (item.isDeprecated()) {
-            log.warn("Use of deprecated catalog item "+item.getSymbolicName()+":"+item.getVersion());
-        }
-        
-        LocationSpec<?> origLocSpec = (LocationSpec) managementContext.getTypeRegistry().createSpec(item, null, LocationSpec.class);
-        LocationSpec locSpec = LocationSpec.create(origLocSpec)
-                .configure(locationFlags);
-        return managementContext.getLocationManager().createLocation(locSpec);
-    }
-
-    @Override
-    public String getPrefix() {
-        return NAME;
-    }
-    
-    /**
-     * accepts anything that looks like it will be a YAML catalog item (e.g. starting "brooklyn.locations")
-     */
-    @Override
-    public boolean accepts(String spec, LocationRegistry registry) {
-        if (BasicLocationRegistry.isResolverPrefixForSpec(this, spec, false)) return true;
-        if (registry.getDefinedLocationByName(spec)!=null) return true;
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DefinedLocationByIdResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DefinedLocationByIdResolver.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DefinedLocationByIdResolver.java
deleted file mode 100644
index 0438d1d..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DefinedLocationByIdResolver.java
+++ /dev/null
@@ -1,74 +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.core.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.location.LocationRegistry;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * looks up based on ID in DefinedLocations map
- */
-public class DefinedLocationByIdResolver implements LocationResolver {
-
-    public static final Logger log = LoggerFactory.getLogger(DefinedLocationByIdResolver.class);
-
-    public static final String ID = "id";
-    
-    private volatile ManagementContext managementContext;
-
-    @Override
-    public void init(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-    }
-    
-    @SuppressWarnings({ "rawtypes" })
-    @Override
-    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
-        String id = spec;
-        if (spec.toLowerCase().startsWith(ID+":")) {
-            id = spec.substring( (ID+":").length() );
-        }
-        LocationDefinition ld = registry.getDefinedLocationById(id);
-        ld.getSpec();
-        return ((BasicLocationRegistry)registry).resolveLocationDefinition(ld, locationFlags, null);
-    }
-
-    @Override
-    public String getPrefix() {
-        return ID;
-    }
-    
-    /** accepts anything starting  id:xxx  or just   xxx where xxx is a defined location ID */
-    @Override
-    public boolean accepts(String spec, LocationRegistry registry) {
-        if (BasicLocationRegistry.isResolverPrefixForSpec(this, spec, false)) return true;
-        if (registry.getDefinedLocationById(spec)!=null) return true;
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DeprecatedKeysMappingBuilder.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DeprecatedKeysMappingBuilder.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DeprecatedKeysMappingBuilder.java
deleted file mode 100644
index d5cb3c6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/DeprecatedKeysMappingBuilder.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 org.apache.brooklyn.core.location;
-
-import java.util.Map;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.slf4j.Logger;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableMap;
-
-/**
-* @deprecated since 0.6; for use only in converting deprecated flags; will be deleted in future version.
-*/
-public class DeprecatedKeysMappingBuilder {
-    private final ImmutableMap.Builder<String,String> builder = new ImmutableMap.Builder<String,String>();
-    private final Logger logger;
-    
-    public DeprecatedKeysMappingBuilder(Logger logger) {
-        this.logger = logger;
-    }
-
-    public DeprecatedKeysMappingBuilder camelToHyphen(ConfigKey<?> key) {
-        return camelToHyphen(key.getName());
-    }
-    
-    public DeprecatedKeysMappingBuilder camelToHyphen(String key) {
-        String hyphen = toHyphen(key);
-        if (key.equals(hyphen)) {
-            logger.warn("Invalid attempt to convert camel-case key {} to deprecated hyphen-case: both the same", hyphen);
-        } else {
-            builder.put(hyphen, key);
-        }
-        return this;
-    }
-    
-    public DeprecatedKeysMappingBuilder putAll(Map<String,String> vals) {
-        builder.putAll(vals);
-        return this;
-    }
-
-    public Map<String,String> build() {
-        return builder.build();
-    }
-    
-    private String toHyphen(String word) {
-        return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, word);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/HasSubnetHostname.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/HasSubnetHostname.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/HasSubnetHostname.java
deleted file mode 100644
index 8f2cc4f..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/HasSubnetHostname.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 org.apache.brooklyn.core.location;
-
-import com.google.common.annotations.Beta;
-
-@Beta
-public interface HasSubnetHostname {
-
-    /** returns a hostname for use internally within a subnet / VPC */
-    @Beta
-    String getSubnetHostname();
-
-    /** returns an IP for use internally within a subnet / VPC */
-    String getSubnetIp();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigKeys.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigKeys.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigKeys.java
deleted file mode 100644
index e8e8db6..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigKeys.java
+++ /dev/null
@@ -1,79 +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.core.location;
-
-import java.io.File;
-import java.util.Set;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.util.os.Os;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.reflect.TypeToken;
-
-public class LocationConfigKeys {
-
-    public static final ConfigKey<String> LOCATION_ID = ConfigKeys.newStringConfigKey("id");
-    public static final ConfigKey<String> DISPLAY_NAME = ConfigKeys.newStringConfigKey("displayName");
-    public static final ConfigKey<Boolean> ENABLED = ConfigKeys.newBooleanConfigKey("enabled", "Whether the location is enabled for listing and use "
-        + "(only supported for selected locations)", true);
-    
-    public static final ConfigKey<String> ACCESS_IDENTITY = ConfigKeys.newStringConfigKey("identity"); 
-    public static final ConfigKey<String> ACCESS_CREDENTIAL = ConfigKeys.newStringConfigKey("credential"); 
-
-    public static final ConfigKey<Double> LATITUDE = new BasicConfigKey<Double>(Double.class, "latitude"); 
-    public static final ConfigKey<Double> LONGITUDE = new BasicConfigKey<Double>(Double.class, "longitude"); 
-
-    public static final ConfigKey<String> CLOUD_PROVIDER = ConfigKeys.newStringConfigKey("provider");
-    public static final ConfigKey<String> CLOUD_ENDPOINT = ConfigKeys.newStringConfigKey("endpoint");
-    public static final ConfigKey<String> CLOUD_REGION_ID = ConfigKeys.newStringConfigKey("region");
-    public static final ConfigKey<String> CLOUD_AVAILABILITY_ZONE_ID = ConfigKeys.newStringConfigKey("availabilityZone");
-
-    @SuppressWarnings("serial")
-    public static final ConfigKey<Set<String>> ISO_3166 = ConfigKeys.newConfigKey(new TypeToken<Set<String>>() {}, "iso3166", "ISO-3166 or ISO-3166-2 location codes"); 
-
-    public static final ConfigKey<String> USER = ConfigKeys.newStringConfigKey("user", 
-            "user account for normal access to the remote machine, defaulting to local user", System.getProperty("user.name"));
-    
-    public static final ConfigKey<String> PASSWORD = ConfigKeys.newStringConfigKey("password", "password to use for ssh; note some images do not allow password-based ssh access");
-    public static final ConfigKey<String> PUBLIC_KEY_FILE = ConfigKeys.newStringConfigKey("publicKeyFile", "ssh public key file to use; if blank will infer from privateKeyFile by appending \".pub\"");
-    public static final ConfigKey<String> PUBLIC_KEY_DATA = ConfigKeys.newStringConfigKey("publicKeyData", "ssh public key string to use (takes precedence over publicKeyFile)");
-    public static final ConfigKey<String> PRIVATE_KEY_FILE = ConfigKeys.newStringConfigKey("privateKeyFile", "a '" + File.pathSeparator + "' separated list of ssh private key files; uses first in list that can be read",
-                                                                                           Os.fromHome(".ssh/id_rsa") + File.pathSeparator + Os.fromHome(".ssh/id_dsa"));
-    public static final ConfigKey<String> PRIVATE_KEY_DATA = ConfigKeys.newStringConfigKey("privateKeyData", "ssh private key string to use (takes precedence over privateKeyFile)");
-    public static final ConfigKey<String> PRIVATE_KEY_PASSPHRASE = ConfigKeys.newStringConfigKey("privateKeyPassphrase");
-
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PUBLIC_KEY_FILE = ConfigKeys.convert(PUBLIC_KEY_FILE, CaseFormat.LOWER_CAMEL, CaseFormat.LOWER_HYPHEN);
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PUBLIC_KEY_DATA = ConfigKeys.convert(PUBLIC_KEY_DATA, CaseFormat.LOWER_CAMEL, CaseFormat.LOWER_HYPHEN);
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_FILE = ConfigKeys.convert(PRIVATE_KEY_FILE, CaseFormat.LOWER_CAMEL, CaseFormat.LOWER_HYPHEN);
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_DATA = ConfigKeys.convert(PRIVATE_KEY_DATA, CaseFormat.LOWER_CAMEL, CaseFormat.LOWER_HYPHEN);
-    /** @deprecated since 0.6.0; included here so it gets picked up in auto-detect routines */ @Deprecated
-    public static final ConfigKey<String> LEGACY_PRIVATE_KEY_PASSPHRASE = ConfigKeys.convert(PRIVATE_KEY_PASSPHRASE, CaseFormat.LOWER_CAMEL, CaseFormat.LOWER_HYPHEN);
-
-    public static final ConfigKey<Object> CALLER_CONTEXT = new BasicConfigKey<Object>(Object.class, "callerContext",
-            "An object whose toString is used for logging, to indicate wherefore a VM is being created");
-    public static final ConfigKey<String> CLOUD_MACHINE_NAMER_CLASS = ConfigKeys.newStringConfigKey("cloudMachineNamer", "fully qualified class name of a class that extends CloudMachineNamer and has a single-parameter constructor that takes a ConfigBag");
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigUtils.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigUtils.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigUtils.java
deleted file mode 100644
index 64d31f9..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/location/LocationConfigUtils.java
+++ /dev/null
@@ -1,559 +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.core.location;
-
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.groovyTruth;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.security.KeyPair;
-import java.security.PublicKey;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.crypto.SecureKeys;
-import org.apache.brooklyn.util.core.crypto.SecureKeys.PassphraseProblem;
-import org.apache.brooklyn.util.crypto.AuthorizedKeysParser;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.text.StringFunctions;
-import org.apache.brooklyn.util.text.Strings;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class LocationConfigUtils {
-
-    private static final Logger log = LoggerFactory.getLogger(LocationConfigUtils.class);
-
-    /** Creates an instance of {@link OsCredential} by inspecting {@link LocationConfigKeys#PASSWORD}; 
-     * {@link LocationConfigKeys#PRIVATE_KEY_DATA} and {@link LocationConfigKeys#PRIVATE_KEY_FILE};
-     * {@link LocationConfigKeys#PRIVATE_KEY_PASSPHRASE} if needed, and
-     * {@link LocationConfigKeys#PRIVATE_KEY_DATA} and {@link LocationConfigKeys#PRIVATE_KEY_FILE}
-     * (defaulting to the private key file + ".pub"). 
-     **/
-    public static OsCredential getOsCredential(ConfigBag config) {
-        return OsCredential.newInstance(config);
-    }
-    
-    /** Convenience class for holding private/public keys and passwords, inferring from config keys.
-     * See {@link LocationConfigUtils#getOsCredential(ConfigBag)}. */
-    @Beta // would be nice to replace with a builder pattern 
-    public static class OsCredential {
-        private final ConfigBag config;
-        private boolean preferPassword = false;
-        private boolean tryDefaultKeys = true;
-        private boolean requirePublicKey = true;
-        private boolean doKeyValidation = BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_VALIDATE_LOCATION_SSH_KEYS);
-        private boolean warnOnErrors = true;
-        private boolean throwOnErrors = false;
-        
-        private boolean dirty = true;;
-        
-        private String privateKeyData;
-        private String publicKeyData;
-        private String password;
-        
-        private OsCredential(ConfigBag config) {
-            this.config = config;
-        }
-
-        /** throws if there are any problems */
-        public OsCredential checkNotEmpty() {
-            checkNoErrors();
-            
-            if (!hasKey() && !hasPassword()) {
-                if (warningMessages.size()>0)
-                    throw new IllegalStateException("Could not find credentials: "+warningMessages);
-                else 
-                    throw new IllegalStateException("Could not find credentials");
-            }
-            return this;
-        }
-
-        /** throws if there were errors resolving (e.g. explicit keys, none of which were found/valid, or public key required and not found) 
-         * @return */
-        public OsCredential checkNoErrors() {
-            throwOnErrors(true);
-            dirty();
-            infer();
-            return this;
-        }
-        
-        public OsCredential logAnyWarnings() {
-            if (!warningMessages.isEmpty())
-                log.warn("When reading credentials: "+warningMessages);
-            return this;
-        }
-
-        public Set<String> getWarningMessages() {
-            return warningMessages;
-        }
-        
-        /** returns either the key or password or null; if both a key and a password this prefers the key unless otherwise set
-         * via {@link #preferPassword()} */
-        public synchronized String getPreferredCredential() {
-            infer();
-            
-            if (isUsingPassword()) return password;
-            if (hasKey()) return privateKeyData;
-            return null;
-        }
-
-        /** if there is no credential (ignores public key) */
-        public boolean isEmpty() {
-            return !hasKey() && !hasPassword();
-        }
-        public boolean hasKey() {
-            infer();
-            // key has stricter non-blank check than password
-            return Strings.isNonBlank(privateKeyData);
-        }
-        public boolean hasPassword() {
-            infer();
-            // blank, even empty passwords are allowed
-            return password!=null;
-        }
-        /** if a password is available, and either this is preferred over a key or there is no key */
-        public boolean isUsingPassword() {
-            return hasPassword() && (!hasKey() || preferPassword);
-        }
-        
-        public String getPrivateKeyData() {
-            infer();
-            return privateKeyData;
-        }
-        public String getPublicKeyData() {
-            infer();
-            return publicKeyData;
-        }
-        public String getPassword() {
-            infer();
-            return password;
-        }
-        
-        /** if both key and password supplied, prefer the key; the default */
-        public OsCredential preferKey() { preferPassword = false; return dirty(); }
-        /** if both key and password supplied, prefer the password; see {@link #preferKey()} */
-        public OsCredential preferPassword() { preferPassword = true; return dirty(); }
-        
-        /** if false, do not mind if there is no public key corresponding to any private key;
-         * defaults to true; only applies if a private key is set */
-        public OsCredential requirePublicKey(boolean requirePublicKey) {
-            this.requirePublicKey = requirePublicKey;
-            return dirty(); 
-        }
-        /** whether to check the private/public keys and passphrase are coherent; default true */
-        public OsCredential doKeyValidation(boolean doKeyValidation) {
-            this.doKeyValidation = doKeyValidation;
-            return dirty();
-        }
-        /** if true (the default) this will look at default locations set on keys */
-        public OsCredential useDefaultKeys(boolean tryDefaultKeys) {
-            this.tryDefaultKeys = tryDefaultKeys;
-            return dirty(); 
-        }
-        /** whether to log warnings on problems */
-        public OsCredential warnOnErrors(boolean warnOnErrors) {
-            this.warnOnErrors = warnOnErrors;
-            return dirty(); 
-        }
-        /** whether to throw on problems */
-        public OsCredential throwOnErrors(boolean throwOnErrors) {
-            this.throwOnErrors = throwOnErrors;
-            return dirty(); 
-        }
-        
-        private OsCredential dirty() { dirty = true; return this; }
-            
-        public static OsCredential newInstance(ConfigBag config) {
-            return new OsCredential(config);
-        }
-        
-        private synchronized void infer() {
-            if (!dirty) return;
-            warningMessages.clear(); 
-            
-            log.debug("Inferring OS credentials");
-            privateKeyData = config.get(LocationConfigKeys.PRIVATE_KEY_DATA);
-            password = config.get(LocationConfigKeys.PASSWORD);
-            publicKeyData = getKeyDataFromDataKeyOrFileKey(config, LocationConfigKeys.PUBLIC_KEY_DATA, LocationConfigKeys.PUBLIC_KEY_FILE);
-
-            KeyPair privateKey = null;
-            
-            if (Strings.isBlank(privateKeyData)) {
-                // look up private key files
-                String privateKeyFiles = null;
-                boolean privateKeyFilesExplicitlySet = config.containsKey(LocationConfigKeys.PRIVATE_KEY_FILE);
-                if (privateKeyFilesExplicitlySet || (tryDefaultKeys && password==null)) 
-                    privateKeyFiles = config.get(LocationConfigKeys.PRIVATE_KEY_FILE);
-                if (Strings.isNonBlank(privateKeyFiles)) {
-                    Iterator<String> fi = Arrays.asList(privateKeyFiles.split(File.pathSeparator)).iterator();
-                    while (fi.hasNext()) {
-                        String file = fi.next();
-                        if (Strings.isNonBlank(file)) {
-                            try {
-                                // real URL's won't actual work, due to use of path separator above 
-                                // not real important, but we get it for free if "files" is a list instead.
-                                // using ResourceUtils is useful for classpath resources
-                                if (file!=null)
-                                    privateKeyData = ResourceUtils.create().getResourceAsString(file);
-                                // else use data already set
-                                
-                                privateKey = getValidatedPrivateKey(file);
-                                
-                                if (privateKeyData==null) {
-                                    // was cleared due to validation error
-                                } else if (Strings.isNonBlank(publicKeyData)) {
-                                    log.debug("Loaded private key data from "+file+" (public key data explicitly set)");
-                                    break;
-                                } else {
-                                    String publicKeyFile = (file!=null ? file+".pub" : "(data)");
-                                    try {
-                                        publicKeyData = ResourceUtils.create().getResourceAsString(publicKeyFile);
-                                        
-                                        log.debug("Loaded private key data from "+file+
-                                            " and public key data from "+publicKeyFile);
-                                        break;
-                                    } catch (Exception e) {
-                                        Exceptions.propagateIfFatal(e);
-                                        log.debug("No public key file "+publicKeyFile+"; will try extracting from private key");
-                                        publicKeyData = AuthorizedKeysParser.encodePublicKey(privateKey.getPublic());
-                                        
-                                        if (publicKeyData==null) {
-                                            if (requirePublicKey) {
-                                                addWarning("Unable to find or extract public key for "+file, "skipping");
-                                            } else {
-                                                log.debug("Loaded private key data from "+file+" (public key data not found but not required)");
-                                                break;
-                                            }
-                                        } else {
-                                            log.debug("Loaded private key data from "+file+" (public key data extracted)");
-                                            break;
-                                        }
-                                        privateKeyData = null;
-                                    }
-                                }
-
-                            } catch (Exception e) {
-                                Exceptions.propagateIfFatal(e);
-                                String message = "Missing/invalid private key file "+file;
-                                if (privateKeyFilesExplicitlySet) addWarning(message, (!fi.hasNext() ? "no more files to try" : "trying next file")+": "+e);
-                            }
-                        }
-                    }
-                    if (privateKeyFilesExplicitlySet && Strings.isBlank(privateKeyData))
-                        error("No valid private keys found", ""+warningMessages);
-                }
-            } else {
-                privateKey = getValidatedPrivateKey("(data)");
-            }
-            
-            if (privateKeyData!=null) {
-                if (requirePublicKey && Strings.isBlank(publicKeyData)) {
-                    if (privateKey!=null) {
-                        publicKeyData = AuthorizedKeysParser.encodePublicKey(privateKey.getPublic());
-                    }
-                    if (Strings.isBlank(publicKeyData)) {
-                        error("If explicit "+LocationConfigKeys.PRIVATE_KEY_DATA.getName()+" is supplied, then "
-                            + "the corresponding "+LocationConfigKeys.PUBLIC_KEY_DATA.getName()+" must also be supplied.", null);
-                    } else {
-                        log.debug("Public key data extracted");
-                    }
-                }
-                if (doKeyValidation && privateKey!=null && privateKey.getPublic()!=null && Strings.isNonBlank(publicKeyData)) {
-                    PublicKey decoded = null;
-                    try {
-                        decoded = AuthorizedKeysParser.decodePublicKey(publicKeyData);
-                    } catch (Exception e) {
-                        Exceptions.propagateIfFatal(e);
-                        addWarning("Invalid public key: "+decoded);
-                    }
-                    if (decoded!=null && !privateKey.getPublic().equals( decoded )) {
-                        error("Public key inferred from does not match public key extracted from private key", null);
-                    }
-                }
-            }
-
-            log.debug("OS credential inference: "+this);
-            dirty = false;
-        }
-
-        private KeyPair getValidatedPrivateKey(String label) {
-            KeyPair privateKey = null;
-            String passphrase = config.get(CloudLocationConfig.PRIVATE_KEY_PASSPHRASE);
-            try {
-                privateKey = SecureKeys.readPem(new ByteArrayInputStream(privateKeyData.getBytes()), passphrase);
-                if (passphrase!=null) {
-                    // get the unencrypted key data for our internal use (jclouds requires this)
-                    privateKeyData = SecureKeys.toPem(privateKey);
-                }
-            } catch (PassphraseProblem e) {
-                if (doKeyValidation) {
-                    log.debug("Encountered error handling key "+label+": "+e, e);
-                    if (Strings.isBlank(passphrase))
-                        addWarning("Passphrase required for key '"+label+"'");
-                    else
-                        addWarning("Invalid passphrase for key '"+label+"'");
-                    privateKeyData = null;
-                }
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                if (doKeyValidation) {
-                    addWarning("Unable to parse private key from '"+label+"': unknown format");
-                    privateKeyData = null;
-                }
-            }
-            return privateKey;
-        }
-        
-        Set<String> warningMessages = MutableSet.of();
-        
-        private void error(String msg, String logExtension) {
-            addWarning(msg);
-            if (warnOnErrors) log.warn(msg+(logExtension==null ? "" : ": "+logExtension));
-            if (throwOnErrors) throw new IllegalStateException(msg+(logExtension==null ? "" : "; "+logExtension));
-        }
-
-        private void addWarning(String msg) {
-            addWarning(msg, null);
-        }
-        private void addWarning(String msg, String debugExtension) {
-            log.debug(msg+(debugExtension==null ? "" : "; "+debugExtension));
-            warningMessages.add(msg);
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName()+"["+
-                (Strings.isNonBlank(publicKeyData) ? publicKeyData : "no-public-key")+";"+
-                (Strings.isNonBlank(privateKeyData) ? "private-key-present" : "no-private-key")+","+
-                (password!=null ? "password(len="+password.length()+")" : "no-password")+"]";
-        }
-    }
-
-    /** @deprecated since 0.7.0, use #getOsCredential(ConfigBag) */ @Deprecated
-    public static String getPrivateKeyData(ConfigBag config) {
-        return getKeyData(config, LocationConfigKeys.PRIVATE_KEY_DATA, LocationConfigKeys.PRIVATE_KEY_FILE);
-    }
-    
-    /** @deprecated since 0.7.0, use #getOsCredential(ConfigBag) */ @Deprecated
-    public static String getPublicKeyData(ConfigBag config) {
-        String data = getKeyData(config, LocationConfigKeys.PUBLIC_KEY_DATA, LocationConfigKeys.PUBLIC_KEY_FILE);
-        if (groovyTruth(data)) return data;
-        
-        String privateKeyFile = config.get(LocationConfigKeys.PRIVATE_KEY_FILE);
-        if (groovyTruth(privateKeyFile)) {
-            List<String> privateKeyFiles = Arrays.asList(privateKeyFile.split(File.pathSeparator));
-            List<String> publicKeyFiles = ImmutableList.copyOf(Iterables.transform(privateKeyFiles, StringFunctions.append(".pub")));
-            List<String> publicKeyFilesTidied = tidyFilePaths(publicKeyFiles);
-            
-            String fileData = getFileContents(publicKeyFilesTidied);
-            if (groovyTruth(fileData)) {
-                if (log.isDebugEnabled()) log.debug("Loaded "+LocationConfigKeys.PUBLIC_KEY_DATA.getName()+" from inferred files, based on "+LocationConfigKeys.PRIVATE_KEY_FILE.getName() + ": used " + publicKeyFilesTidied + " for "+config.getDescription());
-                config.put(LocationConfigKeys.PUBLIC_KEY_DATA, fileData);
-                return fileData;
-            } else {
-                log.info("Not able to load "+LocationConfigKeys.PUBLIC_KEY_DATA.getName()+" from inferred files, based on "+LocationConfigKeys.PRIVATE_KEY_FILE.getName() + ": tried " + publicKeyFilesTidied + " for "+config.getDescription());
-            }
-        }
-        
-        return null;
-    }
-
-    /** @deprecated since 0.7.0, use #getOsCredential(ConfigBag) */ @Deprecated
-    public static String getKeyData(ConfigBag config, ConfigKey<String> dataKey, ConfigKey<String> fileKey) {
-        return getKeyDataFromDataKeyOrFileKey(config, dataKey, fileKey);
-    }
-    
-    private static String getKeyDataFromDataKeyOrFileKey(ConfigBag config, ConfigKey<String> dataKey, ConfigKey<String> fileKey) {
-        boolean unused = config.isUnused(dataKey);
-        String data = config.get(dataKey);
-        if (groovyTruth(data) && !unused) {
-            return data;
-        }
-        
-        String file = config.get(fileKey);
-        if (groovyTruth(file)) {
-            List<String> files = Arrays.asList(file.split(File.pathSeparator));
-            List<String> filesTidied = tidyFilePaths(files);
-            String fileData = getFileContents(filesTidied);
-            if (fileData == null) {
-                log.warn("Invalid file" + (files.size() > 1 ? "s" : "") + " for " + fileKey + " (given " + files + 
-                        (files.equals(filesTidied) ? "" : "; converted to " + filesTidied) + ") " +
-                        "may fail provisioning " + config.getDescription());
-            } else if (groovyTruth(data)) {
-                if (!fileData.trim().equals(data.trim()))
-                    log.warn(dataKey.getName()+" and "+fileKey.getName()+" both specified; preferring the former");
-            } else {
-                data = fileData;
-                config.put(dataKey, data);
-                config.get(dataKey);
-            }
-        }
-        
-        return data;
-    }
-    
-    /**
-     * Reads the given file(s) in-order, returning the contents of the first file that can be read.
-     * Returns the file contents, or null if none of the files can be read.
-     *  
-     * @param files             list of file paths
-     */
-    private static String getFileContents(Iterable<String> files) {
-        Iterator<String> fi = files.iterator();
-        while (fi.hasNext()) {
-            String file = fi.next();
-            if (groovyTruth(file)) {
-                try {
-                    // see comment above
-                    String result = ResourceUtils.create().getResourceAsString(file);
-                    if (result!=null) return result;
-                    log.debug("Invalid file "+file+" ; " + (!fi.hasNext() ? "no more files to try" : "trying next file")+" (null)");
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.debug("Invalid file "+file+" ; " + (!fi.hasNext() ? "no more files to try" : "trying next file"), e);
-                }
-            }
-        }
-        return null;
-    }
-
-    private static List<String> tidyFilePaths(Iterable<String> files) {
-        List<String> result = Lists.newArrayList();
-        for (String file : files) {
-            result.add(Os.tidyPath(file));
-        }
-        return result;
-    }
-
-    /** @deprecated since 0.6.0 use configBag.getWithDeprecation */
-    @Deprecated
-    @SuppressWarnings("unchecked")
-    public static <T> T getConfigCheckingDeprecatedAlternatives(ConfigBag configBag, ConfigKey<T> preferredKey,
-            ConfigKey<?> ...deprecatedKeys) {
-        T value1 = (T) configBag.getWithDeprecation(preferredKey, deprecatedKeys);
-        T value2 = getConfigCheckingDeprecatedAlternativesInternal(configBag, preferredKey, deprecatedKeys);
-        if (!Objects.equal(value1, value2)) {
-            // points to a bug in one of the get-with-deprecation methods
-            log.warn("Deprecated getConfig with deprecated keys "+Arrays.toString(deprecatedKeys)+" gets different value with " +
-                    "new strategy "+preferredKey+" ("+value1+") and old ("+value2+"); preferring old value for now, but this behaviour will change");
-            return value2;
-        }
-        return value1;
-    }
-    
-    @SuppressWarnings("unchecked")
-    private static <T> T getConfigCheckingDeprecatedAlternativesInternal(ConfigBag configBag, ConfigKey<T> preferredKey,
-            ConfigKey<?> ...deprecatedKeys) {
-        ConfigKey<?> keyProvidingValue = null;
-        T value = null;
-        boolean found = false;
-        if (configBag.containsKey(preferredKey)) {
-            value = configBag.get(preferredKey);
-            found = true;
-            keyProvidingValue = preferredKey;
-        }
-        
-        for (ConfigKey<?> deprecatedKey: deprecatedKeys) {
-            T altValue = null;
-            boolean altFound = false;
-            if (configBag.containsKey(deprecatedKey)) {
-                altValue = (T) configBag.get(deprecatedKey);
-                altFound = true;
-                
-                if (altFound) {
-                    if (found) {
-                        if (Objects.equal(value, altValue)) {
-                            // fine -- nothing
-                        } else {
-                            log.warn("Detected deprecated key "+deprecatedKey+" with value "+altValue+" used in addition to "+keyProvidingValue+" " +
-                                    "with value "+value+" for "+configBag.getDescription()+"; ignoring");
-                            configBag.remove(deprecatedKey);
-                        }
-                    } else {
-                        log.warn("Detected deprecated key "+deprecatedKey+" with value "+altValue+" used instead of recommended "+preferredKey+"; " +
-                                "promoting to preferred key status; will not be supported in future versions");
-                        configBag.put(preferredKey, altValue);
-                        configBag.remove(deprecatedKey);
-                        value = altValue;
-                        found = true;
-                        keyProvidingValue = deprecatedKey;
-                    }
-                }
-            }
-        }
-        
-        if (found) {
-            return value;
-        } else {
-            return configBag.get(preferredKey); // get the default
-        }
-    }
-
-    public static Map<ConfigKey<String>,String> finalAndOriginalSpecs(String finalSpec, Object ...sourcesForOriginalSpec) {
-        // yuck!: TODO should clean up how these things get passed around
-        Map<ConfigKey<String>,String> result = MutableMap.of();
-        if (finalSpec!=null) 
-            result.put(LocationInternal.FINAL_SPEC, finalSpec);
-        
-        String originalSpec = null;
-        for (Object source: sourcesForOriginalSpec) {
-            if (source instanceof CharSequence) originalSpec = source.toString();
-            else if (source instanceof Map) {
-                if (originalSpec==null) originalSpec = Strings.toString( ((Map<?,?>)source).get(LocationInternal.ORIGINAL_SPEC) );
-                if (originalSpec==null) originalSpec = Strings.toString( ((Map<?,?>)source).get(LocationInternal.ORIGINAL_SPEC.getName()) );
-            }
-            if (originalSpec!=null) break; 
-        }
-        if (originalSpec==null) originalSpec = finalSpec;
-        if (originalSpec!=null)
-            result.put(LocationInternal.ORIGINAL_SPEC, originalSpec);
-        
-        return result;
-    }
-
-    public static boolean isEnabled(ManagementContext mgmt, String prefix) {
-        ConfigKey<Boolean> key = ConfigKeys.newConfigKeyWithPrefix(prefix+".", LocationConfigKeys.ENABLED);
-        Boolean enabled = mgmt.getConfig().getConfig(key);
-        if (enabled!=null) return enabled.booleanValue();
-        return true;
-    }
-    
-
-}


[36/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
deleted file mode 100644
index 40fd757..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ /dev/null
@@ -1,331 +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.brooklyn.spi.dsl.methods;
-
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagerInternal;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.task.TaskBuilder;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
-
-    private static final long serialVersionUID = -7715984495268724954L;
-    
-    private final String componentId;
-    private final DslComponent scopeComponent;
-    private final Scope scope;
-
-    public DslComponent(String componentId) {
-        this(Scope.GLOBAL, componentId);
-    }
-    
-    public DslComponent(Scope scope, String componentId) {
-        this(null, scope, componentId);
-    }
-    
-    public DslComponent(DslComponent scopeComponent, Scope scope, String componentId) {
-        Preconditions.checkNotNull(scope, "scope");
-        this.scopeComponent = scopeComponent;
-        this.componentId = componentId;
-        this.scope = scope;
-    }
-
-    // ---------------------------
-    
-    @Override
-    public Task<Entity> newTask() {
-        return TaskBuilder.<Entity>builder().displayName(toString()).tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
-            .body(new EntityInScopeFinder(scopeComponent, scope, componentId)).build();
-    }
-    
-    protected static class EntityInScopeFinder implements Callable<Entity> {
-        protected final DslComponent scopeComponent;
-        protected final Scope scope;
-        protected final String componentId;
-
-        public EntityInScopeFinder(DslComponent scopeComponent, Scope scope, String componentId) {
-            this.scopeComponent = scopeComponent;
-            this.scope = scope;
-            this.componentId = componentId;
-        }
-
-        protected EntityInternal getEntity() {
-            if (scopeComponent!=null) {
-                return (EntityInternal)scopeComponent.get();
-            } else {
-                return entity();
-            }
-        }
-        
-        @Override
-        public Entity call() throws Exception {
-            Iterable<Entity> entitiesToSearch = null;
-            switch (scope) {
-                case THIS:
-                    return getEntity();
-                case PARENT:
-                    return getEntity().getParent();
-                case GLOBAL:
-                    entitiesToSearch = ((EntityManagerInternal)getEntity().getManagementContext().getEntityManager())
-                        .getAllEntitiesInApplication( entity().getApplication() );
-                    break;
-                case ROOT:
-                    return getEntity().getApplication();
-                case SCOPE_ROOT:
-                    return Entities.catalogItemScopeRoot(getEntity());
-                case DESCENDANT:
-                    entitiesToSearch = Entities.descendants(getEntity());
-                    break;
-                case ANCESTOR:
-                    entitiesToSearch = Entities.ancestors(getEntity());
-                    break;
-                case SIBLING:
-                    entitiesToSearch = getEntity().getParent().getChildren();
-                    break;
-                case CHILD:
-                    entitiesToSearch = getEntity().getChildren();
-                    break;
-                default:
-                    throw new IllegalStateException("Unexpected scope "+scope);
-            }
-            
-            Optional<Entity> result = Iterables.tryFind(entitiesToSearch, EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId));
-            
-            if (result.isPresent())
-                return result.get();
-            
-            // TODO may want to block and repeat on new entities joining?
-            throw new NoSuchElementException("No entity matching id " + componentId+
-                (scope==Scope.GLOBAL ? "" : ", in scope "+scope+" wrt "+getEntity()+
-                (scopeComponent!=null ? " ("+scopeComponent+" from "+entity()+")" : "")));
-        }        
-    }
-    
-    // -------------------------------
-
-    // DSL words which move to a new component
-    
-    public DslComponent entity(String scopeOrId) {
-        return new DslComponent(this, Scope.GLOBAL, scopeOrId);
-    }
-    public DslComponent child(String scopeOrId) {
-        return new DslComponent(this, Scope.CHILD, scopeOrId);
-    }
-    public DslComponent sibling(String scopeOrId) {
-        return new DslComponent(this, Scope.SIBLING, scopeOrId);
-    }
-    public DslComponent descendant(String scopeOrId) {
-        return new DslComponent(this, Scope.DESCENDANT, scopeOrId);
-    }
-    public DslComponent ancestor(String scopeOrId) {
-        return new DslComponent(this, Scope.ANCESTOR, scopeOrId);
-    }
-    public DslComponent root() {
-        return new DslComponent(this, Scope.ROOT, "");
-    }
-    public DslComponent scopeRoot() {
-        return new DslComponent(this, Scope.SCOPE_ROOT, "");
-    }
-    
-    @Deprecated /** @deprecated since 0.7.0 */
-    public DslComponent component(String scopeOrId) {
-        return new DslComponent(this, Scope.GLOBAL, scopeOrId);
-    }
-    
-    public DslComponent parent() {
-        return new DslComponent(this, Scope.PARENT, "");
-    }
-    
-    public DslComponent component(String scope, String id) {
-        if (!DslComponent.Scope.isValid(scope)) {
-            throw new IllegalArgumentException(scope + " is not a vlaid scope");
-        }
-        return new DslComponent(this, DslComponent.Scope.fromString(scope), id);
-    }
-
-    // DSL words which return things
-    
-    public BrooklynDslDeferredSupplier<?> attributeWhenReady(final String sensorName) {
-        return new AttributeWhenReady(this, sensorName);
-    }
-    // class simply makes the memento XML files nicer
-    protected static class AttributeWhenReady extends BrooklynDslDeferredSupplier<Object> {
-        private static final long serialVersionUID = 1740899524088902383L;
-        private final DslComponent component;
-        private final String sensorName;
-        public AttributeWhenReady(DslComponent component, String sensorName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.sensorName = sensorName;
-        }
-        @SuppressWarnings("unchecked")
-        @Override
-        public Task<Object> newTask() {
-            Entity targetEntity = component.get();
-            Sensor<?> targetSensor = targetEntity.getEntityType().getSensor(sensorName);
-            if (!(targetSensor instanceof AttributeSensor<?>)) {
-                targetSensor = Sensors.newSensor(Object.class, sensorName);
-            }
-            return (Task<Object>) DependentConfiguration.attributeWhenReady(targetEntity, (AttributeSensor<?>)targetSensor);
-        }
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") +
-                "attributeWhenReady("+JavaStringEscapes.wrapJavaString(sensorName)+")";
-        }
-    }
-
-    public BrooklynDslDeferredSupplier<?> config(final String keyName) {
-        return new DslConfigSupplier(this, keyName);
-    }
-    protected final static class DslConfigSupplier extends BrooklynDslDeferredSupplier<Object> {
-        private final DslComponent component;
-        private final String keyName;
-        private static final long serialVersionUID = -4735177561947722511L;
-
-        public DslConfigSupplier(DslComponent component, String keyName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.keyName = keyName;
-        }
-
-        @Override
-        public Task<Object> newTask() {
-            return Tasks.builder().displayName("retrieving config for "+keyName).tag(BrooklynTaskTags.TRANSIENT_TASK_TAG).dynamic(false).body(new Callable<Object>() {
-                @Override
-                public Object call() throws Exception {
-                    Entity targetEntity = component.get();
-                    return targetEntity.getConfig(ConfigKeys.newConfigKey(Object.class, keyName));
-                }
-            }).build();
-        }
-
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") + 
-                "config("+JavaStringEscapes.wrapJavaString(keyName)+")";
-        }
-    }
-    
-    public BrooklynDslDeferredSupplier<Sensor<?>> sensor(final String sensorName) {
-        return new DslSensorSupplier(this, sensorName);
-    }
-    protected final static class DslSensorSupplier extends BrooklynDslDeferredSupplier<Sensor<?>> {
-        private final DslComponent component;
-        private final String sensorName;
-        private static final long serialVersionUID = -4735177561947722511L;
-
-        public DslSensorSupplier(DslComponent component, String sensorName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.sensorName = sensorName;
-        }
-
-        @Override
-        public Task<Sensor<?>> newTask() {
-            return Tasks.<Sensor<?>>builder().displayName("looking up sensor for "+sensorName).dynamic(false).body(new Callable<Sensor<?>>() {
-                @Override
-                public Sensor<?> call() throws Exception {
-                    Entity targetEntity = component.get();
-                    Sensor<?> result = null;
-                    if (targetEntity!=null) {
-                        result = targetEntity.getEntityType().getSensor(sensorName);
-                    }
-                    if (result!=null) return result;
-                    return Sensors.newSensor(Object.class, sensorName);
-                }
-            }).build();
-        }
-
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") + 
-                "sensor("+JavaStringEscapes.wrapJavaString(sensorName)+")";
-        }
-    }
-
-    public static enum Scope {
-        GLOBAL ("global"),
-        CHILD ("child"),
-        PARENT ("parent"),
-        SIBLING ("sibling"),
-        DESCENDANT ("descendant"),
-        ANCESTOR("ancestor"),
-        ROOT("root"),
-        SCOPE_ROOT("scopeRoot"),
-        THIS ("this");
-        
-        public static final Set<Scope> VALUES = ImmutableSet.of(GLOBAL, CHILD, PARENT, SIBLING, DESCENDANT, ANCESTOR, ROOT, SCOPE_ROOT, THIS);
-        
-        private final String name;
-        
-        private Scope(String name) {
-            this.name = name;
-        }
-        
-        public static Scope fromString(String name) {
-            return tryFromString(name).get();
-        }
-        
-        public static Maybe<Scope> tryFromString(String name) {
-            for (Scope scope : VALUES)
-                if (scope.name.toLowerCase().equals(name.toLowerCase()))
-                    return Maybe.of(scope);
-            return Maybe.absent(new IllegalArgumentException(name + " is not a valid scope"));
-        }
-        
-        public static boolean isValid(String name) {
-            for (Scope scope : VALUES)
-                if (scope.name.toLowerCase().equals(name.toLowerCase()))
-                    return true;
-            return false;
-        }
-    }
-
-
-    @Override
-    public String toString() {
-        return "$brooklyn:entity("+
-            (scopeComponent==null ? "" : JavaStringEscapes.wrapJavaString(scopeComponent.toString())+", ")+
-            (scope==Scope.GLOBAL ? "" : JavaStringEscapes.wrapJavaString(scope.toString())+", ")+
-            JavaStringEscapes.wrapJavaString(componentId)+
-            ")";
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
deleted file mode 100644
index 7b0f359..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
+++ /dev/null
@@ -1,144 +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.brooklyn.spi.dsl.parse;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.util.collections.MutableList;
-
-public class DslParser {
-    private final String expression;
-    int index = -1;
-    
-    public DslParser(String expression) {
-        this.expression = expression;
-    }
-    
-    public synchronized Object parse() {
-        if (index>=0)
-            throw new IllegalStateException("Parser can only be used once");
-        
-        index++;
-        Object result = next();
-        
-        if (index < expression.length())
-            throw new IllegalStateException("Unexpected character at position "+index+" in "+expression);
-        
-        return result;
-    }
-    
-    @SuppressWarnings("unchecked")
-    public Object next() {
-        int start = index;
-        
-        skipWhitespace();
-        if (index >= expression.length())
-            throw new IllegalStateException("Unexpected end of expression to parse, looking for content since position "+start);
-        
-        if (expression.charAt(index)=='"') {
-            // assume a string
-            int stringStart = index;
-            index++;
-            do {
-                if (index >= expression.length())
-                    throw new IllegalStateException("Unexpected end of expression to parse, looking for close quote since position "+stringStart);
-                char c = expression.charAt(index);
-                if (c=='"') break;
-                if (c=='\\') index++;
-                index++;
-            } while (true);
-            index++;
-            return new QuotedString(expression.substring(stringStart, index));
-        }
-
-        // not a string, must be a function (or chain thereof)
-        List<FunctionWithArgs> result = new MutableList<FunctionWithArgs>();
-
-        int fnStart = index;
-        do {
-            if (index >= expression.length())
-                break;
-            char c = expression.charAt(index);
-            if (Character.isJavaIdentifierPart(c)) ;
-            // these chars also permitted
-            else if (".:".indexOf(c)>=0) ;
-            // other things e.g. whitespace, parentheses, etc, skip
-            else break;
-            index++;
-        } while (true);
-        String fn = expression.substring(fnStart, index);
-        if (fn.length()==0)
-            throw new IllegalStateException("Expected a function name at position "+start);
-        skipWhitespace();
-        
-        if (index < expression.length() && expression.charAt(index)=='(') {
-            // collect arguments
-            int parenStart = index;
-            List<Object> args = new MutableList<Object>();
-            index ++;
-            do {
-                skipWhitespace();
-                if (index >= expression.length())
-                    throw new IllegalStateException("Unexpected end of arguments to function '"+fn+"', no close parenthesis matching character at position "+parenStart);
-                char c = expression.charAt(index);
-                if (c==')') break;
-                if (c==',') {
-                    if (args.isEmpty())
-                        throw new IllegalStateException("Invalid character at position"+index);
-                    index++;
-                } else {
-                    if (!args.isEmpty())
-                        throw new IllegalStateException("Expected , before position"+index);
-                }
-                args.add(next());
-            } while (true);
-            result.add(new FunctionWithArgs(fn, args));
-            index++;
-            skipWhitespace();
-            if (index >= expression.length())
-                return result;
-            char c = expression.charAt(index);
-            if (c=='.') {
-                // chained expression
-                int chainStart = index;
-                index++;
-                Object next = next();
-                if (next instanceof List) {
-                    result.addAll((Collection<? extends FunctionWithArgs>) next);
-                    return result;
-                } else {
-                    throw new IllegalStateException("Expected functions following position"+chainStart);
-                }
-            } else {
-                // following word not something handled at this level; assume parent will handle (or throw) - e.g. a , or extra )
-                return result;
-            }
-        } else {
-            // it is just a word; return it with args as null
-            return new FunctionWithArgs(fn, null);
-        }
-    }
-
-    private void skipWhitespace() {
-        while (index<expression.length() && Character.isWhitespace(expression.charAt(index)))
-            index++;
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java
deleted file mode 100644
index 41bc837..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.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.brooklyn.spi.dsl.parse;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-public class FunctionWithArgs {
-    private final String function;
-    private final List<Object> args;
-    
-    public FunctionWithArgs(String function, List<Object> args) {
-        this.function = function;
-        this.args = args==null ? null : ImmutableList.copyOf(args);
-    }
-    
-    public String getFunction() {
-        return function;
-    }
-    
-    /**
-     * arguments (typically {@link QuotedString} or more {@link FunctionWithArgs}).
-     * 
-     * null means it is a function in a map key which expects map value to be the arguments -- specified without parentheses;
-     * empty means parentheses already applied, with 0 args.
-     */
-    public List<Object> getArgs() {
-        return args;
-    }
-    
-    @Override
-    public String toString() {
-        return function+(args==null ? "" : args);
-    }
-
-    public Object arg(int i) {
-        return args.get(i);
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java
deleted file mode 100644
index cf1b67d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.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 org.apache.brooklyn.camp.brooklyn.spi.dsl.parse;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.base.Objects;
-
-public class QuotedString {
-    private final String s;
-    
-    public QuotedString(String s) {
-        this.s = checkNotNull(s, "string");
-    }
-    @Override
-    public String toString() {
-        return s;
-    }
-    public String unwrapped() {
-        return JavaStringEscapes.unwrapJavaString(s);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        return (obj instanceof QuotedString) && ((QuotedString)obj).toString().equals(toString());
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(s);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
deleted file mode 100644
index b0514e6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.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.brooklyn.spi.lookup;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-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> {
-
-    protected final PlatformRootSummary root;
-    protected final ManagementContext bmc;
-
-    public AbstractBrooklynResourceLookup(PlatformRootSummary root, ManagementContext bmc) {
-        this.root = root;
-        this.bmc = bmc;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
deleted file mode 100644
index f038e0f..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.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 org.apache.brooklyn.camp.brooklyn.spi.lookup;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.spi.AbstractResource;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractTemplateBrooklynLookup<T extends AbstractResource>  extends AbstractBrooklynResourceLookup<T> {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractTemplateBrooklynLookup.class);
-    
-    public AbstractTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public T get(String id) {
-        RegisteredType item = bmc.getTypeRegistry().get(id);
-        if (item==null) {
-            log.warn("Could not find item '"+id+"' in Brooklyn catalog; returning null");
-            return null;
-        }
-        return adapt(item);
-    }
-
-    public abstract T adapt(RegisteredType item);
-
-    protected ResolvableLink<T> newLink(CatalogItem<? extends Entity,EntitySpec<?>> li) {
-        return newLink(li.getId(), li.getDisplayName());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
deleted file mode 100644
index 1ab2585..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
+++ /dev/null
@@ -1,68 +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.brooklyn.spi.lookup;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.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> {
-
-    private PlatformComponentBrooklynLookup pcs;
-
-    public AssemblyBrooklynLookup(PlatformRootSummary root, ManagementContext bmc, PlatformComponentBrooklynLookup pcs) {
-        super(root, bmc);
-        this.pcs = pcs;
-    }
-
-    @Override
-    public Assembly get(String id) {
-        Entity entity = bmc.getEntityManager().getEntity(id);
-        if (!(entity instanceof Application))
-            throw new IllegalArgumentException("Element for "+id+" is not an Application ("+entity+")");
-        Assembly.Builder<? extends Assembly> builder = Assembly.builder()
-                .created(new Date(entity.getCreationTime()))
-                .id(entity.getId())
-                .name(entity.getDisplayName());
-        
-        builder.customAttribute("externalManagementUri", BrooklynUrlLookup.getUrl(bmc, entity));
-        
-        for (Entity child: entity.getChildren())
-            // FIXME this walks the whole damn tree!
-            builder.add( pcs.get(child.getId() ));
-        return builder.build();
-    }
-
-    @Override
-    public List<ResolvableLink<Assembly>> links() {
-        List<ResolvableLink<Assembly>> result = new ArrayList<ResolvableLink<Assembly>>();
-        for (Application app: bmc.getApplications())
-            result.add(newLink(app.getId(), app.getDisplayName()));
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
deleted file mode 100644
index e30d9c6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.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.brooklyn.spi.lookup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-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> {
-
-    public AssemblyTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public AssemblyTemplate adapt(RegisteredType item) {
-        return AssemblyTemplate.builder().
-                name(item.getDisplayName()).
-                id(item.getId()).
-                description(item.getDescription()).
-                created(root.getCreated()).
-                instantiator(BrooklynAssemblyTemplateInstantiator.class).
-                build();
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    // why can I not pass an EntitySpec<? extends Application> to    newLink(EntitySpec<?> spec)  ?
-    // feels to me (alexheneveld) that `? extends Application` should be both covariant and contravariant to `?` ..
-    // but it's not, so we introduce this conversion method
-    protected ResolvableLink<AssemblyTemplate> newApplicationLink(CatalogItem<? extends Entity, EntitySpec<? extends Application>> li) {
-        return super.newLink((CatalogItem)li);
-    }
-    
-    @Override
-    public List<ResolvableLink<AssemblyTemplate>> links() {
-        Iterable<CatalogItem<Application,EntitySpec<? extends Application>>> l = bmc.getCatalog().getCatalogItems(CatalogPredicates.IS_TEMPLATE);
-        List<ResolvableLink<AssemblyTemplate>> result = new ArrayList<ResolvableLink<AssemblyTemplate>>();
-        for (CatalogItem<Application,EntitySpec<? extends Application>> li: l)
-            result.add(newApplicationLink(li));
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java
deleted file mode 100644
index 97ad8cc..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.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 org.apache.brooklyn.camp.brooklyn.spi.lookup;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.util.net.Urls;
-
-public class BrooklynUrlLookup {
-
-    public static ConfigKey<String> BROOKLYN_ROOT_URL = ConfigKeys.newStringConfigKey("brooklyn.root.url");
-    
-    public static String getUrl(ManagementContext bmc, Entity entity) {
-        String root = bmc.getConfig().getConfig(BROOKLYN_ROOT_URL);
-        if (root==null) return null;
-        return Urls.mergePaths(root, "#/", 
-                "/v1/applications/"+entity.getApplicationId()+"/entities/"+entity.getId());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
deleted file mode 100644
index 6705b10..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.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 org.apache.brooklyn.camp.brooklyn.spi.lookup;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.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> {
-
-    public PlatformComponentBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public PlatformComponent get(String id) {
-        Entity entity = bmc.getEntityManager().getEntity(id);
-        Builder<? extends PlatformComponent> builder = PlatformComponent.builder()
-            .created(new Date(entity.getCreationTime()))
-            .id(entity.getId())
-            .name(entity.getDisplayName())
-            .externalManagementUri(BrooklynUrlLookup.getUrl(bmc, entity));
-        
-        for (Entity child: entity.getChildren())
-            // FIXME this walks the whole damn tree!
-            builder.add( get(child.getId() ));
-        return builder.build();
-    }
-
-    // platform components are not listed at the top level -- you have to walk the assemblies
-    @Override
-    public List<ResolvableLink<PlatformComponent>> links() {
-        return Collections.emptyList();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
deleted file mode 100644
index d70129a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
+++ /dev/null
@@ -1,59 +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.brooklyn.spi.lookup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-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> {
-
-    public PlatformComponentTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public PlatformComponentTemplate adapt(RegisteredType item) {
-        return PlatformComponentTemplate.builder().
-                name(item.getDisplayName()).
-                id(item.getId()).
-                description(item.getDescription()).
-                created(root.getCreated()).
-                build();
-    }
-
-    @Override
-    public List<ResolvableLink<PlatformComponentTemplate>> links() {
-        Iterable<CatalogItem<Entity,EntitySpec<?>>> l = bmc.getCatalog().getCatalogItems(CatalogPredicates.IS_ENTITY);
-        List<ResolvableLink<PlatformComponentTemplate>> result = new ArrayList<ResolvableLink<PlatformComponentTemplate>>();
-        for (CatalogItem<Entity,EntitySpec<?>> li: l)
-            result.add(newLink(li));
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
deleted file mode 100644
index 7135480..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
+++ /dev/null
@@ -1,108 +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.brooklyn.spi.platform;
-
-import org.apache.brooklyn.api.mgmt.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 org.apache.brooklyn.core.mgmt.HasBrooklynManagementContext;
-
-/** Immutable CAMP platform which reflects things in the underlying Brooklyn system */
-public class BrooklynImmutableCampPlatform extends CampPlatform implements HasBrooklynManagementContext {
-
-    private final ManagementContext bmc;
-    private final AssemblyTemplateBrooklynLookup ats;
-    private final PlatformComponentTemplateBrooklynLookup pcts;
-    private final BasicResourceLookup<ApplicationComponentTemplate> acts;
-    private final PlatformComponentBrooklynLookup pcs;
-    private final AssemblyBrooklynLookup assemblies;
-
-    public BrooklynImmutableCampPlatform(PlatformRootSummary root, ManagementContext managementContext) {
-        super(root);
-        this.bmc = managementContext;
-        
-        // these come from brooklyn
-        pcts = new PlatformComponentTemplateBrooklynLookup(root(), getBrooklynManagementContext());
-        ats = new AssemblyTemplateBrooklynLookup(root(), getBrooklynManagementContext());
-        pcs = new PlatformComponentBrooklynLookup(root(), getBrooklynManagementContext());
-        assemblies = new AssemblyBrooklynLookup(root(), getBrooklynManagementContext(), pcs);
-        
-        // ACT's are not known in brooklyn (everything comes in as config) -- to be extended to support!
-        acts = new BasicResourceLookup<ApplicationComponentTemplate>();
-    }
-
-    // --- brooklyn setup
-    
-    @Override
-    public ManagementContext getBrooklynManagementContext() {
-        return bmc;
-    }
-    
-    // --- camp comatibility setup
-    
-    @Override
-    public ResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
-        return pcts;
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
-        return acts;
-    }
-
-    @Override
-    public ResourceLookup<AssemblyTemplate> assemblyTemplates() {
-        return ats;
-    }
-    
-    @Override
-    public ResourceLookup<PlatformComponent> platformComponents() {
-        return pcs;
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponent> applicationComponents() {
-        return new EmptyResourceLookup<ApplicationComponent>();
-    }
-
-    @Override
-    public ResourceLookup<Assembly> assemblies() {
-        return assemblies;
-    }
-    
-    @Override
-    public PlatformTransaction transaction() {
-        throw new IllegalStateException(this+" does not support adding new items");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer
deleted file mode 100644
index e93291e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer
+++ /dev/null
@@ -1,19 +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.
-#
-org.apache.brooklyn.camp.brooklyn.spi.creation.CampToSpecTransformer

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
deleted file mode 100644
index 0c6fab3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
+++ /dev/null
@@ -1,19 +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.
-#
-org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
deleted file mode 100644
index 6982507..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
+++ /dev/null
@@ -1,207 +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.brooklyn;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.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.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-public class AbstractYamlRebindTest extends RebindTestFixture<StartableApplication> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractYamlTest.class);
-    protected static final String TEST_VERSION = "0.1.2";
-
-    protected BrooklynCampPlatform platform;
-    protected BrooklynCampPlatformLauncherNoServer launcher;
-    private boolean forceUpdate;
-    
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        launcher = new BrooklynCampPlatformLauncherNoServer() {
-            @Override
-            protected LocalManagementContext newMgmtContext() {
-                return (LocalManagementContext) mgmt();
-            }
-        };
-        launcher.launch();
-        platform = launcher.getCampPlatform();
-    }
-
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() throws Exception {
-        try {
-            super.tearDown();
-        } finally {
-            if (launcher != null) launcher.stopServers();
-        }
-    }
-
-    protected StartableApplication rebind(RebindOptions options) throws Exception {
-        StartableApplication result = super.rebind(options);
-        if (launcher != null) {
-            launcher.stopServers();
-            launcher = new BrooklynCampPlatformLauncherNoServer() {
-                @Override
-                protected LocalManagementContext newMgmtContext() {
-                    return (LocalManagementContext) mgmt();
-                }
-            };
-            launcher.launch();
-            platform = launcher.getCampPlatform();
-        }
-        return result;
-    }
-    
-    @Override
-    protected StartableApplication createApp() {
-        return null;
-    }
-
-    protected ManagementContext mgmt() {
-        return (newManagementContext != null) ? newManagementContext : origManagementContext;
-    }
-    
-    ///////////////////////////////////////////////////
-    // TODO code below is duplicate of AbstractYamlTest
-    ///////////////////////////////////////////////////
-    
-    protected void waitForApplicationTasks(Entity app) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
-        getLogger().info("Waiting on " + tasks.size() + " task(s)");
-        for (Task<?> t : tasks) {
-            t.blockUntilEnded();
-        }
-    }
-
-    protected Reader loadYaml(String yamlFileName, String ...extraLines) throws Exception {
-        String input = new ResourceUtils(this).getResourceAsString(yamlFileName).trim();
-        StringBuilder builder = new StringBuilder(input);
-        for (String l: extraLines)
-            builder.append("\n").append(l);
-        return new StringReader(builder.toString());
-    }
-    
-    protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
-        return createAndStartApplication(joinLines(multiLineYaml));
-    }
-    
-    protected Entity createAndStartApplication(String input) throws Exception {
-        return createAndStartApplication(new StringReader(input));
-    }
-
-    protected Entity createAndStartApplication(Reader input) throws Exception {
-        AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
-        Assembly assembly;
-        try {
-            assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-        } catch (Exception e) {
-            getLogger().warn("Unable to instantiate " + at + " (rethrowing): " + e);
-            throw e;
-        }
-        getLogger().info("Test - created " + assembly);
-        final Entity app = mgmt().getEntityManager().getEntity(assembly.getId());
-        getLogger().info("App - " + app);
-        
-        // wait for app to have started
-        Set<Task<?>> tasks = mgmt().getExecutionManager().getTasksWithAllTags(ImmutableList.of(
-                BrooklynTaskTags.EFFECTOR_TAG, 
-                BrooklynTaskTags.tagForContextEntity(app), 
-                BrooklynTaskTags.tagForEffectorCall(app, "start", ConfigBag.newInstance(ImmutableMap.of("locations", ImmutableMap.of())))));
-        Iterables.getOnlyElement(tasks).get();
-        
-        return app;
-    }
-
-    protected Entity createStartWaitAndLogApplication(Reader input) throws Exception {
-        Entity app = createAndStartApplication(input);
-        waitForApplicationTasks(app);
-
-        getLogger().info("App started:");
-        Entities.dumpInfo(app);
-        
-        return app;
-    }
-
-    protected void addCatalogItems(Iterable<String> catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String... catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected Iterable<? extends CatalogItem<?,?>> addCatalogItems(String catalogYaml) {
-        return mgmt().getCatalog().addItems(catalogYaml, forceUpdate);
-    }
-
-    protected void deleteCatalogEntity(String catalogItem) {
-        mgmt().getCatalog().deleteCatalogItem(catalogItem, TEST_VERSION);
-    }
-
-    protected Logger getLogger() {
-        return LOG;
-    }
-
-    private String joinLines(Iterable<String> catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    private String joinLines(String[] catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String ver(String id) {
-        return CatalogUtils.getVersionedId(id, TEST_VERSION);
-    }
-
-    public void forceCatalogUpdate() {
-        forceUpdate = true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
deleted file mode 100644
index 4478f2b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.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 org.apache.brooklyn.camp.brooklyn;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-import com.google.common.base.Joiner;
-
-public abstract class AbstractYamlTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractYamlTest.class);
-    protected static final String TEST_VERSION = "0.1.2";
-
-    private ManagementContext brooklynMgmt;
-    protected BrooklynCatalog catalog;
-    protected BrooklynCampPlatform platform;
-    protected BrooklynCampPlatformLauncherNoServer launcher;
-    private boolean forceUpdate;
-    
-    public AbstractYamlTest() {
-        super();
-    }
-
-    protected ManagementContext mgmt() { return brooklynMgmt; }
-    
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() {
-        forceUpdate = false;
-        launcher = new BrooklynCampPlatformLauncherNoServer() {
-            @Override
-            protected LocalManagementContext newMgmtContext() {
-                return newTestManagementContext();
-            }
-        };
-        launcher.launch();
-        brooklynMgmt = launcher.getBrooklynMgmt();
-        catalog = brooklynMgmt.getCatalog();
-        platform = launcher.getCampPlatform();
-    }
-
-    protected LocalManagementContext newTestManagementContext() {
-        // TODO they don't all need osgi, just a few do, so could speed it up by specifying when they do
-        return LocalManagementContextForTests.newInstanceWithOsgi();
-    }
-    
-    @AfterMethod(alwaysRun = true)
-    public void tearDown() {
-        if (brooklynMgmt != null) Entities.destroyAll(brooklynMgmt);
-        if (launcher != null) launcher.stopServers();
-    }
-
-    protected void waitForApplicationTasks(Entity app) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(), app);
-        getLogger().info("Waiting on " + tasks.size() + " task(s)");
-        for (Task<?> t : tasks) {
-            t.blockUntilEnded();
-        }
-    }
-
-    protected Reader loadYaml(String yamlFileName, String ...extraLines) throws Exception {
-        String input = new ResourceUtils(this).getResourceAsString(yamlFileName).trim();
-        StringBuilder builder = new StringBuilder(input);
-        for (String l: extraLines)
-            builder.append("\n").append(l);
-        return new StringReader(builder.toString());
-    }
-    
-    protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
-        return createAndStartApplication(joinLines(multiLineYaml));
-    }
-    
-    protected Entity createAndStartApplication(Reader input) throws Exception {
-        return createAndStartApplication(Streams.readFully(input));
-    }
-
-    protected Entity createAndStartApplication(String input) throws Exception {
-        return createAndStartApplication(input, MutableMap.<String,String>of());
-    }
-    protected Entity createAndStartApplication(String input, Map<String,String> startParameters) throws Exception {
-        EntitySpec<?> spec = 
-            mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, input, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class);
-        final Entity app = brooklynMgmt.getEntityManager().createEntity(spec);
-        // start the app (happens automatically if we use camp to instantiate, but not if we use crate spec approach)
-        app.invoke(Startable.START, startParameters).get();
-        return app;
-    }
-
-    protected Entity createStartWaitAndLogApplication(Reader input) throws Exception {
-        Entity app = createAndStartApplication(input);
-        waitForApplicationTasks(app);
-        getLogger().info("App started: "+app);
-        return app;
-    }
-
-    protected EntitySpec<?> createAppEntitySpec(String... yaml) {
-        return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(yaml));
-    }
-
-    protected void addCatalogItems(Iterable<String> catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String... catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String catalogYaml) {
-        mgmt().getCatalog().addItems(catalogYaml, forceUpdate);
-    }
-
-    protected void deleteCatalogEntity(String catalogItem) {
-        mgmt().getCatalog().deleteCatalogItem(catalogItem, TEST_VERSION);
-    }
-
-    protected Logger getLogger() {
-        return LOG;
-    }
-
-    protected String joinLines(Iterable<String> catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String joinLines(String... catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String ver(String id) {
-        return CatalogUtils.getVersionedId(id, TEST_VERSION);
-    }
-
-    public void forceCatalogUpdate() {
-        forceUpdate = true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
deleted file mode 100644
index c462889..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
+++ /dev/null
@@ -1,121 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.StringReader;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.api.client.repackaged.com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-@Test
-public class AppYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(AppYamlTest.class);
-
-    @Test
-    public void testAutoWrapsEntityInApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity");
-        
-        BasicApplication app = (BasicApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        @SuppressWarnings("unused")
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-    }
-    
-    @Test
-    public void testDoesNotAutoWrapApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-    }
-    
-    @Test
-    public void testWrapsAppIfNameAtTopLevelAndOnApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  name: myEntityName");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-        assertEquals(app.getChildren().size(), 0);
-    }
-    
-    @Test
-    public void testDoesNotWrapAppIfNoConflictingNameOnApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-    }
-    
-    @Test
-    public void testDoesNotWrapAppWithDefaultDisplayName() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  brooklyn.config:",
-                "    defaultDisplayName: myDefaultEntityName");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-    }
-    
-    @Test
-    public void testUsesDefaultDisplayNameIfNoOther() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  brooklyn.config:",
-                "    defaultDisplayName: myDefaultEntityName");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myDefaultEntityName");
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
deleted file mode 100644
index 374df13..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
+++ /dev/null
@@ -1,253 +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.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.camp.brooklyn.TestSensorAndEffectorInitializer.TestConfigurableInitializer;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.policy.TestEnricher;
-import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test
-public class ApplicationsYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(ApplicationsYamlTest.class);
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        // Don't need osgi
-        return LocalManagementContextForTests.newInstance();
-    }
-
-    @Test
-    public void testWrapsEntity() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicEntity.class.getName());
-        assertWrapped(app, BasicEntity.class);
-    }
-
-    @Test
-    public void testWrapsMultipleApps() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "- type: " + BasicApplication.class.getName());
-        assertTrue(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(app instanceof BasicApplication);
-        assertEquals(app.getChildren().size(), 2);
-    }
-
-    @Test
-    public void testWrapsWhenEnrichers() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.enrichers:",
-                "- type: " + TestEnricher.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsWhenPolicy() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.policies:",
-                "- type: " + TestPolicy.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsWhenInitializer() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.initializers:",
-                "- type: " + TestConfigurableInitializer.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsAppIfForced() throws Exception {
-        Entity app = createAndStartApplication(
-                "wrappedApp: true",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testDoesNotWrapApp() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, null);
-    }
-
-    @Test
-    public void testDoesNotWrapAppIfUnforced() throws Exception {
-        Entity app = createAndStartApplication(
-                "wrappedApp: false",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, null);
-    }
-    
-    @Test
-    public void testDoesNotWrapEntityIfDifferentTopLevelName() throws Exception {
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "  name: bottomLevel");
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapsEntityIfNoNameOnService() throws Exception {
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemWithDisplayName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemWithServiceName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName(),
-                "      defaultDisplayName: defaultServiceName",
-                "      displayName: explicitServiceName");
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndOverridesName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION,
-                "  name: serviceLevel");
-        assertDoesNotWrap(app, BasicApplication.class, "serviceLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndUsesCatalogName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "catalogLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndUsesCatalogServiceName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName(),
-                "      name: catalogServiceLevel");
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "catalogServiceLevel");
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-    private void assertWrapped(Entity app, Class<? extends Entity> wrappedEntityType) {
-        assertTrue(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(app instanceof BasicApplication);
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        assertTrue(wrappedEntityType.isInstance(child));
-        assertTrue(child.getChildren().isEmpty());
-    }
-
-    private void assertDoesNotWrap(Entity app, Class<? extends Application> entityType, String displayName) {
-        assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(entityType.isInstance(app));
-        if (displayName != null) {
-            assertEquals(app.getDisplayName(), displayName);
-        }
-        assertEquals(app.getChildren().size(), 0);
-    }
-    
-}


[02/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalLocationManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalLocationManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalLocationManager.java
deleted file mode 100644
index dcd1b43..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalLocationManager.java
+++ /dev/null
@@ -1,460 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.Closeable;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.location.ProvisioningLocation;
-import org.apache.brooklyn.api.mgmt.AccessController;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.BrooklynLogging;
-import org.apache.brooklyn.core.BrooklynLogging.LoggingLevel;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.objs.proxy.InternalLocationFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
-import org.apache.brooklyn.util.stream.Streams;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-
-public class LocalLocationManager implements LocationManagerInternal {
-
-    @Beta /* expect to remove when API returns LocationSpec or similar */
-    public static final ConfigKey<Boolean> CREATE_UNMANAGED = ConfigKeys.newBooleanConfigKey("brooklyn.internal.location.createUnmanaged",
-        "If set on a location or spec, causes the manager to create it in an unmanaged state (for peeking)", false);
-    
-    private static final Logger log = LoggerFactory.getLogger(LocalLocationManager.class);
-
-    private final LocalManagementContext managementContext;
-    private final InternalLocationFactory locationFactory;
-    
-    protected final Map<String,Location> locationsById = Maps.newLinkedHashMap();
-    private final Map<String, Location> preRegisteredLocationsById = Maps.newLinkedHashMap();
-
-    /** Management mode for each location */
-    protected final Map<String,ManagementTransitionMode> locationModesById = Maps.newLinkedHashMap();
-
-    private final BrooklynStorage storage;
-    private Map<String, String> locationTypes;
-
-    private static AtomicLong LOCATION_CNT = new AtomicLong(0);
-    
-    public LocalLocationManager(LocalManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-        this.locationFactory = new InternalLocationFactory(managementContext);
-        
-        this.storage = managementContext.getStorage();
-        locationTypes = storage.getMap("locations");
-    }
-
-    public InternalLocationFactory getLocationFactory() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return locationFactory;
-        
-    }
-
-    @Override
-    public <T extends Location> T createLocation(LocationSpec<T> spec) {
-        try {
-            boolean createUnmanaged = ConfigBag.coerceFirstNonNullKeyValue(CREATE_UNMANAGED, 
-                spec.getConfig().get(CREATE_UNMANAGED), spec.getFlags().get(CREATE_UNMANAGED.getName()));
-            if (createUnmanaged) {
-                spec.removeConfig(CREATE_UNMANAGED);
-            }
-
-            T loc = locationFactory.createLocation(spec);
-            if (!createUnmanaged) {
-                manage(loc);
-            } else {
-                // remove references
-                Location parent = loc.getParent();
-                if (parent!=null) {
-                    ((AbstractLocation)parent).removeChild(loc);
-                }
-                preRegisteredLocationsById.remove(loc.getId());
-            }
-            
-            return loc;
-        } catch (Throwable e) {
-            log.warn("Failed to create location using spec "+spec+" (rethrowing)", e);
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    @Override
-    public <T extends Location> T createLocation(Map<?,?> config, Class<T> type) {
-        return createLocation(LocationSpec.create(config, type));
-    }
-
-    @Override
-    public synchronized Collection<Location> getLocations() {
-        return ImmutableList.copyOf(locationsById.values());
-    }
-    
-    @Override
-    public Collection<String> getLocationIds() {
-        return ImmutableList.copyOf(locationsById.keySet());
-    }
-
-    @Override
-    public synchronized Location getLocation(String id) {
-        return locationsById.get(id);
-    }
-    
-    public synchronized Location getLocationEvenIfPreManaged(String id) {
-        Location result = locationsById.get(id);
-        if (result == null) {
-            result = preRegisteredLocationsById.get(id);
-        }
-        return result;
-    }
-    
-    @Override
-    public boolean isManaged(Location loc) {
-        return (isRunning() && loc != null && getLocation(loc.getId()) != null);
-    }
-    
-    synchronized boolean isPreRegistered(Location loc) {
-        return preRegisteredLocationsById.containsKey(loc.getId());
-    }
-    
-    public boolean isKnownLocationId(String id) {
-        return preRegisteredLocationsById.containsKey(id) || locationsById.containsKey(id);
-    }
-    
-    synchronized void prePreManage(Location loc) {
-        if (isPreRegistered(loc)) {
-            log.warn(""+this+" redundant call to pre-pre-manage location "+loc+"; skipping", 
-                    new Exception("source of duplicate pre-pre-manage of "+loc));
-            return;
-        }
-        preRegisteredLocationsById.put(loc.getId(), loc);
-    }
-    
-    @Override
-    public ManagementTransitionMode getLastManagementTransitionMode(String itemId) {
-        return locationModesById.get(itemId);
-    }
-    
-    @Override
-    public void setManagementTransitionMode(Location item, ManagementTransitionMode mode) {
-        locationModesById.put(item.getId(), mode);
-    }
-
-    // TODO synchronization issues here: see comment in LocalEntityManager.manage(Entity)
-    /** management on creation */
-    @Override
-    public Location manage(Location loc) {
-        if (isManaged(loc)) {
-            // TODO put log.warn back in if/when manage(Location) becomes private; or could even have assert.
-            // Can be stricter about contract.
-            return loc;
-        }
-        
-        Location parent = loc.getParent();
-        if (parent != null && !managementContext.getLocationManager().isManaged(parent)) {
-            log.warn("Parent location "+parent+" of "+loc+" is not managed; attempting to manage it (in future this may be disallowed)");
-            return manage(parent);
-        } else {
-            return manageRecursive(loc, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY));
-        }
-    }
-    
-    @Override
-    public void manageRebindedRoot(Location item) {
-        ManagementTransitionMode mode = getLastManagementTransitionMode(item.getId());
-        Preconditions.checkNotNull(mode, "Mode not set for rebinding %s", item);
-        manageRecursive(item, mode);
-    }
-
-    protected void checkManagementAllowed(Location item) {
-        AccessController.Response access = managementContext.getAccessController().canManageLocation(item);
-        if (!access.isAllowed()) {
-            throw new IllegalStateException("Access controller forbids management of "+item+": "+access.getMsg());
-        }        
-    }
-
-    protected Location manageRecursive(Location loc, final ManagementTransitionMode initialMode) {
-        // TODO see comments in LocalEntityManager about recursive management / manageRebindRoot v manageAll
-        
-        AccessController.Response access = managementContext.getAccessController().canManageLocation(loc);
-        if (!access.isAllowed()) {
-            throw new IllegalStateException("Access controller forbids management of "+loc+": "+access.getMsg());
-        }
-
-        long count = LOCATION_CNT.incrementAndGet();
-        if (log.isDebugEnabled()) {
-            String msg = "Managing location " + loc + " ("+initialMode+"), from " + Tasks.current()+" / "+Entitlements.getEntitlementContext();
-            LoggingLevel level = (!initialMode.wasNotLoaded() || initialMode.isReadOnly() ? LoggingLevel.TRACE : LoggingLevel.DEBUG);
-            if (count % 100 == 0) {
-                // include trace periodically in case we get leaks or too much location management
-                BrooklynLogging.log(log, level,
-                    msg, new Exception("Informational stack trace of call to manage location "+loc+" ("+count+" calls; "+getLocations().size()+" currently managed)"));
-            } else {
-                BrooklynLogging.log(log, level, msg);
-            }
-        }
-
-        recursively(loc, new Predicate<AbstractLocation>() { public boolean apply(AbstractLocation it) {
-            ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId());
-            if (mode==null) {
-                setManagementTransitionMode(it, mode = initialMode);
-            }
-            
-            if (it.isManaged()) {
-                if (mode.wasNotLoaded()) {
-                    // silently bail out
-                    return false;
-                } else {
-                    // on rebind, we just replace, fall through to below
-                }
-            }
-            
-            boolean result = manageNonRecursive(it, mode);
-            if (result) {
-                it.setManagementContext(managementContext);
-                if (mode.isPrimary()) {
-                    it.onManagementStarted();
-                    if (mode.isCreating()) {
-                        // Never record event on rebind; this isn't the location (e.g. the VM) being "created"
-                        // so don't tell listeners that.
-                        // TODO The location-event history should be persisted; currently it is lost on
-                        // rebind, unless there is a listener that is persisting the state externally itself.
-                        recordLocationEvent(it, Lifecycle.CREATED);
-                    }
-                }
-                managementContext.getRebindManager().getChangeListener().onManaged(it);
-            }
-            return result;
-        } });
-        return loc;
-    }
-    
-    @Override
-    public void unmanage(final Location loc) {
-        unmanage(loc, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.MANAGED_PRIMARY, BrooklynObjectManagementMode.NONEXISTENT));
-    }
-    
-    public void unmanage(final Location loc, final ManagementTransitionMode mode) {
-        unmanage(loc, mode, false);
-    }
-    
-    private void unmanage(final Location loc, final ManagementTransitionMode mode, boolean hasBeenReplaced) {
-        if (shouldSkipUnmanagement(loc)) return;
-
-        if (hasBeenReplaced) {
-            // we are unmanaging an old instance after having replaced it; 
-            // don't unmanage or even clear its fields, because there might be references to it
-            
-            if (mode.wasReadOnly()) {
-                // if coming *from* read only; nothing needed
-            } else {
-                if (!mode.wasPrimary()) {
-                    log.warn("Unexpected mode "+mode+" for unmanage-replace "+loc+" (applying anyway)");
-                }
-                // migrating away or in-place active partial rebind:
-                managementContext.getRebindManager().getChangeListener().onUnmanaged(loc);
-                if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc);
-            }
-            // do not remove from maps below, bail out now
-            return;
-
-        } else if ((mode.wasPrimary() && mode.isReadOnly()) || (mode.wasReadOnly() && mode.isNoLongerLoaded())) {
-            if (mode.isReadOnly() && mode.wasPrimary()) {
-                // TODO shouldn't this fall into "hasBeenReplaced" above?
-                log.debug("Unmanaging on demotion: "+loc+" ("+mode+")");
-            }
-            // we are unmanaging an instance whose primary management is elsewhere (either we were secondary, or we are being demoted)
-            unmanageNonRecursiveRemoveFromRecords(loc, mode);
-            managementContext.getRebindManager().getChangeListener().onUnmanaged(loc);
-            if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc);
-            unmanageNonRecursiveClearItsFields(loc, mode);
-            
-        } else if (mode.isNoLongerLoaded()) {
-            // Need to store all child entities as onManagementStopping removes a child from the parent entity
-            
-            // As above, see TODO in LocalEntityManager about recursive management / unmanagement v manageAll/unmanageAll
-            recursively(loc, new Predicate<AbstractLocation>() { public boolean apply(AbstractLocation it) {
-                if (shouldSkipUnmanagement(it)) return false;
-                boolean result = unmanageNonRecursiveRemoveFromRecords(it, mode);
-                if (result) {
-                    ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId());
-                    if (mode==null) {
-                        // ad hoc creation e.g. tests
-                        log.debug("Missing transition mode for "+it+" when unmanaging; assuming primary/destroying");
-                        mode = ManagementTransitionMode.guessing(BrooklynObjectManagementMode.MANAGED_PRIMARY, BrooklynObjectManagementMode.NONEXISTENT);
-                    }
-                    if (mode.wasPrimary()) it.onManagementStopped();
-                    managementContext.getRebindManager().getChangeListener().onUnmanaged(it);
-                    if (mode.isDestroying()) recordLocationEvent(it, Lifecycle.DESTROYED);
-                    if (managementContext.gc != null) managementContext.gc.onUnmanaged(it);
-                }
-                unmanageNonRecursiveClearItsFields(loc, mode);
-                return result;
-            } });
-            
-        } else {
-            log.warn("Invalid mode for unmanage: "+mode+" on "+loc+" (ignoring)");
-        }
-        
-        if (loc instanceof Closeable) {
-            Streams.closeQuietly( (Closeable)loc );
-        }
-        
-        locationsById.remove(loc.getId());
-        preRegisteredLocationsById.remove(loc.getId());
-        locationModesById.remove(loc.getId());
-        locationTypes.remove(loc.getId());
-    }
-    
-    /**
-     * Adds this location event to the usage record for the given location (creating the usage 
-     * record if one does not already exist).
-     */
-    private void recordLocationEvent(LocationInternal loc, Lifecycle state) {
-        try {
-            managementContext.getUsageManager().recordLocationEvent(loc, state);
-        } catch (RuntimeInterruptedException e) {
-            throw e;
-        } catch (RuntimeException e) {
-            log.warn("Failed to store location lifecycle event for "+loc+" (ignoring)", e);
-        }
-    }
-
-    private void recursively(Location e, Predicate<AbstractLocation> action) {
-        boolean success = action.apply( (AbstractLocation)e );
-        if (!success) {
-            return; // Don't manage children if action false/unnecessary for parent
-        }
-        for (Location child : e.getChildren()) {
-            recursively(child, action);
-        }
-    }
-
-    /**
-     * Should ensure that the location is now managed somewhere, and known about in all the lists.
-     * Returns true if the location has now become managed; false if it was already managed (anything else throws exception)
-     * @param rebindPrimary true if rebinding primary, false if rebinding as copy, null if creating (not rebinding)
-     */
-    private synchronized boolean manageNonRecursive(Location loc, ManagementTransitionMode mode) {
-        Location old = locationsById.put(loc.getId(), loc);
-        preRegisteredLocationsById.remove(loc.getId());
-
-        locationTypes.put(loc.getId(), loc.getClass().getName());
-        
-        if (old!=null && mode.wasNotLoaded()) {
-            if (old.equals(loc)) {
-                log.warn("{} redundant call to start management of location {}", this, loc);
-            } else {
-                throw new IllegalStateException("call to manage location "+loc+" but different location "+old+" already known under that id at "+this);
-            }
-            return false;
-        }
-
-        if (old!=null && old!=loc) {
-            // passing the transition info will ensure the right shutdown steps invoked for old instance
-            unmanage(old, mode, true);
-        }
-        
-        return true;
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    private synchronized void unmanageNonRecursiveClearItsFields(Location loc, ManagementTransitionMode mode) {
-        if (mode.isDestroying()) {
-            ((AbstractLocation)loc).setParent(null, true);
-            
-            Location parent = ((AbstractLocation)loc).getParent();
-            if (parent instanceof ProvisioningLocation<?>) {
-                try {
-                    ((ProvisioningLocation)parent).release(loc);
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.debug("Error releasing "+loc+" in its parent "+parent+": "+e);
-                }
-            }
-        } else {
-            // if not destroying, don't change the parent's children list
-            ((AbstractLocation)loc).setParent(null, false);
-        }
-        // clear config to help with GC; i know you're not supposed to, but this seems to help, else config bag is littered with refs to entities etc
-        // FIXME relies on config().getLocalBag() returning the underlying bag!
-        ((AbstractLocation)loc).config().getLocalBag().clear();
-    }
-    
-    /**
-     * Should ensure that the location is no longer managed anywhere, remove from all lists.
-     * Returns true if the location has been removed from management; if it was not previously managed (anything else throws exception) 
-     */
-    private synchronized boolean unmanageNonRecursiveRemoveFromRecords(Location loc, ManagementTransitionMode mode) {
-        Object old = locationsById.remove(loc.getId());
-        locationTypes.remove(loc.getId());
-        locationModesById.remove(loc.getId());
-        
-        if (old==null) {
-            log.warn("{} call to stop management of unknown location (already unmanaged?) {}; ignoring", this, loc);
-            return false;
-        } else if (!old.equals(loc)) {
-            // shouldn't happen...
-            log.error("{} call to stop management of location {} removed different location {}; ignoring", new Object[] { this, loc, old });
-            return true;
-        } else {
-            if (log.isDebugEnabled()) log.debug("{} stopped management of location {}", this, loc);
-            return true;
-        }
-    }
-
-    private boolean shouldSkipUnmanagement(Location loc) {
-        if (loc==null) {
-            log.warn(""+this+" call to unmanage null location; skipping",  
-                new IllegalStateException("source of null unmanagement call to "+this));
-            return true;
-        }
-        if (!isManaged(loc)) {
-            log.warn("{} call to stop management of unknown location (already unmanaged?) {}; skipping, and all descendants", this, loc);
-            return true;
-        }
-        return false;
-    }
-    
-    private boolean isRunning() {
-        return managementContext.isRunning();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalManagementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalManagementContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalManagementContext.java
deleted file mode 100644
index 76500bc..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalManagementContext.java
+++ /dev/null
@@ -1,433 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.elvis;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.AccessController;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ExecutionManager;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.mgmt.TaskAdaptable;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.entity.drivers.downloads.BasicDownloadsManager;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.internal.BrooklynProperties.Factory.Builder;
-import org.apache.brooklyn.core.internal.storage.DataGridFactory;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
-import org.apache.brooklyn.core.objs.proxy.InternalEntityFactory;
-import org.apache.brooklyn.core.objs.proxy.InternalLocationFactory;
-import org.apache.brooklyn.core.objs.proxy.InternalPolicyFactory;
-import org.apache.brooklyn.util.core.task.BasicExecutionContext;
-import org.apache.brooklyn.util.core.task.BasicExecutionManager;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * A local (single node) implementation of the {@link ManagementContext} API.
- */
-public class LocalManagementContext extends AbstractManagementContext {
-    
-    private static final Logger log = LoggerFactory.getLogger(LocalManagementContext.class);
-
-    private static final Set<LocalManagementContext> INSTANCES = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<LocalManagementContext, Boolean>()));
-    
-    private final Builder builder;
-    
-    private final List<ManagementContext.PropertiesReloadListener> reloadListeners = new CopyOnWriteArrayList<ManagementContext.PropertiesReloadListener>();
-
-    @VisibleForTesting
-    static Set<LocalManagementContext> getInstances() {
-        synchronized (INSTANCES) {
-            return ImmutableSet.copyOf(INSTANCES);
-        }
-    }
-
-    // Note also called reflectively by BrooklynLeakListener
-    public static void logAll(Logger logger){
-        for (LocalManagementContext context : getInstances()) {
-            logger.warn("Management Context "+context+" running, creation stacktrace:\n" + Throwables.getStackTraceAsString(context.constructionStackTrace));
-        }
-    }
-
-    /** terminates all (best effort); returns count of sessions closed; if exceptions thrown, returns negative number.
-     * semantics might change, particular in dealing with interminable mgmt contexts. */
-    // Note also called reflectively by BrooklynLeakListener
-    @Beta
-    public static int terminateAll() {
-        int closed=0,dangling=0;
-        for (LocalManagementContext context : getInstances()) {
-            try {
-                context.terminate();
-                closed++;
-            }catch (Throwable t) {
-                Exceptions.propagateIfFatal(t);
-                log.warn("Failed to terminate management context", t);
-                dangling++;
-            }
-        }
-        if (dangling>0) return -dangling;
-        return closed;
-    }
-
-    private AtomicBoolean terminated = new AtomicBoolean(false);
-    private String managementPlaneId;
-    private String managementNodeId;
-    private BasicExecutionManager execution;
-    private SubscriptionManager subscriptions;
-    private LocalEntityManager entityManager;
-    private final LocalLocationManager locationManager;
-    private final LocalAccessManager accessManager;
-    private final LocalUsageManager usageManager;
-    private OsgiManager osgiManager;
-    
-    public final Throwable constructionStackTrace = new Throwable("for construction stacktrace").fillInStackTrace();
-    
-    private final Map<String, Object> brooklynAdditionalProperties;
-
-    /**
-     * Creates a LocalManagement with default BrooklynProperties.
-     */
-    public LocalManagementContext() {
-        this(BrooklynProperties.Factory.builderDefault());
-    }
-
-    public LocalManagementContext(BrooklynProperties brooklynProperties) {
-        this(brooklynProperties, (DataGridFactory)null);
-    }
-
-    /**
-     * Creates a new LocalManagementContext.
-     *
-     * @param brooklynProperties the BrooklynProperties.
-     * @param datagridFactory the DataGridFactory to use. If this instance is null, it means that the system
-     *                        is going to use BrooklynProperties to figure out which instance to load or otherwise
-     *                        use a default instance.
-     */
-    @VisibleForTesting
-    public LocalManagementContext(BrooklynProperties brooklynProperties, DataGridFactory datagridFactory) {
-        this(Builder.fromProperties(brooklynProperties), datagridFactory);
-    }
-    
-    public LocalManagementContext(Builder builder) {
-        this(builder, null, null);
-    }
-    
-    public LocalManagementContext(Builder builder, DataGridFactory datagridFactory) {
-        this(builder, null, datagridFactory);
-    }
-
-    public LocalManagementContext(Builder builder, Map<String, Object> brooklynAdditionalProperties) {
-        this(builder, brooklynAdditionalProperties, null);
-    }
-    
-    public LocalManagementContext(BrooklynProperties brooklynProperties, Map<String, Object> brooklynAdditionalProperties) {
-        this(Builder.fromProperties(brooklynProperties), brooklynAdditionalProperties, null);
-    }
-    
-    public LocalManagementContext(Builder builder, Map<String, Object> brooklynAdditionalProperties, DataGridFactory datagridFactory) {
-        super(builder.build(), datagridFactory);
-        
-        checkNotNull(configMap, "brooklynProperties");
-        
-        // TODO in a persisted world the planeId may be injected
-        this.managementPlaneId = Strings.makeRandomId(8);
-        this.managementNodeId = Strings.makeRandomId(8);
-        this.builder = builder;
-        this.brooklynAdditionalProperties = brooklynAdditionalProperties;
-        if (brooklynAdditionalProperties != null)
-            configMap.addFromMap(brooklynAdditionalProperties);
-        
-        BrooklynFeatureEnablement.init(configMap);
-        
-        this.locationManager = new LocalLocationManager(this);
-        this.accessManager = new LocalAccessManager();
-        this.usageManager = new LocalUsageManager(this);
-        
-        if (configMap.getConfig(OsgiManager.USE_OSGI)) {
-            this.osgiManager = new OsgiManager(this);
-            osgiManager.start();
-        }
-        
-        INSTANCES.add(this);
-        log.debug("Created management context "+this);
-    }
-
-    @Override
-    public String getManagementPlaneId() {
-        return managementPlaneId;
-    }
-    
-    @Override
-    public String getManagementNodeId() {
-        return managementNodeId;
-    }
-    
-    @Override
-    public void prePreManage(Entity entity) {
-        getEntityManager().prePreManage(entity);
-    }
-
-    @Override
-    public void prePreManage(Location location) {
-        getLocationManager().prePreManage(location);
-    }
-
-    @Override
-    public synchronized Collection<Application> getApplications() {
-        return getEntityManager().getApplications();
-    }
-
-    @Override
-    public void addEntitySetListener(CollectionChangeListener<Entity> listener) {
-        getEntityManager().addEntitySetListener(listener);
-    }
-
-    @Override
-    public void removeEntitySetListener(CollectionChangeListener<Entity> listener) {
-        getEntityManager().removeEntitySetListener(listener);
-    }
-
-    @Override
-    protected void manageIfNecessary(Entity entity, Object context) {
-        getEntityManager().manageIfNecessary(entity, context);
-    }
-
-    @Override
-    public synchronized LocalEntityManager getEntityManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-
-        if (entityManager == null) {
-            entityManager = new LocalEntityManager(this);
-        }
-        return entityManager;
-    }
-
-    @Override
-    public InternalEntityFactory getEntityFactory() {
-        return getEntityManager().getEntityFactory();
-    }
-
-    @Override
-    public InternalLocationFactory getLocationFactory() {
-        return getLocationManager().getLocationFactory();
-    }
-
-    @Override
-    public InternalPolicyFactory getPolicyFactory() {
-        return getEntityManager().getPolicyFactory();
-    }
-
-    @Override
-    public synchronized LocalLocationManager getLocationManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return locationManager;
-    }
-
-    @Override
-    public synchronized LocalAccessManager getAccessManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return accessManager;
-    }
-
-    @Override
-    public synchronized LocalUsageManager getUsageManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        return usageManager;
-    }
-    
-    @Override
-    public synchronized Maybe<OsgiManager> getOsgiManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-        if (osgiManager==null) return Maybe.absent("OSGi not available in this instance"); 
-        return Maybe.of(osgiManager);
-    }
-
-    @Override
-    public synchronized AccessController getAccessController() {
-        return getAccessManager().getAccessController();
-    }
-    
-    @Override
-    public synchronized  SubscriptionManager getSubscriptionManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-
-        if (subscriptions == null) {
-            subscriptions = new LocalSubscriptionManager(getExecutionManager());
-        }
-        return subscriptions;
-    }
-
-    @Override
-    public synchronized ExecutionManager getExecutionManager() {
-        if (!isRunning()) throw new IllegalStateException("Management context no longer running");
-
-        if (execution == null) {
-            execution = new BasicExecutionManager(getManagementNodeId());
-            gc = new BrooklynGarbageCollector(configMap, execution, getStorage());
-        }
-        return execution;
-    }
-    
-    @Override
-    public void terminate() {
-        synchronized (terminated) {
-            if (terminated.getAndSet(true)) {
-                log.trace("Already terminated management context "+this);
-                // no harm in doing it twice, but it makes logs ugly!
-                return;
-            }
-            log.debug("Terminating management context "+this);
-            
-            INSTANCES.remove(this);
-            super.terminate();
-            if (osgiManager!=null) {
-                osgiManager.stop();
-                osgiManager = null;
-            }
-            if (usageManager != null) usageManager.terminate();
-            if (execution != null) execution.shutdownNow();
-            if (gc != null) gc.shutdownNow();
-            
-            log.debug("Terminated management context "+this);
-        }
-    }
-
-    @Override
-    protected void finalize() {
-        terminate();
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    @Override
-    public <T> Task<T> runAtEntity(Map flags, Entity entity, Callable<T> c) {
-        manageIfNecessary(entity, elvis(Arrays.asList(flags.get("displayName"), flags.get("description"), flags, c)));
-        return runAtEntity(entity, Tasks.<T>builder().dynamic(true).body(c).flags(flags).build());
-    }
-
-    protected <T> Task<T> runAtEntity(Entity entity, TaskAdaptable<T> task) {
-        getExecutionContext(entity).submit(task);
-        if (DynamicTasks.getTaskQueuingContext()!=null) {
-            // put it in the queueing context so it appears in the GUI
-            // mark it inessential as this is being invoked from code,
-            // the caller will do 'get' to handle errors
-            TaskTags.markInessential(task);
-            DynamicTasks.getTaskQueuingContext().queue(task.asTask());
-        }
-        return task.asTask();
-    }
-    
-    @Override
-    protected <T> Task<T> runAtEntity(final Entity entity, final Effector<T> eff, @SuppressWarnings("rawtypes") final Map parameters) {
-        manageIfNecessary(entity, eff);
-        // prefer to submit this from the current execution context so it sets up correct cross-context chaining
-        ExecutionContext ec = BasicExecutionContext.getCurrentExecutionContext();
-        if (ec == null) {
-            log.debug("Top-level effector invocation: {} on {}", eff, entity);
-            ec = getExecutionContext(entity);
-        }
-        return runAtEntity(entity, Effectors.invocation(entity, eff, parameters));
-    }
-
-    @Override
-    public boolean isManagedLocally(Entity e) {
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return LocalManagementContext.class.getSimpleName()+"["+getManagementPlaneId()+"-"+getManagementNodeId()+"]";
-    }
-
-    @Override
-    public void reloadBrooklynProperties() {
-        log.info("Reloading brooklyn properties from " + builder);
-        if (builder.hasDelegateOriginalProperties())
-            log.warn("When reloading, mgmt context "+this+" properties are fixed, so reload will be of limited utility");
-        
-        BrooklynProperties properties = builder.build();
-        configMap = new DeferredBrooklynProperties(properties, this);
-        if (brooklynAdditionalProperties != null) {
-            log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties);
-            configMap.addFromMap(brooklynAdditionalProperties);
-        }
-        this.downloadsManager = BasicDownloadsManager.newDefault(configMap);
-        this.entitlementManager = Entitlements.newManager(this, configMap);
-        
-        clearLocationRegistry();
-        
-        BrooklynFeatureEnablement.init(configMap);
-        
-        // Notify listeners that properties have been reloaded
-        for (PropertiesReloadListener listener : reloadListeners) {
-            listener.reloaded();
-        }
-    }
-
-    @VisibleForTesting
-    public void clearLocationRegistry() {
-        // Force reload of location registry
-        this.locationRegistry = null;
-    }
-
-    @Override
-    public void addPropertiesReloadListener(PropertiesReloadListener listener) {
-        reloadListeners.add(checkNotNull(listener, "listener"));
-    }
-
-    @Override
-    public void removePropertiesReloadListener(PropertiesReloadListener listener) {
-        reloadListeners.remove(listener);
-    }
-
-    public void noteStartupComplete() {
-        startupComplete = true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java
deleted file mode 100644
index 7743995..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java
+++ /dev/null
@@ -1,330 +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.core.mgmt.internal;
-
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.elvis;
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.groovyTruth;
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.join;
-import static org.apache.brooklyn.util.JavaGroovyEquivalents.mapOf;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ExecutionManager;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.mgmt.SubscriptionManager;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.sensor.BasicSensorEvent;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.BasicExecutionManager;
-import org.apache.brooklyn.util.core.task.SingleThreadedScheduler;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimaps;
-
-/**
- * A {@link SubscriptionManager} that stores subscription details locally.
- */
-public class LocalSubscriptionManager extends AbstractSubscriptionManager {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(LocalSubscriptionManager.class);
-
-    protected final ExecutionManager em;
-    
-    private final String tostring = "SubscriptionContext("+Identifiers.getBase64IdFromValue(System.identityHashCode(this), 5)+")";
-
-    private final AtomicLong totalEventsPublishedCount = new AtomicLong();
-    private final AtomicLong totalEventsDeliveredCount = new AtomicLong();
-    
-    @SuppressWarnings("rawtypes")
-    protected final ConcurrentMap<String, Subscription> allSubscriptions = new ConcurrentHashMap<String, Subscription>();
-    @SuppressWarnings("rawtypes")
-    protected final ConcurrentMap<Object, Set<Subscription>> subscriptionsBySubscriber = new ConcurrentHashMap<Object, Set<Subscription>>();
-    @SuppressWarnings("rawtypes")
-    protected final ConcurrentMap<Object, Set<Subscription>> subscriptionsByToken = new ConcurrentHashMap<Object, Set<Subscription>>();
-    
-    public LocalSubscriptionManager(ExecutionManager m) {
-        this.em = m;
-    }
-        
-    public long getNumSubscriptions() {
-        return allSubscriptions.size();
-    }
-
-    public long getTotalEventsPublished() {
-        return totalEventsPublishedCount.get();
-    }
-    
-    public long getTotalEventsDelivered() {
-        return totalEventsDeliveredCount.get();
-    }
-    
-    @SuppressWarnings("unchecked")
-    protected synchronized <T> SubscriptionHandle subscribe(Map<String, Object> flags, final Subscription<T> s) {
-        Entity producer = s.producer;
-        Sensor<T> sensor= s.sensor;
-        s.subscriber = getSubscriber(flags, s);
-        if (flags.containsKey("subscriberExecutionManagerTag")) {
-            s.subscriberExecutionManagerTag = flags.remove("subscriberExecutionManagerTag");
-            s.subscriberExecutionManagerTagSupplied = true;
-        } else {
-            s.subscriberExecutionManagerTag = 
-                s.subscriber instanceof Entity ? "subscription-delivery-entity-"+((Entity)s.subscriber).getId()+"["+s.subscriber+"]" : 
-                s.subscriber instanceof String ? "subscription-delivery-string["+s.subscriber+"]" : 
-                "subscription-delivery-object["+s.subscriber+"]";
-            s.subscriberExecutionManagerTagSupplied = false;
-        }
-        s.eventFilter = (Predicate<SensorEvent<T>>) flags.remove("eventFilter");
-        boolean notifyOfInitialValue = Boolean.TRUE.equals(flags.remove("notifyOfInitialValue"));
-        s.flags = flags;
-        
-        if (LOG.isDebugEnabled()) LOG.debug("Creating subscription {} for {} on {} {} in {}", new Object[] {s.id, s.subscriber, producer, sensor, this});
-        allSubscriptions.put(s.id, s);
-        addToMapOfSets(subscriptionsByToken, makeEntitySensorToken(s.producer, s.sensor), s);
-        if (s.subscriber!=null) {
-            addToMapOfSets(subscriptionsBySubscriber, s.subscriber, s);
-        }
-        if (!s.subscriberExecutionManagerTagSupplied && s.subscriberExecutionManagerTag!=null) {
-            ((BasicExecutionManager) em).setTaskSchedulerForTag(s.subscriberExecutionManagerTag, SingleThreadedScheduler.class);
-        }
-
-        if (notifyOfInitialValue) {
-            if (producer == null) {
-                LOG.warn("Cannot notifyOfInitialValue for subscription with wildcard producer: "+s);
-            } else if (sensor == null) {
-                LOG.warn("Cannot notifyOfInitialValue for subscription with wilcard sensor: "+s);
-            } else if (!(sensor instanceof AttributeSensor)) {
-                LOG.warn("Cannot notifyOfInitialValue for subscription with non-attribute sensor: "+s);
-            } else {
-                if (LOG.isTraceEnabled()) LOG.trace("sending initial value of {} -> {} to {}", new Object[] {s.producer, s.sensor, s});
-                Map<String, Object> tagsMap = MutableMap.of("tag", s.subscriberExecutionManagerTag);
-                em.submit(tagsMap, new Runnable() {
-                    @Override
-                    public String toString() {
-                        return "LSM.publishInitialValue("+s.producer+", "+s.sensor+")";
-                    }
-                    public void run() {
-                        Object val = s.producer.getAttribute((AttributeSensor<?>) s.sensor);
-                        @SuppressWarnings("rawtypes") // TODO s.listener.onEvent gives compilation error if try to use <T>
-                        SensorEvent event = new BasicSensorEvent(s.sensor, s.producer, val);
-                        if (s.eventFilter!=null && !s.eventFilter.apply(event))
-                            return;
-                        try {
-                            s.listener.onEvent(event);
-                        } catch (Throwable t) {
-                            if (event!=null && event.getSource()!=null && Entities.isNoLongerManaged(event.getSource())) {
-                                LOG.debug("Error processing initial-value subscription to "+LocalSubscriptionManager.this+", after entity unmanaged: "+t, t);
-                            } else {
-                                LOG.warn("Error processing initial-value subscription to "+LocalSubscriptionManager.this+": "+t, t);
-                            }
-                        }
-                    }});
-            }
-        }
-        
-        return s;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Set<SubscriptionHandle> getSubscriptionsForSubscriber(Object subscriber) {
-        return (Set<SubscriptionHandle>) ((Set<?>) elvis(subscriptionsBySubscriber.get(subscriber), Collections.emptySet()));
-    }
-
-    public synchronized Set<SubscriptionHandle> getSubscriptionsForEntitySensor(Entity source, Sensor<?> sensor) {
-        Set<SubscriptionHandle> subscriptions = new LinkedHashSet<SubscriptionHandle>();
-        subscriptions.addAll(elvis(subscriptionsByToken.get(makeEntitySensorToken(source, sensor)), Collections.emptySet()));
-        subscriptions.addAll(elvis(subscriptionsByToken.get(makeEntitySensorToken(null, sensor)), Collections.emptySet()));
-        subscriptions.addAll(elvis(subscriptionsByToken.get(makeEntitySensorToken(source, null)), Collections.emptySet()));
-        subscriptions.addAll(elvis(subscriptionsByToken.get(makeEntitySensorToken(null, null)), Collections.emptySet()));
-        return subscriptions;
-    }
-
-    /**
-     * Unsubscribe the given subscription id.
-     *
-     * @see #subscribe(Map, Entity, Sensor, SensorEventListener)
-     */
-    @SuppressWarnings("rawtypes")
-    public synchronized boolean unsubscribe(SubscriptionHandle sh) {
-        if (!(sh instanceof Subscription)) throw new IllegalArgumentException("Only subscription handles of type Subscription supported: sh="+sh+"; type="+(sh != null ? sh.getClass().getCanonicalName() : null));
-        Subscription s = (Subscription) sh;
-        boolean result = allSubscriptions.remove(s.id) != null;
-        boolean b2 = removeFromMapOfCollections(subscriptionsByToken, makeEntitySensorToken(s.producer, s.sensor), s);
-        assert result==b2;
-        if (s.subscriber!=null) {
-            boolean b3 = removeFromMapOfCollections(subscriptionsBySubscriber, s.subscriber, s);
-            assert b3 == b2;
-        }
-
-        // FIXME ALEX - this seems wrong
-        ((BasicExecutionManager) em).setTaskSchedulerForTag(s.subscriberExecutionManagerTag, SingleThreadedScheduler.class);
-        return result;
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public <T> void publish(final SensorEvent<T> event) {
-        // REVIEW 1459 - execution
-        
-        // delivery in parallel/background, using execution manager
-        
-        // subscriptions, should define SingleThreadedScheduler for any subscriber ID tag
-        // in order to ensure callbacks are invoked in the order they are submitted
-        // (recommend exactly one per subscription to prevent deadlock)
-        // this is done with:
-        // em.setTaskSchedulerForTag(subscriberId, SingleThreadedScheduler.class);
-        
-        //note, generating the notifications must be done in the calling thread to preserve order
-        //e.g. emit(A); emit(B); should cause onEvent(A); onEvent(B) in that order
-        if (LOG.isTraceEnabled()) LOG.trace("{} got event {}", this, event);
-        totalEventsPublishedCount.incrementAndGet();
-        
-        Set<Subscription> subs = (Set<Subscription>) ((Set<?>) getSubscriptionsForEntitySensor(event.getSource(), event.getSensor()));
-        if (groovyTruth(subs)) {
-            if (LOG.isTraceEnabled()) LOG.trace("sending {}, {} to {}", new Object[] {event.getSensor().getName(), event, join(subs, ",")});
-            for (Subscription s : subs) {
-                if (s.eventFilter!=null && !s.eventFilter.apply(event))
-                    continue;
-                final Subscription sAtClosureCreation = s;
-                
-//                Set<Object> tags = MutableSet.of();
-//                if (s.subscriberExecutionManagerTag!=null) tags.add(s.subscriberExecutionManagerTag);
-//                if (event.getSource()!=null) tags.add(BrooklynTaskTags.tagForContextEntity(event.getSource()));
-//                Map<String, Object> tagsMap = mapOf("tags", (Object)tags);
-                // use code above, instead of line below, if we want subscription deliveries associated with the entity;
-                // that will cause them to be cancelled when the entity is unmanaged
-                // (not sure that is useful, and likely NOT worth the expense, but it might be...) -Alex Oct 2014
-                Map<String, Object> tagsMap = mapOf("tag", s.subscriberExecutionManagerTag);
-                
-                em.submit(tagsMap, new Runnable() {
-                    @Override
-                    public String toString() {
-                        return "LSM.publish("+event+")";
-                    }
-                    public void run() {
-                        try {
-                            sAtClosureCreation.listener.onEvent(event);
-                        } catch (Throwable t) {
-                            if (event!=null && event.getSource()!=null && Entities.isNoLongerManaged(event.getSource())) {
-                                LOG.debug("Error processing subscriptions to "+this+", after entity unmanaged: "+t, t);
-                            } else {
-                                LOG.warn("Error processing subscriptions to "+this+": "+t, t);
-                            }
-                        }
-                    }});
-                totalEventsDeliveredCount.incrementAndGet();
-            }
-        }
-    }
-    
-    @Override
-    public String toString() {
-        return tostring;
-    }
-    
-    /**
-     * Copied from LanguageUtils.groovy, to remove dependency.
-     * 
-     * Adds the given value to a collection in the map under the key.
-     * 
-     * A collection (as {@link LinkedHashMap}) will be created if necessary,
-     * synchronized on map for map access/change and set for addition there
-     *
-     * @return the updated set (instance, not copy)
-     * 
-     * @deprecated since 0.5; use {@link HashMultimap}, and {@link Multimaps#synchronizedSetMultimap(com.google.common.collect.SetMultimap)}
-     */
-    @Deprecated
-    private static <K,V> Set<V> addToMapOfSets(Map<K,Set<V>> map, K key, V valueInCollection) {
-        Set<V> coll;
-        synchronized (map) {
-            coll = map.get(key);
-            if (coll==null) {
-                coll = new LinkedHashSet<V>();
-                map.put(key, coll);
-            }
-            if (coll.isEmpty()) {
-                synchronized (coll) {
-                    coll.add(valueInCollection);
-                }
-                //if collection was empty then add to the collection while holding the map lock, to prevent removal
-                return coll;
-            }
-        }
-        synchronized (coll) {
-            if (!coll.isEmpty()) {
-                coll.add(valueInCollection);
-                return coll;
-            }
-        }
-        //if was empty, recurse, because someone else might be removing the collection
-        return addToMapOfSets(map, key, valueInCollection);
-    }
-
-    /**
-     * Copied from LanguageUtils.groovy, to remove dependency.
-     * 
-     * Removes the given value from a collection in the map under the key.
-     *
-     * @return the updated set (instance, not copy)
-     * 
-     * @deprecated since 0.5; use {@link ArrayListMultimap} or {@link HashMultimap}, and {@link Multimaps#synchronizedListMultimap(com.google.common.collect.ListMultimap)} etc
-     */
-    @Deprecated
-    private static <K,V> boolean removeFromMapOfCollections(Map<K,? extends Collection<V>> map, K key, V valueInCollection) {
-        Collection<V> coll;
-        synchronized (map) {
-            coll = map.get(key);
-            if (coll==null) return false;
-        }
-        boolean result;
-        synchronized (coll) {
-            result = coll.remove(valueInCollection);
-        }
-        if (coll.isEmpty()) {
-            synchronized (map) {
-                synchronized (coll) {
-                    if (coll.isEmpty()) {
-                        //only remove from the map if no one is adding to the collection or to the map, and the collection is still in the map
-                        if (map.get(key)==coll) {
-                            map.remove(key);
-                        }
-                    }
-                }
-            }
-        }
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
deleted file mode 100644
index 363009e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
+++ /dev/null
@@ -1,411 +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.core.mgmt.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.entitlement.EntitlementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.core.location.LocationConfigKeys;
-import org.apache.brooklyn.core.location.internal.LocationInternal;
-import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
-import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
-import org.apache.brooklyn.core.mgmt.usage.ApplicationUsage;
-import org.apache.brooklyn.core.mgmt.usage.LocationUsage;
-import org.apache.brooklyn.core.mgmt.usage.UsageListener;
-import org.apache.brooklyn.core.mgmt.usage.UsageManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-public class LocalUsageManager implements UsageManager {
-
-    // TODO Threading model needs revisited.
-    // Synchronizes on updates to storage; but if two Brooklyn nodes were both writing to the same
-    // ApplicationUsage or LocationUsage record there'd be a race. That currently won't happen
-    // (at least for ApplicationUsage?) because the app is mastered in just one node at a time,
-    // and because location events are just manage/unmanage which should be happening in just 
-    // one place at a time for a given location.
-    
-    private static final Logger log = LoggerFactory.getLogger(LocalUsageManager.class);
-
-    private static class ApplicationMetadataImpl implements UsageListener.ApplicationMetadata {
-        private final Application app;
-        private String applicationId;
-        private String applicationName;
-        private String entityType;
-        private String catalogItemId;
-        private Map<String, String> metadata;
-
-        ApplicationMetadataImpl(Application app) {
-            this.app = checkNotNull(app, "app");
-            applicationId = app.getId();
-            applicationName = app.getDisplayName();
-            entityType = app.getEntityType().getName();
-            catalogItemId = app.getCatalogItemId();
-            metadata = ((EntityInternal)app).toMetadataRecord();
-        }
-        @Override public Application getApplication() {
-            return app;
-        }
-        @Override public String getApplicationId() {
-            return applicationId;
-        }
-        @Override public String getApplicationName() {
-            return applicationName;
-        }
-        @Override public String getEntityType() {
-            return entityType;
-        }
-        @Override public String getCatalogItemId() {
-            return catalogItemId;
-        }
-        @Override public Map<String, String> getMetadata() {
-            return metadata;
-        }
-    }
-    
-    private static class LocationMetadataImpl implements UsageListener.LocationMetadata {
-        private final Location loc;
-        private String locationId;
-        private Map<String, String> metadata;
-
-        LocationMetadataImpl(Location loc) {
-            this.loc = checkNotNull(loc, "loc");
-            locationId = loc.getId();
-            metadata = ((LocationInternal)loc).toMetadataRecord();
-        }
-        @Override public Location getLocation() {
-            return loc;
-        }
-        @Override public String getLocationId() {
-            return locationId;
-        }
-        @Override public Map<String, String> getMetadata() {
-            return metadata;
-        }
-    }
-    
-    // Register a coercion from String->UsageListener, so that USAGE_LISTENERS defined in brooklyn.properties
-    // will be instantiated, given their class names.
-    static {
-        TypeCoercions.registerAdapter(String.class, UsageListener.class, new Function<String, UsageListener>() {
-            @Override public UsageListener apply(String input) {
-                // TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
-                ClassLoader classLoader = LocalUsageManager.class.getClassLoader();
-                Optional<Object> result = Reflections.invokeConstructorWithArgs(classLoader, input);
-                if (result.isPresent()) {
-                    return (UsageListener) result.get();
-                } else {
-                    throw new IllegalStateException("Failed to create UsageListener from class name '"+input+"' using no-arg constructor");
-                }
-            }
-        });
-    }
-    
-    @VisibleForTesting
-    public static final String APPLICATION_USAGE_KEY = "usage-application";
-    
-    @VisibleForTesting
-    public static final String LOCATION_USAGE_KEY = "usage-location";
-
-    private final LocalManagementContext managementContext;
-    
-    private final Object mutex = new Object();
-
-    private final List<UsageListener> listeners = Lists.newCopyOnWriteArrayList();
-    
-    private final AtomicInteger listenerQueueSize = new AtomicInteger();
-    
-    private ListeningExecutorService listenerExecutor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
-            .setNameFormat("brooklyn-usagemanager-listener-%d")
-            .build()));
-
-    public LocalUsageManager(LocalManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, "managementContext");
-        
-        // TODO Once org.apache.brooklyn.core.management.internal.UsageManager.UsageListener is deleted, restore this
-        // to normal generics!
-        Collection<?> listeners = managementContext.getBrooklynProperties().getConfig(UsageManager.USAGE_LISTENERS);
-        if (listeners != null) {
-            for (Object listener : listeners) {
-                if (listener instanceof ManagementContextInjectable) {
-                    ((ManagementContextInjectable)listener).setManagementContext(managementContext);
-                }
-                if (listener instanceof UsageListener) {
-                    addUsageListener((UsageListener)listener);
-                } else if (listener == null) {
-                    throw new NullPointerException("null listener in config "+UsageManager.USAGE_LISTENERS);
-                } else {
-                    throw new ClassCastException("listener "+listener+" of type "+listener.getClass()+" is not of type "+UsageListener.class.getName());
-                }
-            }
-        }
-    }
-
-    public void terminate() {
-        // Wait for the listeners to finish + close the listeners
-        Duration timeout = managementContext.getBrooklynProperties().getConfig(UsageManager.USAGE_LISTENER_TERMINATION_TIMEOUT);
-        if (listenerQueueSize.get() > 0) {
-            log.info("Usage manager waiting for "+listenerQueueSize+" listener events for up to "+timeout);
-        }
-        List<ListenableFuture<?>> futures = Lists.newArrayList();
-        for (final UsageListener listener : listeners) {
-            ListenableFuture<?> future = listenerExecutor.submit(new Runnable() {
-                public void run() {
-                    if (listener instanceof Closeable) {
-                        try {
-                            ((Closeable)listener).close();
-                        } catch (IOException e) {
-                            log.warn("Problem closing usage listener "+listener+" (continuing)", e);
-                        }
-                    }
-                }});
-            futures.add(future);
-        }
-        try {
-            Futures.successfulAsList(futures).get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.warn("Problem terminiating usage listeners (continuing)", e);
-        } finally {
-            listenerExecutor.shutdownNow();
-        }
-    }
-
-    private void execOnListeners(final Function<UsageListener, Void> job) {
-        for (final UsageListener listener : listeners) {
-            listenerQueueSize.incrementAndGet();
-            listenerExecutor.execute(new Runnable() {
-                public void run() {
-                    try {
-                        job.apply(listener);
-                    } catch (RuntimeException e) {
-                        log.error("Problem notifying listener "+listener+" of "+job, e);
-                        Exceptions.propagateIfFatal(e);
-                    } finally {
-                        listenerQueueSize.decrementAndGet();
-                    }
-                }});
-        }
-    }
-    
-    @Override
-    public void recordApplicationEvent(final Application app, final Lifecycle state) {
-        log.debug("Storing application lifecycle usage event: application {} in state {}", new Object[] {app, state});
-        ConcurrentMap<String, ApplicationUsage> eventMap = managementContext.getStorage().getMap(APPLICATION_USAGE_KEY);
-        synchronized (mutex) {
-            ApplicationUsage usage = eventMap.get(app.getId());
-            if (usage == null) {
-                usage = new ApplicationUsage(app.getId(), app.getDisplayName(), app.getEntityType().getName(), ((EntityInternal)app).toMetadataRecord());
-            }
-            final ApplicationUsage.ApplicationEvent event = new ApplicationUsage.ApplicationEvent(state, getUser());
-            usage.addEvent(event);        
-            eventMap.put(app.getId(), usage);
-
-            execOnListeners(new Function<UsageListener, Void>() {
-                    public Void apply(UsageListener listener) {
-                        listener.onApplicationEvent(new ApplicationMetadataImpl(Entities.proxy(app)), event);
-                        return null;
-                    }
-                    public String toString() {
-                        return "applicationEvent("+app+", "+state+")";
-                    }});
-        }
-    }
-    
-    /**
-     * Adds this location event to the usage record for the given location (creating the usage 
-     * record if one does not already exist).
-     */
-    @Override
-    public void recordLocationEvent(final Location loc, final Lifecycle state) {
-        // TODO This approach (i.e. recording events on manage/unmanage would not work for
-        // locations that are reused. For example, in a FixedListMachineProvisioningLocation
-        // the ssh machine location is returned to the pool and handed back out again.
-        // But maybe the solution there is to hand out different instances so that one user
-        // can't change the config of the SshMachineLocation to subsequently affect the next 
-        // user.
-        //
-        // TODO Should perhaps extract the location storage methods into their own class,
-        // but no strong enough feelings yet...
-        
-        checkNotNull(loc, "location");
-        if (loc.getConfig(AbstractLocation.TEMPORARY_LOCATION)) {
-            log.info("Ignoring location lifecycle usage event for {} (state {}), because location is a temporary location", loc, state);
-            return;
-        }
-        checkNotNull(state, "state of location %s", loc);
-        if (loc.getId() == null) {
-            log.error("Ignoring location lifecycle usage event for {} (state {}), because location has no id", loc, state);
-            return;
-        }
-        if (managementContext.getStorage() == null) {
-            log.warn("Cannot store location lifecycle usage event for {} (state {}), because storage not available", loc, state);
-            return;
-        }
-        
-        Object callerContext = loc.getConfig(LocationConfigKeys.CALLER_CONTEXT);
-        
-        if (callerContext != null && callerContext instanceof Entity) {
-            log.debug("Storing location lifecycle usage event: location {} in state {}; caller context {}", new Object[] {loc, state, callerContext});
-            
-            Entity caller = (Entity) callerContext;
-            String entityTypeName = caller.getEntityType().getName();
-            String appId = caller.getApplicationId();
-
-            final LocationUsage.LocationEvent event = new LocationUsage.LocationEvent(state, caller.getId(), entityTypeName, appId, getUser());
-            
-            ConcurrentMap<String, LocationUsage> usageMap = managementContext.getStorage().<String, LocationUsage>getMap(LOCATION_USAGE_KEY);
-            synchronized (mutex) {
-                LocationUsage usage = usageMap.get(loc.getId());
-                if (usage == null) {
-                    usage = new LocationUsage(loc.getId(), ((LocationInternal)loc).toMetadataRecord());
-                }
-                usage.addEvent(event);
-                usageMap.put(loc.getId(), usage);
-                
-                execOnListeners(new Function<UsageListener, Void>() {
-                        public Void apply(UsageListener listener) {
-                            listener.onLocationEvent(new LocationMetadataImpl(loc), event);
-                            return null;
-                        }
-                        public String toString() {
-                            return "locationEvent("+loc+", "+state+")";
-                        }});
-            }
-        } else {
-            // normal for high-level locations
-            log.trace("Not recording location lifecycle usage event for {} in state {}, because no caller context", new Object[] {loc, state});
-        }
-    }
-
-    /**
-     * Returns the usage info for the location with the given id, or null if unknown.
-     */
-    @Override
-    public LocationUsage getLocationUsage(String locationId) {
-        BrooklynStorage storage = managementContext.getStorage();
-
-        Map<String, LocationUsage> usageMap = storage.getMap(LOCATION_USAGE_KEY);
-        return usageMap.get(locationId);
-    }
-    
-    /**
-     * Returns the usage info that matches the given predicate.
-     * For example, could be used to find locations used within a given time period.
-     */
-    @Override
-    public Set<LocationUsage> getLocationUsage(Predicate<? super LocationUsage> filter) {
-        // TODO could do more efficient indexing, to more easily find locations in use during a given period.
-        // But this is good enough for first-pass.
-
-        Map<String, LocationUsage> usageMap = managementContext.getStorage().getMap(LOCATION_USAGE_KEY);
-        Set<LocationUsage> result = Sets.newLinkedHashSet();
-        
-        for (LocationUsage usage : usageMap.values()) {
-            if (filter.apply(usage)) {
-                result.add(usage);
-            }
-        }
-        return result;
-    }
-    
-    /**
-     * Returns the usage info for the location with the given id, or null if unknown.
-     */
-    @Override
-    public ApplicationUsage getApplicationUsage(String appId) {
-        BrooklynStorage storage = managementContext.getStorage();
-
-        Map<String, ApplicationUsage> usageMap = storage.getMap(APPLICATION_USAGE_KEY);
-        return usageMap.get(appId);
-    }
-    
-    /**
-     * Returns the usage info that matches the given predicate.
-     * For example, could be used to find applications used within a given time period.
-     */
-    @Override
-    public Set<ApplicationUsage> getApplicationUsage(Predicate<? super ApplicationUsage> filter) {
-        // TODO could do more efficient indexing, to more easily find locations in use during a given period.
-        // But this is good enough for first-pass.
-
-        Map<String, ApplicationUsage> usageMap = managementContext.getStorage().getMap(APPLICATION_USAGE_KEY);
-        Set<ApplicationUsage> result = Sets.newLinkedHashSet();
-        
-        for (ApplicationUsage usage : usageMap.values()) {
-            if (filter.apply(usage)) {
-                result.add(usage);
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public void addUsageListener(UsageListener listener) {
-        listeners.add(listener);
-    }
-
-    @Override
-    public void removeUsageListener(UsageListener listener) {
-        listeners.remove(listener);
-    }
-
-    private String getUser() {
-        EntitlementContext entitlementContext = Entitlements.getEntitlementContext();
-        if (entitlementContext != null) {
-            return entitlementContext.user();
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocationManagerInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocationManagerInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocationManagerInternal.java
deleted file mode 100644
index d37c115..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocationManagerInternal.java
+++ /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.
- */
-package org.apache.brooklyn.core.mgmt.internal;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.LocationManager;
-
-public interface LocationManagerInternal extends LocationManager, BrooklynObjectManagerInternal<Location> {
-
-    public Iterable<String> getLocationIds();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementContextInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementContextInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementContextInternal.java
deleted file mode 100644
index e76f2fb..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementContextInternal.java
+++ /dev/null
@@ -1,125 +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.core.mgmt.internal;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
-import org.apache.brooklyn.core.mgmt.usage.UsageManager;
-import org.apache.brooklyn.core.objs.proxy.InternalEntityFactory;
-import org.apache.brooklyn.core.objs.proxy.InternalLocationFactory;
-import org.apache.brooklyn.core.objs.proxy.InternalPolicyFactory;
-import org.apache.brooklyn.util.core.task.TaskTags;
-import org.apache.brooklyn.util.guava.Maybe;
-
-import com.google.common.annotations.Beta;
-
-public interface ManagementContextInternal extends ManagementContext {
-
-    public static final String SUB_TASK_TAG = TaskTags.SUB_TASK_TAG;
-    
-    public static final String EFFECTOR_TAG = BrooklynTaskTags.EFFECTOR_TAG;
-    public static final String NON_TRANSIENT_TASK_TAG = BrooklynTaskTags.NON_TRANSIENT_TASK_TAG;
-    public static final String TRANSIENT_TASK_TAG = BrooklynTaskTags.TRANSIENT_TASK_TAG;
-
-    public static final String EMPTY_CATALOG_URL = "classpath://brooklyn/empty.catalog.bom";
-    
-    ClassLoader getBaseClassLoader();
-
-    Iterable<URL> getBaseClassPathForScanning();
-
-    void setBaseClassPathForScanning(Iterable<URL> urls);
-
-    void setManagementNodeUri(URI uri);
-
-    void addEntitySetListener(CollectionChangeListener<Entity> listener);
-
-    void removeEntitySetListener(CollectionChangeListener<Entity> listener);
-
-    void terminate();
-    
-    long getTotalEffectorInvocations();
-
-    <T> T invokeEffectorMethodSync(final Entity entity, final Effector<T> eff, final Object args) throws ExecutionException;
-    
-    <T> Task<T> invokeEffector(final Entity entity, final Effector<T> eff, @SuppressWarnings("rawtypes") final Map parameters);
-
-    BrooklynStorage getStorage();
-    
-    BrooklynProperties getBrooklynProperties();
-    
-    AccessManager getAccessManager();
-
-    UsageManager getUsageManager();
-    
-    /**
-     * @return The OSGi manager, if available; may be absent if OSGi is not supported,
-     * e.g. in test contexts (but will be supported in all major contexts).
-     */
-    Maybe<OsgiManager> getOsgiManager();
-
-    InternalEntityFactory getEntityFactory();
-    
-    InternalLocationFactory getLocationFactory();
-    
-    InternalPolicyFactory getPolicyFactory();
-    
-    /**
-     * Registers an entity that has been created, but that has not yet begun to be managed.
-     * <p>
-     * This differs from the idea of "preManaged" where the entities are in the process of being
-     * managed, but where management is not yet complete.
-     */
-    // TODO would benefit from better naming! The name has percolated up from LocalEntityManager.
-    //      should we just rename here as register or preManage?
-    void prePreManage(Entity entity);
-
-    /**
-     * Registers a location that has been created, but that has not yet begun to be managed.
-     */
-    void prePreManage(Location location);
-
-    /** Object which allows adding, removing, and clearing errors.
-     * TODO In future this will change to a custom interface with a unique identifier for each error. */
-    @Beta
-    List<Throwable> errors();
-
-    @Beta
-    CatalogInitialization getCatalogInitialization();
-
-    @Beta
-    void setCatalogInitialization(CatalogInitialization catalogInitialization);
-
-    @Beta
-    ExternalConfigSupplierRegistry getExternalConfigProviderRegistry();
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionInfo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionInfo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionInfo.java
deleted file mode 100644
index 8fa567a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementTransitionInfo.java
+++ /dev/null
@@ -1,48 +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.core.mgmt.internal;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-
-/** Stores a management transition mode, and the management context. */
-// TODO does this class really pull its weight?
-public class ManagementTransitionInfo {
-
-    final ManagementContext mgmtContext;
-    final ManagementTransitionMode mode;
-    
-    public ManagementTransitionInfo(ManagementContext mgmtContext, ManagementTransitionMode mode) {
-        this.mgmtContext = mgmtContext;
-        this.mode = mode;
-    }
-    
-    
-    public ManagementContext getManagementContext() {
-        return mgmtContext;
-    }
-
-    public ManagementTransitionMode getMode() {
-        return mode;
-    }
-    
-    @Override
-    public String toString() {
-        return super.toString()+"["+mgmtContext+";"+mode+"]";
-    }
-}


[25/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
deleted file mode 100644
index 41a0a9c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ /dev/null
@@ -1,1073 +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.core.catalog.internal;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
-import org.apache.brooklyn.core.location.BasicLocationRegistry;
-import org.apache.brooklyn.core.mgmt.internal.CampYamlParser;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.javalang.AggregateClassLoader;
-import org.apache.brooklyn.util.javalang.LoadedClassLoader;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
-import org.apache.brooklyn.util.yaml.Yamls;
-import org.apache.brooklyn.util.yaml.Yamls.YamlExtract;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.collect.Iterables;
-
-/* TODO the complex tree-structured catalogs are only useful when we are relying on those separate catalog classloaders
- * to isolate classpaths. with osgi everything is just put into the "manual additions" catalog. */
-public class BasicBrooklynCatalog implements BrooklynCatalog {
-    public static final String POLICIES_KEY = "brooklyn.policies";
-    public static final String LOCATIONS_KEY = "brooklyn.locations";
-    public static final String NO_VERSION = "0.0.0.SNAPSHOT";
-
-    private static final Logger log = LoggerFactory.getLogger(BasicBrooklynCatalog.class);
-
-    public static class BrooklynLoaderTracker {
-        public static final ThreadLocal<BrooklynClassLoadingContext> loader = new ThreadLocal<BrooklynClassLoadingContext>();
-        
-        public static void setLoader(BrooklynClassLoadingContext val) {
-            loader.set(val);
-        }
-        
-        // TODO Stack, for recursive calls?
-        public static void unsetLoader(BrooklynClassLoadingContext val) {
-            loader.set(null);
-        }
-        
-        public static BrooklynClassLoadingContext getLoader() {
-            return loader.get();
-        }
-    }
-
-    private final ManagementContext mgmt;
-    private CatalogDo catalog;
-    private volatile CatalogDo manualAdditionsCatalog;
-    private volatile LoadedClassLoader manualAdditionsClasses;
-    private final AggregateClassLoader rootClassLoader = AggregateClassLoader.newInstanceWithNoLoaders();
-
-    public BasicBrooklynCatalog(ManagementContext mgmt) {
-        this(mgmt, CatalogDto.newNamedInstance("empty catalog", "empty catalog", "empty catalog, expected to be reset later"));
-    }
-
-    public BasicBrooklynCatalog(ManagementContext mgmt, CatalogDto dto) {
-        this.mgmt = checkNotNull(mgmt, "managementContext");
-        this.catalog = new CatalogDo(mgmt, dto);
-    }
-
-    public boolean blockIfNotLoaded(Duration timeout) {
-        try {
-            return getCatalog().blockIfNotLoaded(timeout);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-    public void reset(CatalogDto dto) {
-        reset(dto, true);
-    }
-
-    public void reset(CatalogDto dto, boolean failOnLoadError) {
-        // Unregister all existing persisted items.
-        for (CatalogItem<?, ?> toRemove : getCatalogItems()) {
-            if (log.isTraceEnabled()) {
-                log.trace("Scheduling item for persistence removal: {}", toRemove.getId());
-            }
-            mgmt.getRebindManager().getChangeListener().onUnmanaged(toRemove);
-        }
-        CatalogDo catalog = new CatalogDo(mgmt, dto);
-        CatalogUtils.logDebugOrTraceIfRebinding(log, "Resetting "+this+" catalog to "+dto);
-        catalog.load(mgmt, null, failOnLoadError);
-        CatalogUtils.logDebugOrTraceIfRebinding(log, "Reloaded catalog for "+this+", now switching");
-        this.catalog = catalog;
-        resetRootClassLoader();
-        this.manualAdditionsCatalog = null;
-
-        // Inject management context into and persist all the new entries.
-        for (CatalogItem<?, ?> entry : getCatalogItems()) {
-            boolean setManagementContext = false;
-            if (entry instanceof CatalogItemDo) {
-                CatalogItemDo<?, ?> cid = CatalogItemDo.class.cast(entry);
-                if (cid.getDto() instanceof CatalogItemDtoAbstract) {
-                    CatalogItemDtoAbstract<?, ?> cdto = CatalogItemDtoAbstract.class.cast(cid.getDto());
-                    if (cdto.getManagementContext() == null) {
-                        cdto.setManagementContext((ManagementContextInternal) mgmt);
-                    }
-                    setManagementContext = true;
-                }
-            }
-            if (!setManagementContext) {
-                log.warn("Can't set management context on entry with unexpected type in catalog. type={}, " +
-                        "expected={}", entry, CatalogItemDo.class);
-            }
-            if (log.isTraceEnabled()) {
-                log.trace("Scheduling item for persistence addition: {}", entry.getId());
-            }
-            mgmt.getRebindManager().getChangeListener().onManaged(entry);
-        }
-
-    }
-
-    /**
-     * Resets the catalog to the given entries
-     */
-    @Override
-    public void reset(Collection<CatalogItem<?, ?>> entries) {
-        CatalogDto newDto = CatalogDto.newDtoFromCatalogItems(entries, "explicit-catalog-reset");
-        reset(newDto);
-    }
-    
-    public CatalogDo getCatalog() {
-        return catalog;
-    }
-
-    protected CatalogItemDo<?,?> getCatalogItemDo(String symbolicName, String version) {
-        String fixedVersionId = getFixedVersionId(symbolicName, version);
-        if (fixedVersionId == null) {
-            //no items with symbolicName exist
-            return null;
-        }
-
-        return catalog.getIdCache().get( CatalogUtils.getVersionedId(symbolicName, fixedVersionId) );
-    }
-    
-    private String getFixedVersionId(String symbolicName, String version) {
-        if (version!=null && !DEFAULT_VERSION.equals(version)) {
-            return version;
-        } else {
-            return getBestVersion(symbolicName);
-        }
-    }
-
-    /** returns best version, as defined by {@link BrooklynCatalog#getCatalogItem(String, String)} */
-    private String getBestVersion(String symbolicName) {
-        Iterable<CatalogItem<Object, Object>> versions = getCatalogItems(Predicates.and(
-                CatalogPredicates.disabled(false),
-                CatalogPredicates.symbolicName(Predicates.equalTo(symbolicName))));
-        Collection<CatalogItem<Object, Object>> orderedVersions = sortVersionsDesc(versions);
-        if (!orderedVersions.isEmpty()) {
-            return orderedVersions.iterator().next().getVersion();
-        } else {
-            return null;
-        }
-    }
-
-    private <T,SpecT> Collection<CatalogItem<T,SpecT>> sortVersionsDesc(Iterable<CatalogItem<T,SpecT>> versions) {
-        return ImmutableSortedSet.orderedBy(CatalogItemComparator.<T,SpecT>getInstance()).addAll(versions).build();
-    }
-
-    @Override
-    public CatalogItem<?,?> getCatalogItem(String symbolicName, String version) {
-        if (symbolicName == null) return null;
-        checkNotNull(version, "version");
-        CatalogItemDo<?, ?> itemDo = getCatalogItemDo(symbolicName, version);
-        if (itemDo == null) return null;
-        return itemDo.getDto();
-    }
-    
-    @Override
-    public void deleteCatalogItem(String symbolicName, String version) {
-        log.debug("Deleting manual catalog item from "+mgmt+": "+symbolicName + ":" + version);
-        checkNotNull(symbolicName, "id");
-        checkNotNull(version, "version");
-        if (DEFAULT_VERSION.equals(version)) {
-            throw new IllegalStateException("Deleting items with unspecified version (argument DEFAULT_VERSION) not supported.");
-        }
-        CatalogItem<?, ?> item = getCatalogItem(symbolicName, version);
-        CatalogItemDtoAbstract<?,?> itemDto = getAbstractCatalogItem(item);
-        if (itemDto == null) {
-            throw new NoSuchElementException("No catalog item found with id "+symbolicName);
-        }
-        if (manualAdditionsCatalog==null) loadManualAdditionsCatalog();
-        manualAdditionsCatalog.deleteEntry(itemDto);
-        
-        // Ensure the cache is de-populated
-        getCatalog().deleteEntry(itemDto);
-
-        // And indicate to the management context that it should be removed.
-        if (log.isTraceEnabled()) {
-            log.trace("Scheduling item for persistence removal: {}", itemDto.getId());
-        }
-        if (itemDto.getCatalogItemType() == CatalogItemType.LOCATION) {
-            @SuppressWarnings("unchecked")
-            CatalogItem<Location,LocationSpec<?>> locationItem = (CatalogItem<Location, LocationSpec<?>>) itemDto;
-            ((BasicLocationRegistry)mgmt.getLocationRegistry()).removeDefinedLocation(locationItem);
-        }
-        mgmt.getRebindManager().getChangeListener().onUnmanaged(itemDto);
-
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public <T,SpecT> CatalogItem<T,SpecT> getCatalogItem(Class<T> type, String id, String version) {
-        if (id==null || version==null) return null;
-        CatalogItem<?,?> result = getCatalogItem(id, version);
-        if (result==null) return null;
-        if (type==null || type.isAssignableFrom(result.getCatalogItemJavaType())) 
-            return (CatalogItem<T,SpecT>)result;
-        return null;
-    }
-
-    @Override
-    public void persist(CatalogItem<?, ?> catalogItem) {
-        checkArgument(getCatalogItem(catalogItem.getSymbolicName(), catalogItem.getVersion()) != null, "Unknown catalog item %s", catalogItem);
-        mgmt.getRebindManager().getChangeListener().onChanged(catalogItem);
-    }
-    
-    @Override
-    public ClassLoader getRootClassLoader() {
-        if (rootClassLoader.isEmpty() && catalog!=null) {
-            resetRootClassLoader();
-        }
-        return rootClassLoader;
-    }
-
-    private void resetRootClassLoader() {
-        rootClassLoader.reset(ImmutableList.of(catalog.getRootClassLoader()));
-    }
-
-    /**
-     * Loads this catalog. No effect if already loaded.
-     */
-    public void load() {
-        log.debug("Loading catalog for " + mgmt);
-        getCatalog().load(mgmt, null);
-        if (log.isDebugEnabled()) {
-            log.debug("Loaded catalog for " + mgmt + ": " + catalog + "; search classpath is " + catalog.getRootClassLoader());
-        }
-    }
-
-    @Override
-    public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createSpec(CatalogItem<T, SpecT> item) {
-        if (item == null) return null;
-        @SuppressWarnings("unchecked")
-        CatalogItemDo<T,SpecT> loadedItem = (CatalogItemDo<T, SpecT>) getCatalogItemDo(item.getSymbolicName(), item.getVersion());
-        if (loadedItem == null) throw new RuntimeException(item+" not in catalog; cannot create spec");
-        if (loadedItem.getSpecType()==null) return null;
-
-        SpecT spec = internalCreateSpecLegacy(mgmt, loadedItem, MutableSet.<String>of(), true);
-        if (spec != null) {
-            return spec;
-        }
-
-        throw new IllegalStateException("No known mechanism to create instance of "+item);
-    }
-    
-    /** @deprecated since introduction in 0.9.0, only used for backwards compatibility, can be removed any time;
-     * uses the type-creation info on the item.
-     * deprecated transformers must be included by routines which don't use {@link BrooklynTypePlanTransformer} instances;
-     * otherwise deprecated transformers should be excluded. (deprecation is taken as equivalent to having a new-style transformer.) */
-    @Deprecated 
-    public static <T,SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT internalCreateSpecLegacy(ManagementContext mgmt, final CatalogItem<T, SpecT> item, final Set<String> encounteredTypes, boolean includeDeprecatedTransformers) {
-        // deprecated lookup
-        if (encounteredTypes.contains(item.getSymbolicName())) {
-            throw new IllegalStateException("Type being resolved '"+item.getSymbolicName()+"' has already been encountered in " + encounteredTypes + "; recursive cycle detected");
-        }
-        Maybe<SpecT> specMaybe = org.apache.brooklyn.core.plan.PlanToSpecFactory.attemptWithLoaders(mgmt, includeDeprecatedTransformers, new Function<org.apache.brooklyn.core.plan.PlanToSpecTransformer, SpecT>() {
-            @Override
-            public SpecT apply(org.apache.brooklyn.core.plan.PlanToSpecTransformer input) {
-                return input.createCatalogSpec(item, encounteredTypes);
-            }
-        });
-        return specMaybe.get();
-    }
-
-    @Deprecated /** @deprecated since 0.7.0 only used by other deprecated items */ 
-    private <T,SpecT> CatalogItemDtoAbstract<T,SpecT> getAbstractCatalogItem(CatalogItem<T,SpecT> item) {
-        while (item instanceof CatalogItemDo) item = ((CatalogItemDo<T,SpecT>)item).itemDto;
-        if (item==null) return null;
-        if (item instanceof CatalogItemDtoAbstract) return (CatalogItemDtoAbstract<T,SpecT>) item;
-        throw new IllegalStateException("Cannot unwrap catalog item '"+item+"' (type "+item.getClass()+") to restore DTO");
-    }
-    
-    @SuppressWarnings("unchecked")
-    private static <T> Maybe<T> getFirstAs(Map<?,?> map, Class<T> type, String firstKey, String ...otherKeys) {
-        if (map==null) return Maybe.absent("No map available");
-        String foundKey = null;
-        Object value = null;
-        if (map.containsKey(firstKey)) foundKey = firstKey;
-        else for (String key: otherKeys) {
-            if (map.containsKey(key)) {
-                foundKey = key;
-                break;
-            }
-        }
-        if (foundKey==null) return Maybe.absent("Missing entry '"+firstKey+"'");
-        value = map.get(foundKey);
-        if (type.equals(String.class) && Number.class.isInstance(value)) value = value.toString();
-        if (!type.isInstance(value)) 
-            throw new IllegalArgumentException("Entry for '"+firstKey+"' should be of type "+type+", not "+value.getClass());
-        return Maybe.of((T)value);
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private Maybe<Map<?,?>> getFirstAsMap(Map<?,?> map, String firstKey, String ...otherKeys) {
-        return (Maybe<Map<?,?>>)(Maybe) getFirstAs(map, Map.class, firstKey, otherKeys);
-    }
-
-    private List<CatalogItemDtoAbstract<?,?>> collectCatalogItems(String yaml) {
-        Map<?,?> itemDef = Yamls.getAs(Yamls.parseAll(yaml), Map.class);
-        Map<?,?> catalogMetadata = getFirstAsMap(itemDef, "brooklyn.catalog").orNull();
-        if (catalogMetadata==null)
-            log.warn("No `brooklyn.catalog` supplied in catalog request; using legacy mode for "+itemDef);
-        catalogMetadata = MutableMap.copyOf(catalogMetadata);
-
-        List<CatalogItemDtoAbstract<?, ?>> result = MutableList.of();
-        
-        collectCatalogItems(Yamls.getTextOfYamlAtPath(yaml, "brooklyn.catalog").getMatchedYamlTextOrWarn(), 
-            catalogMetadata, result, null);
-        
-        itemDef.remove("brooklyn.catalog");
-        catalogMetadata.remove("item");
-        catalogMetadata.remove("items");
-        if (!itemDef.isEmpty()) {
-            log.debug("Reading brooklyn.catalog peer keys as item ('top-level syntax')");
-            Map<String,?> rootItem = MutableMap.of("item", itemDef);
-            String rootItemYaml = yaml;
-            YamlExtract yamlExtract = Yamls.getTextOfYamlAtPath(rootItemYaml, "brooklyn.catalog");
-            String match = yamlExtract.withOriginalIndentation(true).withKeyIncluded(true).getMatchedYamlTextOrWarn();
-            if (match!=null) {
-                if (rootItemYaml.startsWith(match)) rootItemYaml = Strings.removeFromStart(rootItemYaml, match);
-                else rootItemYaml = Strings.replaceAllNonRegex(rootItemYaml, "\n"+match, "");
-            }
-            collectCatalogItems("item:\n"+makeAsIndentedObject(rootItemYaml), rootItem, result, catalogMetadata);
-        }
-        
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    private void collectCatalogItems(String sourceYaml, Map<?,?> itemMetadata, List<CatalogItemDtoAbstract<?, ?>> result, Map<?,?> parentMetadata) {
-
-        if (sourceYaml==null) sourceYaml = new Yaml().dump(itemMetadata);
-
-        Map<?, ?> itemMetadataWithoutItemDef = MutableMap.builder()
-                .putAll(itemMetadata)
-                .remove("item")
-                .remove("items")
-                .build();
-        
-        // Parse CAMP-YAML DSL in item metadata (but not in item or items - those will be parsed only when used). 
-        CampYamlParser parser = mgmt.getConfig().getConfig(CampYamlParser.YAML_PARSER_KEY);
-        if (parser != null) {
-            itemMetadataWithoutItemDef = parser.parse((Map<String, Object>) itemMetadataWithoutItemDef);
-            try {
-                itemMetadataWithoutItemDef = (Map<String, Object>) Tasks.resolveDeepValue(itemMetadataWithoutItemDef, Object.class, mgmt.getServerExecutionContext());
-            } catch (Exception e) {
-                throw Exceptions.propagate(e);
-            }
-            
-        } else {
-            log.info("No Camp-YAML parser regsitered for parsing catalog item DSL; skipping DSL-parsing");
-        }
-
-        Map<Object,Object> catalogMetadata = MutableMap.<Object, Object>builder()
-                .putAll(parentMetadata)
-                .putAll(itemMetadataWithoutItemDef)
-                .putIfNotNull("item", itemMetadata.get("item"))
-                .putIfNotNull("items", itemMetadata.get("items"))
-                .build();
-
-        // brooklyn.libraries we treat specially, to append the list, with the child's list preferred in classloading order
-        // `libraries` is supported in some places as a legacy syntax; it should always be `brooklyn.libraries` for new apps
-        // TODO in 0.8.0 require brooklyn.libraries, don't allow "libraries" on its own
-        List<?> librariesNew = MutableList.copyOf(getFirstAs(itemMetadataWithoutItemDef, List.class, "brooklyn.libraries", "libraries").orNull());
-        Collection<CatalogBundle> libraryBundlesNew = CatalogItemDtoAbstract.parseLibraries(librariesNew);
-
-        List<?> librariesCombined = MutableList.copyOf(librariesNew)
-            .appendAll(getFirstAs(parentMetadata, List.class, "brooklyn.libraries", "libraries").orNull());
-        if (!librariesCombined.isEmpty())
-            catalogMetadata.put("brooklyn.libraries", librariesCombined);
-        Collection<CatalogBundle> libraryBundles = CatalogItemDtoAbstract.parseLibraries(librariesCombined);
-
-        // TODO as this may take a while if downloading, the REST call should be async
-        // (this load is required for the scan below and I think also for yaml resolution)
-        CatalogUtils.installLibraries(mgmt, libraryBundlesNew);
-
-        Boolean scanJavaAnnotations = getFirstAs(itemMetadataWithoutItemDef, Boolean.class, "scanJavaAnnotations", "scan_java_annotations").orNull();
-        if (scanJavaAnnotations==null || !scanJavaAnnotations) {
-            // don't scan
-        } else {
-            // scan for annotations: if libraries here, scan them; if inherited libraries error; else scan classpath
-            if (!libraryBundlesNew.isEmpty()) {
-                result.addAll(scanAnnotationsFromBundles(mgmt, libraryBundlesNew, catalogMetadata));
-            } else if (libraryBundles.isEmpty()) {
-                result.addAll(scanAnnotationsFromLocal(mgmt, catalogMetadata));
-            } else {
-                throw new IllegalStateException("Cannot scan catalog node no local bundles, and with inherited bundles we will not scan the classpath");
-            }
-        }
-        
-        Object items = catalogMetadata.remove("items");
-        Object item = catalogMetadata.remove("item");
-
-        if (items!=null) {
-            int count = 0;
-            for (Map<?,?> i: ((List<Map<?,?>>)items)) {
-                collectCatalogItems(Yamls.getTextOfYamlAtPath(sourceYaml, "items", count).getMatchedYamlTextOrWarn(),
-                        i, result, catalogMetadata);
-                count++;
-            }
-        }
-        
-        if (item==null) return;
-
-        // now look at the actual item, first correcting the sourceYaml and interpreting the catalog metadata
-        String itemYaml = Yamls.getTextOfYamlAtPath(sourceYaml, "item").getMatchedYamlTextOrWarn();
-        if (itemYaml!=null) sourceYaml = itemYaml;
-        else sourceYaml = new Yaml().dump(item);
-        
-        CatalogItemType itemType = TypeCoercions.coerce(getFirstAs(catalogMetadata, Object.class, "itemType", "item_type").orNull(), CatalogItemType.class);
-
-        String id = getFirstAs(catalogMetadata, String.class, "id").orNull();
-        String version = getFirstAs(catalogMetadata, String.class, "version").orNull();
-        String symbolicName = getFirstAs(catalogMetadata, String.class, "symbolicName").orNull();
-        String displayName = getFirstAs(catalogMetadata, String.class, "displayName").orNull();
-        String name = getFirstAs(catalogMetadata, String.class, "name").orNull();
-
-        if ((Strings.isNonBlank(id) || Strings.isNonBlank(symbolicName)) && 
-                Strings.isNonBlank(displayName) &&
-                Strings.isNonBlank(name) && !name.equals(displayName)) {
-            log.warn("Name property will be ignored due to the existence of displayName and at least one of id, symbolicName");
-        }
-
-        PlanInterpreterGuessingType planInterpreter = new PlanInterpreterGuessingType(null, item, sourceYaml, itemType, libraryBundles, result).reconstruct();
-        if (!planInterpreter.isResolved()) {
-            throw Exceptions.create("Could not resolve item"
-                + (Strings.isNonBlank(id) ? " '"+id+"'" : Strings.isNonBlank(symbolicName) ? " '"+symbolicName+"'" : Strings.isNonBlank(name) ? " '"+name+"'" : "")
-                // better not to show yaml, takes up lots of space, and with multiple plan transformers there might be multiple errors; 
-                // some of the errors themselves may reproduce it
-                // (ideally in future we'll be able to return typed errors with caret position of error)
-//                + ":\n"+sourceYaml
-                , planInterpreter.getErrors());
-        }
-        itemType = planInterpreter.getCatalogItemType();
-        Map<?, ?> itemAsMap = planInterpreter.getItem();
-        // the "plan yaml" includes the services: ... or brooklyn.policies: ... outer key,
-        // as opposed to the rawer { type: xxx } map without that outer key which is valid as item input
-        // TODO this plan yaml is needed for subsequent reconstruction; would be nicer if it weren't! 
-
-        // if symname not set, infer from: id, then name, then item id, then item name
-        if (Strings.isBlank(symbolicName)) {
-            if (Strings.isNonBlank(id)) {
-                if (CatalogUtils.looksLikeVersionedId(id)) {
-                    symbolicName = CatalogUtils.getSymbolicNameFromVersionedId(id);
-                } else {
-                    symbolicName = id;
-                }
-            } else if (Strings.isNonBlank(name)) {
-                if (CatalogUtils.looksLikeVersionedId(name)) {
-                    symbolicName = CatalogUtils.getSymbolicNameFromVersionedId(name);
-                } else {
-                    symbolicName = name;
-                }
-            } else {
-                symbolicName = setFromItemIfUnset(symbolicName, itemAsMap, "id");
-                symbolicName = setFromItemIfUnset(symbolicName, itemAsMap, "name");
-                // TODO we should let the plan transformer give us this
-                symbolicName = setFromItemIfUnset(symbolicName, itemAsMap, "template_name");
-                if (Strings.isBlank(symbolicName)) {
-                    log.error("Can't infer catalog item symbolicName from the following plan:\n" + sourceYaml);
-                    throw new IllegalStateException("Can't infer catalog item symbolicName from catalog item metadata");
-                }
-            }
-        }
-
-        // if version not set, infer from: id, then from name, then item version
-        if (CatalogUtils.looksLikeVersionedId(id)) {
-            String versionFromId = CatalogUtils.getVersionFromVersionedId(id);
-            if (versionFromId != null && Strings.isNonBlank(version) && !versionFromId.equals(version)) {
-                throw new IllegalArgumentException("Discrepency between version set in id " + versionFromId + " and version property " + version);
-            }
-            version = versionFromId;
-        }
-        if (Strings.isBlank(version)) {
-            if (CatalogUtils.looksLikeVersionedId(name)) {
-                version = CatalogUtils.getVersionFromVersionedId(name);
-            } else if (Strings.isBlank(version)) {
-                version = setFromItemIfUnset(version, itemAsMap, "version");
-                version = setFromItemIfUnset(version, itemAsMap, "template_version");
-                if (version==null) {
-                    log.warn("No version specified for catalog item " + symbolicName + ". Using default value.");
-                    version = null;
-                }
-            }
-        }
-        
-        // if not set, ID can come from symname:version, failing that, from the plan.id, failing that from the sym name
-        if (Strings.isBlank(id)) {
-            // let ID be inferred, especially from name, to support style where only "name" is specified, with inline version
-            if (Strings.isNonBlank(symbolicName) && Strings.isNonBlank(version)) {
-                id = symbolicName + ":" + version;
-            }
-            id = setFromItemIfUnset(id, itemAsMap, "id");
-            if (Strings.isBlank(id)) {
-                if (Strings.isNonBlank(symbolicName)) {
-                    id = symbolicName;
-                } else {
-                    log.error("Can't infer catalog item id from the following plan:\n" + sourceYaml);
-                    throw new IllegalStateException("Can't infer catalog item id from catalog item metadata");
-                }
-            }
-        }
-
-        if (Strings.isBlank(displayName)) {
-            if (Strings.isNonBlank(name)) displayName = name;
-            displayName = setFromItemIfUnset(displayName, itemAsMap, "name");
-        }
-
-        String description = getFirstAs(catalogMetadata, String.class, "description").orNull();
-        description = setFromItemIfUnset(description, itemAsMap, "description");
-
-        // icon.url is discouraged, but kept for legacy compatibility; should deprecate this
-        final String catalogIconUrl = getFirstAs(catalogMetadata, String.class, "iconUrl", "icon_url", "icon.url").orNull();
-
-        final String deprecated = getFirstAs(catalogMetadata, String.class, "deprecated").orNull();
-        final Boolean catalogDeprecated = Boolean.valueOf(deprecated);
-
-        // run again now that we know the ID
-        planInterpreter = new PlanInterpreterGuessingType(id, item, sourceYaml, itemType, libraryBundles, result).reconstruct();
-        if (!planInterpreter.isResolved()) {
-            throw new IllegalStateException("Could not resolve plan once id and itemType are known (recursive reference?): "+sourceYaml);
-        }
-        String sourcePlanYaml = planInterpreter.getPlanYaml();
-
-        CatalogItemDtoAbstract<?, ?> dto = createItemBuilder(itemType, symbolicName, version)
-            .libraries(libraryBundles)
-            .displayName(displayName)
-            .description(description)
-            .deprecated(catalogDeprecated)
-            .iconUrl(catalogIconUrl)
-            .plan(sourcePlanYaml)
-            .build();
-
-        dto.setManagementContext((ManagementContextInternal) mgmt);
-        result.add(dto);
-    }
-
-    private String setFromItemIfUnset(String oldValue, Map<?,?> item, String fieldAttr) {
-        if (Strings.isNonBlank(oldValue)) return oldValue;
-        if (item!=null) {
-            Object newValue = item.get(fieldAttr);
-            if (newValue instanceof String && Strings.isNonBlank((String)newValue)) 
-                return (String)newValue;
-        }
-        return oldValue;
-    }
-
-    private Collection<CatalogItemDtoAbstract<?, ?>> scanAnnotationsFromLocal(ManagementContext mgmt, Map<?, ?> catalogMetadata) {
-        CatalogDto dto = CatalogDto.newNamedInstance("Local Scanned Catalog", "All annotated Brooklyn entities detected in the classpath", "scanning-local-classpath");
-        return scanAnnotationsInternal(mgmt, new CatalogDo(dto), catalogMetadata);
-    }
-    
-    private Collection<CatalogItemDtoAbstract<?, ?>> scanAnnotationsFromBundles(ManagementContext mgmt, Collection<CatalogBundle> libraries, Map<?, ?> catalogMetadata) {
-        CatalogDto dto = CatalogDto.newNamedInstance("Bundles Scanned Catalog", "All annotated Brooklyn entities detected in bundles", "scanning-bundles-classpath-"+libraries.hashCode());
-        List<String> urls = MutableList.of();
-        for (CatalogBundle b: libraries) {
-            // TODO currently does not support pre-installed bundles identified by name:version 
-            // (ie where URL not supplied)
-            if (Strings.isNonBlank(b.getUrl())) {
-                urls.add(b.getUrl());
-            }
-        }
-        
-        if (urls.isEmpty()) {
-            log.warn("No bundles to scan: scanJavaAnnotations currently only applies to OSGi bundles provided by URL"); 
-            return MutableList.of();
-        }
-        
-        CatalogDo subCatalog = new CatalogDo(dto);
-        subCatalog.addToClasspath(urls.toArray(new String[0]));
-        return scanAnnotationsInternal(mgmt, subCatalog, catalogMetadata);
-    }
-    
-    private Collection<CatalogItemDtoAbstract<?, ?>> scanAnnotationsInternal(ManagementContext mgmt, CatalogDo subCatalog, Map<?, ?> catalogMetadata) {
-        // TODO this does java-scanning only;
-        // the call when scanning bundles should use the CatalogItem instead and use OSGi when loading for scanning
-        // (or another scanning mechanism).  see comments on CatalogClasspathDo.load
-        subCatalog.mgmt = mgmt;
-        subCatalog.setClasspathScanForEntities(CatalogScanningModes.ANNOTATIONS);
-        subCatalog.load();
-        // TODO apply metadata?  (extract YAML from the items returned)
-        // also see doc .../catalog/index.md which says we might not apply metadata
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        Collection<CatalogItemDtoAbstract<?, ?>> result = (Collection<CatalogItemDtoAbstract<?, ?>>)(Collection)Collections2.transform(
-                (Collection<CatalogItemDo<Object,Object>>)(Collection)subCatalog.getIdCache().values(), 
-                itemDoToDtoAddingSelectedMetadataDuringScan(catalogMetadata));
-        return result;
-    }
-
-    private class PlanInterpreterGuessingType {
-
-        final String id;
-        final Map<?,?> item;
-        final String itemYaml;
-        final Collection<CatalogBundle> libraryBundles;
-        final List<CatalogItemDtoAbstract<?, ?>> itemsDefinedSoFar;
-        
-        CatalogItemType catalogItemType;
-        String planYaml;
-        boolean resolved = false;
-        List<Exception> errors = MutableList.of();
-        List<Exception> entityErrors = MutableList.of();
-        
-        public PlanInterpreterGuessingType(@Nullable String id, Object item, String itemYaml, @Nullable CatalogItemType optionalCiType, 
-                Collection<CatalogBundle> libraryBundles, List<CatalogItemDtoAbstract<?,?>> itemsDefinedSoFar) {
-            // ID is useful to prevent recursive references (possibly only supported for entities?)
-            this.id = id;
-            
-            if (item instanceof String) {
-                // if just a string supplied, wrap as map
-                this.item = MutableMap.of("type", item);
-                this.itemYaml = "type:\n"+makeAsIndentedObject(itemYaml);                
-            } else {
-                this.item = (Map<?,?>)item;
-                this.itemYaml = itemYaml;
-            }
-            this.catalogItemType = optionalCiType;
-            this.libraryBundles = libraryBundles;
-            this.itemsDefinedSoFar = itemsDefinedSoFar;
-        }
-
-        public PlanInterpreterGuessingType reconstruct() {
-            if (catalogItemType==CatalogItemType.TEMPLATE) {
-                // template *must* be explicitly defined, and if so, none of the other calls apply
-                attemptType(null, CatalogItemType.TEMPLATE);
-                
-            } else {
-                attemptType(null, CatalogItemType.ENTITY);
-
-                attemptType("services", CatalogItemType.ENTITY);
-                attemptType(POLICIES_KEY, CatalogItemType.POLICY);
-                attemptType(LOCATIONS_KEY, CatalogItemType.LOCATION);
-            }
-            
-            if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) {
-                // anything goes, for an explicit template, because we can't easily recurse into the types
-                planYaml = itemYaml;
-                resolved = true;
-            }
-            
-            return this;
-        }
-
-        public boolean isResolved() { return resolved; }
-        
-        /** Returns potentially useful errors encountered while guessing types. 
-         * May only be available where the type is known. */
-        public List<Exception> getErrors() {
-            if (errors.isEmpty()) return entityErrors;
-            return errors;
-        }
-        
-        public CatalogItemType getCatalogItemType() {
-            return catalogItemType; 
-        }
-        
-        public String getPlanYaml() {
-            return planYaml;
-        }
-        
-        private boolean attemptType(String key, CatalogItemType candidateCiType) {
-            if (resolved) return false;
-            if (catalogItemType!=null && catalogItemType!=candidateCiType) return false;
-            
-            final String candidateYaml;
-            if (key==null) candidateYaml = itemYaml;
-            else {
-                if (item.containsKey(key))
-                    candidateYaml = itemYaml;
-                else
-                    candidateYaml = key + ":\n" + makeAsIndentedList(itemYaml);
-            }
-            // first look in collected items, if a key is given
-            String type = (String) item.get("type");
-            String version = null;
-            if (CatalogUtils.looksLikeVersionedId(type)) {
-                version = CatalogUtils.getVersionFromVersionedId(type);
-                type = CatalogUtils.getSymbolicNameFromVersionedId(type);
-            }
-            if (type!=null && key!=null) {
-                for (CatalogItemDtoAbstract<?,?> candidate: itemsDefinedSoFar) {
-                    if (candidateCiType == candidate.getCatalogItemType() &&
-                            (type.equals(candidate.getSymbolicName()) || type.equals(candidate.getId()))) {
-                        if (version==null || version.equals(candidate.getVersion())) {
-                            // matched - exit
-                            catalogItemType = candidateCiType;
-                            planYaml = candidateYaml;
-                            resolved = true;
-                            return true;
-                        }
-                    }
-                }
-            }
-            
-            // then try parsing plan - this will use loader
-            try {
-                @SuppressWarnings("rawtypes")
-                CatalogItem itemToAttempt = createItemBuilder(candidateCiType, getIdWithRandomDefault(), DEFAULT_VERSION)
-                    .plan(candidateYaml)
-                    .libraries(libraryBundles)
-                    .build();
-                @SuppressWarnings("unchecked")
-                AbstractBrooklynObjectSpec<?, ?> spec = internalCreateSpecLegacy(mgmt, itemToAttempt, MutableSet.<String>of(), true);
-                if (spec!=null) {
-                    catalogItemType = candidateCiType;
-                    planYaml = candidateYaml;
-                    resolved = true;
-                }
-                return true;
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                // record the error if we have reason to expect this guess to succeed
-                if (item.containsKey("services") && (candidateCiType==CatalogItemType.ENTITY || candidateCiType==CatalogItemType.TEMPLATE)) {
-                    // explicit services supplied, so plan should have been parseable for an entity or a a service
-                    errors.add(e);
-                } else if (catalogItemType!=null && key!=null) {
-                    // explicit itemType supplied, so plan should be parseable in the cases where we're given a key
-                    // (when we're not given a key, the previous block should apply)
-                    errors.add(e);
-                } else {
-                    // all other cases, the error is probably due to us not getting the type right, probably ignore it
-                    // but cache it if we've checked entity, we'll use that as fallback errors
-                    if (candidateCiType==CatalogItemType.ENTITY) {
-                        entityErrors.add(e);
-                    }
-                    if (log.isTraceEnabled())
-                        log.trace("Guessing type of plan, it looks like it isn't "+candidateCiType+"/"+key+": "+e);
-                }
-            }
-            
-            // finally try parsing a cut-down plan, in case there is a nested reference to a newly defined catalog item
-            if (type!=null && key!=null) {
-                try {
-                    String cutDownYaml = key + ":\n" + makeAsIndentedList("type: "+type);
-                    @SuppressWarnings("rawtypes")
-                    CatalogItem itemToAttempt = createItemBuilder(candidateCiType, getIdWithRandomDefault(), DEFAULT_VERSION)
-                            .plan(cutDownYaml)
-                            .libraries(libraryBundles)
-                            .build();
-                    @SuppressWarnings("unchecked")
-                    AbstractBrooklynObjectSpec<?, ?> cutdownSpec = internalCreateSpecLegacy(mgmt, itemToAttempt, MutableSet.<String>of(), true);
-                    if (cutdownSpec!=null) {
-                        catalogItemType = candidateCiType;
-                        planYaml = candidateYaml;
-                        resolved = true;
-                    }
-                    return true;
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                }
-            }
-            // FIXME we should lookup type in the catalog on its own, then infer the type from that,
-            // and give proper errors (right now e.g. if there are no transformers then we bail out 
-            // with very little information)
-            
-            return false;
-        }
-
-        private String getIdWithRandomDefault() {
-            return id != null ? id : Strings.makeRandomId(10);
-        }
-        public Map<?,?> getItem() {
-            return item;
-        }
-    }
-    
-    private String makeAsIndentedList(String yaml) {
-        String[] lines = yaml.split("\n");
-        lines[0] = "- "+lines[0];
-        for (int i=1; i<lines.length; i++)
-            lines[i] = "  " + lines[i];
-        return Strings.join(lines, "\n");
-    }
-
-    private String makeAsIndentedObject(String yaml) {
-        String[] lines = yaml.split("\n");
-        for (int i=0; i<lines.length; i++)
-            lines[i] = "  " + lines[i];
-        return Strings.join(lines, "\n");
-    }
-
-    static CatalogItemBuilder<?> createItemBuilder(CatalogItemType itemType, String symbolicName, String version) {
-        return CatalogItemBuilder.newItem(itemType, symbolicName, version);
-    }
-
-    // these kept as their logic may prove useful; Apr 2015
-//    private boolean isApplicationSpec(EntitySpec<?> spec) {
-//        return !Boolean.TRUE.equals(spec.getConfig().get(EntityManagementUtils.WRAPPER_APP_MARKER));
-//    }
-//
-//    private boolean isEntityPlan(DeploymentPlan plan) {
-//        return plan!=null && !plan.getServices().isEmpty() || !plan.getArtifacts().isEmpty();
-//    }
-//    
-//    private boolean isPolicyPlan(DeploymentPlan plan) {
-//        return !isEntityPlan(plan) && plan.getCustomAttributes().containsKey(POLICIES_KEY);
-//    }
-//
-//    private boolean isLocationPlan(DeploymentPlan plan) {
-//        return !isEntityPlan(plan) && plan.getCustomAttributes().containsKey(LOCATIONS_KEY);
-//    }
-
-    //------------------------
-    
-    @Override
-    public CatalogItem<?,?> addItem(String yaml) {
-        return addItem(yaml, false);
-    }
-
-    @Override
-    public List<? extends CatalogItem<?,?>> addItems(String yaml) {
-        return addItems(yaml, false);
-    }
-
-    @Override
-    public CatalogItem<?,?> addItem(String yaml, boolean forceUpdate) {
-        return Iterables.getOnlyElement(addItems(yaml, forceUpdate));
-    }
-    
-    @Override
-    public List<? extends CatalogItem<?,?>> addItems(String yaml, boolean forceUpdate) {
-        log.debug("Adding manual catalog item to "+mgmt+": "+yaml);
-        checkNotNull(yaml, "yaml");
-        List<CatalogItemDtoAbstract<?, ?>> result = collectCatalogItems(yaml);
-
-        // do this at the end for atomic updates; if there are intra-yaml references, we handle them specially
-        for (CatalogItemDtoAbstract<?, ?> item: result) {
-            addItemDto(item, forceUpdate);
-        }
-        return result;
-    }
-    
-    private CatalogItem<?,?> addItemDto(CatalogItemDtoAbstract<?, ?> itemDto, boolean forceUpdate) {
-        CatalogItem<?, ?> existingDto = checkItemAllowedAndIfSoReturnAnyDuplicate(itemDto, true, forceUpdate);
-        if (existingDto!=null) {
-            // it's a duplicate, and not forced, just return it
-            log.trace("Using existing duplicate for catalog item {}", itemDto.getId());
-            return existingDto;
-        }
-
-        if (manualAdditionsCatalog==null) loadManualAdditionsCatalog();
-        manualAdditionsCatalog.addEntry(itemDto);
-
-        // Ensure the cache is populated and it is persisted by the management context
-        getCatalog().addEntry(itemDto);
-
-        // Request that the management context persist the item.
-        if (log.isTraceEnabled()) {
-            log.trace("Scheduling item for persistence addition: {}", itemDto.getId());
-        }
-        if (itemDto.getCatalogItemType() == CatalogItemType.LOCATION) {
-            @SuppressWarnings("unchecked")
-            CatalogItem<Location,LocationSpec<?>> locationItem = (CatalogItem<Location, LocationSpec<?>>) itemDto;
-            ((BasicLocationRegistry)mgmt.getLocationRegistry()).updateDefinedLocation(locationItem);
-        }
-        mgmt.getRebindManager().getChangeListener().onManaged(itemDto);
-
-        return itemDto;
-    }
-
-    /** returns item DTO if item is an allowed duplicate, or null if it should be added (there is no duplicate), 
-     * throwing if item cannot be added */
-    private CatalogItem<?, ?> checkItemAllowedAndIfSoReturnAnyDuplicate(CatalogItem<?,?> itemDto, boolean allowDuplicates, boolean forceUpdate) {
-        if (forceUpdate) return null;
-        CatalogItemDo<?, ?> existingItem = getCatalogItemDo(itemDto.getSymbolicName(), itemDto.getVersion());
-        if (existingItem == null) return null;
-        // check if they are equal
-        CatalogItem<?, ?> existingDto = existingItem.getDto();
-        if (existingDto.equals(itemDto)) {
-            if (allowDuplicates) return existingItem;
-            throw new IllegalStateException("Updating existing catalog entries, even with the same content, is forbidden: " +
-                    itemDto.getSymbolicName() + ":" + itemDto.getVersion() + ". Use forceUpdate argument to override.");
-        } else {
-            throw new IllegalStateException("Updating existing catalog entries is forbidden: " +
-                    itemDto.getSymbolicName() + ":" + itemDto.getVersion() + ". Use forceUpdate argument to override.");
-        }
-    }
-
-    @Override @Deprecated /** @deprecated see super */
-    public void addItem(CatalogItem<?,?> item) {
-        //assume forceUpdate for backwards compatibility
-        log.debug("Adding manual catalog item to "+mgmt+": "+item);
-        checkNotNull(item, "item");
-        CatalogUtils.installLibraries(mgmt, item.getLibraries());
-        if (manualAdditionsCatalog==null) loadManualAdditionsCatalog();
-        manualAdditionsCatalog.addEntry(getAbstractCatalogItem(item));
-    }
-
-    @Override @Deprecated /** @deprecated see super */
-    public CatalogItem<?,?> addItem(Class<?> type) {
-        //assume forceUpdate for backwards compatibility
-        log.debug("Adding manual catalog item to "+mgmt+": "+type);
-        checkNotNull(type, "type");
-        if (manualAdditionsCatalog==null) loadManualAdditionsCatalog();
-        manualAdditionsClasses.addClass(type);
-        return manualAdditionsCatalog.classpath.addCatalogEntry(type);
-    }
-
-    private synchronized void loadManualAdditionsCatalog() {
-        if (manualAdditionsCatalog!=null) return;
-        CatalogDto manualAdditionsCatalogDto = CatalogDto.newNamedInstance(
-                "Manual Catalog Additions", "User-additions to the catalog while Brooklyn is running, " +
-                "created "+Time.makeDateString(),
-                "manual-additions");
-        CatalogDo manualAdditionsCatalog = catalog.addCatalog(manualAdditionsCatalogDto);
-        if (manualAdditionsCatalog==null) {
-            // not hard to support, but slightly messy -- probably have to use ID's to retrieve the loaded instance
-            // for now block once, then retry
-            log.warn("Blocking until catalog is loaded before changing it");
-            boolean loaded = blockIfNotLoaded(Duration.TEN_SECONDS);
-            if (!loaded)
-                log.warn("Catalog still not loaded after delay; subsequent operations may fail");
-            manualAdditionsCatalog = catalog.addCatalog(manualAdditionsCatalogDto);
-            if (manualAdditionsCatalog==null) {
-                throw new UnsupportedOperationException("Catalogs cannot be added until the base catalog is loaded, and catalog is taking a while to load!");
-            }
-        }
-        
-        log.debug("Creating manual additions catalog for "+mgmt+": "+manualAdditionsCatalog);
-        manualAdditionsClasses = new LoadedClassLoader();
-        ((AggregateClassLoader)manualAdditionsCatalog.classpath.getLocalClassLoader()).addFirst(manualAdditionsClasses);
-        
-        // expose when we're all done
-        this.manualAdditionsCatalog = manualAdditionsCatalog;
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    @Override
-    public <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems() {
-        if (!getCatalog().isLoaded()) {
-            // some callers use this to force the catalog to load (maybe when starting as hot_backup without a catalog ?)
-            log.debug("Forcing catalog load on access of catalog items");
-            load();
-        }
-        return ImmutableList.copyOf((Iterable)catalog.getIdCache().values());
-    }
-    
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    @Override
-    public <T,SpecT> Iterable<CatalogItem<T,SpecT>> getCatalogItems(Predicate<? super CatalogItem<T,SpecT>> filter) {
-        Iterable<CatalogItemDo<T,SpecT>> filtered = Iterables.filter((Iterable)catalog.getIdCache().values(), (Predicate<CatalogItem<T,SpecT>>)(Predicate) filter);
-        return Iterables.transform(filtered, BasicBrooklynCatalog.<T,SpecT>itemDoToDto());
-    }
-
-    private static <T,SpecT> Function<CatalogItemDo<T,SpecT>, CatalogItem<T,SpecT>> itemDoToDto() {
-        return new Function<CatalogItemDo<T,SpecT>, CatalogItem<T,SpecT>>() {
-            @Override
-            public CatalogItem<T,SpecT> apply(@Nullable CatalogItemDo<T,SpecT> item) {
-                if (item==null) return null;
-                return item.getDto();
-            }
-        };
-    }
-    
-    private static <T,SpecT> Function<CatalogItemDo<T, SpecT>, CatalogItem<T,SpecT>> itemDoToDtoAddingSelectedMetadataDuringScan(final Map<?, ?> catalogMetadata) {
-        return new Function<CatalogItemDo<T,SpecT>, CatalogItem<T,SpecT>>() {
-            @Override
-            public CatalogItem<T,SpecT> apply(@Nullable CatalogItemDo<T,SpecT> item) {
-                if (item==null) return null;
-                CatalogItemDtoAbstract<T, SpecT> dto = (CatalogItemDtoAbstract<T, SpecT>) item.getDto();
-
-                // when scanning we only allow version and libraries to be overwritten
-                
-                String version = getFirstAs(catalogMetadata, String.class, "version").orNull();
-                if (Strings.isNonBlank(version)) dto.setVersion(version);
-                
-                Object librariesCombined = catalogMetadata.get("brooklyn.libraries");
-                if (librariesCombined instanceof Collection) {
-                    // will be set by scan -- slightly longwinded way to retrieve, but scanning for osgi needs an overhaul in any case
-                    Collection<CatalogBundle> libraryBundles = CatalogItemDtoAbstract.parseLibraries((Collection<?>) librariesCombined);
-                    dto.setLibraries(libraryBundles);
-                }
-                // replace java type with plan yaml -- needed for libraries / catalog item to be picked up,
-                // but probably useful to transition away from javaType altogether
-                dto.setSymbolicName(dto.getJavaType());
-                switch (dto.getCatalogItemType()) {
-                    case TEMPLATE:
-                    case ENTITY:
-                        dto.setPlanYaml("services: [{ type: "+dto.getJavaType()+" }]");
-                        break;
-                    case POLICY:
-                        dto.setPlanYaml(POLICIES_KEY + ": [{ type: "+dto.getJavaType()+" }]");
-                        break;
-                    case LOCATION:
-                        dto.setPlanYaml(LOCATIONS_KEY + ": [{ type: "+dto.getJavaType()+" }]");
-                        break;
-                }
-                dto.setJavaType(null);
-
-                return dto;
-            }
-        };
-    }
-
-    transient CatalogXmlSerializer serializer;
-    
-    public String toXmlString() {
-        if (serializer==null) loadSerializer();
-        return serializer.toString(catalog.dto);
-    }
-    
-    private synchronized void loadSerializer() {
-        if (serializer==null) 
-            serializer = new CatalogXmlSerializer();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleConverter.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleConverter.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleConverter.java
deleted file mode 100644
index 79b39c3..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleConverter.java
+++ /dev/null
@@ -1,63 +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.core.catalog.internal;
-
-import com.thoughtworks.xstream.converters.Converter;
-import com.thoughtworks.xstream.converters.MarshallingContext;
-import com.thoughtworks.xstream.converters.UnmarshallingContext;
-import com.thoughtworks.xstream.converters.reflection.ReflectionConverter;
-import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
-import com.thoughtworks.xstream.io.HierarchicalStreamReader;
-import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
-import com.thoughtworks.xstream.mapper.Mapper;
-
-
-/**
- *  Convert old-style catalog.xml file formats to the latest version.
- *  The code is needed only during transition to the new version, can be removed after a while.
- */
-@Deprecated
-public class CatalogBundleConverter implements Converter {
-
-    private ReflectionConverter delegateConverter;
-
-    public CatalogBundleConverter(Mapper mapper, ReflectionProvider reflectionProvider) {
-        this.delegateConverter = new ReflectionConverter(mapper, reflectionProvider);
-    }
-
-    @Override
-    public boolean canConvert(@SuppressWarnings("rawtypes") Class type) {
-        return type == CatalogBundleDto.class;
-    }
-
-    @Override
-    public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
-        context.convertAnother(source, delegateConverter);
-    }
-
-    @Override
-    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
-        if (reader.hasMoreChildren()) {
-            return context.convertAnother(context.currentObject(), CatalogBundleDto.class, delegateConverter);
-        } else {
-            return new CatalogBundleDto(null, null, reader.getValue());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleDto.java
deleted file mode 100644
index d3ce7ac..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleDto.java
+++ /dev/null
@@ -1,96 +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.core.catalog.internal;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-
-public class CatalogBundleDto implements CatalogBundle {
-    private String symbolicName;
-    private String version;
-    private String url;
-
-    public CatalogBundleDto() {}
-
-    public CatalogBundleDto(String name, String version, String url) {
-        if (name == null && version == null) {
-            Preconditions.checkNotNull(url, "url to an OSGi bundle is required");
-        } else {
-            Preconditions.checkNotNull(name, "both name and version are required");
-            Preconditions.checkNotNull(version, "both name and version are required");
-        }
-
-        this.symbolicName = name;
-        this.version = version;
-        this.url = url;
-    }
-
-    @Override
-    public boolean isNameResolved() {
-        return symbolicName != null && version != null;
-    }
-    
-    @Override
-    public boolean isNamed() { return isNameResolved(); }
-
-    @Override
-    public String getSymbolicName() {
-        return symbolicName;
-    }
-
-    @Override
-    public String getVersion() {
-        return version;
-    }
-
-    @Override
-    public String getUrl() {
-        return url;
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("symbolicName", symbolicName)
-                .add("version", version)
-                .add("url", url)
-                .toString();
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(symbolicName, version, url);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
-        CatalogBundleDto other = (CatalogBundleDto) obj;
-        if (!Objects.equal(symbolicName, other.symbolicName)) return false;
-        if (!Objects.equal(version, other.version)) return false;
-        if (!Objects.equal(url, other.url)) return false;
-        return true;
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java
deleted file mode 100644
index d183c7e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java
+++ /dev/null
@@ -1,357 +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.core.catalog.internal;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.core.mgmt.BrooklynTags;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.javalang.ReflectionScanner;
-import org.apache.brooklyn.util.core.javalang.UrlClassLoader;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.javalang.AggregateClassLoader;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Time;
-import org.apache.commons.lang3.ClassUtils;
-import org.reflections.util.ClasspathHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.Iterables;
-
-public class CatalogClasspathDo {
-
-    public static enum CatalogScanningModes {
-        /** the classpath is not scanned; 
-         * for any catalog which is presented over the internet this is recommended (to prevent loading) and is the default; 
-         * (you should explicitly list the items to include; it may be useful to autogenerate it by using a local catalog
-         * scanning with ANNOTATIONS, viwing that by running mgmt.getCatalog().toXmlString(),
-         * then editing the resulting XML (e.g. setting the classpath and removing the scan attribute) */
-        NONE, 
-        
-        /** types in the classpath are scanned for annotations indicating inclusion in the catalog ({@link Catalog});
-         * this is the default if no catalog is supplied, scanning the local classpath */
-        ANNOTATIONS,
-        
-        @Beta
-        /** all catalog-friendly types are included, 
-         * even if not annotated for inclusion in the catalog; useful for quick hacking,
-         * or a classpath (and possibly in future a regex, if added) which is known to have only good things in it;
-         * however the precise semantics of what is included is subject to change,
-         * and it is strongly recommended to use the {@link Catalog} annotation and scan for annotations 
-         * <p>
-         * a catalog-friendly type is currently defined as:
-         * any concrete non-anonymous (and not a non-static inner) class implementing Entity or Policy;
-         * and additionally for entities and applications, an interface with the {@link ImplementedBy} annotation;
-         * note that this means classes done "properly" with both an interface and an implementation
-         * will be included twice, once as interface and once as implementation;
-         * this guarantees inclusion of anything previously included (implementations; 
-         * and this will be removed from catalog in future likely),
-         * plus things now done properly (which will become the only way in the future)
-         **/
-        TYPES
-    }
-    
-    private static final Logger log = LoggerFactory.getLogger(CatalogClasspathDo.class);
-    
-    private final CatalogDo catalog;
-    private final CatalogClasspathDto classpath;
-    private final CatalogScanningModes scanMode;
-    
-    boolean isLoaded = false;
-    private URL[] urls;
-    
-    private final AggregateClassLoader classloader = AggregateClassLoader.newInstanceWithNoLoaders();
-    private volatile boolean classloaderLoaded = false;
-
-    public CatalogClasspathDo(CatalogDo catalog) {
-        this.catalog = Preconditions.checkNotNull(catalog, "catalog");
-        this.classpath = catalog.dto.classpath;
-        this.scanMode = (classpath != null) ? classpath.scan : null;
-    }
-    
-    /** causes all scanning-based classpaths to scan the classpaths
-    * (but does _not_ load all JARs) */
-    // TODO this does a Java scan; we also need an OSGi scan which uses the OSGi classloaders when loading for scanning and resolving dependencies 
-    synchronized void load() {
-        if (classpath == null || isLoaded) return;
-
-        if (classpath.getEntries() == null) {
-            urls = new URL[0];
-        } else {
-            urls = new URL[classpath.getEntries().size()];
-            for (int i=0; i<urls.length; i++) {
-                try {
-                    String u = classpath.getEntries().get(i);
-                    if (u.startsWith("classpath:")) {
-                        // special support for classpath: url's
-                        // TODO put convenience in ResourceUtils for extracting to a normal url
-                        // (or see below)
-                        InputStream uin = ResourceUtils.create(this).getResourceFromUrl(u);
-                        File f = Os.newTempFile("brooklyn-catalog-"+u, null);
-                        FileOutputStream fout = new FileOutputStream(f);
-                        try {
-                            Streams.copy(uin, fout);
-                        } finally {
-                            Streams.closeQuietly(fout);
-                            Streams.closeQuietly(uin);
-                        }
-                        u = f.toURI().toString();
-                    }
-                    urls[i] = new URL(u);
-                    
-                    // TODO potential disk leak above as we have no way to know when the temp file can be removed earlier than server shutdown;
-                    // a better way to handle this is to supply a stream handler (but URLConnection is a little bit hard to work with):
-//                    urls[i] = new URL(null, classpath.getEntries().get(i)   // (handy construtor for reparsing urls, without splitting into uri first)
-//                        , new URLStreamHandler() {
-//                            @Override
-//                            protected URLConnection openConnection(URL u) throws IOException {
-//                                new ResourceUtils(null). ???
-//                            }
-//                        });
-                } catch (Exception e) {
-                    Exceptions.propagateIfFatal(e);
-                    log.error("Error loading URL "+classpath.getEntries().get(i)+" in definition of catalog "+catalog+"; skipping definition");
-                    throw Exceptions.propagate(e);
-                }
-            }
-        }
-        
-        // prefix is supported (but not really used yet) --
-        // seems to have _better_ URL-discovery with prefixes 
-        // (might also offer regex ? but that is post-load filter as opposed to native optimisation)
-        String prefix = null;
-
-        if (scanMode==null || scanMode==CatalogScanningModes.NONE)
-            return;
-        
-        Stopwatch timer = Stopwatch.createStarted();
-        ReflectionScanner scanner = null;
-        if (!catalog.isLocal()) {
-            log.warn("Scanning not supported for remote catalogs; ignoring scan request in "+catalog);
-        } else if (classpath.getEntries() == null || classpath.getEntries().isEmpty()) {
-            // scan default classpath:
-            ClassLoader baseCL = null;
-            Iterable<URL> baseCP = null;
-            if (catalog.mgmt instanceof ManagementContextInternal) {
-                baseCL = ((ManagementContextInternal)catalog.mgmt).getBaseClassLoader();
-                baseCP = ((ManagementContextInternal)catalog.mgmt).getBaseClassPathForScanning();
-            }
-            scanner = new ReflectionScanner(baseCP, prefix, baseCL, catalog.getRootClassLoader());
-            if (scanner.getSubTypesOf(Entity.class).isEmpty()) {
-                try {
-                    ((ManagementContextInternal)catalog.mgmt).setBaseClassPathForScanning(ClasspathHelper.forJavaClassPath());
-                    log.debug("Catalog scan of default classloader returned nothing; reverting to java.class.path");
-                    baseCP = sanitizeCP(((ManagementContextInternal) catalog.mgmt).getBaseClassPathForScanning());
-                    scanner = new ReflectionScanner(baseCP, prefix, baseCL, catalog.getRootClassLoader());
-                } catch (Exception e) {
-                    log.info("Catalog scan is empty, and unable to use java.class.path (base classpath is "+baseCP+"): "+e);
-                    Exceptions.propagateIfFatal(e);
-                }
-            }
-        } else {
-            // scan specified jars:
-            scanner = new ReflectionScanner(urls==null || urls.length==0 ? null : Arrays.asList(urls), prefix, getLocalClassLoader());
-        }
-        
-        if (scanner!=null) {
-            int count = 0, countApps = 0;
-            if (scanMode==CatalogScanningModes.ANNOTATIONS) {
-                Set<Class<?>> catalogClasses = scanner.getTypesAnnotatedWith(Catalog.class);
-                for (Class<?> c: catalogClasses) {
-                    try {
-                        CatalogItem<?,?> item = addCatalogEntry(c);
-                        count++;
-                        if (CatalogTemplateItemDto.class.isInstance(item)) countApps++;
-                    } catch (Exception e) {
-                        log.warn("Failed to add catalog entry for "+c+"; continuing scan...", e);
-                    }
-                }
-            } else if (scanMode==CatalogScanningModes.TYPES) {
-                Iterable<Class<?>> entities = this.excludeInvalidClasses(
-                        Iterables.concat(scanner.getSubTypesOf(Entity.class),
-                                // not sure why we have to look for sub-types of Application, 
-                                // they should be picked up as sub-types of Entity, but in maven builds (only!)
-                                // they are not -- i presume a bug in scanner
-                                scanner.getSubTypesOf(Application.class), 
-                                scanner.getSubTypesOf(ApplicationBuilder.class)));
-                for (Class<?> c: entities) {
-                    if (Application.class.isAssignableFrom(c) || ApplicationBuilder.class.isAssignableFrom(c)) {
-                        addCatalogEntry(new CatalogTemplateItemDto(), c);
-                        countApps++;
-                    } else {
-                        addCatalogEntry(new CatalogEntityItemDto(), c);
-                    }
-                    count++;
-                }
-                Iterable<Class<? extends Policy>> policies = this.excludeInvalidClasses(scanner.getSubTypesOf(Policy.class));
-                for (Class<?> c: policies) {
-                    addCatalogEntry(new CatalogPolicyItemDto(), c);
-                    count++;
-                }
-                
-                Iterable<Class<? extends Location>> locations = this.excludeInvalidClasses(scanner.getSubTypesOf(Location.class));
-                for (Class<?> c: locations) {
-                    addCatalogEntry(new CatalogLocationItemDto(), c);
-                    count++;
-                }
-            } else {
-                throw new IllegalStateException("Unsupported catalog scan mode "+scanMode+" for "+this);
-            }
-            log.debug("Catalog '"+catalog.dto.name+"' classpath scan completed: loaded "+
-                    count+" item"+Strings.s(count)+" ("+countApps+" app"+Strings.s(countApps)+") in "+Time.makeTimeStringRounded(timer));
-        }
-        
-        isLoaded = true;
-    }
-
-    private Iterable<URL> sanitizeCP(Iterable<URL> baseClassPathForScanning) {
-        /*
-        If Brooklyn is being run via apache daemon[1], and the classpath contains the contents of an empty folder,
-        (e.g. xxx:lib/patch/*:xxx) the classpath will be incorrectly expanded to include a zero-length string
-        (e.g. xxx::xxx), which is then interpreted by {@link org.reflections.Reflections#scan} as the root of the
-        file system. See [2], line 90+. This needs to be removed, lest we attempt to scan the entire filesystem
-
-        [1]: http://commons.apache.org/proper/commons-daemon/
-        [2]: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/arguments.c?view=markup&pathrev=1196468
-         */
-        Iterables.removeIf(baseClassPathForScanning, new Predicate<URL>() {
-            @Override
-            public boolean apply(@Nullable URL url) {
-                return Strings.isEmpty(url.getFile()) || "/".equals(url.getFile());
-            }
-        });
-        return baseClassPathForScanning;
-    }
-
-    /** removes inner classes (non-static nesteds) and others; 
-     * bear in mind named ones will be hard to instantiate without the outer class instance) */
-    private <T> Iterable<Class<? extends T>> excludeInvalidClasses(Iterable<Class<? extends T>> input) {
-        Predicate<Class<? extends T>> f = new Predicate<Class<? extends T>>() {
-            @Override
-            public boolean apply(@Nullable Class<? extends T> input) {
-                if (input==null) return false;
-                if (input.isLocalClass() || input.isAnonymousClass()) return false;
-                if (Modifier.isAbstract(input.getModifiers())) {
-                    if (input.getAnnotation(ImplementedBy.class)==null)
-                        return false;
-                }
-                // non-abstract top-level classes are okay
-                if (!input.isMemberClass()) return true;
-                if (!Modifier.isStatic(input.getModifiers())) return false;
-                // nested classes only okay if static
-                return true;
-            }
-        };
-        return Iterables.filter(input, f);
-    }
-
-    /** augments the given item with annotations and class data for the given class, then adds to catalog
-     * @deprecated since 0.7.0 the classpath DO is replaced by libraries */
-    @Deprecated
-    public CatalogItem<?,?> addCatalogEntry(Class<?> c) {
-        if (Application.class.isAssignableFrom(c)) return addCatalogEntry(new CatalogTemplateItemDto(), c);
-        if (ApplicationBuilder.class.isAssignableFrom(c)) return addCatalogEntry(new CatalogTemplateItemDto(), c);
-        if (Entity.class.isAssignableFrom(c)) return addCatalogEntry(new CatalogEntityItemDto(), c);
-        if (Policy.class.isAssignableFrom(c)) return addCatalogEntry(new CatalogPolicyItemDto(), c);
-        if (Location.class.isAssignableFrom(c)) return addCatalogEntry(new CatalogLocationItemDto(), c);
-        throw new IllegalStateException("Cannot add "+c+" to catalog: unsupported type "+c.getName());
-    }
-    
-    /** augments the given item with annotations and class data for the given class, then adds to catalog 
-     * @deprecated since 0.7.0 the classpath DO is replaced by libraries */
-    @Deprecated
-    public CatalogItem<?,?> addCatalogEntry(CatalogItemDtoAbstract<?,?> item, Class<?> c) {
-        Catalog catalogAnnotation = c.getAnnotation(Catalog.class);
-        item.setSymbolicName(c.getName());
-        item.setJavaType(c.getName());
-        item.setDisplayName(firstNonEmpty(c.getSimpleName(), c.getName()));
-        if (catalogAnnotation!=null) {
-            item.setDisplayName(firstNonEmpty(catalogAnnotation.name(), item.getDisplayName()));
-            item.setDescription(firstNonEmpty(catalogAnnotation.description()));
-            item.setIconUrl(firstNonEmpty(catalogAnnotation.iconUrl()));
-        }
-        if (item instanceof CatalogEntityItemDto || item instanceof CatalogTemplateItemDto) {
-            item.tags().addTag(BrooklynTags.newTraitsTag(ClassUtils.getAllInterfaces(c)));
-        }
-        if (log.isTraceEnabled())
-            log.trace("adding to catalog: "+c+" (from catalog "+catalog+")");
-        catalog.addEntry(item);
-        return item;
-    }
-
-    private static String firstNonEmpty(String ...candidates) {
-        for (String c: candidates)
-            if (c!=null && !c.isEmpty()) return c;
-        return null;
-    }
-
-    /** returns classloader for the entries specified here */
-    public ClassLoader getLocalClassLoader() {
-        if (!classloaderLoaded) loadLocalClassLoader();
-        return classloader;
-    }
-
-    protected synchronized void loadLocalClassLoader() {
-        if (classloaderLoaded) return;
-        if (urls==null) return;
-        classloader.addFirst(new UrlClassLoader(urls));
-        classloaderLoaded = true;
-        return;
-    }
-
-    /** adds the given URL as something this classloader will load
-     * (however no scanning is done) */
-    public void addToClasspath(URL u, boolean updateDto) {
-        if (updateDto) classpath.getEntries().add(u.toExternalForm());
-        addToClasspath(new UrlClassLoader(u));
-    }
-
-    /** adds the given URL as something this classloader will load
-     * (however no scanning is done).
-     * <p>
-     * the DTO will _not_ be updated. */
-    public void addToClasspath(ClassLoader loader) {
-        classloader.addFirst(loader);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDto.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDto.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDto.java
deleted file mode 100644
index 5779a4e..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDto.java
+++ /dev/null
@@ -1,43 +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.core.catalog.internal;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
-
-public class CatalogClasspathDto {
-    
-    /** whether/what to scan; defaults to 'none' */
-    CatalogScanningModes scan;
-    private List<String> entries;
-    
-    public synchronized void addEntry(String url) {
-        if (entries==null)
-            entries = new CopyOnWriteArrayList<String>();
-        
-        entries.add(url);
-    }
-
-    public synchronized List<String> getEntries() {
-        return entries;
-    }
-    
-}


[17/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
deleted file mode 100644
index e78a1af..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
+++ /dev/null
@@ -1,226 +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.core.entity;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.time.Duration;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.apache.brooklyn.test.Asserts.assertEquals;
-
-/**
- * Convenience class containing assertions that may be made about entities.
- */
-public class EntityAsserts {
-
-
-    public static <T> void assertAttributeEquals(Entity entity, AttributeSensor<T> attribute, T expected) {
-        assertEquals(entity.getAttribute(attribute), expected, "entity=" + entity + "; attribute=" + attribute);
-    }
-
-    public static <T> void assertConfigEquals(Entity entity, ConfigKey<T> configKey, T expected) {
-        assertEquals(entity.getConfig(configKey), expected, "entity=" + entity + "; configKey=" + configKey);
-    }
-
-    public static <T> void assertAttributeEqualsEventually(final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        assertAttributeEqualsEventually(Maps.newLinkedHashMap(), entity, attribute, expected);
-    }
-
-    public static <T> void assertAttributeEqualsEventually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        // Not using assertAttributeEventually(predicate) so get nicer error message
-        Asserts.succeedsEventually((Map) flags, new Runnable() {
-            @Override
-            public void run() {
-                assertAttributeEquals(entity, attribute, expected);
-            }
-        });
-    }
-
-    public static <T> T assertAttributeEventuallyNonNull(final Entity entity, final AttributeSensor<T> attribute) {
-        return assertAttributeEventuallyNonNull(Maps.newLinkedHashMap(), entity, attribute);
-    }
-
-    public static <T> T assertAttributeEventuallyNonNull(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute) {
-        return assertAttributeEventually(flags, entity, attribute, Predicates.notNull());
-    }
-
-    public static <T> T assertAttributeEventually(final Entity entity, final AttributeSensor<T> attribute, Predicate<? super T> predicate) {
-        return assertAttributeEventually(ImmutableMap.of(), entity, attribute, predicate);
-    }
-
-    public static <T> T assertAttributeEventually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final Predicate<? super T> predicate) {
-        final AtomicReference<T> result = new AtomicReference<T>();
-        Asserts.succeedsEventually((Map)flags, new Runnable() {
-            @Override public void run() {
-                T val = entity.getAttribute(attribute);
-                Asserts.assertTrue(predicate.apply(val), "val=" + val);
-                result.set(val);
-            }});
-        return result.get();
-    }
-
-    public static <T> T assertAttribute(final Entity entity, final AttributeSensor<T> attribute, final Predicate<? super T> predicate) {
-        T val = entity.getAttribute(attribute);
-        Asserts.assertTrue(predicate.apply(val), "val=" + val);
-        return val;
-    }
-
-
-    public static <T extends Entity> void assertPredicateEventuallyTrue(final T entity, final Predicate<? super T> predicate) {
-        assertPredicateEventuallyTrue(Maps.newLinkedHashMap(), entity, predicate);
-    }
-
-    public static <T extends Entity> void assertPredicateEventuallyTrue(Map<?,?> flags, final T entity, final Predicate<? super T> predicate) {
-        Asserts.succeedsEventually((Map)flags, new Runnable() {
-            @Override public void run() {
-                Asserts.assertTrue(predicate.apply(entity), "predicate unsatisfied");
-            }});
-    }
-
-    public static <T> void assertAttributeEqualsContinually(final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        assertAttributeEqualsContinually(Maps.newLinkedHashMap(), entity, attribute, expected);
-    }
-
-    public static <T> void assertAttributeEqualsContinually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        Asserts.succeedsContinually(flags, new Runnable() {
-            @Override public void run() {
-                assertAttributeEquals(entity, attribute, expected);
-            }});
-    }
-
-    public static void assertGroupSizeEqualsEventually(final Group group, int expected) {
-        assertGroupSizeEqualsEventually(ImmutableMap.of(), group, expected);
-    }
-
-    public static void assertGroupSizeEqualsEventually(Map<?,?> flags, final Group group, final int expected) {
-        Asserts.succeedsEventually((Map)flags, new Runnable() {
-            @Override public void run() {
-                Collection<Entity> members = group.getMembers();
-                assertEquals(members.size(), expected, "members=" + members);
-            }});
-    }
-
-
-    /**
-     * Asserts that the entity's value for this attribute changes, by registering a subscription and checking the value.
-     *
-     * @param entity The entity whose attribute will be checked.
-     * @param attribute The attribute to check on the entity.
-     *
-     * @throws AssertionError if the assertion fails.
-     */
-    public static void assertAttributeChangesEventually(final Entity entity, final AttributeSensor<?> attribute) {
-        final Object origValue = entity.getAttribute(attribute);
-        final AtomicBoolean changed = new AtomicBoolean();
-        SubscriptionHandle handle = entity.subscriptions().subscribe(entity, attribute, new SensorEventListener<Object>() {
-            @Override public void onEvent(SensorEvent<Object> event) {
-                if (!Objects.equal(origValue, event.getValue())) {
-                    changed.set(true);
-                }
-            }});
-        try {
-            Asserts.succeedsEventually(new Runnable() {
-                @Override public void run() {
-                    Asserts.assertTrue(changed.get(), entity + " -> " + attribute + " not changed");
-                }});
-        } finally {
-            entity.subscriptions().unsubscribe(entity, handle);
-        }
-    }
-
-
-    /**
-     * Assert that the given attribute of an entity does not take any of the disallowed values during a given period.
-     *
-     * This method relies on {@link Asserts#succeedsContinually(Runnable)}, therefore it loops comparing the value
-     * of the attribute to the disallowed values, rather than setting up a subscription.  It may therefore miss a
-     * situation where the attribute temporarily takes a disallowed value. This method is therefore suited for use
-     * where the attribute will take on a value permanently, which may or may not be disallowed.
-     *
-     * @param entity      The entity owning the attribute to check.
-     * @param attribute   The attribute on the entity.
-     * @param disallowed  The disallowed values for the entity.
-     * @param <T>         Type of the sensor.
-     */
-    @Beta @SafeVarargs
-    public static <T> void assertAttributeContinuallyNotEqualTo(final Entity entity, final AttributeSensor<T> attribute, T... disallowed) {
-        final Set<T> reject = Sets.newHashSet(disallowed);
-        Asserts.succeedsContinually(new Runnable() {
-            @Override
-            public void run() {
-                T val = entity.getAttribute(attribute);
-                Asserts.assertFalse(reject.contains(val),
-                        "Attribute " + attribute + " on " + entity + " has disallowed value " + val);
-            }
-        });
-    }
-
-    /**
-     * Assert that the given attribute of an entity does not take any of the disallowed values during a given period.
-     *
-     * This method relies on {@link Asserts#succeedsContinually(Runnable)}, therefore it loops comparing the value
-     * of the attribute to the disallowed values, rather than setting up a subscription.  It may therefore miss a
-     * situation where the attribute temporarily takes a disallowed value. This method is therefore suited for use
-     * where the attribute will take on a value permanently, which may or may not be disallowed.
-     *
-     * @param flags       Flags controlling the loop, with keys: <ul>
-     *                    <li>timeout: a {@link Duration} specification String for the duration for which to test the
-     *                    assertion. Default 1 second.</li>
-     *                    <li>period: a {@link Duration} specification String for the interval at which to perform polls
-     *                    on the attribute value. Default 10ms.</li>
-     *                   </ul>
-     * @param entity      The entity owning the attribute to check.
-     * @param attribute   The attribute on the entity.
-     * @param disallowed  The disallowed values for the entity.
-     * @param <T>         Type of the sensor.
-     */
-    @Beta @SafeVarargs
-    public static <T> void assertAttributeContinuallyNotEqualTo(final Map<?, ?> flags, final Entity entity, final AttributeSensor<T> attribute, T... disallowed) {
-        final Set<T> reject = Sets.newHashSet(disallowed);
-        Asserts.succeedsContinually(flags, new Runnable() {
-            @Override
-            public void run() {
-                T val = entity.getAttribute(attribute);
-                Asserts.assertFalse(reject.contains(val),
-                        "Attribute " + attribute + " on " + entity + " has disallowed value " + val);
-            }
-        });
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
deleted file mode 100644
index 69e8caa..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
+++ /dev/null
@@ -1,376 +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.core.entity;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityType;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.core.effector.EffectorAndBody;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.effector.EffectorWithBody;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.effector.MethodEffector;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorBodyTaskFactory;
-import org.apache.brooklyn.core.effector.EffectorTasks.EffectorTaskFactory;
-import org.apache.brooklyn.core.objs.BrooklynDynamicType;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Joiner;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-
-/** This is the actual type of an entity instance at runtime,
- * which can change from the static {@link EntityType}, and can change over time;
- * for this reason it does *not* implement EntityType, but 
- * callers can call {@link #getSnapshot()} to get a snapshot such instance  
- */
-public class EntityDynamicType extends BrooklynDynamicType<Entity, AbstractEntity> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EntityDynamicType.class);
-
-    /** 
-     * Effectors on this entity, by name.
-     */
-    // TODO support overloading; requires not using a map keyed off method name.
-    private final Map<String, Effector<?>> effectors = new ConcurrentHashMap<String, Effector<?>>();
-
-    /** 
-     * Map of sensors on this entity, by name.
-     */
-    private final ConcurrentMap<String,Sensor<?>> sensors = new ConcurrentHashMap<String, Sensor<?>>();
-
-    public EntityDynamicType(AbstractEntity entity) {
-        this(entity.getClass(), entity);
-    }
-    public EntityDynamicType(Class<? extends Entity> clazz) {
-        this(clazz, null);
-    }
-    private EntityDynamicType(Class<? extends Entity> clazz, AbstractEntity entity) {
-        super(clazz, entity);
-        String id = entity==null ? clazz.getName() : entity.getId();
-        
-        effectors.putAll(findEffectors(clazz, null));
-        if (LOG.isTraceEnabled())
-            LOG.trace("Entity {} effectors: {}", id, Joiner.on(", ").join(effectors.keySet()));
-        
-        sensors.putAll(findSensors(clazz, null));
-        if (LOG.isTraceEnabled())
-            LOG.trace("Entity {} sensors: {}", id, Joiner.on(", ").join(sensors.keySet()));
-        
-        refreshSnapshot();
-    }
-    
-    /**
-     * @deprecated since 0.7; unused code; instead use {@link #getBrooklynClass()}
-     */
-    @Deprecated
-    public Class<? extends Entity> getEntityClass() {
-        return super.getBrooklynClass();
-    }
-    
-    @Override
-    public EntityType getSnapshot() {
-        return (EntityType) super.getSnapshot();
-    }
-
-    // --------------------------------------------------
-    
-    /**
-     * @return the effector with the given name, or null if not found
-     */
-    public Effector<?> getEffector(String name) {
-        return effectors.get(name);
-    }
-    
-    /**
-     * Effectors available on this entity.
-     */
-    public Map<String,Effector<?>> getEffectors() {
-        return Collections.unmodifiableMap(effectors);
-    }
-    
-    /**
-     * Adds the given {@link Effector} to this entity.
-     */
-    @Beta
-    public void addEffector(Effector<?> newEffector) {
-        Effector<?> oldEffector = effectors.put(newEffector.getName(), newEffector);
-        invalidateSnapshot();
-        if (oldEffector!=null)
-            instance.sensors().emit(AbstractEntity.EFFECTOR_CHANGED, newEffector.getName());
-        else
-            instance.sensors().emit(AbstractEntity.EFFECTOR_ADDED, newEffector.getName());
-    }
-
-    /**
-     * Adds an effector with an explicit body to this entity.
-     */
-    @Beta
-    public <T> void addEffector(Effector<T> effector, EffectorTaskFactory<T> body) {
-        addEffector(new EffectorAndBody<T>(effector, body));
-    }
-
-    /**
-     * Adds an effector with an explicit body to this entity.
-     */
-    @Beta
-    public <T> void addEffector(Effector<T> effector, EffectorBody<T> body) {
-        addEffector(effector, new EffectorBodyTaskFactory<T>(body));
-    }
-
-    /**
-     * Removes the given {@link Effector} from this entity.
-     * <p>
-     * Note that if the argument is an instance of {@link EffectorWithBody} it will
-     * still be possible to invoke the effector on the entity by calling
-     * <code>entity.invoke(effector, argumentsMap)</code>.
-     */
-    @Beta
-    public void removeEffector(Effector<?> effector) {
-        Effector<?> removed = effectors.remove(effector.getName());
-        invalidateSnapshot();
-        if (removed != null) {
-            instance.sensors().emit(AbstractEntity.EFFECTOR_REMOVED, removed.getName());
-        }
-    }
-
-    // --------------------------------------------------
-    
-    /**
-     * Sensors available on this entity.
-     */
-    public Map<String,Sensor<?>> getSensors() {
-        return Collections.unmodifiableMap(sensors);
-    }
-    
-    /** 
-     * Convenience for finding named sensor.
-     */
-    public Sensor<?> getSensor(String sensorName) {
-        return sensors.get(sensorName);
-    }
-
-    /**
-     * Adds the given {@link Sensor} to this entity.
-     */
-    public void addSensor(Sensor<?> newSensor) {
-        sensors.put(newSensor.getName(), newSensor);
-        invalidateSnapshot();
-        instance.sensors().emit(AbstractEntity.SENSOR_ADDED, newSensor);
-    }
-    
-    /**
-     * Adds the given {@link Sensor}s to this entity.
-     */
-    public void addSensors(Iterable<? extends Sensor<?>> newSensors) {
-        for (Sensor<?> sensor : newSensors) {
-            addSensor(sensor);
-        }
-    }
-    
-    public void addSensorIfAbsent(Sensor<?> newSensor) {
-        Sensor<?> prev = addSensorIfAbsentWithoutPublishing(newSensor);
-        if (prev == null) {
-            instance.sensors().emit(AbstractEntity.SENSOR_ADDED, newSensor);
-        }
-    }
-    
-    public Sensor<?> addSensorIfAbsentWithoutPublishing(Sensor<?> newSensor) {
-        Sensor<?> prev = sensors.putIfAbsent(newSensor.getName(), newSensor);
-        if (prev == null) {
-            invalidateSnapshot();
-        }
-        return prev;
-    }
-
-    /**
-     * Removes the named {@link Sensor} from this entity.
-     */
-    public Sensor<?> removeSensor(String sensorName) {
-        Sensor<?> result = sensors.remove(sensorName);
-        if (result != null) {
-            invalidateSnapshot();
-            instance.sensors().emit(AbstractEntity.SENSOR_REMOVED, result);
-        }
-        return result;
-    }
-    
-    /**
-     * Removes the named {@link Sensor} from this entity.
-     */
-    public boolean removeSensor(Sensor<?> sensor) {
-        return (removeSensor(sensor.getName()) != null);
-    }
-    
-    // --------------------------------------------------
-    
-    /**
-     * Adds the given {@link ConfigKey} to this entity.
-     */
-    public void addConfigKey(ConfigKey<?> newKey) {
-        configKeys.put(newKey.getName(), new FieldAndValue<ConfigKey<?>>(null, newKey));
-        invalidateSnapshot();
-        instance.sensors().emit(AbstractEntity.CONFIG_KEY_ADDED, newKey);
-    }
-    
-    /**
-     * Adds the given {@link ConfigKey} to this entity.
-     */
-    public void addConfigKeys(Iterable<ConfigKey<?>> newKeys) {
-        for (ConfigKey<?> newKey : newKeys) {
-            addConfigKey(newKey);
-        }
-    }
-
-    /**
-     * Removes the named {@link ConfigKey} from this entity.
-     */
-    public boolean removeConfigKey(ConfigKey<?> key) {
-        FieldAndValue<ConfigKey<?>> result = configKeys.remove(key.getName());
-        if (result != null) {
-            invalidateSnapshot();
-            ConfigKey<?> removedKey = result.value;
-            instance.sensors().emit(AbstractEntity.CONFIG_KEY_REMOVED, removedKey);
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // --------------------------------------------------
-    
-    @Override
-    protected EntityTypeSnapshot newSnapshot() {
-        return new EntityTypeSnapshot(name, value(configKeys), sensors, effectors.values());
-    }
-    
-    /**
-     * Finds the effectors defined on the entity's class, statics and optionally any non-static (discouraged).
-     */
-    public static Map<String,Effector<?>> findEffectors(Class<? extends Entity> clazz, Entity optionalEntity) {
-        try {
-            Map<String,Effector<?>> result = Maps.newLinkedHashMap();
-            Map<String,Field> fieldSources = Maps.newLinkedHashMap();
-            Map<String,Method> methodSources = Maps.newLinkedHashMap();
-            
-            for (Field f : Reflections.findPublicFieldsOrderedBySuper(clazz)) {
-                if (Effector.class.isAssignableFrom(f.getType())) {
-                    if (!Modifier.isStatic(f.getModifiers())) {
-                        // require it to be static or we have an instance
-                        LOG.warn("Discouraged/deprecated use of non-static effector field "+f+" defined in " + (optionalEntity!=null ? optionalEntity : clazz));
-                        if (optionalEntity==null) continue;
-                    }
-                    Effector<?> eff = (Effector<?>) f.get(optionalEntity);
-                    if (eff==null) {
-                        LOG.warn("Effector "+f+" undefined for "+clazz+" ("+optionalEntity+")");
-                        continue;
-                    }
-                    Effector<?> overwritten = result.put(eff.getName(), eff);
-                    Field overwrittenFieldSource = fieldSources.put(eff.getName(), f);
-                    if (overwritten!=null && !Effectors.sameInstance(overwritten, eff)) {
-                        LOG.trace("multiple definitions for effector {} on {}; preferring {} from {} to {} from {}", new Object[] {
-                                eff.getName(), (optionalEntity != null ? optionalEntity : clazz), eff, f, overwritten, 
-                                overwrittenFieldSource});
-                    }
-                }
-            }
-
-            for (Method m : Reflections.findPublicMethodsOrderedBySuper(clazz)) {
-                org.apache.brooklyn.core.annotation.Effector effectorAnnotation = m.getAnnotation(org.apache.brooklyn.core.annotation.Effector.class);
-                if (effectorAnnotation != null) {
-                    if (Modifier.isStatic(m.getModifiers())) {
-                        // require it to be static or we have an instance
-                        LOG.warn("Discouraged/deprecated use of static annotated effector method "+m+" defined in " + (optionalEntity!=null ? optionalEntity : clazz));
-                        if (optionalEntity==null) continue;
-                    }
-
-                    Effector<?> eff = MethodEffector.create(m);
-                    Effector<?> overwritten = result.get(eff.getName());
-                    
-                    if ((overwritten instanceof EffectorWithBody) && !(overwritten instanceof MethodEffector<?>)) {
-                        // don't let annotations on methods override a static, unless that static is a MethodEffector
-                        // TODO not perfect, but approx right; we should clarify whether we prefer statics or methods
-                    } else {
-                        result.put(eff.getName(), eff);
-                        Method overwrittenMethodSource = methodSources.put(eff.getName(), m);
-                        Field overwrittenFieldSource = fieldSources.remove(eff.getName());
-                        LOG.trace("multiple definitions for effector {} on {}; preferring {} from {} to {} from {}", new Object[] {
-                                eff.getName(), (optionalEntity != null ? optionalEntity : clazz), eff, m, overwritten, 
-                                (overwrittenMethodSource != null ? overwrittenMethodSource : overwrittenFieldSource)});
-                    }
-                }
-            }
-
-            return result;
-        } catch (IllegalAccessException e) {
-            throw Throwables.propagate(e);
-        }
-    }
-    
-
-    /**
-     * Finds the sensors defined on the entity's class, statics and optionally any non-static (discouraged).
-     */
-    public static Map<String,Sensor<?>> findSensors(Class<? extends Entity> clazz, Entity optionalEntity) {
-        try {
-            Map<String,Sensor<?>> result = Maps.newLinkedHashMap();
-            Map<String,Field> sources = Maps.newLinkedHashMap();
-            for (Field f : Reflections.findPublicFieldsOrderedBySuper((clazz))) {
-                if (Sensor.class.isAssignableFrom(f.getType())) {
-                    if (!Modifier.isStatic(f.getModifiers())) {
-                        // require it to be static or we have an instance
-                        LOG.warn("Discouraged use of non-static sensor "+f+" defined in " + (optionalEntity!=null ? optionalEntity : clazz));
-                        if (optionalEntity==null) continue;
-                    }
-                    Sensor<?> sens = (Sensor<?>) f.get(optionalEntity);
-                    Sensor<?> overwritten = result.put(sens.getName(), sens);
-                    Field source = sources.put(sens.getName(), f);
-                    if (overwritten!=null && overwritten != sens) {
-                        if (sens instanceof HasConfigKey) {
-                            // probably overriding defaults, just log low level (there will be add'l logging in config key section)
-                            LOG.trace("multiple definitions for config sensor {} on {}; preferring {} from {} to {} from {}", new Object[] {
-                                    sens.getName(), optionalEntity!=null ? optionalEntity : clazz, sens, f, overwritten, source});
-                        } else {
-                            LOG.warn("multiple definitions for sensor {} on {}; preferring {} from {} to {} from {}", new Object[] {
-                                    sens.getName(), optionalEntity!=null ? optionalEntity : clazz, sens, f, overwritten, source});
-                        }
-                    }
-                }
-            }
-
-            return result;
-        } catch (IllegalAccessException e) {
-            throw Throwables.propagate(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
deleted file mode 100644
index c65a176..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
+++ /dev/null
@@ -1,307 +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.core.entity;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.objs.Identifiable;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic;
-import org.apache.brooklyn.util.core.flags.TypeCoercions;
-import org.apache.brooklyn.util.guava.Functionals;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.Iterables;
-
-public class EntityFunctions {
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Function<Entity, T> attributeOld(final AttributeSensor<T> attribute) {
-        // TODO PERSISTENCE WORKAROUND
-        class GetEntityAttributeFunction implements Function<Entity, T> {
-            @Override public T apply(Entity input) {
-                return (input == null) ? null : input.getAttribute(attribute);
-            }
-        }
-        return new GetEntityAttributeFunction();
-    }
-    
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Function<Entity, T> configOld(final ConfigKey<T> key) {
-        // TODO PERSISTENCE WORKAROUND
-        class GetEntityConfigFunction implements Function<Entity, T> {
-            @Override public T apply(Entity input) {
-                return (input == null) ? null : input.getConfig(key);
-            }
-        }
-        return new GetEntityConfigFunction();
-    }
-    
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Function<Entity, String> displayNameOld() {
-        // TODO PERSISTENCE WORKAROUND
-        class GetEntityDisplayName implements Function<Entity, String> {
-            @Override public String apply(Entity input) {
-                return (input == null) ? null : input.getDisplayName();
-            }
-        }
-        return new GetEntityDisplayName();
-    }
-    
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Function<Identifiable, String> idOld() {
-        // TODO PERSISTENCE WORKAROUND
-        class GetIdFunction implements Function<Identifiable, String> {
-            @Override public String apply(Identifiable input) {
-                return (input == null) ? null : input.getId();
-            }
-        }
-        return new GetIdFunction();
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Function<Entity,Void> settingSensorsConstantOld(final Map<AttributeSensor<?>,Object> values) {
-        // TODO PERSISTENCE WORKAROUND
-        class SettingSensorsConstantFunction implements Function<Entity, Void> {
-            @SuppressWarnings({ "unchecked", "rawtypes" })
-            @Override public Void apply(Entity input) {
-                for (Map.Entry<AttributeSensor<?>,Object> entry : values.entrySet()) {
-                    AttributeSensor sensor = (AttributeSensor)entry.getKey();
-                    Object value = entry.getValue();
-                    if (value==Entities.UNCHANGED) {
-                        // nothing
-                    } else if (value==Entities.REMOVE) {
-                        ((EntityInternal)input).removeAttribute(sensor);
-                    } else {
-                        value = TypeCoercions.coerce(value, sensor.getTypeToken());
-                        ((EntityInternal)input).sensors().set(sensor, value);
-                    }
-                }
-                return null;
-            }
-        }
-        return new SettingSensorsConstantFunction();
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <K,V> Function<Entity, Void> updatingSensorMapEntryOld(final AttributeSensor<Map<K,V>> mapSensor, final K key, final Supplier<? extends V> valueSupplier) {
-        // TODO PERSISTENCE WORKAROUND
-        class UpdatingSensorMapEntryFunction implements Function<Entity, Void> {
-            @Override public Void apply(Entity input) {
-                ServiceStateLogic.updateMapSensorEntry((EntityLocal)input, mapSensor, key, valueSupplier.get());
-                return null;
-            }
-        }
-        return new UpdatingSensorMapEntryFunction();
-    }
-
-    /** @deprecated since 0.9.0 kept only to allow conversion of non-static inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Supplier<Collection<Application>> applicationsOld(final ManagementContext mgmt) {
-        // TODO PERSISTENCE WORKAROUND
-        class AppsSupplier implements Supplier<Collection<Application>> {
-            @Override
-            public Collection<Application> get() {
-                return mgmt.getApplications();
-            }
-        }
-        return new AppsSupplier();
-    }
-    
-    public static <T> Function<Entity, T> attribute(AttributeSensor<T> attribute) {
-        return new GetEntityAttributeFunction<T>(checkNotNull(attribute, "attribute"));
-    }
-
-    protected static class GetEntityAttributeFunction<T> implements Function<Entity, T> {
-        private final AttributeSensor<T> attribute;
-        protected GetEntityAttributeFunction(AttributeSensor<T> attribute) {
-            this.attribute = attribute;
-        }
-        @Override public T apply(Entity input) {
-            return (input == null) ? null : input.getAttribute(attribute);
-        }
-    }
-
-    public static <T> Function<Object, T> attribute(Entity entity, AttributeSensor<T> attribute) {
-        return new GetFixedEntityAttributeFunction<>(entity, attribute);
-    }
-
-    protected static class GetFixedEntityAttributeFunction<T> implements Function<Object, T> {
-        private final Entity entity;
-        private final AttributeSensor<T> attribute;
-        protected GetFixedEntityAttributeFunction(Entity entity, AttributeSensor<T> attribute) {
-            this.entity = entity;
-            this.attribute = attribute;
-        }
-        @Override public T apply(Object input) {
-            return entity.getAttribute(attribute);
-        }
-    }
-
-    public static <T> Function<Entity, T> config(ConfigKey<T> key) {
-        return new GetEntityConfigFunction<T>(checkNotNull(key, "key"));
-    }
-
-    protected static class GetEntityConfigFunction<T> implements Function<Entity, T> {
-        private final ConfigKey<T> key;
-
-        protected GetEntityConfigFunction(ConfigKey<T> key) {
-            this.key = key;
-        }
-
-        @Override public T apply(Entity input) {
-            return (input == null) ? null : input.getConfig(key);
-        }
-    }
-
-    public static Function<Entity, String> displayName() {
-        return GetEntityDisplayName.INSTANCE;
-    }
-
-    protected static class GetEntityDisplayName implements Function<Entity, String> {
-        public static final GetEntityDisplayName INSTANCE = new GetEntityDisplayName();
-        @Override public String apply(Entity input) {
-            return (input == null) ? null : input.getDisplayName();
-        }
-    }
-
-    public static Function<Identifiable, String> id() {
-        return GetIdFunction.INSTANCE;
-    }
-    
-    protected static class GetIdFunction implements Function<Identifiable, String> {
-        public static final GetIdFunction INSTANCE = new GetIdFunction();
-        @Override public String apply(Identifiable input) {
-            return (input == null) ? null : input.getId();
-        }
-    }
-
-
-    /** returns a function which sets the given sensors on the entity passed in,
-     * with {@link Entities#UNCHANGED} and {@link Entities#REMOVE} doing those actions. */
-    public static Function<Entity,Void> settingSensorsConstant(final Map<AttributeSensor<?>,Object> values) {
-        return new SettingSensorsConstantFunction(checkNotNull(values, "values"));
-    }
-
-    protected static class SettingSensorsConstantFunction implements Function<Entity, Void> {
-        private final Map<AttributeSensor<?>, Object> values;
-
-        protected SettingSensorsConstantFunction(Map<AttributeSensor<?>, Object> values) {
-            this.values = values;
-        }
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        @Override public Void apply(Entity input) {
-            for (Map.Entry<AttributeSensor<?>,Object> entry : values.entrySet()) {
-                AttributeSensor sensor = (AttributeSensor)entry.getKey();
-                Object value = entry.getValue();
-                if (value==Entities.UNCHANGED) {
-                    // nothing
-                } else if (value==Entities.REMOVE) {
-                    ((EntityInternal)input).sensors().remove(sensor);
-                } else {
-                    value = TypeCoercions.coerce(value, sensor.getTypeToken());
-                    ((EntityInternal)input).sensors().set(sensor, value);
-                }
-            }
-            return null;
-        }
-    }
-
-    /** as {@link #settingSensorsConstant(Map)} but as a {@link Runnable} */
-    public static Runnable settingSensorsConstant(final Entity entity, final Map<AttributeSensor<?>,Object> values) {
-        checkNotNull(entity, "entity");
-        checkNotNull(values, "values");
-        return Functionals.runnable(Suppliers.compose(settingSensorsConstant(values), Suppliers.ofInstance(entity)));
-    }
-
-    public static <K,V> Function<Entity, Void> updatingSensorMapEntry(final AttributeSensor<Map<K,V>> mapSensor, final K key, final Supplier<? extends V> valueSupplier) {
-        return new UpdatingSensorMapEntryFunction<K,V>(mapSensor, key, valueSupplier);
-    }
-    
-    protected static class UpdatingSensorMapEntryFunction<K, V> implements Function<Entity, Void> {
-        private final AttributeSensor<Map<K, V>> mapSensor;
-        private final K key;
-        private final Supplier<? extends V> valueSupplier;
-
-        public UpdatingSensorMapEntryFunction(AttributeSensor<Map<K, V>> mapSensor, K key, Supplier<? extends V> valueSupplier) {
-            this.mapSensor = mapSensor;
-            this.key = key;
-            this.valueSupplier = valueSupplier;
-        }
-        @Override public Void apply(Entity input) {
-            ServiceStateLogic.updateMapSensorEntry((EntityLocal)input, mapSensor, key, valueSupplier.get());
-            return null;
-        }
-    }
-
-    public static <K,V> Runnable updatingSensorMapEntry(final Entity entity, final AttributeSensor<Map<K,V>> mapSensor, final K key, final Supplier<? extends V> valueSupplier) {
-        return Functionals.runnable(Suppliers.compose(updatingSensorMapEntry(mapSensor, key, valueSupplier), Suppliers.ofInstance(entity)));
-    }
-
-    public static Supplier<Collection<Application>> applications(ManagementContext mgmt) {
-        return new AppsSupplier(checkNotNull(mgmt, "mgmt"));
-    }
-    
-    protected static class AppsSupplier implements Supplier<Collection<Application>> {
-        private final ManagementContext mgmt;
-
-        public AppsSupplier(ManagementContext mgmt) {
-            this.mgmt = mgmt;
-        }
-        @Override
-        public Collection<Application> get() {
-            return mgmt.getApplications();
-        }
-    }
-
-    public static Function<Entity, Location> locationMatching(Predicate<? super Location> filter) {
-        return new LocationMatching(filter);
-    }
-    
-    private static class LocationMatching implements Function<Entity, Location> {
-        private Predicate<? super Location> filter;
-        
-        private LocationMatching() { /* for xstream */
-        }
-        public LocationMatching(Predicate<? super Location> filter) {
-            this.filter = filter;
-        }
-        @Override public Location apply(Entity input) {
-            return Iterables.find(input.getLocations(), filter);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInitializers.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInitializers.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInitializers.java
deleted file mode 100644
index a258007..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInitializers.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 org.apache.brooklyn.core.entity;
-
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.EntityInitializer;
-import org.apache.brooklyn.api.entity.EntityLocal;
-
-import com.google.common.collect.ImmutableList;
-
-public class EntityInitializers {
-
-    public static class AddTags implements EntityInitializer {
-        public final List<Object> tags;
-        
-        public AddTags(Object... tags) {
-            this.tags = ImmutableList.copyOf(tags);
-        }
-        
-        @Override
-        public void apply(EntityLocal entity) {
-            for (Object tag: tags)
-                entity.tags().addTag(tag);
-        }
-    }
-
-    
-    public static EntityInitializer addingTags(Object... tags) {
-        return new AddTags(tags);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
deleted file mode 100644
index 3602bee..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
+++ /dev/null
@@ -1,274 +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.core.entity;
-
-import java.util.Collection;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.mgmt.ExecutionContext;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
-import org.apache.brooklyn.api.mgmt.rebind.Rebindable;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.internal.EntityConfigMap;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagementSupport;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import com.google.common.annotations.Beta;
-
-/** 
- * Extended Entity interface with additional functionality that is purely-internal (i.e. intended 
- * for the brooklyn framework only).
- */
-@Beta
-public interface EntityInternal extends BrooklynObjectInternal, EntityLocal, Rebindable {
-    
-    void addLocations(@Nullable Collection<? extends Location> locations);
-
-    void removeLocations(Collection<? extends Location> locations);
-
-    void clearLocations();
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupportInternal#setWithoutPublishing(AttributeSensor, Object)} via code like {@code sensors().setWithoutPublishing(attribute, val)}.
-     */
-    <T> T setAttributeWithoutPublishing(AttributeSensor<T> sensor, T val);
-
-    /**
-     * @deprecated since 0.7.0; instead just use methods on {@link ConfigurationSupportInternal} returned by {@link #config()}
-     */
-    @Deprecated
-    EntityConfigMap getConfigMap();
-
-    /**
-     * @return a read-only copy of all the config key/value pairs on this entity.
-     * 
-     * @deprecated since 0.7.0; instead just use methods on {@link ConfigurationSupportInternal} returned by {@link #config()},
-     * e.g. getBag().getAllConfigAsConfigKeyMap().
-     */
-    @Deprecated
-    @Beta
-    Map<ConfigKey<?>,Object> getAllConfig();
-
-    /**
-     * Returns a read-only view of all the config key/value pairs on this entity, backed by a string-based map, 
-     * including config names that did not match anything on this entity.
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().getBag()}
-     */
-    @Deprecated
-    ConfigBag getAllConfigBag();
-
-    /**
-     * Returns a read-only view of the local (i.e. not inherited) config key/value pairs on this entity, 
-     * backed by a string-based map, including config names that did not match anything on this entity.
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().getLocalBag()}
-     */
-    @Deprecated
-    ConfigBag getLocalConfigBag();
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupportInternal#getAll()} via code like {@code sensors().getAll()}.
-     */
-    @Beta
-    Map<AttributeSensor, Object> getAllAttributes();
-
-    /**
-     * @deprecated since 0.8.0; use {@link SensorSupportInternal#remove(AttributeSensor)} via code like {@code sensors().remove(attribute)}.
-     */
-    @Beta
-    void removeAttribute(AttributeSensor<?> attribute);
-
-    /**
-     * 
-     * @deprecated since 0.7.0; use {@link #config()}, such as {@code entity.config().refreshInheritedConfig()}
-     */
-    @Deprecated
-    void refreshInheritedConfig();
-
-    /**
-     * Must be called before the entity is started.
-     * 
-     * @return this entity (i.e. itself)
-     */
-    @Beta // for internal use only
-    EntityInternal configure(Map flags);
-
-    /** 
-     * @return Routings for accessing and inspecting the management context of the entity
-     */
-    EntityManagementSupport getManagementSupport();
-
-    /**
-     * Should be invoked at end-of-life to clean up the item.
-     */
-    @Beta
-    void destroy();
-    
-    /** 
-     * Returns the management context for the entity. If the entity is not yet managed, some 
-     * operations on the management context will fail. 
-     * 
-     * Do not cache this object; instead call getManagementContext() each time you need to use it.
-     */
-    ManagementContext getManagementContext();
-
-    /** 
-     * Returns the task execution context for the entity. If the entity is not yet managed, some 
-     * operations on the management context will fail.
-     * 
-     * Do not cache this object; instead call getExecutionContext() each time you need to use it.
-     */    
-    ExecutionContext getExecutionContext();
-
-    /** returns the dynamic type corresponding to the type of this entity instance */
-    @Beta
-    EntityDynamicType getMutableEntityType();
-
-    /** returns the effector registered against a given name */
-    @Beta
-    Effector<?> getEffector(String effectorName);
-    
-    FeedSupport feeds();
-    
-    /**
-     * @since 0.7.0-M2
-     * @deprecated since 0.7.0-M2; use {@link #feeds()}
-     */
-    @Deprecated
-    FeedSupport getFeedSupport();
-
-    Map<String, String> toMetadataRecord();
-    
-    /**
-     * Users are strongly discouraged from calling or overriding this method.
-     * It is for internal calls only, relating to persisting/rebinding entities.
-     * This method may change (or be removed) in a future release without notice.
-     */
-    @Override
-    @Beta
-    RebindSupport<EntityMemento> getRebindSupport();
-
-    @Override
-    RelationSupportInternal<Entity> relations();
-    
-    /**
-     * Can be called to request that the entity be persisted.
-     * This persistence may happen asynchronously, or may not happen at all if persistence is disabled.
-     */
-    void requestPersist();
-    
-    @Override
-    SensorSupportInternal sensors();
-
-    @Override
-    PolicySupportInternal policies();
-
-    @Override
-    EnricherSupportInternal enrichers();
-
-    @Beta
-    public interface SensorSupportInternal extends Entity.SensorSupport {
-        /**
-         * 
-         * Like {@link EntityLocal#setAttribute(AttributeSensor, Object)}, except does not publish an attribute-change event.
-         */
-        <T> T setWithoutPublishing(AttributeSensor<T> sensor, T val);
-        
-        @Beta
-        Map<AttributeSensor<?>, Object> getAll();
-
-        @Beta
-        void remove(AttributeSensor<?> attribute);
-    }
-
-    public interface FeedSupport {
-        Collection<Feed> getFeeds();
-        
-        /**
-         * Adds the given feed to this entity. The feed will automatically be re-added on brooklyn restart.
-         */
-        <T extends Feed> T addFeed(T feed);
-        
-        /**
-         * Removes the given feed from this entity. 
-         * @return True if the feed existed at this entity; false otherwise
-         */
-        boolean removeFeed(Feed feed);
-        
-        /**
-         * Removes all feeds from this entity.
-         * Use with caution as some entities automatically register feeds; this will remove those feeds as well.
-         * @return True if any feeds existed at this entity; false otherwise
-         */
-        boolean removeAllFeeds();
-    }
-    
-    @Beta
-    public interface PolicySupportInternal extends Entity.PolicySupport {
-        /**
-         * Removes all policy from this entity. 
-         * @return True if any policies existed at this entity; false otherwise
-         */
-        boolean removeAllPolicies();
-    }
-    
-    @Beta
-    public interface EnricherSupportInternal extends Entity.EnricherSupport {
-        /**
-         * Removes all enricher from this entity.
-         * Use with caution as some entities automatically register enrichers; this will remove those enrichers as well.
-         * @return True if any enrichers existed at this entity; false otherwise
-         */
-        boolean removeAll();
-    }
-    
-    @Beta
-    public interface GroupSupportInternal extends Entity.GroupSupport {
-        /**
-         * Add this entity as a member of the given {@link Group}. Called by framework.
-         * <p>
-         * Users should call {@link Group#addMember(Entity)} instead; this method will then 
-         * automatically be called. However, the reverse is not true (calling this method will 
-         * not tell the group; this behaviour may change in a future release!)
-         */
-        void add(Group group);
-
-        /**
-         * Removes this entity as a member of the given {@link Group}. Called by framework.
-         * <p>
-         * Users should call {@link Group#removeMember(Entity)} instead; this method will then 
-         * automatically be called. However, the reverse is not true (calling this method will 
-         * not tell the group; this behaviour may change in a future release!)
-         */
-        void remove(Group group);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityPredicates.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityPredicates.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityPredicates.java
deleted file mode 100644
index a618784..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityPredicates.java
+++ /dev/null
@@ -1,451 +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.core.entity;
-
-import java.util.Collection;
-import java.util.regex.Pattern;
-
-import javax.annotation.Nullable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.util.collections.CollectionFunctionals;
-import org.apache.brooklyn.util.guava.SerializablePredicate;
-import org.apache.brooklyn.util.javalang.Reflections;
-import org.apache.brooklyn.util.text.StringPredicates;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-@SuppressWarnings("serial")
-public class EntityPredicates {
-
-    public static Predicate<Entity> idEqualTo(final String val) {
-        return idSatisfies(Predicates.equalTo(val));
-    }
-    
-    public static Predicate<Entity> idSatisfies(final Predicate<? super String> condition) {
-        return new IdSatisfies(condition);
-    }
-    
-    protected static class IdSatisfies implements SerializablePredicate<Entity> {
-        protected final Predicate<? super String> condition;
-        protected IdSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getId());
-        }
-        @Override
-        public String toString() {
-            return "idSatisfies("+condition+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> idEqualToOld(final T val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getId(), val);
-            }
-        };
-    }
-    
-    // ---------------------------
-    
-    public static Predicate<Entity> displayNameEqualTo(final String val) {
-        return displayNameSatisfies(Predicates.equalTo(val));
-    }
-    
-    public static Predicate<Entity> displayNameSatisfies(final Predicate<? super String> condition) {
-        return new DisplayNameSatisfies(condition);
-    }
-    
-    protected static class DisplayNameSatisfies implements SerializablePredicate<Entity> {
-        protected final Predicate<? super String> condition;
-        protected DisplayNameSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getDisplayName());
-        }
-        @Override
-        public String toString() {
-            return "displayNameSatisfies("+condition+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> displayNameEqualToOld(final T val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getDisplayName(), val);
-            }
-        };
-    }
-    
-    /** @deprecated since 0.7.0 use {@link #displayNameSatisfies(Predicate)} to clarify this is *regex* matching
-     * (passing {@link StringPredicates#matchesRegex(String)} as the predicate) */
-    public static Predicate<Entity> displayNameMatches(final String regex) {
-        return displayNameSatisfies(StringPredicates.matchesRegex(regex));
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static class DisplayNameMatches implements SerializablePredicate<Entity> {
-        private final String regex;
-        DisplayNameMatches(String regex) {
-            this.regex = regex;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null && input.getDisplayName() != null) && input.getDisplayName().matches(regex);
-        }
-        @Override
-        public String toString() {
-            return "DisplayNameMatches("+regex+")";
-        }
-    };
-    
-    // ---------------------------
-
-    public static Predicate<Entity> applicationIdEqualTo(final String val) {
-        return applicationIdSatisfies(Predicates.equalTo(val));
-    }
-
-    public static Predicate<Entity> applicationIdSatisfies(final Predicate<? super String> condition) {
-        return new ApplicationIdSatisfies(condition);
-    }
-
-    protected static class ApplicationIdSatisfies implements SerializablePredicate<Entity> {
-        protected final Predicate<? super String> condition;
-        protected ApplicationIdSatisfies(Predicate<? super String> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getApplicationId());
-        }
-        @Override
-        public String toString() {
-            return "applicationIdSatisfies("+condition+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static Predicate<Entity> applicationIdEqualToOld(final String val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && val.equals(input.getApplicationId());
-            }
-        };
-    }
-
-    // ---------------------------
-    
-    public static <T> Predicate<Entity> attributeEqualTo(final AttributeSensor<T> attribute, final T val) {
-        return attributeSatisfies(attribute, Predicates.equalTo(val));
-    }
-    
-    public static <T> Predicate<Entity> attributeSatisfies(final AttributeSensor<T> attribute, final Predicate<T> condition) {
-        return new AttributeSatisfies<T>(attribute, condition);
-    }
-
-    protected static class AttributeSatisfies<T> implements SerializablePredicate<Entity> {
-        protected final AttributeSensor<T> attribute;
-        protected final Predicate<T> condition;
-        private AttributeSatisfies(AttributeSensor<T> attribute, Predicate<T> condition) {
-            this.attribute = attribute;
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getAttribute(attribute));
-        }
-        @Override
-        public String toString() {
-            return "attributeSatisfies("+attribute.getName()+","+condition+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> attributeEqualToOld(final AttributeSensor<T> attribute, final T val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getAttribute(attribute), val);
-            }
-        };
-    }
-    
-    public static <T> Predicate<Entity> attributeNotEqualTo(final AttributeSensor<T> attribute, final T val) {
-        return attributeSatisfies(attribute, Predicates.not(Predicates.equalTo(val)));
-    }
-
-    // ---------------------------
-
-    public static <T> Predicate<Entity> configEqualTo(final ConfigKey<T> configKey, final T val) {
-        return configSatisfies(configKey, Predicates.equalTo(val));
-    }
-
-    public static <T> Predicate<Entity> configSatisfies(final ConfigKey<T> configKey, final Predicate<T> condition) {
-        return new ConfigKeySatisfies<T>(configKey, condition);
-    }
-
-    public static <T> Predicate<Entity> configEqualTo(final HasConfigKey<T> configKey, final T val) {
-        return configEqualTo(configKey.getConfigKey(), val);
-    }
-
-    public static <T> Predicate<Entity> configSatisfies(final HasConfigKey<T> configKey, final Predicate<T> condition) {
-        return new ConfigKeySatisfies<T>(configKey.getConfigKey(), condition);
-    }
-
-    protected static class ConfigKeySatisfies<T> implements SerializablePredicate<Entity> {
-        protected final ConfigKey<T> configKey;
-        protected final Predicate<T> condition;
-        private ConfigKeySatisfies(ConfigKey<T> configKey, Predicate<T> condition) {
-            this.configKey = configKey;
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getConfig(configKey));
-        }
-        @Override
-        public String toString() {
-            return "configKeySatisfies("+configKey.getName()+","+condition+")";
-        }
-    }
-
-    
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> configEqualToOld(final ConfigKey<T> configKey, final T val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getConfig(configKey), val);
-            }
-        };
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> configEqualToOld(final HasConfigKey<T> configKey, final T val) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getConfig(configKey), val);
-            }
-        };
-    }
-
-    // ---------------------------
-
-    /**
-     * @param typeRegex a regular expression
-     * @return true if any of the interfaces implemented by the entity (including those derived) match typeRegex.
-     */
-    public static Predicate<Entity> hasInterfaceMatching(String typeRegex) {
-        return new ImplementsInterface(typeRegex);
-    }
-
-    protected static class ImplementsInterface implements SerializablePredicate<Entity> {
-        protected final Pattern pattern;
-
-        public ImplementsInterface(String typeRegex) {
-            this.pattern = Pattern.compile(typeRegex);
-        }
-
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            if (input == null) return false;
-            for (Class<?> cls : Reflections.getAllInterfaces(input.getClass())) {
-                if (pattern.matcher(cls.getName()).matches()) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    // ---------------------------
-
-    /**
-     * Returns a predicate that determines if a given entity is a direct child of this {@code parent}.
-     */
-    public static Predicate<Entity> isChildOf(final Entity parent) {
-        return new IsChildOf(parent);
-    }
-
-    // if needed, could add parentSatisfies(...)
-    
-    protected static class IsChildOf implements SerializablePredicate<Entity> {
-        protected final Entity parent;
-        protected IsChildOf(Entity parent) {
-            this.parent = parent;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && Objects.equal(input.getParent(), parent);
-        }
-        @Override
-        public String toString() {
-            return "isChildOf("+parent+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> isChildOfOld(final Entity parent) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Objects.equal(input.getParent(), parent);
-            }
-        };
-    }
-
-    // ---------------------------
-    
-    public static Predicate<Entity> isMemberOf(final Group group) {
-        return new IsMemberOf(group);
-    }
-
-    protected static class IsMemberOf implements SerializablePredicate<Entity> {
-        protected final Group group;
-        protected IsMemberOf(Group group) {
-            this.group = group;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (group != null) && (input != null) && group.hasMember(input);
-        }
-        @Override
-        public String toString() {
-            return "isMemberOf("+group+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 kept only to allow conversion of anonymous inner classes */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> isMemberOfOld(final Group group) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && group.hasMember(input);
-            }
-        };
-    }
-
-    // ---------------------------
-
-    /**
-     * Create a predicate that matches any entity who has an exact match for the given location
-     * (i.e. {@code entity.getLocations().contains(location)}).
-     */
-    public static <T> Predicate<Entity> locationsIncludes(Location location) {
-        return locationsSatisfy(CollectionFunctionals.contains(location));
-        
-    }
-    
-    public static <T> Predicate<Entity> locationsSatisfy(final Predicate<Collection<Location>> condition) {
-        return new LocationsSatisfy(condition);
-    }
-
-    protected static class LocationsSatisfy implements SerializablePredicate<Entity> {
-        protected final Predicate<Collection<Location>> condition;
-        protected LocationsSatisfy(Predicate<Collection<Location>> condition) {
-            this.condition = condition;
-        }
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && condition.apply(input.getLocations());
-        }
-        @Override
-        public String toString() {
-            return "locationsSatisfy("+condition+")";
-        }
-    }
-
-    /** @deprecated since 0.7.0 use {@link #locationsIncludes(Location)} */
-    @Deprecated 
-    public static <T> Predicate<Entity> withLocation(final Location location) {
-        return locationsIncludes(location);
-    }
-    
-    /** @deprecated since 0.7.0 use {@link #locationsIncludes(Location)}, introduced to allow deserialization of anonymous inner class */
-    @SuppressWarnings("unused") @Deprecated 
-    private static <T> Predicate<Entity> withLocationOld(final Location location) {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && input.getLocations().contains(location);
-            }
-        };
-    }
-    
-    // ---------------------------
-
-    public static <T> Predicate<Entity> isManaged() {
-        return new IsManaged();
-    }
-
-    protected static class IsManaged implements SerializablePredicate<Entity> {
-        @Override
-        public boolean apply(@Nullable Entity input) {
-            return (input != null) && Entities.isManaged(input);
-        }
-        @Override
-        public String toString() {
-            return "isManaged()";
-        }
-    }
-
-    /** @deprecated since 0.7.0 use {@link #isManaged()} */ @Deprecated
-    public static <T> Predicate<Entity> managed() {
-        return isManaged();
-    }
-
-    /** @deprecated since 0.7.0 use {@link #isManaged()}, introduced to allow deserialization of anonymous inner class */
-    @SuppressWarnings("unused") @Deprecated
-    private static <T> Predicate<Entity> managedOld() {
-        return new SerializablePredicate<Entity>() {
-            @Override
-            public boolean apply(@Nullable Entity input) {
-                return (input != null) && Entities.isManaged(input);
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityRelations.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityRelations.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityRelations.java
deleted file mode 100644
index d29b80c..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntityRelations.java
+++ /dev/null
@@ -1,179 +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.core.entity;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.BrooklynObject.RelationSupport;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.relations.RelationshipType;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.core.relations.AbstractBasicRelationSupport;
-import org.apache.brooklyn.core.relations.RelationshipTypes;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import com.google.common.annotations.Beta;
-
-/** TODO these relations are not used yet; see issue where this is introduced and email thread */
-@Beta
-public class EntityRelations<T extends BrooklynObject> {
-
-    /** {@link #MANAGER_OF} indicates that one entity is the manager of another entity,
-     * in the internal Brooklyn management hierarchy model.
-     * Apart from root {@link Application} entities, every deployed entity must have exactly one manager.  
-     * The inverse relationship is {@link #MANAGED_BY}. */ 
-    public static final RelationshipType<Entity,Entity> MANAGER_OF = RelationshipTypes.newRelationshipPair(
-        "manager", "managers", Entity.class, "manager_of", 
-        "managed child", "managed children", Entity.class, "managed_by");
-    /** Inverse of {@link #MANAGER_OF}. */
-    public static final RelationshipType<Entity,Entity> MANAGED_BY = MANAGER_OF.getInverseRelationshipType();
-    
-    /** {@link #GROUP_CONTAINS} indicates that one entity, typically a {@link Group},
-     * has zero or more entities which are labelled as "members" of that group entity.
-     * What membership means will depend on the group entity.
-     * An entity may be a member of any number of other entities.  
-     * The inverse relationship is {@link #IN_GROUP}. */ 
-    public static final RelationshipType<Entity,Entity> GROUP_CONTAINS = RelationshipTypes.newRelationshipPair(
-        "group", "groups", Entity.class, "group_contains",
-        "member", "members", Entity.class, "in_group");
-    /** Inverse of {@link #GROUP_CONTAINS}. */
-    public static final RelationshipType<Entity,Entity> IN_GROUP = GROUP_CONTAINS.getInverseRelationshipType();
-
-    /** {@link #HAS_TARGET} indicates that one entity directs to one or more other entities.
-     * What this targeting relationship means depends on the targetter.
-     * The inverse relationship is {@link #TARGETTED_BY}. */
-    public static final RelationshipType<Entity,Entity> HAS_TARGET = RelationshipTypes.newRelationshipPair(
-        "targetter", "targetters", Entity.class, "has_target", 
-        "target", "targets", Entity.class, "targetted_by");
-    /** Inverse of {@link #HAS_TARGET}. */
-    public static final RelationshipType<Entity,Entity> TARGETTED_BY = HAS_TARGET.getInverseRelationshipType();
-
-    /** {@link #ACTIVE_PARENT_OF} indicates that one entity is should be considered as the logical parent of another,
-     * e.g. for presentation purposes to the end user.
-     * Frequently this relationship coincides with a {@link #MANAGED_BY} relationship, 
-     * but sometimes some managed children are there for purposes the designers consider less important,
-     * and they can choose to suppress the {@link #ACTIVE_PARENT_OF} relationship 
-     * so that the active children is a subset of the managed children.
-     * <p>
-     * One recommended consideration is whether the child should be shown in a default tree view.
-     * Whilst a user can always fina a way to see all managed children, 
-     * it may be the case that only some of those are of primary interest,
-     * and it is to identify those that this relationship exists.
-     * <p>
-     * It is permitted that an entity be an {@link #ACTIVE_PARENT_OF} an entity for which it is not a manager,
-     * but in most cases a different relationship type is more appropriate where there is not also a management relationship.
-     * <p> 
-     * The inverse relationship is {@link #ACTIVE_CHILD_OF},
-     * and an entity should normally be an {@link #ACTIVE_CHILD_OF} zero or one entities. */
-    public static final RelationshipType<Entity,Entity> ACTIVE_PARENT_OF = RelationshipTypes.newRelationshipPair(
-        "parent", "parents", Entity.class, "parent_of_active", 
-        "active child", "active children", Entity.class, "active_child_of");
-    /** Inverse of {@link #ACTIVE_PARENT_OF}. */
-    public static final RelationshipType<Entity,Entity> ACTIVE_CHILD_OF = ACTIVE_PARENT_OF.getInverseRelationshipType();
-    
-    /** {@link #HAS_POLICY} indicates that an entity has a policy associated to it.
-     * The inverse relationship is {@link #POLICY_FOR}. */
-    public static final RelationshipType<Entity,Policy> HAS_POLICY = RelationshipTypes.newRelationshipPair(
-        "entity", "entities", Entity.class, "has_policy", 
-        "policy", "policies", Policy.class, "policy_for");
-    /** Inverse of {@link #HAS_POLICY}. */
-    public static final RelationshipType<Policy,Entity> POLICY_FOR = HAS_POLICY.getInverseRelationshipType();
-
-    // ----
-    
-    // TODO replace by relations stored in catalog when catalog supports arbitrary types
-    private static Map<String,RelationshipType<? extends BrooklynObject, ? extends BrooklynObject>> KNOWN_RELATIONSHIPS = MutableMap.of();
-    private static void addRelationship(RelationshipType<? extends BrooklynObject, ? extends BrooklynObject> r) {
-        KNOWN_RELATIONSHIPS.put(r.getRelationshipTypeName(), r);
-        if (r.getInverseRelationshipType()!=null) {
-            KNOWN_RELATIONSHIPS.put(r.getInverseRelationshipType().getRelationshipTypeName(), r.getInverseRelationshipType());
-        }
-    }
-    static {
-        addRelationship(MANAGER_OF);
-        addRelationship(GROUP_CONTAINS);
-        addRelationship(HAS_TARGET);
-        addRelationship(HAS_POLICY);
-    }
-    
-    /** Find the typed Relationship instance for the given relationship name, if known;
-     * behaviour is not guaranteed by the API if not known (hence the Beta marker),
-     * it may fail fast or return null or create a poor-man's relationship instance. 
-     */
-    @Beta
-    public static RelationshipType<? extends BrooklynObject, ? extends BrooklynObject> lookup(ManagementContext mgmt, String relationshipTypeName) {
-        if (relationshipTypeName==null) return null;
-        RelationshipType<? extends BrooklynObject, ? extends BrooklynObject> result = KNOWN_RELATIONSHIPS.get(relationshipTypeName);
-        if (result!=null) return result;
-        
-        /* TODO ultimately we'd like to support arbitrary relationships via persistence and lookup against the catalog;
-         * however for now, so that we can persist nicely (without catalog items for relationships) 
-         * we are smart about the relationships defined here, and we return a poor-man's version for items elsewhere.
-         * 
-         * for now, a poor-man's relationship; if not in catalog ultimately we should fail. */
-        return RelationshipTypes.newRelationshipOneway("source", "sources", BrooklynObject.class, relationshipTypeName, "target", "targets", BrooklynObject.class);
-    }
-    
-    /** 
-     * As {@link RelationSupport#getRelationshipTypes()} for the given object.  Callers can use either method.
-     * See {@link AbstractBasicRelationSupport} for a discussion of why double dispatch is used and both methods are present.
-     */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static <T extends BrooklynObject> Set<RelationshipType<? super T,? extends BrooklynObject>> getRelationshipTypes(T source) {
-        return (Set) ((BrooklynObjectInternal)source).relations().getLocalBackingStore().getRelationshipTypes();
-    }
-
-    /** 
-     * As {@link RelationSupport#getRelations(RelationshipType)} for the given object.  Callers can use either method.
-     * See {@link AbstractBasicRelationSupport} for a discussion of why double dispatch is used and both methods are present.
-     */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static <T extends BrooklynObject,U extends BrooklynObject> Set<U> getRelations(RelationshipType<? super T,U> relationship, T source) {
-        return (Set) ((BrooklynObjectInternal)source).relations().getLocalBackingStore().getRelations((RelationshipType)relationship);
-    }
-
-    /** 
-     * As {@link RelationSupport#add(RelationshipType, BrooklynObject)} for the given object.  Callers can use either method.
-     * See {@link AbstractBasicRelationSupport} for a discussion of why double dispatch is used and both methods are present.
-     */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static <T extends BrooklynObject,U extends BrooklynObject> void add(T source, RelationshipType<? super T,? super U> relationship, U target) {
-        ((BrooklynObjectInternal)source).relations().getLocalBackingStore().add((RelationshipType)relationship, target);
-        if (relationship.getInverseRelationshipType()!=null)
-            ((BrooklynObjectInternal)target).relations().getLocalBackingStore().add((RelationshipType)relationship.getInverseRelationshipType(), source);
-    }
-
-    /** 
-     * As {@link RelationSupport#remove(RelationshipType, BrooklynObject)} for the given object.  Callers can use either method.
-     * See {@link AbstractBasicRelationSupport} for a discussion of why double dispatch is used and both methods are present.
-     */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static <T extends BrooklynObject,U extends BrooklynObject> void remove(T source, RelationshipType<? super T,? super U> relationship, U target) {
-        ((BrooklynObjectInternal)source).relations().getLocalBackingStore().remove((RelationshipType)relationship, target);
-        if (relationship.getInverseRelationshipType()!=null)
-            ((BrooklynObjectInternal)target).relations().getLocalBackingStore().remove((RelationshipType)relationship.getInverseRelationshipType(), source);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
deleted file mode 100644
index 406485a..0000000
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.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.core.entity;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.location.Machines;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-
-import com.google.common.base.Supplier;
-
-public class EntitySuppliers {
-
-    public static Supplier<SshMachineLocation> uniqueSshMachineLocation(Entity entity) {
-        return new UniqueSshMchineLocation(entity);
-    }
-    
-    private static class UniqueSshMchineLocation implements Supplier<SshMachineLocation> {
-        private Entity entity;
-
-        private UniqueSshMchineLocation() { /* for xstream */
-        }
-        
-        private UniqueSshMchineLocation(Entity entity) {
-            this.entity = entity;
-        }
-        
-        @Override public SshMachineLocation get() {
-            return Machines.findUniqueMachineLocation(entity.getLocations(), SshMachineLocation.class).get();
-        }
-    }
-}


[32/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!)

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
deleted file mode 100644
index a149f18..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
+++ /dev/null
@@ -1,410 +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.brooklyn;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.MachineProvisioningLocation;
-import org.apache.brooklyn.api.mgmt.HasTaskChildren;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.apache.brooklyn.entity.software.base.VanillaWindowsProcess;
-import org.apache.brooklyn.entity.software.base.test.location.WindowsTestFixture;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.apache.brooklyn.util.core.task.TaskPredicates;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-/**
- * Tests Windows YAML blueprint features.
- */
-@Test
-public class WindowsYamlLiveTest extends AbstractYamlTest {
-    
-    // TODO Remove duplication of assertStreams and VanillaWindowsProcessWinrmStreamsLiveTest.assertStreams
-    
-    private static final Logger log = LoggerFactory.getLogger(WindowsYamlLiveTest.class);
-
-    /**
-     * Maps from the task names that are used to the names used in log/exception messages.
-     */
-    private static final Map<String, String> TASK_REGEX_TO_COMMAND = ImmutableMap.<String, String>builder()
-            .put("winrm: pre-install-command.*", "pre-install-command")
-            .put("winrm: install.*", "install-command")
-            .put("winrm: post-install-command.*", "post-install-command")
-            .put("winrm: customize.*", "customize-command")
-            .put("winrm: pre-launch-command.*", "pre-launch-command")
-            .put("winrm: launch.*", "launch-command")
-            .put("winrm: post-launch-command.*", "post-launch-command")
-            .put("winrm: stop-command.*", "stop-command")
-            .put("winrm: is-running-command.*", "is-running-command")
-            .build();
-
-    protected List<String> yamlLocation;
-    protected MachineProvisioningLocation<WinRmMachineLocation> location;
-    protected WinRmMachineLocation machine;
-    protected Entity app;
-    
-    @BeforeClass(alwaysRun = true)
-    public void setUpClass() throws Exception {
-        super.setUp();
-        
-        location = WindowsTestFixture.setUpWindowsLocation(mgmt());
-        machine = (WinRmMachineLocation) location.obtain(ImmutableMap.of());
-        String ip = machine.getAddress().getHostAddress();
-        String password = machine.config().get(WinRmMachineLocation.PASSWORD);
-
-        yamlLocation = ImmutableList.of(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - winrm: "+ip+":5985",
-                "      password: "+password,
-                "      user: Administrator",
-                "      osFamily: windows");
-    }
-
-    @AfterClass(alwaysRun = true)
-    public void tearDownClass() {
-        try {
-            if (location != null) location.release(machine);
-        } catch (Throwable t) {
-            log.error("Caught exception in tearDownClass method", t);
-        } finally {
-            super.tearDown();
-        }
-    }
-
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() {
-        // no-op; everything done @BeforeClass
-    }
-
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() {
-        try {
-            if (app != null) Entities.destroy(app);
-        } catch (Throwable t) {
-            log.error("Caught exception in tearDown method", t);
-        } finally {
-            app = null;
-        }
-    }
-    
-    @Override
-    protected ManagementContextInternal mgmt() {
-        return (ManagementContextInternal) super.mgmt();
-    }
-    
-    @Test(groups="Live")
-    public void testPowershellMinimalist() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.bat\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testPowershell() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.<String, List<String>>builder()
-                .put("winrm: install.*", ImmutableList.of("myInstall"))
-                .put("winrm: post-install-command.*", ImmutableList.of("myPostInstall"))
-                .put("winrm: customize.*", ImmutableList.of("myval"))
-                .put("winrm: pre-launch-command.*", ImmutableList.of("myval"))
-                .build();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testBatch() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("install.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.command", "\"c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.command", "\"c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("post.launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("checkRunning.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("stop.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .build();
-
-        Map<String, List<String>> stdouts = ImmutableMap.<String, List<String>>builder()
-                .put("winrm: install.*", ImmutableList.of("myInstall"))
-                .put("winrm: post-install-command.*", ImmutableList.of("myPostInstall"))
-                .put("winrm: customize.*", ImmutableList.of("myval"))
-                .put("winrm: pre-launch-command.*", ImmutableList.of("myval"))
-                .build();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testPowershellExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: pre-install-command.*");
-    }
-    
-    // FIXME Failing to match the expected exception, but looks fine! Needs more investigation.
-    @Test(groups="Live")
-    public void testPowershellCheckRunningExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: is-running-command.*");
-    }
-    
-    // FIXME Needs more work to get the stop's task that failed, so can assert got the right error message
-    @Test(groups="Live")
-    public void testPowershellStopExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: stop-command.*");
-    }
-    
-    protected void runWindowsApp(Map<String, String> commands, Map<String, List<String>> stdouts, String taskRegexFailed) throws Exception {
-        String cmdFailed = (taskRegexFailed == null) ? null : TASK_REGEX_TO_COMMAND.get(taskRegexFailed);
-        
-        List<String> yaml = Lists.newArrayList();
-        yaml.addAll(yamlLocation);
-        yaml.addAll(ImmutableList.of(
-                "services:",
-                "- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess",
-                "  brooklyn.config:",
-                "    onbox.base.dir.skipResolution: true",
-                "    templates.preinstall:",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat: c:\\echoFreemarkerMyarg.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1: c:\\echoFreemarkerMyarg.ps1",
-                "    files.preinstall:",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoArg.bat: c:\\echoArg.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1: c:\\echoMyArg.ps1",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit0.bat: c:\\exit0.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit1.bat: c:\\exit1.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit0.ps1: c:\\exit0.ps1",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit1.ps1: c:\\exit1.ps1",
-                ""));
-        
-        for (Map.Entry<String, String> entry : commands.entrySet()) {
-            yaml.add("    "+entry.getKey()+": "+entry.getValue());
-        }
-
-        if (Strings.isBlank(cmdFailed)) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-            waitForApplicationTasks(app);
-            log.info("App started:");
-            Entities.dumpInfo(app);
-            
-            VanillaWindowsProcess entity = (VanillaWindowsProcess) app.getChildren().iterator().next();
-            
-            EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-            assertStreams(entity, stdouts);
-            
-        } else if (cmdFailed.equals("stop-command")) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-            waitForApplicationTasks(app);
-            log.info("App started:");
-            Entities.dumpInfo(app);
-            VanillaWindowsProcess entity = (VanillaWindowsProcess) app.getChildren().iterator().next();
-            EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-            
-            entity.stop();
-            assertSubTaskFailures(entity, ImmutableMap.of(taskRegexFailed, StringPredicates.containsLiteral("for "+cmdFailed)));
-            
-        } else {
-            try {
-                app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-                fail("start should have failed for app="+app);
-            } catch (Exception e) {
-                if (e.toString().contains("invalid result") && e.toString().contains("for "+cmdFailed)) throw e;
-            }
-        }
-    }
-
-    protected void assertStreams(SoftwareProcess entity, Map<String, List<String>> stdouts) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), entity);
-
-        for (Map.Entry<String, List<String>> entry : stdouts.entrySet()) {
-            String taskNameRegex = entry.getKey();
-            List<String> expectedOuts = entry.getValue();
-
-            Task<?> subTask = findTaskOrSubTask(tasks, TaskPredicates.displayNameSatisfies(StringPredicates.matchesRegex(taskNameRegex))).get();
-
-            String stdin = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDIN);
-            String stdout = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDOUT);
-            String stderr = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDERR);
-            String env = getStream(subTask, BrooklynTaskTags.STREAM_ENV);
-            String msg = "stdin="+stdin+"; stdout="+stdout+"; stderr="+stderr+"; env="+env;
-
-            for (String expectedOut : expectedOuts) {
-                assertTrue(stdout.contains(expectedOut), msg);
-            }
-        }
-    }
-
-    protected void assertSubTaskFailures(SoftwareProcess entity, Map<String, Predicate<CharSequence>> taskErrs) throws Exception {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), entity);
-
-        for (Map.Entry<String, Predicate<CharSequence>> entry : taskErrs.entrySet()) {
-            String taskNameRegex = entry.getKey();
-            Predicate<? super String> errChecker = entry.getValue();
-            Task<?> subTask = findTaskOrSubTask(tasks, TaskPredicates.displayNameSatisfies(StringPredicates.matchesRegex(taskNameRegex))).get();
-            String msg = "regex="+taskNameRegex+"; task="+subTask;
-            assertNotNull(subTask, msg);
-            assertTrue(subTask.isDone(), msg);
-            assertTrue(subTask.isError(), msg);
-            try {
-                subTask.get();
-                fail();
-            } catch (Exception e) {
-                if (!errChecker.apply(e.toString())) {
-                    throw e;
-                }
-            }
-        }
-    }
-
-    public static String getStreamOrFail(Task<?> task, String streamType) {
-        String msg = "task="+task+"; stream="+streamType;
-        BrooklynTaskTags.WrappedStream stream = checkNotNull(BrooklynTaskTags.stream(task, streamType), "Stream null: " + msg);
-        return checkNotNull(stream.streamContents.get(), "Contents null: "+msg);
-    }
-
-    public static String getStream(Task<?> task, String streamType) {
-        BrooklynTaskTags.WrappedStream stream = BrooklynTaskTags.stream(task, streamType);
-        return (stream != null) ? stream.streamContents.get() : null;
-    }
-
-    protected Optional<Task<?>> findTaskOrSubTask(Iterable<? extends Task<?>> tasks, Predicate<? super Task<?>> matcher) {
-        List<String> taskNames = Lists.newArrayList();
-        Optional<Task<?>> result = findTaskOrSubTaskImpl(tasks, matcher, taskNames);
-        if (!result.isPresent() && log.isDebugEnabled()) {
-            log.debug("Task not found matching "+matcher+"; contender names were "+taskNames);
-        }
-        return result;
-    }
-
-    protected Optional<Task<?>> findTaskOrSubTaskImpl(Iterable<? extends Task<?>> tasks, Predicate<? super Task<?>> matcher, List<String> taskNames) {
-        for (Task<?> task : tasks) {
-            if (matcher.apply(task)) return Optional.<Task<?>>of(task);
-
-            if (!(task instanceof HasTaskChildren)) {
-                return Optional.absent();
-            } else {
-                Optional<Task<?>> subResult = findTaskOrSubTask(((HasTaskChildren) task).getChildren(), matcher);
-                if (subResult.isPresent()) return subResult;
-            }
-        }
-
-        return Optional.<Task<?>>absent();
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
deleted file mode 100644
index 6df5093..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
+++ /dev/null
@@ -1,92 +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.brooklyn;
-
-import java.io.StringReader;
-
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class WrapAppTest extends AbstractYamlTest {
-    private static final String NO_WRAP_APP_IMPLICIT =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String NO_WRAP_APP_EXPLICIT =
-            "name: Empty App\n" +
-            "wrappedApp: false\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String WRAP_APP_IMPLICIT =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String WRAP_APP_EXPLICIT =
-            "name: Empty App\n" +
-            "wrappedApp: true\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-    
-    private static final String WRAP_ENTITY =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestEntity";
-    
-    @Test
-    public void testNoWrapAppImplicit() throws Exception {
-        StartableApplication app = createApp(NO_WRAP_APP_IMPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 0);
-    }
-    
-    @Test
-    public void testNoWrapAppExplicit() throws Exception {
-        StartableApplication app = createApp(NO_WRAP_APP_EXPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 0);
-    }
-    
-    @Test
-    public void testWrapAppImplicit() throws Exception {
-        StartableApplication app = createApp(WRAP_APP_IMPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 2);
-    }
-    
-    @Test
-    public void testWrapAppExplicit() throws Exception {
-        StartableApplication app = createApp(WRAP_APP_EXPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 1);
-    }
-    
-    @Test
-    public void testWrapEntity() throws Exception {
-        StartableApplication app = createApp(WRAP_ENTITY);
-        Assert.assertTrue(app.getChildren().size() == 1);
-    }
-    
-    private StartableApplication createApp(String yaml) throws Exception {
-        StringReader in = new StringReader(yaml);
-        StartableApplication app = (StartableApplication)createAndStartApplication(in);
-        in.close();
-        return app;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
deleted file mode 100644
index 7985bb8..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
+++ /dev/null
@@ -1,108 +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.brooklyn.catalog;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.stream.ReaderInputStream;
-import org.apache.brooklyn.util.stream.Streams;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringReader;
-
-import com.google.common.io.ByteStreams;
-
-public class AbstractCatalogXmlTest extends AbstractYamlTest {
-    
-    private String catalogUrl;
-    
-    public AbstractCatalogXmlTest(String catalogUrl) {
-        this.catalogUrl = catalogUrl;
-    }
-    
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        ResourceUtils ru = new ResourceUtils(this);
-        File jar = createJar(ru);
-        File catalog = createCatalog(ru, jar);
-
-        BrooklynProperties properties = BrooklynProperties.Factory.newEmpty();
-        properties.put(BrooklynServerConfig.BROOKLYN_CATALOG_URL, catalog.toURI().toString());
-        return LocalManagementContextForTests.builder(true)
-                .useProperties(properties)
-                .disableOsgi(false)
-                .build();
-    }
-
-    protected Entity startApp(String type) throws Exception {
-        String yaml = "name: simple-app-yaml\n" +
-                "location: localhost\n" +
-                "services: \n" +
-                "  - type: " + type;
-        return createAndStartApplication(yaml);
-    }
-
-    private File createCatalog(ResourceUtils ru, File tmpJar) {
-        String catalogTemplate = ru.getResourceAsString(catalogUrl);
-        String catalog = catalogTemplate.replace("${osgi-entities-path}", tmpJar.toURI().toString());
-        File catalogTmp = Os.newTempFile("simple-catalog-", ".xml");
-        copy(catalog, catalogTmp);
-        return catalogTmp;
-    }
-
-    private File createJar(ResourceUtils ru) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        File tmpJar = Os.newTempFile("osgi-entities-", ".jar");
-        InputStream in = ru.getResourceFromUrl("classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        copy(in, tmpJar);
-        return tmpJar;
-    }
-
-    private void copy(String src, File dst) {
-        try {
-            copy(new ReaderInputStream(new StringReader(src), "UTF-8"), dst);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    private void copy(InputStream in, File tmpJar) {
-        try {
-            OutputStream out = new FileOutputStream(tmpJar);
-            ByteStreams.copy(in, out);
-            Streams.closeQuietly(in);
-            Streams.closeQuietly(out);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java
deleted file mode 100644
index 5a26f7a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java
+++ /dev/null
@@ -1,265 +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.brooklyn.catalog;
-
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityMatcher;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
-import org.apache.brooklyn.core.objs.BrooklynTypes;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-/** Many of the same tests as per {@link OsgiVersionMoreEntityTest} but using YAML for catalog and entities, so catalog item ID is set automatically */
-public class CatalogOsgiVersionMoreEntityTest extends AbstractYamlTest {
-    
-    private static final Logger log = LoggerFactory.getLogger(CatalogOsgiVersionMoreEntityTest.class);
-    
-    private static String getLocalResource(String filename) {
-        return ResourceUtils.create(CatalogOsgiVersionMoreEntityTest.class).getResourceAsString(
-            "classpath:/"+CatalogOsgiVersionMoreEntityTest.class.getPackage().getName().replace('.', '/')+"/"+filename);
-    }
-    
-    @Test
-    public void testMoreEntityV1() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        RegisteredType item = mgmt().getTypeRegistry().get("more-entity");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "1.0");
-        Assert.assertTrue(RegisteredTypePredicates.IS_ENTITY.apply(item));
-        Assert.assertEquals(item.getLibraries().size(), 1);
-        
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntity);
-    }
-
-    /** TODO we get warnings from {@link BrooklynEntityMatcher#extractValidConfigFlagsOrKeys};
-     * if we passed the correct loader at that point we could avoid those warnings. */ 
-    @Test
-    public void testMoreEntityV1WithPolicy() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("simple-policy-osgi-catalog.yaml"));
-        addCatalogItems(getLocalResource("more-entity-v1-with-policy-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        
-        Assert.assertEquals(moreEntity.policies().size(), 1, "wrong policies: "+moreEntity.policies());
-        Policy policy = Iterables.getOnlyElement(moreEntity.policies());
-        // it was loaded by yaml w ref to catalog, so should have the simple-policy catalog-id
-        Assert.assertEquals(policy.getCatalogItemId(), "simple-policy:1.0");
-    }
-
-    @Test
-    public void testMoreEntityV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-        
-        Assert.assertEquals(moreEntity.policies().size(), 1, "wrong policies: "+moreEntity.policies());
-        Policy policy = Iterables.getOnlyElement(moreEntity.policies());
-        // it was loaded from the java so should have the base more-entity catalog id
-        Assert.assertEquals(policy.getCatalogItemId(), "more-entity:1.0");
-    }
-
-    @Test
-    /** TODO this test works if we assume most recent version wins, but semantics TBC */
-    public void testMoreEntityV2ThenV1GivesV1() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        forceCatalogUpdate();
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntity);
-    }
-
-    /** unlike {@link #testMoreEntityV2ThenV1GivesV1()} this test should always work,
-     * because default should probably be either most-recent version or highest version,
-     * in either case this works */
-    @Test
-    public void testMoreEntityV1ThenV2GivesV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        forceCatalogUpdate();
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-    }
-
-    @Test
-    public void testMoreEntityBothV1AndV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-called-v1-osgi-catalog.yaml"));
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity v1 = createAndStartApplication("services: [ { type: 'more-entity-v1:1.0' } ]");
-        Entity v2 = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        
-        Entity moreEntityV1 = Iterables.getOnlyElement(v1.getChildren());
-        Entity moreEntityV2 = Iterables.getOnlyElement(v2.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntityV1);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntityV1);
-        
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntityV2);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntityV2);
-    }
-
-    @Test
-    public void testMoreEntityV2AutoscanWithClasspath() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-        
-        addCatalogItems(getLocalResource("more-entities-osgi-catalog-scan.yaml"));
-        
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getCatalog().getCatalogItems(), ", "));
-
-        RegisteredType item = mgmt().getTypeRegistry().get("more-entity");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "2.0.test");
-        Assert.assertTrue(RegisteredTypePredicates.IS_ENTITY.apply(item));
-        
-        // this refers to the java item, where the libraries are defined
-        item = mgmt().getTypeRegistry().get("org.apache.brooklyn.test.osgi.entities.more.MoreEntity");
-        Assert.assertEquals(item.getVersion(), "2.0.test_java");
-        Assert.assertEquals(item.getLibraries().size(), 2);
-        
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:2.0.test' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:2.0.test");
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-    }
-
-    @Test
-    public void testMorePolicyV2AutoscanWithClasspath() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-        
-        addCatalogItems(getLocalResource("more-policies-osgi-catalog-scan.yaml"));
-        
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getCatalog().getCatalogItems(), ", "));
-
-        RegisteredType item = mgmt().getTypeRegistry().get("more-policy");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "2.0.test");
-        Assert.assertTrue(RegisteredTypePredicates.IS_POLICY.apply(item));
-        
-        // this refers to the java item, where the libraries are defined
-        item = mgmt().getTypeRegistry().get("org.apache.brooklyn.test.osgi.entities.more.MorePolicy");
-        Assert.assertEquals(item.getVersion(), "2.0.test_java");
-        Assert.assertEquals(item.getLibraries().size(), 2);
-        
-        Entity app = createAndStartApplication(
-                "services: ",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-                "  brooklyn.policies:",
-                "  - type: more-policy:2.0.test");
-        Entity basicEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy morePolicy = Iterables.getOnlyElement(basicEntity.policies());
-        
-        Assert.assertEquals(morePolicy.getCatalogItemId(), "more-policy:2.0.test");
-        OsgiVersionMoreEntityTest.assertV2MethodCall(morePolicy);
-    }
-
-    @Test
-    public void testAutoscanWithClasspathCanCreateSpecs() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entities-osgi-catalog-scan.yaml"));
-
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getTypeRegistry().getAll(), ", "));
-
-        BrooklynTypeRegistry types = mgmt().getTypeRegistry();
-        Iterable<RegisteredType> items = types.getAll();
-        for (RegisteredType item: items) {
-            Object spec = types.createSpec(item, null, null);
-            int match = 0;
-            if (RegisteredTypes.isSubtypeOf(item, Entity.class)) {
-                assertTrue(spec instanceof EntitySpec, "Not an EntitySpec: " + spec);
-                BrooklynTypes.getDefinedEntityType(((EntitySpec<?>)spec).getType());
-                match++;
-            }
-            if (RegisteredTypes.isSubtypeOf(item, Policy.class)) {
-                assertTrue(spec instanceof PolicySpec, "Not a PolicySpec: " + spec);
-                BrooklynTypes.getDefinedBrooklynType(((PolicySpec<?>)spec).getType());
-                match++;
-            }
-            if (RegisteredTypes.isSubtypeOf(item, Location.class)) {
-                assertTrue(spec instanceof LocationSpec, "Not a LocationSpec: " + spec);
-                BrooklynTypes.getDefinedBrooklynType(((LocationSpec<?>)spec).getType());
-                match++;
-            }
-            if (match==0) {
-                Assert.fail("Unexpected type: "+item+" ("+item.getSuperTypes()+")");
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java
deleted file mode 100644
index 2161fec..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.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.brooklyn.catalog;
-
-import org.testng.annotations.Test;
-
-public class CatalogXmlOsgiTest extends AbstractCatalogXmlTest {
-
-    public CatalogXmlOsgiTest(String catalogUrl) {
-        super("classpath://osgi-catalog.xml");
-    }
-
-    @Test
-    public void testOsgiItem() throws Exception {
-        startApp("OsgiApp");
-        // previously OSGi libraries were not supported with old-style catalog items;
-        // now they are (2015-10), even though the XML is not supported,
-        // we may use the same type instantiator from CAMP and elsewhere
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.java
deleted file mode 100644
index b47bf76..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.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.brooklyn.catalog;
-
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-public class CatalogXmlVersionTest extends AbstractCatalogXmlTest {
-
-    public CatalogXmlVersionTest(String catalogUrl) {
-        super("classpath://simple-catalog.xml");
-    }
-
-    @DataProvider(name = "types")
-    public Object[][] createTypes() {
-        return new Object[][] {
-                {"org.apache.brooklyn.entity.stock.BasicApplication"},
-                {"org.apache.brooklyn.entity.stock.BasicApplication:0.0.0.SNAPSHOT"},
-                {"org.apache.brooklyn.entity.stock.BasicApplication:2.0"},
-                {"BasicApp"}, // test that items with symbolicName not matching the type work
-                {"BasicApp:0.0.0.SNAPSHOT"},
-                {"BasicApp:2.0"},
-                {"org.apache.brooklyn.test.osgi.entities.SimpleApplication"}, //test that classpath is used
-        };
-    }
-
-    @Test(dataProvider = "types")
-    public void testXmlCatalogItem(String type) throws Exception {
-        startApp(type);
-    }
-
-    @Test
-    public void testJavaPrefixDoesNotLoadXMLCatalogItem() throws Exception {
-        Entity entity = startApp("java:org.apache.brooklyn.camp.brooklyn.catalog.TestBasicApp");
-        assertTrue(entity instanceof TestBasicApp, "Entity is not a " + TestBasicApp.class.getName() + ", instead the type is " + entity.getEntityType().getName());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
deleted file mode 100644
index f4e58be..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.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.brooklyn.catalog;
-
-import org.testng.annotations.Test;
-
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-
-
-public class CatalogYamlAppTest extends AbstractYamlTest {
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        // Don't need osgi
-        return LocalManagementContextForTests.newInstance();
-    }
-
-    /**
-     * "Contrived" example was encountered by a customer in a real use-case!
-     * I couldn't yet simplify it further while still reproducing the failure.
-     * Throws StackOverlfowError, without giving a nice error message about 
-     * "BasicEntity" cyclic reference.
-     * 
-     * The circular reference comes from the member spec referencing 
-     * "org.apache.brooklyn.entity.stock.BasicEntity", but that has been defined in the
-     * catalog as this new blueprint (which overrides the previous value of it
-     * being a reference to the Java class).
-     * 
-     * We need to use an id that matches something else already on the classpath.
-     * Otherwise we'd get an error telling us "could not resolve item ..." when
-     * attempting to add the initial catalog item.
-     */
-    @Test(groups="WIP") // TODO Fix this!
-    public void testAddCatalogItemWithCircularReference() throws Exception {
-        // Add a catalog item with a circular reference to its own id.
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: org.apache.brooklyn.entity.stock.BasicEntity",
-                "  version: "+TEST_VERSION,
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  brooklyn.config:",
-                "    memberSpec:",
-                "      $brooklyn:entitySpec:",
-                "      - type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "        brooklyn.children:",
-                "        - type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        try {
-            // Use the blueprint from the catalog that has the circular reference.
-            // This should really give a nice error (rather than a StackOverflowError!).
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: another.app.in.the.catalog",
-                    "  version: "+TEST_VERSION,
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-            deleteCatalogEntity("another.app.in.the.catalog");
-        } finally {
-            deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicEntity");
-        }
-    }
-
-    @Test // same as above, but the minimal possible setup
-    public void testAddCatalogItemWithMemberSpecCircularReference() throws Exception {
-        // Add a catalog item with a circular reference to its own id through a $brooklyn:entitySpec
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  version: "+TEST_VERSION,
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  brooklyn.config:",
-                "    memberSpec:",
-                "      $brooklyn:entitySpec:",
-                "      - type: org.apache.brooklyn.entity.stock.BasicApplication");
-
-        try {
-            // Use the blueprint from the catalog that has the circular reference.
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: another.app.in.the.catalog",
-                    "  version: "+TEST_VERSION,
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicApplication");
-            deleteCatalogEntity("another.app.in.the.catalog");
-        } finally {
-            deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicApplication");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
deleted file mode 100644
index 8ce0023..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
+++ /dev/null
@@ -1,148 +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.brooklyn.catalog;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.entity.stock.BasicStartable;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-
-public class CatalogYamlCombiTest extends AbstractYamlTest {
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogYamlCombiTest.class);
-    
-    @Test
-    public void testBRefEntityA() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  items:",
-            
-            "  - itemType: entity",
-            "    item:",
-            // TODO inclusion of the above information gives a better error message when no transformers
-//            "  - item:",
-            
-            "      id: A",
-            "      type: "+BasicEntity.class.getName(),
-            "      brooklyn.config: { a: 1, b: 0 }",
-            "  - item:",
-            "      id: B",
-            "      type: A",
-            "      brooklyn.config: { b: 1 }");
-
-        RegisteredType item = mgmt().getTypeRegistry().get("B", TEST_VERSION);
-        Assert.assertNotNull(item);
-
-        Entity a = launchEntity("A");
-        Assert.assertTrue(BasicEntity.class.isInstance(a), "Wrong type: "+a);
-        Assert.assertEquals(a.config().get(ConfigKeys.newIntegerConfigKey("a")), (Integer)1);
-        Assert.assertEquals(a.config().get(ConfigKeys.newIntegerConfigKey("b")), (Integer)0);
-
-        Entity b = launchEntity("B");
-        Assert.assertTrue(BasicEntity.class.isInstance(b), "Wrong type: "+b);
-        Assert.assertEquals(b.config().get(ConfigKeys.newIntegerConfigKey("a")), (Integer)1);
-        Assert.assertEquals(b.config().get(ConfigKeys.newIntegerConfigKey("b")), (Integer)1);
-
-        deleteCatalogEntity("A");
-        
-        // now loading B makes an error
-        try {
-            launchEntity("B");
-            Assert.fail("B should not be launchable");
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.info("Got expected error: "+e);
-        }
-        
-        deleteCatalogEntity("B");
-    }
-
-    @Test
-    public void testBRefPolicyALocationZ() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  id: Z",
-            "  items:",
-            "  - item: ",
-            "      type: localhost",
-            "      brooklyn.config: { z: 9 }");
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  items:",
-            "  - item_type: policy", 
-            "    item:",
-            "      id: A",
-            "      type: "+ServiceRestarter.class.getName(),
-            "      brooklyn.config: { a: 99 }",
-            "  - item:",
-            "      id: B",
-            "      type: "+BasicStartable.class.getName(),
-            "      location: Z",
-            "      brooklyn.policies:",
-            "      - type: A");
-
-        RegisteredType item = mgmt().getTypeRegistry().get("A", TEST_VERSION);
-        Assert.assertNotNull(item);
-
-        Entity b = launchEntity("B", false);
-        Assert.assertTrue(BasicStartable.class.isInstance(b), "Wrong type: "+b);
-        Entities.dumpInfo(b);
-        
-        Assert.assertEquals(Iterables.getOnlyElement(b.getLocations()).getConfig(ConfigKeys.newIntegerConfigKey("z")), (Integer)9);
-        
-        Policy p = Iterables.getOnlyElement(b.policies());
-        Assert.assertTrue(ServiceRestarter.class.isInstance(p), "Wrong type: "+p);
-        Assert.assertEquals(p.getConfig(ConfigKeys.newIntegerConfigKey("a")), (Integer)99);
-        
-        deleteCatalogEntity("A");
-        deleteCatalogEntity("B");
-        deleteCatalogEntity("Z");
-    }
-
-    private Entity launchEntity(String symbolicName) throws Exception {
-        return launchEntity(symbolicName, true);
-    }
-    
-    private Entity launchEntity(String symbolicName, boolean includeLocation) throws Exception {
-        String yaml = "name: simple-app-yaml\n" +
-                      (includeLocation ? "location: localhost\n" : "") +
-                      "services: \n" +
-                      "  - type: "+ver(symbolicName);
-        Entity app = createAndStartApplication(yaml);
-        return Iterables.getOnlyElement(app.getChildren());
-    }
-
-
-}