Fix xacml-pdp due to sonar changes in common
[policy/xacml-pdp.git] / main / src / main / java / org / onap / policy / pdpx / main / rest / XacmlPdpRestServer.java
index eee9717..a6213da 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.policy.pdpx.main.rest;
 
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
-
 import org.onap.policy.common.capabilities.Startable;
 import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
 import org.onap.policy.common.gson.GsonMessageBodyHandler;
-import org.onap.policy.pdpx.main.parameters.RestServerParameters;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,17 +44,15 @@ public class XacmlPdpRestServer implements Startable {
 
     private List<HttpServletServer> servers = new ArrayList<>();
 
-    private RestServerParameters restServerParameters;
-    private String applicationPath;
+    private final RestServerParameters restServerParameters;
 
     /**
      * Constructor for instantiating XacmlPdpRestServer.
      *
      * @param restServerParameters the rest server parameters
      */
-    public XacmlPdpRestServer(final RestServerParameters restServerParameters, final String applicationPath) {
+    public XacmlPdpRestServer(final RestServerParameters restServerParameters) {
         this.restServerParameters = restServerParameters;
-        this.applicationPath = applicationPath;
     }
 
     /**
@@ -64,26 +62,17 @@ public class XacmlPdpRestServer implements Startable {
     public boolean start() {
         try {
             LOGGER.info("Starting XacmlPdpRestServer...");
-            //
-            // Initialize the applications - SEND PROPERTIES
-            //
-            XacmlPdpApplicationManager.initializeApplications(Paths.get(applicationPath));
-
-            //
-            // Update statistics manager on the policy types
-            //
-            XacmlPdpStatisticsManager.setTotalPolicyTypesCount(XacmlPdpApplicationManager.getPolicyTypeCount());
 
             //
             // Get the server properties
             //
-            servers = HttpServletServer.factory.build(getServerProperties());
+            servers = HttpServletServerFactoryInstance.getServerFactory().build(getServerProperties());
             //
             // Start all the servers
             //
             for (final HttpServletServer server : servers) {
                 if (server.isAaf()) {
-                    server.addFilterClass(null, XacmlPdpAafFilter.class.getCanonicalName());
+                    server.addFilterClass(null, XacmlPdpAafFilter.class.getName());
                 }
                 server.start();
             }
@@ -108,7 +97,7 @@ public class XacmlPdpRestServer implements Startable {
         props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".port",
                 Integer.toString(restServerParameters.getPort()));
         props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".restClasses",
-                XacmlPdpRestController.class.getCanonicalName());
+                XacmlPdpRestController.class.getName());
         props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".managed", "false");
         props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".swagger", "true");
         props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".userName",