Sonar cleanup and remove duplicate code
[policy/engine.git] / ONAP-XACML / src / main / java / org / onap / policy / xacml / std / pap / StdEngine.java
index 8e55300..1fb2518 100644 (file)
@@ -30,6 +30,7 @@ import com.att.research.xacml.util.XACMLProperties;
 import com.google.common.base.Joiner;
 import com.google.common.base.Splitter;
 import com.google.common.collect.Sets;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -48,6 +49,7 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.onap.policy.common.logging.eelf.MessageCodes;
@@ -64,9 +66,13 @@ import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
  *
  */
 public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyEngine {
-    public static final String pipPropertyFile = "pip.properties";
+    public static final String PIP_PROPERTY_FILE = "pip.properties";
 
-    private static final String addGroup = "addGroup ";
+    private static final String STR_ADDGROUP = "addGroup ";
+    private static final String STR_CLASS = "StdEngine";
+    private static final String STR_APPEND_NAME = ".name";
+    private static final String STR_APPEND_DESCRIPTION = ".description";
+    private static final String STR_APPEND_PDPS = ".pdps";
 
     private static Log logger = LogFactory.getLog(StdEngine.class);
 
@@ -81,6 +87,12 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
     protected final Path repository;
     protected Set<StdPDPGroup> groups;
 
+    /**
+     * StdEngine constructor.
+     *
+     * @throws PAPException PAPException
+     * @throws IOException IOException
+     */
     public StdEngine() throws PAPException, IOException {
         //
         // Get the location in the file system of our repository
@@ -92,6 +104,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         this.intialize();
     }
 
+    /**
+     * StdEngine constructor.
+     *
+     * @param properties Properties
+     * @throws PAPException PAPException
+     * @throws IOException IOException
+     */
     public StdEngine(Properties properties) throws PAPException, IOException {
         //
         // Get the location in the file system of our repository
@@ -103,6 +122,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         this.intialize();
     }
 
+    /**
+     * StdEngine constructor.
+     *
+     * @param repository Path
+     * @throws PAPException PAPException
+     * @throws IOException IOException
+     */
     public StdEngine(Path repository) throws PAPException, IOException {
         //
         // Save our location
@@ -121,13 +147,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         if (this.repository == null) {
             throw new PAPException("No repository specified.");
         }
-        if (Files.notExists(this.repository)) {
+        if (! this.repository.toFile().exists()) {
             Files.createDirectory(repository);
         }
-        if (!Files.isDirectory(this.repository)) {
+        if (! this.repository.toFile().isDirectory()) {
             throw new PAPException("Repository is NOT a directory: " + this.repository.toAbsolutePath());
         }
-        if (!Files.isWritable(this.repository)) {
+        if (! this.repository.toFile().canWrite()) {
             throw new PAPException("Repository is NOT writable: " + this.repository.toAbsolutePath());
         }
         //
@@ -155,7 +181,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             //
             this.groups = this.readProperties(this.repository, properties);
         } catch (IOException e) {
-            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to load properties file");
+            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS, "Failed to load properties file");
             this.groups = new HashSet<>();
         }
         //
@@ -188,7 +214,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             //
             // Does it exist?
             //
-            if (Files.notExists(defaultPath)) {
+            if (! defaultPath.toFile().exists()) {
                 //
                 // Create its directory
                 //
@@ -205,19 +231,19 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                     try (OutputStream os = Files.newOutputStream(policyPath)) {
                         props.store(os, "");
                     } catch (IOException e) {
-                        PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine",
+                        PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS,
                                 "Failed to write default policy properties");
                     }
                 }
                 {
                     Properties props = new Properties();
-                    props = setPIPProperties(props);
+                    props = setPipProperties(props);
                     Path pipPath = Paths.get(defaultPath.toAbsolutePath().toString(), "xacml.pip.properties");
                     Files.createFile(pipPath);
                     try (OutputStream os = Files.newOutputStream(pipPath)) {
                         props.store(os, "");
                     } catch (IOException e) {
-                        PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine",
+                        PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS,
                                 "Failed to write default pip properties");
                     }
                 }
@@ -225,7 +251,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             //
             // Create the default group
             //
-            StdPDPGroup newDefault = new StdPDPGroup(defaultId, true, "default",
+            StdPDPGroup newDefault = new StdPDPGroup(defaultId, true, PROP_PAP_GROUPS_DEFAULT_NAME,
                     "The default group where new PDP's are put.", defaultPath);
             //
             // Add it to our list
@@ -244,7 +270,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                     properties.store(os, "");
                 }
             } catch (IOException e) {
-                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine",
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, STR_CLASS,
                         "Failed to save properties with new default group information.");
             }
             //
