You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/07/12 22:02:14 UTC

svn commit: r963455 - in /incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc: XmlRpcCatalogClient.java XmlRpcCommunicationChannelClient.java

Author: mattmann
Date: Mon Jul 12 20:02:14 2010
New Revision: 963455

URL: http://svn.apache.org/viewvc?rev=963455&view=rev
Log:
- progress towards OODT-15 One trunk for all OODT components with top level build

Added:
    incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCatalogClient.java
      - copied, changed from r963452, incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
Removed:
    incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java

Copied: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCatalogClient.java (from r963452, incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java)
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCatalogClient.java?p2=incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCatalogClient.java&p1=incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java&r1=963452&r2=963455&rev=963455&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCatalogClient.java Mon Jul 12 20:02:14 2010
@@ -1,4 +1,4 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -32,11 +32,11 @@ import org.apache.xmlrpc.XmlRpcClient;
 
 //OODT imports
 import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
+import org.apache.oodt.cas.catalog.pagiantion.CatalogReceipt;
+import org.apache.oodt.cas.catalog.pagination.Page;
+import org.apache.oodt.cas.catalog.pagination.PageInfo;
+import org.apache.oodt.cas.catalog.pagination.QueryPager;
+import org.apache.oodt.cas.catalog.pagination.TransactionReceipt;
 import org.apache.oodt.cas.catalog.query.QueryExpression;
 import org.apache.oodt.cas.catalog.server.channel.AbstractCommunicationChannelClient;
 import org.apache.oodt.cas.catalog.struct.Dictionary;
@@ -47,397 +47,420 @@ import org.apache.oodt.cas.catalog.util.
 import org.apache.oodt.cas.metadata.Metadata;
 
 /**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Communication Channel Client over XML-RPC
- * <p>
+ * 
+ * XML-RPC implementation of the Catalog Server.
+ * 
  */
-public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChannelClient {
+public class XmlRpcCommunicationChannelClient extends
+    AbstractCommunicationChannelClient {
 
-	protected XmlRpcClient client;
-	protected int chunkSize;
-	
-	public XmlRpcCommunicationChannelClient(URL serverUrl, int connectionTimeout, int requestTimeout, int chunkSize) {
-		super();
-        CommonsXmlRpcTransportFactory transportFactory = new CommonsXmlRpcTransportFactory(serverUrl);
-        transportFactory.setConnectionTimeout(connectionTimeout * 60 * 1000);
-        transportFactory.setTimeout(requestTimeout * 60 * 1000);        
-		this.client = new XmlRpcClient(serverUrl, transportFactory);
-		this.chunkSize = chunkSize;
-	}
-	
-	public void shutdown() throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_shutdown", args);
-	}
-
-	public void addCatalog(Catalog catalog) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalog));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
-	}
-	
-	public void replaceCatalog(Catalog catalog) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalog));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args);	
-	}
-	
-	public void addCatalog(String catalogId, Index index) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(index));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
-	}
-	
-	public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(index));
-		args.add(this.serializer.serializeObject(dictionaries));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
-	}
-
-	public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(index));
-		args.add(this.serializer.serializeObject(dictionaries));
-		args.add(restrictQueryPermission);
-		args.add(restrictIngestPermission);
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
-	}
-
-	public void addDictionary(String catalogId, Dictionary dictionary) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(dictionary));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
-	}
-	
-	public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(dictionaries));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
-	}
-
-	public void replaceIndex(String catalogId, Index index) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(index));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceIndex", args);
-	}
-
-	public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(restrictIngestPermission));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyIngestPermission", args);
-	}
-	
-	public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogId);
-		args.add(this.serializer.serializeObject(restrictQueryPermission));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyQueryPermission", args);
-	}
-	
-	public List<PluginURL> getPluginUrls() throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginUrls", args));
-	}
-	
-	public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(pluginURLs));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addPluginUrls", args);
-	}
-	
-	public URL getPluginStorageDir() throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args));	
-	}
-	
-	public void transferUrl(URL fromUrl, URL toURL) throws Exception {
-		System.out.println("Transfering '" + fromUrl + "' to '" + toURL + "'");
-        FileInputStream is = null;
-        try {
-            byte[] buf = new byte[this.chunkSize];
-	        is = new FileInputStream(new File(fromUrl.getPath()));
-            int offset = 0;
-            int numBytes = 0;
-	        while ((numBytes = is.read(buf, offset, chunkSize)) != -1)
-	            this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes);
-        }catch (Exception e) {
-        	throw e;
-        }finally {
-        	try {
-        		is.close();
-        	}catch(Exception e) {}
-        }
-	}
-	
-    protected void transferFile(String filePath, byte[] fileData, int offset,
-            int numBytes) throws Exception {
-        Vector<Object> argList = new Vector<Object>();
-        argList.add(filePath);
-        argList.add(fileData);
-        argList.add(new Integer(offset));
-        argList.add(new Integer(numBytes));
-        client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList);
-    }
+  protected XmlRpcClient client;
+  protected int chunkSize;
 
