AT&T 1712 and 1802 release code
[so.git] / common / src / main / java / org / openecomp / mso / client / dmaap / DmaapClient.java
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.mso.client.dmaap;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Base64;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Properties;
 
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.openecomp.mso.client.defaultproperties.DefaultDmaapPropertiesImpl;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 
@@ -38,10 +38,11 @@ public abstract class DmaapClient {
        protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
        protected final Map<String, String> msoProperties;
        protected final Properties properties;
-       public DmaapClient(String filepath) throws FileNotFoundException, IOException {
+       public DmaapClient(String filepath) throws IOException {
                Resource resource = new ClassPathResource(filepath);
-               DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getImpl();
+               DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
                if (dmaapProperties == null) {
+                       auditLogger.error("No RestProperty implementation found on classpath, loading default");
                        dmaapProperties = new DefaultDmaapPropertiesImpl();
                }
                this.msoProperties = dmaapProperties.getProperties();
@@ -50,6 +51,9 @@ public abstract class DmaapClient {
                this.properties.put("password", this.deobfuscatePassword(this.getPassword()));
                this.properties.put("username", this.getUserName());
                this.properties.put("topic", this.getTopic());
+               if (this.getHost().isPresent()) {
+                       this.properties.put("host", this.getHost().get());
+               }
        }
        protected String deobfuscatePassword(String password) {
                
@@ -65,4 +69,5 @@ public abstract class DmaapClient {
        public abstract String getUserName();
        public abstract String getPassword();
        public abstract String getTopic();
+       public abstract Optional<String> getHost();
 }