Repository: oodt Updated Branches: refs/heads/master 70e5517b5 -> a8b45735e
Remove static fields Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/0979eb35 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/0979eb35 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/0979eb35 Branch: refs/heads/master Commit: 0979eb350bddd07351506b9a78b2de3a4189b107 Parents: f286ded Author: Tom Barber <[email protected]> Authored: Mon Nov 2 20:23:21 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Mon Nov 2 20:23:21 2015 +0000 ---------------------------------------------------------------------- .../model/repo/XmlWorkflowModelRepository.java | 16 +++--- .../gui/perspective/view/impl/GraphView.java | 9 ++-- .../apache/oodt/cas/catalog/system/Catalog.java | 7 +-- .../system/impl/CatalogServiceLocal.java | 4 +- .../cas/catalog/util/PluginClassLoader.java | 27 +++++----- .../oodt/cas/catalog/util/SpringUtils.java | 4 +- .../oodt/commons/io/DirectorySelector.java | 8 +-- .../org/apache/oodt/commons/util/Utility.java | 10 ++-- .../apache/oodt/cas/crawl/ProductCrawler.java | 12 ++--- .../oodt/cas/crawl/action/IngestAncillary.java | 6 +-- .../cas/crawl/action/SolrIndexingAction.java | 5 +- .../curation/metadata/CuratorConfMetKeys.java | 2 +- .../cas/curation/service/CurationService.java | 9 ++-- .../cas/curation/service/DirectoryResource.java | 1 + .../cas/curation/service/MetadataResource.java | 14 ++--- .../catalog/LenientDataSourceCatalog.java | 14 +++-- .../catalog/solr/DefaultProductSerializer.java | 16 +++--- .../cas/filemgr/catalog/solr/SolrClient.java | 6 +-- .../datatransfer/TransferStatusTracker.java | 5 +- .../repository/XMLRepositoryManager.java | 5 +- .../oodt/cas/filemgr/tools/DeleteProduct.java | 2 +- .../cas/filemgr/util/XmlRpcStructFactory.java | 5 +- .../filemgr/validation/XMLValidationLayer.java | 18 ++++--- .../cas/filemgr/versioning/VersioningUtils.java | 46 +++++++++-------- .../org/apache/oodt/cas/metadata/Metadata.java | 11 ++-- .../preconditions/PreCondEvalUtils.java | 4 +- .../apache/oodt/pcs/services/PCSService.java | 6 +-- .../apache/oodt/cas/pge/PGETaskInstance.java | 4 +- .../handlers/ofsn/AbstractCrawlLister.java | 5 +- .../product/handlers/ofsn/OFSNFileHandler.java | 5 +- .../retrievalsystem/FileRetrievalSystem.java | 6 ++- .../cas/resource/monitor/AssignmentMonitor.java | 4 +- .../monitor/ganglia/GangliaResourceMonitor.java | 12 ++--- .../resource/noderepo/XmlNodeRepository.java | 48 ++++++++--------- .../resource/queuerepo/XmlQueueRepository.java | 2 + .../cas/resource/scheduler/QueueManager.java | 11 ++-- .../resource/system/extern/XmlRpcBatchStub.java | 2 +- .../org/apache/oodt/security/sso/DummyImpl.java | 12 ++--- .../oodt/cas/product/rdf/RDFDatasetServlet.java | 2 +- .../oodt/cas/product/rdf/RDFProductServlet.java | 2 +- .../product/rss/RSSProductTransferServlet.java | 4 +- .../PackagedWorkflowRepositoryFactory.java | 13 +++-- .../repository/XMLWorkflowRepository.java | 54 ++++++++++---------- 43 files changed, 241 insertions(+), 217 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java index e975556..e9a523a 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java @@ -78,9 +78,11 @@ public class XmlWorkflowModelRepository { public XmlWorkflowModelRepository(File workspace) { this.files = new Vector<File>(); - for (File file : (this.workspace = workspace).listFiles()) { - if (!file.isDirectory()) { - this.files.add(file); + if(workspace!=null) { + for (File file : (this.workspace = workspace).listFiles()) { + if (!file.isDirectory()) { + this.files.add(file); + } } } } @@ -168,8 +170,8 @@ public class XmlWorkflowModelRepository { } private void writeOutDocuments(Map<File, Document> documents) { - for (File file : documents.keySet()) { - XMLUtils.writeXmlFile(documents.get(file), file.getAbsolutePath()); + for (Map.Entry<File, Document> file : documents.entrySet()) { + XMLUtils.writeXmlFile(documents.get(file.getKey()), file.getKey().getAbsolutePath()); } } @@ -183,8 +185,8 @@ public class XmlWorkflowModelRepository { document.appendChild(document.createElement("workflows")); documents.put(globalConfigGroupsFile, document); } - for (String configName : this.globalConfigGroups.keySet()) { - ConfigGroup globalConfig = this.globalConfigGroups.get(configName); + for (Map.Entry<String, ConfigGroup> configName : this.globalConfigGroups.entrySet()) { + ConfigGroup globalConfig = configName.getValue(); Element configElem = document.createElement("configuration"); document.getDocumentElement().appendChild(configElem); configElem.setAttribute("name", globalConfig.getName()); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java index 0059fba..700f227 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java @@ -18,9 +18,6 @@ package org.apache.oodt.cas.workflow.gui.perspective.view.impl; //JDK imports -import com.jgraph.layout.JGraphFacade; -import com.jgraph.layout.hierarchical.JGraphHierarchicalLayout; - import org.apache.oodt.cas.workflow.gui.model.ModelGraph; import org.apache.oodt.cas.workflow.gui.model.ModelNode; import org.apache.oodt.cas.workflow.gui.perspective.view.View; @@ -29,6 +26,10 @@ import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState; import org.apache.oodt.cas.workflow.gui.util.GuiUtils; import org.apache.oodt.cas.workflow.gui.util.IconLoader; import org.apache.oodt.cas.workflow.gui.util.Line; + +import com.jgraph.layout.JGraphFacade; +import com.jgraph.layout.hierarchical.JGraphHierarchicalLayout; + import org.jgraph.JGraph; import org.jgraph.graph.AttributeMap; import org.jgraph.graph.DefaultEdge; @@ -132,7 +133,7 @@ public class GraphView extends DefaultTreeView { private static final String TASK_MODE = "Task"; private static final String WORKFLOW_MODE = "Workflow"; - private static boolean scrollSelectedToVisible = false; + private boolean scrollSelectedToVisible = false; public GraphView(String name) { super(name); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java index 265364e..a95fec2 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java @@ -304,9 +304,10 @@ public class Catalog { if (this.isQueriable()) { QueryService queryService = (QueryService) this.index; Map<TransactionId<?>, List<TermBucket>> termBucketMap = queryService.getBuckets(transactionIds); - for (TransactionId<?> transactionId : termBucketMap.keySet()) { - metadataMap.put(transactionId, this.getMetadataFromBuckets(termBucketMap.get(transactionId))); - } + + for(Map.Entry<TransactionId<?>, List<TermBucket>> entry : termBucketMap.entrySet()){ + metadataMap.put(entry.getKey(), this.getMetadataFromBuckets(entry.getValue())); + } }else { LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java index 3621a7e..0415c7a 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java @@ -845,8 +845,8 @@ public class CatalogServiceLocal implements CatalogService { returnList.add(new TransactionReceipt(null, Collections.singletonList(catalogReceipt))); } } - for (TransactionId<?> transactionId : existing.keySet()) { - returnList.add(new TransactionReceipt(transactionId, existing.get(transactionId))); + for (Entry<TransactionId<?>, List<CatalogReceipt>> transactionId : existing.entrySet()) { + returnList.add(new TransactionReceipt(transactionId.getKey(), existing.get(transactionId.getValue()))); } return returnList; }catch (Exception e) { http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java index a2ffefd..ac322f9 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java @@ -17,6 +17,8 @@ package org.apache.oodt.cas.catalog.util; //JDK imports +import org.apache.oodt.cas.metadata.util.PathUtils; + import java.io.File; import java.io.FileFilter; import java.net.URL; @@ -27,7 +29,6 @@ import java.util.logging.Level; import java.util.logging.Logger; //OODT imports -import org.apache.oodt.cas.metadata.util.PathUtils; /** * @@ -64,19 +65,21 @@ public class PluginClassLoader extends URLClassLoader { String pluginDirs = System.getProperty("org.apache.oodt.cas.catalog.plugin.dirs"); if (pluginDirs != null) { for (String pluginDir : PathUtils.doDynamicReplacement(pluginDirs).split(",")) { - File[] jarFiles = new File(pluginDir).listFiles(new FileFilter() { - public boolean accept(File pathname) { - return pathname.getName().endsWith(".jar"); - } - }); + File[] jarFiles = new File(pluginDir).listFiles(new FileFilter() { + public boolean accept(File pathname) { + return pathname.getName().endsWith(".jar"); + } + }); + if (jarFiles != null) { for (File jarFile : jarFiles) { - try { - urls.add(jarFile.toURL()); - }catch (Exception e) { - LOG.log(Level.SEVERE, "Failed to load jar file '" + jarFile + "' : " + e.getMessage(), e); - } - + try { + urls.add(jarFile.toURL()); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Failed to load jar file '" + jarFile + "' : " + e.getMessage(), e); + } + } + } } } }catch (Exception ignored) {} http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java index 3b1a149..61bf00b 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java @@ -39,8 +39,8 @@ public class SpringUtils { FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(catalogBeanRepo); Map<String, Catalog> catalogsMap = appContext.getBeansOfType(Catalog.class); HashSet<Catalog> catalogs = new HashSet<Catalog>(); - for (String key : catalogsMap.keySet()) { - Catalog curCatalog = catalogsMap.get(key); + for (Map.Entry<String, Catalog> key : catalogsMap.entrySet()) { + Catalog curCatalog = key.getValue(); LOG.log(Level.INFO, "Loading catalog configuration for Catalog: '" + curCatalog + "'"); if (catalogs.contains(curCatalog)) { throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. " http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/commons/src/main/java/org/apache/oodt/commons/io/DirectorySelector.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/io/DirectorySelector.java b/commons/src/main/java/org/apache/oodt/commons/io/DirectorySelector.java index 6fd4615..ee39441 100644 --- a/commons/src/main/java/org/apache/oodt/commons/io/DirectorySelector.java +++ b/commons/src/main/java/org/apache/oodt/commons/io/DirectorySelector.java @@ -94,9 +94,11 @@ public class DirectorySelector { // recursion over sub-directories File[] subdirs = dir.listFiles( directoryFilter ); - for (File subdir : subdirs) { - traverseDir(subdir, subDirs); - } + if(subdirs!=null) { + for (File subdir : subdirs) { + traverseDir(subdir, subDirs); + } + } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/commons/src/main/java/org/apache/oodt/commons/util/Utility.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/Utility.java b/commons/src/main/java/org/apache/oodt/commons/util/Utility.java index e54b9bc..d707614 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/Utility.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/Utility.java @@ -170,10 +170,12 @@ public class Utility { public static boolean delete(File file) { if (file.isDirectory()) { File[] entries = file.listFiles(); - for (File entry : entries) { - if (!delete(entry)) { - return false; - } + if (entries != null) { + for (File entry : entries) { + if (!delete(entry)) { + return false; + } + } } } return file.delete(); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java index e2e702f..3f5d254 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java @@ -97,14 +97,12 @@ public abstract class ProductCrawler extends ProductCrawlerBean { LOG.log(Level.INFO, "Crawling " + dir); File[] productFiles; - if (isCrawlForDirs()) { - productFiles = dir.listFiles(DIR_FILTER); - } else { - productFiles = dir.listFiles(FILE_FILTER); - } + productFiles = isCrawlForDirs() ? dir.listFiles(DIR_FILTER) : dir.listFiles(FILE_FILTER); - for (File productFile : productFiles) { - ingestStatus.add(handleFile(productFile)); + if(productFiles!=null) { + for (File productFile : productFiles) { + ingestStatus.add(handleFile(productFile)); + } } if (!isNoRecur()) { http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/crawler/src/main/java/org/apache/oodt/cas/crawl/action/IngestAncillary.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/IngestAncillary.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/IngestAncillary.java index 1e5dfbc..76f5cd9 100755 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/IngestAncillary.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/IngestAncillary.java @@ -66,9 +66,9 @@ public class IngestAncillary extends FileBasedAction { public boolean performFileAction(File actionFile, Metadata metadata) { Metadata ingestMetadata = new Metadata(); if (ancillaryMetadata != null) { - for (String key : this.ancillaryMetadata.keySet()) { - for (String value : this.ancillaryMetadata.get(key)) { - ingestMetadata.addMetadata(key, PathUtils.replaceEnvVariables(value)); + for (Map.Entry<String, List<String>> entry : this.ancillaryMetadata.entrySet()) { + for (String value : entry.getValue()) { + ingestMetadata.addMetadata(entry.getKey(), PathUtils.replaceEnvVariables(value)); } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/crawler/src/main/java/org/apache/oodt/cas/crawl/action/SolrIndexingAction.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/SolrIndexingAction.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/SolrIndexingAction.java index 9cbf23d..7592090 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/SolrIndexingAction.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/SolrIndexingAction.java @@ -24,7 +24,6 @@ import java.util.Map; import java.util.logging.Level; //OODT imports -import org.apache.oodt.cas.crawl.action.CrawlerAction; import org.apache.oodt.cas.crawl.structs.exceptions.CrawlerActionException; import org.apache.oodt.cas.filemgr.tools.SolrIndexer; import org.apache.oodt.cas.metadata.Metadata; @@ -71,8 +70,8 @@ public class SolrIndexingAction extends CrawlerAction { // set environment from bean configuration // (including indexer.properties) - for (String s : env.keySet()) { - System.setProperty(s, env.get(s)); + for (Map.Entry<String, String> s : env.entrySet()) { + System.setProperty(s.getKey(), env.get(s.getValue())); } // instantiate indexing service http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/curator/services/src/main/java/org/apache/oodt/cas/curation/metadata/CuratorConfMetKeys.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/metadata/CuratorConfMetKeys.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/metadata/CuratorConfMetKeys.java index c1556c5..aabb081 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/metadata/CuratorConfMetKeys.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/metadata/CuratorConfMetKeys.java @@ -48,5 +48,5 @@ public interface CuratorConfMetKeys { String FM_PROPS = "org.apache.oodt.cas.curator.fmProps"; String CATALOG_FACTORY_CLASS = "org.apache.oodt.cas.curator.catalogFactoryClass"; - + } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationService.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationService.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationService.java index 44c84af..61fae24 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationService.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationService.java @@ -18,12 +18,12 @@ package org.apache.oodt.cas.curation.service; //OODT imports -import net.sf.json.JSONArray; - import org.apache.commons.lang.StringUtils; import org.apache.oodt.cas.curation.metadata.CuratorConfMetKeys; import org.apache.oodt.security.sso.SingleSignOn; +import net.sf.json.JSONArray; + import java.io.File; import java.io.FilenameFilter; import java.io.IOException; @@ -41,9 +41,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.UriInfo; -//JDK imports -//JAX-RS imports -//APACHE imports /** * @@ -64,7 +61,7 @@ public class CurationService extends HttpServlet implements CuratorConfMetKeys { private static final Logger LOG = Logger.getLogger(CurationService.class .getName()); - protected static CurationServiceConfig config = null; + public static CurationServiceConfig config = null; protected final static String FORMAT_JSON = "json"; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java index df718aa..bd3b26a 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java @@ -59,6 +59,7 @@ public class DirectoryResource extends CurationService { if (FORMAT_HTML.equals(format)) { return this.getDirectoryAreaAsHTML( CurationService.config.getStagingAreaPath(), path, showFiles); + } return this.getDirectoryAreaAsJSON( CurationService.config.getStagingAreaPath(), path, showFiles); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java index 9d93b0d..2c146f8 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java @@ -62,6 +62,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -85,11 +86,6 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -//JAX-RS imports -//JSON imports -//OODT imports -//SPRING imports - @Path("metadata") /** * @@ -391,10 +387,10 @@ public class MetadataResource extends CurationService { private Metadata getMetadataFromMap(MultivaluedMap<String, String> formParams) { Metadata metadata = new Metadata(); - for (String key : formParams.keySet()) { - if (key.startsWith("metadata.")) { - String newKey = key.substring(key.indexOf('.') + 1); - for (String value : formParams.get(key)) { + for (Map.Entry<String, List<String>> entry : formParams.entrySet()) { + if (entry.getKey().startsWith("metadata.")) { + String newKey = entry.getKey().substring(entry.getKey().indexOf('.') + 1); + for (String value : entry.getValue()) { metadata.addMetadata(newKey, value); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java index 8f3132d..1f3bd21 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java @@ -44,8 +44,6 @@ import java.util.logging.Logger; import javax.sql.DataSource; -//JDK imports - /** * @author luca * @version $Revision$ @@ -96,8 +94,8 @@ public class LenientDataSourceCatalog extends DataSourceCatalog { Map<String, String> metadataTypes = getMetadataTypes(m, product); // loop over metadata types - for (String metadataId : metadataTypes.keySet()) { - String metadataName = metadataTypes.get(metadataId); + for (Map.Entry<String, String> metadataId : metadataTypes.entrySet()) { + String metadataName = metadataId.getValue(); List<String> values = m.getAllMetadata(metadataName); @@ -180,15 +178,15 @@ public class LenientDataSourceCatalog extends DataSourceCatalog { Map<String, String> metadataTypes = getMetadataTypes(m, product); // loop over metadata types - for (String metadataId : metadataTypes.keySet()) { - String metadataName = metadataTypes.get(metadataId); + for (Map.Entry<String, String> metadataId : metadataTypes.entrySet()) { + String metadataName = metadataId.getValue(); List<String> values = m.getAllMetadata(metadataName); if (values != null) { for (String value : values) { try { - removeMetadataValue(metadataId, product, value); + removeMetadataValue(metadataId.getKey(), product, value); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage()); LOG @@ -403,7 +401,7 @@ public class LenientDataSourceCatalog extends DataSourceCatalog { return m; } - private synchronized void addMetadataValue(String key, + private synchronized void addMetadataValue(Map.Entry<String, String> key, Product product, String value) throws CatalogException { Connection conn = null; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java index 27c6eae..0377b4b 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java @@ -230,9 +230,9 @@ public class DefaultProductSerializer implements ProductSerializer { doc.append( encodeIndexField(Parameters.ID, productId) ); // all other fields - for (String key : fields.keySet()) { - for (String value : fields.get(key)) { - doc.append( encodeIndexField(key, value) ); + for (Map.Entry<String, List<String>> key : fields.entrySet()) { + for (String value : key.getValue()) { + doc.append( encodeIndexField(key.getKey(), value) ); } } @@ -256,25 +256,25 @@ public class DefaultProductSerializer implements ProductSerializer { List<String> delFields = new ArrayList<String>(); // encode update instructions - for (String key : fields.keySet()) { + for (Map.Entry<String, List<String>> key : fields.entrySet()) { - List<String> values = fields.get(key); + List<String> values = key.getValue(); if (replace) { if (values.isEmpty()) { // use special value to flag removal - delFields.add( this.encodeUpdateField(key, Parameters.NULL, true) ); + delFields.add( this.encodeUpdateField(key.getKey(), Parameters.NULL, true) ); } else { for (String value : values) { - setFields.add( this.encodeUpdateField(key, value, true) ); + setFields.add( this.encodeUpdateField(key.getKey(), value, true) ); } } } else { for (String value : values) { - addFields.add( this.encodeUpdateField(key, value, false) ); + addFields.add( this.encodeUpdateField(key.getKey(), value, false) ); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java index 66f7673..650d6b6 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java @@ -239,9 +239,9 @@ public class SolrClient { // build HTTP/GET request GetMethod method = new GetMethod(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); - for (String key : parameters.keySet()) { - for (String value : parameters.get(key)) { - nvps.add(new NameValuePair(key, value)); + for (Map.Entry<String, String[]> key : parameters.entrySet()) { + for (String value : key.getValue()) { + nvps.add(new NameValuePair(key.getKey(), value)); } } // request results in JSON format http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java index 1371fa2..489b459 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java @@ -30,6 +30,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; @@ -86,8 +87,8 @@ public class TransferStatusTracker { public List<FileTransferStatus> getCurrentFileTransfers() { List<FileTransferStatus> currTransfers = new Vector<FileTransferStatus>(); - for (String productId : currentProductTransfers.keySet()) { - Product p = (Product) currentProductTransfers.get(productId); + for (Map.Entry<String, Product> productId : currentProductTransfers.entrySet()) { + Product p = productId.getValue(); // get its references List<Reference> refs = quietGetReferences(p); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/XMLRepositoryManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/XMLRepositoryManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/XMLRepositoryManager.java index 31120f8..bf3ce42 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/XMLRepositoryManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/XMLRepositoryManager.java @@ -31,6 +31,7 @@ import java.net.URISyntaxException; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; @@ -130,8 +131,8 @@ public class XMLRepositoryManager implements RepositoryManager { */ public ProductType getProductTypeByName(String productTypeName) throws RepositoryManagerException { - for (String typeId : productTypeMap.keySet()) { - ProductType type = (ProductType) productTypeMap.get(typeId); + for (Map.Entry<String, ProductType> typeId : productTypeMap.entrySet()) { + ProductType type = typeId.getValue(); if (type.getName().equals(productTypeName)) { return type; } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java index f1a0f88..eaade08 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java @@ -54,7 +54,7 @@ public class DeleteProduct { private static final Logger LOG = Logger.getLogger(DeleteProduct.class.getName()); /* our File Manager client */ - private static XmlRpcFileManagerClient client = null; + private XmlRpcFileManagerClient client = null; /* whether or not we should commit our deletions */ private boolean commit = true; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java index 115ec65..3007041 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java @@ -39,6 +39,7 @@ import org.apache.oodt.cas.metadata.Metadata; import java.util.Hashtable; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.Vector; @@ -493,9 +494,9 @@ public final class XmlRpcStructFactory { Properties props = new Properties(); if (propHash != null && propHash.keySet().size() > 0) { - for (String propName : propHash.keySet()) { + for (Map.Entry<String, String> propName : propHash.entrySet()) { String propValue = propHash.get(propName); - props.setProperty(propName, propValue); + props.setProperty(propName.getKey(), propValue); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java index 97c0620..e2a06aa 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java @@ -23,7 +23,11 @@ import org.apache.oodt.cas.filemgr.structs.ProductType; import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException; import org.apache.oodt.cas.filemgr.util.XmlStructFactory; -//JDK imports +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -32,15 +36,15 @@ import java.net.URISyntaxException; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; + +//JDK imports /** * @author mattmann @@ -199,8 +203,8 @@ public class XMLValidationLayer implements ValidationLayer { */ public Element getElementByName(String elementName) throws ValidationLayerException { - for (String elementId : elementMap.keySet()) { - Element element = (Element) elementMap.get(elementId); + for (Map.Entry<String, Element> elementId : elementMap.entrySet()) { + Element element = elementId.getValue(); if (element.getElementName().equals(elementName)) { return element; } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java index a13a2be..8028bec 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java @@ -101,25 +101,27 @@ public final class VersioningUtils { File[] files = dir.listFiles(FILE_FILTER); - for (File file : files) { - // add the file references - try { - Reference r = new Reference(); - r.setOrigReference(file.toURL().toExternalForm()); - r.setFileSize(file.length()); - references.add(r); - } catch (MalformedURLException e) { - LOG.log(Level.SEVERE, e.getMessage()); - LOG.log(Level.WARNING, - "MalformedURLException when generating reference for file: " - + file); - } + if(files!=null) { + for (File file : files) { + // add the file references + try { + Reference r = new Reference(); + r.setOrigReference(file.toURL().toExternalForm()); + r.setFileSize(file.length()); + references.add(r); + } catch (MalformedURLException e) { + LOG.log(Level.SEVERE, e.getMessage()); + LOG.log(Level.WARNING, + "MalformedURLException when generating reference for file: " + + file); + } - } - File[] subdirs = dir.listFiles(DIR_FILTER); - if (subdirs != null) { - for (File subdir : subdirs) { - stack.push(subdir); + } + File[] subdirs = dir.listFiles(DIR_FILTER); + if (subdirs != null) { + for (File subdir : subdirs) { + stack.push(subdir); + } } } } @@ -151,9 +153,11 @@ public final class VersioningUtils { File[] files = dir.listFiles(FILE_FILTER); - for (File file : files) { - // add the file references - uris.add(file.toURI().toString()); + if(files!=null) { + for (File file : files) { + // add the file references + uris.add(file.toURI().toString()); + } } File[] subdirs = dir.listFiles(DIR_FILTER); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java ---------------------------------------------------------------------- diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java index 6dfcd6f..e432dfb 100644 --- a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java +++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java @@ -401,14 +401,13 @@ public class Metadata { public void addMetadata(Hashtable<String, Object> metadata, boolean replace) { // for back compat: the old method allowed us to give it a // Hashtable<String,String> and it still worked - for (String key : metadata.keySet()) { - List<String> vals = (metadata.get(key) instanceof List) ? (List<String>) metadata - .get(key) - : Collections.singletonList(metadata.get(key).toString()); + for (Map.Entry<String, Object> key : metadata.entrySet()) { + List<String> vals = (key.getValue() instanceof List) ? (List<String>) key.getValue() + : Collections.singletonList(key.getValue().toString()); if (replace) { - this.replaceMetadata(key, vals); + this.replaceMetadata(key.getKey(), vals); } else { - this.addMetadata(key, vals); + this.addMetadata(key.getKey(), vals); } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreCondEvalUtils.java ---------------------------------------------------------------------- diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreCondEvalUtils.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreCondEvalUtils.java index fec6db5..04fcfa5 100644 --- a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreCondEvalUtils.java +++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreCondEvalUtils.java @@ -44,10 +44,10 @@ public class PreCondEvalUtils implements PreConditionOperatorMetKeys { private static Logger LOG = Logger.getLogger(PreCondEvalUtils.class .getName()); - private static ApplicationContext applicationContext; + private ApplicationContext applicationContext; public PreCondEvalUtils(ApplicationContext applicationContext) { - PreCondEvalUtils.applicationContext = applicationContext; + this.applicationContext = applicationContext; } /** http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/pcs/services/src/main/java/org/apache/oodt/pcs/services/PCSService.java ---------------------------------------------------------------------- diff --git a/pcs/services/src/main/java/org/apache/oodt/pcs/services/PCSService.java b/pcs/services/src/main/java/org/apache/oodt/pcs/services/PCSService.java index 2e6e24d..00b38df 100644 --- a/pcs/services/src/main/java/org/apache/oodt/pcs/services/PCSService.java +++ b/pcs/services/src/main/java/org/apache/oodt/pcs/services/PCSService.java @@ -18,18 +18,18 @@ package org.apache.oodt.pcs.services; //JDK imports +import org.apache.oodt.pcs.services.config.PCSServiceConfig; + import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; - -//JAX-RS imports import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +//JAX-RS imports //OODT imports -import org.apache.oodt.pcs.services.config.PCSServiceConfig; /** http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java ---------------------------------------------------------------------- diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java index 1cca03e..5ce2d30 100644 --- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java +++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java @@ -437,6 +437,7 @@ public class PGETaskInstance implements WorkflowTaskInstance { protected void processOutput() throws IOException { for (final OutputDir outputDir : this.pgeConfig.getOuputDirs()) { File[] createdFiles = new File(outputDir.getPath()).listFiles(); + if (createdFiles != null) { for (File createdFile : createdFiles) { Metadata outputMetadata = new Metadata(); for (RegExprOutputFiles regExprFiles : outputDir @@ -448,7 +449,7 @@ public class PGETaskInstance implements WorkflowTaskInstance { .forName(regExprFiles.getConverterClass()) .newInstance(); outputMetadata.replaceMetadata(this.getMetadataForFile( - (regExprFiles.getRenamingConv() != null) + (regExprFiles.getRenamingConv() != null) ? createdFile = this.renameFile(createdFile, regExprFiles.getRenamingConv()) : createdFile, writer, regExprFiles.getArgs())); } catch (Exception e) { @@ -464,6 +465,7 @@ public class PGETaskInstance implements WorkflowTaskInstance { + "." + this.pgeMetadata.getMetadata(MET_FILE_EXT)); } } + } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/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 b855988..40b3094 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 @@ -97,8 +97,9 @@ public abstract class AbstractCrawlLister implements OFSNListHandler { File[] productFiles; productFiles = crawlForDirs ? dir.listFiles(DIR_FILTER) : dir.listFiles(FILE_FILTER); - Collections.addAll(fileList, productFiles); - + if(productFiles!=null) { + Collections.addAll(fileList, productFiles); + } if (recur) { File[] subdirs = dir.listFiles(DIR_FILTER); if (subdirs != null) { http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java ---------------------------------------------------------------------- diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java index 31a3218..16141ae 100644 --- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java +++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java @@ -18,7 +18,6 @@ package org.apache.oodt.product.handlers.ofsn; -//JDK imports import org.apache.oodt.commons.xml.XMLUtils; import org.apache.oodt.product.LargeProductQueryHandler; import org.apache.oodt.product.ProductException; @@ -45,8 +44,6 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -//APACHE imports -//OODT imports /** * @@ -74,7 +71,7 @@ public class OFSNFileHandler implements LargeProductQueryHandler, private OFSNFileHandlerConfiguration conf; - private static Map<String, Object> HANDLER_CACHE; + private Map<String, Object> HANDLER_CACHE; public OFSNFileHandler() throws InstantiationException { // init conf here http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java index 4bd5c92..fde2d18 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java @@ -547,10 +547,12 @@ public class FileRetrievalSystem { return pathname.getName().startsWith("Downloading_"); } }); - for (File file : failedDownloads) { + if(failedDownloads!=null) { + for (File file : failedDownloads) { LOG.log(Level.INFO, "Removing failed download file " - + file.getAbsolutePath()); + + file.getAbsolutePath()); file.delete(); + } } } else { LOG.log(Level.INFO, "Staging area " + stagingArea.getAbsolutePath() http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java index bc969b0..7daab5d 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java @@ -45,10 +45,10 @@ import java.util.Vector; public class AssignmentMonitor implements Monitor { /* our nodes map */ - private static HashMap<String, ResourceNode> nodesMap; + private HashMap<String, ResourceNode> nodesMap; /* our load map */ - private static HashMap<String, Integer> loadMap; + private HashMap<String, Integer> loadMap; public AssignmentMonitor(List<ResourceNode> nodes) { nodesMap = new HashMap<String, ResourceNode>(); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java index f4a36e3..d2b20ad 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java @@ -167,15 +167,15 @@ public class GangliaResourceMonitor implements Monitor { for (GangliaAdapter adapter : this.gmetaAdapters.values()) { Map<String, Map<String, String>> aNodes = adapter .getResourceNodeStatus(); - for (String aNodeId : aNodes.keySet()) { + for (Map.Entry<String, Map<String, String>> aNodeId : aNodes.entrySet()) { String host = ipAddr.getHost(); int port = ipAddr.getPort(); - Map<String, String> nodeProps = aNodes.get(aNodeId); - if (aNodeId.equals(host) + Map<String, String> nodeProps = aNodeId.getValue(); + if (aNodeId.getKey().equals(host) && nodeProps.get(DEFAULT_PORT).equals( String.valueOf(port))) { try { - return this.nodeFromMap(aNodes.get(aNodeId)); + return this.nodeFromMap(aNodeId.getValue()); } catch (MalformedURLException e) { LOG.log(Level.SEVERE, e.getMessage()); throw new MonitorException(e.getMessage()); @@ -205,8 +205,8 @@ public class GangliaResourceMonitor implements Monitor { private Map<String, String> locateNode(String nodeId) { if (this.gmetaAdapters != null && this.gmetaAdapters.size() > 0) { - for (String nId : this.gmetaAdapters.keySet()) { - GangliaAdapter adapter = this.gmetaAdapters.get(nId); + for (Map.Entry<String, GangliaAdapter> nId : this.gmetaAdapters.entrySet()) { + GangliaAdapter adapter = nId.getValue(); try { System.out.println("Querying gmetad: ["+adapter.getUrlString()+"]"); Map<String, Map<String, String>> nodeStatus = adapter http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java index 66332f0..11c0562 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java @@ -74,30 +74,32 @@ public class XmlNodeRepository implements NodeRepository { File nodesDir = new File(new URI(dirUri)); if (nodesDir.isDirectory()) { - String nodesDirStr = nodesDir.getAbsolutePath(); - - // get all the workflow xml files - File[] nodesFiles = nodesDir.listFiles(nodesXmlFilter); - - for (File nodesFile : nodesFiles) { - - String nodesXmlFile = nodesFile.getAbsolutePath(); - Document nodesRoot = null; - try { - nodesRoot = XMLUtils - .getDocumentRoot(new FileInputStream( - nodesFile)); - } catch (FileNotFoundException e) { - LOG.log(Level.SEVERE, e.getMessage()); - return null; - } + String nodesDirStr = nodesDir.getAbsolutePath(); + + // get all the workflow xml files + File[] nodesFiles = nodesDir.listFiles(nodesXmlFilter); + + if (nodesFiles != null) { + for (File nodesFile : nodesFiles) { + + String nodesXmlFile = nodesFile.getAbsolutePath(); + Document nodesRoot = null; + try { + nodesRoot = XMLUtils + .getDocumentRoot(new FileInputStream( + nodesFile)); + } catch (FileNotFoundException e) { + LOG.log(Level.SEVERE, e.getMessage()); + return null; + } - NodeList nodeList = nodesRoot - .getElementsByTagName("node"); - if (nodeList != null) { - for (int k = 0; k < nodeList.getLength(); k++) { - nodes.add(XmlStructFactory - .getNodes((Element) nodeList.item(k))); + NodeList nodeList = nodesRoot + .getElementsByTagName("node"); + if (nodeList != null) { + for (int k = 0; k < nodeList.getLength(); k++) { + nodes.add(XmlStructFactory + .getNodes((Element) nodeList.item(k))); + } } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java index 329342e..8ef2ccf 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java @@ -82,6 +82,7 @@ public class XmlQueueRepository implements QueueRepository { // get all the workflow xml files File[] nodesFiles = nodesDir.listFiles(queuesXmlFilter); + if(nodesFiles!=null){ for (File nodesFile : nodesFiles) { Document nodesRoot; @@ -131,6 +132,7 @@ public class XmlQueueRepository implements QueueRepository { } } } + } } } catch (URISyntaxException e) { LOG.log(Level.SEVERE, e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java b/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java index c90896d..8afc30b 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java @@ -82,11 +82,12 @@ public class QueueManager { return new Vector<String>(this.queueToNodesMapping.keySet()); } - public synchronized List<String> getQueues(String nodeId) { - Vector<String> queueNames = new Vector<String>(); - for (String queueName : this.queueToNodesMapping.keySet()) { - if (this.queueToNodesMapping.get(queueName).contains(nodeId)) { - queueNames.add(queueName); + public synchronized Vector<String> getQueues(String nodeId) { + Vector<String> + queueNames = new Vector<String>(); + for (Map.Entry<String, LinkedHashSet<String>> queueName : this.queueToNodesMapping.entrySet()) { + if (queueName.getValue().contains(nodeId)) { + queueNames.add(queueName.getKey()); } } return queueNames; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java index 3fe2c3a..7d1fc6d 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java @@ -60,7 +60,7 @@ public class XmlRpcBatchStub { private static Logger LOG = Logger.getLogger(XmlRpcBatchStub.class .getName()); - private static Map jobThreadMap = null; + private Map jobThreadMap = null; public XmlRpcBatchStub(int port) { webServerPort = port; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java ---------------------------------------------------------------------- diff --git a/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java b/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java index 36ba5a1..dfc88be 100644 --- a/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java +++ b/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java @@ -39,7 +39,7 @@ public class DummyImpl extends AbstractWebBasedSingleSignOn { private static final String DEFAULT_GROUP = "guest"; - private static boolean connected = false; + private boolean connected = false; /* * (non-Javadoc) @@ -58,7 +58,7 @@ public class DummyImpl extends AbstractWebBasedSingleSignOn { */ public boolean getLastConnectionStatus() { // TODO Auto-generated method stub - return DummyImpl.connected; + return this.connected; } /* @@ -68,7 +68,7 @@ public class DummyImpl extends AbstractWebBasedSingleSignOn { */ public boolean isLoggedIn() { // TODO Auto-generated method stub - return DummyImpl.connected; + return this.connected; } /* @@ -79,8 +79,8 @@ public class DummyImpl extends AbstractWebBasedSingleSignOn { * java.lang.String) */ public boolean login(String username, String password) { - DummyImpl.connected = true; - return DummyImpl.connected; + this.connected = true; + return true; } /* @@ -89,7 +89,7 @@ public class DummyImpl extends AbstractWebBasedSingleSignOn { * @see org.apache.oodt.cas.security.sso.SingleSignOn#logout() */ public void logout() { - DummyImpl.connected = false; + this.connected = false; } /* (non-Javadoc) http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java index 8dc1e07..49f623d 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java @@ -72,7 +72,7 @@ public class RDFDatasetServlet extends HttpServlet { private static final long serialVersionUID = -3660991271642533985L; /* our client to the file manager */ - private static XmlRpcFileManagerClient fClient = null; + private XmlRpcFileManagerClient fClient = null; /* our log stream */ private Logger LOG = Logger.getLogger(RDFProductServlet.class.getName()); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFProductServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFProductServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFProductServlet.java index 37abfd3..58bd4ed 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFProductServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFProductServlet.java @@ -78,7 +78,7 @@ public class RDFProductServlet extends HttpServlet { private static final long serialVersionUID = -3660991271646533985L; /* our client to the file manager */ - private static XmlRpcFileManagerClient fClient = null; + private XmlRpcFileManagerClient fClient = null; /* our log stream */ private Logger LOG = Logger.getLogger(RDFProductServlet.class.getName()); http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java index a62604c..14fd8c4 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java @@ -18,7 +18,6 @@ package org.apache.oodt.cas.product.rss; -//JDK imports import org.apache.oodt.cas.filemgr.structs.FileTransferStatus; import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; @@ -57,7 +56,6 @@ import javax.xml.transform.stream.StreamResult; import static org.apache.oodt.cas.product.rss.RSSConfigMetKeys.RSS_TRANSFER_CONF_KEY; -//OODT imports /** * @author mattmann @@ -76,7 +74,7 @@ public class RSSProductTransferServlet extends HttpServlet { private static final long serialVersionUID = -7983832512818339079L; /* our client to the file manager */ - private static XmlRpcFileManagerClient fClient = null; + private XmlRpcFileManagerClient fClient = null; /* RSS config */ private RSSConfig rssconf; http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepositoryFactory.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepositoryFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepositoryFactory.java index 57fe166..7539ecf 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepositoryFactory.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepositoryFactory.java @@ -59,10 +59,17 @@ public class PackagedWorkflowRepositoryFactory implements @Override public WorkflowRepository createRepository() { try { - return new PackagedWorkflowRepository( - Arrays.asList(new File(this.wDirPath).listFiles())); + if(this.wDirPath!=null) { + return new PackagedWorkflowRepository( + Arrays.asList(new File(this.wDirPath).listFiles())); + } + else { + LOG.log( + Level.SEVERE, + "Unable to create packaged workflow repository! Reason: empty wDirPath"); + return null; + } } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); LOG.log( Level.SEVERE, "Unable to create packaged workflow repository! Reason: " http://git-wip-us.apache.org/repos/asf/oodt/blob/0979eb35/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java index ea348bf..d4e2160 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java @@ -536,34 +536,36 @@ public class XMLWorkflowRepository implements WorkflowRepository { File[] workflowFiles = workflowDir .listFiles(workflowXmlFilter); - for (File workflowFile : workflowFiles) { - String workflowXmlFile = workflowFile - .getAbsolutePath(); - Document workflowRoot = getDocumentRoot(workflowXmlFile); - - String workflowId = workflowRoot - .getDocumentElement().getAttribute("id"); - if (workflowMap.get(workflowId) == null) { - Workflow w = XmlStructFactory.getWorkflow( - workflowRoot.getDocumentElement(), - taskMap, conditionMap); - - if (w.getConditions() != null && w.getConditions().size() > 0) { - // add a virtual first task, with the conditions - w.getTasks().add(0, getGlobalWorkflowConditionsTask(w.getName(), w.getId(), w.getConditions())); + if(workflowFiles!=null) { + for (File workflowFile : workflowFiles) { + String workflowXmlFile = workflowFile + .getAbsolutePath(); + Document workflowRoot = getDocumentRoot(workflowXmlFile); + + String workflowId = workflowRoot + .getDocumentElement().getAttribute("id"); + if (workflowMap.get(workflowId) == null) { + Workflow w = XmlStructFactory.getWorkflow( + workflowRoot.getDocumentElement(), + taskMap, conditionMap); + + if (w.getConditions() != null && w.getConditions().size() > 0) { + // add a virtual first task, with the conditions + w.getTasks().add(0, getGlobalWorkflowConditionsTask(w.getName(), w.getId(), w.getConditions())); + } + workflowMap.put(workflowId, w); + } else { + LOG + .log( + Level.FINE, + "Ignoring workflow file: " + + workflowXmlFile + + " when loading workflows, workflow id: " + + workflowId + + " already loaded"); } - workflowMap.put(workflowId, w); - } else { - LOG - .log( - Level.FINE, - "Ignoring workflow file: " - + workflowXmlFile - + " when loading workflows, workflow id: " - + workflowId - + " already loaded"); - } + } } } } catch (URISyntaxException e) {
