OODT-911 more cleanup
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/35d3b221 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/35d3b221 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/35d3b221 Branch: refs/heads/master Commit: 35d3b2219a8412ecc0c80d53ff0304644e07d22a Parents: abd7164 Author: Tom Barber <[email protected]> Authored: Sun Nov 1 00:40:38 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Sun Nov 1 00:40:38 2015 +0000 ---------------------------------------------------------------------- .../catalog/mapping/InMemoryIngestMapper.java | 2 +- .../oodt/cas/catalog/page/CatalogReceipt.java | 22 +++++++--- .../oodt/commons/activity/ActivityTracker.java | 7 +-- .../cas/filemgr/catalog/DataSourceCatalog.java | 46 +++++++------------- .../handlers/ofsn/AbstractCrawlLister.java | 6 +-- 5 files changed, 37 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/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 index 92daa04..525ea07 100644 --- 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 @@ -33,7 +33,7 @@ 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.dataSource); + SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.getDataSource()); coreSchemaScript.loadScript(); coreSchemaScript.execute(); } http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/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 index 417390a..3f9c195 100644 --- 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 @@ -17,10 +17,11 @@ package org.apache.oodt.cas.catalog.page; //JDK imports +import org.apache.oodt.cas.catalog.struct.TransactionId; + import java.util.Date; //OODT imports -import org.apache.oodt.cas.catalog.struct.TransactionId; /** * @author bfoster @@ -29,9 +30,9 @@ import org.apache.oodt.cas.catalog.struct.TransactionId; */ public class CatalogReceipt { - protected TransactionId<?> transactionId; - protected Date transactionDate; - protected String catalogId; + private TransactionId<?> transactionId; + private Date transactionDate; + private String catalogId; public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) { this.transactionId = ingestReceipt.getCatalogTransactionId(); @@ -67,5 +68,16 @@ public class CatalogReceipt { 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/35d3b221/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java index ad14341..8850330 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java @@ -69,11 +69,8 @@ public class ActivityTracker { } if (factories.isEmpty()) { factory = new NullActivityFactory(); - } else if (factories.size() == 1) { - factory = (ActivityFactory) factories.get(0); - } else { - factory = new CompositeActivityFactory(factories); - } + } else factory = + factories.size() == 1 ? (ActivityFactory) factories.get(0) : new CompositeActivityFactory(factories); } /** http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java index 327a80a..8d99122 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java @@ -255,12 +255,9 @@ public class DataSourceCatalog implements Catalog { String addProductSql; String productTypeIdStr; - if (fieldIdStringFlag) { - productTypeIdStr = "'" - + product.getProductType().getProductTypeId() + "'"; - } else { - productTypeIdStr = product.getProductType().getProductTypeId(); - } + productTypeIdStr = fieldIdStringFlag ? "'" + + product.getProductType().getProductTypeId() + "'" + : product.getProductType().getProductTypeId(); if (!productIdString) { @@ -964,11 +961,7 @@ public class DataSourceCatalog implements Catalog { String getProductSql; String productTypeIdStr; - if (fieldIdStringFlag) { - productTypeIdStr = "'" + type.getProductTypeId() + "'"; - } else { - productTypeIdStr = type.getProductTypeId(); - } + productTypeIdStr = fieldIdStringFlag ? "'" + type.getProductTypeId() + "'" : type.getProductTypeId(); getProductSql = "SELECT products.* " + "FROM products " + "WHERE products.product_type_id = " + productTypeIdStr; @@ -1705,12 +1698,10 @@ public class DataSourceCatalog implements Catalog { String elementIdStr; - if (fieldIdStringFlag) { - elementIdStr = - "'" + this.validationLayer.getElementByName(criteria.getElementName()).getElementId() + "'"; - } else { - elementIdStr = this.validationLayer.getElementByName(criteria.getElementName()).getElementId(); - } + elementIdStr = + fieldIdStringFlag ? "'" + this.validationLayer.getElementByName(criteria.getElementName()) + .getElementId() + "'" + : this.validationLayer.getElementByName(criteria.getElementName()).getElementId(); StringBuilder clause = new StringBuilder(); @@ -2135,14 +2126,13 @@ public class DataSourceCatalog implements Catalog { "metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'"; } if (rqc.getEndValue() != null) { - if (rangeSubQuery == null) { - rangeSubQuery = - "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'"; - } else { - rangeSubQuery = - "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" - + rqc.getEndValue() + "')"; - } + rangeSubQuery = + rangeSubQuery == null ? "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc + .getEndValue() + "'" + : "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " + : " < ") + + "'" + + rqc.getEndValue() + "')"; } sqlQuery.append(rangeSubQuery); } else { @@ -2237,11 +2227,7 @@ public class DataSourceCatalog implements Catalog { * @return the quoted productId */ protected String quoteIt(String productId) { - if (this.productIdString) { - return "'"+productId+"'"; - } else { - return productId; - } + return this.productIdString ? "'" + productId + "'" : productId; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java ---------------------------------------------------------------------- diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java index 1c839d2..b855988 100644 --- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java +++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java @@ -95,11 +95,7 @@ public abstract class AbstractCrawlLister implements OFSNListHandler { LOG.log(Level.INFO, "OFSN: Crawling " + dir); File[] productFiles; - if (crawlForDirs) { - productFiles = dir.listFiles(DIR_FILTER); - } else { - productFiles = dir.listFiles(FILE_FILTER); - } + productFiles = crawlForDirs ? dir.listFiles(DIR_FILTER) : dir.listFiles(FILE_FILTER); Collections.addAll(fileList, productFiles);
