http://git-wip-us.apache.org/repos/asf/oodt/blob/8705ccf4/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 cb80e08..5e84249 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
@@ -55,8 +55,8 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.util.Hashtable;
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
 import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -66,1334 +66,1326 @@ import java.util.logging.Logger;
  * @author mattmann (Chris Mattmann)
  * @author bfoster (Brian Foster)
  * @version $Revision$
- * 
- * <p>
- * The XML RPC based file manager client.
- * </p>
- * 
+ *          <p/>
+ *          <p> The XML RPC based file manager client. </p>
  */
 public class XmlRpcFileManagerClient {
 
-    /* our xml rpc client */
-    private XmlRpcClient client = null;
-
-    /* our log stream */
-    private static Logger LOG = Logger.getLogger(XmlRpcFileManagerClient.class
-            .getName());
-
-    /* file manager url */
-    private URL fileManagerUrl = null;
-
-    /* data transferer needed if client is request to move files itself */
-    private DataTransfer dataTransfer = null;
-
-    public XmlRpcFileManagerClient(final URL url) throws ConnectionException {
-       this(url, true);
-    }
-
-    /**
-     * <p>
-     * Constructs a new XmlRpcFileManagerClient with the given 
<code>url</code>.
-     * </p>
-     * 
-     * @param url
-     *            The url pointer to the xml rpc file manager service.
-     * @param testConnection
-     *            Whether or not to check if server at given url is alive.
-     */
-    public XmlRpcFileManagerClient(final URL url, boolean testConnection)
-          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");
-            LOG.log(Level.INFO,
-                    "Loading File Manager Configuration Properties from: ["
-                            + configFile + "]");
-            try {
-                System.getProperties().load(
-                        new FileInputStream(new File(configFile)));
-            } catch (Exception e) {
-                LOG.log(Level.INFO,
-                        "Error loading configuration properties from: ["
-                                + configFile + "]");
-            }
-
-        }
-
-        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
-                                    .getInteger(
-                                        
"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;
-                            }
-
-                        });
-                CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(
-                        url, client);
-                transport
-                        .setConnectionTimeout(Integer
-                                                  .getInteger(
-                                                      
"org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes",
-                                                      20) * 60 * 1000);
-                transport
-                        .setTimeout(Integer
-                                        .getInteger(
-                                            
"org.apache.oodt.cas.filemgr.system.xmlrpc.requestTimeout.minutes",
-                                            60) * 60 * 1000);
-
-                return transport;
-            }
-
-            public void setProperty(String arg0, Object arg1) {
-            }
-
-        };
-
-        client = new XmlRpcClient(url, transportFactory);
-        fileManagerUrl = url;
-
-        if (testConnection && !isAlive()) {
-            throw new ConnectionException("Exception connecting to filemgr: ["
-                    + this.fileManagerUrl + "]");
-        }
-
-    }
-    
-    public boolean refreshConfigAndPolicy() {
-      boolean success;
-  
-      Vector<Object> argList = new Vector<Object>();
-      try {
-        success = (Boolean) client.execute("filemgr.refreshConfigAndPolicy",
-            argList);
-      } catch (XmlRpcException e) {
-        LOG.log(Level.WARNING, "XmlRpcException when connecting to filemgr: ["
-            + this.fileManagerUrl + "]");
-        success = false;
-      } catch (IOException e) {
-        LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
-            + this.fileManagerUrl + "]");
-        success = false;
-      }
-  
-      return success;
-  }
-
-    public boolean isAlive() {
-        boolean connected;
+  /* our xml rpc client */
+  private XmlRpcClient client = null;
 
-        Vector<Object> argList = new Vector<Object>();
-        try {
-            connected = (Boolean) client.execute("filemgr.isAlive", argList);
-        } catch (XmlRpcException e) {
-            LOG.log(Level.WARNING,
-                    "XmlRpcException when connecting to filemgr: ["
-                            + this.fileManagerUrl + "]");
-            connected = false;
-        } catch (IOException e) {
-            LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
-                    + this.fileManagerUrl + "]");
-            connected = false;
-        }
+  /* our log stream */
+  private static Logger LOG = Logger.getLogger(XmlRpcFileManagerClient.class
+      .getName());
 
-        return connected;
-    }
+  /* file manager url */
+  private URL fileManagerUrl = null;
 
-    public boolean transferringProduct(Product product)
-            throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
+  /* data transferer needed if client is request to move files itself */
+  private DataTransfer dataTransfer = null;
 
-        boolean success;
+  public XmlRpcFileManagerClient(final URL url) throws ConnectionException {
+    this(url, true);
+  }
 