-	public void delete(Metadata metadata) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(metadata));
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args);		
-	}
-
-	public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryPager));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getAllPages", args));
-	}
-
-	public Properties getCalalogProperties() throws Exception {
-		return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", new Vector<Object>()));
-	}
-
-	public Properties getCalalogProperties(String catalogUrn)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogUrn);
-		return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", args));
-	}
-
-//	public Catalog getCatalog(String catalogUrn) throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(catalogUrn);
-//		return this.serializer.deserializeObject(Catalog.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalog", args));
-//	}
-
-//	public CatalogRepository getCatalogRepository()
-//			throws Exception {
-//		return this.serializer.deserializeObject(CatalogRepository.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogRepository", new Vector<Object>()));
-//	}
-
-	public TransactionId<?> getCatalogServiceTransactionId(
-			TransactionId<?> catalogTransactionId, String catalogUrn)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalogTransactionId));
-		args.add(catalogUrn);
-		return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
-	}
-
-	public TransactionId<?> getCatalogServiceTransactionId(
-			CatalogReceipt catalogReceipt,
-			boolean generateNew) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalogReceipt));
-		args.add(this.serializer.serializeObject(new Boolean(generateNew)));
-		return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId2", args));
-	}
-
-	public List<TransactionId<?>> getCatalogServiceTransactionIds(
-			List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalogTransactionIds));
-		args.add(catalogUrn);
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
-	}
-
-	public Set<String> getCurrentCatalogIds() throws Exception {
-		return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogIds", new Vector<Object>()));
-	}
-
-//	public Set<Catalog> getCurrentCatalogList() throws Exception {
-//		return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogList", new Vector<Object>()));
-//	}
-//
-//	public IngestMapper getIngestMapper() throws Exception { 
-//		return this.serializer.deserializeObject(IngestMapper.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getIngestMapper", new Vector<Object>()));
-//	}
-
-	public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
-			List<String> catalogServiceTransactionIdStrings)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalogServiceTransactionIdStrings));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIdStrings", args));
-	}
-
-	public List<TransactionalMetadata> getMetadataFromTransactionIds(
-			List<TransactionId<?>> catalogServiceTransactionIds)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(catalogServiceTransactionIds));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIds", args));
-	}
-
-	public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryPager));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage", args));
-	}
-
-	public List<String> getProperty(String key) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(key);
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getProperty", args));
-	}
-
-	public Class<? extends TransactionId<?>> getTransactionIdClass() throws Exception {
-		return this.serializer.deserializeObject(Class.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdClass", new Vector<Object>()));
-	}
-
-	public List<TransactionId<?>> getTransactionIdsForAllPages(
-			QueryPager queryPager) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryPager));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdsForAllPages", args));
-	}
-
-	public TransactionReceipt ingest(Metadata metadata)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(metadata));
-		return this.serializer.deserializeObject(TransactionReceipt.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_ingest", args));
-	}
-
-	public boolean isRestrictIngestPermissions() throws Exception {
-		return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictIngestPermissions", new Vector<Object>()));
-	}
-
-	public boolean isRestrictQueryPermissions() throws Exception {
-		return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictQueryPermissions", new Vector<Object>()));
-	}
-
-	public Page getFirstPage(QueryExpression queryExpression) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
-	}
-
-	public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		args.add(this.serializer.serializeObject(catalogIds));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
-	}
-	
-	public Page getNextPage(Page page) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(page));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage2", args));
-	}
-	
-	public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(pageInfo));
-		args.add(this.serializer.serializeObject(queryExpression));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
-	}
-	
-	public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(pageInfo));
-		args.add(this.serializer.serializeObject(queryExpression));
-		args.add(this.serializer.serializeObject(catalogIds));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
-	}
-	
-	public Page getLastPage(QueryExpression queryExpression) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
-	}
-
-	public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		args.add(this.serializer.serializeObject(catalogIds));
-		return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
-	}
-	
-	public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(page));
-		return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadata", args));
-	}
-	
-	public QueryPager query(QueryExpression queryExpression)
-			throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
-	}
-
-	public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(this.serializer.serializeObject(queryExpression));
-		args.add(this.serializer.serializeObject(catalogIds));
-		return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
-	}
-	
-//	public QueryPager query(QueryExpression queryExpression, boolean sortResults)
-//			throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(queryExpression));
-//		args.add(this.serializer.serializeObject(new Boolean(sortResults)));
-//		return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
-//	}
-
-	public void removeCatalog(String catalogUrn) throws Exception {
-		Vector<Object> args = new Vector<Object>();
-		args.add(catalogUrn);
-		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args);		
-	}
-
-//	public void removeCatalog(String catalogUrn, boolean preserveMapping)
-//			throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(catalogUrn);
-//		args.add(this.serializer.serializeObject(new Boolean(preserveMapping)));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args);		
-//	}
-
-//	public void setCatalogRepository(CatalogRepository catalogRepository)
-//			throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(catalogRepository));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setCatalogRepository", args);
-//	}
-
-//	public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(new Boolean(restrictIngestPermissions)));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setHasIngestPermissions", args);		
-//	}
-
-//	public void setIngestMapper(IngestMapper ingestMapper) throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(ingestMapper));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setIngestMapper", args);		
-//	}
-
-//	public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(new Boolean(restrictQueryPermissions)));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setRestrictQueryPermissions", args);			
-//	}
-
-//	public void setTransactionIdClass(
-//			Class<? extends TransactionId<?>> transactionIdClass) throws Exception {
-//		Vector<Object> args = new Vector<Object>();
-//		args.add(this.serializer.serializeObject(transactionIdClass));
-//		this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setTransactionIdClass", args);		
-//	}
+  public XmlRpcCommunicationChannelClient(URL serverUrl, int connectionTimeout,
+      int requestTimeout, int chunkSize) {
+    super();
+    CommonsXmlRpcTransportFactory transportFactory = new CommonsXmlRpcTransportFactory(
+        serverUrl);
+    transportFactory.setConnectionTimeout(connectionTimeout * 60 * 1000);
+    transportFactory.setTimeout(requestTimeout * 60 * 1000);
+    this.client = new XmlRpcClient(serverUrl, transportFactory);
+    this.chunkSize = chunkSize;
+  }
+
+  public void shutdown() throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_shutdown", args);
+  }
+
+  public void addCatalog(Catalog catalog) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalog));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addCatalog", args);
+  }
+
+  public void replaceCatalog(Catalog catalog) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalog));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_replaceCatalog", args);
+  }
+
+  public void addCatalog(String catalogId, Index index) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(index));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addCatalog", args);
+  }
+
+  public void addCatalog(String catalogId, Index index,
+      List<Dictionary> dictionaries) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(index));
+    args.add(this.serializer.serializeObject(dictionaries));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addCatalog", args);
+  }
+
+  public void addCatalog(String catalogId, Index index,
+      List<Dictionary> dictionaries, boolean restrictQueryPermission,
+      boolean restrictIngestPermission) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(index));
+    args.add(this.serializer.serializeObject(dictionaries));
+    args.add(restrictQueryPermission);
+    args.add(restrictIngestPermission);
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addCatalog", args);
+  }
+
+  public void addDictionary(String catalogId, Dictionary dictionary)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(dictionary));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addDictionary", args);
+  }
+
+  public void replaceDictionaries(String catalogId,
+      List<Dictionary> dictionaries) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(dictionaries));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addDictionary", args);
+  }
+
+  public void replaceIndex(String catalogId, Index index) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(index));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_replaceIndex", args);
+  }
+
+  public void modifyIngestPermission(String catalogId,
+      boolean restrictIngestPermission) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(restrictIngestPermission));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_modifyIngestPermission", args);
+  }
+
+  public void modifyQueryPermission(String catalogId,
+      boolean restrictQueryPermission) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogId);
+    args.add(this.serializer.serializeObject(restrictQueryPermission));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_modifyQueryPermission", args);
+  }
+
+  public List<PluginURL> getPluginUrls() throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getPluginUrls", args));
+  }
+
+  public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(pluginURLs));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_addPluginUrls", args);
+  }
+
+  public URL getPluginStorageDir() throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    return this.serializer.deserializeObject(URL.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getPluginStorageDir", args));
+  }
+
+  public void transferUrl(URL fromUrl, URL toURL) throws Exception {
+    System.out.println("Transfering '" + fromUrl + "' to '" + toURL + "'");
+    FileInputStream is = null;
+    try {
+      byte[] buf = new byte[this.chunkSize];
+      is = new FileInputStream(new File(fromUrl.getPath()));
+      int offset = 0;
+      int numBytes = 0;
+      while ((numBytes = is.read(buf, offset, chunkSize)) != -1)
+        this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf,
+            offset, numBytes);
+    } catch (Exception e) {
+      throw e;
+    } finally {
+      try {
+        is.close();
+      } catch (Exception e) {
+      }
+    }
+  }
 
