if (!communities.isEmpty()) restartLocatorProps.setProperty("community", (String)communities.iterator().next());
if (!communities.isEmpty()) { communityToMonitor = (String)communities.iterator().next();   getPropertiesFromCommunityAttributes(); } else { log.error("Agent \"" + myAgent.toString() + "\" not identified as a \"CommunityManager\" in any active community!."); log.error("Check that the community to monitor has this agent identified\n"); log.error("in its \"CommunityManager\" attribute and that this agent is\n"); log.error("also identified as an Entity within the monitored community with\n"); log.error("the attribute \"Role=ManagementAgent\"."); }
  protected void setupSubscriptions() {    log =  (LoggingService) getBindingSite().getServiceBroker().      getService(this, LoggingService.class, null);    bbs = getBlackboardService();    DomainService domainService =      (DomainService) getBindingSite().getServiceBroker().      getService(this, DomainService.class, null);    sensorFactory =      ((SensorFactory) domainService.getFactory("sensors"));    if (sensorFactory == null) {      log.error("Unable to get 'sensors' domain");    }    myAgent = getClusterIdentifier();    communityService = getCommunityService();    topologyService = getTopologyReaderService();    // Find name of community to monitor    Collection communities = communityService.search("(CommunityManager=" +      myAgent.toString() + ")");    if (!communities.isEmpty())      restartLocatorProps.setProperty("community",                                      (String)communities.iterator().next());    // Initialize configurable paramaeters from defaults and plugin arguments.    updateParams(restartLocatorProps);    bbs.publishAdd(restartLocatorProps);    // Subscribe to ManagementAgentProperties to receive parameter changes    mgmtAgentProps =      (IncrementalSubscription)bbs.subscribe(propertiesPredicate);    // Subscribe to RestartLocationRequest objects    restartRequests =      (IncrementalSubscription)bbs.subscribe(restartRequestPredicate);    // Subscribe to PingRequests to receive ping results    pingRequests =      (IncrementalSubscription)bbs.subscribe(pingRequestPredicate);    // Print informational message defining current parameters    log.info(paramsToString());  }