update some dependenceies

Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/78ce45e2
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/78ce45e2
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/78ce45e2

Branch: refs/heads/master
Commit: 78ce45e2efad87835af9d29972e88cc32561c5d7
Parents: 29fc616
Author: Tom Barber <t...@analytical-labs.com>
Authored: Tue Dec 6 11:34:33 2016 +0000
Committer: Tom Barber <t...@analytical-labs.com>
Committed: Tue Dec 6 11:34:33 2016 +0000

----------------------------------------------------------------------
 catalog/pom.xml                                 |   4 +-
 core/pom.xml                                    |  22 +-
 crawler/pom.xml                                 |   4 +-
 filemgr/pom.xml                                 |   4 +-
 .../cas/filemgr/catalog/solr/SolrClient.java    | 318 ++++++++-------
 .../filemgr/system/CommonsXmlRpcTransport.java  | 183 +++++++++
 .../filemgr/system/XmlRpcFileManagerClient.java | 398 ++++++++++---------
 .../oodt/cas/filemgr/tools/SolrIndexer.java     | 236 ++++++-----
 profile/pom.xml                                 |   5 +-
 protocol/http/pom.xml                           |   4 +-
 resource/pom.xml                                |   4 +-
 sso/pom.xml                                     |   5 +-
 .../oodt/security/sso/opensso/SSOProxy.java     | 214 ++++++----
 workflow/pom.xml                                |   4 +-
 14 files changed, 842 insertions(+), 563 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/catalog/pom.xml
----------------------------------------------------------------------
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 77ffa77..07805a3 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -61,8 +61,8 @@
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 3420597..f1dea9e 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -111,9 +111,15 @@ the License.
         <version>1.4</version>
       </dependency>
       <dependency>
-        <groupId>commons-httpclient</groupId>
-        <artifactId>commons-httpclient</artifactId>
-        <version>3.1</version>
+       <groupId>org.apache.httpcomponents</groupId>
+       <artifactId>httpclient</artifactId>
+       <exclusions>
+         <exclusion>
+           <artifactId>commons-logging</artifactId>
+         <groupId>commons-logging</groupId>
+       </exclusion>
+      </exclusions>
+        <version>4.5.2</version>
       </dependency>
       <dependency>
         <groupId>commons-io</groupId>
@@ -267,11 +273,6 @@ the License.
         <version>1.1</version>
       </dependency>
       <dependency>
-        <groupId>org.apache.httpcomponents</groupId>
-        <artifactId>httpclient</artifactId>
-        <version>4.5.2</version>
-      </dependency>
-      <dependency>
         <groupId>org.apache.jena</groupId>
         <artifactId>apache-jena-libs</artifactId>
         <version>${jena.version}</version>
@@ -489,11 +490,6 @@ the License.
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-log4j</artifactId>
-        <version>1.7.12</version>
-      </dependency>
-      <dependency>
-        <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
         <version>1.7.12</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/crawler/pom.xml
----------------------------------------------------------------------
diff --git a/crawler/pom.xml b/crawler/pom.xml
index 5428b53..46378c8 100644
--- a/crawler/pom.xml
+++ b/crawler/pom.xml
@@ -56,8 +56,8 @@ the License.
       <artifactId>commons-collections</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
+         <groupId>org.apache.httpcomponents</groupId>
+         <artifactId>httpclient</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/filemgr/pom.xml
----------------------------------------------------------------------
diff --git a/filemgr/pom.xml b/filemgr/pom.xml
index cc9a6e5..745778f 100644
--- a/filemgr/pom.xml
+++ b/filemgr/pom.xml
@@ -91,8 +91,8 @@
       <artifactId>commons-dbcp</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
