Sonar Minor
[aai/esr-server.git] / esr-mgr / src / main / java / org / onap / aai / esr / externalservice / aai / AaiCommon.java
index c2088a1..25ed596 100644 (file)
  */
 package org.onap.aai.esr.externalservice.aai;
 
-import java.io.IOException;
-import java.io.StringReader;
-import com.sun.jersey.api.client.ClientResponse;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
 public class AaiCommon {
+       
+       private AaiCommon() {
+               
+       }
+       
+    private static String AaiAuthenticationUser = "AAI";
+    private static String AAI_AUTHENTICATION_PAASWORD = "AAI";
 
-  private static String AAI_AUTHENTICATION_USER = "AAI";
-  private static String AAI_AUTHENTICATION_PAASWORD = "AAI";
-  private static String RESOURCE_VERSION_PARAM = "resource-version";
-  
-//  public String getAuthenticationCredentials() {
-//    String usernameAndPassword = AAI_AUTHENTICATION_USER + ":"
-//        + AAI_AUTHENTICATION_PAASWORD;
-//    return "Basic " + java.util.Base64.getEncoder().encodeToString("AAI:AAI".getBytes());
-//  }
-  
-  public String getResourceVersion(ClientResponse response)
-      throws ParserConfigurationException, SAXException, IOException {
-    String respData = response.getEntity(String.class);
-
-    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-    DocumentBuilder builder = factory.newDocumentBuilder();
-    InputSource is = new InputSource(new StringReader(respData));
-    Document doc = builder.parse(is);
-
-    NodeList nodeList = doc.getDocumentElement().getChildNodes();
-    for (int i = 0; i < nodeList.getLength(); i++) {
-      Node currentNode = nodeList.item(i);
-      if (currentNode.getNodeName().equals(RESOURCE_VERSION_PARAM)) {
-        return currentNode.getTextContent();
-      }
+    public static String getAuthenticationCredentials() {
+        String usernameAndPassword = AaiAuthenticationUser + ":" + AAI_AUTHENTICATION_PAASWORD;
+        return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes());
     }
 
-    return null;
-  }
 }