http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java deleted file mode 100644 index 901915b..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java +++ /dev/null @@ -1,91 +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.mapping; - -import java.util.logging.Level; -import java.util.logging.Logger; - -//Spring imports -import org.springframework.beans.factory.annotation.Required; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Factory for creating DataSourceIngestMapper - * <p> - */ -public class DataSourceIngestMapperFactory implements IngestMapperFactory { - - private static Logger LOG = Logger.getLogger(DataSourceIngestMapperFactory.class.getName()); - - protected String jdbcUrl; - protected String user; - protected String pass; - protected String driver; - - public DataSourceIngestMapperFactory() {} - - public String getJdbcUrl() { - return jdbcUrl; - } - - @Required - public void setJdbcUrl(String jdbcUrl) { - this.jdbcUrl = jdbcUrl; - } - - public String getUser() { - return user; - } - - @Required - public void setUser(String user) { - this.user = user; - } - - public String getPass() { - return pass; - } - - @Required - public void setPass(String pass) { - this.pass = pass; - } - - public String getDriver() { - return driver; - } - - @Required - public void setDriver(String driver) { - this.driver = driver; - } - - @Override - public IngestMapper createMapper() { - try { - return new DataSourceIngestMapper(user, pass, - driver, jdbcUrl); - }catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage(), e); - return null; - } - } - -}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java deleted file mode 100644 index 525ea07..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java +++ /dev/null @@ -1,41 +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.mapping; - -//OODT imports -import org.apache.oodt.commons.database.SqlScript; - -//JDK imports -import java.io.File; -import java.io.IOException; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class InMemoryIngestMapper extends DataSourceIngestMapper { - - public InMemoryIngestMapper(String user, String pass, String driver, - String jdbcUrl, String tablesFile) throws IOException { - super(user, pass, driver, jdbcUrl); - SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.getDataSource()); - coreSchemaScript.loadScript(); - coreSchemaScript.execute(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java deleted file mode 100644 index 8d79e41..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java +++ /dev/null @@ -1,52 +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.mapping; - -//JDK imports -import java.util.logging.Level; -import java.util.logging.Logger; - -//OODT imports -import org.apache.oodt.cas.catalog.struct.impl.index.InMemoryIndexFactory; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class InMemoryIngestMapperFactory extends DataSourceIngestMapperFactory { - - private static final Logger LOG = Logger.getLogger(InMemoryIndexFactory.class.getName()); - - protected String tablesFile; - - @Override - public InMemoryIngestMapper createMapper() { - try { - return new InMemoryIngestMapper(user, pass, - driver, jdbcUrl, 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; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java deleted file mode 100644 index 1c1ecde..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java +++ /dev/null @@ -1,157 +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.mapping; - -import java.sql.SQLException; -import java.text.ParseException; -//JDK imports -import java.util.Set; - -//OODT imports -import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; -import org.apache.oodt.cas.catalog.page.CatalogReceipt; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * An Interface Ingest Mapper that indexes transaction ids to catalog transaction ids and catlaog ids - * <p> - */ -public interface IngestMapper { - - /** - * Maps the three arguments to each other so any of the others can be - * retrieved via one of the other arguments - * - * @param catalogServiceTransactionId - * TransactionId generated by the CatalogService - * @throws CatalogRepositoryException - * Any error - * @throws SQLException - */ - void storeTransactionIdMapping( - TransactionId<?> catalogServiceTransactionId, TransactionIdFactory catalogServiceTransactionIdFactory, - CatalogReceipt catalogReceipt, TransactionIdFactory catalogTransactionIdFactory) - throws CatalogRepositoryException, SQLException; - - Set<TransactionId<?>> getPageOfCatalogTransactionIds(IndexPager indexPager, - String catalogId) throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException; - - void deleteTransactionIdMapping(TransactionId<?> catalogTransactionId, - String catalogId) throws CatalogRepositoryException, SQLException; - - void deleteAllMappingsForCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException; - - void deleteAllMappingsForCatalog(String catalogId) - throws CatalogRepositoryException, SQLException; - - /** - * Verify if the given CatalogService TransactionId has been stored in a - * mapping {@link storeTransactionIdMapping(String, TransactionId<?>, - * TransactionId<?>)} - * - * @param catalogServiceTransactionId - * The CatalogService TransactionId in question - * @return True is the catalogServiceTransactionId has been used in a used in a mapping - * @throws CatalogRepositoryException - * Any error - * @throws SQLException - */ - boolean hasCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException; - - /** - * Get the CatalogService TransactionId that was mapped to the given Catalog - * URN and Catalog TransactionId - * - * @param catalogTransactionId - * A Catalog TransactionId - * @param catalogId - * A unique Catalog ID when the Catalog TransactionId was used - * @return The CatalogService TransactionId which was mapped to the given - * Catalog TransactionId and Catalog ID - * @throws CatalogRepositoryException - * Any Error - * @throws SQLException - * @throws ClassNotFoundException - * @throws IllegalAccessException - * @throws InstantiationException - */ - TransactionId<?> getCatalogServiceTransactionId( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException; - - /** - * Get the Catalog TransactionId that was mapped to the given Catalog ID - * and CatalogService TransactionId - * - * @param catalogServiceTransactionId - * A Catalog TransactionId - * @param catalogId - * A unique Catalog ID when the Catalog TransactionId was used - * @return The CatalogService TransactionId which was mapped to the given - * Catalog TransactionId and Catalog ID - * @throws CatalogRepositoryException - * Any Error - * @throws SQLException - * @throws ClassNotFoundException - * @throws IllegalAccessException - * @throws InstantiationException - */ - TransactionId<?> getCatalogTransactionId( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException; - - /** - * Get all the Catalog URNs for which the given TransactionId was mapped - * - * @param catalogServiceTransactionId - * A CatalogService TransactionId - * @return Catalog IDs for which the given TransactionId was mapped - * @throws CatalogRepositoryException - * Any Error - * @throws SQLException - */ - Set<String> getCatalogIds( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException; - - /** - * - * @param catalogServiceTransactionId - * @param catalogId - * @return - * @throws CatalogRepositoryException - * @throws SQLException - * @throws ClassNotFoundException - * @throws IllegalAccessException - * @throws InstantiationException - * @throws ParseException - */ - CatalogReceipt getCatalogReceipt( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, ParseException; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java deleted file mode 100644 index 964a0dd..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.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.mapping; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Factory for creating IngestMapper - * <p> - */ -public interface IngestMapperFactory { - - IngestMapper createMapper(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java deleted file mode 100644 index 3b97265..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java +++ /dev/null @@ -1,114 +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.mapping; - -//JDK imports -import java.util.Set; - -//OODT imports -import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; -import org.apache.oodt.cas.catalog.page.CatalogReceipt; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Ingest Mapper that indexes to a Lucene index - * <p> - */ -public class LuceneIngestMapper implements IngestMapper { - - private static final String UNSUPPORTED = "This operation is currently unsupported. Please report to [email protected]"; - @Override - public void deleteAllMappingsForCatalog(String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public void deleteAllMappingsForCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public void deleteTransactionIdMapping( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public CatalogReceipt getCatalogReceipt( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public TransactionId<?> getCatalogServiceTransactionId( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public TransactionId<?> getCatalogTransactionId( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public Set<String> getCatalogIds( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public Set<TransactionId<?>> getPageOfCatalogTransactionIds( - IndexPager indexPager, String catalogId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public boolean hasCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - @Override - public void storeTransactionIdMapping( - TransactionId<?> catalogServiceTransactionId, - TransactionIdFactory catalogServiceTransactionIdFactory, - CatalogReceipt catalogReceipt, - TransactionIdFactory catalogTransactionIdFactory) - throws CatalogRepositoryException { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java deleted file mode 100644 index c736bd9..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java +++ /dev/null @@ -1,35 +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.mapping; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Factory for creating LuceneIngestMapper - * <p> - */ -public class LuceneIngestMapperFactory implements - IngestMapperFactory { - - @Override - public IngestMapper createMapper() { - return new LuceneIngestMapper(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java deleted file mode 100644 index 58df519..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java +++ /dev/null @@ -1,281 +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.mapping; - -//JDK imports -import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; -import org.apache.oodt.cas.catalog.page.CatalogReceipt; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.Vector; -import java.util.logging.Level; -import java.util.logging.Logger; - -//OODT imports - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Ingest Mapper that indexes to local memory - * <p> - */ -public class MemoryBasedIngestMapper implements IngestMapper { - - private static Logger LOG = Logger.getLogger(MemoryBasedIngestMapper.class.getName()); - - protected ConcurrentHashMap<String, TransactionIdMapping> catalogServiceTransactionIdKeyMapping; - protected ConcurrentHashMap<String, TransactionIdMapping> catalogInfoKeyMapping; - protected ConcurrentHashMap<String, List<CatalogReceipt>> catalogIdToCatalogReceiptMapping; - - public MemoryBasedIngestMapper() { - this.catalogServiceTransactionIdKeyMapping = new ConcurrentHashMap<>(); - this.catalogInfoKeyMapping = new ConcurrentHashMap<>(); - this.catalogIdToCatalogReceiptMapping = new ConcurrentHashMap<>(); - } - - /* - * (non-Javadoc) - * - * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository# - * getCatalogServiceTransactionId - * (org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String) - */ - @Override - public synchronized TransactionId<?> getCatalogServiceTransactionId( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException { - LOG.log(Level.INFO, "Looking up CatalogService TransactionId for Catalog TransactionId '" + catalogTransactionId + "' and catalog '" + catalogId + "'"); - String key = generateKey(catalogTransactionId.toString(), catalogId); - TransactionIdMapping mapping = this.catalogInfoKeyMapping.get(key); - if (mapping != null) { - return mapping.catalogServiceTransactionId; - }else { - return null; - } - } - - /* - * (non-Javadoc) - * - * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository# - * getCatalogTransactionId - * (org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String) - */ - @Override - public synchronized TransactionId<?> getCatalogTransactionId( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException { - TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping - .get(catalogServiceTransactionId.toString()); - if (mapping != null) { - for (CatalogReceipt receipt : mapping.getCatalogReceipts()) { - if (receipt.getCatalogId().equals(catalogId)) { - return receipt.getTransactionId(); - } - } - } - return null; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.oodt.cas.catalog.mapping.IngestMapper#getPage(org.apache - * .oodt.cas.catalog.page.IndexPager, java.lang.String) - */ - @Override - public synchronized Set<TransactionId<?>> getPageOfCatalogTransactionIds(IndexPager indexPager, - String catalogId) throws CatalogRepositoryException { - Set<TransactionId<?>> catalogTransactionIds = new HashSet<>(); - List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId); - if (catalogReceipts != null) { - for (int i = indexPager.getPageNum() * indexPager.getPageSize(); - i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++) { - catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId()); - } - } - return catalogTransactionIds; - } - - /* - * (non-Javadoc) - * @see org.apache.oodt.cas.catalog.mapping.IngestMapper#deleteAllMappingsForCatalog(java.lang.String) - */ - @Override - public synchronized void deleteAllMappingsForCatalog(String catalogId) - throws CatalogRepositoryException { - List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.remove(catalogId); - if (catalogReceipts != null) { - for (CatalogReceipt catalogReceipt : catalogReceipts) { - TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId())); - if (mapping != null) { - mapping.getCatalogReceipts().remove(catalogReceipt); - } - } - } - } - - /* - * (non-Javadoc) - * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#deleteAllMappingsForCatalogServiceTransactionId(org.apache.oodt.cas.catalog.struct.TransactionId) - */ - @Override - public synchronized void deleteAllMappingsForCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.remove(catalogServiceTransactionId.toString()); - if (mapping != null) { - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { - this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt); - this.catalogInfoKeyMapping - .remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId())); - } - } - } - - /* - * (non-Javadoc) - * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#deleteTransactionIdMapping(org.apache.oodt.cas.catalog.struct.TransactionId, org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String) - */ - @Override - public synchronized void deleteTransactionIdMapping( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException { - List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId); - for (int i = 0; i < catalogReceipts.size(); i++) { - if (catalogReceipts.get(i).getCatalogId().equals(catalogId) && catalogReceipts.get(i).getTransactionId().equals(catalogTransactionId)) { - catalogReceipts.remove(i); - break; - } - } - TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogTransactionId.toString(), catalogId)); - this.catalogServiceTransactionIdKeyMapping.remove(mapping.getCatalogServiceTransactionId().toString()); - } - - /* - * (non-Javadoc) - * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#hasCatalogServiceTransactionId(org.apache.oodt.cas.catalog.struct.TransactionId) - */ - @Override - public synchronized boolean hasCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - return this.catalogServiceTransactionIdKeyMapping.containsKey(catalogServiceTransactionId.toString()); - } - - /* - * (non-Javadoc) - * - * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository# - * storeTransactionIdMapping(java.lang.String, - * org.apache.oodt.cas.catalog.struct.TransactionId, - * org.apache.oodt.cas.catalog.struct.TransactionId) - */ - @Override - public synchronized void storeTransactionIdMapping( - TransactionId<?> catalogServiceTransactionId, - TransactionIdFactory catalogServiceTransactionIdFactory, - CatalogReceipt catalogReceipt, - TransactionIdFactory catalogTransactionIdFactory) - throws CatalogRepositoryException { - TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping - .get(catalogServiceTransactionId.toString()); - if (mapping == null) { - mapping = new TransactionIdMapping(catalogServiceTransactionId); - } - mapping.addCatalogReceipt(catalogReceipt); - this.catalogServiceTransactionIdKeyMapping.put( - catalogServiceTransactionId.toString(), mapping); - this.catalogInfoKeyMapping.put(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()), mapping); - List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()); - if (catalogReceipts == null) { - catalogReceipts = new Vector<CatalogReceipt>(); - } - catalogReceipts.add(catalogReceipt); - this.catalogIdToCatalogReceiptMapping.put(catalogReceipt.getCatalogId(), catalogReceipts); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.oodt.cas.catalog.repository.CatalogRepository#getCatalogs - * (org.apache.oodt.cas.catalog.struct.TransactionId) - */ - @Override - public synchronized Set<String> getCatalogIds( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException { - HashSet<String> catalogs = new HashSet<>(); - TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping - .get(catalogServiceTransactionId.toString()); - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { - catalogs.add(catalogReceipt.getCatalogId()); - } - return catalogs; - } - - @Override - public CatalogReceipt getCatalogReceipt( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException { - TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.get(catalogServiceTransactionId); - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { - if (catalogReceipt.getCatalogId().equals(catalogId)) { - return catalogReceipt; - } - } - return null; - } - - private static String generateKey(String catalogTransactionId, String catalogId) { - return catalogTransactionId + ":" + catalogId; - } - - private static class TransactionIdMapping { - - private TransactionId<?> catalogServiceTransactionId; - private List<CatalogReceipt> catalogReceipts; - - public TransactionIdMapping(TransactionId<?> catalogServiceTransactionId) { - this.catalogServiceTransactionId = catalogServiceTransactionId; - this.catalogReceipts = new Vector<>(); - } - - public void addCatalogReceipt(CatalogReceipt catalogReceipt) { - this.catalogReceipts.add(catalogReceipt); - } - - public List<CatalogReceipt> getCatalogReceipts() { - return this.catalogReceipts; - } - - public TransactionId<?> getCatalogServiceTransactionId() { - return catalogServiceTransactionId; - } - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java deleted file mode 100644 index cf691ba..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.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.mapping; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Factory for creating MemoryBasedIngestMapper - * <p> - */ -public class MemoryBasedIngestMapperFactory implements IngestMapperFactory { - - @Override - public IngestMapper createMapper() { - return new MemoryBasedIngestMapper(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java deleted file mode 100644 index 7474581..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java +++ /dev/null @@ -1,73 +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.metadata; - -//JDK imports -import java.util.Date; -import java.util.Set; - -//APACHE imports -import org.apache.commons.lang.StringUtils; - -//OODT imports -import org.apache.oodt.cas.catalog.page.TransactionReceipt; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.system.CatalogService; -import org.apache.oodt.cas.metadata.Metadata; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * Metadata tied to a Transaction - * <p> - */ -public class TransactionalMetadata { - - protected TransactionReceipt receipt; - protected Metadata metadata; - - public TransactionalMetadata(TransactionReceipt receipt, Metadata metadata) { - this.receipt = receipt; - this.metadata = metadata; - this.metadata.replaceMetadata(CatalogService.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, this.receipt.getTransactionId().toString()); - this.metadata.replaceMetadata(CatalogService.CATALOG_IDS_MET_KEY, StringUtils.join(this.receipt.getCatalogIds().iterator(), ",")); - } - - public TransactionId<?> getTransactionId() { - return receipt.getTransactionId(); - } - - public Set<String> getCatalogIds() { - return receipt.getCatalogIds(); - } - - public Date getTransactionDate() { - return receipt.getTransactionDate(); - } - - public Metadata getMetadata() { - return metadata; - } - - @Override - public int hashCode() { - return this.getTransactionId().hashCode(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java deleted file mode 100644 index 3f9c195..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java +++ /dev/null @@ -1,83 +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.page; - -//JDK imports -import org.apache.oodt.cas.catalog.struct.TransactionId; - -import java.util.Date; - -//OODT imports - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogReceipt { - - private TransactionId<?> transactionId; - private Date transactionDate; - private String catalogId; - - public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) { - this.transactionId = ingestReceipt.getCatalogTransactionId(); - this.transactionDate = ingestReceipt.getTransactionDate(); - this.catalogId = catalogId; - } - - public TransactionId<?> getTransactionId() { - return this.transactionId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public String getCatalogId() { - return this.catalogId; - } - - public boolean equals(Object obj) { - if (obj instanceof CatalogReceipt) { - CatalogReceipt compareTo = (CatalogReceipt) obj; - return this.transactionId.equals(compareTo.transactionId) && this.transactionDate.equals(compareTo.transactionDate) && this.catalogId.equals(compareTo.catalogId); - }else { - return false; - } - } - - public int hashCode() { - return this.toString().hashCode(); - } - - public String toString() { - return ("{CatalogReceipt(tID=" + this.transactionId + ",tDate=" + this.transactionDate + ",catID=" + this.catalogId + ")}"); - } - - public void setTransactionId(TransactionId<?> transactionId) { - this.transactionId = transactionId; - } - - public void setTransactionDate(Date transactionDate) { - this.transactionDate = transactionDate; - } - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java deleted file mode 100644 index 9c9045a..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.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.page; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A pager for paging through a index - * <p> - */ -public class IndexPager { - - protected int pageSize; - protected int pageNum; - protected int totalPages; - protected int numOfHits; - - public IndexPager() { - this.pageSize = 20; - this.pageNum = 1; - this.totalPages = 0; - } - - public IndexPager(ProcessedPageInfo processedPageInfo) { - this.pageSize = processedPageInfo.getPageSize(); - this.pageNum = processedPageInfo.getPageNum(); - this.totalPages = processedPageInfo.getTotalPages(); - this.numOfHits = processedPageInfo.getNumOfHits(); - } - - public ProcessedPageInfo getProcessedPageInfo() { - return new ProcessedPageInfo(this.pageSize, this.pageNum, this.numOfHits); - } - - public int getPageSize() { - return this.pageSize; - } - - public int getPageNum() { - return this.pageNum; - } - - public int getTotalPages() { - return this.totalPages; - } - - public int getNumOfHits() { - return this.numOfHits; - } - - public void incrementPageNumber() { - if (this.pageNum + 1 <= this.totalPages) { - this.pageNum++; - } - } - - public boolean isLastPage() { - return this.getProcessedPageInfo().isLastPage(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java deleted file mode 100644 index f6e0b38..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java +++ /dev/null @@ -1,56 +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.page; - -//JDK imports -import java.util.Date; - -//OODT imports -import org.apache.oodt.cas.catalog.struct.TransactionId; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class IngestReceipt { - - protected TransactionId<?> catalogTransactionId; - protected Date transactionDate; - - public IngestReceipt(TransactionId<?> catalogTransactionId, Date transactionDate) { - this.catalogTransactionId = catalogTransactionId; - this.transactionDate = transactionDate; - } - - public TransactionId<?> getCatalogTransactionId() { - return this.catalogTransactionId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public int hashCode() { - return this.catalogTransactionId.hashCode(); - } - - public String toString() { - return this.catalogTransactionId.toString() + " : " + this.transactionDate.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java deleted file mode 100644 index be5dce3..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.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.page; - -//JDK imports -import java.util.List; -import java.util.Set; - -//OODT imports -import org.apache.oodt.cas.catalog.query.QueryExpression; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class Page { - - protected List<TransactionReceipt> receipts; - protected ProcessedPageInfo processedPageInfo; - protected QueryExpression queryExpression; - protected Set<String> restrictToCatalogIds; - - public Page(ProcessedPageInfo pageInfo, QueryExpression queryExpression, Set<String> restrictToCatalogIds, List<TransactionReceipt> receipts) { - this.processedPageInfo = pageInfo; - this.queryExpression = queryExpression; - this.restrictToCatalogIds = restrictToCatalogIds; - this.receipts = receipts; - } - - public List<TransactionReceipt> getReceipts() { - return this.receipts; - } - - public int getPageSize() { - return this.processedPageInfo.getPageSize(); - } - - public int getPageNum() { - return this.processedPageInfo.getPageNum(); - } - - public int getTotalPages() { - return this.processedPageInfo.getTotalPages(); - } - - public int getNumOfHits() { - return this.processedPageInfo.getNumOfHits(); - } - - public QueryExpression getQueryExpression() { - return queryExpression; - } - - public Set<String> getRestrictToCatalogIds() { - return restrictToCatalogIds; - } - - public boolean isLastPage() { - return this.processedPageInfo.isLastPage(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java deleted file mode 100644 index af0f0f3..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java +++ /dev/null @@ -1,49 +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.page; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class PageInfo { - - protected int pageSize; - protected int pageNum; - - public static final int LAST_PAGE = Integer.MAX_VALUE; - public static final int FIRST_PAGE = 1; - - public PageInfo(int pageSize, int pageNum) { - this.pageSize = pageSize; - if (pageNum < 1) { - this.pageNum = 1; - } else { - this.pageNum = pageNum; - } - } - - public int getPageSize() { - return pageSize; - } - - public int getPageNum() { - return pageNum; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java deleted file mode 100644 index d454e69..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.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.page; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class ProcessedPageInfo extends PageInfo { - - protected int totalPages; - protected int numOfHits; - - public ProcessedPageInfo(int pageSize, int pageNum, int numOfHits) { - super(pageSize, pageNum > ((int) Math.ceil((double) numOfHits / (double) pageSize)) ? ((int) Math.ceil((double) numOfHits / (double) pageSize)) : pageNum); - this.totalPages = ((int) Math.ceil((double) numOfHits / (double) pageSize)); - this.numOfHits = numOfHits; - } - - public int getTotalPages() { - return this.totalPages; - } - - public int getNumOfHits() { - return this.numOfHits; - } - - public boolean isLastPage() { - return this.pageNum >= this.totalPages; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java deleted file mode 100644 index 59ff1f5..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java +++ /dev/null @@ -1,73 +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.page; - -//JDK imports -import java.util.Collections; -import java.util.List; -import java.util.Vector; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A pager for paging through query results - * <p> - */ -public class QueryPager extends IndexPager { - - protected List<TransactionReceipt> receipts; - - public QueryPager(List<TransactionReceipt> receipts) { - super(); - this.receipts = new Vector<TransactionReceipt>(receipts); - this.totalPages = this.caculateTotalPages(); - this.numOfHits = receipts.size(); - } - - protected int caculateTotalPages() { - return (int) Math.ceil((double) receipts.size() / (double) this.getPageSize()); - } - - public void setPageInfo(PageInfo pageInfo) { - this.pageSize = Math.max(pageInfo.getPageSize(), 0); - this.totalPages = this.caculateTotalPages(); - if (this.totalPages == 0) { - this.pageNum = 0; - } else { - this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages) - ? this.totalPages : pageInfo.getPageNum(); - } - } - - public List<TransactionReceipt> getTransactionReceipts() { - return Collections.unmodifiableList(this.receipts); - } - - public List<TransactionReceipt> getCurrentPage() { - List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>(); - if (this.pageNum > 0) { - for (int i = (this.getPageNum() - 1) * this.getPageSize(); - i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++) { - currentPage.add(receipts.get(i)); - } - } - return currentPage; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java deleted file mode 100644 index 9dfa440..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java +++ /dev/null @@ -1,91 +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.page; - -//JDK imports -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.Vector; - -//OODT imports -import org.apache.oodt.cas.catalog.struct.TransactionId; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Reciept created by performing a transaction with a CatalogService - * <p> - */ -public class TransactionReceipt { - - protected TransactionId<?> transactionId; - protected Set<String> catalogIds; - protected Date transactionDate; - protected Vector<CatalogReceipt> catalogReceipts; - - public TransactionReceipt(TransactionId<?> transactionId, List<CatalogReceipt> catalogReceipts) { - this.transactionId = transactionId; - this.catalogIds = new HashSet<String>(); - this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts); - for (CatalogReceipt catalogReceipt : catalogReceipts) { - this.catalogIds.add(catalogReceipt.getCatalogId()); - if (this.transactionDate == null) { - this.transactionDate = catalogReceipt.getTransactionDate(); - } else if (this.transactionDate.before(catalogReceipt.getTransactionDate())) { - this.transactionDate = catalogReceipt.getTransactionDate(); - } - } - } - - public TransactionId<?> getTransactionId() { - return this.transactionId; - } - - public Set<String> getCatalogIds() { - return this.catalogIds; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public List<CatalogReceipt> getCatalogReceipts() { - return Collections.unmodifiableList(this.catalogReceipts); - } - - public int hashCode() { - return this.transactionId.hashCode(); - } - - public boolean equals(Object obj) { - if (obj instanceof TransactionReceipt) { - return this.transactionId.equals(((TransactionReceipt) obj).transactionId); - }else { - return false; - } - } - - public String toString() { - return this.transactionId + ":" + this.catalogIds; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java deleted file mode 100644 index 049e821..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java +++ /dev/null @@ -1,84 +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.query; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A TermQueryExpression which allows Term comparison - * <p> - */ -public class ComparisonQueryExpression extends TermQueryExpression { - - public enum Operator { EQUAL_TO("=="), LESS_THAN_EQUAL_TO("<="), GREATER_THAN_EQUAL_TO(">="), LESS_THAN("<"), GREATER_THAN(">"), LIKE("LIKE"); - - private String value; - - Operator(String value) { - this.value = value; - } - - public static Operator getOperatorBySign(String sign) { - if (EQUAL_TO.value.equals(sign)) { - return EQUAL_TO; - } else if (LESS_THAN_EQUAL_TO.value.equals(sign)) { - return LESS_THAN_EQUAL_TO; - } else if (GREATER_THAN_EQUAL_TO.value.equals(sign)) { - return GREATER_THAN_EQUAL_TO; - } else if (LESS_THAN.value.equals(sign)) { - return LESS_THAN; - } else if (GREATER_THAN.value.equals(sign)) { - return GREATER_THAN; - } else if (LIKE.value.equals(sign)) { - return LIKE; - } else { - throw new IllegalArgumentException("Not matching operator for '" + sign + "'"); - } - } - - public String toString() { - return this.value; - } - - } - protected Operator operator; - - public void setOperator(Operator operator) { - this.operator = operator; - } - - public Operator getOperator() { - return this.operator; - } - - @Override - public String toString() { - return "({" + this.bucketNames + "} " + this.getTerm().getName() + " " + this.operator + " " + this.getTerm().getValues() + ")"; - } - - @Override - public ComparisonQueryExpression clone() { - ComparisonQueryExpression newQE = new ComparisonQueryExpression(); - newQE.operator = this.operator; - newQE.setTerm(this.term.clone()); - newQE.setBucketNames(this.getBucketNames()); - return newQE; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java deleted file mode 100644 index 544ef35..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java +++ /dev/null @@ -1,73 +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.query; - -//JDK imports -import java.util.Properties; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Configurable QueryExpression - * <p> - */ -public class CustomQueryExpression extends QueryExpression { - - protected Properties properties; - protected String name; - - public CustomQueryExpression(String name) { - this(name, new Properties()); - } - - public CustomQueryExpression(String name, Properties properties) { - super(); - this.name = name; - if (properties != null) { - this.properties = properties; - } else { - this.properties = new Properties(); - } - } - - public String getName() { - return this.name; - } - - public void setProperty(String key, String value) { - this.properties.put(key, value); - } - - public String getProperty(String key) { - return this.properties.getProperty(key); - } - - @Override - public CustomQueryExpression clone() { - CustomQueryExpression cqe = new CustomQueryExpression(this.name, (Properties) this.properties.clone()); - cqe.setBucketNames(this.getBucketNames()); - return cqe; - } - - @Override - public String toString() { - return "({" + this.bucketNames + "} " + this.name + " : " + this.properties.toString() + ")"; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java deleted file mode 100644 index 8a621fd..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java +++ /dev/null @@ -1,58 +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.query; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CustomWrapperQueryExpression extends WrapperQueryExpression { - - protected String meaning; - - public CustomWrapperQueryExpression(String meaning) { - this.meaning = meaning; - } - - public CustomWrapperQueryExpression(String meaning, QueryExpression queryExpression) { - super(queryExpression); - this.meaning = meaning; - } - - public String getMeaning() { - return this.meaning; - } - - @Override - public CustomWrapperQueryExpression clone() { - CustomWrapperQueryExpression cwqe = new CustomWrapperQueryExpression(this.meaning, this.queryExpression.clone()); - cwqe.setBucketNames(this.bucketNames); - return cwqe; - } - - @Override - public String toString() { - return "({" + this.bucketNames + "} " + this.meaning + "(" + this.queryExpression + "))"; - } - - @Override - public boolean isValidWithNoSubExpression() { - return false; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java deleted file mode 100644 index 01142a4..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java +++ /dev/null @@ -1,103 +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.query; - -//JDK imports -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - * @author woollard - * @author bfoster - * @version $Revision$ - * - * <p> - * A Free Text TermQueryExpression - * </p> - * - */ -public class FreeTextQueryExpression extends TermQueryExpression { - - private HashSet<String> noiseWordHash = new HashSet<String>( - Arrays.asList(new String[] { "a", "all", "am", "an", "and", - "any", "are", "as", "at", "be", "but", "can", "did", "do", "does", - "for", "from", "had", "has", "have", "here", "how", "i", "if", - "in", "is", "it", "no", "not", "of", "on", "or", "so", "that", - "the", "then", "there", "this", "to", "too", "up", "use", "what", - "when", "where", "who", "why", "you" })); - - /** - * A method for adding unparsed free text to the FreeTextCriteria. Free text - * entered as a string is tokenized and punctuation and common words are - * dropped before the values are added to the query. In order to query for - * pre-parsed keywords, see the setValues method of this class. - * - * @param text - * The free text to be parsed and searched on. - */ - public void addFreeText(String text) { - // remove punctuation from the text - text = text.replaceAll("\\p{Punct}+", ""); - - // tokenize string using default delimiters - StringTokenizer tok = new StringTokenizer(text); - String token; - - // filter noise words and add to values vector - List<String> values = new Vector<String>(); - while (tok.hasMoreElements()) { - token = tok.nextToken(); - if (!noiseWordHash.contains(token)) { - values.add(token); - } - } - if (values.size() > 0) { - values.addAll(this.term.getValues()); - this.term.setValues(values); - } - } - - /** - * Implementation of the abstract method inherited from QueryCriteria for - * generating a human-parsable string version of the query criteria. Note - * that the returned String follows the Lucene query language. - * - * @return The query as a String. - */ - public String toString() { - StringBuilder serial = new StringBuilder(); - serial.append("({").append(this.bucketNames).append("} ").append(this.term.getName()).append(" :|"); - for (String value : this.term.getValues()) { - serial.append("+").append(value); - serial.append("|: )"); - } - return serial.toString(); - } - - @Override - public FreeTextQueryExpression clone() { - FreeTextQueryExpression ftQE = new FreeTextQueryExpression(); - ftQE.noiseWordHash = new HashSet<String>(this.noiseWordHash); - ftQE.setTerm(this.term.clone()); - ftQE.setBucketNames(this.bucketNames); - return ftQE; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java deleted file mode 100644 index 3609dfc..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java +++ /dev/null @@ -1,54 +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.query; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A WrapperQueryExpression which signifies negation of wrapped QueryExpression - * <p> - */ -public class NotQueryExpression extends WrapperQueryExpression { - - public NotQueryExpression() { - super(); - } - - public NotQueryExpression(QueryExpression queryExpression) { - super(queryExpression); - } - - @Override - public NotQueryExpression clone() { - NotQueryExpression nqe = new NotQueryExpression(this.queryExpression.clone()); - nqe.setBucketNames(this.getBucketNames()); - return nqe; - } - - @Override - public String toString() { - return "(NOT (" + this.queryExpression + "))"; - } - - @Override - public boolean isValidWithNoSubExpression() { - return false; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java deleted file mode 100644 index c8ef02a..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java +++ /dev/null @@ -1,53 +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.query; - -//JDK imports -import java.util.HashSet; -import java.util.Set; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Expression for querying against a CatalogServices Metadata - * <p> - */ -public abstract class QueryExpression implements Cloneable { - - protected Set<String> bucketNames; - - public QueryExpression() {} - - public QueryExpression(Set<String> bucketNames) { - this.bucketNames = new HashSet<String>(bucketNames); - } - - public Set<String> getBucketNames() { - return (this.bucketNames != null) ? new HashSet<String>(this.bucketNames) : null; - } - - public void setBucketNames(Set<String> bucketNames) { - this.bucketNames = bucketNames; - } - - public abstract String toString(); - - public abstract QueryExpression clone(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java deleted file mode 100644 index 1a1fdac..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java +++ /dev/null @@ -1,117 +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.query; - -//JDK imports -import java.util.Collections; -import java.util.List; -import java.util.Vector; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A QueryExpression which groups other QueryExpressions - * <p> - */ -public class QueryLogicalGroup extends QueryExpression { - - public enum Operator { AND, OR } - - protected Operator operator; - - protected List<QueryExpression> queryExpressions; - - public QueryLogicalGroup() { - this(new Vector<QueryExpression>(), Operator.AND); - } - - public QueryLogicalGroup(List<QueryExpression> queryExpressions) { - this(queryExpressions, Operator.AND); - } - - public QueryLogicalGroup(List<QueryExpression> queryExpressions, Operator operator) { - this.setExpressions(queryExpressions); - this.setOperator(operator); - } - - public void setExpressions(List<QueryExpression> queryExpressions) { - this.queryExpressions = new Vector<QueryExpression>(queryExpressions); - } - - /** - * - * @param queryExpression - */ - public void addExpression(QueryExpression queryExpression) { - this.queryExpressions.add(queryExpression); - } - - /** - * - * @param queryExpressions - */ - public void addExpressions(List<QueryExpression> queryExpressions) { - this.queryExpressions.addAll(queryExpressions); - } - - /** - * - * @return - */ - public List<QueryExpression> getExpressions() { - return Collections.unmodifiableList(this.queryExpressions); - } - - /** - * - * @param operator - */ - public void setOperator(Operator operator) { - this.operator = operator; - } - - /** - * - * @return - */ - public Operator getOperator() { - return this.operator; - } - - @Override - public String toString() { - StringBuilder query = new StringBuilder(); - query.append("({").append(this.bucketNames).append("} ").append(this.operator).append(" : "); - for (QueryExpression queryExpression : this.queryExpressions) { - query.append(queryExpression.toString()).append(","); - } - return query.substring(0, query.length() - 1) + ")"; - } - - public QueryLogicalGroup clone() { - QueryLogicalGroup qlGroup = new QueryLogicalGroup(); - qlGroup.setBucketNames(this.getBucketNames()); - qlGroup.setOperator(this.operator); - for (QueryExpression qe : this.queryExpressions) { - qlGroup.addExpression(qe.clone()); - } - return qlGroup; - } - -} \ 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/query/StdQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java deleted file mode 100644 index 4353d4c..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java +++ /dev/null @@ -1,50 +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.query; - -//JDK imports -import java.util.Set; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Standard QueryExpression - * <p> - */ -public class StdQueryExpression extends QueryExpression { - - public StdQueryExpression() { - super(); - } - - public StdQueryExpression(Set<String> bucketNames) { - super(bucketNames); - } - - @Override - public StdQueryExpression clone() { - return new StdQueryExpression(this.getBucketNames()); - } - - @Override - public String toString() { - return "({" + this.bucketNames + "})"; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java deleted file mode 100644 index b551126..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java +++ /dev/null @@ -1,44 +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.query; - -//OODT imports -import org.apache.oodt.cas.catalog.term.Term; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A QueryExpression which wrappers a Term - * <p> - */ -public abstract class TermQueryExpression extends QueryExpression implements Cloneable { - - protected Term term; - - public Term getTerm() { - return this.term; - } - - public void setTerm(Term term) { - this.term = term; - } - - public abstract TermQueryExpression clone(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java deleted file mode 100644 index a11c627..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java +++ /dev/null @@ -1,57 +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.query; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A QueryExpression which wrappers another QueryExpression - * <p> - */ -public abstract class WrapperQueryExpression extends QueryExpression { - - protected QueryExpression queryExpression; - - public WrapperQueryExpression() { - super(); - } - - public WrapperQueryExpression(QueryExpression queryExpression) { - this(); - this.queryExpression = queryExpression; - } - - public QueryExpression getQueryExpression() { - return queryExpression; - } - - public void setQueryExpression(QueryExpression queryExpression) { - this.queryExpression = queryExpression; - } - - @Override - public String toString() { - return "(" + this.queryExpression + ")"; - } - - public abstract boolean isValidWithNoSubExpression(); - - public abstract WrapperQueryExpression clone(); - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java deleted file mode 100644 index c3b99e1..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java +++ /dev/null @@ -1,35 +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.query.filter; - -//JDK imports -import java.util.List; - -/** - * - * @author bfoster - * @version $Revision$ - * - * <p> - * An algorithm interface for defining how QueryFilter filters query results - * <p> - */ -public abstract class FilterAlgorithm<FilterType> { - - public abstract List<FilterType> filter(List<FilterType> events); - -}
