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:47:48 UTC

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

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServer.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServer.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServer.java
deleted file mode 100644
index 34c07d3..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.entity.nosql.mongodb;
-
-import org.bson.BasicBSONObject;
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.AttributeSensor.SensorPersistenceMode;
-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.sensor.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-@Catalog(name="MongoDB Server",
-    description="MongoDB (from \"humongous\") is a scalable, high-performance, open source NoSQL database",
-    iconUrl="classpath:///mongodb-logo.png")
-@ImplementedBy(MongoDBServerImpl.class)
-public interface MongoDBServer extends AbstractMongoDBServer {
-
-    @SetFromFlag("mongodbConfTemplateUrl")
-    ConfigKey<String> MONGODB_CONF_TEMPLATE_URL = ConfigKeys.newConfigKeyWithDefault(
-            AbstractMongoDBServer.MONGODB_CONF_TEMPLATE_URL,
-            "classpath://org/apache/brooklyn/entity/nosql/mongodb/default-mongod.conf");
-
-    // See http://docs.mongodb.org/ecosystem/tools/http-interfaces/#http-console
-    // This is *always* 1000 more than port. We disable if it is not available.
-    PortAttributeSensorAndConfigKey HTTP_PORT =
-        new PortAttributeSensorAndConfigKey("mongodb.server.httpPort", "HTTP port for the server (estimated)", "28017+");
-
-    @SetFromFlag("enableRestInterface")
-    ConfigKey<Boolean> ENABLE_REST_INTERFACE = ConfigKeys.newBooleanConfigKey(
-            "mongodb.config.enable_rest", "Adds --rest to server startup flags when true", Boolean.FALSE);
-
-    @SetFromFlag("useClientMonitoring")
-    ConfigKey<Boolean> USE_CLIENT_MONITORING = ConfigKeys.newConfigKey("clientMonitoring.enabled", "Monitoring via the MongoDB client enabled", Boolean.TRUE);
-
-    AttributeSensor<String> HTTP_INTERFACE_URL = Sensors.newStringSensor(
-            "mongodb.server.http_interface", "URL of the server's HTTP console");
-
-    AttributeSensor<BasicBSONObject> STATUS_BSON = Sensors.builder(BasicBSONObject.class, "mongodb.server.status.bson")
-            .description("Server status (BSON/JSON map ojbect)")
-            .persistence(SensorPersistenceMode.NONE)
-            .build();
-    
-    AttributeSensor<Double> UPTIME_SECONDS = Sensors.newDoubleSensor(
-            "mongodb.server.uptime", "Server uptime in seconds");
-
-    AttributeSensor<Long> OPCOUNTERS_INSERTS = Sensors.newLongSensor(
-            "mongodb.server.opcounters.insert", "Server inserts");
-
-    AttributeSensor<Long> OPCOUNTERS_QUERIES = Sensors.newLongSensor(
-            "mongodb.server.opcounters.query", "Server queries");
-
-    AttributeSensor<Long> OPCOUNTERS_UPDATES = Sensors.newLongSensor(
-            "mongodb.server.opcounters.update", "Server updates");
-
-    AttributeSensor<Long> OPCOUNTERS_DELETES = Sensors.newLongSensor(
-            "mongodb.server.opcounters.delete", "Server deletes");
-
-    AttributeSensor<Long> OPCOUNTERS_GETMORE = Sensors.newLongSensor(
-            "mongodb.server.opcounters.getmore", "Server getmores");
-
-    AttributeSensor<Long> OPCOUNTERS_COMMAND = Sensors.newLongSensor(
-            "mongodb.server.opcounters.command", "Server commands");
-
-    AttributeSensor<Long> NETWORK_BYTES_IN = Sensors.newLongSensor(
-            "mongodb.server.network.bytesIn", "Server incoming network traffic (in bytes)");
-
-    AttributeSensor<Long> NETWORK_BYTES_OUT = Sensors.newLongSensor(
-            "mongodb.server.network.bytesOut", "Server outgoing network traffic (in bytes)");
-
-    AttributeSensor<Long> NETWORK_NUM_REQUESTS = Sensors.newLongSensor(
-            "mongodb.server.network.numRequests", "Server network requests");
-
-    /** A single server's replica set configuration **/
-    ConfigKey<MongoDBReplicaSet> REPLICA_SET = new BasicConfigKey<MongoDBReplicaSet>(MongoDBReplicaSet.class,
-            "mongodb.replicaset", "The replica set to which the server belongs. " +
-            "Users should not set this directly when creating a new replica set.");
-
-    AttributeSensor<ReplicaSetMemberStatus> REPLICA_SET_MEMBER_STATUS = Sensors.newSensor(
-            ReplicaSetMemberStatus.class, "mongodb.server.replicaSet.memberStatus", "The status of this server in the replica set");
-
-    AttributeSensor<Boolean> IS_PRIMARY_FOR_REPLICA_SET = Sensors.newBooleanSensor(
-            "mongodb.server.replicaSet.isPrimary", "True if this server is the write master for the replica set");
-
-    AttributeSensor<Boolean> IS_SECONDARY_FOR_REPLICA_SET = Sensors.newBooleanSensor(
-            "mongodb.server.replicaSet.isSecondary", "True if this server is a secondary server in the replica set");
-
-    AttributeSensor<String> REPLICA_SET_PRIMARY_ENDPOINT = Sensors.newStringSensor(
-            "mongodb.server.replicaSet.primary.endpoint", "The host:port of the server which is acting as primary (master) for the replica set");
-
-    AttributeSensor<String> MONGO_SERVER_ENDPOINT = Sensors.newStringSensor(
-            "mongodb.server.endpoint", "The host:port where this server is listening");
-
-    /**
-     * @return The replica set the server belongs to, or null if the server is a standalone instance.
-     */
-    MongoDBReplicaSet getReplicaSet();
-
-    /**
-     * @return True if the server is a child of {@link MongoDBReplicaSet}.
-     */
-    boolean isReplicaSetMember();
-
-    /**
-     * Initialises a replica set at the server the method is invoked on.
-     * @param replicaSetName The name for the replica set.
-     * @param id The id to be given to this server in the replica set configuration.
-     * @return True if initialisation is successful.
-     */
-    boolean initializeReplicaSet(String replicaSetName, Integer id);
-
-    /**
-     * Reconfigures the replica set that the server the method is invoked on is the primary member of
-     * to include a new member.
-     * <p/>
-     * Note that this can cause long downtime (typically 10-20s, even up to a minute).
-     *
-     * @param secondary New member of the set.
-     * @param id The id for the new set member. Must be unique within the set; its validity is not checked.
-     * @return True if addition is successful. False if the server this is called on is not the primary
-     *         member of the replica set.
-     */
-    boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id);
-
-    /**
-     * Reconfigures the replica set that the server the method is invoked on is the primary member of
-     * to remove the given server.
-     * @param server The server to remove.
-     * @return True if removal is successful. False if the server this is called on is not the primary
-     *         member of the replica set.
-     */
-    boolean removeMemberFromReplicaSet(MongoDBServer server);
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
deleted file mode 100644
index 35b60e8..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.entity.nosql.mongodb;
-
-import java.net.UnknownHostException;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.core.location.access.BrooklynAccessUtils;
-import org.apache.brooklyn.entity.software.base.SoftwareProcessImpl;
-import org.apache.brooklyn.feed.function.FunctionFeed;
-import org.apache.brooklyn.feed.function.FunctionPollConfig;
-import org.bson.BasicBSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Functions;
-import com.google.common.base.Objects;
-import com.google.common.net.HostAndPort;
-
-public class MongoDBServerImpl extends SoftwareProcessImpl implements MongoDBServer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(MongoDBServerImpl.class);
-
-    static {
-        RendererHints.register(HTTP_INTERFACE_URL, RendererHints.namedActionWithUrl());
-    }
-
-    private FunctionFeed serviceStats;
-    private FunctionFeed replicaSetStats;
-    private MongoDBClientSupport client;
-
-    public MongoDBServerImpl() {
-    }
-
-    @Override
-    public Class<?> getDriverInterface() {
-        return MongoDBDriver.class;
-    }
-
-    @Override
-    protected void connectSensors() {
-        super.connectSensors();
-        connectServiceUpIsRunning();
-
-        int port = sensors().get(MongoDBServer.PORT);
-        HostAndPort accessibleAddress = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, port);
-        sensors().set(MONGO_SERVER_ENDPOINT, String.format("%s:%d",
-                accessibleAddress.getHostText(), accessibleAddress.getPort()));
-
-        int httpConsolePort = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, sensors().get(HTTP_PORT)).getPort();
-        sensors().set(HTTP_INTERFACE_URL, String.format("http://%s:%d",
-                accessibleAddress.getHostText(), httpConsolePort));
-
-        if (clientAccessEnabled()) {
-            try {
-                client = MongoDBClientSupport.forServer(this);
-            } catch (UnknownHostException e) {
-                LOG.warn("Unable to create client connection to {}, not connecting sensors: {} ", this, e.getMessage());
-                return;
-            }
-    
-            serviceStats = FunctionFeed.builder()
-                    .entity(this)
-                    .poll(new FunctionPollConfig<Object, BasicBSONObject>(STATUS_BSON)
-                            .period(2, TimeUnit.SECONDS)
-                            .callable(new Callable<BasicBSONObject>() {
-                                @Override
-                                public BasicBSONObject call() throws Exception {
-                                    return MongoDBServerImpl.this.sensors().get(SERVICE_UP)
-                                        ? client.getServerStatus()
-                                        : null;
-                                }
-                            })
-                            .onException(Functions.<BasicBSONObject>constant(null)))
-                    .build();
-    
-            if (isReplicaSetMember()) {
-                replicaSetStats = FunctionFeed.builder()
-                        .entity(this)
-                        .poll(new FunctionPollConfig<Object, ReplicaSetMemberStatus>(REPLICA_SET_MEMBER_STATUS)
-                                .period(2, TimeUnit.SECONDS)
-                                .callable(new Callable<ReplicaSetMemberStatus>() {
-                                    /**
-                                     * Calls {@link MongoDBClientSupport#getReplicaSetStatus} and
-                                     * extracts <code>myState</code> from the response.
-                                     * @return
-                                     *      The appropriate {@link org.apache.brooklyn.entity.nosql.mongodb.ReplicaSetMemberStatus}
-                                     *      if <code>myState</code> was non-null, {@link ReplicaSetMemberStatus#UNKNOWN} otherwise.
-                                     */
-                                    @Override
-                                    public ReplicaSetMemberStatus call() {
-                                        BasicBSONObject serverStatus = client.getReplicaSetStatus();
-                                        int state = serverStatus.getInt("myState", -1);
-                                        return ReplicaSetMemberStatus.fromCode(state);
-                                    }
-                                })
-                                .onException(Functions.constant(ReplicaSetMemberStatus.UNKNOWN))
-                                .suppressDuplicates(true))
-                        .build();
-            } else {
-                sensors().set(IS_PRIMARY_FOR_REPLICA_SET, false);
-                sensors().set(IS_SECONDARY_FOR_REPLICA_SET, false);
-            }
-        } else {
-            LOG.info("Not monitoring "+this+" to retrieve state via client API");
-        }
-
-        // Take interesting details from STATUS.
-        subscriptions().subscribe(this, STATUS_BSON, new SensorEventListener<BasicBSONObject>() {
-                @Override public void onEvent(SensorEvent<BasicBSONObject> event) {
-                    BasicBSONObject map = event.getValue();
-                    if (map != null && !map.isEmpty()) {
-                        sensors().set(UPTIME_SECONDS, map.getDouble("uptime", 0));
-
-                        // Operations
-                        BasicBSONObject opcounters = (BasicBSONObject) map.get("opcounters");
-                        sensors().set(OPCOUNTERS_INSERTS, opcounters.getLong("insert", 0));
-                        sensors().set(OPCOUNTERS_QUERIES, opcounters.getLong("query", 0));
-                        sensors().set(OPCOUNTERS_UPDATES, opcounters.getLong("update", 0));
-                        sensors().set(OPCOUNTERS_DELETES, opcounters.getLong("delete", 0));
-                        sensors().set(OPCOUNTERS_GETMORE, opcounters.getLong("getmore", 0));
-                        sensors().set(OPCOUNTERS_COMMAND, opcounters.getLong("command", 0));
-
-                        // Network stats
-                        BasicBSONObject network = (BasicBSONObject) map.get("network");
-                        sensors().set(NETWORK_BYTES_IN, network.getLong("bytesIn", 0));
-                        sensors().set(NETWORK_BYTES_OUT, network.getLong("bytesOut", 0));
-                        sensors().set(NETWORK_NUM_REQUESTS, network.getLong("numRequests", 0));
-
-                        // Replica set stats
-                        BasicBSONObject repl = (BasicBSONObject) map.get("repl");
-                        if (isReplicaSetMember() && repl != null) {
-                            sensors().set(IS_PRIMARY_FOR_REPLICA_SET, repl.getBoolean("ismaster"));
-                            sensors().set(IS_SECONDARY_FOR_REPLICA_SET, repl.getBoolean("secondary"));
-                            sensors().set(REPLICA_SET_PRIMARY_ENDPOINT, repl.getString("primary"));
-                        }
-                    }
-                }
-        });
-    }
-
-    @Override
-    protected void disconnectSensors() {
-        super.disconnectSensors();
-        disconnectServiceUpIsRunning();
-        if (serviceStats != null) serviceStats.stop();
-        if (replicaSetStats != null) replicaSetStats.stop();
-    }
-
-    protected boolean clientAccessEnabled() {
-        return Boolean.TRUE.equals(config().get(MongoDBServer.USE_CLIENT_MONITORING));
-    }
-    
-    @Override
-    public MongoDBReplicaSet getReplicaSet() {
-        return config().get(MongoDBServer.REPLICA_SET);
-    }
-
-    @Override
-    public boolean isReplicaSetMember() {
-        return getReplicaSet() != null;
-    }
-
-    @Override
-    public boolean initializeReplicaSet(String replicaSetName, Integer id) {
-        return client.initializeReplicaSet(replicaSetName, id);
-    }
-
-    @Override
-    public boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id) {
-        // TODO The attributes IS_PRIMARY_FOR_REPLICA_SET and REPLICA_SET_MEMBER_STATUS can be out-of-sync.
-        // The former is obtained by an enricher that listens to STATUS_BSON (set by client.getServerStatus()).
-        // The latter is set by a different feed doing client.getReplicaSetStatus().getInt("myState").
-        // The ReplicaSet uses REPLICA_SET_MEMBER_STATUS to determine which node to call.
-        // 
-        // Relying on caller to respect the `false` result, to retry.
-        if (!sensors().get(IS_PRIMARY_FOR_REPLICA_SET)) {
-            LOG.warn("Attempted to add {} to replica set at server that is not primary: {}", secondary, this);
-            return false;
-        }
-        if (!clientAccessEnabled()) {
-            throw new IllegalStateException("client-access disabled for "+this+"; cannot add to replica set member "+secondary+" -> "+id);
-        }
-        return client.addMemberToReplicaSet(secondary, id);
-    }
-
-    @Override
-    public boolean removeMemberFromReplicaSet(MongoDBServer server) {
-        if (!sensors().get(IS_PRIMARY_FOR_REPLICA_SET)) {
-            LOG.warn("Attempted to remove {} from replica set at server that is not primary: {}", server, this);
-            return false;
-        }
-        if (!clientAccessEnabled()) {
-            throw new IllegalStateException("client-access disabled for "+this+"; cannot remove from replica set member "+server);
-        }
-        return client.removeMemberFromReplicaSet(server);
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this)
-                .add("id", getId())
-                .add("hostname", sensors().get(HOSTNAME))
-                .add("port", sensors().get(PORT))
-                .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBSshDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBSshDriver.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBSshDriver.java
deleted file mode 100644
index 89f8112..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBSshDriver.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.entity.nosql.mongodb;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-
-public class MongoDBSshDriver extends AbstractMongoDBSshDriver implements MongoDBDriver {
-
-    public MongoDBSshDriver(MongoDBServerImpl entity, SshMachineLocation machine) {
-        super(entity, machine);
-    }
-
-    @Override
-    public MongoDBServerImpl getEntity() {
-        return MongoDBServerImpl.class.cast(super.getEntity());
-    }
-
-    @Override
-    public void launch() {
-        MongoDBServer server = getEntity();
-
-        ImmutableList.Builder<String> argsBuilder = getArgsBuilderWithDefaults(server)
-            .add("--dbpath", getDataDirectory());
-
-        if (server.isReplicaSetMember()) {
-            String replicaSetName = server.getReplicaSet().getName();
-            checkState(!Strings.isNullOrEmpty(replicaSetName), "Replica set name must not be null or empty");
-            argsBuilder.add("--replSet", replicaSetName);
-        }
-
-        if (Boolean.TRUE.equals(server.getConfig(MongoDBServer.ENABLE_REST_INTERFACE)))
-            argsBuilder.add("--rest");
-
-        launch(argsBuilder);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java
deleted file mode 100644
index 9ea240b..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.entity.nosql.mongodb;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Iterator;
-
-import org.apache.brooklyn.core.location.access.BrooklynAccessUtils;
-import org.bson.BSONObject;
-import org.bson.BasicBSONObject;
-import org.bson.types.BasicBSONList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
-import com.google.common.net.HostAndPort;
-
-/**
- * Simplifies the creation of configuration objects for Mongo DB replica sets.
- * <p/>
- * A configuration object is structured like this:
- * <pre>
- * {
- *    "_id" : "replica-set-name",
- *     "version" : 3,
- *    "members" : [
- *        { "_id" : 0, "host" : "Sams.local:27017" },
- *        { "_id" : 1, "host" : "Sams.local:27018" },
- *        { "_id" : 2, "host" : "Sams.local:27019" }
- *    ]
- * }
- * </pre>
- * To add or remove servers to a replica set you must redefine this configuration
- * (run <code>replSetReconfig</code> on the primary) with the new <code>members</code>
- * list and the <code>version</code> updated.
- */
-public class ReplicaSetConfig {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ReplicaSetConfig.class);
-    static final int MAXIMUM_REPLICA_SET_SIZE = 12;
-    static final int MAXIMUM_VOTING_MEMBERS = 7;
-
-    private Optional<HostAndPort> primary = Optional.absent();
-
-    private String name;
-    private Integer version;
-    BasicBSONList members;
-
-    public ReplicaSetConfig(String name) {
-        this(name, new BasicBSONList());
-    }
-
-    public ReplicaSetConfig(String name, BasicBSONList existingMembers) {
-        this.name = name;
-        this.members = existingMembers;
-        this.version = 1;
-    }
-
-    /**
-     * Creates a configuration with the given name.
-     */
-    public static ReplicaSetConfig builder(String name) {
-        return new ReplicaSetConfig(name);
-    }
-
-    /**
-     * Creates a configuration from an existing configuration.
-     * <p/>
-     * Automatically increments the replica set's version number.
-     */
-    public static ReplicaSetConfig fromExistingConfig(BSONObject config) {
-        checkNotNull(config);
-        checkArgument(config.containsField("_id"), "_id missing from replica set config");
-        checkArgument(config.containsField("version"), "version missing from replica set config");
-        checkArgument(config.containsField("members"), "members missing from replica set config");
-
-        String name = (String) config.get("_id");
-        Integer version = (Integer) config.get("version");
-        BasicBSONList members = (BasicBSONList) config.get("members");
-
-        return new ReplicaSetConfig(name, members).version(++version);
-    }
-
-    /**
-     * Sets the version of the configuration. The version number must increase as the replica set changes.
-     */
-    public ReplicaSetConfig version(Integer version) {
-        this.version = version;
-        return this;
-    }
-
-    /**
-     * Notes the primary member of the replica. Primary members will always be voting members.
-     */
-    public ReplicaSetConfig primary(HostAndPort primary) {
-        this.primary = Optional.of(primary);
-        return this;
-    }
-
-    /**
-     * Adds a new member to the replica set config using {@link MongoDBServer#HOSTNAME} and {@link MongoDBServer#PORT}
-     * for hostname and port. Doesn't attempt to check that the id is free.
-     */
-    public ReplicaSetConfig member(MongoDBServer server, Integer id) {
-        // TODO: Switch to SUBNET_HOSTNAME and there should be no need for a Brooklyn accessible
-        // address. It will require modification to MongoDBClientSupport, though, since it sets
-        // the primary to the host/port accessible from Brooklyn.
-        HostAndPort hap = BrooklynAccessUtils.getBrooklynAccessibleAddress(server, server.getAttribute(MongoDBServer.PORT));
-        return member(hap.getHostText(), hap.getPort(), id);
-    }
-
-    /**
-     * Adds a new member to the replica set config using the given {@link HostAndPort} for hostname and port.
-     * Doesn't attempt to check that the id is free.
-     */
-    public ReplicaSetConfig member(HostAndPort address, Integer id) {
-        return member(address.getHostText(), address.getPort(), id);
-    }
-
-    /**
-     * Adds a new member to the replica set config with the given hostname, port and id. Doesn't attempt to check
-     * that the id is free.
-     */
-    public ReplicaSetConfig member(String hostname, Integer port, Integer id) {
-        if (members.size() == MAXIMUM_REPLICA_SET_SIZE) {
-            throw new IllegalStateException(String.format(
-                    "Replica set {} exceeds maximum size of {} with addition of member at {}:{}",
-                    new Object[]{name, MAXIMUM_REPLICA_SET_SIZE, hostname, port}));
-        }
-        BasicBSONObject member = new BasicBSONObject();
-        member.put("_id", id);
-        member.put("host", String.format("%s:%s", hostname, port));
-        members.add(member);
-        return this;
-    }
-
-    /** Removes the first entity using {@link MongoDBServer#HOSTNAME} and {@link MongoDBServer#PORT}. */
-    public ReplicaSetConfig remove(MongoDBServer server) {
-        HostAndPort hap = BrooklynAccessUtils.getBrooklynAccessibleAddress(server, server.getAttribute(MongoDBServer.PORT));
-        return remove(hap.getHostText(), hap.getPort());
-    }
-
-    /** Removes the first entity with host and port matching the given address. */
-    public ReplicaSetConfig remove(HostAndPort address) {
-        return remove(address.getHostText(), address.getPort());
-    }
-
-    /**
-     * Removes the first entity with the given hostname and port from the list of members
-     */
-    public ReplicaSetConfig remove(String hostname, Integer port) {
-        String host = String.format("%s:%s", hostname, port);
-        Iterator<Object> it = this.members.iterator();
-        while (it.hasNext()) {
-            Object next = it.next();
-            if (next instanceof BasicBSONObject) {
-                BasicBSONObject basicBSONObject = (BasicBSONObject) next;
-                if (host.equals(basicBSONObject.getString("host"))) {
-                    it.remove();
-                    break;
-                }
-            }
-        }
-        return this;
-    }
-
-    /**
-     * @return A {@link BasicBSONObject} representing the configuration that is suitable for a MongoDB server.
-     */
-    public BasicBSONObject build() {
-        setVotingMembers();
-        BasicBSONObject config = new BasicBSONObject();
-        config.put("_id", name);
-        config.put("version", version);
-        config.put("members", members);
-        return config;
-    }
-
-    /**
-     * Selects 1, 3, 5 or 7 members to have a vote. The primary member (as set by
-     * {@link #primary(com.google.common.net.HostAndPort)}) is guaranteed a vote if
-     * it is in {@link #members}.
-     * <p/>
-     *
-     * Reconfiguring a server to be voters when they previously did not have votes generally triggers
-     * a primary election. This confuses the MongoDB Java driver, which logs an error like:
-     * <pre>
-     * WARN  emptying DBPortPool to sams.home/192.168.1.64:27019 b/c of error
-     * java.io.EOFException: null
-     *    at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na]
-     * WARN  Command { "replSetReconfig" : ... } on sams.home/192.168.1.64:27019 failed
-     * com.mongodb.MongoException$Network: Read operation to server sams.home/192.168.1.64:27019 failed on database admin
-     *    at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:253) ~[mongo-java-driver-2.11.3.jar:na]
-     * Caused by: java.io.EOFException: null
-     *    at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na]
-     * </pre>
-     *
-     * The MongoDB documentation on <a href=http://docs.mongodb.org/manual/tutorial/configure-a-non-voting-replica-set-member/">
-     * non-voting members</a> says:
-     * <blockquote>
-     *     Initializes a new replica set configuration. Disconnects the shell briefly and forces a
-     *     reconnection as the replica set renegotiates which member will be primary. As a result,
-     *     the shell will display an error even if this command succeeds.
-     * </blockquote>
-     *
-     * So the problem is more that the MongoDB Java driver does not understand why the server
-     * may have disconnected and is to eager to report a problem.
-     */
-    private void setVotingMembers() {
-        if (LOG.isDebugEnabled())
-            LOG.debug("Setting voting and non-voting members of replica set: {}", name);
-        boolean seenPrimary = false;
-        String expectedPrimary = primary.isPresent()
-                ? primary.get().getHostText() + ":" + primary.get().getPort()
-                : "";
-
-        // Ensure an odd number of voters
-        int setSize = this.members.size();
-        int nonPrimaryVotingMembers = Math.min(setSize % 2 == 0 ? setSize - 1 : setSize, MAXIMUM_VOTING_MEMBERS);
-        if (primary.isPresent()) {
-            if (LOG.isTraceEnabled())
-                LOG.trace("Reserving vote for primary: " + expectedPrimary);
-            nonPrimaryVotingMembers -= 1;
-        }
-
-        for (Object member : this.members) {
-            if (member instanceof BasicBSONObject) {
-                BasicBSONObject bsonObject = BasicBSONObject.class.cast(member);
-                String host = bsonObject.getString("host");
-
-                // is this member noted as the primary?
-                if (this.primary.isPresent() && expectedPrimary.equals(host)) {
-                    bsonObject.put("votes", 1);
-                    seenPrimary = true;
-                    if (LOG.isDebugEnabled())
-                        LOG.debug("Voting member (primary) of set {}: {}", name, host);
-                } else if (nonPrimaryVotingMembers-- > 0) {
-                    bsonObject.put("votes", 1);
-                    if (LOG.isDebugEnabled())
-                        LOG.debug("Voting member of set {}: {}", name, host);
-                } else {
-                    bsonObject.put("votes", 0);
-                    if (LOG.isDebugEnabled())
-                        LOG.debug("Non-voting member of set {}: {}", name, host);
-                }
-            } else {
-                LOG.error("Unexpected entry in replica set members list: " + member);
-            }
-        }
-
-        if (primary.isPresent() && !seenPrimary) {
-            LOG.warn("Cannot give replica set primary a vote in reconfigured set: " +
-                    "primary was indicated as {} but no member with that host and port was seen in the set. " +
-                    "The replica set now has an even number of voters.",
-                    this.primary);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetMemberStatus.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetMemberStatus.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetMemberStatus.java
deleted file mode 100644
index 16df3a7..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/ReplicaSetMemberStatus.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.entity.nosql.mongodb;
-
-/**
- * @see <a href="http://docs.mongodb.org/manual/reference/replica-status/">Replica set status reference</a>
- */
-public enum ReplicaSetMemberStatus {
-
-    STARTUP("Start up, phase 1 (parsing configuration)"),
-    PRIMARY("Primary"),
-    SECONDARY("Secondary"),
-    RECOVERING("Member is recovering (initial sync, post-rollback, stale members)"),
-    FATAL("Member has encountered an unrecoverable error"),
-    STARTUP2("Start up, phase 2 (forking threads)"),
-    UNKNOWN("Unknown (the set has never connected to the member)"),
-    ARBITER("Member is an arbiter"),
-    DOWN("Member is not accessible to the set"),
-    ROLLBACK("Member is rolling back data. See rollback"),
-    SHUNNED("Member has been removed from replica set");
-
-    private final String description;
-
-    ReplicaSetMemberStatus(String description) {
-        this.description = description;
-    }
-
-    public static ReplicaSetMemberStatus fromCode(int code) {
-        switch (code) {
-            case 0: return STARTUP;
-            case 1: return PRIMARY;
-            case 2: return SECONDARY;
-            case 3: return RECOVERING;
-            case 4: return FATAL;
-            case 5: return STARTUP2;
-            case 6: return UNKNOWN;
-            case 7: return ARBITER;
-            case 8: return DOWN;
-            case 9: return ROLLBACK;
-            case 10: return SHUNNED;
-            default: return UNKNOWN;
-        }
-    }
-
-    @Override
-    public String toString() {
-        return name() + ": " + description;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouter.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouter.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouter.java
deleted file mode 100644
index 55bad2e..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouter.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.entity.nosql.mongodb.sharding;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-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.Sensors;
-import org.apache.brooklyn.entity.software.base.SameServerEntity;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-import com.google.common.reflect.TypeToken;
-
-@ImplementedBy(CoLocatedMongoDBRouterImpl.class)
-public interface CoLocatedMongoDBRouter extends SameServerEntity {
-    @SuppressWarnings("serial")
-    @SetFromFlag("siblingSpecs")
-    ConfigKey<Iterable<EntitySpec<?>>> SIBLING_SPECS = ConfigKeys.newConfigKey(new TypeToken<Iterable<EntitySpec<?>>>(){}, 
-            "mongodb.colocatedrouter.sibling.specs", "Collection of (configured) specs for entities to be co-located with the router");
-    
-    @SetFromFlag("shardedDeployment")
-    ConfigKey<MongoDBShardedDeployment> SHARDED_DEPLOYMENT = ConfigKeys.newConfigKey(MongoDBShardedDeployment.class, 
-            "mongodb.colocatedrouter.shardeddeployment", "Sharded deployment to which the router should report");
-
-    /** Deprecated since 0.7.0 use {@link #PROPAGATING_SENSORS} instead. */
-    @Deprecated
-    @SuppressWarnings("serial")
-    @SetFromFlag("propogatingSensors")
-    ConfigKey<List<Map<String, ?>>> PROPOGATING_SENSORS = ConfigKeys.newConfigKey(new TypeToken<List<Map<String, ?>>>(){}, 
-            "mongodb.colocatedrouter.propogating.sensors", "List of sensors to be propogated from child members");
-
-    @SetFromFlag("propagatingSensors")
-    ConfigKey<List<Map<String, ?>>> PROPAGATING_SENSORS = ConfigKeys.newConfigKey(new TypeToken<List<Map<String, ?>>>(){},
-            "mongodb.colocatedrouter.propagating.sensors", "List of sensors to be propogated from child members");
-
-    public static AttributeSensor<MongoDBRouter> ROUTER = Sensors.newSensor(MongoDBRouter.class,
-            "mongodb.colocatedrouter.router", "Router");
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
deleted file mode 100644
index 9648f47..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.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.entity.nosql.mongodb.sharding;
-
-import java.util.Collection;
-
-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.core.entity.Entities;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.group.AbstractGroup;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBAuthenticationMixins;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBAuthenticationUtils;
-import org.apache.brooklyn.entity.software.base.SameServerEntityImpl;
-
-public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl implements CoLocatedMongoDBRouter, MongoDBAuthenticationMixins {
-
-    @Override
-    public void init() {
-        super.init();
-        MongoDBRouter router = addChild(EntitySpec.create(MongoDBRouter.class)
-                .configure(MongoDBRouter.CONFIG_SERVERS,
-                        DependentConfiguration.attributeWhenReady(
-                                getConfig(CoLocatedMongoDBRouter.SHARDED_DEPLOYMENT),
-                                MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES)));
-
-        for (EntitySpec<?> siblingSpec : getConfig(CoLocatedMongoDBRouter.SIBLING_SPECS)) {
-            addChild(siblingSpec);
-        }
-        sensors().set(ROUTER, router);
-    }
-
-    @Override
-    protected void doStart(Collection<? extends Location> locations) {
-        MongoDBRouter router = sensors().get(ROUTER);
-
-        // Do not attempt to read the configuration until after the router has been added to the cluster
-        // as it is at this point that the authentication configuration is set
-        Task<?> clusterTask = DependentConfiguration.attributeWhenReady(router, AbstractGroup.FIRST);
-        Entities.submit(this, clusterTask);
-        clusterTask.getUnchecked();
-
-        MongoDBAuthenticationUtils.setAuthenticationConfig(router, this);
-        router.sensors().set(MongoDBAuthenticationMixins.ROOT_PASSWORD, router.config().get(MongoDBAuthenticationMixins.ROOT_PASSWORD));
-        router.sensors().set(MongoDBAuthenticationMixins.ROOT_USERNAME, router.config().get(MongoDBAuthenticationMixins.ROOT_USERNAME));
-        router.sensors().set(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE, router.config().get(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE));
-        enrichers().add(Enrichers.builder().propagating(MongoDBRouter.PORT).from(router).build());
-        
-        super.doStart(locations);
-        sensors().set(Startable.SERVICE_UP, true);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServer.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServer.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServer.java
deleted file mode 100644
index 2108eaa..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServer.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.entity.nosql.mongodb.AbstractMongoDBServer;
-
-@ImplementedBy(MongoDBConfigServerImpl.class)
-public interface MongoDBConfigServer extends AbstractMongoDBServer {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerCluster.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerCluster.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerCluster.java
deleted file mode 100644
index 73ac77d..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerCluster.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-
-import com.google.common.reflect.TypeToken;
-
-@ImplementedBy(MongoDBConfigServerClusterImpl.class)
-public interface MongoDBConfigServerCluster extends DynamicCluster {
-
-    @SuppressWarnings("serial")
-    AttributeSensor<Iterable<String>> CONFIG_SERVER_ADDRESSES = Sensors.newSensor(new TypeToken<Iterable<String>>() {}, 
-            "mongodb.config.server.addresses", "List of config server hostnames and ports");
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerClusterImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerClusterImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerClusterImpl.java
deleted file mode 100644
index b5bf2cc..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerClusterImpl.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.entity.nosql.mongodb.sharding;
-
-import java.util.Collection;
-
-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.core.location.access.BrooklynAccessUtils;
-import org.apache.brooklyn.entity.group.DynamicClusterImpl;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.net.HostAndPort;
-
-public class MongoDBConfigServerClusterImpl extends DynamicClusterImpl implements MongoDBConfigServerCluster {
-    
-    @Override
-    protected EntitySpec<?> getMemberSpec() {
-        if (super.getMemberSpec() != null)
-            return super.getMemberSpec();
-        return EntitySpec.create(MongoDBConfigServer.class);
-    }
-    
-    @Override
-    public void start(Collection<? extends Location> locs) {
-        super.start(locs);
-        
-        // TODO this should be an enricher
-        Iterable<String> memberHostNamesAndPorts = Iterables.transform(getMembers(), new Function<Entity, String>() {
-            @Override
-            public String apply(Entity entity) {
-                HostAndPort hostAndPort = BrooklynAccessUtils.getBrooklynAccessibleAddress(entity, entity.getAttribute(MongoDBConfigServer.PORT));
-                return hostAndPort.getHostText() + ":" + hostAndPort.getPort();
-            }
-        });
-        sensors().set(MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES, ImmutableList.copyOf(memberHostNamesAndPorts));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerDriver.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerDriver.java
deleted file mode 100644
index 9ccaccd..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerDriver.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.entity.software.base.SoftwareProcessDriver;
-
-public interface MongoDBConfigServerDriver extends SoftwareProcessDriver {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerImpl.java
deleted file mode 100644
index faa6ed6..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerImpl.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.entity.software.base.SoftwareProcessImpl;
-
-public class MongoDBConfigServerImpl extends SoftwareProcessImpl implements MongoDBConfigServer {
-
-    @Override
-    public Class<?> getDriverInterface() {
-        return MongoDBConfigServerDriver.class;
-    }
-    
-    @Override
-    protected void connectSensors() {
-        super.connectSensors();
-        connectServiceUpIsRunning();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerSshDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerSshDriver.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerSshDriver.java
deleted file mode 100644
index 3eada3b..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBConfigServerSshDriver.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.entity.nosql.mongodb.AbstractMongoDBSshDriver;
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBDriver;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-
-public class MongoDBConfigServerSshDriver extends AbstractMongoDBSshDriver implements MongoDBDriver {
-    
-    public MongoDBConfigServerSshDriver(MongoDBConfigServerImpl entity, SshMachineLocation machine) {
-        super(entity, machine);
-    }
-    
-    @Override
-    public MongoDBConfigServerImpl getEntity() {
-        return MongoDBConfigServerImpl.class.cast(super.getEntity());
-    }
-
-    @Override
-    public void launch() {
-        launch(getArgsBuilderWithDefaults(getEntity())
-                .add("--configsvr")
-                .add("--dbpath", getDataDirectory()));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouter.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouter.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouter.java
deleted file mode 100644
index 9191391..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouter.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-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.Sensors;
-import org.apache.brooklyn.entity.nosql.mongodb.AbstractMongoDBServer;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.reflect.TypeToken;
-
-@Catalog(name="MongoDB Router",
-        description="MongoDB (from \"humongous\") is a scalable, high-performance, open source NoSQL database",
-        iconUrl="classpath:///mongodb-logo.png")
-@ImplementedBy(MongoDBRouterImpl.class)
-public interface MongoDBRouter extends AbstractMongoDBServer {
-
-    @SuppressWarnings("serial")
-    ConfigKey<Iterable<String>> CONFIG_SERVERS = ConfigKeys.newConfigKey(
-            new TypeToken<Iterable<String>>(){}, "mongodb.router.config.servers", "List of host names and ports of the config servers");
-    
-    AttributeSensor<Integer> SHARD_COUNT = Sensors.newIntegerSensor("mongodb.router.config.shard.count", "Number of shards that have been added");
-    
-    AttributeSensor<Boolean> RUNNING = Sensors.newBooleanSensor("mongodb.router.running", "Indicates that the router is running, "
-            + "and can be used to add shards, but is not necessarity available for CRUD operations (e.g. if no shards have been added)");
-
-    /**
-     * @throws IllegalStateException if times out.
-     */
-    public void waitForServiceUp(Duration duration);
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterCluster.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterCluster.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterCluster.java
deleted file mode 100644
index a313c1c..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterCluster.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.entity.nosql.mongodb.sharding;
-
-import java.util.Collection;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-
-@ImplementedBy(MongoDBRouterClusterImpl.class)
-public interface MongoDBRouterCluster extends DynamicCluster {
-
-    AttributeSensor<MongoDBRouter> ANY_ROUTER = Sensors.newSensor(MongoDBRouter.class, "mongodb.routercluster.any", 
-            "When set, can be used to access one of the routers in the cluster (usually the first). This will only be set once "
-            + "at least one shard has been added, and the router is available for CRUD operations");
-    
-    AttributeSensor<MongoDBRouter> ANY_RUNNING_ROUTER = Sensors.newSensor(MongoDBRouter.class, "mongodb.routercluster.any.running", 
-            "When set, can be used to access one of the running routers in the cluster (usually the first). This should only be used " 
-            + "to add shards as it does not guarantee that the router is available for CRUD operations");
-
-    /**
-     * @return One of the routers in the cluster if available, null otherwise
-     */
-    MongoDBRouter getAnyRouter();
-    
-    /**
-     * @return One of the running routers in the cluster. This should only be used to add shards as it does not guarantee that 
-     * the router is available for CRUD operations
-     */
-    MongoDBRouter getAnyRunningRouter();
-    
-    /**
-     * @return All routers in the cluster
-     */
-    Collection<MongoDBRouter> getRouters();
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
deleted file mode 100644
index 48b501c..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.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.entity.nosql.mongodb.sharding;
-
-import java.util.Collection;
-
-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.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.entity.group.AbstractMembershipTrackingPolicy;
-import org.apache.brooklyn.entity.group.DynamicClusterImpl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class MongoDBRouterClusterImpl extends DynamicClusterImpl implements MongoDBRouterCluster {
-
-    @Override
-    public void init() {
-        super.init();
-        subscriptions().subscribeToChildren(this, MongoDBRouter.RUNNING, new SensorEventListener<Boolean>() {
-            @Override public void onEvent(SensorEvent<Boolean> event) {
-                setAnyRouter();
-            }
-        });
-    }
-    
-    @Override
-    public void start(Collection<? extends Location> locations) {
-        super.start(locations);
-        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
-                .displayName("Router cluster membership tracker")
-                .configure("group", this));
-    }
-    
-    public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy {
-        @Override protected void onEntityEvent(EventType type, Entity member) {
-            ((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
-        }
-        @Override protected void onEntityRemoved(Entity member) {
-            ((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
-        }
-        @Override protected void onEntityChange(Entity member) {
-            ((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
-        }
-    }
-    
-    protected void setAnyRouter() {
-        sensors().set(MongoDBRouterCluster.ANY_ROUTER, Iterables.tryFind(getRouters(), 
-                EntityPredicates.attributeEqualTo(Startable.SERVICE_UP, true)).orNull());
-
-        sensors().set(
-                MongoDBRouterCluster.ANY_RUNNING_ROUTER, 
-                Iterables.tryFind(getRouters(), EntityPredicates.attributeEqualTo(MongoDBRouter.RUNNING, true))
-                .orNull());
-    }
-    
-    @Override
-    public Collection<MongoDBRouter> getRouters() {
-        return ImmutableList.copyOf(Iterables.filter(getMembers(), MongoDBRouter.class));
-    }
-    
-    @Override
-    protected EntitySpec<?> getMemberSpec() {
-        if (super.getMemberSpec() != null)
-            return super.getMemberSpec();
-        return EntitySpec.create(MongoDBRouter.class);
-    }
-
-    @Override
-    public MongoDBRouter getAnyRouter() {
-        return getAttribute(MongoDBRouterCluster.ANY_ROUTER);
-    }
-    
-    @Override
-    public MongoDBRouter getAnyRunningRouter() {
-        return getAttribute(MongoDBRouterCluster.ANY_RUNNING_ROUTER);
-    }
- 
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterDriver.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterDriver.java
deleted file mode 100644
index 5ca17ac..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterDriver.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.entity.software.base.SoftwareProcessDriver;
-
-public interface MongoDBRouterDriver extends SoftwareProcessDriver {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterImpl.java
deleted file mode 100644
index 149457d..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterImpl.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.entity.nosql.mongodb.sharding;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.brooklyn.entity.nosql.mongodb.MongoDBClientSupport;
-import org.apache.brooklyn.entity.software.base.SoftwareProcessImpl;
-import org.apache.brooklyn.feed.function.FunctionFeed;
-import org.apache.brooklyn.feed.function.FunctionPollConfig;
-
-import com.google.common.base.Functions;
-
-public class MongoDBRouterImpl extends SoftwareProcessImpl implements MongoDBRouter {
-    
-    private volatile FunctionFeed functionFeed;
-
-    @Override
-    public Class<?> getDriverInterface() {
-        return MongoDBRouterDriver.class;
-    }
-
-    @Override
-    protected void connectSensors() {
-        super.connectSensors();
-        functionFeed = FunctionFeed.builder()
-                .entity(this)
-                .poll(new FunctionPollConfig<Boolean, Boolean>(RUNNING)
-                        .period(5, TimeUnit.SECONDS)
-                        .callable(new Callable<Boolean>() {
-                            @Override
-                            public Boolean call() throws Exception {
-                                MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this);
-                                return clientSupport.ping();
-                            }
-                        })
-                        .onException(Functions.<Boolean>constant(false)))
-                .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_UP)
-                        .period(5, TimeUnit.SECONDS)
-                        .callable(new Callable<Boolean>() {
-                            @Override
-                            public Boolean call() throws Exception {
-                                // TODO: This is the same as in AbstractMongoDBSshDriver.isRunning. 
-                                // This feels like the right place. But feels like can be more consistent with different 
-                                // MongoDB types using the FunctionFeed.
-                                MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this);
-                                return clientSupport.ping() && MongoDBRouterImpl.this.getAttribute(SHARD_COUNT) > 0;
-                            }
-                        })
-                        .onException(Functions.<Boolean>constant(false)))
-                .poll(new FunctionPollConfig<Integer, Integer>(SHARD_COUNT)
-                        .period(5, TimeUnit.SECONDS)
-                        .callable(new Callable<Integer>() {
-                            public Integer call() throws Exception {
-                                MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this);
-                                return (int) clientSupport.getShardCount();
-                            }    
-                        })
-                        .onException(Functions.<Integer>constant(-1)))
-                .build();
-    }
-
-    @Override
-    protected void disconnectSensors() {
-        super.disconnectSensors();
-        if (functionFeed != null) functionFeed.stop();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterSshDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterSshDriver.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterSshDriver.java
deleted file mode 100644
index 816906d..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterSshDriver.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.entity.nosql.mongodb.AbstractMongoDBSshDriver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-
-public class MongoDBRouterSshDriver extends AbstractMongoDBSshDriver implements MongoDBRouterDriver {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(MongoDBRouterSshDriver.class);
-
-    public MongoDBRouterSshDriver(MongoDBRouterImpl entity, SshMachineLocation machine) {
-        super(entity, machine);
-    }
-    
-    @Override
-    public void launch() {
-        String configdb = Joiner.on(",").join(getEntity().getConfig(MongoDBRouter.CONFIG_SERVERS));
-        ImmutableList.Builder<String> argsBuilder = getArgsBuilderWithDefaults(MongoDBRouterImpl.class.cast(getEntity()))
-                .add("--configdb", configdb);
-        
-        String args = Joiner.on(" ").join(argsBuilder.build());
-        String command = String.format("%s/bin/mongos %s > out.log 2> err.log < /dev/null", getExpandedInstallDir(), args);
-        LOG.info(command);
-        newScript(LAUNCHING)
-                .updateTaskAndFailOnNonZeroResultCode()
-                .body.append(command).execute();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardCluster.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardCluster.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardCluster.java
deleted file mode 100644
index 02903c3..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardCluster.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.entity.nosql.mongodb.sharding;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-
-@ImplementedBy(MongoDBShardClusterImpl.class)
-public interface MongoDBShardCluster extends DynamicCluster {
-
-}