+  protected void transferFile(String filePath, byte[] fileData, int offset,
+      int numBytes) throws Exception {
+    Vector<Object> argList = new Vector<Object>();
+    argList.add(filePath);
+    argList.add(fileData);
+    argList.add(new Integer(offset));
+    argList.add(new Integer(numBytes));
+    client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_transferFile", argList);
+  }
+
+  public void delete(Metadata metadata) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(metadata));
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_delete", args);
+  }
+
+  public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryPager));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getAllPages", args));
+  }
+
+  public Properties getCalalogProperties() throws Exception {
+    return this.serializer.deserializeObject(Properties.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_getCalalogProperties", new Vector<Object>()));
+  }
+
+  public Properties getCalalogProperties(String catalogUrn) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogUrn);
+    return this.serializer.deserializeObject(Properties.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_getCalalogProperties", args));
+  }
+
+  public TransactionId<?> getCatalogServiceTransactionId(
+      TransactionId<?> catalogTransactionId, String catalogUrn)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalogTransactionId));
+    args.add(catalogUrn);
+    return this.serializer.deserializeObject(TransactionId.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_getCatalogServiceTransactionId", args));
+  }
+
+  public TransactionId<?> getCatalogServiceTransactionId(
+      CatalogReceipt catalogReceipt, boolean generateNew) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalogReceipt));
+    args.add(this.serializer.serializeObject(new Boolean(generateNew)));
+    return this.serializer.deserializeObject(TransactionId.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_getCatalogServiceTransactionId2", args));
+  }
+
+  public List<TransactionId<?>> getCatalogServiceTransactionIds(
+      List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalogTransactionIds));
+    args.add(catalogUrn);
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getCatalogServiceTransactionId", args));
+  }
+
+  public Set<String> getCurrentCatalogIds() throws Exception {
+    return this.serializer.deserializeObject(Set.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getCurrentCatalogIds", new Vector<Object>()));
+  }
+
+  public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
+      List<String> catalogServiceTransactionIdStrings) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer
+        .serializeObject(catalogServiceTransactionIdStrings));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getMetadataFromTransactionIdStrings", args));
+  }
+
+  public List<TransactionalMetadata> getMetadataFromTransactionIds(
+      List<TransactionId<?>> catalogServiceTransactionIds) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(catalogServiceTransactionIds));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getMetadataFromTransactionIds", args));
+  }
+
+  public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryPager));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getNextPage", args));
+  }
+
+  public List<String> getProperty(String key) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(key);
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getProperty", args));
+  }
+
+  public Class<? extends TransactionId<?>> getTransactionIdClass()
+      throws Exception {
+    return this.serializer.deserializeObject(Class.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getTransactionIdClass", new Vector<Object>()));
+  }
+
+  public List<TransactionId<?>> getTransactionIdsForAllPages(
+      QueryPager queryPager) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryPager));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getTransactionIdsForAllPages", args));
+  }
+
+  public TransactionReceipt ingest(Metadata metadata) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(metadata));
+    return this.serializer.deserializeObject(TransactionReceipt.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_ingest", args));
+  }
+
+  public boolean isRestrictIngestPermissions() throws Exception {
+    return this.serializer.deserializeObject(Boolean.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_isRestrictIngestPermissions", new Vector<Object>()));
+  }
+
+  public boolean isRestrictQueryPermissions() throws Exception {
+    return this.serializer.deserializeObject(Boolean.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_isRestrictQueryPermissions", new Vector<Object>()));
+  }
+
+  public Page getFirstPage(QueryExpression queryExpression) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getFirstPage", args));
+  }
+
+  public Page getFirstPage(QueryExpression queryExpression,
+      Set<String> catalogIds) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    args.add(this.serializer.serializeObject(catalogIds));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getFirstPage", args));
+  }
+
+  public Page getNextPage(Page page) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(page));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getNextPage2", args));
+  }
+
+  public Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
+      throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(pageInfo));
+    args.add(this.serializer.serializeObject(queryExpression));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getPage", args));
+  }
+
+  public Page getPage(PageInfo pageInfo, QueryExpression queryExpression,
+      Set<String> catalogIds) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(pageInfo));
+    args.add(this.serializer.serializeObject(queryExpression));
+    args.add(this.serializer.serializeObject(catalogIds));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getPage", args));
+  }
+
+  public Page getLastPage(QueryExpression queryExpression) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getLastPage", args));
+  }
+
+  public Page getLastPage(QueryExpression queryExpression,
+      Set<String> catalogIds) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    args.add(this.serializer.serializeObject(catalogIds));
+    return this.serializer.deserializeObject(Page.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getLastPage", args));
+  }
+
+  public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(page));
+    return this.serializer.deserializeObject(List.class, (String) this.client
+        .execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+            + ".xmlrpc_getMetadata", args));
+  }
+
+  public QueryPager query(QueryExpression queryExpression) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    return this.serializer.deserializeObject(QueryPager.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_query", args));
+  }
+
+  public QueryPager query(QueryExpression queryExpression,
+      Set<String> catalogIds) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(this.serializer.serializeObject(queryExpression));
+    args.add(this.serializer.serializeObject(catalogIds));
+    return this.serializer.deserializeObject(QueryPager.class,
+        (String) this.client.execute(XmlRpcCommunicationChannelServer.class
+            .getSimpleName()
+            + ".xmlrpc_query", args));
+  }
+
+  public void removeCatalog(String catalogUrn) throws Exception {
+    Vector<Object> args = new Vector<Object>();
+    args.add(catalogUrn);
+    this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName()
+        + ".xmlrpc_removeCatalog", args);
+  }
 
 }