* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.dmaap.dbcapi.service;
import java.util.ArrayList;
-
-
-
-
-
-
-
-
-
-
import org.onap.dmaap.dbcapi.aaf.AafService;
import org.onap.dmaap.dbcapi.aaf.DmaapGrant;
import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
String topicFactory; // = "org.openecomp.dcae.dmaap.topicFactory";
String topicMgrRole; // = "org.openecomp.dmaapBC.TopicMgr";
- String dcaeTopicNs; // = "org.openecomp.dcae.dmaap";
+
private boolean multiSite;
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
topicFactory = p.getProperty("MR.TopicFactoryNS", "MR.topicFactoryNS.not.set");
topicMgrRole = p.getProperty("MR.TopicMgrRole", "MR.TopicMgrRole.not.set" );
- dcaeTopicNs = dmaapholder.get().getTopicNsRoot();
+
multiSite = "true".equalsIgnoreCase(p.getProperty("MR.multisite", "true"));
noEnvironmentPrefix = p.getProperty( "AAF.NoEnvironmentPrefix", "org.onap");
logger.info( "DmaapService settings: " +
" topicFactory=" + topicFactory +
" topicMgrRole=" + topicMgrRole +
- " dcaeTopicNs=" + dcaeTopicNs +
+
" multisite=" + multiSite +
" noEnvironmentPrefix=" + noEnvironmentPrefix
);
nd.setLastMod();
dmaapholder.update(nd);
-
+
AafService aaf = new AafService( ServiceType.AAF_Admin);
ApiPolicy apiPolicy = new ApiPolicy();
- if ( apiPolicy.getUseAuthClass() ) {
+ if ( apiPolicy.isPermissionClassSet() ) {
ApiPerms p = new ApiPerms();
p.setEnvMap();
}
if ( ! dmaap.isStatusValid() || ! nd.getDmaapName().equals(dmaap.getDmaapName()) || dmaap.getVersion().equals( "0") ) {
nd.setLastMod();
dmaapholder.update(nd); //need to set this so the following perms will pick up any new vals.
+ //dcaeTopicNs = dmaapholder.get().getTopicNsRoot();
ApiPolicy apiPolicy = new ApiPolicy();
- if ( apiPolicy.getUseAuthClass()) {
+ if ( apiPolicy.isPermissionClassSet()) {
ApiPerms p = new ApiPerms();
p.setEnvMap();
}
public String getTopicPerm( String val ) {
Dmaap dmaap = dmaapholder.get();
String nsRoot = dmaap.getTopicNsRoot();
+ if ( nsRoot == null ) { return null; }
+
String t;
// in ONAP Casablanca, we assume no distinction of environments reflected in topic namespace
if ( nsRoot.startsWith(noEnvironmentPrefix) ) {
private boolean setTopicMgtPerms( Dmaap nd, AafService aaf ){
String[] actions = { "create", "destroy" };
- String instance = ":" + dcaeTopicNs + "." + nd.getDmaapName() + ".mr.topic:" + dcaeTopicNs + "." + nd.getDmaapName();
+ String instance = ":" + nd.getTopicNsRoot() + "." + nd.getDmaapName() + ".mr.topic:" + nd.getTopicNsRoot() + "." + nd.getDmaapName();
for( String action : actions ) {
}
}
- String t = dcaeTopicNs +"." + nd.getDmaapName() + ".mr.topic";
+ String t = nd.getTopicNsRoot() +"." + nd.getDmaapName() + ".mr.topic";
String[] s = { "view", "pub", "sub" };
actions = s;
instance = "*";
clients.add( nClient );
// initialize Topic
- Topic mmaTopic = new Topic();
+ Topic mmaTopic = new Topic().init();
mmaTopic.setTopicName(dmaap.getBridgeAdminTopic());
mmaTopic.setClients(clients);
mmaTopic.setOwner("BusController");
mmaTopic.setTopicDescription("topic reserved for MirrorMaker Administration");
mmaTopic.setTnxEnabled("false");
+ mmaTopic.setPartitionCount("1"); // a single partition should guarantee message order
+
ApiError err = new ApiError();
TopicService svc = new TopicService();