Xacml PDP Register/Unregister Changes
[policy/xacml-pdp.git] / main / src / main / java / org / onap / policy / pdpx / main / startstop / XacmlPdpCommandLineArguments.java
index 1b0f62e..7a04d23 100644 (file)
@@ -48,6 +48,7 @@ public class XacmlPdpCommandLineArguments {
 
     // The command line options
     private String configurationFilePath = null;
+    private String propertyFilePath = null;
 
     /**
      * Construct the options for the CLI editor.
@@ -76,6 +77,15 @@ public class XacmlPdpCommandLineArguments {
                 .required(false)
                 .type(String.class)
                 .build());
+        options.addOption(Option.builder("p")
+                .longOpt("property-file")
+                .desc("the full path to the topic property file to use, "
+                        + "the property file contains the policy pap topic properties")
+                .hasArg()
+                .argName("PROP_FILE")
+                .required(false)
+                .type(String.class)
+                .build());
         //@formatter:on
     }
 
@@ -106,6 +116,7 @@ public class XacmlPdpCommandLineArguments {
     public String parse(final String[] args) throws PolicyXacmlPdpException {
         // Clear all our arguments
         setConfigurationFilePath(null);
+        setPropertyFilePath(null);
 
         CommandLine commandLine = null;
         try {
@@ -137,6 +148,10 @@ public class XacmlPdpCommandLineArguments {
             setConfigurationFilePath(commandLine.getOptionValue('c'));
         }
 
+        if (commandLine.hasOption('p')) {
+            setPropertyFilePath(commandLine.getOptionValue('p'));
+        }
+
         return null;
     }
 
@@ -212,6 +227,34 @@ public class XacmlPdpCommandLineArguments {
         return configurationFilePath != null && !configurationFilePath.isEmpty();
     }
 
+    /**
+     * Gets the property file path.
+     *
+     * @return the property file path
+     */
+    public String getPropertyFilePath() {
+        return propertyFilePath;
+    }
+
+    /**
+     * Gets the full expanded property file path.
+     *
+     * @return the property file path
+     */
+    public String getFullPropertyFilePath() {
+        return ResourceUtils.getFilePath4Resource(getPropertyFilePath());
+    }
+
+    /**
+     * Sets the property file path.
+     *
+     * @param propertyFilePath the property file path
+     */
+    public void setPropertyFilePath(final String propertyFilePath) {
+        this.propertyFilePath = propertyFilePath;
+
+    }
+
     /**
      * Validate readable file.
      *