index 1b17b62..475ff8b 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
@@ -16,20 +16,35 @@
  */
 package org.apache.oodt.cas.filemgr.catalog.solr;
 
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.solr.client.solrj.util.ClientUtils;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,30 +54,30 @@ import java.util.logging.Logger;
 /**
  * Class containing client-side functionality for interacting with a Solr 
server.
  * This class uses an {@link HttpClient} for all HTTP communication.
- * 
+ *
  * @author Luca Cinquini
  *
  */
 public class SolrClient {
-               
+
        // base URL of Solr server
        private String solrUrl;
-       
+
        private final Logger LOG = Logger.getLogger(this.getClass().getName());
-       
+
        /**
         * Constructor initializes the Solr URL
         * @param url
         */
        public SolrClient(final String url) {
-               
+
                solrUrl = url;
-               
+
        }
-       
+
        /**
         * Method to send one or more documents to be indexed to Solr.
-        * 
+        *
         * @param docs
         * @param commit
         * @param mimeType : the mime-type format of the documents
@@ -70,38 +85,38 @@ public class SolrClient {
         * @throws CatalogException
         */
        public String index(List<String> docs, boolean commit, String mimeType) 
throws CatalogException {
-               
+
                try {
-                       
+
                        final String url = this.buildUpdateUrl();
-                       
+
                        // build message
                        StringBuilder message = new StringBuilder("<add>");
                        for (String doc : docs) {
                                message.append(doc);
                        }
-                       message.append("</add>");       
-           
-           // send POST request
-           LOG.info("Posting message:"+message+" to URL:"+url);
-           String response = doPost(url, message.toString(), mimeType);
-           LOG.info(response);
-           
-           // commit changes ?
-           if (commit) {
-                 this.commit();
-               }
-           
-           LOG.info(response);
-           return response;
-    
+                       message.append("</add>");
+
+                       // send POST request
+                       LOG.info("Posting message:"+message+" to URL:"+url);
+                       String response = doPost(url, message.toString(), 
mimeType);
+                       LOG.info(response);
+
+                       // commit changes ?
+                       if (commit) {
+                               this.commit();
+                       }
+
+                       LOG.info(response);
+                       return response;
+
                } catch(Exception e) {
                        LOG.log(Level.SEVERE, e.getMessage());
                        throw new CatalogException(e.getMessage());
                }
-    
+
        }
-       
+
        /**
         * Method to send a message containing a 'delete' instruction to Solr.
         * @param id
@@ -110,41 +125,41 @@ public class SolrClient {
         * @throws CatalogException
         */
        public String delete(String id, boolean commit) throws CatalogException 
{
-               
+
                try {
-                       
+
                        // build POST request
                        String url = this.buildUpdateUrl();
                        if (commit) {
-                         url += "?commit=true";
+                               url += "?commit=true";
                        }
                        String message = 
"<delete><query>id:"+id+"</query></delete>";
-                       
-           // send POST request
-           LOG.info("Posting message:"+message+" to URL:"+url);
 
-                 return doPost(url, message, Parameters.MIME_TYPE_XML);
-    
+                       // send POST request
+                       LOG.info("Posting message:"+message+" to URL:"+url);
+
+                       return doPost(url, message, Parameters.MIME_TYPE_XML);
+
                } catch(Exception e) {
                        LOG.log(Level.SEVERE, e.getMessage());
                        throw new CatalogException(e.getMessage());
                }
-               
+
        }
-       
+
        /**
         * Method to query the Solr index for a product with the specified id.
         * @param id
         * @return
         */
        public String queryProductById(String id, String mimeType) throws 
CatalogException {
-               
+
                ConcurrentHashMap<String, String[]> params = new 
ConcurrentHashMap<String, String[]>();
                params.put("q", new String[]{Parameters.PRODUCT_ID+":"+id} );
                return query(params, mimeType);
-               
+
        }
-       
+
        /**
         * Method to query the Solr index for a product with the specified name.
         * @param name
@@ -152,13 +167,13 @@ public class SolrClient {
         * @return
         */
        public String queryProductByName(String name, String mimeType) throws 
CatalogException {
-               
+
                ConcurrentHashMap<String, String[]> params = new 
ConcurrentHashMap<String, String[]>();
-               params.put("q", new String[]{Parameters.PRODUCT_NAME+":"+name} 
);
+               params.put("q", new String[]{Parameters.PRODUCT_NAME+":"+ 
ClientUtils.escapeQueryChars(name)} );
                return query(params, mimeType);
-               
+
        }
-       
+
        /**
         * Method to query Solr for the most recent 'n' products.
         * @param n
@@ -166,15 +181,15 @@ public class SolrClient {
         * @throws CatalogException
         */
        public String queryProductsByDate(int n, String mimeType) throws 
CatalogException {
-               
+
                ConcurrentHashMap<String, String[]> params = new 
ConcurrentHashMap<String, String[]>();
                params.put("q", new String[]{ "*:*"} );
                params.put("rows", new String[]{ ""+n} );
                params.put("sort", new String[]{ 
Parameters.PRODUCT_RECEIVED_TIME+" desc"} );
                return query(params, mimeType);
-               
+
        }
-       
+
        /**
         * Method to query Solr for the most recent 'n' products of a specified 
type.
         * @param n
@@ -182,51 +197,51 @@ public class SolrClient {
         * @throws CatalogException
         */
        public String queryProductsByDateAndType(int n, ProductType type, 
String mimeType) throws CatalogException {
-               
+
                ConcurrentHashMap<String, String[]> params = new 
ConcurrentHashMap<String, String[]>();
                params.put("q", new String[]{ 
Parameters.PRODUCT_TYPE_NAME+type.getName() } );
                params.put("rows", new String[]{ ""+n} );
                params.put("sort", new String[]{ 
Parameters.PRODUCT_RECEIVED_TIME+" desc"} );
                return query(params, mimeType);
-               
+
        }
-       
+
        /**
         * Method to commit the current changes to the Solr index.
         * @throws Exception
         */
        public void commit() throws IOException, CatalogException {
-               
+
                String message = "<commit waitSearcher=\"true\"/>";
                String url =  this.buildUpdateUrl();
                doPost(url, message, Parameters.MIME_TYPE_XML);
-               
+
        }
-       
+
        /**
         * Method to send a generic query to the Solr server.
-        * 
+        *
         * @param parameters
         * @param mimeType : the desired mime type for the results (XML, JSON, 
...)
         * @return
         */
        public String query(Map<String, String[]> parameters, String mimeType) 
throws CatalogException {
-               
+
                try {
-                       
+
                        // build HTTP request
                        String url = this.buildSelectUrl();
-                       
+
                        // execute request
-                 return this.doGet(url, parameters, mimeType);
-               
+                       return this.doGet(url, parameters, mimeType);
+
                } catch(Exception e) {
                        LOG.log(Level.SEVERE, e.getMessage());
                        throw new CatalogException(e.getMessage());
                }
-               
+
        }
-               
+
        /**
         * Method to execute a GET request to the given URL with the given 
parameters.
         * @param url
@@ -234,28 +249,32 @@ public class SolrClient {
         * @return
         */
        private String doGet(String url, Map<String, String[]> parameters, 
String mimeType)
-               throws IOException, CatalogException {
-                                   
+                       throws IOException, CatalogException {
+
                // build HTTP/GET request
-    GetMethod method = new GetMethod(url);
-    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-    for (Map.Entry<String, String[]> key : parameters.entrySet()) {
-       for (String value : key.getValue()) {
-               nvps.add(new NameValuePair(key.getKey(), value));
-       }
-    }
-    // request results in JSON format
-    if (mimeType.equals(Parameters.MIME_TYPE_JSON)) {
-         nvps.add(new NameValuePair("wt", "json"));
+
+
+               List<BasicNameValuePair> nvps = new 
ArrayList<BasicNameValuePair>();
+               for (Map.Entry<String, String[]> key : parameters.entrySet()) {
+                       for (String value : key.getValue()) {
+                               nvps.add(new BasicNameValuePair(key.getKey(), 
value));
+                       }
+               }
+               // request results in JSON format
+               if (mimeType.equals(Parameters.MIME_TYPE_JSON)) {
+                       nvps.add(new BasicNameValuePair("wt", "json"));
+               }
+
+               String paramString = URLEncodedUtils.format(nvps, "utf-8");
+
+               HttpRequestBase method = new HttpGet(url+"?"+paramString);
+               LOG.info("GET url: "+url+" query string: "+method.getURI());
+
+               // send HTTP/GET request, return response
+               return doHttp(method);
+
        }
-    method.setQueryString( nvps.toArray( new NameValuePair[nvps.size()] ) );
-    LOG.info("GET url: "+url+" query string: "+method.getQueryString());
-    
-    // send HTTP/GET request, return response
-    return doHttp(method);
-    
-  }
-       
+
        /**
         * Method to execute a POST request to the given URL.
         * @param url
@@ -263,91 +282,96 @@ public class SolrClient {
         * @return
         */
        private String doPost(String url, String document, String mimeType) 
throws IOException, CatalogException {
-    
+
                // build HTTP/POST request
-    PostMethod method = new PostMethod(url);
-    StringRequestEntity requestEntity = new StringRequestEntity(document, 
mimeType, "UTF-8");
-    method.setRequestEntity(requestEntity);
-    
-    // send HTTP/POST request, return response
-    return doHttp(method);
-               
+               HttpPost method = new HttpPost(url);
+               HttpEntity requestEntity = null;
+               try {
+                       requestEntity = new StringEntity(document, mimeType, 
"UTF-8");
+               } catch (UnsupportedEncodingException e) {
+                       e.printStackTrace();
+               }
+
+               method.setEntity(requestEntity);
+               // send HTTP/POST request, return response
+               return doHttp(method);
+
        }
-       
+
        /**
         * Common functionality for HTTP GET and POST requests.
         * @param method
         * @return
         * @throws Exception
         */
-       private String doHttp(HttpMethod method) throws IOException, 
CatalogException {
-               
-               StringBuilder response = new StringBuilder();
+       private String doHttp(HttpRequestBase method) throws IOException, 
CatalogException {
+
+               String response = null;
                BufferedReader br = null;
                try {
-                       
-           // send request
-           HttpClient httpClient = new HttpClient();
-            // OODT-719 Prevent httpclient from spawning closewait tcp 
connections
-            method.setRequestHeader("Connection", "close");
-
-           int statusCode = httpClient.executeMethod(method);      
-           
-           // read response
-           if (statusCode != HttpStatus.SC_OK) {
-               
-               // still consume the response
-               method.getResponseBodyAsString();
-             throw new CatalogException("HTTP method failed: " + 
method.getStatusLine());
-             
-           } else {
-       
-                   // read the response body.
-                   br = new BufferedReader(new 
InputStreamReader(method.getResponseBodyAsStream()));
-        String readLine;
-        while(((readLine = br.readLine()) != null)) {
-          response.append(readLine);
-        }
-           
-           }
-               
-         } finally {
-           // must release the connection even if an exception occurred
-           method.releaseConnection();
-           if (br!=null) {
-                 try {
-                       br.close();
-                 } catch (Exception ignored) {
-                 }
+
+                       // send request
+                       HttpClient httpClient = new DefaultHttpClient();
+                       // OODT-719 Prevent httpclient from spawning closewait 
tcp connections
+                       method.setHeader("Connection", "close");
+
+                       HttpResponse statusCode = httpClient.execute(method);
+
+                       // read response
+                       if (statusCode.getStatusLine().getStatusCode() != 
HttpStatus.SC_OK) {
+
+                               // still consume the response
+                               ResponseHandler<String> handler = new 
BasicResponseHandler();
+
+                               handler.handleResponse(statusCode);
+                               throw new CatalogException("HTTP method failed: 
" + statusCode.getStatusLine().toString());
+
+                       } else {
+                               ResponseHandler<String> handler = new 
BasicResponseHandler();
+
+                               String resp = 
handler.handleResponse(statusCode);
+
+                               response=resp;
+
+                       }
+
+               } finally {
+                       // must release the connection even if an exception 
occurred
+                       method.releaseConnection();
+                       if (br!=null) {
+                               try {
+                                       br.close();
+                               } catch (Exception ignored) {
+                               }
+                       }
                }
-         }  
-  
-         return response.toString();
-  
+
+               return response;
+
        }
-       
+
        /**
         * Builds the URL used to update the Solr index.
-        * 
+        *
         * Example: http://localhost:8983/solr/update?
         * @return
         */
        private String buildUpdateUrl() {
-               
+
                return solrUrl + (solrUrl.endsWith("/") ? "" : "/") + "update";
-               
+
        }
-       
+
        /**
         * Builds the URL used to query the Solr index.
-        * 
+        *
         * Example: http://localhost:8983/solr/select?
         * @return
         */
        private String buildSelectUrl() {
-               
+
                return solrUrl + (solrUrl.endsWith("/") ? "" : "/") + "select";
-               
+
        }
 
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/CommonsXmlRpcTransport.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/CommonsXmlRpcTransport.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/CommonsXmlRpcTransport.java
new file mode 100644
index 0000000..baf9e73
--- /dev/null
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/CommonsXmlRpcTransport.java
@@ -0,0 +1,183 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package org.apache.oodt.cas.filemgr.system;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.*;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.AuthSchemes;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.entity.ByteArrayEntity;
+
+import org.apache.http.impl.auth.BasicSchemeFactory;
+import org.apache.http.impl.auth.DigestSchemeFactory;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicHeader;
+import org.apache.xmlrpc.XmlRpcClientException;
+import org.apache.xmlrpc.XmlRpcTransport;
+
+public class CommonsXmlRpcTransport implements XmlRpcTransport {
+    private URL url;
+    private HttpClient client;
+    private Header userAgentHeader;
+    private boolean http11;
+    private boolean gzip;
+    private boolean rgzip;
+    private Credentials creds;
+    protected HttpPost method;
+    private int timeout = 10;
+    private int connecttimeout = 10;
+    private String password;
+    private String user;
+    private String auth;
+
+    public CommonsXmlRpcTransport(URL url, HttpClient client) {
+        this.userAgentHeader = new BasicHeader("User-Agent", "Apache XML-RPC 
2.0");
+        this.http11 = false;
+        this.gzip = false;
+        this.rgzip = false;
+        this.url = url;
+        if(client == null) {
+            RequestConfig config = RequestConfig.custom()
+                    .setSocketTimeout(timeout * 1000)
+                    .setConnectTimeout(connecttimeout * 1000)
+                    .build();
+            CredentialsProvider credsProvider = new BasicCredentialsProvider();
+            if(!user.equals(null)) {
+                credsProvider.setCredentials(AuthScope.ANY, new 
UsernamePasswordCredentials(user));
+            }
+            else if(!user.equals(null)&& !password.equals(null)){
+                credsProvider.setCredentials(AuthScope.ANY, new 
UsernamePasswordCredentials(user, password));
+            }
+            else if(!auth.equals(null)){
+
+            }
+
+            System.out.println("building empty registry");
+            Registry<AuthSchemeProvider> r = 
RegistryBuilder.<AuthSchemeProvider>create().build();
+            HttpClient newClient = 
HttpClients.custom().setDefaultAuthSchemeRegistry(r).setDefaultCredentialsProvider(credsProvider).setDefaultRequestConfig(config).build();
+            this.client = newClient;
+        } else {
+            this.client = client;
+        }
+
+    }
+
+    public CommonsXmlRpcTransport(URL url) {
+        this(url, (HttpClient)null);
+    }
+
+
+
+    public InputStream sendXmlRpc(byte[] request) throws IOException, 
XmlRpcClientException {
+        this.method = new HttpPost(this.url.toString());
+        //this.method.setHttp11(this.http11);
+        this.method.setHeader(new BasicHeader("Content-Type", "text/xml"));
+        if(this.rgzip) {
+            this.method.setHeader(new BasicHeader("Content-Encoding", "gzip"));
+        }
+
+        if(this.gzip) {
+            this.method.setHeader(new BasicHeader("Accept-Encoding", "gzip"));
+        }
+
+        this.method.setHeader(this.userAgentHeader);
+        if(this.rgzip) {
+            ByteArrayOutputStream hostURI = new ByteArrayOutputStream();
+            GZIPOutputStream hostConfig = new GZIPOutputStream(hostURI);
+            hostConfig.write(request);
+            hostConfig.finish();
+            hostConfig.close();
+            byte[] lgzipo = hostURI.toByteArray();
+
+            HttpEntity entity = new ByteArrayEntity(lgzipo);
+
+
+            this.method.setEntity(entity);
+
+            //this.method.setRequestContentLength(-1);
+        } else {
+            HttpEntity entity = new ByteArrayEntity(request);
+            this.method.setEntity(entity);
+//            this.method.setRequestBody(new ByteArrayInputStream(request));
+        }
+
+        URI hostURI1 = null;
+        try {
+            hostURI1 = new URI(this.url.toString());
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        }
+        HttpHost hostConfig1 = new HttpHost(hostURI1.toString());
+        HttpResponse response = this.client.execute(this.method);
+        boolean lgzipo1 = false;
+        Header[] lHeader = response.getHeaders("Content-Encoding");
+        if(lHeader != null && lHeader.length>0) {
+            String lValue = lHeader[0].getValue();
+            if(lValue != null) {
+                lgzipo1 = lValue.indexOf("gzip") >= 0;
+            }
+        }
+
+        return (InputStream)(lgzipo1?new 
GZIPInputStream(response.getEntity().getContent()):response.getEntity().getContent());
+    }
+
+    public void setHttp11(boolean http11) {
+        this.http11 = http11;
+    }
+
+    public void setGzip(boolean gzip) {
+        this.gzip = gzip;
+    }
+
+    public void setRGzip(boolean gzip) {
+        this.rgzip = gzip;
+    }
+
+    public void setUserAgent(String userAgent) {
+        this.userAgentHeader =new BasicHeader("User-Agent", userAgent);
+    }
+
+    public void setTimeout(int timeout) {
+        this.timeout = timeout;
+    }
+
+    public void setConnectionTimeout(int ctimeout) {
+        this.connecttimeout = ctimeout;
+    }
+
+    public void setBasicAuthentication(String user, String password) {
+        this.user = user;
+        this.password = password;
+
+    }
+
+    public void setBasicAuthentication(String auth) {
+        this.auth = auth;
+    }
+
+    public void endClientRequest() throws XmlRpcClientException {
+        this.method.releaseConnection();
+    }
+}

http://git-wip-us.apache.org/repos/asf/oodt/blob/78ce45e2/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
index db64716..9c3a5e4 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
@@ -17,10 +17,14 @@
 
 package org.apache.oodt.cas.filemgr.system;
 
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodRetryHandler;
-import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.http.auth.AuthSchemeProvider;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.HttpContext;
 import org.apache.oodt.cas.cli.CmdLineUtility;
 import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
 import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
@@ -43,7 +47,6 @@ import 
org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
 import org.apache.oodt.cas.filemgr.util.XmlRpcStructFactory;
 import org.apache.oodt.cas.filemgr.versioning.Versioner;
 import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.xmlrpc.CommonsXmlRpcTransport;
 import org.apache.xmlrpc.XmlRpcClient;
 import org.apache.xmlrpc.XmlRpcClientException;
 import org.apache.xmlrpc.XmlRpcException;
@@ -76,7 +79,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   /* our log stream */
   private static Logger LOG = Logger.getLogger(XmlRpcFileManagerClient.class
-      .getName());
+          .getName());
 
   /* file manager url */
   private URL fileManagerUrl = null;
@@ -95,21 +98,21 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
    * @param testConnection Whether or not to check if server at given url is 
alive.
    */
   public XmlRpcFileManagerClient(final URL url, boolean testConnection)
-      throws ConnectionException {
+          throws ConnectionException {
     // set up the configuration, if there is any
     if (System.getProperty("org.apache.oodt.cas.filemgr.properties") != null) {
       String configFile = System
-          .getProperty("org.apache.oodt.cas.filemgr.properties");
+              .getProperty("org.apache.oodt.cas.filemgr.properties");
       LOG.log(Level.INFO,
-          "Loading File Manager Configuration Properties from: ["
-          + configFile + "]");
+              "Loading File Manager Configuration Properties from: ["
+                      + configFile + "]");
       try {
         System.getProperties().load(
-            new FileInputStream(new File(configFile)));
+                new FileInputStream(new File(configFile)));
       } catch (Exception e) {
         LOG.log(Level.INFO,
-            "Error loading configuration properties from: ["
-            + configFile + "]");
+                "Error loading configuration properties from: ["
+                        + configFile + "]");
       }
 
     }
@@ -117,41 +120,52 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
     XmlRpcTransportFactory transportFactory = new XmlRpcTransportFactory() {
 
       public XmlRpcTransport createTransport()
-          throws XmlRpcClientException {
-        HttpClient client = new HttpClient();
-        client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
-            new HttpMethodRetryHandler() {
-
-              public boolean retryMethod(HttpMethod method,
-                                         IOException e, int count) {
-                if (count < Integer
+              throws XmlRpcClientException {
+
+        HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler() 
{
+          public boolean retryRequest(
+                  IOException exception,
+                  int count,
+                  HttpContext context){
+            if (count < Integer
                     .getInteger(
-                        
"org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retries",
-                        3)) {
-                  try {
-                    Thread
+                            
"org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retries",
+                            3)) {
+              try {
+                Thread
                         .sleep(Integer
-                                   .getInteger(
-                                       
"org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retry.interval.seconds",
-                                       0) * 1000);
-                    return true;
-                  } catch (Exception ignored) {
-                  }
-                }
-                return false;
+                                .getInteger(
+                                        
"org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retry.interval.seconds",
+                                        0) * 1000);
+                return true;
+              } catch (Exception ignored) {
               }
+            }
+            return false;
+          }
+        };
+        RequestConfig config = RequestConfig.custom()
+                .setSocketTimeout(Integer
+                        .getInteger(
+                                
"org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes",
+                                20) * 60 * 1000)
+                .setConnectTimeout(Integer
+                        .getInteger(
+                                
"org.apache.oodt.cas.filemgr.system.xmlrpc.requestTimeout.minutes",
+                                60) * 60 * 1000)
+                .build();
+        Registry<AuthSchemeProvider> r = 
RegistryBuilder.<AuthSchemeProvider>create().build();
+        HttpClient client = 
HttpClients.custom().setRetryHandler(myRetryHandler).setDefaultAuthSchemeRegistry(r).setDefaultRequestConfig(config).build();
 
-            });
-        CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(
-            url, client);
+        CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(url, 
client);
         transport
-            .setConnectionTimeout(Integer
-                                      .getInteger(
-                                          
"org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes",
-                                          20) * 60 * 1000);
+                .setConnectionTimeout(Integer
+                        .getInteger(
+                                
"org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes",
+                                20) * 60 * 1000);
         transport
-            .setTimeout(Integer
-                            .getInteger(
+                .setTimeout(Integer
+                        .getInteger(
                                 
"org.apache.oodt.cas.filemgr.system.xmlrpc.requestTimeout.minutes",
                                 60) * 60 * 1000);
 
@@ -168,7 +182,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     if (testConnection && !isAlive()) {
       throw new ConnectionException("Exception connecting to filemgr: ["
-                                    + this.fileManagerUrl + "]");
+              + this.fileManagerUrl + "]");
     }
 
   }
@@ -179,14 +193,14 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
     Vector<Object> argList = new Vector<Object>();
     try {
       success = (Boolean) client.execute("filemgr.refreshConfigAndPolicy",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       LOG.log(Level.WARNING, "XmlRpcException when connecting to filemgr: ["
-                             + this.fileManagerUrl + "]");
+              + this.fileManagerUrl + "]");
       success = false;
     } catch (IOException e) {
       LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
-                             + this.fileManagerUrl + "]");
+              + this.fileManagerUrl + "]");
       success = false;
     }
 
@@ -201,12 +215,12 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
       connected = (Boolean) client.execute("filemgr.isAlive", argList);
     } catch (XmlRpcException e) {
       LOG.log(Level.WARNING,
-          "XmlRpcException when connecting to filemgr: ["
-          + this.fileManagerUrl + "]");
+              "XmlRpcException when connecting to filemgr: ["
+                      + this.fileManagerUrl + "]");
       connected = false;
     } catch (IOException e) {
       LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
-                             + this.fileManagerUrl + "]");
+              + this.fileManagerUrl + "]");
       connected = false;
     }
 
