You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2010/09/29 19:19:15 UTC
svn commit: r1002752 [6/9] - in /incubator/oodt/trunk/catalog: ./
.externalToolBuilders/ .settings/ src/ src/main/ src/main/assembly/
src/main/bin/ src/main/java/ src/main/java/gov/ src/main/java/gov/nasa/
src/main/java/gov/nasa/jpl/ src/main/java/gov/...
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,277 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.channel.rmi;
+
+//JDK imports
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+//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.query.QueryExpression;
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
+import org.apache.oodt.cas.catalog.struct.Dictionary;
+import org.apache.oodt.cas.catalog.struct.Index;
+import org.apache.oodt.cas.catalog.struct.TransactionId;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.system.CatalogService;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+import org.apache.oodt.cas.metadata.Metadata;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class RmiCommunicationChannelServer implements
+ CommunicationChannelServer {
+
+ public void shutdown() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startup()
+ throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCatalog(Catalog catalog) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCatalog(String catalogId, Index index) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCatalog(String catalogId, Index index,
+ List<Dictionary> dictionaries) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCatalog(String catalogId, Index index,
+ List<Dictionary> dictionaries, boolean restrictQueryPermission,
+ boolean restrictIngestPermission) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addDictionary(String catalogId, Dictionary dictionary)
+ throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void delete(Metadata metadata) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Properties getCalalogProperties() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Properties getCalalogProperties(String catalogUrn) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public TransactionId<?> getCatalogServiceTransactionId(
+ TransactionId<?> catalogTransactionId, String catalogUrn)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public TransactionId<?> getCatalogServiceTransactionId(
+ CatalogReceipt catalogReceipt, boolean generateNew)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<TransactionId<?>> getCatalogServiceTransactionIds(
+ List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<String> getCurrentCatalogIds() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
+ List<String> catalogServiceTransactionIdStrings) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<TransactionalMetadata> getMetadataFromTransactionIds(
+ List<TransactionId<?>> catalogServiceTransactionIds)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Page getNextPage(Page page) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Page getPage(PageInfo pageInfo, QueryExpression queryExpression,
+ Set<String> catalogIds) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public URL getPluginStorageDir() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<PluginURL> getPluginUrls() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getPort() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public List<String> getProperty(String key) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public TransactionReceipt ingest(Metadata metadata) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isRestrictIngestPermissions() throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isRestrictQueryPermissions() throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void modifyIngestPermission(String catalogId,
+ boolean restrictIngestPermission) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void modifyQueryPermission(String catalogId,
+ boolean restrictQueryPermission) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public QueryPager query(QueryExpression queryExpression) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public QueryPager query(QueryExpression queryExpression,
+ Set<String> catalogIds) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void removeCatalog(String catalogUrn) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void replaceCatalog(Catalog catalog) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void replaceDictionaries(String catalogId,
+ List<Dictionary> dictionaries) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void replaceIndex(String catalogId, Index index) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCatalogService(CatalogService catalogService)
+ throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPort(int port) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
Added: 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/XmlRpcCommunicationChannelClient.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,442 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
+
+//JDK imports
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Vector;
+
+//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.query.QueryExpression;
+import org.apache.oodt.cas.catalog.server.channel.AbstractCommunicationChannelClient;
+import org.apache.oodt.cas.catalog.struct.Dictionary;
+import org.apache.oodt.cas.catalog.struct.Index;
+import org.apache.oodt.cas.catalog.struct.TransactionId;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+import org.apache.oodt.cas.metadata.Metadata;
+
+//APACHE imports
+import org.apache.xmlrpc.CommonsXmlRpcTransportFactory;
+import org.apache.xmlrpc.XmlRpcClient;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Communication Channel Client over XML-RPC
+ * <p>
+ */
+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);
+ }
+
+ 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);
+// }
+
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
+
+//JDK imports
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClient;
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClientFactory;
+
+//Spring imports
+import org.springframework.beans.factory.annotation.Required;
+
+//OODT imports
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating XmlRpcCommunicationChannelServer
+ * <p>
+ */
+public class XmlRpcCommunicationChannelClientFactory implements
+ CommunicationChannelClientFactory {
+
+ private static Logger LOG = Logger.getLogger(XmlRpcCommunicationChannelClientFactory.class.getName());
+
+ protected String serverUrl;
+ protected int connectionTimeout;
+ protected int requestTimeout;
+ protected int chunkSize;
+
+ public XmlRpcCommunicationChannelClientFactory() {}
+
+ public CommunicationChannelClient createCommunicationChannelClient() {
+ try {
+ return new XmlRpcCommunicationChannelClient(new URL(this.serverUrl), this.connectionTimeout, this.requestTimeout, this.chunkSize);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to create XmlRpcCommunicationChannelClient : " + e.getMessage(), e);
+ return null;
+ }
+ }
+
+ @Required
+ public void setServerUrl(String serverUrl) {
+ this.serverUrl = serverUrl;
+ }
+
+ public String getServerUrl() {
+ return this.serverUrl;
+ }
+
+ /**
+ * @param connectionTimeout timeout for client in minutes
+ */
+ @Required
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ /**
+ *
+ * @param requestTimeout timout for client in minutes
+ */
+ @Required
+ public void setRequestTimeout(int requestTimeout) {
+ this.requestTimeout = requestTimeout;
+ }
+
+ @Required
+ public void setChunkSize(int chunkSize) {
+ this.chunkSize = chunkSize;
+ }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,316 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
+
+//JDK imports
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.List;
+import java.util.Set;
+
+//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.query.QueryExpression;
+import org.apache.oodt.cas.catalog.server.channel.AbstractCommunicationChannelServer;
+import org.apache.oodt.cas.catalog.struct.Dictionary;
+import org.apache.oodt.cas.catalog.struct.Index;
+import org.apache.oodt.cas.catalog.struct.TransactionId;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.metadata.Metadata;
+
+//APACHE imports
+import org.apache.xmlrpc.WebServer;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Communication Channel Server over XML-RPC
+ * <p>
+ */
+public class XmlRpcCommunicationChannelServer extends
+ AbstractCommunicationChannelServer {
+
+ private WebServer webServer;
+
+ public XmlRpcCommunicationChannelServer() {
+ super();
+ }
+
+ public void startup() throws Exception {
+ this.webServer = new WebServer(this.port);
+ this.webServer.addHandler(this.getClass().getSimpleName(), this);
+ this.webServer.start();
+ }
+
+ public boolean xmlrpc_shutdown() throws Exception {
+ this.shutdown();
+ this.webServer.shutdown();
+ this.webServer = null;
+ return true;
+ }
+
+ public boolean xmlrpc_addCatalog(String catalogObject) throws Exception {
+ this.addCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
+ return true;
+ }
+
+ public boolean xmlrpc_replaceCatalog(String catalogObject) throws Exception {
+ this.replaceCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
+ return true;
+ }
+
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws Exception {
+ this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
+ return true;
+ }
+
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws Exception {
+ this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject));
+ return true;
+ }
+
+ public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws Exception {
+ this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject), this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject), this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
+ return true;
+ }
+
+ public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws Exception {
+ this.addDictionary(catalogId, this.serializer.deserializeObject(Dictionary.class, dictionaryObject));
+ return true;
+ }
+
+ public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws Exception {
+ this.replaceDictionaries(catalogId, this.serializer.deserializeObject(List.class, dictionariesObject));
+ return true;
+ }
+
+ public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws Exception {
+ this.replaceIndex(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
+ return true;
+ }
+
+ public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws Exception {
+ this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
+ return true;
+ }
+
+ public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws Exception {
+ this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject));
+ return true;
+ }
+
+ public boolean xmlrpc_delete(String metadataObject) throws Exception {
+ this.delete(this.serializer.deserializeObject(Metadata.class, metadataObject));
+ return true;
+ }
+
+ public String xmlrpc_getPluginUrls() throws Exception {
+ return this.serializer.serializeObject(this.getPluginUrls());
+ }
+
+ public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws Exception {
+ this.addPluginUrls(this.serializer.deserializeObject(List.class, pluginUrlsObject));
+ return true;
+ }
+
+ public String xmlrpc_getPluginStorageDir() throws Exception {
+ return this.serializer.serializeObject(this.getPluginStorageDir());
+ }
+
+ public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes) throws Exception {
+ FileOutputStream fOut = null;
+ try {
+ File outFile = new File(filePath);
+ if (outFile.exists())
+ fOut = new FileOutputStream(outFile, true);
+ else
+ fOut = new FileOutputStream(outFile, false);
+
+ fOut.write(fileData, (int) offset, (int) numBytes);
+ }catch (Exception e) {
+ throw e;
+ }finally {
+ try {
+ fOut.close();
+ }catch(Exception e) {}
+ }
+ return true;
+ }
+
+ public String xmlrpc_getAllPages(String queryPagerObject) throws Exception {
+ return this.serializer.serializeObject(this.getAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
+ }
+
+ public String xmlrpc_getCalalogProperties() throws Exception {
+ return this.serializer.serializeObject(this.getCalalogProperties());
+ }
+
+ public String xmlrpc_getCalalogProperties(String catalogUrn)
+ throws Exception {
+ return this.serializer.serializeObject(this.getCalalogProperties(catalogUrn));
+ }
+
+// public String xmlrpc_getCatalog(String catalogUrn) throws Exception {
+// return this.serializer.serializeObject(this.getCatalog(catalogUrn));
+// }
+
+ public String xmlrpc_getCatalogServiceTransactionId(
+ String catalogTransactionIdObject, String catalogUrn)
+ throws Exception {
+ return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(TransactionId.class, catalogTransactionIdObject), catalogUrn));
+ }
+
+ public String xmlrpc_getCatalogServiceTransactionId2(
+ String catalogReceiptObject,
+ String generateNewObject) throws Exception {
+ return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(CatalogReceipt.class, catalogReceiptObject), this.serializer.deserializeObject(Boolean.class, generateNewObject)));
+ }
+
+ public String xmlrpc_getCatalogServiceTransactionIds(
+ String catalogTransactionIdsObject, String catalogUrn)
+ throws Exception {
+ return this.serializer.serializeObject(this.getCatalogServiceTransactionIds(this.serializer.deserializeObject(List.class, catalogTransactionIdsObject), catalogUrn));
+ }
+
+ public String xmlrpc_getCurrentCatalogIds() throws Exception {
+ return this.serializer.serializeObject(this.getCurrentCatalogIds());
+ }
+
+// public String xmlrpc_getCurrentCatalogList() throws Exception {
+// return this.serializer.serializeObject(this.getCurrentCatalogList());
+// }
+
+ public String xmlrpc_getMetadataFromTransactionIdStrings(
+ String catalogServiceTransactionIdStringsObject)
+ throws Exception {
+ return this.serializer.serializeObject(this.getMetadataFromTransactionIdStrings(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdStringsObject)));
+ }
+
+ public String xmlrpc_getMetadataFromTransactionIds(
+ String catalogServiceTransactionIdsObject)
+ throws Exception {
+ return this.serializer.serializeObject(this.getMetadataFromTransactionIds(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdsObject)));
+ }
+
+ public String xmlrpc_getNextPage(String queryPagerObject)
+ throws Exception {
+ return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
+ }
+
+ public String xmlrpc_getProperty(String key) throws Exception {
+ return this.serializer.serializeObject(this.getProperty(key));
+ }
+//
+// public String xmlrpc_getTransactionIdClass() throws Exception {
+// return this.serializer.serializeObject(this.getTransactionIdClass());
+// }
+
+// public String xmlrpc_getTransactionIdsForAllPages(
+// String queryPagerObject) throws Exception {
+// return this.serializer.serializeObject(this.getTransactionIdsForAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
+// }
+
+ public String xmlrpc_ingest(String metadataObject)
+ throws Exception {
+ return this.serializer.serializeObject(this.ingest(this.serializer.deserializeObject(Metadata.class, metadataObject)));
+ }
+
+ public String xmlrpc_isRestrictIngestPermissions() throws Exception {
+ return this.serializer.serializeObject(new Boolean(this.isRestrictIngestPermissions()));
+ }
+
+ public String xmlrpc_isRestrictQueryPermissions() throws Exception {
+ return this.serializer.serializeObject(new Boolean(this.isRestrictQueryPermissions()));
+ }
+
+ public String xmlrpc_query(String queryExpressionObject) throws Exception {
+ return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
+ }
+
+ public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws Exception {
+ return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
+ }
+
+// public String xmlrpc_getFirstPage(String queryExpressionObject) throws Exception {
+// return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
+// }
+//
+// public String xmlrpc_getFirstPage(String queryExpressionObject, String catalogIdsObject) throws Exception {
+// return this.serializer.serializeObject(this.getFirstPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
+// }
+
+ public String xmlrpc_getNextPage2(String pageObject) throws Exception {
+ return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(Page.class, pageObject)));
+ }
+
+ public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
+ }
+
+ public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
+ }
+
+// public String xmlrpc_getLastPage(String queryExpressionObject) throws Exception {
+// return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
+// }
+//
+// public String xmlrpc_getLastPage(String queryExpressionObject, String catalogIdsObject) throws Exception {
+// return this.serializer.serializeObject(this.getLastPage(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
+// }
+
+ public String xmlrpc_getMetadata(String pageObject) throws Exception {
+ return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(Page.class, pageObject)));
+ }
+
+// public String xmlrpc_query(String queryExpressionObject, String sortResultsObject) throws Exception {
+// System.out.println(this.getClass().getClassLoader());
+// return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Boolean.class, sortResultsObject)));
+// }
+
+ public boolean xmlrpc_removeCatalog(String catalogUrn) throws Exception {
+ this.removeCatalog(catalogUrn);
+ return true;
+ }
+//
+// public boolean xmlrpc_removeCatalog(String catalogUrn, String preserveMappingObject) throws Exception {
+// this.removeCatalog(catalogUrn, this.serializer.deserializeObject(Boolean.class, preserveMappingObject));
+// return true;
+// }
+//
+// public boolean xmlrpc_setHasIngestPermissions(String restrictIngestPermissionsObject) throws Exception {
+// this.setHasIngestPermissions(this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionsObject));
+// return true;
+// }
+//
+// public boolean xmlrpc_setRestrictQueryPermissions(String restrictQueryPermissionsObject) throws Exception {
+// this.setRestrictQueryPermissions(this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionsObject));
+// return true;
+// }
+
+// public boolean setTransactionIdClass(String transactionIdClassObject) throws Exception {
+// this.setTransactionIdClass(this.serializer.deserializeObject(Class.class, transactionIdClassObject));
+// return true;
+// }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
+
+//JDK imports
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServerFactory;
+import org.apache.oodt.cas.catalog.system.CatalogServiceFactory;
+
+//Spring imports
+import org.springframework.beans.factory.annotation.Required;
+
+//OODT imports
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating XmlRpcCommunicationChannelServer
+ * <p>
+ */
+public class XmlRpcCommunicationChannelServerFactory implements
+ CommunicationChannelServerFactory {
+
+ private static Logger LOG = Logger.getLogger(XmlRpcCommunicationChannelServerFactory.class.getName());
+
+ protected int port;
+ protected CatalogServiceFactory catalogServiceFactory;
+
+ public XmlRpcCommunicationChannelServerFactory() {}
+
+ public CommunicationChannelServer createCommunicationChannelServer() {
+ try {
+ XmlRpcCommunicationChannelServer server = new XmlRpcCommunicationChannelServer();
+ server.setCatalogService(this.catalogServiceFactory.createCatalogService());
+ server.setPort(this.port);
+ return server;
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to create XML-RPC server : " + e.getMessage(), e);
+ return null;
+ }
+ }
+
+ @Required
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public int getPort() {
+ return this.port;
+ }
+
+ @Required
+ public void setCatalogServiceFactory(CatalogServiceFactory catalogServiceFactory) {
+ this.catalogServiceFactory = catalogServiceFactory;
+ }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedActionsHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedActionsHandler.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedActionsHandler.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedActionsHandler.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Map;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.action.CatalogServiceServerAction;
+import org.apache.oodt.cas.catalog.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class PrintSupportedActionsHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("Actions:");
+ for (CatalogServiceServerAction action : ((Map<String, CatalogServiceServerAction>) appContext.getBeansOfType(CatalogServiceServerAction.class)).values()) {
+ ps.println(" Action:");
+ ps.println(" Id: " + action.getId());
+ ps.println(" Description: " + action.getDescription());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+// @Override
+// public boolean affectsOption(CmdLineOptionInstance arg0) {
+// return false;
+// }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedClientsHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedClientsHandler.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedClientsHandler.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedClientsHandler.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
+import org.apache.oodt.cas.catalog.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class PrintSupportedClientsHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("ClientFactories:");
+ for (String clientId : appContext.getBeanNamesForType(CatalogServiceClientFactory.class)) {
+ CatalogServiceClientFactory clientFactory = (CatalogServiceClientFactory) appContext.getBean(clientId, CatalogServiceClientFactory.class);
+ ps.println(" ClientFactory:");
+ ps.println(" Id: " + clientId);
+ ps.println(" URL: " + clientFactory.getServerUrl());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+// @Override
+// public boolean affectsOption(CmdLineOptionInstance arg0) {
+// return false;
+// }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedServersHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedServersHandler.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedServersHandler.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/PrintSupportedServersHandler.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.server.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServerFactory;
+import org.apache.oodt.cas.catalog.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class PrintSupportedServersHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("ServerFactories:");
+ for (String serverId : appContext.getBeanNamesForType(CommunicationChannelServerFactory.class)) {
+ CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(serverId, CommunicationChannelServerFactory.class);
+ ps.println(" ServerFactory:");
+ ps.println(" Id: " + serverId);
+ ps.println(" Port: " + serverFactory.getPort());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+// @Override
+// public boolean affectsOption(CmdLineOptionInstance arg0) {
+// return false;
+// }
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogDictionaryException;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.catalog.term.TermBucket;
+import org.apache.oodt.cas.metadata.Metadata;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Dictionary for create Catalog understandable Terms from Metadata
+ * <p>
+ */
+public interface Dictionary {
+
+ /**
+ * Given a Metadata object a lookup call to a given dictionary will
+ * always return the same TermBucket. However, calls to several
+ * Dictionary's lookup method may return different TermBuckets for
+ * a given Metadata object.
+ * @param metadata The Metadata for which a TermBucket will be created
+ * @return TermBucket representing the given Metadata for this Dictionary or
+ * null if Metadata is not recognized by this Dictionary
+ */
+ public TermBucket lookup(Metadata metadata) throws CatalogDictionaryException;
+
+ /**
+ * Generates Metadata for the given TermBucket. A call to lookup(Metadata) and
+ * then reverseLookup(TermBucket) may not give you back the original Metadata
+ * because lookup may ignore key/values in Metadata for which it does not
+ * understand.
+ * @param termBucket The TermBucket for which Metadata will be created
+ * @return Metadata for the given TermBucket. If the TermBucket is not understood,
+ * then an empty Metadata object should be returned.
+ */
+ public Metadata reverseLookup(TermBucket termBucket) throws CatalogDictionaryException;
+
+ /**
+ *
+ * @param queryExpression
+ * @return
+ * @throws CatalogDictionaryException
+ */
+ public boolean understands(QueryExpression queryExpression) throws CatalogDictionaryException;
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public interface DictionaryFactory {
+
+ public Dictionary createDictionary();
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+//JDK imports
+import java.util.List;
+import java.util.Properties;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogIndexException;
+import org.apache.oodt.cas.catalog.page.IndexPager;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Interface for Communicating with an Term Index. Should also implement
+ * IngestService to allow Term ingest to this Index and/or implement
+ * QueryService to allow Term query on this Index.
+ * <p>
+ */
+public interface Index {
+
+ public Properties getProperties() throws CatalogIndexException;
+
+ public String getProperty(String key) throws CatalogIndexException;
+
+ /**
+ * Returns a list of TransactionIds associated with the
+ * given Index page.
+ * @param indexPage The page for which TransactionIds will be returned
+ * @return A page of TransactionIds, if page does not exist,
+ * then returns null.
+ */
+ public List<TransactionId<?>> getPage(IndexPager indexPage) throws CatalogIndexException;
+
+ /**
+ *
+ * @return
+ */
+ public TransactionIdFactory getTransactionIdFactory() throws CatalogIndexException;
+
+ /**
+ *
+ * @param catalogTransactionid
+ * @return
+ * @throws CatalogIndexException
+ */
+ public boolean hasTransactionId(TransactionId<?> transactionid) throws CatalogIndexException;
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public interface IndexFactory {
+
+ public Index createIndex();
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+//JDK imports
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.IngestServiceException;
+import org.apache.oodt.cas.catalog.page.IngestReceipt;
+import org.apache.oodt.cas.catalog.term.TermBucket;
+
+//OODT imports
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Interface for performing ingests to an Index
+ * <p>
+ */
+public interface IngestService {
+
+ /**
+ * Indexes the given TermBucket to a TransactionId, and returns a IngestReceipt
+ * @param termBuckets The List of TermBucket to be ingested
+ * @return IngestReceipt Receipt of ingest
+ * @throws IngestServiceException Any error
+ */
+ public IngestReceipt ingest(List<TermBucket> termBuckets) throws IngestServiceException;
+
+ /**
+ * TermBucket updates to given TransactionId. A new TransactionId can be returned in IngestReceipt
+ * if so desired and it will automatically get remapped by CatalogService. Existing metadata
+ * for given TransactionId should not be deleted, just the terms in the given term buckets should
+ * be modified. For a complete re-ingest, one should instead delete() then ingest().
+ * @param transactionId
+ * @param termBuckets
+ * @throws IngestServiceException
+ */
+ public IngestReceipt update(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException;
+
+ /**
+ * Deletes all TermBuckets attached to given TransactionId -- there should be no trace of
+ * given transaction after this method is called.
+ * @param transactionId The ID for given transaction which should be erased
+ * @throws IngestServiceException Any error
+ */
+ public boolean delete(TransactionId<?> transactionId) throws IngestServiceException;
+
+ /**
+ * Deletes only the Terms in the given TermBuckets from the given TransactionId
+ * @param transactionId The TransactionId for which Terms will be deleted
+ * @param termBuckets The reduction set of Terms for each TermBucket
+ * @throws IngestServiceException Any error
+ */
+ public boolean reduce(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException;
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+//JDK imports
+import java.util.List;
+import java.util.Map;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.QueryServiceException;
+import org.apache.oodt.cas.catalog.page.IngestReceipt;
+import org.apache.oodt.cas.catalog.page.TransactionReceipt;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.catalog.term.TermBucket;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Interface for performing queries to a Catalog
+ * <p>
+ */
+public interface QueryService {
+
+ /**
+ * Returns all the TransactionIds that fall under the given query
+ * @param query The query for TransactionIds
+ * @return Returns a List of TransactionIds that meet the query, otherwise
+ * an empty List is no TransactionIds are found for the given query
+ */
+ public List<IngestReceipt> query(QueryExpression queryExpression) throws QueryServiceException;
+
+ /**
+ * Returns a List of TermBuckets ingested for a given TransactionId
+ * @param transactionId The TransactionId in question
+ * @return A List of TermBuckets for the given TransactionId or empty list
+ * if no record of the give TranactionId exists
+ */
+ public List<TermBucket> getBuckets(TransactionId<?> transactionId) throws QueryServiceException;
+
+ /**
+ * Does the same as getBuckets(TransactionId), except is performed over a list
+ * of TransactionIds
+ * @param transactionIds A List of TransactionIds for which TermBuckets are wanted
+ * @return A Map of TransactionIds to TermBuckets
+ */
+ public Map<TransactionId<?>, List<TermBucket>> getBuckets(List<TransactionId<?>> transactionIds) throws QueryServiceException;
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Interface for storing TransactionIds
+ * <p>
+ */
+public abstract class TransactionId<NativeType> {
+
+ protected NativeType nativeId;
+
+ public TransactionId() {}
+
+ public TransactionId(NativeType nativeId) {
+ this.nativeId = nativeId;
+ }
+
+ public TransactionId(String stringId) {
+ this.nativeId = this.fromString(stringId);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+
+ public NativeType getNativeId() {
+ return this.nativeId;
+ }
+
+ /**
+ * Should override this method if NativeType.toString()
+ * does not properly represent the String value of the
+ * native type. The string value of the NativeType should
+ * be as unique as in its native form.
+ */
+ public String toString() {
+ return this.nativeId.toString();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TransactionId<?>)
+ return this.toString().equals(obj.toString());
+ else if (obj instanceof String)
+ return this.toString().equals((String) obj);
+ else
+ return false;
+ }
+
+ protected abstract NativeType fromString(String stringId);
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public interface TransactionIdFactory {
+
+ public TransactionId<?> createNewTransactionId();
+
+ public TransactionId<?> createTransactionId(String transactionIdString);
+
+}
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.catalog.struct.impl.dictionary;
+
+//JDK imports
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogDictionaryException;
+import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
+import org.apache.oodt.cas.catalog.query.NotQueryExpression;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
+import org.apache.oodt.cas.catalog.query.StdQueryExpression;
+import org.apache.oodt.cas.catalog.query.TermQueryExpression;
+import org.apache.oodt.cas.catalog.struct.Dictionary;
+import org.apache.oodt.cas.catalog.term.Term;
+import org.apache.oodt.cas.catalog.term.TermBucket;
+import org.apache.oodt.cas.metadata.Metadata;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class WorkflowManagerDictionary implements Dictionary {
+
+ public TermBucket lookup(Metadata metadata)
+ throws CatalogDictionaryException {
+ if (metadata.getMetadata("ProductType") != null && metadata.getAllMetadata("ProductType").contains("Workflows")) {
+ TermBucket workflowBucket = new TermBucket("Workflows");
+ for (Object key : metadata.getHashtable().keySet())
+ workflowBucket.addTerm(new Term((String) key, metadata.getAllMetadata((String) key)));
+ return workflowBucket;
+ }else {
+ return null;
+ }
+ }
+
+ public Metadata reverseLookup(TermBucket termBucket)
+ throws CatalogDictionaryException {
+ Metadata metadata = new Metadata();
+ if (termBucket.getName().equals("Workflows")) {
+ for (Term term : termBucket.getTerms())
+ metadata.addMetadata(term.getName(), term.getValues());
+ }
+ return metadata;
+ }
+
+ public boolean understands(QueryExpression queryExpression)
+ throws CatalogDictionaryException {
+ Set<String> bucketNames = queryExpression.getBucketNames();
+ if (bucketNames == null || bucketNames.contains("Workflows")) {
+ if (queryExpression instanceof NotQueryExpression
+ || queryExpression instanceof ComparisonQueryExpression
+ || queryExpression instanceof StdQueryExpression
+ || queryExpression instanceof QueryLogicalGroup) {
+ return true;
+ } else
+ return false;
+ }
+ return false;
+ }
+
+}