@@ -253,7 +279,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             wasDefaultGroupJustAdded = true;
             return newDefault;
         } catch (IOException e) {
-            PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create default group");
+            PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, STR_CLASS, "Failed to create default group");
             throw new PAPException("Failed to create default group");
         }
     }
@@ -282,7 +308,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
     }
 
     @Override
-    public void newGroup(String name, String description) throws PAPException, NullPointerException {
+    public void newGroup(String name, String description) throws PAPException {
         //
         // Null check
         //
@@ -298,12 +324,10 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             }
         }
 
-
         // create an Id that can be used as a file name and a properties file key.
         // Ids must not contain \/:*?"<>|=,;
         // The ID must also be unique within the current set of PDPGroups.
-        String id = createNewPDPGroupId(name);
-
+        String id = createNewPdpGroupId(name);
 
         //
         // Construct the directory path
@@ -313,7 +337,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         // If it exists already
         //
         if (Files.exists(groupPath)) {
-            logger.warn(addGroup + id + " directory exists");
+            logger.warn(STR_ADDGROUP + id + " directory exists");
         } else {
             try {
                 //
@@ -321,7 +345,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                 //
                 Files.createDirectory(groupPath);
             } catch (IOException e) {
-                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + groupPath);
+                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS, "Failed to create " + groupPath);
                 throw new PAPException("Failed to create " + id);
             }
         }
@@ -330,8 +354,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
 
         Path policyProperties = Paths.get(groupPath.toString(), "xacml.policy.properties");
-        if (Files.exists(policyProperties)) {
-            logger.warn(addGroup + id + " file exists");
+        if (policyProperties.toFile().exists()) {
+            logger.warn(STR_ADDGROUP + id + " file exists");
         } else {
             Properties props = new Properties();
             props.setProperty(XACMLProperties.PROP_REFERENCEDPOLICIES, "");
@@ -342,7 +366,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                     props.store(os, "");
                 }
             } catch (IOException e) {
-                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create policyProperties");
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, STR_CLASS, "Failed to create policyProperties");
                 throw new PAPException("Failed to create " + id);
             }
         }
@@ -351,17 +375,17 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
         Path pipProperties = Paths.get(groupPath.toString(), "xacml.pip.properties");
         Properties props = new Properties();
-        if (Files.exists(pipProperties)) {
-            logger.warn(addGroup + id + " file exists.");
+        if (pipProperties.toFile().exists()) {
+            logger.warn(STR_ADDGROUP + id + " file exists.");
         } else {
             try {
-                props = setPIPProperties(props);
+                props = setPipProperties(props);
                 Files.createFile(pipProperties);
                 try (OutputStream os = Files.newOutputStream(pipProperties)) {
                     props.store(os, "");
                 }
             } catch (IOException e) {
-                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create pipProperties");
+                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS, "Failed to create pipProperties");
                 throw new PAPException("Failed to create " + id);
             }
 
@@ -389,17 +413,15 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
 
     }
 
-
-
     /**
      * Helper to create a new Group ID. Use the Name field to create the Id. The Name is expected to not be null; if it
      * is then this method throws an exception. The name is supposed to be unique within the current set of groups, so
      * creating the ID based on the name will create a unique string.
      *
-     * @param name
-     * @return
+     * @param name String
+     * @return String
      */
