Code Review
/
dmaap
/
dbcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
No topic dups in mmagent whitelist
[dmaap/dbcapi.git]
/
src
/
main
/
java
/
org
/
onap
/
dmaap
/
dbcapi
/
service
/
MR_ClusterService.java
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
529723e
..
ed57279
100644
(file)
--- a/
src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java
+++ b/
src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java
@@
-32,10
+32,19
@@
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.model.DcaeLocation;
import org.onap.dmaap.dbcapi.model.MR_Cluster;
import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
+import org.onap.dmaap.dbcapi.util.DmaapConfig;
public class MR_ClusterService extends BaseLoggingClass {
private Map<String, MR_Cluster> mr_clusters = DatabaseClass.getMr_clusters();
public class MR_ClusterService extends BaseLoggingClass {
private Map<String, MR_Cluster> mr_clusters = DatabaseClass.getMr_clusters();
+ private boolean multiSite;
+
+ public MR_ClusterService() {
+ logger.info( "new ClusterService");
+ DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
+ multiSite = "true".equalsIgnoreCase(p.getProperty("MR.multisite", "true"));
+
+ }
public Map<String, MR_Cluster> getMR_Clusters() {
return mr_clusters;
public Map<String, MR_Cluster> getMR_Clusters() {
return mr_clusters;
@@
-68,8
+77,12
@@
public class MR_ClusterService extends BaseLoggingClass {
DcaeLocationService locations = new DcaeLocationService();
List<MR_Cluster> result = new ArrayList<MR_Cluster>();
for( MR_Cluster c: mr_clusters.values() ) {
DcaeLocationService locations = new DcaeLocationService();
List<MR_Cluster> result = new ArrayList<MR_Cluster>();
for( MR_Cluster c: mr_clusters.values() ) {
- if ( locations.getDcaeLocation(c.getDcaeLocationName()).isCentral() ) {
- result.add(c);
+ try {
+ if ( locations.getDcaeLocation(c.getDcaeLocationName()).isCentral() ) {
+ result.add(c);
+ }
+ } catch ( NullPointerException npe ) {
+ logger.warn( "Failed test isCentral for location:" + c.getDcaeLocationName() );
}
}
return result;
}
}
return result;
@@
-89,7
+102,7
@@
public class MR_ClusterService extends BaseLoggingClass {
mr_clusters.put( cluster.getDcaeLocationName(), cluster );
DcaeLocationService svc = new DcaeLocationService();
DcaeLocation loc = svc.getDcaeLocation( cluster.getDcaeLocationName() );
mr_clusters.put( cluster.getDcaeLocationName(), cluster );
DcaeLocationService svc = new DcaeLocationService();
DcaeLocation loc = svc.getDcaeLocation( cluster.getDcaeLocationName() );
- if ( loc != null && loc.isCentral() ) {
+ if ( loc != null && loc.isCentral()
&& multiSite
) {
ApiError resp = TopicService.setBridgeClientPerms( cluster );
if ( ! resp.is2xx() ) {
logger.error( "Unable to provision Bridge to " + cluster.getDcaeLocationName() );
ApiError resp = TopicService.setBridgeClientPerms( cluster );
if ( ! resp.is2xx() ) {
logger.error( "Unable to provision Bridge to " + cluster.getDcaeLocationName() );
@@
-119,7
+132,7
@@
public class MR_ClusterService extends BaseLoggingClass {
cluster.setLastMod();
cluster.setStatus(DmaapObject_Status.INVALID);
mr_clusters.put( cluster.getDcaeLocationName(), cluster );
cluster.setLastMod();
cluster.setStatus(DmaapObject_Status.INVALID);
mr_clusters.put( cluster.getDcaeLocationName(), cluster );
- } else if ( loc.isCentral() ) {
+ } else if ( loc.isCentral()
& multiSite
) {
ApiError resp = TopicService.setBridgeClientPerms( cluster );
if ( ! resp.is2xx() ) {
logger.error( "Unable to provision Bridge to " + cluster.getDcaeLocationName() );
ApiError resp = TopicService.setBridgeClientPerms( cluster );
if ( ! resp.is2xx() ) {
logger.error( "Unable to provision Bridge to " + cluster.getDcaeLocationName() );