@@ -214,17 +228,17 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public boolean transferringProduct(Product product)
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
 
     boolean success;
 
     try {
       success = (Boolean) client.execute("filemgr.transferringProduct",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -235,9 +249,9 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public boolean removeProductTransferStatus(Product product)
-      throws DataTransferException {
+          throws DataTransferException {
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     Vector<Object> argList = new Vector<Object>();
     argList.add(productHash);
 
@@ -245,7 +259,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       success = (Boolean) client.execute(
-          "filemgr.removeProductTransferStatus", argList);
+              "filemgr.removeProductTransferStatus", argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -256,9 +270,9 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public boolean isTransferComplete(Product product)
-      throws DataTransferException {
+          throws DataTransferException {
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     Vector<Object> argList = new Vector<Object>();
     argList.add(productHash);
 
@@ -266,7 +280,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       success = (Boolean) client.execute("filemgr.isTransferComplete",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -277,9 +291,9 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public boolean moveProduct(Product product, String newPath)
-      throws DataTransferException {
+          throws DataTransferException {
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     Vector<Object> argList = new Vector<Object>();
     argList.add(productHash);
     argList.add(newPath);
@@ -299,7 +313,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   public boolean modifyProduct(Product product) throws CatalogException {
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
 
     Vector<Object> argList = new Vector<Object>();
     argList.add(productHash);
@@ -308,7 +322,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       success = (Boolean) client.execute("filemgr.modifyProduct",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -321,7 +335,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   public boolean removeProduct(Product product) throws CatalogException {
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
 
     Vector<Object> argList = new Vector<Object>();
     argList.add(productHash);
@@ -330,7 +344,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       success = (Boolean) client.execute("filemgr.removeProduct",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -343,7 +357,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public FileTransferStatus getCurrentFileTransfer()
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
 
     Map<String, Object> statusHash;
@@ -351,7 +365,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       statusHash = (Map<String, Object>) client.execute(
-          "filemgr.getCurrentFileTransfer", argList);
+              "filemgr.getCurrentFileTransfer", argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -360,7 +374,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     if (statusHash != null) {
       status = XmlRpcStructFactory
-          .getFileTransferStatusFromXmlRpc(statusHash);
+              .getFileTransferStatusFromXmlRpc(statusHash);
     }
 
     return status;
@@ -368,7 +382,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public List<FileTransferStatus> getCurrentFileTransfers()
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
 
     Vector<Map<String, Object>> statusVector;
@@ -376,7 +390,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       statusVector = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.getCurrentFileTransfers", argList);
+              "filemgr.getCurrentFileTransfers", argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -385,23 +399,23 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     if (statusVector != null) {
       statuses = XmlRpcStructFactory
-          .getFileTransferStatusesFromXmlRpc(statusVector);
+              .getFileTransferStatusesFromXmlRpc(statusVector);
     }
 
     return statuses;
   }
 
   public double getProductPctTransferred(Product product)
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
     Double pct;
 
     try {
       pct = (Double) client.execute("filemgr.getProductPctTransferred",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -416,16 +430,16 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public double getRefPctTransferred(Reference reference)
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> refHash = XmlRpcStructFactory
-        .getXmlRpcReference(reference);
+            .getXmlRpcReference(reference);
     argList.add(refHash);
     Double pct;
 
     try {
       pct = (Double) client.execute("filemgr.getRefPctTransferred",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new DataTransferException(e);
     } catch (IOException e) {
@@ -441,12 +455,12 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public ProductPage pagedQuery(Query query, ProductType type, int pageNum)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> queryHash = XmlRpcStructFactory
-        .getXmlRpcQuery(query);
+            .getXmlRpcQuery(query);
     Map<String, Object> typeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
     argList.add(queryHash);
     argList.add(typeHash);
     argList.add(pageNum);
@@ -455,7 +469,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       pageHash = (Map<String, Object>) client.execute(
-          "filemgr.pagedQuery", argList);
+              "filemgr.pagedQuery", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -475,7 +489,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       pageHash = (Map<String, Object>) client.execute(
-          "filemgr.getFirstPage", argList);
+              "filemgr.getFirstPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -500,7 +514,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       pageHash = (Map<String, Object>) client.execute(
-          "filemgr.getLastPage", argList);
+              "filemgr.getLastPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -516,7 +530,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public ProductPage getNextPage(ProductType type, ProductPage currPage)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
     argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
@@ -526,7 +540,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       pageHash = (Map<String, Object>) client.execute(
-          "filemgr.getNextPage", argList);
+              "filemgr.getNextPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -542,7 +556,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public ProductPage getPrevPage(ProductType type, ProductPage currPage)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
     argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
@@ -552,7 +566,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       pageHash = (Map<String, Object>) client.execute(
-          "filemgr.getPrevPage", argList);
+              "filemgr.getPrevPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -567,16 +581,16 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public String addProductType(ProductType type)
-      throws RepositoryManagerException {
+          throws RepositoryManagerException {
     String productTypeId;
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> typeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
     argList.add(typeHash);
 
     try {
       productTypeId = (String) client.execute("filemgr.addProductType",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new RepositoryManagerException(e);
     } catch (IOException e) {
@@ -595,7 +609,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       hasProduct = (Boolean) client.execute("filemgr.hasProduct",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -614,7 +628,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       numProducts = (Integer) client.execute("filemgr.getNumProducts",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -633,7 +647,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       topNProducts = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.getTopNProducts", argList);
+              "filemgr.getTopNProducts", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -641,23 +655,23 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
     }
 
     return XmlRpcStructFactory
-        .getProductListFromXmlRpc(topNProducts);
+            .getProductListFromXmlRpc(topNProducts);
   }
 
   @SuppressWarnings("unchecked")
   public List<Product> getTopNProducts(int n, ProductType type)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(n);
     Map<String, Object> productTypeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
     argList.add(productTypeHash);
 
     Vector<Map<String, Object>> topNProducts;
 
     try {
       topNProducts = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.getTopNProducts", argList);
+              "filemgr.getTopNProducts", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -665,14 +679,14 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
     }
 
     return XmlRpcStructFactory
-        .getProductListFromXmlRpc(topNProducts);
+            .getProductListFromXmlRpc(topNProducts);
   }
 
   public void setProductTransferStatus(Product product)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
 
     try {
@@ -688,7 +702,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   public void addProductReferences(Product product) throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
 
     try {
@@ -701,7 +715,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public void addMetadata(Product product, Metadata metadata)
-      throws CatalogException {
+          throws CatalogException {
 
     Vector<Object> argList = new Vector<Object>();
     argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
@@ -717,7 +731,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public boolean updateMetadata(Product product, Metadata met)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
     argList.add(met.getHashTable());
@@ -744,7 +758,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       productId = (String) client.execute("filemgr.catalogProduct",
-          argList);
+              argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -758,14 +772,14 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   public Metadata getMetadata(Product product) throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
 
     Map<String, Object> metadata;
 
     try {
       metadata = (Map<String, Object>) client.execute(
-          "filemgr.getMetadata", argList);
+              "filemgr.getMetadata", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -780,10 +794,10 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings({ "unchecked", "rawtypes" })
   public Metadata getReducedMetadata(Product product, List<?> elements)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
     argList.add(new Vector(elements));
 
@@ -791,7 +805,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       metadata = (Map<String, Object>) client.execute(
-          "filemgr.getReducedMetadata", argList);
+              "filemgr.getReducedMetadata", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -822,7 +836,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public byte[] retrieveFile(String filePath, int offset, int numBytes)
-      throws DataTransferException {
+          throws DataTransferException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(filePath);
     argList.add(offset);
@@ -856,17 +870,17 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public List<Product> getProductsByProductType(ProductType type)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productTypeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
     argList.add(productTypeHash);
 
     Vector<Map<String, Object>> productVector;
 
     try {
       productVector = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.getProductsByProductType", argList);
+              "filemgr.getProductsByProductType", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -882,10 +896,10 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public List<Element> getElementsByProductType(ProductType type)
-      throws ValidationLayerException {
+          throws ValidationLayerException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> productTypeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
 
     argList.add(productTypeHash);
 
@@ -893,7 +907,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       elementVector = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.getElementsByProductType", argList);
+              "filemgr.getElementsByProductType", argList);
     } catch (XmlRpcException e) {
       throw new ValidationLayerException(e);
     } catch (IOException e) {
@@ -909,7 +923,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public Element getElementById(String elementId)
-      throws ValidationLayerException {
+          throws ValidationLayerException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(elementId);
 
@@ -917,7 +931,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       elementHash = (Hashtable<String, Object>) client.execute(
-          "filemgr.getElementById", argList);
+              "filemgr.getElementById", argList);
     } catch (XmlRpcException e) {
       throw new ValidationLayerException(e);
     } catch (IOException e) {
@@ -933,7 +947,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public Element getElementByName(String elementName)
-      throws ValidationLayerException {
+          throws ValidationLayerException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(elementName);
 
@@ -941,7 +955,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       elementHash = (Hashtable<String, Object>) client.execute(
-          "filemgr.getElementByName", argList);
+              "filemgr.getElementByName", argList);
     } catch (XmlRpcException e) {
       throw new ValidationLayerException(e);
     } catch (IOException e) {
@@ -957,7 +971,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public Element getElementByName(String elementName, ProductType type)
-      throws ValidationLayerException {
+          throws ValidationLayerException {
     Vector<Object> argList = new Vector<Object>();
     argList.add(elementName);
     argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
@@ -966,7 +980,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       elementHash = (Hashtable<String, Object>) client.execute(
-          "filemgr.getElementByName", argList);
+              "filemgr.getElementByName", argList);
     } catch (XmlRpcException e) {
       throw new ValidationLayerException(e);
     } catch (IOException e) {
@@ -981,17 +995,17 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
   }
 
   public List<QueryResult> complexQuery(ComplexQuery complexQuery)
-      throws CatalogException {
+          throws CatalogException {
     try {
       Map<String, Object> complexQueryHash = XmlRpcStructFactory
-          .getXmlRpcComplexQuery(complexQuery);
+              .getXmlRpcComplexQuery(complexQuery);
       Vector<Object> argList = new Vector<Object>();
       argList.add(complexQueryHash);
       @SuppressWarnings("unchecked")
       Vector<Map<String, Object>> queryResultHashVector = (Vector<Map<String, 
Object>>) client
-          .execute("filemgr.complexQuery", argList);
+              .execute("filemgr.complexQuery", argList);
       return XmlRpcStructFactory
-          .getQueryResultsFromXmlRpc(queryResultHashVector);
+              .getQueryResultsFromXmlRpc(queryResultHashVector);
     } catch (Exception e) {
       LOG.log(Level.SEVERE, e.getMessage());
       throw new CatalogException(e);
@@ -1000,12 +1014,12 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public List<Product> query(Query query, ProductType type)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
     Map<String, Object> queryHash = XmlRpcStructFactory
-        .getXmlRpcQuery(query);
+            .getXmlRpcQuery(query);
     Map<String, Object> typeHash = XmlRpcStructFactory
-        .getXmlRpcProductType(type);
+            .getXmlRpcProductType(type);
     argList.add(queryHash);
     argList.add(typeHash);
 
@@ -1013,7 +1027,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       productVector = (Vector<Map<String, Object>>) client.execute(
-          "filemgr.query", argList);
+              "filemgr.query", argList);
     } catch (XmlRpcException e) {
       LOG.log(Level.SEVERE, e.getMessage());
       throw new CatalogException(e);
@@ -1032,14 +1046,14 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   @SuppressWarnings("unchecked")
   public ProductType getProductTypeByName(String productTypeName)
-      throws RepositoryManagerException {
+          throws RepositoryManagerException {
     Hashtable<String, Object> productTypeHash;
     Vector<Object> argList = new Vector<Object>();
     argList.add(productTypeName);
 
     try {
       productTypeHash = (Hashtable<String, Object>) client.execute(
-          "filemgr.getProductTypeByName", argList);
+              "filemgr.getProductTypeByName", argList);
     } catch (XmlRpcException e) {
       throw new RepositoryManagerException(e.getLocalizedMessage());
     } catch (IOException e) {
@@ -1050,20 +1064,20 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
       return null;
     } else {
       return XmlRpcStructFactory
-          .getProductTypeFromXmlRpc(productTypeHash);
+              .getProductTypeFromXmlRpc(productTypeHash);
     }
   }
 
   @SuppressWarnings("unchecked")
   public ProductType getProductTypeById(String productTypeId)
-      throws RepositoryManagerException {
+          throws RepositoryManagerException {
     Hashtable<String, Object> productTypeHash;
     Vector<Object> argList = new Vector<Object>();
     argList.add(productTypeId);
 
     try {
       productTypeHash = (Hashtable<String, Object>) client.execute(
-          "filemgr.getProductTypeById", argList);
+              "filemgr.getProductTypeById", argList);
     } catch (XmlRpcException e) {
       throw new RepositoryManagerException(e);
     } catch (IOException e) {
@@ -1074,20 +1088,20 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
       return null;
     } else {
       return XmlRpcStructFactory
-          .getProductTypeFromXmlRpc(productTypeHash);
+              .getProductTypeFromXmlRpc(productTypeHash);
     }
   }
 
   @SuppressWarnings("unchecked")
   public List<ProductType> getProductTypes()
-      throws RepositoryManagerException {
+          throws RepositoryManagerException {
     Vector<Object> argList = new Vector<Object>();
 
     Vector<Map<String, Object>> productTypeVector;
 
     try {
       productTypeVector = (Vector<Map<String, Object>>) client
-          .execute("filemgr.getProductTypes", argList);
+              .execute("filemgr.getProductTypes", argList);
     } catch (XmlRpcException e) {
       throw new RepositoryManagerException(e);
     } catch (IOException e) {
@@ -1098,23 +1112,23 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
       return null;
     } else {
       return XmlRpcStructFactory
-          .getProductTypeListFromXmlRpc(productTypeVector);
+              .getProductTypeListFromXmlRpc(productTypeVector);
     }
   }
 
   @SuppressWarnings("unchecked")
   public List<Reference> getProductReferences(Product product)
-      throws CatalogException {
+          throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
 
     Vector<Map<String, Object>> productReferenceVector;
     Map<String, Object> productHash = XmlRpcStructFactory
-        .getXmlRpcProduct(product);
+            .getXmlRpcProduct(product);
     argList.add(productHash);
 
     try {
       productReferenceVector = (Vector<Map<String, Object>>) client
-          .execute("filemgr.getProductReferences", argList);
+              .execute("filemgr.getProductReferences", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -1125,7 +1139,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
       return null;
     } else {
       return XmlRpcStructFactory
-          .getReferencesFromXmlRpc(productReferenceVector);
+              .getReferencesFromXmlRpc(productReferenceVector);
     }
   }
 
@@ -1138,7 +1152,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       productHash = (Map<String, Object>) client.execute(
-          "filemgr.getProductById", argList);
+              "filemgr.getProductById", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -1161,7 +1175,7 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
     try {
       productHash = (Map<String, Object>) client.execute(
-          "filemgr.getProductByName", argList);
+              "filemgr.getProductByName", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
@@ -1177,38 +1191,38 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
 
   public String ingestProduct(Product product, Metadata metadata,
                               boolean clientTransfer)
-      throws VersioningException, XmlRpcException, FileManagerException {
+          throws VersioningException, XmlRpcException, FileManagerException {
     try {
       // ingest product
       Vector<Object> argList = new Vector<Object>();
       Map<String, Object> productHash = XmlRpcStructFactory
-          .getXmlRpcProduct(product);
+              .getXmlRpcProduct(product);
       argList.add(productHash);
       argList.add(metadata.getHashTable());
       argList.add(clientTransfer);
       String productId = (String) client.execute("filemgr.ingestProduct",
-          argList);
+              argList);
 
       if (clientTransfer) {
         LOG.log(Level.FINEST,
-            "File Manager Client: clientTransfer enabled: "
-            + "transfering product ["
-            + product.getProductName() + "]");
+                "File Manager Client: clientTransfer enabled: "
+                        + "transfering product ["
+                        + product.getProductName() + "]");
 
         // we need to transfer the product ourselves
         // make sure we have the product ID
         if (productId == null) {
           throw new Exception("Request to ingest product: "
-                              + product.getProductName()
-                              + " but no product ID returned from File "
-                              + "Manager ingest");
+                  + product.getProductName()
+                  + " but no product ID returned from File "
+                  + "Manager ingest");
         }
 
         if (dataTransfer == null) {
           throw new Exception("Request to ingest product: ["
-                              + product.getProductName()
-                              + "] using client transfer, but no "
-                              + "dataTransferer specified!");
+                  + product.getProductName()
+                  + "] using client transfer, but no "
+                  + "dataTransferer specified!");
         }
 
         product.setProductId(productId);
@@ -1216,8 +1230,8 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
         if 
(!Boolean.getBoolean("org.apache.oodt.cas.filemgr.serverside.versioning")) {
           // version the product
           Versioner versioner = GenericFileManagerObjectFactory
-              .getVersionerFromClassName(product.getProductType()
-                                                .getVersioner());
+                  .getVersionerFromClassName(product.getProductType()
+                          .getVersioner());
           if (versioner != null) {
             versioner.createDataStoreReferences(product, metadata);
           }
@@ -1227,13 +1241,13 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
             addProductReferences(product);
           } catch (CatalogException e) {
             LOG
-                .log(
-                    Level.SEVERE,
-                    "ingestProduct: RepositoryManagerException "
-                    + "when adding Product References for Product : "
-                    + product.getProductName()
-                    + " to RepositoryManager: Message: "
-                    + e);
+                    .log(
+                            Level.SEVERE,
+                            "ingestProduct: RepositoryManagerException "
+                                    + "when adding Product References for 
Product : "
+                                    + product.getProductName()
+                                    + " to RepositoryManager: Message: "
+                                    + e);
             throw e;
           }
         } else {
@@ -1251,19 +1265,19 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
             setProductTransferStatus(product);
           } catch (CatalogException e) {
             LOG
-                .log(
-                    Level.SEVERE,
-                    "ingestProduct: RepositoryManagerException "
-                    + "when updating product transfer status for Product: "
-                    + product.getProductName()
-                    + " Message: " + e);
+                    .log(
+                            Level.SEVERE,
+                            "ingestProduct: RepositoryManagerException "
+                                    + "when updating product transfer status 
for Product: "
+                                    + product.getProductName()
+                                    + " Message: " + e);
             throw e;
           }
         } catch (Exception e) {
           LOG.log(Level.SEVERE,
-              "ingestProduct: DataTransferException when transfering Product: "
-              + product.getProductName() + ": Message: "
-              + e);
+                  "ingestProduct: DataTransferException when transfering 
Product: "
+                          + product.getProductName() + ": Message: "
+                          + e);
           throw new DataTransferException(e);
         }
 
@@ -1274,81 +1288,81 @@ public class XmlRpcFileManagerClient implements 
FileManagerClient {
     } catch (VersioningException e) {
       LOG.log(Level.SEVERE, e.getMessage());
       LOG.log(Level.SEVERE,
-          "ingestProduct: VersioningException when versioning Product: "
-          + product.getProductName() + " with Versioner "
-          + product.getProductType().getVersioner()
-          + ": Message: " + e);
+              "ingestProduct: VersioningException when versioning Product: "
+                      + product.getProductName() + " with Versioner "
+                      + product.getProductType().getVersioner()
+                      + ": Message: " + e);
       throw new VersioningException(e);
     } catch (XmlRpcException e2) {
       LOG.log(Level.SEVERE, "Failed to ingest product [ name:" + 
product.getProductName() + "] :" + e2.getMessage()
-                            + " -- rolling back ingest");
+              + " -- rolling back ingest");
       try {
         Vector<Object> argList = new Vector<Object>();
         Map<String, Object> productHash = XmlRpcStructFactory
-            .getXmlRpcProduct(product);
+                .getXmlRpcProduct(product);
         argList.add(productHash);
         client.execute("filemgr.removeProduct", argList);
       } catch (Exception e1) {
         LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
-                              + product + "] : " + e2.getMessage());
+                + product + "] : " + e2.getMessage());
       }
       throw e2;
     } catch (Exception e) {
       LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + 
product.getProductId() +
-                            "/ name:" + product.getProductName() + "] :" + e + 
" -- rolling back ingest");
+              "/ name:" + product.getProductName() + "] :" + e + " -- rolling 
back ingest");
       try {
         Vector<Object> argList = new Vector<Object>();
         Map<String, Object> productHash = XmlRpcStructFactory
-            .getXmlRpcProduct(product);
+                .getXmlRpcProduct(product);
         argList.add(productHash);
         client.execute("filemgr.removeProduct", argList);
       } catch (Exception e1) {
         LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
-                              + product + "] : " + e);
+                + product + "] : " + e);
       }
       throw new FileManagerException("Failed to ingest product [" + product + 
"] : "
-                                     + e);
+              + e);
     }
 
   }
 
   @SuppressWarnings("unchecked")
   public Metadata getCatalogValues(Metadata metadata, ProductType productType)
-      throws XmlRpcException, IOException {
+          throws XmlRpcException, IOException {
     Vector<Object> args = new Vector<Object>();
     args.add(metadata.getHashTable());
     args.add(XmlRpcStructFactory.getXmlRpcProductType(productType));
 
     Metadata m = new Metadata();
     m.addMetadata((Map<String, Object>) this.client.execute(
-        "filemgr.getCatalogValues", args));
+            "filemgr.getCatalogValues", args));
 
     return m;
   }
 
   @SuppressWarnings("unchecked")
   public Metadata getOrigValues(Metadata metadata, ProductType productType)
-      throws XmlRpcException, IOException {
+          throws XmlRpcException, IOException {
     Vector<Object> args = new Vector<Object>();
     args.add(metadata.getHashTable());
     args.add(XmlRpcStructFactory.getXmlRpcProductType(productType));
 
     Metadata m = new Metadata();
     m.addMetadata((Map<String, Object>) this.client.execute(
-        "filemgr.getOrigValues", args));
+            "filemgr.getOrigValues", args));
 
     return m;
   }
 
   @SuppressWarnings("unchecked")
   public Query getCatalogQuery(Query query, ProductType productType)
-      throws XmlRpcException, IOException {
+          throws XmlRpcException, IOException {
     Vector<Object> args = new Vector<Object>();
     args.add(XmlRpcStructFactory.getXmlRpcQuery(query));
     args.add(XmlRpcStructFactory.getXmlRpcProductType(productType));
     return XmlRpcStructFactory
-        .getQueryFromXmlRpc((Hashtable<String, Object>) this.client
-            .execute("filemgr.getCatalogQuery", args));
+            .getQueryFromXmlRpc((Hashtable<String, Object>) this.client
+                    .execute("filemgr.getCatalogQuery", args));
   }
 
   public static void main(String[] args) {

Reply via email to