-    private String createNewPDPGroupId(String name) {
+    private String createNewPdpGroupId(String name) {
         String id = name;
         // replace "bad" characters with sequences that will be ok for file names and properties keys.
         id = id.replace(" ", "_sp_");
@@ -420,7 +442,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         return id;
     }
 
-
     @Override
     public OnapPDP getPDP(String pdpId) throws PAPException {
         for (OnapPDPGroup group : this.groups) {
@@ -433,7 +454,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         return null;
     }
 
-
     @Override
     public void movePDP(OnapPDP pdp, OnapPDPGroup newGroup) throws PAPException {
         if (newGroup == null) {
@@ -471,21 +491,20 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         }
     }
 
-
     @Override
     public void updatePDP(OnapPDP pdp) throws PAPException {
-        PDP currentPDP = this.getPDP(pdp.getId());
-        if (currentPDP == null) {
+        PDP currentPdp = this.getPDP(pdp.getId());
+        if (currentPdp == null) {
             String message = "Unknown PDP id '" + pdp.getId() + "'";
             logger.warn(message);
             throw new PAPException(message);
         }
 
         // the only things that the user can change are name and description
-        currentPDP.setDescription(pdp.getDescription());
-        currentPDP.setName(pdp.getName());
-        if (currentPDP instanceof OnapPDP) {
-            ((OnapPDP) currentPDP).setJmxPort(pdp.getJmxPort());
+        currentPdp.setDescription(pdp.getDescription());
+        currentPdp.setName(pdp.getName());
+        if (currentPdp instanceof OnapPDP) {
+            ((OnapPDP) currentPdp).setJmxPort(pdp.getJmxPort());
         }
         this.doSave();
     }
@@ -508,7 +527,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         throw new PAPException(message);
     }
 
-
     @Override
     /**
      * Should never be called - Detailed status is held on the PDP, not the PAP
@@ -531,7 +549,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         throw new PAPException("Unknown PDP Group: " + group.getId());
     }
 
-
     @Override
     public void copyPolicy(PDPPolicy policy, OnapPDPGroup group) throws PAPException {
         //
@@ -539,7 +556,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
     }
 
-
     @Override
     public void removePolicy(PDPPolicy policy, OnapPDPGroup group) throws PAPException {
         if (group == null) {
@@ -553,7 +569,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         throw new PAPException("Unknown PDP Group: " + group.getId());
     }
 
-
     //
     // HELPER methods
     //
@@ -578,14 +593,14 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             //
             // Add our Group Object
             //
-            StdPDPGroup g = new StdPDPGroup(id.trim(),
+            StdPDPGroup newGroup = new StdPDPGroup(id.trim(),
                     id.equals(properties.getProperty(PROP_PAP_GROUPS_DEFAULT, PROP_PAP_GROUPS_DEFAULT_NAME)),
                     properties, Paths.get(repository.toString(), id));
 
             //
             // Add it in
             //
-            pdpGroups.add(g);
+            pdpGroups.add(newGroup);
         }
         //
         // Dump what we got
@@ -617,8 +632,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         List<String> ids = new ArrayList<>();
         for (PDPGroup group : this.groups) {
             ids.add(group.getId());
-            properties.setProperty(group.getId() + ".name", group.getName() == null ? "" : group.getName());
-            properties.setProperty(group.getId() + ".description",
+            properties.setProperty(group.getId() + STR_APPEND_NAME, group.getName() == null ? "" : group.getName());
+            properties.setProperty(group.getId() + STR_APPEND_DESCRIPTION,
                     group.getDescription() == null ? "" : group.getDescription());
             //
             // Iterate its PDPs
@@ -626,8 +641,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             List<String> pdps = new ArrayList<>();
             for (PDP pdp : group.getPdps()) {
                 pdps.add(pdp.getId());
-                properties.setProperty(pdp.getId() + ".name", pdp.getName() == null ? "" : pdp.getName());
-                properties.setProperty(pdp.getId() + ".description",
+                properties.setProperty(pdp.getId() + STR_APPEND_NAME, pdp.getName() == null ? "" : pdp.getName());
+                properties.setProperty(pdp.getId() + STR_APPEND_DESCRIPTION,
                         pdp.getDescription() == null ? "" : pdp.getDescription());
                 if (pdp instanceof OnapPDP) {
                     properties.setProperty(pdp.getId() + ".jmxport",
@@ -643,7 +658,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             if (logger.isDebugEnabled()) {
                 logger.debug("Group " + group.getId() + " PDPS: " + pdpList);
             }
-            properties.setProperty(group.getId() + ".pdps", pdpList);
+            properties.setProperty(group.getId() + STR_APPEND_PDPS, pdpList);
         }
         if (ids.isEmpty()) {
             throw new PAPException("Inconsistency - we have NO groups. We should have at least one.");
@@ -674,14 +689,12 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         }
     }
 
-    public static void removeGroupProperties(String id, Properties properties) {
-        for (Object key : properties.keySet()) {
-            if (key.toString().startsWith(id + ".")) {
-                properties.remove(key);
-            }
-        }
-    }
-
+    /**
+     * setGroupProperties.
+     *
+     * @param group PDPGroup
+     * @param properties Properties
+     */
     public static void setGroupProperties(PDPGroup group, Properties properties) {
         //
         // make sure its in the list of groups
@@ -711,8 +724,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
         // Set its properties
         //
-        properties.setProperty(group.getId() + ".name", group.getName());
-        properties.setProperty(group.getId() + ".description", group.getDescription());
+        properties.setProperty(group.getId() + STR_APPEND_NAME, group.getName());
+        properties.setProperty(group.getId() + STR_APPEND_DESCRIPTION, group.getDescription());
         //
         // Set its PDP list
         //
@@ -727,13 +740,15 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                 }
                 pdpList = Joiner.on(',').skipNulls().join(ids);
             }
-            properties.setProperty(group.getId() + ".pdps", pdpList);
+            properties.setProperty(group.getId() + STR_APPEND_PDPS, pdpList);
         } else {
-            properties.setProperty(group.getId() + ".pdps", "");
+            properties.setProperty(group.getId() + STR_APPEND_PDPS, "");
         }
     }
 
