http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java deleted file mode 100644 index fb01ac0..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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; - } - -}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java deleted file mode 100644 index 5540d44..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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 org.apache.oodt.cas.catalog.exception.CatalogServiceException; -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; -import org.apache.xmlrpc.WebServer; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.List; -import java.util.Set; - - -/** - * @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() { - this.webServer = new WebServer(this.port); - this.webServer.addHandler(this.getClass().getSimpleName(), this); - this.webServer.start(); - } - - public boolean xmlrpc_shutdown() throws CatalogServiceException { - this.shutdown(); - this.webServer.shutdown(); - this.webServer = null; - return true; - } - - public boolean xmlrpc_addCatalog(String catalogObject) throws CatalogServiceException { - this.addCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject)); - return true; - } - - public boolean xmlrpc_replaceCatalog(String catalogObject) throws CatalogServiceException { - this.replaceCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject)); - return true; - } - - public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws CatalogServiceException { - this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject)); - return true; - } - - public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws CatalogServiceException { - 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 CatalogServiceException { - 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 CatalogServiceException { - this.addDictionary(catalogId, this.serializer.deserializeObject(Dictionary.class, dictionaryObject)); - return true; - } - - public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws CatalogServiceException { - this.replaceDictionaries(catalogId, this.serializer.deserializeObject(List.class, dictionariesObject)); - return true; - } - - public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws CatalogServiceException { - this.replaceIndex(catalogId, this.serializer.deserializeObject(Index.class, indexObject)); - return true; - } - - public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws CatalogServiceException { - this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject)); - return true; - } - - public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws CatalogServiceException { - this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject)); - return true; - } - - public boolean xmlrpc_delete(String metadataObject) throws CatalogServiceException { - this.delete(this.serializer.deserializeObject(Metadata.class, metadataObject)); - return true; - } - - public String xmlrpc_getPluginUrls() throws CatalogServiceException { - return this.serializer.serializeObject(this.getPluginUrls()); - } - - public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws CatalogServiceException { - this.addPluginUrls(this.serializer.deserializeObject(List.class, pluginUrlsObject)); - return true; - } - - public String xmlrpc_getPluginStorageDir() throws CatalogServiceException { - return this.serializer.serializeObject(this.getPluginStorageDir()); - } - - public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes) - throws IOException { - 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); - } finally { - try { - fOut.close(); - }catch(Exception ignored) {} - } - return true; - } - - public String xmlrpc_getAllPages(String queryPagerObject) throws CatalogServiceException { - return this.serializer.serializeObject(this.getAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject))); - } - - public String xmlrpc_getCalalogProperties() throws CatalogServiceException { - return this.serializer.serializeObject(this.getCalalogProperties()); - } - - public String xmlrpc_getCalalogProperties(String catalogUrn) - throws CatalogServiceException { - return this.serializer.serializeObject(this.getCalalogProperties(catalogUrn)); - } - - public String xmlrpc_getCatalogServiceTransactionId( - String catalogTransactionIdObject, String catalogUrn) - throws CatalogServiceException { - return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(TransactionId.class, catalogTransactionIdObject), catalogUrn)); - } - - public String xmlrpc_getCatalogServiceTransactionId2( - String catalogReceiptObject, - String generateNewObject) throws CatalogServiceException { - 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 CatalogServiceException { - return this.serializer.serializeObject(this.getCatalogServiceTransactionIds(this.serializer.deserializeObject(List.class, catalogTransactionIdsObject), catalogUrn)); - } - - public String xmlrpc_getCurrentCatalogIds() throws CatalogServiceException { - return this.serializer.serializeObject(this.getCurrentCatalogIds()); - } - - public String xmlrpc_getMetadataFromTransactionIdStrings( - String catalogServiceTransactionIdStringsObject) - throws CatalogServiceException { - return this.serializer.serializeObject(this.getMetadataFromTransactionIdStrings(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdStringsObject))); - } - - public String xmlrpc_getMetadataFromTransactionIds( - String catalogServiceTransactionIdsObject) - throws CatalogServiceException { - return this.serializer.serializeObject(this.getMetadataFromTransactionIds(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdsObject))); - } - - public String xmlrpc_getNextPage(String queryPagerObject) - throws CatalogServiceException { - return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPager.class, queryPagerObject))); - } - - public String xmlrpc_getProperty(String key) throws CatalogServiceException { - return this.serializer.serializeObject(this.getProperty(key)); - } - - - public String xmlrpc_ingest(String metadataObject) - throws CatalogServiceException { - return this.serializer.serializeObject(this.ingest(this.serializer.deserializeObject(Metadata.class, metadataObject))); - } - - public String xmlrpc_isRestrictIngestPermissions() throws CatalogServiceException { - return this.serializer.serializeObject(this.isRestrictIngestPermissions()); - } - - public String xmlrpc_isRestrictQueryPermissions() throws CatalogServiceException { - return this.serializer.serializeObject(this.isRestrictQueryPermissions()); - } - - public String xmlrpc_query(String queryExpressionObject) throws CatalogServiceException { - return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject))); - } - - public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException { - return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject))); - } - - public String xmlrpc_getNextPage2(String pageObject) throws CatalogServiceException { - return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(Page.class, pageObject))); - } - - public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws CatalogServiceException { - 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 CatalogServiceException { - 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_getMetadata(String pageObject) throws CatalogServiceException { - return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(Page.class, pageObject))); - } - - - public boolean xmlrpc_removeCatalog(String catalogUrn) throws CatalogServiceException { - this.removeCatalog(catalogUrn); - return true; - } - - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java deleted file mode 100644 index 565d4d3..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java deleted file mode 100644 index e8cbb3e..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.cli.action; - -//OODT imports -import org.apache.oodt.cas.catalog.mapping.IngestMapperFactory; -import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory; -import org.apache.oodt.cas.cli.action.CmdLineAction; - -/** - * Base Catalog Service Server {@link CmdLineAction}. - * - * @author bfoster (Brian Foster) - */ -public abstract class CatalogServiceServerCliAction extends CmdLineAction { - - public int getPort() { - return Integer.getInteger("org.apache.oodt.cas.catalog.port"); - } - - public String getTransactionId() { - return System.getProperty("org.apache.oodt.cas.catalog.transactionid"); - } - - public CatalogRepositoryFactory getRepository() - throws InstantiationException, IllegalAccessException, - ClassNotFoundException { - return (CatalogRepositoryFactory) Class.forName( - System.getProperty("org.apache.oodt.cas.catalog.repository")) - .newInstance(); - } - - public IngestMapperFactory getIngestMapper() throws InstantiationException, - IllegalAccessException, ClassNotFoundException { - return (IngestMapperFactory) Class.forName( - System.getProperty("org.apache.oodt.cas.catalog.ingestmapper")) - .newInstance(); - } - - public boolean getRestrictQueryPermissions() { - return Boolean - .getBoolean("org.apache.oodt.cas.catalog.restrict.query.permissions"); - } - - public boolean getRestrictIngestPermissions() { - return Boolean - .getBoolean("org.apache.oodt.cas.catalog.restrict.ingest.permissions"); - } - - public boolean getOneCatalogFailsAllFail() { - return Boolean - .getBoolean("org.apache.oodt.cas.catalog.oneCatalogFailsAllFail"); - } - - public boolean getSimplifyQueries() { - return Boolean.getBoolean("org.apache.oodt.cas.catalog.simplifyQueries"); - } - - public boolean getDisableIntersectingCrossCatalogQueries() { - return Boolean - .getBoolean("org.apache.oodt.cas.catalog.disableIntersectingCrossCatalogQueries"); - } - - public int getCrossCatalogResultSortingThreshold() { - return Integer - .getInteger("org.apache.oodt.cas.catalog.crossCatalogResultSortingThreshold"); - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java deleted file mode 100644 index 1ef4747..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.cli.action; - -//OODT imports -import org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory; -import org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * - * @author bfoster (Brian Foster) - */ -public class LaunchXmlRpcServerCliAction extends CatalogServiceServerCliAction { - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - printer.println("Starting XML-RPC server on port " + getPort()); - getXmlRpcFactory().createCommunicationChannelServer().startup(); - } catch (Exception e) { - throw new CmdLineActionException("Failed to startup server : " - + e.getMessage(), e); - } - } - - protected XmlRpcCommunicationChannelServerFactory getXmlRpcFactory() - throws InstantiationException, IllegalAccessException, - ClassNotFoundException { - XmlRpcCommunicationChannelServerFactory factory = new XmlRpcCommunicationChannelServerFactory(); - factory.setPort(getPort()); - factory.setCatalogServiceFactory(getCatalogServiceFactory()); - return factory; - } - - protected CatalogServiceLocalFactory getCatalogServiceFactory() - throws InstantiationException, IllegalAccessException, - ClassNotFoundException { - CatalogServiceLocalFactory factory = new CatalogServiceLocalFactory(); - factory.setTransactionIdFactory(getTransactionId()); - factory.setCatalogRepositoryFactory(getRepository()); - factory.setIngestMapperFactory(getIngestMapper()); - factory.setRestrictQueryPermissions(getRestrictQueryPermissions()); - factory.setRestrictIngestPermissions(getRestrictIngestPermissions()); - factory.setOneCatalogFailsAllFail(getOneCatalogFailsAllFail()); - factory.setSimplifyQueries(getSimplifyQueries()); - factory.setDisableIntersectingCrossCatalogQueries( - getDisableIntersectingCrossCatalogQueries()); - factory.setCrossCatalogResultSortingThreshold( - getCrossCatalogResultSortingThreshold()); - return factory; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java deleted file mode 100644 index f415346..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 - */ - TermBucket lookup(Metadata metadata); - - /** - * 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. - */ - Metadata reverseLookup(TermBucket termBucket); - - /** - * - * @param queryExpression - * @return - * @throws CatalogDictionaryException - */ - boolean understands(QueryExpression queryExpression); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java deleted file mode 100644 index 55e7947..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { - - Dictionary createDictionary(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java deleted file mode 100644 index 1a8723f..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 { - - Properties getProperties(); - - String getProperty(String key); - - /** - * 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. - */ - List<TransactionId<?>> getPage(IndexPager indexPage); - - /** - * - * @return - */ - TransactionIdFactory getTransactionIdFactory(); - - /** - * - * @return - * @throws CatalogIndexException - */ - boolean hasTransactionId(TransactionId<?> transactionid) throws CatalogIndexException; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java deleted file mode 100644 index 5dd4098..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { - - Index createIndex(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java deleted file mode 100644 index 161d004..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 - */ - 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 - */ - 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 - */ - 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 - */ - boolean reduce(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java deleted file mode 100644 index 056f9d8..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.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 - * @return Returns a List of TransactionIds that meet the query, otherwise - * an empty List is no TransactionIds are found for the given query - */ - List<IngestReceipt> query(QueryExpression queryExpression) throws QueryServiceException; - - /** - * Returns the results of the given query such that: [startIndex, endIndex) - * @param queryExpression The query for which results will be returned - * @param startIndex The start index of subset of results to be returned - * @param endIndex The end index of the subset of results to be returned - * @return The results of the given query such that: [startIndex, endIndex) - * @throws QueryServiceException on an error - */ - List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException; - - /** - * Returns the number of results found for the given query - * @param queryExpression The query whose size in question - * @return The number of results found for the given query - * @throws QueryServiceException on an error - */ - int sizeOf(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 - */ - 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 - */ - Map<TransactionId<?>, List<TermBucket>> getBuckets(List<TransactionId<?>> transactionIds) throws QueryServiceException; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java deleted file mode 100644 index 7e5d934..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java deleted file mode 100644 index eb5d42b..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 { - - TransactionId<?> createNewTransactionId(); - - TransactionId<?> createTransactionId(String transactionIdString); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java deleted file mode 100644 index 5630b6f..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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; - -//OODT imports -import org.apache.oodt.cas.catalog.query.*; -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; - -//JDK imports -import java.util.Set; - - -/** - * - * @author bfoster - * @version $Revision$ - * - */ -public class WorkflowManagerDictionary implements Dictionary { - - public TermBucket lookup(Metadata metadata) { - if (metadata.getMetadata("ProductType") != null && metadata.getAllMetadata("ProductType").contains("Workflows")) { - TermBucket workflowBucket = new TermBucket("Workflows"); - for (Object key : metadata.getMap().keySet()) { - workflowBucket.addTerm(new Term((String) key, metadata.getAllMetadata((String) key))); - } - return workflowBucket; - }else { - return null; - } - } - - public Metadata reverseLookup(TermBucket termBucket) { - 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) { - Set<String> bucketNames = queryExpression.getBucketNames(); - if (bucketNames == null || bucketNames.contains("Workflows")) { - return queryExpression instanceof NotQueryExpression - || queryExpression instanceof ComparisonQueryExpression - || queryExpression instanceof StdQueryExpression - || queryExpression instanceof QueryLogicalGroup; - } - return false; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java deleted file mode 100644 index e629667..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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; - -//OODT imports -import org.apache.oodt.cas.catalog.struct.DictionaryFactory; - -/** - * - * @author bfoster - * @version $Revision$ - * - */ -public class WorkflowManagerDictionaryFactory implements DictionaryFactory { - - public WorkflowManagerDictionary createDictionary() { - return new WorkflowManagerDictionary(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java deleted file mode 100644 index 5d8b1bd..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java +++ /dev/null @@ -1,549 +0,0 @@ -/* - * 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.index; - -import org.apache.commons.lang.StringUtils; -import org.apache.oodt.cas.catalog.exception.CatalogIndexException; -import org.apache.oodt.cas.catalog.exception.IngestServiceException; -import org.apache.oodt.cas.catalog.exception.QueryServiceException; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.page.IngestReceipt; -import org.apache.oodt.cas.catalog.page.PageInfo; -import org.apache.oodt.cas.catalog.page.ProcessedPageInfo; -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.struct.Index; -import org.apache.oodt.cas.catalog.struct.IngestService; -import org.apache.oodt.cas.catalog.struct.QueryService; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; -import org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory; -import org.apache.oodt.cas.catalog.term.Term; -import org.apache.oodt.cas.catalog.term.TermBucket; -import org.apache.oodt.commons.database.DatabaseConnectionBuilder; -import org.apache.oodt.commons.date.DateUtils; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -/** - * - * DataSource Indexer which supports both ingest and query - * - * @author bfoster - * @version $Revision$ - * - */ -public class DataSourceIndex implements Index, IngestService, QueryService { - - private static final Logger LOG = Logger.getLogger(DataSourceIndex.class.getName()); - - protected DataSource dataSource; - protected boolean useUTF8; - - public DataSourceIndex(String user, String pass, String driver, String jdbcUrl, boolean useUTF8) { - this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass, driver, jdbcUrl); - this.useUTF8 = useUTF8; - } - - public IndexPager getPager(PageInfo pageInfo) throws CatalogIndexException { - return new IndexPager(new ProcessedPageInfo(pageInfo.getPageSize(), pageInfo.getPageNum(), this.getNumOfTransactions())); - } - - protected int getNumOfTransactions() throws CatalogIndexException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT COUNT(transaction_id) AS numTransIds FROM transactions"); - if (rs.next()) { - return rs.getInt("numTransIds"); - } else { - throw new Exception("Failed to query for number of transactions"); - } - }catch (Exception e) { - throw new CatalogIndexException("Failed to get number of transactions : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public List<TransactionId<?>> getPage(IndexPager indexPage) { - return null; - } - - /** - * {@inheritDoc} - */ - public Properties getProperties() { - return new Properties(); - } - - /** - * {@inheritDoc} - */ - public String getProperty(String key) { - return null; - } - - /** - * {@inheritDoc} - */ - public TransactionIdFactory getTransactionIdFactory() { - return new UuidTransactionIdFactory(); - } - - /** - * {@inheritDoc} - */ - public boolean hasTransactionId(TransactionId<?> transactionId) - throws CatalogIndexException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT DISTINCT transaction_id FROM transactions WHERE transaction_id = '" + transactionId + "'"); - return rs.next(); - }catch (Exception e) { - throw new CatalogIndexException("Failed to check for transaction id '" + transactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public boolean delete(TransactionId<?> transactionId) - throws IngestServiceException { - Connection conn = null; - Statement stmt = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - stmt.execute("DELETE FROM transactions WHERE transaction_id = '" + transactionId + "'"); - stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId + "'"); - conn.commit(); - return true; - }catch (Exception e) { - throw new IngestServiceException("Failed to delete transaction id '" + transactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public IngestReceipt ingest(List<TermBucket> termBuckets) throws IngestServiceException { - Connection conn = null; - Statement stmt = null; - TransactionId<?> catalogTransactionId = null; - try { - catalogTransactionId = this.getTransactionIdFactory().createNewTransactionId(); - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - Calendar calendar = DateUtils.getCurrentLocalTime(); - stmt.execute("INSERT INTO transactions VALUES ('" + catalogTransactionId + "','" + DateUtils.toString(calendar) + "')"); - for (TermBucket termBucket : termBuckets) { - for (Term term : termBucket.getTerms()) { - for (String value : term.getValues()) { - try { - stmt.execute("INSERT INTO transaction_terms VALUES ('" + catalogTransactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')"); - }catch (Exception e) { - LOG.log(Level.WARNING, "Failed to ingest term: '" + catalogTransactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + value + "'"); - } - } - } - } - conn.commit(); - return new IngestReceipt(catalogTransactionId, calendar.getTime()); - }catch (Exception e) { - throw new IngestServiceException("Failed to ingest metadata for transaction id '" + catalogTransactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public boolean reduce(TransactionId<?> transactionId, - List<TermBucket> termBuckets) throws IngestServiceException { - Connection conn = null; - Statement stmt = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - for (TermBucket termBucket : termBuckets) { - for (Term term : termBucket.getTerms()) { - for (String value : term.getValues()) { - try { - stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId - + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term - .getName() + "' AND term_value = '" + (this.useUTF8 ? URLEncoder - .encode(value, "UTF8") : value) + "'"); - } catch (Exception e) { - LOG.log(Level.WARNING, - "Failed to delete term: '" + transactionId + "','" + termBucket.getName() + "','" + term - .getName() + "','" + value + "'"); - } - } - } - } - conn.commit(); - return true; - }catch (Exception e) { - throw new IngestServiceException("Failed to delete transaction id '" + transactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public IngestReceipt update(TransactionId<?> transactionId, - List<TermBucket> termBuckets) throws IngestServiceException { - Connection conn = null; - Statement stmt = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - for (TermBucket termBucket : termBuckets) { - for (Term term : termBucket.getTerms()) { - for (String value : term.getValues()) { - try { - stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId - + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term - .getName() + "'"); - stmt.execute( - "INSERT INTO transaction_terms VALUES ('" + transactionId + "','" + termBucket.getName() + "','" - + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')"); - } catch (Exception e) { - LOG.log(Level.WARNING, - "Failed to ingest term: '" + transactionId + "','" + termBucket.getName() + "','" + term - .getName() + "','" + value + "'"); - } - } - } - } - Calendar calendar = DateUtils.getCurrentLocalTime(); - stmt.execute("UPDATE transactions SET transaction_date = '" + DateUtils.toString(calendar) + "' WHERE transaction_id = '" + transactionId + "'"); - return new IngestReceipt(transactionId, calendar.getTime()); - }catch (Exception e) { - throw new IngestServiceException("Failed to ingest metadata for transaction id '" + transactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public List<TermBucket> getBuckets(TransactionId<?> transactionId) - throws QueryServiceException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - ConcurrentHashMap<String, TermBucket> termBuckets = new ConcurrentHashMap<String, TermBucket>(); - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - rs = stmt.executeQuery("SELECT bucket_name,term_name,term_value FROM transaction_terms WHERE transaction_id = '" + transactionId + "'"); - while (rs.next()) { - String bucketName = rs.getString("bucket_name"); - String termName = rs.getString("term_name"); - String termValue = rs.getString("term_value"); - TermBucket bucket = termBuckets.get(bucketName); - if (bucket == null) { - bucket = new TermBucket(bucketName); - } - Term term = new Term(termName, Collections.singletonList((this.useUTF8 ? URLDecoder.decode(termValue, "UTF8") : termValue))); - bucket.addTerm(term); - termBuckets.put(bucketName, bucket); - } - return new Vector<TermBucket>(termBuckets.values()); - }catch (Exception e) { - throw new QueryServiceException("Failed to get term buckets for transaction id '" + transactionId + "' : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - /** - * {@inheritDoc} - */ - public Map<TransactionId<?>, List<TermBucket>> getBuckets( - List<TransactionId<?>> transactionIds) throws QueryServiceException { - ConcurrentHashMap<TransactionId<?>, List<TermBucket>> map = new ConcurrentHashMap<TransactionId<?>, List<TermBucket>>(); - for (TransactionId<?> transactionId : transactionIds) { - map.put(transactionId, this.getBuckets(transactionId)); - } - return map; - } - - /** - * {@inheritDoc} - */ - public List<IngestReceipt> query(QueryExpression queryExpression) - throws QueryServiceException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - String sqlQuery = "SELECT DISTINCT transaction_id,transaction_date FROM transactions " - + "WHERE " - + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")"; - LOG.log(Level.INFO, "Performing Query: " + sqlQuery); - rs = stmt.executeQuery(sqlQuery); - - List<IngestReceipt> receipts = new Vector<IngestReceipt>(); - while (rs.next()) { - receipts.add( - new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")), - DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT) - .getTime())); - } - return receipts; - }catch (Exception e) { - throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - public List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - String sqlQuery = "SELECT DISTINCT transaction_id,transaction_date FROM transactions WHERE " - + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")"; - LOG.log(Level.INFO, "Performing Query: " + sqlQuery); - rs = stmt.executeQuery(sqlQuery); - - List<IngestReceipt> receipts = new Vector<IngestReceipt>(); - int index = 0; - while (startIndex > index && rs.next()) { - index++; - } - while (rs.next() && index++ <= endIndex) { - receipts.add( - new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")), - DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT) - .getTime())); - } - return receipts; - }catch (Exception e) { - throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - public int sizeOf(QueryExpression queryExpression) - throws QueryServiceException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - try { - conn = this.dataSource.getConnection(); - stmt = conn.createStatement(); - String sqlQuery = "SELECT COUNT(transaction_id) AS numTransactions FROM transactions " - + "WHERE " - + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")"; - LOG.log(Level.INFO, "Performing Query: " + sqlQuery); - rs = stmt.executeQuery(sqlQuery); - - int numTransactions = 0; - while (rs.next()) { - numTransactions = rs.getInt("numTransactions"); - } - - return numTransactions; - }catch (Exception e) { - throw new QueryServiceException("Failed to get size of query : " + e.getMessage(), e); - }finally { - try { - conn.close(); - }catch(Exception ignored) {} - try { - stmt.close(); - }catch(Exception ignored) {} - try { - rs.close(); - }catch(Exception ignored) {} - } - } - - - private String getSqlQuery(QueryExpression queryExpression) throws QueryServiceException, UnsupportedEncodingException { - StringBuilder sqlQuery = new StringBuilder(); - StringBuilder bucketNameFilter = new StringBuilder(""); - if (queryExpression.getBucketNames() != null) { - if (queryExpression.getBucketNames().size() == 1) { - bucketNameFilter.append("bucket_name = '").append(queryExpression.getBucketNames().iterator().next()) - .append("' ").append("AND "); - } else if (queryExpression.getBucketNames().size() > 1) { - bucketNameFilter.append("(bucket_name = '") - .append(StringUtils.join(queryExpression.getBucketNames().iterator(), - "' OR bucket_name = '")).append("') AND "); - } - } - if (queryExpression instanceof QueryLogicalGroup) { - QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression; - sqlQuery.append("(").append(this.getSqlQuery(qlg.getExpressions().get(0))); - String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION"; - for (int i = 1; i < qlg.getExpressions().size(); i++) { - sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i))); - } - sqlQuery.append(")"); - }else if (queryExpression instanceof ComparisonQueryExpression){ - ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression; - String operator; - if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) { - operator = "="; - } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN)) { - operator = ">"; - } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN_EQUAL_TO)) { - operator = ">="; - } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN)) { - operator = "<"; - } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN_EQUAL_TO)) { - operator = "<="; - } else { - throw new QueryServiceException("Invalid ComparisonQueryExpression Operator '" + cqe.getOperator() + "'"); - } - - sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms WHERE ") - .append(bucketNameFilter.toString()).append(" ").append("term_name = '") - .append(cqe.getTerm().getName()).append("' AND ("); - for (int i = 0; i < cqe.getTerm().getValues().size(); i++) { - String value = cqe.getTerm().getValues().get(i); - sqlQuery.append("term_value ").append(operator).append(" '") - .append(this.useUTF8 ? URLEncoder.encode(value, "UTF-8") : value).append("'"); - if ((i + 1) < cqe.getTerm().getValues().size()) { - sqlQuery.append(" OR "); - } - } - sqlQuery.append(")"); - }else if (queryExpression instanceof NotQueryExpression) { - NotQueryExpression nqe = (NotQueryExpression) queryExpression; - sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms WHERE ") - .append(bucketNameFilter.toString()).append(" NOT (") - .append(this.getSqlQuery(nqe.getQueryExpression())).append(")"); - }else if (queryExpression instanceof StdQueryExpression) { - sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms ") - .append(bucketNameFilter.toString()); - }else { - throw new QueryServiceException("Invalid QueryExpression '" + queryExpression.getClass().getCanonicalName() + "'"); - } - return sqlQuery.toString(); - } - -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java deleted file mode 100644 index cf6d1ba..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.index; - -//OODT imports -import org.apache.oodt.cas.catalog.struct.Index; -import org.apache.oodt.cas.catalog.struct.IndexFactory; - -/** - * - * Factory for creating DataSourceIndex(s). - * - * @author bfoster - * @version $Revision$ - * - */ -public class DataSourceIndexFactory implements IndexFactory { - - protected String jdbcUrl; - protected String user; - protected String pass; - protected String driver; - protected boolean useUTF8; - - public DataSourceIndexFactory() { - this.useUTF8 = false; - } - - public Index createIndex() { - return new DataSourceIndex(this.user, this.pass, this.driver, this.jdbcUrl, this.useUTF8); - } - - public void setJdbcUrl(String jdbcUrl) { - this.jdbcUrl = jdbcUrl; - } - - public void setUser(String user) { - this.user = user; - } - - public void setPass(String pass) { - this.pass = pass; - } - - public void setDriver(String driver) { - this.driver = driver; - } - - public void setUseUTF8(boolean useUTF8) { - this.useUTF8 = useUTF8; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java deleted file mode 100644 index 20f7b61..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.index; - -//JDK imports -import java.io.File; -import java.io.IOException; -import java.sql.SQLException; - -//OODT imports -import org.apache.oodt.commons.database.SqlScript; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A in memory Index which is ingestable - * <p> - */ -public class InMemoryIndex extends DataSourceIndex { - - public InMemoryIndex(String user, String pass, String driver, - String jdbcUrl, boolean useUTF8, String tablesFile) throws IOException { - super(user, pass, driver, jdbcUrl, useUTF8); - SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.dataSource); - coreSchemaScript.loadScript(); - coreSchemaScript.execute(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java deleted file mode 100644 index 542cae6..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.index; - -//JDK imports -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class InMemoryIndexFactory extends DataSourceIndexFactory { - - private static final Logger LOG = Logger.getLogger(InMemoryIndexFactory.class.getName()); - - protected String tablesFile; - - public InMemoryIndex createIndex() { - try { - return new InMemoryIndex(this.user, this.pass, this.driver, this.jdbcUrl, this.useUTF8, this.tablesFile); - }catch (Exception e) { - LOG.log(Level.SEVERE, "Failed to create InMemoryIndex : " + e.getMessage(), e); - return null; - } - } - - public void setTablesFile(String tablesFile) { - this.tablesFile = tablesFile; - } - -}
