Github user sjcorbett commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/894#discussion_r39423845
--- Diff:
software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
---
@@ -19,32 +19,47 @@
package org.apache.brooklyn.entity.nosql.mongodb.sharding;
import java.util.Collection;
+import java.util.concurrent.ExecutionException;
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;
+import org.apache.brooklyn.util.exceptions.Exceptions;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
-public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl
implements CoLocatedMongoDBRouter {
+public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl
implements CoLocatedMongoDBRouter, MongoDBAuthenticationMixins {
+
+ private MongoDBRouter router;
+
@Override
public void init() {
super.init();
-
+ 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, (MongoDBRouter)
Iterables.tryFind(getChildren(),
Predicates.instanceOf(MongoDBRouter.class)).get());
--- End diff --
You already have a reference to `router`!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---