\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
+import static java.lang.System.exit;\r
+\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
import java.io.File;\r
}\r
}\r
\r
- public static final String ENV_VAR = "PROVSRVR";\r
- public static final String PROMPT = "dr-route> ";\r
- public static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";\r
+ private static final String ENV_VAR = "PROVSRVR";\r
+ private static final String PROMPT = "dr-route> ";\r
+ private static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";\r
private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
\r
private final String server;\r
*/\r
public DRRouteCLI(String server) throws Exception {\r
this.server = server;\r
- this.width = 120;\r
this.httpclient = new DefaultHttpClient();\r
\r
- Properties prop = (new DB()).getProperties();\r
- String truststoreFile = prop.getProperty("org.onap.dmaap.datarouter.provserver.truststore.path");\r
- String truststorePw = prop.getProperty("org.onap.dmaap.datarouter.provserver.truststore.password");\r
+ Properties provProperties = (new DB()).getProperties();\r
+ try {\r
+ AafPropsUtils.init(new File(provProperties.getProperty(\r
+ "org.onap.dmaap.datarouter.provserver.aafprops.path",\r
+ "/opt/app/osaaf/local/org.onap.dmaap-dr.props")));\r
+ } catch (IOException e) {\r
+ intlogger.error("NODE0314 Failed to load AAF props. Exiting", e);\r
+ exit(1);\r
+ }\r
+\r
+ String truststoreFile = AafPropsUtils.getInstance().getTruststorePathProperty();\r
+ String truststorePw = AafPropsUtils.getInstance().getTruststorePassProperty();\r
\r
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());\r
if (truststoreFile == null || truststoreFile.equals("")) {\r
} finally {\r
try {\r
instream.close();\r
- } catch (Exception ignore) {\r
- intlogger.error("Ignore error closing input stream: " + ignore.getMessage(), ignore);\r
+ } catch (Exception e) {\r
+ intlogger.error("Ignore error closing input stream: " + e.getMessage(), e);\r
}\r
}\r
}\r
* @param args The command line arguments.\r
* @return true if the command was valid and succeeded\r
*/\r
- public boolean runCommand(String[] args) {\r
+ boolean runCommand(String[] args) {\r
String cmd = args[0].trim().toLowerCase();\r
if (cmd.equals("add")) {\r
if (args.length > 2) {\r
return rv;\r
}\r
\r
- private void printErrorText(HttpEntity entity) throws IllegalStateException, IOException {\r
+ private void printErrorText(HttpEntity entity) throws IOException {\r
// Look for and print only the part of the output between <pre>...</pre>\r
InputStream is = entity.getContent();\r
StringBuilder sb = new StringBuilder();\r
byte[] bite = new byte[512];\r
- int num = 0;\r
+ int num;\r
while ((num = is.read(bite)) > 0) {\r
sb.append(new String(bite, 0, num));\r
}\r