airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1415233 [1/4] - in /airavata/trunk/modules/rest: client/src/main/java/org/apache/airavata/rest/ client/src/main/java/org/apache/airavata/rest/client/ client/src/main/java/org/apache/airavata/rest/utils/ mappings/src/main/java/org/apache/ai...
Date Thu, 29 Nov 2012 16:12:32 GMT
Author: chathuri
Date: Thu Nov 29 16:12:29 2012
New Revision: 1415233

URL: http://svn.apache.org/viewvc?rev=1415233&view=rev
Log:
fixing AIRAVATA-665

Modified:
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/Test.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/BasicAuthHeaderUtil.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/ClientConstant.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/Test.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/Test.java?rev=1415233&r1=1415232&r2=1415233&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/Test.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/Test.java Thu Nov 29 16:12:29 2012
@@ -24,9 +24,12 @@ package org.apache.airavata.rest;
 
 import org.apache.airavata.rest.client.*;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 public class Test {
     public static void main(String[] args) {
-        configurationResourceClientTest();
+//        configurationResourceClientTest();
 //        hostDescriptorClientTest();
 //        serviceDescriptorClientTest();
 //          appDescriptorClientTest();
@@ -40,7 +43,12 @@ public class Test {
 
     public static void configurationResourceClientTest(){
         //configuration resource test
-//        ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient("admin", new PasswordCallbackImpl("admin", "admin"));
+        ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient("admin",
+                "http://localhost:9080/airavata-services/", new PasswordCallbackImpl("admin", "admin"));
+
+//        System.out.println("###############getConfiguration###############");
+//        Object configuration = configurationResourceClient.getConfiguration("gfac.url");
+//        System.out.println(configuration.toString());
 
 
 //        System.out.println("###############getConfiguration###############");
@@ -48,7 +56,11 @@ public class Test {
 //        System.out.println(configuration.toString());
 //
 //        System.out.println("###############getConfigurationList###############");
-//        configurationResourceClient.addWFInterpreterURI("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2");
+        try {
+            configurationResourceClient.addWFInterpreterURI(new URI("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2"));
+        } catch (URISyntaxException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
 //        List<Object> configurationList = configurationResourceClient.getConfigurationList("testKey1");
 //        for(Object object : configurationList){
 //            System.out.println(object.toString());
@@ -156,10 +168,12 @@ public class Test {
     }
 
     public static void serviceDescriptorClientTest (){
-//        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient();
+
+        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient("admin",
+                "http://localhost:9080/airavata-services/api", new PasswordCallbackImpl("admin", "admin"));
         //service descriptor exists
-//        boolean exists = descriptorResourceClient.isServiceDescriptorExists("echo");
-//        System.out.println(exists);
+        boolean exists = descriptorResourceClient.isServiceDescriptorExists("echo");
+        System.out.println(exists);
 
         //service descriptor save
 //        ServiceDescription serviceDescription = new ServiceDescription();

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java?rev=1415233&r1=1415232&r2=1415233&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java Thu Nov 29 16:12:29 2012
@@ -44,6 +44,11 @@ import javax.ws.rs.core.UriBuilder;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+/**
+ * This is the client class for all the basic registry operations. This class is being
+ * instantiated by <code>AiravataClient</code>. Users of Airavata can also call this
+ * client class if he wants to use REST service
+ */
 public class BasicRegistryResourceClient {
     private WebResource webResource;
     private final static Logger logger = LoggerFactory.getLogger(BasicRegistryResourceClient.class);
@@ -51,90 +56,124 @@ public class BasicRegistryResourceClient
     private PasswordCallback callback;
     private String baseURI;
 
-    public BasicRegistryResourceClient(String userName, String seriveURI, PasswordCallback callback) {
+    /**
+     * Creates a BasicRegistryResourceClient
+     * @param userName registry user
+     * @param seriveURI REST service URL
+     * @param callback implementation of the <code>PasswordCallback</code>
+     */
+    public BasicRegistryResourceClient(String userName,
+                                       String seriveURI,
+                                       PasswordCallback callback) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = seriveURI;
     }
 
+    /**
+     * Get base URL of the REST service
+     * @return REST url
+     */
     private URI getBaseURI() {
-        logger.info("Creating Base URI");
+        logger.debug("Creating Base URI");
         return UriBuilder.fromUri(baseURI).build();
     }
 
-    private WebResource getBasicRegistryBaseResource (){
+    /**
+     * Creating the web resource for base url
+     * @return web resource related to the base url
+     */
+    private WebResource getBasicRegistryBaseResource() {
         ClientConfig config = new DefaultClientConfig();
         config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
                 Boolean.TRUE);
         Client client = Client.create(config);
         WebResource baseWebResource = client.resource(getBaseURI());
-        webResource = baseWebResource.path(ResourcePathConstants.BasicRegistryConstants.REGISTRY_API_BASICREGISTRY);
+        webResource = baseWebResource.path(
+                ResourcePathConstants.BasicRegistryConstants.REGISTRY_API_BASICREGISTRY);
         return webResource;
     }
 
-    public Gateway getGateway (){
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.GET_GATEWAY);
-        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+    /**
+     * Get gateway related to the instance
+     * @return gateway
+     */
+    public Gateway getGateway() {
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.GET_GATEWAY);
+        ClientResponse response = webResource.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
             }
         }
-
-
-        Gateway gateway = response.getEntity(Gateway.class);
-        return gateway;
+        return response.getEntity(Gateway.class);
     }
 
-    public AiravataUser getUser (){
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.GET_USER);
-        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+    /**
+     * Get executing user for the instance
+     * @return airavata user
+     */
+    public AiravataUser getUser() {
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.GET_USER);
+        ClientResponse response = webResource.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
             }
         }
-
-        AiravataUser airavataUser = response.getEntity(AiravataUser.class);
-        return airavataUser;
+        return response.getEntity(AiravataUser.class);
     }
 
-    public void setGateway (Gateway gateway){
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.SET_GATEWAY);
-        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, gateway);
+    /**
+     * setting the gateway
+     * @param gateway gateway
+     */
+    public void setGateway(Gateway gateway) {
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.SET_GATEWAY);
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(
+                MediaType.APPLICATION_JSON).post(ClientResponse.class, gateway);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, gateway);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).type(
+                    MediaType.APPLICATION_JSON).post(ClientResponse.class, gateway);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
@@ -145,18 +184,26 @@ public class BasicRegistryResourceClient
         }
     }
 