-        try {
-            success = (Boolean) client.execute("filemgr.transferringProduct",
-                argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  /**
+   * <p> Constructs a new XmlRpcFileManagerClient with the given 
<code>url</code>. </p>
+   *
+   * @param url            The url pointer to the xml rpc file manager service.
+   * @param testConnection Whether or not to check if server at given url is 
alive.
+   */
+  public XmlRpcFileManagerClient(final URL url, boolean testConnection)
+      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");
+      LOG.log(Level.INFO,
+          "Loading File Manager Configuration Properties from: ["
+          + configFile + "]");
+      try {
+        System.getProperties().load(
+            new FileInputStream(new File(configFile)));
+      } catch (Exception e) {
+        LOG.log(Level.INFO,
+            "Error loading configuration properties from: ["
+            + configFile + "]");
+      }
 
-        return success;
     }
 
-    public boolean removeProductTransferStatus(Product product)
-            throws DataTransferException {
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productHash);
-
-        boolean success;
+    XmlRpcTransportFactory transportFactory = new XmlRpcTransportFactory() {
 
-        try {
-            success = (Boolean) client.execute(
-                "filemgr.removeProductTransferStatus", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+      public XmlRpcTransport createTransport()
+          throws XmlRpcClientException {
+        HttpClient client = new HttpClient();
+        client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
+            new HttpMethodRetryHandler() {
 
-        return success;
-    }
+              public boolean retryMethod(HttpMethod method,
+                                         IOException e, int count) {
+                if (count < Integer
+                    .getInteger(
+                        
"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;
+              }
+
+            });
+        CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(
+            url, client);
+        transport
+            .setConnectionTimeout(Integer
+                                      .getInteger(
+                                          
"org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes",
+                                          20) * 60 * 1000);
+        transport
+            .setTimeout(Integer
+                            .getInteger(
+                                
"org.apache.oodt.cas.filemgr.system.xmlrpc.requestTimeout.minutes",
+                                60) * 60 * 1000);
+
+        return transport;
+      }
 
-    public boolean isTransferComplete(Product product)
-            throws DataTransferException {
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productHash);
+      public void setProperty(String arg0, Object arg1) {
+      }
 
-        boolean success;
+    };
 
-        try {
-            success = (Boolean) client.execute("filemgr.isTransferComplete",
-                argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+    client = new XmlRpcClient(url, transportFactory);
+    fileManagerUrl = url;
 
-        return success;
+    if (testConnection && !isAlive()) {
+      throw new ConnectionException("Exception connecting to filemgr: ["
+                                    + this.fileManagerUrl + "]");
     }
 
-    public boolean moveProduct(Product product, String newPath)
-            throws DataTransferException {
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productHash);
-        argList.add(newPath);
-
-        boolean success;
+  }
 
-        try {
-            success = (Boolean) client.execute("filemgr.moveProduct", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  public boolean refreshConfigAndPolicy() {
+    boolean success;
 
-        return success;
+    Vector<Object> argList = new Vector<Object>();
+    try {
+      success = (Boolean) client.execute("filemgr.refreshConfigAndPolicy",
+          argList);
+    } catch (XmlRpcException e) {
+      LOG.log(Level.WARNING, "XmlRpcException when connecting to filemgr: ["
+                             + this.fileManagerUrl + "]");
+      success = false;
+    } catch (IOException e) {
+      LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
+                             + this.fileManagerUrl + "]");
+      success = false;
     }
 
-    public boolean modifyProduct(Product product) throws CatalogException {
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productHash);
-
-        boolean success;
-
-        try {
-            success = (Boolean) client.execute("filemgr.modifyProduct",
-                argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    return success;
+  }
 
-        return success;
+  public boolean isAlive() {
+    boolean connected;
 
+    Vector<Object> argList = new Vector<Object>();
+    try {
+      connected = (Boolean) client.execute("filemgr.isAlive", argList);
+    } catch (XmlRpcException e) {
+      LOG.log(Level.WARNING,
+          "XmlRpcException when connecting to filemgr: ["
+          + this.fileManagerUrl + "]");
+      connected = false;
+    } catch (IOException e) {
+      LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
+                             + this.fileManagerUrl + "]");
+      connected = false;
     }
 
-    public boolean removeProduct(Product product) throws CatalogException {
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productHash);
-
-        boolean success;
+    return connected;
+  }
 
-        try {
-            success = (Boolean) client.execute("filemgr.removeProduct",
-                argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  public boolean transferringProduct(Product product)
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
 
-        return success;
+    boolean success;
 
+    try {
+      success = (Boolean) client.execute("filemgr.transferringProduct",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public FileTransferStatus getCurrentFileTransfer()
-            throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-
-        Map<String, Object> statusHash;
-        FileTransferStatus status = null;
+    return success;
+  }
 
-        try {
-            statusHash = (Map<String, Object>) client.execute(
-                    "filemgr.getCurrentFileTransfer", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  public boolean removeProductTransferStatus(Product product)
+      throws DataTransferException {
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productHash);
 
-        if (statusHash != null) {
-            status = XmlRpcStructFactory
-                    .getFileTransferStatusFromXmlRpc(statusHash);
-        }
+    boolean success;
 
-        return status;
+    try {
+      success = (Boolean) client.execute(
+          "filemgr.removeProductTransferStatus", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<FileTransferStatus> getCurrentFileTransfers()
-            throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-
-        Vector<Map<String, Object>> statusVector;
-        List<FileTransferStatus> statuses = null;
+    return success;
+  }
 
-        try {
-            statusVector = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.getCurrentFileTransfers", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  public boolean isTransferComplete(Product product)
+      throws DataTransferException {
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productHash);
 
-        if (statusVector != null) {
-            statuses = XmlRpcStructFactory
-                    .getFileTransferStatusesFromXmlRpc(statusVector);
-        }
+    boolean success;
 
-        return statuses;
+    try {
+      success = (Boolean) client.execute("filemgr.isTransferComplete",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    public double getProductPctTransferred(Product product)
-            throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
-        Double pct;
+    return success;
+  }
 
-        try {
-            pct = (Double) client.execute("filemgr.getProductPctTransferred",
-                    argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  public boolean moveProduct(Product product, String newPath)
+      throws DataTransferException {
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productHash);
+    argList.add(newPath);
 
-        if (pct != null) {
-            return pct;
-        }
+    boolean success;
 
-        return -1.0;
+    try {
+      success = (Boolean) client.execute("filemgr.moveProduct", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    public double getRefPctTransferred(Reference reference)
-            throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> refHash = XmlRpcStructFactory
-                .getXmlRpcReference(reference);
-        argList.add(refHash);
-        Double pct;
-
-        try {
-            pct = (Double) client.execute("filemgr.getRefPctTransferred",
-                    argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
-
-        if (pct != null) {
-            return pct;
-        }
-
-        return -1.0;
-    }
+    return success;
+  }
 
-    @SuppressWarnings("unchecked")
-    public ProductPage pagedQuery(Query query, ProductType type, int pageNum)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> queryHash = XmlRpcStructFactory
-                .getXmlRpcQuery(query);
-        Map<String, Object> typeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
-        argList.add(queryHash);
-        argList.add(typeHash);
-        argList.add(pageNum);
+  public boolean modifyProduct(Product product) throws CatalogException {
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
 
-        Map<String, Object> pageHash;
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productHash);
 
-        try {
-            pageHash = (Map<String, Object>) client.execute(
-                    "filemgr.pagedQuery", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    boolean success;
 
-        return XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
+    try {
+      success = (Boolean) client.execute("filemgr.modifyProduct",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public ProductPage getFirstPage(ProductType type) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    return success;
 
-        ProductPage page = null;
-        Map<String, Object> pageHash;
+  }
 
-        try {
-            pageHash = (Map<String, Object>) client.execute(
-                    "filemgr.getFirstPage", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  public boolean removeProduct(Product product) throws CatalogException {
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
 
-        if (pageHash != null) {
-            page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
-        }
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productHash);
 
-        return page;
+    boolean success;
 
+    try {
+      success = (Boolean) client.execute("filemgr.removeProduct",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public ProductPage getLastPage(ProductType type) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    return success;
 
-        ProductPage page = null;
-        Map<String, Object> pageHash;
+  }
 
-        try {
-            pageHash = (Map<String, Object>) client.execute(
-                    "filemgr.getLastPage", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  @SuppressWarnings("unchecked")
+  public FileTransferStatus getCurrentFileTransfer()
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
 
-        if (pageHash != null) {
-            page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
-        }
+    Map<String, Object> statusHash;
+    FileTransferStatus status = null;
 
-        return page;
+    try {
+      statusHash = (Map<String, Object>) client.execute(
+          "filemgr.getCurrentFileTransfer", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public ProductPage getNextPage(ProductType type, ProductPage currPage)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
-        argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
-
-        ProductPage page = null;
-        Map<String, Object> pageHash;
-
-        try {
-            pageHash = (Map<String, Object>) client.execute(
-                    "filemgr.getNextPage", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
-
-        if (pageHash != null) {
-            page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
-        }
-
-        return page;
+    if (statusHash != null) {
+      status = XmlRpcStructFactory
+          .getFileTransferStatusFromXmlRpc(statusHash);
     }
 
-    @SuppressWarnings("unchecked")
-    public ProductPage getPrevPage(ProductType type, ProductPage currPage)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
-        argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
-
-        ProductPage page = null;
-        Map<String, Object> pageHash;
+    return status;
+  }
 
-        try {
-            pageHash = (Map<String, Object>) client.execute(
-                    "filemgr.getPrevPage", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  @SuppressWarnings("unchecked")
+  public List<FileTransferStatus> getCurrentFileTransfers()
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
 
-        if (pageHash != null) {
-            page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
-        }
+    Vector<Map<String, Object>> statusVector;
+    List<FileTransferStatus> statuses = null;
 
-        return page;
+    try {
+      statusVector = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.getCurrentFileTransfers", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    public String addProductType(ProductType type)
-            throws RepositoryManagerException {
-        String productTypeId;
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> typeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
-        argList.add(typeHash);
+    if (statusVector != null) {
+      statuses = XmlRpcStructFactory
+          .getFileTransferStatusesFromXmlRpc(statusVector);
+    }
 
-        try {
-            productTypeId = (String) client.execute("filemgr.addProductType",
-                    argList);
-        } catch (XmlRpcException e) {
-            throw new RepositoryManagerException(e);
-        } catch (IOException e) {
-            throw new RepositoryManagerException(e);
-        }
+    return statuses;
+  }
 
-        return productTypeId;
+  public double getProductPctTransferred(Product product)
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
+    Double pct;
 
+    try {
+      pct = (Double) client.execute("filemgr.getProductPctTransferred",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    public boolean hasProduct(String productName) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productName);
+    if (pct != null) {
+      return pct;
+    }
 
-        boolean hasProduct;
+    return -1.0;
+  }
 
-        try {
-            hasProduct = (Boolean) client.execute("filemgr.hasProduct",
-                argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  public double getRefPctTransferred(Reference reference)
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> refHash = XmlRpcStructFactory
+        .getXmlRpcReference(reference);
+    argList.add(refHash);
+    Double pct;
 
-        return hasProduct;
+    try {
+      pct = (Double) client.execute("filemgr.getRefPctTransferred",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
+    }
 
+    if (pct != null) {
+      return pct;
     }
 
-    public int getNumProducts(ProductType type) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    return -1.0;
+  }
 
-        Integer numProducts;
+  @SuppressWarnings("unchecked")
+  public ProductPage pagedQuery(Query query, ProductType type, int pageNum)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> queryHash = XmlRpcStructFactory
+        .getXmlRpcQuery(query);
+    Map<String, Object> typeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
+    argList.add(queryHash);
+    argList.add(typeHash);
+    argList.add(pageNum);
 
-        try {
-            numProducts = (Integer) client.execute("filemgr.getNumProducts",
-                    argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    Map<String, Object> pageHash;
 
-        return numProducts;
+    try {
+      pageHash = (Map<String, Object>) client.execute(
+          "filemgr.pagedQuery", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<Product> getTopNProducts(int n) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(n);
+    return XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
+  }
 
-        Vector<Map<String, Object>> topNProducts;
+  @SuppressWarnings("unchecked")
+  public ProductPage getFirstPage(ProductType type) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
 
-        try {
-            topNProducts = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.getTopNProducts", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    ProductPage page = null;
+    Map<String, Object> pageHash;
 
-      return XmlRpcStructFactory
-              .getProductListFromXmlRpc(topNProducts);
+    try {
+      pageHash = (Map<String, Object>) client.execute(
+          "filemgr.getFirstPage", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<Product> getTopNProducts(int n, ProductType type)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(n);
-        Map<String, Object> productTypeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
-        argList.add(productTypeHash);
-
-        Vector<Map<String, Object>> topNProducts;
+    if (pageHash != null) {
+      page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
+    }
 
-        try {
-            topNProducts = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.getTopNProducts", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    return page;
 
-      return XmlRpcStructFactory
-              .getProductListFromXmlRpc(topNProducts);
-    }
+  }
 
-    public void setProductTransferStatus(Product product)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
+  @SuppressWarnings("unchecked")
+  public ProductPage getLastPage(ProductType type) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
 
-        try {
-            client.execute("filemgr.setProductTransferStatus", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    ProductPage page = null;
+    Map<String, Object> pageHash;
 
+    try {
+      pageHash = (Map<String, Object>) client.execute(
+          "filemgr.getLastPage", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    public void addProductReferences(Product product) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
-
-        try {
-            client.execute("filemgr.addProductReferences", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    if (pageHash != null) {
+      page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
     }
 
-  public void addMetadata(Product product, Metadata metadata)
-      throws CatalogException {
+    return page;
+  }
 
+  @SuppressWarnings("unchecked")
+  public ProductPage getNextPage(ProductType type, ProductPage currPage)
+      throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
-    argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
-    argList.add(metadata.getHashTable());
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
+
+    ProductPage page = null;
+    Map<String, Object> pageHash;
 
     try {
-      client.execute("filemgr.addMetadata", argList);
+      pageHash = (Map<String, Object>) client.execute(
+          "filemgr.getNextPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
       throw new CatalogException(e);
     }
+
+    if (pageHash != null) {
+      page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
+    }
+
+    return page;
   }
 
-  public boolean updateMetadata(Product product, Metadata met)
+  @SuppressWarnings("unchecked")
+  public ProductPage getPrevPage(ProductType type, ProductPage currPage)
       throws CatalogException {
     Vector<Object> argList = new Vector<Object>();
-    argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
-    argList.add(met.getHashTable());
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));
 
-    boolean result;
+    ProductPage page = null;
+    Map<String, Object> pageHash;
 
     try {
-      result = (Boolean) client.execute("filemgr.updateMetadata", argList);
+      pageHash = (Map<String, Object>) client.execute(
+          "filemgr.getPrevPage", argList);
     } catch (XmlRpcException e) {
       throw new CatalogException(e);
     } catch (IOException e) {
       throw new CatalogException(e);
     }
 
-    return result;
+    if (pageHash != null) {
+      page = XmlRpcStructFactory.getProductPageFromXmlRpc(pageHash);
+    }
 
+    return page;
   }
 
-    public String catalogProduct(Product product) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
+  public String addProductType(ProductType type)
+      throws RepositoryManagerException {
+    String productTypeId;
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> typeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
+    argList.add(typeHash);
 
-        String productId;
+    try {
+      productTypeId = (String) client.execute("filemgr.addProductType",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new RepositoryManagerException(e);
+    } catch (IOException e) {
+      throw new RepositoryManagerException(e);
+    }
 
-        try {
-            productId = (String) client.execute("filemgr.catalogProduct",
-                    argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    return productTypeId;
+
+  }
+
+  public boolean hasProduct(String productName) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productName);
+
+    boolean hasProduct;
 
-        return productId;
+    try {
+      hasProduct = (Boolean) client.execute("filemgr.hasProduct",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Metadata getMetadata(Product product) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
+    return hasProduct;
 
-        Map<String, Object> metadata;
+  }
 
-        try {
-            metadata = (Map<String, Object>) client.execute(
-                    "filemgr.getMetadata", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  public int getNumProducts(ProductType type) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
 
-        Metadata m = new Metadata();
-        m.addMetadata(metadata);
-        return m;
+    Integer numProducts;
 
+    try {
+      numProducts = (Integer) client.execute("filemgr.getNumProducts",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Metadata getReducedMetadata(Product product, List<?> elements)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
-        argList.add(new Vector(elements));
-
-        Map<String, Object> metadata;
+    return numProducts;
+  }
 
-        try {
-            metadata = (Map<String, Object>) client.execute(
-                    "filemgr.getReducedMetadata", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+  @SuppressWarnings("unchecked")
+  public List<Product> getTopNProducts(int n) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(n);
 
-        Metadata m = new Metadata();
-        m.addMetadata(metadata);
-        return m;
+    Vector<Map<String, Object>> topNProducts;
 
+    try {
+      topNProducts = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.getTopNProducts", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    public boolean removeFile(String filePath) throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(filePath);
+    return XmlRpcStructFactory
+        .getProductListFromXmlRpc(topNProducts);
+  }
 
-        boolean success;
+  @SuppressWarnings("unchecked")
+  public List<Product> getTopNProducts(int n, ProductType type)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(n);
+    Map<String, Object> productTypeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
+    argList.add(productTypeHash);
 
-        try {
-            success = (Boolean) client.execute("filemgr.removeFile", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+    Vector<Map<String, Object>> topNProducts;
 
-        return success;
+    try {
+      topNProducts = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.getTopNProducts", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-   public byte[] retrieveFile(String filePath, int offset, int numBytes)
-         throws DataTransferException {
-      Vector<Object> argList = new Vector<Object>();
-      argList.add(filePath);
-      argList.add(offset);
-      argList.add(numBytes);
+    return XmlRpcStructFactory
+        .getProductListFromXmlRpc(topNProducts);
+  }
 
-      try {
-         return (byte[]) client.execute("filemgr.retrieveFile", argList);
-      } catch (XmlRpcException e) {
-         throw new DataTransferException(e);
-      } catch (IOException e) {
-         throw new DataTransferException(e);
-      }
-   }
+  public void setProductTransferStatus(Product product)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
 
-    public void transferFile(String filePath, byte[] fileData, int offset,
-            int numBytes) throws DataTransferException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(filePath);
-        argList.add(fileData);
-        argList.add(offset);
-        argList.add(numBytes);
+    try {
+      client.execute("filemgr.setProductTransferStatus", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
+    }
 
-        try {
-            client.execute("filemgr.transferFile", argList);
-        } catch (XmlRpcException e) {
-            throw new DataTransferException(e);
-        } catch (IOException e) {
-            throw new DataTransferException(e);
-        }
+  }
+
+  public void addProductReferences(Product product) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
+
+    try {
+      client.execute("filemgr.addProductReferences", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
+  }
 
-    @SuppressWarnings("unchecked")
-    public List<Product> getProductsByProductType(ProductType type)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productTypeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
-        argList.add(productTypeHash);
+  public void addMetadata(Product product, Metadata metadata)
+      throws CatalogException {
 
-        Vector<Map<String, Object>> productVector;
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
+    argList.add(metadata.getHashTable());
 
-        try {
-            productVector = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.getProductsByProductType", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    try {
+      client.execute("filemgr.addMetadata", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
+    }
+  }
 
-        if (productVector == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getProductListFromXmlRpc(productVector);
-        }
+  public boolean updateMetadata(Product product, Metadata met)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
+    argList.add(met.getHashTable());
+
+    boolean result;
+
+    try {
+      result = (Boolean) client.execute("filemgr.updateMetadata", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<Element> getElementsByProductType(ProductType type)
-            throws ValidationLayerException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> productTypeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
+    return result;
 
-        argList.add(productTypeHash);
+  }
 
-        Vector<Map<String, Object>> elementVector;
+  public String catalogProduct(Product product) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(XmlRpcStructFactory.getXmlRpcProduct(product));
 
-        try {
-            elementVector = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.getElementsByProductType", argList);
-        } catch (XmlRpcException e) {
-            throw new ValidationLayerException(e);
-        } catch (IOException e) {
-            throw new ValidationLayerException(e);
-        }
+    String productId;
 
-        if (elementVector == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getElementListFromXmlRpc(elementVector);
-        }
+    try {
+      productId = (String) client.execute("filemgr.catalogProduct",
+          argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Element getElementById(String elementId)
-            throws ValidationLayerException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(elementId);
+    return productId;
+  }
 
-        Hashtable<String, Object> elementHash;
+  @SuppressWarnings("unchecked")
+  public Metadata getMetadata(Product product) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
 
-        try {
-            elementHash = (Hashtable<String, Object>) client.execute(
-                    "filemgr.getElementById", argList);
-        } catch (XmlRpcException e) {
-            throw new ValidationLayerException(e);
-        } catch (IOException e) {
-            throw new ValidationLayerException(e);
-        }
+    Map<String, Object> metadata;
 
-        if (elementHash == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
-        }
+    try {
+      metadata = (Map<String, Object>) client.execute(
+          "filemgr.getMetadata", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Element getElementByName(String elementName)
-            throws ValidationLayerException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(elementName);
+    Metadata m = new Metadata();
+    m.addMetadata(metadata);
+    return m;
 
-        Hashtable<String, Object> elementHash;
+  }
 
-        try {
-            elementHash = (Hashtable<String, Object>) client.execute(
-                    "filemgr.getElementByName", argList);
-        } catch (XmlRpcException e) {
-            throw new ValidationLayerException(e);
-        } catch (IOException e) {
-            throw new ValidationLayerException(e);
-        }
+  @SuppressWarnings({ "unchecked", "rawtypes" })
+  public Metadata getReducedMetadata(Product product, List<?> elements)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
+    argList.add(new Vector(elements));
 
-        if (elementHash == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
-        }
+    Map<String, Object> metadata;
+
+    try {
+      metadata = (Map<String, Object>) client.execute(
+          "filemgr.getReducedMetadata", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Element getElementByName(String elementName, ProductType type)
-            throws ValidationLayerException {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(elementName);
-        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
+    Metadata m = new Metadata();
+    m.addMetadata(metadata);
+    return m;
 
-        Hashtable<String, Object> elementHash;
+  }
 
-        try {
-            elementHash = (Hashtable<String, Object>) client.execute(
-                    "filemgr.getElementByName", argList);
-        } catch (XmlRpcException e) {
-            throw new ValidationLayerException(e);
-        } catch (IOException e) {
-            throw new ValidationLayerException(e);
-        }
+  public boolean removeFile(String filePath) throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(filePath);
 
-        if (elementHash == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
-        }
-    }
+    boolean success;
 
-    public List<QueryResult> complexQuery(ComplexQuery complexQuery)
-            throws CatalogException {
-        try {
-            Map<String, Object> complexQueryHash = XmlRpcStructFactory
-                    .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);
-            return XmlRpcStructFactory
-                    .getQueryResultsFromXmlRpc(queryResultHashVector);
-        } catch (Exception e) {
-            LOG.log(Level.SEVERE, e.getMessage());
-            throw new CatalogException(e);
-        }
+    try {
+      success = (Boolean) client.execute("filemgr.removeFile", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<Product> query(Query query, ProductType type)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
-        Map<String, Object> queryHash = XmlRpcStructFactory
-                .getXmlRpcQuery(query);
-        Map<String, Object> typeHash = XmlRpcStructFactory
-                .getXmlRpcProductType(type);
-        argList.add(queryHash);
-        argList.add(typeHash);
+    return success;
+  }
 
-        Vector<Map<String, Object>> productVector;
+  public byte[] retrieveFile(String filePath, int offset, int numBytes)
+      throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(filePath);
+    argList.add(offset);
+    argList.add(numBytes);
 
-        try {
-            productVector = (Vector<Map<String, Object>>) client.execute(
-                    "filemgr.query", argList);
-        } catch (XmlRpcException e) {
-            LOG.log(Level.SEVERE, e.getMessage());
-            throw new CatalogException(e);
-
-        } catch (IOException e) {
-            LOG.log(Level.SEVERE, e.getMessage());
-            throw new CatalogException(e);
-        }
+    try {
+      return (byte[]) client.execute("filemgr.retrieveFile", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
+    }
+  }
 
-        if (productVector == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getProductListFromXmlRpc(productVector);
-        }
+  public void transferFile(String filePath, byte[] fileData, int offset,
+                           int numBytes) throws DataTransferException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(filePath);
+    argList.add(fileData);
+    argList.add(offset);
+    argList.add(numBytes);
+
+    try {
+      client.execute("filemgr.transferFile", argList);
+    } catch (XmlRpcException e) {
+      throw new DataTransferException(e);
+    } catch (IOException e) {
+      throw new DataTransferException(e);
     }
+  }
 
-    @SuppressWarnings("unchecked")
-    public ProductType getProductTypeByName(String productTypeName)
-            throws RepositoryManagerException {
-        Hashtable<String, Object> productTypeHash;
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productTypeName);
+  @SuppressWarnings("unchecked")
+  public List<Product> getProductsByProductType(ProductType type)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productTypeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
+    argList.add(productTypeHash);
 
-        try {
-            productTypeHash = (Hashtable<String, Object>) client.execute(
-                    "filemgr.getProductTypeByName", argList);
-        } catch (XmlRpcException e) {
-            throw new RepositoryManagerException(e.getLocalizedMessage());
-        } catch (IOException e) {
-            throw new RepositoryManagerException(e);
-        }
+    Vector<Map<String, Object>> productVector;
 
-        if (productTypeHash == null) {
-            return null;
-        } else {
-          return XmlRpcStructFactory
-              .getProductTypeFromXmlRpc(productTypeHash);
-        }
+    try {
+      productVector = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.getProductsByProductType", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public ProductType getProductTypeById(String productTypeId)
-            throws RepositoryManagerException {
-        Hashtable<String, Object> productTypeHash;
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(productTypeId);
+    if (productVector == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getProductListFromXmlRpc(productVector);
+    }
+  }
 
-        try {
-            productTypeHash = (Hashtable<String, Object>) client.execute(
-                    "filemgr.getProductTypeById", argList);
-        } catch (XmlRpcException e) {
-            throw new RepositoryManagerException(e);
-        } catch (IOException e) {
-            throw new RepositoryManagerException(e);
-        }
+  @SuppressWarnings("unchecked")
+  public List<Element> getElementsByProductType(ProductType type)
+      throws ValidationLayerException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> productTypeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
 
-        if (productTypeHash == null) {
-            return null;
-        } else {
-          return XmlRpcStructFactory
-              .getProductTypeFromXmlRpc(productTypeHash);
-        }
+    argList.add(productTypeHash);
+
+    Vector<Map<String, Object>> elementVector;
+
+    try {
+      elementVector = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.getElementsByProductType", argList);
+    } catch (XmlRpcException e) {
+      throw new ValidationLayerException(e);
+    } catch (IOException e) {
+      throw new ValidationLayerException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<ProductType> getProductTypes()
-            throws RepositoryManagerException {
-        Vector<Object> argList = new Vector<Object>();
+    if (elementVector == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getElementListFromXmlRpc(elementVector);
+    }
+  }
 
-        Vector<Map<String, Object>> productTypeVector;
+  @SuppressWarnings("unchecked")
+  public Element getElementById(String elementId)
+      throws ValidationLayerException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(elementId);
 
-        try {
-            productTypeVector = (Vector<Map<String, Object>>) client
-                    .execute("filemgr.getProductTypes", argList);
-        } catch (XmlRpcException e) {
-            throw new RepositoryManagerException(e);
-        } catch (IOException e) {
-            throw new RepositoryManagerException(e);
-        }
+    Hashtable<String, Object> elementHash;
 
-        if (productTypeVector == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory
-                    .getProductTypeListFromXmlRpc(productTypeVector);
-        }
+    try {
+      elementHash = (Hashtable<String, Object>) client.execute(
+          "filemgr.getElementById", argList);
+    } catch (XmlRpcException e) {
+      throw new ValidationLayerException(e);
+    } catch (IOException e) {
+      throw new ValidationLayerException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public List<Reference> getProductReferences(Product product)
-            throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
+    if (elementHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
+    }
+  }
 
-        Vector<Map<String, Object>> productReferenceVector;
-        Map<String, Object> productHash = XmlRpcStructFactory
-                .getXmlRpcProduct(product);
-        argList.add(productHash);
+  @SuppressWarnings("unchecked")
+  public Element getElementByName(String elementName)
+      throws ValidationLayerException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(elementName);
 
-        try {
-            productReferenceVector = (Vector<Map<String, Object>>) client
-                    .execute("filemgr.getProductReferences", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    Hashtable<String, Object> elementHash;
 
-        if (productReferenceVector == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory
-                    .getReferencesFromXmlRpc(productReferenceVector);
-        }
+    try {
+      elementHash = (Hashtable<String, Object>) client.execute(
+          "filemgr.getElementByName", argList);
+    } catch (XmlRpcException e) {
+      throw new ValidationLayerException(e);
+    } catch (IOException e) {
+      throw new ValidationLayerException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Product getProductById(String productId) throws CatalogException {
-        Vector<Object> argList = new Vector<Object>();
+    if (elementHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
+    }
+  }
 
-        Map<String, Object> productHash;
-        argList.add(productId);
+  @SuppressWarnings("unchecked")
+  public Element getElementByName(String elementName, ProductType type)
+      throws ValidationLayerException {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(elementName);
+    argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
 
-        try {
-            productHash = (Map<String, Object>) client.execute(
-                    "filemgr.getProductById", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    Hashtable<String, Object> elementHash;
 
-        if (productHash == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getProductFromXmlRpc(productHash);
-        }
+    try {
+      elementHash = (Hashtable<String, Object>) client.execute(
+          "filemgr.getElementByName", argList);
+    } catch (XmlRpcException e) {
+      throw new ValidationLayerException(e);
+    } catch (IOException e) {
+      throw new ValidationLayerException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Product getProductByName(String productName) throws 
CatalogException {
-        Vector<Object> argList = new Vector<Object>();
+    if (elementHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getElementFromXmlRpc(elementHash);
+    }
+  }
+
+  public List<QueryResult> complexQuery(ComplexQuery complexQuery)
+      throws CatalogException {
+    try {
+      Map<String, Object> complexQueryHash = XmlRpcStructFactory
+          .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);
+      return XmlRpcStructFactory
+          .getQueryResultsFromXmlRpc(queryResultHashVector);
+    } catch (Exception e) {
+      LOG.log(Level.SEVERE, e.getMessage());
+      throw new CatalogException(e);
+    }
+  }
 
-        Map<String, Object> productHash;
-        argList.add(productName);
+  @SuppressWarnings("unchecked")
+  public List<Product> query(Query query, ProductType type)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
+    Map<String, Object> queryHash = XmlRpcStructFactory
+        .getXmlRpcQuery(query);
+    Map<String, Object> typeHash = XmlRpcStructFactory
+        .getXmlRpcProductType(type);
+    argList.add(queryHash);
+    argList.add(typeHash);
 
-        try {
-            productHash = (Map<String, Object>) client.execute(
-                    "filemgr.getProductByName", argList);
-        } catch (XmlRpcException e) {
-            throw new CatalogException(e);
-        } catch (IOException e) {
-            throw new CatalogException(e);
-        }
+    Vector<Map<String, Object>> productVector;
 
-        if (productHash == null) {
-            return null;
-        } else {
-            return XmlRpcStructFactory.getProductFromXmlRpc(productHash);
-        }
+    try {
+      productVector = (Vector<Map<String, Object>>) client.execute(
+          "filemgr.query", argList);
+    } catch (XmlRpcException e) {
+      LOG.log(Level.SEVERE, e.getMessage());
+      throw new CatalogException(e);
+
+    } catch (IOException e) {
+      LOG.log(Level.SEVERE, e.getMessage());
+      throw new CatalogException(e);
     }
 
-    public String ingestProduct(Product product, Metadata metadata,
-            boolean clientTransfer) throws VersioningException, 
XmlRpcException, FileManagerException {
-        try {
-            // ingest product
-            Vector<Object> argList = new Vector<Object>();
-            Map<String, Object> productHash = XmlRpcStructFactory
-                    .getXmlRpcProduct(product);
-            argList.add(productHash);
-            argList.add(metadata.getHashTable());
-            argList.add(clientTransfer);
-            String productId = (String) client.execute("filemgr.ingestProduct",
-                    argList);
-
-            if (clientTransfer) {
-                LOG.log(Level.FINEST,
-                        "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");
-                }
+    if (productVector == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getProductListFromXmlRpc(productVector);
+    }
+  }
 
-                if (dataTransfer == null) {
-                    throw new Exception("Request to ingest product: ["
-                            + product.getProductName()
-                            + "] using client transfer, but no "
-                            + "dataTransferer specified!");
-                }
+  @SuppressWarnings("unchecked")
+  public ProductType getProductTypeByName(String productTypeName)
+      throws RepositoryManagerException {
+    Hashtable<String, Object> productTypeHash;
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productTypeName);
 
-                product.setProductId(productId);
+    try {
+      productTypeHash = (Hashtable<String, Object>) client.execute(
+          "filemgr.getProductTypeByName", argList);
+    } catch (XmlRpcException e) {
+      throw new RepositoryManagerException(e.getLocalizedMessage());
+    } catch (IOException e) {
+      throw new RepositoryManagerException(e);
+    }
 
-                if 
(!Boolean.getBoolean("org.apache.oodt.cas.filemgr.serverside.versioning")) {
-                  // version the product
-                  Versioner versioner = GenericFileManagerObjectFactory
-                          .getVersionerFromClassName(product.getProductType()
-                                  .getVersioner());
-                  if (versioner != null) {
-                    versioner.createDataStoreReferences(product, metadata);
-                  }
+    if (productTypeHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory
+          .getProductTypeFromXmlRpc(productTypeHash);
+    }
+  }
 
-                  // add the newly versioned references to the data store
-                  try {
-                      addProductReferences(product);
-                  } catch (CatalogException e) {
-                      LOG
-                              .log(
-                                      Level.SEVERE,
-                                      "ingestProduct: 
RepositoryManagerException "
-                                              + "when adding Product 
References for Product : "
-                                              + product.getProductName()
-                                              + " to RepositoryManager: 
Message: "
-                                              + e);
-                      throw e;
-                  }
-                } else {
-                  product.setProductReferences(getProductReferences(product));
-                }
-                
-                // now transfer the product
-                try {
-                    dataTransfer.transferProduct(product);
-                    // now update the product's transfer status in the data
-                    // store
-                    product.setTransferStatus(Product.STATUS_RECEIVED);
-
-                    try {
-                        setProductTransferStatus(product);
-                    } catch (CatalogException e) {
-                        LOG
-                                .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);
-                    throw new DataTransferException(e);
-                }
+  @SuppressWarnings("unchecked")
+  public ProductType getProductTypeById(String productTypeId)
+      throws RepositoryManagerException {
+    Hashtable<String, Object> productTypeHash;
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(productTypeId);
 
-            }
-            return productId;
-
-            // error versioning file
-        } 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);
-            throw new VersioningException(e);
-        } catch(XmlRpcException e2){
-          LOG.log(Level.SEVERE, "Failed to ingest product [ name:" 
+product.getProductName() + "] :" + e2.getMessage() + " -- rolling back 
ingest");
-          try {
-            Vector<Object> argList = new Vector<Object>();
-            Map<String, Object> productHash = XmlRpcStructFactory
-                .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());
-          }
-          throw e2;
-        }
-        catch (Exception e) {
-          LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + 
product.getProductId() +
-                                "/ name:" +product.getProductName() + "] :" + 
e + " -- rolling back ingest");
-            try {
-                Vector<Object> argList = new Vector<Object>();
-                Map<String, Object> productHash = XmlRpcStructFactory
-                        .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);
-            }
-            throw new FileManagerException("Failed to ingest product [" + 
product + "] : "
-                    + e);
-        }
+    try {
+      productTypeHash = (Hashtable<String, Object>) client.execute(
+          "filemgr.getProductTypeById", argList);
+    } catch (XmlRpcException e) {
+      throw new RepositoryManagerException(e);
+    } catch (IOException e) {
+      throw new RepositoryManagerException(e);
+    }
 
+    if (productTypeHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory
+          .getProductTypeFromXmlRpc(productTypeHash);
     }
+  }
+
+  @SuppressWarnings("unchecked")
+  public List<ProductType> getProductTypes()
+      throws RepositoryManagerException {
+    Vector<Object> argList = new Vector<Object>();
 
-    @SuppressWarnings("unchecked")
-    public Metadata getCatalogValues(Metadata metadata, ProductType 
productType)
-            throws XmlRpcException, IOException {
-        Vector<Object> args = new Vector<Object>();
-        args.add(metadata.getHashTable());
-        args.add(XmlRpcStructFactory.getXmlRpcProductType(productType));
+    Vector<Map<String, Object>> productTypeVector;
 
-        Metadata m = new Metadata();
-        m.addMetadata((Map<String, Object>) this.client.execute(
-                "filemgr.getCatalogValues", args));
+    try {
+      productTypeVector = (Vector<Map<String, Object>>) client
+          .execute("filemgr.getProductTypes", argList);
+    } catch (XmlRpcException e) {
+      throw new RepositoryManagerException(e);
+    } catch (IOException e) {
+      throw new RepositoryManagerException(e);
+    }
 
-        return m;
+    if (productTypeVector == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory
+          .getProductTypeListFromXmlRpc(productTypeVector);
     }
+  }
 
-    @SuppressWarnings("unchecked")
-    public Metadata getOrigValues(Metadata metadata, ProductType productType)
-            throws XmlRpcException, IOException {
-        Vector<Object> args = new Vector<Object>();
-        args.add(metadata.getHashTable());
-        args.add(XmlRpcStructFactory.getXmlRpcProductType(productType));
+  @SuppressWarnings("unchecked")
+  public List<Reference> getProductReferences(Product product)
+      throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
 
-        Metadata m = new Metadata();
-        m.addMetadata((Map<String, Object>) this.client.execute(
-                "filemgr.getOrigValues", args));
+    Vector<Map<String, Object>> productReferenceVector;
+    Map<String, Object> productHash = XmlRpcStructFactory
+        .getXmlRpcProduct(product);
+    argList.add(productHash);
 
-        return m;
+    try {
+      productReferenceVector = (Vector<Map<String, Object>>) client
+          .execute("filemgr.getProductReferences", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    @SuppressWarnings("unchecked")
-    public Query getCatalogQuery(Query query, ProductType productType)
-            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));
+    if (productReferenceVector == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory
+          .getReferencesFromXmlRpc(productReferenceVector);
     }
+  }
+
+  @SuppressWarnings("unchecked")
+  public Product getProductById(String productId) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
 
-    public static void main(String[] args) {
-       CmdLineUtility cmdLineUtility = new CmdLineUtility();
-       cmdLineUtility.run(args);
+    Map<String, Object> productHash;
+    argList.add(productId);
+
+    try {
+      productHash = (Map<String, Object>) client.execute(
+          "filemgr.getProductById", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    /**
-     * @return Returns the fileManagerUrl.
-     */
-    public URL getFileManagerUrl() {
-        return fileManagerUrl;
+    if (productHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getProductFromXmlRpc(productHash);
     }
+  }
+
+  @SuppressWarnings("unchecked")
+  public Product getProductByName(String productName) throws CatalogException {
+    Vector<Object> argList = new Vector<Object>();
 
-    /**
-     * @param fileManagerUrl
-     *            The fileManagerUrl to set.
-     */
-    public void setFileManagerUrl(URL fileManagerUrl) {
-        this.fileManagerUrl = fileManagerUrl;
+    Map<String, Object> productHash;
+    argList.add(productName);
 
-        // reset the client
-        this.client = new XmlRpcClient(fileManagerUrl);
+    try {
+      productHash = (Map<String, Object>) client.execute(
+          "filemgr.getProductByName", argList);
+    } catch (XmlRpcException e) {
+      throw new CatalogException(e);
+    } catch (IOException e) {
+      throw new CatalogException(e);
     }
 
-    /**
-     * @return Returns the dataTransfer.
-     */
-    public DataTransfer getDataTransfer() {
-        return dataTransfer;
+    if (productHash == null) {
+      return null;
+    } else {
+      return XmlRpcStructFactory.getProductFromXmlRpc(productHash);
     }
+  }
 
-    /**
-     * @param dataTransfer
-     *            The dataTransfer to set.
-     */
-    public void setDataTransfer(DataTransfer dataTransfer) {
-        this.dataTransfer = dataTransfer;
-        this.dataTransfer.setFileManagerUrl(this.fileManagerUrl);
+  public String ingestProduct(Product product, Metadata metadata,
+                              boolean clientTransfer)
+      throws VersioningException, XmlRpcException, FileManagerException {
+    try {
+      // ingest product
+      Vector<Object> argList = new Vector<Object>();
+      Map<String, Object> productHash = XmlRpcStructFactory
+          .getXmlRpcProduct(product);
+      argList.add(productHash);
+      argList.add(metadata.getHashTable());
+      argList.add(clientTransfer);
+      String productId = (String) client.execute("filemgr.ingestProduct",
+          argList);
+
+      if (clientTransfer) {
+        LOG.log(Level.FINEST,
+            "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");
+        }
+
+        if (dataTransfer == null) {
+          throw new Exception("Request to ingest product: ["
+                              + product.getProductName()
+                              + "] using client transfer, but no "
+                              + "dataTransferer specified!");
+        }
+
+        product.setProductId(productId);
+
+        if 
(!Boolean.getBoolean("org.apache.oodt.cas.filemgr.serverside.versioning")) {
+          // version the product
+          Versioner versioner = GenericFileManagerObjectFactory
+              .getVersionerFromClassName(product.getProductType()
+                                                .getVersioner());
+          if (versioner != null) {
+            versioner.createDataStoreReferences(product, metadata);
+          }
+
+          // add the newly versioned references to the data store
+          try {
+            addProductReferences(product);
+          } catch (CatalogException e) {
+            LOG
+                .log(
+                    Level.SEVERE,
+                    "ingestProduct: RepositoryManagerException "
+                    + "when adding Product References for Product : "
+                    + product.getProductName()
+                    + " to RepositoryManager: Message: "
+                    + e);
+            throw e;
+          }
+        } else {
+          product.setProductReferences(getProductReferences(product));
+        }
+
+        // now transfer the product
+        try {
+          dataTransfer.transferProduct(product);
+          // now update the product's transfer status in the data
+          // store
+          product.setTransferStatus(Product.STATUS_RECEIVED);
+
+          try {
+            setProductTransferStatus(product);
+          } catch (CatalogException e) {
+            LOG
+                .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);
+          throw new DataTransferException(e);
+        }
+
+      }
+      return productId;
+
+      // error versioning file
+    } 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);
+      throw new VersioningException(e);
+    } catch (XmlRpcException e2) {
+      LOG.log(Level.SEVERE, "Failed to ingest product [ name:" + 
product.getProductName() + "] :" + e2.getMessage()
+                            + " -- rolling back ingest");
+      try {
+        Vector<Object> argList = new Vector<Object>();
+        Map<String, Object> productHash = XmlRpcStructFactory
+            .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());
+      }
+      throw e2;
+    } catch (Exception e) {
+      LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + 
product.getProductId() +
+                            "/ name:" + product.getProductName() + "] :" + e + 
" -- rolling back ingest");
+      try {
+        Vector<Object> argList = new Vector<Object>();
+        Map<String, Object> productHash = XmlRpcStructFactory
+            .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);
+      }
+      throw new FileManagerException("Failed to ingest product [" + product + 
"] : "
+                                     + e);
     }
 
+  }
+
+  @SuppressWarnings("unchecked")
+  public Metadata getCatalogValues(Metadata metadata, ProductType productType)
+      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));
+
+    return m;
+  }
+
+  @SuppressWarnings("unchecked")
+  public Metadata getOrigValues(Metadata metadata, ProductType productType)
+      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));
+
+    return m;
+  }
+
+  @SuppressWarnings("unchecked")
+  public Query getCatalogQuery(Query query, ProductType productType)
+      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));
+  }
+
+  public static void main(String[] args) {
+    CmdLineUtility cmdLineUtility = new CmdLineUtility();
+    cmdLineUtility.run(args);
+  }
+
+  /**
+   * @return Returns the fileManagerUrl.
+   */
+  public URL getFileManagerUrl() {
+    return fileManagerUrl;
+  }
+
+  /**
+   * @param fileManagerUrl The fileManagerUrl to set.
+   */
+  public void setFileManagerUrl(URL fileManagerUrl) {
+    this.fileManagerUrl = fileManagerUrl;
+
+    // reset the client
+    this.client = new XmlRpcClient(fileManagerUrl);
+  }
+
+  /**
+   * @return Returns the dataTransfer.
+   */
+  public DataTransfer getDataTransfer() {
+    return dataTransfer;
+  }
+
+  /**
+   * @param dataTransfer The dataTransfer to set.
+   */
+  public void setDataTransfer(DataTransfer dataTransfer) {
+    this.dataTransfer = dataTransfer;
+    this.dataTransfer.setFileManagerUrl(this.fileManagerUrl);
+  }
+
 }

Reply via email to