X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fservice%2FMR_ClusterService.java;fp=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fservice%2FMR_ClusterService.java;h=e2c661bad8f9ae3fb5f83b970f57f6a7ff298def;hb=1611944a45491e2b8f00606b0aac2cdb0de8dde8;hp=ed572791bc08a0cec47b63de144fc42f9eb69d70;hpb=f595e173fdb3921cb6c6855f5389871ee3c3ada3;p=dmaap%2Fdbcapi.git diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java index ed57279..e2c661b 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java @@ -21,8 +21,10 @@ package org.onap.dmaap.dbcapi.service; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import javax.ws.rs.core.Response.Status; @@ -32,6 +34,7 @@ import org.onap.dmaap.dbcapi.model.ApiError; import org.onap.dmaap.dbcapi.model.DcaeLocation; import org.onap.dmaap.dbcapi.model.MR_Cluster; import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status; +import org.onap.dmaap.dbcapi.service.DcaeLocationService; import org.onap.dmaap.dbcapi.util.DmaapConfig; public class MR_ClusterService extends BaseLoggingClass { @@ -73,6 +76,10 @@ public class MR_ClusterService extends BaseLoggingClass { return null; } + public MR_Cluster getMr_ClusterByLoc( String loc ) { + return mr_clusters.get( loc ); + } + public List getCentralClusters() { DcaeLocationService locations = new DcaeLocationService(); List result = new ArrayList(); @@ -87,6 +94,20 @@ public class MR_ClusterService extends BaseLoggingClass { } return result; } + + // builds the set of unique cluster groups + public Set getGroups() { + Set result = new HashSet(); + for( MR_Cluster c: mr_clusters.values() ) { + try { + result.add(c.getReplicationGroup()); + } catch ( NullPointerException npe ) { + logger.warn( "Failed to add Group for cluster:" + c.getDcaeLocationName() ); + } + } + return result; + } + public MR_Cluster addMr_Cluster( MR_Cluster cluster, ApiError apiError ) { logger.info( "Entry: addMr_Cluster");