-    public void setUser (AiravataUser user){
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.SET_USER);
-        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, user);
+    /**
+     * Setting the airavata user
+     * @param user airavata user
+     */
+    public void setUser(AiravataUser user) {
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.SET_USER);
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(
+                MediaType.APPLICATION_JSON).post(ClientResponse.class, user);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, user);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).type(
+                    MediaType.APPLICATION_JSON).post(ClientResponse.class, user);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
@@ -167,35 +214,47 @@ public class BasicRegistryResourceClient
         }
     }
 
+    /**
+     * Get service API version
+     * @return API version
+     */
     public Version getVersion() {
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.VERSION);
-        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.VERSION);
+        ClientResponse response = webResource.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
             }
         }
 
-        Version airavataVersion = response.getEntity(Version.class);
-        return airavataVersion;
+        return response.getEntity(Version.class);
     }
 
-    public URI getConnectionURI(){
+    /**
+     * Get registry REST service connection URL
+     * @return service URL
+     */
+    public URI getConnectionURI() {
         try {
-            webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.GET_SERVICE_URL);
-            ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+            webResource = getBasicRegistryBaseResource().path(
+                    ResourcePathConstants.BasicRegistryConstants.GET_SERVICE_URL);
+            ClientResponse response = webResource.accept(
+                    MediaType.TEXT_PLAIN).get(ClientResponse.class);
             int status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
@@ -203,8 +262,9 @@ public class BasicRegistryResourceClient
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
-                webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-                response = webResource.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+                WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                        webResource, null, userName, callback.getPassword(userName));
+                response = builder.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
                 status = response.getStatus();
 
                 if (status != ClientConstant.HTTP_OK) {
@@ -221,20 +281,27 @@ public class BasicRegistryResourceClient
         return null;
     }
 
-    public void setConnectionURI(URI connectionURI){
-        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.SET_SERVICE_URL);
+    /**
+     * set service connection URL
+     * @param connectionURI service connection URL
+     */
+    public void setConnectionURI(URI connectionURI) {
+        webResource = getBasicRegistryBaseResource().path(
+                ResourcePathConstants.BasicRegistryConstants.SET_SERVICE_URL);
         MultivaluedMap formData = new MultivaluedMapImpl();
         formData.add("connectionurl", connectionURI.toString());
-        ClientResponse response = webResource.type(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        ClientResponse response = webResource.type(
+                MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
         int status = response.getStatus();
 
         if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.type(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName));
+            response = builder.type(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java?rev=1415233&r1=1415232&r2=1415233&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java Thu Nov 29 16:12:29 2012
@@ -55,7 +55,7 @@ public class ConfigurationResourceClient
     private PasswordCallback callback;
     private String baseURI;
 
-    public ConfigurationResourceClient(String userName, String seriveURI,  PasswordCallback callback) {
+    public ConfigurationResourceClient(String userName, String seriveURI, PasswordCallback callback) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = seriveURI;
@@ -66,7 +66,7 @@ public class ConfigurationResourceClient
         return UriBuilder.fromUri(baseURI).build();
     }
 
-    private WebResource getConfigurationBaseResource (){
+    private WebResource getConfigurationBaseResource() {
         ClientConfig config = new DefaultClientConfig();
         config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
                 Boolean.TRUE);
@@ -88,12 +88,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).get(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.get(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -103,7 +103,7 @@ public class ConfigurationResourceClient
         return output;
     }
 
-    public List<Object> getConfigurationList (String configKey) {
+    public List<Object> getConfigurationList(String configKey) {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_CONFIGURATION_LIST);
         MultivaluedMap queryParams = new MultivaluedMapImpl();
         queryParams.add("key", configKey);
@@ -114,12 +114,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -128,14 +128,14 @@ public class ConfigurationResourceClient
         ConfigurationList configurationList = response.getEntity(ConfigurationList.class);
         List<Object> configurationValueList = new ArrayList<Object>();
         Object[] configValList = configurationList.getConfigValList();
-        for(Object configVal : configValList){
+        for (Object configVal : configValList) {
             configurationValueList.add(configVal);
         }
 
         return configurationValueList;
     }
 
-    public void setConfiguration (String configKey, String configVal, Date date){
+    public void setConfiguration(String configKey, String configVal, Date date) {
         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String formattedDate = dateFormat.format(date);
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.SAVE_CONFIGURATION);
@@ -151,12 +151,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -164,7 +164,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void addConfiguration(String configKey, String configVal, Date date){
+    public void addConfiguration(String configKey, String configVal, Date date) {
         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String formattedDate = dateFormat.format(date);
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.UPDATE_CONFIGURATION);
@@ -180,12 +180,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -193,7 +193,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void removeAllConfiguration(String key){
+    public void removeAllConfiguration(String key) {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_CONFIGURATION);
         MultivaluedMap queryParams = new MultivaluedMapImpl();
         queryParams.add("key", key);
@@ -204,12 +204,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -218,7 +218,7 @@ public class ConfigurationResourceClient
 
     }
 
-    public void removeConfiguration(String key, String value){
+    public void removeConfiguration(String key, String value) {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_CONFIGURATION);
         MultivaluedMap queryParams = new MultivaluedMapImpl();
         queryParams.add("key", key);
@@ -230,12 +230,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -243,9 +243,9 @@ public class ConfigurationResourceClient
         }
     }
 
-    public List<URI> getGFacURIs(){
+    public List<URI> getGFacURIs() {
         List<URI> uriList = new ArrayList<URI>();
-        try{
+        try {
             webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_GFAC_URI_LIST);
             ClientResponse response = webResource.get(ClientResponse.class);
             int status = response.getStatus();
@@ -254,9 +254,9 @@ public class ConfigurationResourceClient
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
-            } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-                webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-                response = webResource.get(ClientResponse.class);
+            } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+                WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+                response = builder.get(ClientResponse.class);
                 status = response.getStatus();
 
                 if (status != ClientConstant.HTTP_OK) {
@@ -268,7 +268,7 @@ public class ConfigurationResourceClient
 
             URLList urlList = response.getEntity(URLList.class);
             String[] uris = urlList.getUris();
-            for (String url: uris){
+            for (String url : uris) {
                 URI uri = new URI(url);
                 uriList.add(uri);
             }
@@ -279,9 +279,9 @@ public class ConfigurationResourceClient
         return uriList;
     }
 
-    public List<URI> getWorkflowInterpreterURIs(){
+    public List<URI> getWorkflowInterpreterURIs() {
         List<URI> uriList = new ArrayList<URI>();
-        try{
+        try {
             webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_WFINTERPRETER_URI_LIST);
             ClientResponse response = webResource.get(ClientResponse.class);
             int status = response.getStatus();
@@ -290,12 +290,12 @@ public class ConfigurationResourceClient
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
-            } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-                webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-                response = webResource.get(ClientResponse.class);
+            } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+                WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+                response = builder.get(ClientResponse.class);
                 status = response.getStatus();
 
-                if (status != ClientConstant.HTTP_OK ) {
+                if (status != ClientConstant.HTTP_OK) {
                     logger.error(response.getEntity(String.class));
                     throw new RuntimeException("Failed : HTTP error code : "
                             + status);
@@ -303,7 +303,7 @@ public class ConfigurationResourceClient
             }
             URLList urlList = response.getEntity(URLList.class);
             String[] uris = urlList.getUris();
-            for (String url: uris){
+            for (String url : uris) {
                 URI uri = new URI(url);
                 uriList.add(uri);
             }
@@ -314,8 +314,8 @@ public class ConfigurationResourceClient
     }
 
 
-    public URI getEventingURI(){
-        try{
+    public URI getEventingURI() {
+        try {
             webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_EVENTING_URI);
             ClientResponse response = webResource.get(ClientResponse.class);
             int status = response.getStatus();
@@ -324,12 +324,12 @@ public class ConfigurationResourceClient
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
-            } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-                webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-                response = webResource.get(ClientResponse.class);
+            } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+                WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+                response = builder.get(ClientResponse.class);
                 status = response.getStatus();
 
-                if (status != ClientConstant.HTTP_OK ) {
+                if (status != ClientConstant.HTTP_OK) {
                     logger.error(response.getEntity(String.class));
                     throw new RuntimeException("Failed : HTTP error code : "
                             + status);
@@ -344,8 +344,8 @@ public class ConfigurationResourceClient
         }
     }
 
-    public URI getMsgBoxURI(){
-        try{
+    public URI getMsgBoxURI() {
+        try {
             webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_MESSAGE_BOX_URI);
             ClientResponse response = webResource.get(ClientResponse.class);
             int status = response.getStatus();
@@ -354,9 +354,9 @@ public class ConfigurationResourceClient
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
-            } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-                webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-                response = webResource.get(ClientResponse.class);
+            } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+                WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+                response = builder.get(ClientResponse.class);
                 status = response.getStatus();
 
                 if (status != ClientConstant.HTTP_OK) {
@@ -386,9 +386,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -411,9 +411,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -436,9 +436,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -461,12 +461,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -489,9 +489,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -517,12 +517,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -545,9 +545,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -573,9 +573,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK) {
@@ -586,7 +586,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void removeGFacURI(URI uri){
+    public void removeGFacURI(URI uri) {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_GFAC_URI);
         MultivaluedMap queryParams = new MultivaluedMapImpl();
         queryParams.add("uri", uri.toString());
@@ -597,12 +597,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -610,7 +610,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void removeAllGFacURI(){
+    public void removeAllGFacURI() {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_GFAC_URIS);
         ClientResponse response = webResource.delete(ClientResponse.class);
         int status = response.getStatus();
@@ -619,12 +619,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -632,7 +632,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void removeWorkflowInterpreterURI(URI uri){
+    public void removeWorkflowInterpreterURI(URI uri) {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_WFINTERPRETER_URI);
         MultivaluedMap queryParams = new MultivaluedMapImpl();
         queryParams.add("uri", uri.toString());
@@ -643,9 +643,9 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, queryParams, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
             if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
@@ -656,7 +656,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void removeAllWorkflowInterpreterURI(){
+    public void removeAllWorkflowInterpreterURI() {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_WFINTERPRETER_URIS);
         ClientResponse response = webResource.delete(ClientResponse.class);
         int status = response.getStatus();
@@ -665,12 +665,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -678,7 +678,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void unsetEventingURI(){
+    public void unsetEventingURI() {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_EVENTING_URI);
         ClientResponse response = webResource.delete(ClientResponse.class);
         int status = response.getStatus();
@@ -687,12 +687,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);
@@ -700,7 +700,7 @@ public class ConfigurationResourceClient
         }
     }
 
-    public void unsetMessageBoxURI(){
+    public void unsetMessageBoxURI() {
         webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_MSG_BOX_URI);
         ClientResponse response = webResource.delete(ClientResponse.class);
         int status = response.getStatus();
@@ -709,12 +709,12 @@ public class ConfigurationResourceClient
             logger.error(response.getEntity(String.class));
             throw new RuntimeException("Failed : HTTP error code : "
                     + status);
-        } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
-            webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
-            response = webResource.delete(ClientResponse.class);
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            WebResource.Builder builder = BasicAuthHeaderUtil.getBuilder(webResource, null, userName, callback.getPassword(userName));
+            response = builder.delete(ClientResponse.class);
             status = response.getStatus();
 
-            if (status != ClientConstant.HTTP_OK ) {
+            if (status != ClientConstant.HTTP_OK) {
                 logger.error(response.getEntity(String.class));
                 throw new RuntimeException("Failed : HTTP error code : "
                         + status);



Mime
View raw message