-
+    /**
+     * changed.
+     */
     public void changed() {
         if (logger.isDebugEnabled()) {
             logger.debug("changed");
@@ -742,6 +757,11 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         this.fireChanged();
     }
 
+    /**
+     * groupChanged.
+     *
+     * @param group OnapPDPGroup
+     */
     public void groupChanged(OnapPDPGroup group) {
         if (logger.isDebugEnabled()) {
             logger.debug("groupChanged: " + group);
@@ -750,7 +770,11 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         this.firePDPGroupChanged(group);
     }
 
-
+    /**
+     * pdpChanged.
+     *
+     * @param pdp OnapPDP
+     */
     public void pdpChanged(OnapPDP pdp) {
         if (logger.isDebugEnabled()) {
             logger.debug("pdpChanged: " + pdp);
@@ -766,18 +790,18 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             //
             this.saveConfiguration();
         } catch (IOException | PAPException e) {
-            PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
+            PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, STR_CLASS, "Failed to save configuration");
         }
     }
 
-    private Properties setPIPProperties(Properties props) {
+    private Properties setPipProperties(Properties props) {
         props.setProperty(XACMLProperties.PROP_PIP_ENGINES, "AAF");
         props.setProperty("AAF.name", "AAFEngine");
         props.setProperty("AAF.description", "AAFEngine to communicate with AAF to take decisions");
         props.setProperty("AAF.classname", "org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine");
         // read from PIP properties file.
-        Path file = Paths.get(pipPropertyFile);
-        if (!Files.notExists(file)) {
+        Path file = Paths.get(PIP_PROPERTY_FILE);
+        if (file.toFile().exists()) {
             InputStream in;
             Properties prop = new Properties();
             try {
@@ -792,7 +816,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         return props;
     }
 
-
     @Override
     public Set<OnapPDPGroup> getOnapPDPGroups() throws PAPException {
         final Set<OnapPDPGroup> grps = new HashSet<>();
@@ -815,26 +838,26 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
     @Override
     public void setDefaultGroup(OnapPDPGroup group) throws PAPException {
         boolean changesMade = false;
-        for (OnapPDPGroup aGroup : groups) {
-            if (aGroup.getId().equals(group.getId())) {
-                if (!aGroup.isDefaultGroup()) {
-                    if (aGroup instanceof StdPDPGroup) {
-                        ((StdPDPGroup) aGroup).setDefault(true);
+        for (OnapPDPGroup theGroup : groups) {
+            if (theGroup.getId().equals(group.getId())) {
+                if (!theGroup.isDefaultGroup()) {
+                    if (theGroup instanceof StdPDPGroup) {
+                        ((StdPDPGroup) theGroup).setDefault(true);
                         changesMade = true;
                     } else {
                         throw new IllegalArgumentException(
-                                "Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
+                                "Group in groups of unknown type '" + theGroup.getClass().getName() + "'");
                     }
                 }
             } else {
                 // not the new default group
-                if (aGroup.isDefaultGroup()) {
-                    if (aGroup instanceof StdPDPGroup) {
-                        ((StdPDPGroup) aGroup).setDefault(false);
+                if (theGroup.isDefaultGroup()) {
+                    if (theGroup instanceof StdPDPGroup) {
+                        ((StdPDPGroup) theGroup).setDefault(false);
                         changesMade = true;
                     } else {
                         throw new IllegalArgumentException(
-                                "Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
+                                "Group in groups of unknown type '" + theGroup.getClass().getName() + "'");
                     }
                 }
             }
@@ -842,14 +865,11 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         if (changesMade) {
             this.doSave();
         }
-
-        return;
-
     }
 
     @Override
     public void newPDP(String id, OnapPDPGroup group, String name, String description, int jmxport)
-            throws PAPException, NullPointerException {
+            throws PAPException {
         if (group == null) {
             throw new PAPException("You must specify which group the PDP will belong to.");
         }
@@ -868,10 +888,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                 // Save the properties and notify any listeners
                 //
                 pdpChanged(pdp);
-                return;
             }
         }
-        return;
+    }
+
+    @Override
+    public void updateGroup(OnapPDPGroup group, String userName) throws PAPException {
+        // To pass the userId for PDP Audit log maintenance.
 
     }
 
@@ -888,7 +911,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
             throw new PAPException("Update found no existing group with id '" + group.getId() + "'");
         }
 
-
         // We do dramatically different things when the Name changes
         // because the Name is essentially the identity of the group (as the User knows it) so when the Identity changes
         // we have to change the group ID.
@@ -908,7 +930,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         } else {
             // the name/identity of the group has changed
             // generate the new id
-            String newId = createNewPDPGroupId(group.getName());
+            String newId = createNewPdpGroupId(group.getName());
 
             // make sure no other group uses the new id
             for (OnapPDPGroup g : groups) {
@@ -929,7 +951,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                     throw new PAPException("Unable to rename directory; reason unknown");
                 }
             } catch (Exception e) {
-                PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Unable to rename directory");
+                PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, STR_CLASS, "Unable to rename directory");
                 throw new PAPException(
                         "Unable to move directory from '" + oldPath + "' to '" + newPath + "': " + e.getMessage(), e);
             }
@@ -950,11 +972,10 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         // perhaps only the group changed, but if the name/id changed it may look to a listener like more than one group
         changed();
 
-
     }
 
     @Override
-    public void removeGroup(OnapPDPGroup group, OnapPDPGroup newGroup) throws PAPException, NullPointerException {
+    public void removeGroup(OnapPDPGroup group, OnapPDPGroup newGroup) throws PAPException {
         if (group == null) {
             throw new NullPointerException();
         }
@@ -1005,7 +1026,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
         // If it exists already
         //
-        if (!Files.exists(groupPath)) {
+        if (! groupPath.toFile().exists()) {
             logger.warn("removeGroup " + id + " directory does not exist" + groupPath.toString());
         } else {
             try {
@@ -1023,7 +1044,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
                 //
                 Files.delete(groupPath);
             } catch (IOException e) {
-                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to delete " + groupPath);
+                PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, STR_CLASS, "Failed to delete " + groupPath);
                 throw new PAPException("Failed to delete " + id);
             }
         }
@@ -1036,14 +1057,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
         //
         changed();
         this.doSave();
-        return;
-
-    }
-
-    @Override
-    public void updateGroup(OnapPDPGroup group, String userName) throws PAPException {
-        // To pass the userId for PDP Audit log maintenance.
-
     }
 
 }