| /* |
| * 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.filemgr.catalog; |
| |
| //OODT imports |
| import org.apache.oodt.cas.filemgr.structs.BooleanQueryCriteria; |
| import org.apache.oodt.cas.filemgr.structs.Element; |
| import org.apache.oodt.cas.filemgr.structs.Product; |
| import org.apache.oodt.cas.filemgr.structs.ProductPage; |
| import org.apache.oodt.cas.filemgr.structs.ProductType; |
| import org.apache.oodt.cas.filemgr.structs.Query; |
| import org.apache.oodt.cas.filemgr.structs.QueryCriteria; |
| import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria; |
| import org.apache.oodt.cas.filemgr.structs.Reference; |
| import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria; |
| import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; |
| import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException; |
| import org.apache.oodt.cas.filemgr.util.DbStructFactory; |
| import org.apache.oodt.cas.filemgr.validation.ValidationLayer; |
| import org.apache.oodt.cas.metadata.Metadata; |
| import org.apache.oodt.commons.pagination.PaginationUtils; |
| import org.apache.oodt.commons.util.DateConvert; |
| |
| //SPRING imports |
| import org.springframework.util.StringUtils; |
| |
| |
| |
| //JDK imports |
| import java.util.Date; |
| import java.util.Iterator; |
| import java.util.List; |
| import java.util.TreeMap; |
| import java.util.UUID; |
| import java.util.Vector; |
| import java.util.logging.Level; |
| import java.util.logging.Logger; |
| |
| |
| /** |
| * @author starchmd |
| * @version $Revision$ |
| * |
| * <p> |
| * Passes through {@link Catalog} calls to a subordinate catalog. Allows individual method overriding/ method hijacking. |
| * </p> |
| * |
| */ |
| public abstract class SpacerCatalog implements Catalog { |
| /* our log stream */ |
| private static final Logger LOG = Logger.getLogger(DataSourceCatalog.class.getName()); |
| |
| protected Catalog catalog; |
| |
| /** |
| * <p> |
| * Default Constructor |
| * </p>. |
| * @throws |
| */ |
| public SpacerCatalog(Catalog catalog) { |
| this.catalog = catalog; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#addMetadata(org.apache.oodt.cas.metadata.Metadata, |
| * org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void addMetadata(Metadata m, Product product) |
| throws CatalogException { |
| this.catalog.addMetadata(m,product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#addMetadata(org.apache.oodt.cas.metadata.Metadata, |
| * org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void removeMetadata(Metadata m, Product product) |
| throws CatalogException { |
| this.catalog.removeMetadata(m,product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#addProduct(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void addProduct(Product product) |
| throws CatalogException { |
| this.catalog.addProduct(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#modifyProduct(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void modifyProduct(Product product) |
| throws CatalogException { |
| this.catalog.modifyProduct(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#removeProduct(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void removeProduct(Product product) |
| throws CatalogException { |
| this.catalog.removeProduct(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#setProductTransferStatus(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void setProductTransferStatus(Product product) |
| throws CatalogException { |
| this.catalog.setProductTransferStatus(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#addProductReferences(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public void addProductReferences(Product product) |
| throws CatalogException { |
| this.catalog.addProductReferences(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getProductById(java.lang.String) |
| */ |
| public Product getProductById(String productId) throws CatalogException { |
| return this.catalog.getProductById(productId); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getProductByName(java.lang.String) |
| */ |
| public Product getProductByName(String productName) throws CatalogException { |
| return this.catalog.getProductByName(productName); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getProductReferences(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public List<Reference> getProductReferences(Product product) throws CatalogException { |
| return this.catalog.getProductReferences(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getProducts() |
| */ |
| public List<Product> getProducts() throws CatalogException { |
| return this.catalog.getProducts(); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getProductsByProductType(org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public List<Product> getProductsByProductType(ProductType type) |
| throws CatalogException { |
| return this.catalog.getProductsByProductType(type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getMetadata(org.apache.oodt.cas.filemgr.structs.Product) |
| */ |
| public Metadata getMetadata(Product product) throws CatalogException { |
| return this.catalog.getMetadata(product); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getReducedMetadata(org.apache.oodt.cas.filemgr.structs.Product,java.util.List<java.lang.String>) |
| */ |
| public Metadata getReducedMetadata(Product product, List<String> elems) throws CatalogException { |
| return this.catalog.getReducedMetadata(product,elems); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#query(org.apache.oodt.cas.filemgr.structs.Query |
| * org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public List<String> query(Query query, ProductType type) throws CatalogException { |
| return this.catalog.query(query,type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getTopNProducts(int) |
| */ |
| public List<Product> getTopNProducts(int n) throws CatalogException { |
| return this.catalog.getTopNProducts(n); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getTopNProducts(int, |
| * org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public List<Product> getTopNProducts(int n, ProductType type) |
| throws CatalogException { |
| return this.catalog.getTopNProducts(n,type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getValidationLayer() |
| */ |
| public ValidationLayer getValidationLayer() throws CatalogException { |
| return this.catalog.getValidationLayer(); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getNumProducts(org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public int getNumProducts(ProductType type) throws CatalogException { |
| return this.catalog.getNumProducts(type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.util.Pagination#getFirstPage(org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public ProductPage getFirstPage(ProductType type) { |
| return this.catalog.getFirstPage(type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.util.Pagination#getLastProductPage(org.apache.oodt.cas.filemgr.structs.ProductType) |
| */ |
| public ProductPage getLastProductPage(ProductType type) { |
| return this.catalog.getLastProductPage(type); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.util.Pagination#getNextPage(org.apache.oodt.cas.filemgr.structs.ProductType, |
| * org.apache.oodt.cas.filemgr.structs.ProductPage) |
| */ |
| public ProductPage getNextPage(ProductType type, ProductPage currentPage) { |
| return this.catalog.getNextPage(type,currentPage); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.util.Pagination#getPrevPage(org.apache.oodt.cas.filemgr.structs.ProductType, |
| * org.apache.oodt.cas.filemgr.structs.ProductPage) |
| */ |
| public ProductPage getPrevPage(ProductType type, ProductPage currentPage) { |
| return this.catalog.getPrevPage(type,currentPage); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.apache.oodt.cas.filemgr.catalog.Catalog#pagedQuery(org.apache.oodt.cas.filemgr.structs.Query, |
| * org.apache.oodt.cas.filemgr.structs.ProductType, int) |
| */ |
| public ProductPage pagedQuery(Query query, ProductType type, int pageNum) |
| throws CatalogException { |
| return this.catalog.pagedQuery(query,type,pageNum); |
| } |
| } |