OODT-917 replace hashtables
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/fb5cd1f0 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/fb5cd1f0 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/fb5cd1f0 Branch: refs/heads/master Commit: fb5cd1f001b03a9c7b4a2b27a63f1f72ad497d77 Parents: 1a7f723 Author: Tom Barber <[email protected]> Authored: Tue Nov 3 15:31:37 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Tue Nov 3 15:31:37 2015 +0000 ---------------------------------------------------------------------- .../model/repo/XmlWorkflowModelRepository.java | 20 +++++------ .../gui/perspective/MultiStatePerspective.java | 4 +-- .../gui/perspective/build/BuildPerspective.java | 8 ++--- .../gui/perspective/view/ViewState.java | 4 +-- .../perspective/view/impl/DefaultPropView.java | 4 +-- .../perspective/view/impl/DefaultTreeView.java | 24 ++++++------- .../gui/perspective/view/impl/GraphView.java | 10 +++--- .../view/impl/JungJGraphModelAdapter.java | 4 +-- .../mapping/MemoryBasedIngestMapper.java | 14 ++++---- .../MemoryBasedCatalogRepository.java | 6 ++-- .../struct/impl/index/DataSourceIndex.java | 25 +++++++++++--- .../index/WorkflowManagerDataSourceIndex.java | 16 +++++++-- .../apache/oodt/cas/catalog/system/Catalog.java | 4 +-- .../oodt/cas/catalog/term/TermBucket.java | 10 +++--- .../org/apache/oodt/commons/MultiServer.java | 4 +-- .../oodt/commons/activity/DatagramLogger.java | 4 +-- .../org/apache/oodt/commons/util/CacheMap.java | 8 +++-- .../commons/util/EnterpriseEntityResolver.java | 15 ++++++-- .../org/apache/oodt/commons/util/XMLRPC.java | 4 +-- .../oodt/commons/object/jndi/TContext.java | 4 +-- .../cas/crawl/action/SolrIndexingAction.java | 4 +-- .../cas/curation/service/CurationService.java | 4 +-- .../curation/service/CurationServiceConfig.java | 4 +-- .../cas/curation/service/IngestionResource.java | 10 +++--- .../cas/curation/service/MetadataResource.java | 4 +-- .../cas/curation/service/PolicyResource.java | 8 ++--- .../catalog/LenientDataSourceCatalog.java | 1 + .../oodt/cas/filemgr/catalog/LuceneCatalog.java | 30 +++++++++++++--- .../catalog/solr/DefaultProductSerializer.java | 8 ++--- .../cas/filemgr/catalog/solr/SolrCatalog.java | 12 +++---- .../cas/filemgr/catalog/solr/SolrClient.java | 10 +++--- .../datatransfer/TransferStatusTracker.java | 8 ++--- .../repository/XMLRepositoryManager.java | 4 +-- .../cas/filemgr/system/XmlRpcFileManager.java | 4 +-- .../cas/filemgr/util/XmlRpcStructFactory.java | 30 ++++++++-------- .../oodt/cas/filemgr/util/XmlStructFactory.java | 16 ++++----- .../filemgr/validation/XMLValidationLayer.java | 12 +++---- .../org/apache/oodt/cas/metadata/Metadata.java | 8 ++--- .../extractors/ProdTypePatternMetExtractor.java | 8 ++--- .../main/resources/oodt-fm/conf/solrconfig.xml | 6 ++-- .../apache/oodt/opendapps/DatasetCrawler.java | 14 ++++++-- .../config/ProcessingInstructions.java | 4 +-- .../oodt/opendapps/util/ProfileUtils.java | 4 +-- .../oodt/pcs/input/PGEConfigurationFile.java | 4 +-- .../apache/oodt/pcs/input/PGEDataHandler.java | 8 ++--- .../org/apache/oodt/pcs/input/PGEGroup.java | 18 +++++----- .../apache/oodt/pcs/input/PGEXMLFileUtils.java | 8 ++--- .../oodt/pcs/services/HealthResource.java | 36 ++++++++++---------- .../oodt/pcs/services/PedigreeResource.java | 6 ++-- .../pcs/services/config/PCSServiceConfig.java | 4 +-- .../oodt/cas/pge/TestPGETaskInstance.java | 20 +++++++---- .../product/handlers/ofsn/OFSNFileHandler.java | 4 +-- .../ofsn/OFSNFileHandlerConfiguration.java | 4 +-- product/src/site/xdoc/tutorials/qh/index.xml | 8 ++--- .../java/org/apache/oodt/profile/Profile.java | 4 +-- .../lightweight/LightweightProfileServer.java | 12 +++++-- .../protocol/config/SpringProtocolConfig.java | 4 +-- .../cas/protocol/system/ProtocolManager.java | 4 +-- .../verify/BasicProtocolVerifierFactory.java | 4 +-- .../oodt/cas/protocol/http/HttpProtocol.java | 4 +-- .../oodt/cas/pushpull/config/ParserInfo.java | 6 ++-- .../oodt/cas/pushpull/config/PropFilesInfo.java | 6 ++-- .../oodt/cas/pushpull/config/ProtocolInfo.java | 6 ++-- .../oodt/cas/pushpull/config/RemoteSpecs.java | 4 +-- .../oodt/cas/pushpull/config/SiteInfo.java | 6 ++-- .../pushpull/expressions/GlobalVariables.java | 4 +-- .../oodt/cas/pushpull/expressions/Method.java | 2 +- .../parsers/DirStructXmlParser.java | 8 ++--- .../cas/pushpull/protocol/ProtocolHandler.java | 26 ++++++++------ .../DataFileToPropFileLinker.java | 10 +++--- .../DownloadThreadEvaluator.java | 6 ++-- .../retrievalsystem/RetrievalSetup.java | 6 ++-- .../cas/resource/batchmgr/XmlRpcBatchMgr.java | 6 ++-- .../resource/jobrepo/MemoryJobRepository.java | 8 ++--- .../resource/jobrepo/XStreamJobRepository.java | 4 +-- .../cas/resource/monitor/AssignmentMonitor.java | 10 +++--- .../monitor/ganglia/GangliaAdapter.java | 6 ++-- .../monitor/ganglia/GangliaResourceMonitor.java | 10 +++--- .../monitor/ganglia/GangliaXMLParser.java | 6 ++-- .../monitor/ganglia/configuration/Metric.java | 8 ++--- .../cas/resource/mux/QueueMuxBatchManager.java | 4 +-- .../resource/mux/StandardBackendManager.java | 4 +-- .../cas/resource/scheduler/QueueManager.java | 4 ++- .../cas/resource/structs/NameValueJobInput.java | 4 +-- .../resource/system/extern/XmlRpcBatchStub.java | 4 +-- .../apache/oodt/cas/resource/util/Ulimit.java | 4 +-- .../resource/monitor/TestGangliaXMLParser.java | 4 +-- .../cas/resource/mux/TestQueueMuxMonitor.java | 4 +-- .../resource/batchmgr/MesosBatchManager.java | 4 +-- .../oodt/cas/resource/monitor/MesosMonitor.java | 4 +-- .../apache/oodt/filemgrget/OODTProcesses.java | 4 +-- .../curation/workbench/Workbench.java | 4 +-- .../product/data/DatasetDeliveryServlet.java | 4 +-- .../jaxrs/configurations/RdfConfiguration.java | 14 ++++---- .../filters/BackwardsCompatibleInterceptor.java | 4 +-- .../jaxrs/servlets/CasProductJaxrsServlet.java | 6 ++-- .../apache/oodt/cas/product/rdf/RDFConfig.java | 12 +++---- .../IterativeWorkflowProcessorThread.java | 8 ++--- .../engine/ThreadPoolWorkflowEngine.java | 6 ++-- .../processor/WorkflowProcessorQueue.java | 4 +-- .../runner/AsynchronousLocalEngineRunner.java | 4 +-- .../MemoryWorkflowInstanceRepository.java | 6 ++-- .../repository/PackagedWorkflowRepository.java | 12 +++---- .../repository/XMLWorkflowRepository.java | 21 ++++++++---- .../oodt/cas/workflow/structs/TaskJobInput.java | 4 +-- .../cas/workflow/util/XmlStructFactory.java | 20 +++++------ .../system/TestXmlRpcWorkflowManager.java | 4 --- .../apache/oodt/xmlps/structs/CDEResult.java | 6 ++-- .../org/apache/oodt/xmlquery/CodecFactory.java | 5 +-- .../java/org/apache/oodt/xmlquery/Result.java | 25 ++++++++++---- 110 files changed, 512 insertions(+), 406 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 e9a523a..70d54aa 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 @@ -17,8 +17,6 @@ package org.apache.oodt.cas.workflow.gui.model.repo; -//OODT imports - import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.oodt.cas.metadata.Metadata; @@ -38,13 +36,13 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -57,8 +55,6 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -//JDK imports - /** * * Model Repository which stores models in xml files @@ -90,7 +86,7 @@ public class XmlWorkflowModelRepository { public void loadGraphs(Set<String> supportedProcessorIds) throws XPathExpressionException, WorkflowException, IOException, SAXException, ParserConfigurationException { this.graphs = new HashSet<ModelGraph>(); - HashMap<String, ConfigGroup> globalConfGroups = new HashMap<String, ConfigGroup>(); + ConcurrentHashMap<String, ConfigGroup> globalConfGroups = new ConcurrentHashMap<String, ConfigGroup>(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder parser = factory.newDocumentBuilder(); @@ -130,7 +126,7 @@ public class XmlWorkflowModelRepository { } public void setGlobalConfigGroups(Map<String, ConfigGroup> globalConfigGroups) { - this.globalConfigGroups = new HashMap<String, ConfigGroup>( + this.globalConfigGroups = new ConcurrentHashMap<String, ConfigGroup>( globalConfigGroups); } @@ -154,7 +150,7 @@ public class XmlWorkflowModelRepository { private void saveGraphs() throws ParserConfigurationException { - Map<File, Document> documents = new HashMap<File, Document>(); + Map<File, Document> documents = new ConcurrentHashMap<File, Document>(); for (ModelGraph graph : this.graphs) { Document document = documents.get(graph.getModel().getFile()); if (document == null) { @@ -321,7 +317,7 @@ public class XmlWorkflowModelRepository { private ModelGraph loadGraph(List<FileBasedElement> rootElements, FileBasedElement workflowNode, Metadata staticMetadata, - HashMap<String, ConfigGroup> globalConfGroups, + ConcurrentHashMap<String, ConfigGroup> globalConfGroups, Set<String> supportedProcessorIds) throws XPathExpressionException, WorkflowException { String modelIdRef = null; @@ -464,7 +460,7 @@ public class XmlWorkflowModelRepository { protected ModelGraph findGraph(List<FileBasedElement> rootElements, String modelIdRef, Metadata staticMetadata, - HashMap<String, ConfigGroup> globalConfGroups, + ConcurrentHashMap<String, ConfigGroup> globalConfGroups, Set<String> supportedProcessorIds) throws XPathExpressionException, WorkflowException { XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expr = xpath.compile("//*[@id = '" + modelIdRef + "']"); @@ -482,7 +478,7 @@ public class XmlWorkflowModelRepository { private void loadConfiguration(List<FileBasedElement> rootElements, FileBasedElement workflowNode, ModelNode modelNode, - HashMap<String, ConfigGroup> globalConfGroups) { + ConcurrentHashMap<String, ConfigGroup> globalConfGroups) { NodeList children = workflowNode.getElement().getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node curChild = children.item(i); @@ -515,7 +511,7 @@ public class XmlWorkflowModelRepository { } private Metadata loadConfiguration(List<FileBasedElement> rootElements, - Node configNode, HashMap<String, ConfigGroup> globalConfGroups) { + Node configNode, ConcurrentHashMap<String, ConfigGroup> globalConfGroups) { Metadata curMetadata = new Metadata(); NodeList curGrandChildren = configNode.getChildNodes(); for (int k = 0; k < curGrandChildren.getLength(); k++) { http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java index 5503c6b..bb2ca24 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java @@ -18,7 +18,7 @@ package org.apache.oodt.cas.workflow.gui.perspective; //JDK imports -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -40,7 +40,7 @@ public abstract class MultiStatePerspective extends Perspective { private static final long serialVersionUID = -6410768713084872977L; - private final Map<String, ViewState> states = new HashMap<String, ViewState>(); + private final Map<String, ViewState> states = new ConcurrentHashMap<String, ViewState>(); private Mode mode; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java index e6efd4e..67a6146 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java @@ -40,7 +40,7 @@ import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Collections; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.logging.Level; @@ -76,7 +76,7 @@ public class BuildPerspective extends MultiStatePerspective { private Class<? extends View> propViewClass; private Class<? extends View> globalViewClass; - private HashMap<ViewState, BuildPanel> stateViews; + private ConcurrentHashMap<ViewState, BuildPanel> stateViews; private ViewState activeState; public static final int MAIN_VIEW = 1; @@ -102,7 +102,7 @@ public class BuildPerspective extends MultiStatePerspective { this.treeViewClass = treeViewClass; this.propViewClass = propViewClass; this.globalViewClass = globalViewClass; - this.stateViews = new HashMap<ViewState, BuildPanel>(); + this.stateViews = new ConcurrentHashMap<ViewState, BuildPanel>(); this.projectView = this.createProjectView(); this.projectView.setPreferredSize(new Dimension(WIDTH / 10, HEIGHT / 2)); this.globalConfigView = this.createGlobalConfigView(); @@ -288,7 +288,7 @@ public class BuildPerspective extends MultiStatePerspective { public BuildPanel(ViewState state) { this.state = state; - mainViews = new HashMap<View, ViewState>(); + mainViews = new ConcurrentHashMap<View, ViewState>(); propView = createPropView(); if (propView != null) { http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java index ff863fc..3ffc1fe 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java @@ -26,7 +26,7 @@ import org.apache.oodt.cas.workflow.gui.util.GuiUtils; //JDK imports import java.io.File; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -45,7 +45,7 @@ import java.util.Vector; */ public class ViewState { - private static final HashMap<String, Stack<ViewState>> undoHistory = new HashMap<String, Stack<ViewState>>(); + private static final ConcurrentHashMap<String, Stack<ViewState>> undoHistory = new ConcurrentHashMap<String, Stack<ViewState>>(); private ModelGraph selected; private List<ModelGraph> graphs; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java index 3836137..1f09521 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java @@ -42,7 +42,7 @@ import java.text.DecimalFormat; import java.text.Format; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Hashtable; import java.util.List; import java.util.Vector; @@ -108,7 +108,7 @@ public class DefaultPropView extends View { final ModelGraph selected = state.getSelected(); if (selected != null) { final Vector<Vector<String>> rows = new Vector<Vector<String>>(); - HashMap<String, String> keyToGroupMap = new HashMap<String, String>(); + ConcurrentHashMap<String, String> keyToGroupMap = new ConcurrentHashMap<String, String>(); Metadata staticMet = selected.getModel().getStaticMetadata(); Metadata inheritedMet = selected.getInheritedStaticMetadata(state); Metadata completeMet = new Metadata(); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java index f679fa7..da9c7ef 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java @@ -28,7 +28,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Stack; import javax.swing.JLabel; @@ -108,8 +108,8 @@ public class DefaultTreeView extends View { for (int i = 0; i < node.getChildCount(); i++) { stack.push((DefaultMutableTreeNode) node.getChildAt(i)); } - } else if (node.getUserObject() instanceof HashMap) { - String key = (String) ((HashMap<String, String>) node.getUserObject()) + } else if (node.getUserObject() instanceof ConcurrentHashMap) { + String key = (String) ((ConcurrentHashMap<String, String>) node.getUserObject()) .keySet().iterator().next(); if (lookingForPath.equals(key)) { return new TreePath(node.getPath()); @@ -230,7 +230,7 @@ public class DefaultTreeView extends View { state.setProperty(EXPAND_POSTCONDITIONS, Boolean.toString(node .getUserObject().equals("post-conditions"))); DefaultTreeView.this.notifyListeners(); - } else if (node.getUserObject() instanceof HashMap) { + } else if (node.getUserObject() instanceof ConcurrentHashMap) { DefaultMutableTreeNode metNode = null; String group = null; Object[] path = e.getPath().getPath(); @@ -238,12 +238,12 @@ public class DefaultTreeView extends View { if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof ModelGraph) { metNode = (DefaultMutableTreeNode) path[i]; break; - } else if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof HashMap) { + } else if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof ConcurrentHashMap) { if (group == null) { - group = (String) ((HashMap<String, String>) ((DefaultMutableTreeNode) path[i]) + group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i]) .getUserObject()).keySet().iterator().next(); } else { - group = (String) ((HashMap<String, String>) ((DefaultMutableTreeNode) path[i]) + group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i]) .getUserObject()).keySet().iterator().next() + "/" + group; @@ -291,15 +291,15 @@ public class DefaultTreeView extends View { panel.add(idLabel, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; - } else if (node.getUserObject() instanceof HashMap) { + } else if (node.getUserObject() instanceof ConcurrentHashMap) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); - String group = (String) ((HashMap<String, String>) node + String group = (String) ((ConcurrentHashMap<String, String>) node .getUserObject()).keySet().iterator().next(); JLabel nameLabel = new JLabel(group + " : "); nameLabel.setForeground(Color.blue); nameLabel.setBackground(Color.white); - JLabel valueLabel = new JLabel(((HashMap<String, String>) node + JLabel valueLabel = new JLabel(((ConcurrentHashMap<String, String>) node .getUserObject()).get(group)); valueLabel.setForeground(Color.darkGray); valueLabel.setBackground(Color.white); @@ -404,12 +404,12 @@ public class DefaultTreeView extends View { for (String group : staticMetadata.getGroups()) { Object userObj; if (staticMetadata.getMetadata(group) != null) { - HashMap<String, String> map = new HashMap<String, String>(); + ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>(); map.put(group, StringUtils.join(staticMetadata.getAllMetadata(group), ",")); userObj = map; } else { - HashMap<String, String> map = new HashMap<String, String>(); + ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>(); map.put(group, null); userObj = map; } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 700f227..64cf0a1 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 @@ -69,7 +69,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; @@ -126,7 +126,7 @@ public class GraphView extends DefaultTreeView { private static final String FORWARD_ITEM_NAME = "Move Forward"; private static final String BACKWARDS_ITEM_NAME = "Move Backwards"; - private HashMap<String, Pair> edgeMap; + private ConcurrentHashMap<String, Pair> edgeMap; private static final String SCALE = "GraphView/scale"; private static final String EDGE_DISPLAY_MODE = "GraphView/EdgeDisplay/Mode"; @@ -154,7 +154,7 @@ public class GraphView extends DefaultTreeView { cursor = jgraph.getCursor(); } - this.edgeMap = new HashMap<String, Pair>(); + this.edgeMap = new ConcurrentHashMap<String, Pair>(); directedGraph = new ObservableGraph<ModelNode, IdentifiableEdge>( new DirectedSparseGraph<ModelNode, IdentifiableEdge>()); @@ -444,7 +444,7 @@ public class GraphView extends DefaultTreeView { state.setProperty(EDGE_DISPLAY_MODE, edgeDisplayMode = WORKFLOW_MODE); } if (edgeDisplayMode.equals(WORKFLOW_MODE)) { - this.edgeMap = new HashMap<String, Pair>(); + this.edgeMap = new ConcurrentHashMap<String, Pair>(); removeAllEdges(this.directedGraph); lines = GuiUtils.findSequentialLines(state.getGraphs()); for (Line line : lines) { @@ -730,7 +730,7 @@ public class GraphView extends DefaultTreeView { .getModel()); - HashMap<Object, Object> map = new HashMap<Object, Object>(); + ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<Object, Object>(); for (int i = 0; i < modelGraph.getChildren().size(); i++) { ModelGraph child = modelGraph.getChildren().get(i); DefaultGraphCell curCell = addGroups(child, nested, state); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java index 094cb88..71a6cf5 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java @@ -21,7 +21,7 @@ package org.apache.oodt.cas.workflow.gui.perspective.view.impl; import java.awt.Color; import java.awt.Font; import java.awt.geom.Rectangle2D; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -73,7 +73,7 @@ public class JungJGraphModelAdapter extends DefaultGraphModel { final ObservableGraph<ModelNode, IdentifiableEdge> jungGraph) { this.jungGraph = jungGraph; this.jungGraph.addGraphEventListener(new WorkflowChangeListener(this)); - this.cellMap = new HashMap<String, DefaultGraphCell>(); + this.cellMap = new ConcurrentHashMap<String, DefaultGraphCell>(); this.addGraphModelListener(new GraphModelListener() { @Override http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 index dff1437..5900ca0 100644 --- 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 @@ -23,7 +23,7 @@ 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.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -45,14 +45,14 @@ public class MemoryBasedIngestMapper implements IngestMapper { private static Logger LOG = Logger.getLogger(MemoryBasedIngestMapper.class.getName()); - protected HashMap<String, TransactionIdMapping> catalogServiceTransactionIdKeyMapping; - protected HashMap<String, TransactionIdMapping> catalogInfoKeyMapping; - protected HashMap<String, List<CatalogReceipt>> catalogIdToCatalogReceiptMapping; + protected ConcurrentHashMap<String, TransactionIdMapping> catalogServiceTransactionIdKeyMapping; + protected ConcurrentHashMap<String, TransactionIdMapping> catalogInfoKeyMapping; + protected ConcurrentHashMap<String, List<CatalogReceipt>> catalogIdToCatalogReceiptMapping; public MemoryBasedIngestMapper() { - this.catalogServiceTransactionIdKeyMapping = new HashMap<String, TransactionIdMapping>(); - this.catalogInfoKeyMapping = new HashMap<String, TransactionIdMapping>(); - this.catalogIdToCatalogReceiptMapping = new HashMap<String, List<CatalogReceipt>>(); + this.catalogServiceTransactionIdKeyMapping = new ConcurrentHashMap<String, TransactionIdMapping>(); + this.catalogInfoKeyMapping = new ConcurrentHashMap<String, TransactionIdMapping>(); + this.catalogIdToCatalogReceiptMapping = new ConcurrentHashMap<String, List<CatalogReceipt>>(); } /* http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java index 16bbadb..1b882fb 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java @@ -17,7 +17,7 @@ package org.apache.oodt.cas.catalog.repository; //JDK imports -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -40,11 +40,11 @@ import org.apache.oodt.cas.catalog.util.PluginURL; */ public class MemoryBasedCatalogRepository implements CatalogRepository { - protected HashMap<String, Catalog> catalogMap; + protected ConcurrentHashMap<String, Catalog> catalogMap; protected List<PluginURL> classLoaderUrls; public MemoryBasedCatalogRepository() { - this.catalogMap = new HashMap<String, Catalog>(); + this.catalogMap = new ConcurrentHashMap<String, Catalog>(); this.classLoaderUrls = new Vector<PluginURL>(); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java index 175419a..cc007e0 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java @@ -17,6 +17,7 @@ package org.apache.oodt.cas.catalog.struct.impl.index; //JDK imports + import org.apache.commons.lang.StringUtils; import org.apache.oodt.cas.catalog.exception.CatalogIndexException; import org.apache.oodt.cas.catalog.exception.IngestServiceException; @@ -25,8 +26,16 @@ import org.apache.oodt.cas.catalog.page.IndexPager; import org.apache.oodt.cas.catalog.page.IngestReceipt; import org.apache.oodt.cas.catalog.page.PageInfo; import org.apache.oodt.cas.catalog.page.ProcessedPageInfo; -import org.apache.oodt.cas.catalog.query.*; -import org.apache.oodt.cas.catalog.struct.*; +import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression; +import org.apache.oodt.cas.catalog.query.NotQueryExpression; +import org.apache.oodt.cas.catalog.query.QueryExpression; +import org.apache.oodt.cas.catalog.query.QueryLogicalGroup; +import org.apache.oodt.cas.catalog.query.StdQueryExpression; +import org.apache.oodt.cas.catalog.struct.Index; +import org.apache.oodt.cas.catalog.struct.IngestService; +import org.apache.oodt.cas.catalog.struct.QueryService; +import org.apache.oodt.cas.catalog.struct.TransactionId; +import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; import org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory; import org.apache.oodt.cas.catalog.term.Term; import org.apache.oodt.cas.catalog.term.TermBucket; @@ -39,7 +48,13 @@ import java.net.URLEncoder; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; -import java.util.*; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -336,7 +351,7 @@ public class DataSourceIndex implements Index, IngestService, QueryService { Statement stmt = null; ResultSet rs = null; try { - HashMap<String, TermBucket> termBuckets = new HashMap<String, TermBucket>(); + ConcurrentHashMap<String, TermBucket> termBuckets = new ConcurrentHashMap<String, TermBucket>(); conn = this.dataSource.getConnection(); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT bucket_name,term_name,term_value FROM transaction_terms WHERE transaction_id = '" + transactionId + "'"); @@ -373,7 +388,7 @@ public class DataSourceIndex implements Index, IngestService, QueryService { */ public Map<TransactionId<?>, List<TermBucket>> getBuckets( List<TransactionId<?>> transactionIds) throws QueryServiceException { - HashMap<TransactionId<?>, List<TermBucket>> map = new HashMap<TransactionId<?>, List<TermBucket>>(); + ConcurrentHashMap<TransactionId<?>, List<TermBucket>> map = new ConcurrentHashMap<TransactionId<?>, List<TermBucket>>(); for (TransactionId<?> transactionId : transactionIds) { map.put(transactionId, this.getBuckets(transactionId)); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java index 23f329f..cc329dc 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java @@ -17,11 +17,16 @@ package org.apache.oodt.cas.catalog.struct.impl.index; //JDK imports + import org.apache.oodt.cas.catalog.exception.CatalogIndexException; import org.apache.oodt.cas.catalog.exception.QueryServiceException; import org.apache.oodt.cas.catalog.page.IndexPager; import org.apache.oodt.cas.catalog.page.IngestReceipt; -import org.apache.oodt.cas.catalog.query.*; +import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression; +import org.apache.oodt.cas.catalog.query.NotQueryExpression; +import org.apache.oodt.cas.catalog.query.QueryExpression; +import org.apache.oodt.cas.catalog.query.QueryLogicalGroup; +import org.apache.oodt.cas.catalog.query.StdQueryExpression; import org.apache.oodt.cas.catalog.struct.Index; import org.apache.oodt.cas.catalog.struct.QueryService; import org.apache.oodt.cas.catalog.struct.TransactionId; @@ -38,7 +43,12 @@ import java.net.URLEncoder; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -142,7 +152,7 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService { public Map<TransactionId<?>, List<TermBucket>> getBuckets( List<TransactionId<?>> transactionIds) throws QueryServiceException { - Map<TransactionId<?>, List<TermBucket>> returnMap = new HashMap<TransactionId<?>, List<TermBucket>>(); + Map<TransactionId<?>, List<TermBucket>> returnMap = new ConcurrentHashMap<TransactionId<?>, List<TermBucket>>(); for (TransactionId<?> transactionId : transactionIds) { returnMap.put(transactionId, this.getBuckets(transactionId)); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 a95fec2..c292672 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 @@ -34,7 +34,7 @@ import org.apache.oodt.cas.catalog.term.TermBucket; import org.apache.oodt.cas.metadata.Metadata; import java.util.Collections; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Properties; @@ -300,7 +300,7 @@ public class Catalog { public Map<TransactionId<?>, Metadata> getMetadata(List<TransactionId<?>> transactionIds) throws CatalogException { try { - Map<TransactionId<?>, Metadata> metadataMap = new HashMap<TransactionId<?>, Metadata>(); + Map<TransactionId<?>, Metadata> metadataMap = new ConcurrentHashMap<TransactionId<?>, Metadata>(); if (this.isQueriable()) { QueryService queryService = (QueryService) this.index; Map<TransactionId<?>, List<TermBucket>> termBucketMap = queryService.getBuckets(transactionIds); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java index 5947ba7..513ebaa 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java @@ -18,7 +18,7 @@ package org.apache.oodt.cas.catalog.term; //JDK imports import java.util.Collections; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -34,16 +34,16 @@ import java.util.Vector; */ public class TermBucket extends Bucket { - private HashMap<String, Term> terms; + private ConcurrentHashMap<String, Term> terms; public TermBucket() { super(); - this.terms = new HashMap<String, Term>(); + this.terms = new ConcurrentHashMap<String, Term>(); } public TermBucket(String name) { super(name); - this.terms = new HashMap<String, Term>(); + this.terms = new ConcurrentHashMap<String, Term>(); } public TermBucket(String name, Set<Term> terms) { @@ -53,7 +53,7 @@ public class TermBucket extends Bucket { public void setTerms(Set<Term> terms) { if (terms != null) { - this.terms = new HashMap<String, Term>(); + this.terms = new ConcurrentHashMap<String, Term>(); for (Term term : terms) { this.terms.put(term.name, term); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/main/java/org/apache/oodt/commons/MultiServer.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java b/commons/src/main/java/org/apache/oodt/commons/MultiServer.java index ba06b72..508e76c 100644 --- a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java +++ b/commons/src/main/java/org/apache/oodt/commons/MultiServer.java @@ -33,7 +33,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.rmi.registry.Registry; import java.rmi.server.RemoteObject; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap;; import java.util.Hashtable; import java.util.Map; import java.util.Timer; @@ -242,7 +242,7 @@ public class MultiServer { // Create servers NodeList serverNodes = root.getElementsByTagName("server"); - servers = new HashMap(); + servers = new ConcurrentHashMap(); for (int i = 0; i < serverNodes.getLength(); ++i) { Element serverElem = (Element) serverNodes.item(i); String name = serverElem.getAttribute("id"); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java index 03a0014..c8e6a20 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java @@ -25,7 +25,7 @@ import java.io.OptionalDataException; import java.io.StreamCorruptedException; import java.net.DatagramPacket; import java.net.DatagramSocket; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; /** @@ -71,7 +71,7 @@ class DatagramLogger { private static Storage storage; /** History awaiting long-term storage. Keys are {@link String} activity IDs, and values are {@link History} objects. */ - private static Map histories = new HashMap(); + private static Map histories = new ConcurrentHashMap(); /** * Thread that saves off an incident into a history so the main thread can go back http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java b/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java index 4134f2b..edc2530 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java @@ -15,7 +15,11 @@ package org.apache.oodt.commons.util; -import java.util.*; +import java.util.Collection; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; // Definitions for intended functions: // @@ -229,7 +233,7 @@ public class CacheMap implements Map { private LinkedList cache = new LinkedList(); /** The map (M). */ - private Map map = new HashMap(); + private Map map = new ConcurrentHashMap(); /** The capacity of this cache map (c). */ private int capacity; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java b/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java index a70c86b..547a011 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java @@ -21,10 +21,19 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; @@ -42,7 +51,7 @@ public class EnterpriseEntityResolver implements EntityResolver { /** Initialize the class by reading the entites.xml file. */ static { - entities = new HashMap(); + entities = new ConcurrentHashMap(); try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(false); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java index 3c2bcc6..8b0551f 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java @@ -31,7 +31,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; @@ -208,7 +208,7 @@ public class XMLRPC { } else if ("base64".equals(n)) { return Base64.decode(txt.getBytes()); } else if ("struct".equals(n)) { - Map m = new HashMap(); + Map m = new ConcurrentHashMap(); NodeList memberNodes = t.getChildNodes(); for (int i = 0; i < memberNodes.getLength(); ++i) { Node memberNode = memberNodes.item(i); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/commons/src/test/java/org/apache/oodt/commons/object/jndi/TContext.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/oodt/commons/object/jndi/TContext.java b/commons/src/test/java/org/apache/oodt/commons/object/jndi/TContext.java index b5acdf6..e0a9fbc 100644 --- a/commons/src/test/java/org/apache/oodt/commons/object/jndi/TContext.java +++ b/commons/src/test/java/org/apache/oodt/commons/object/jndi/TContext.java @@ -15,7 +15,7 @@ package org.apache.oodt.commons.object.jndi; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; @@ -194,7 +194,7 @@ public class TContext implements Context { } /** What holds the bindings. Keys are {@link String}s, values are {@link Object}s. */ - Map bindings = new HashMap(); + Map bindings = new ConcurrentHashMap(); /** What every key must start with. */ private String prefix; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 7592090..20fcf90 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 @@ -19,7 +19,7 @@ package org.apache.oodt.cas.crawl.action; // JDK imports import java.io.File; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; import java.util.logging.Level; @@ -41,7 +41,7 @@ public class SolrIndexingAction extends CrawlerAction { private String fileManagerUrl = "http://localhost:9000/"; // environment variables (containing location of indexer.properties) - private Map<String, String> env = new HashMap<String,String>(); + private Map<String, String> env = new ConcurrentHashMap<String,String>(); // service responsible for metadata migration private SolrIndexer solrIndexer = null; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 61fae24..cb1ca41 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 @@ -30,7 +30,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.ArrayList; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.logging.Logger; @@ -104,7 +104,7 @@ public class CurationService extends HttpServlet implements CuratorConfMetKeys { List<Map<String, Object>> items = new ArrayList<Map<String, Object>>(); for (String aF : f) { - Map<String, Object> entry = new HashMap<String, Object>(); + Map<String, Object> entry = new ConcurrentHashMap<String, Object>(); String children[] = getFilesInDirectory(startingPath + "/" + aF, showFiles); entry.put("text", aF); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationServiceConfig.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationServiceConfig.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationServiceConfig.java index b291aa2..1fbfb9b 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationServiceConfig.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/CurationServiceConfig.java @@ -27,7 +27,7 @@ import org.apache.oodt.cas.metadata.util.PathUtils; //JDK imports import java.net.URL; import java.util.Enumeration; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -58,7 +58,7 @@ import javax.servlet.ServletContext; */ public class CurationServiceConfig implements CuratorConfMetKeys { private static CurationServiceConfig instance; - private final Map<String, String> parameters = new HashMap<String, String>(); + private final Map<String, String> parameters = new ConcurrentHashMap<String, String>(); private XmlRpcFileManagerClient fmClient = null; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java index 2a63b54..5cc6520 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java @@ -35,7 +35,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Date; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -225,7 +225,7 @@ public class IngestionResource extends CurationService { private String encodeTaskListAsJSON(List<IngestionTask> taskList) { List<Map<String, String>> jsonFriendlyTaskList = new Vector<Map<String, String>>(); for (IngestionTask task : taskList) { - Map<String, String> taskPropMap = new HashMap<String, String>(); + Map<String, String> taskPropMap = new ConcurrentHashMap<String, String>(); taskPropMap.put("id", task.getId()); taskPropMap.put("createDate", DateUtils.getDateAsISO8601String(task .getCreateDate())); @@ -256,7 +256,7 @@ public class IngestionResource extends CurationService { } private String encodeIngestResponseAsJSON(boolean success, String msg) { - Map<String, Object> resMap = new HashMap<String, Object>(); + Map<String, Object> resMap = new ConcurrentHashMap<String, Object>(); resMap.put("success", success); resMap.put("msg", msg); JSONObject resObj = new JSONObject(); @@ -305,10 +305,10 @@ public class IngestionResource extends CurationService { class IngestionTaskList { - private HashMap<String, IngestionTask> taskMap; + private ConcurrentHashMap<String, IngestionTask> taskMap; public IngestionTaskList() { - this.taskMap = new HashMap<String, IngestionTask>(); + this.taskMap = new ConcurrentHashMap<String, IngestionTask>(); } public synchronized String addIngestionTask(IngestionTask task) { http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 6ec8119..0d2bd2e 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 @@ -59,7 +59,7 @@ import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -933,7 +933,7 @@ public class MetadataResource extends CurationService { throws ValidationLayerException, RepositoryManagerException { // Remove Elements that aren't used in any product type List<ProductType> ptypelist = xmlRepo.getProductTypes(); - HashMap<String, Boolean> usedElementIds = new HashMap<String, Boolean>(); + ConcurrentHashMap<String, Boolean> usedElementIds = new ConcurrentHashMap<String, Boolean>(); for(ProductType ptype: ptypelist) { List<Element> ptypeElements = vLayer.getElements(ptype); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java index 37d5d0d..bde259b 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java @@ -34,7 +34,7 @@ import java.io.FilenameFilter; import java.io.IOException; import java.net.MalformedURLException; import java.util.Arrays; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Vector; @@ -217,7 +217,7 @@ public class PolicyResource extends CurationService { } private String encodePoliciesAsJSON(String[] policyDirs) { - Map<String, String> retMap = new HashMap<String, String>(); + Map<String, String> retMap = new ConcurrentHashMap<String, String>(); for (String policyDir : policyDirs) { retMap.put("policy", policyDir); } @@ -246,11 +246,11 @@ public class PolicyResource extends CurationService { } private String encodeProductTypesAsJSON(String policy, String[] typeNames) { - Map<String, Object> retMap = new HashMap<String, Object>(); + Map<String, Object> retMap = new ConcurrentHashMap<String, Object>(); retMap.put("policy", policy); List<Map<String, String>> typeList = new Vector<Map<String, String>>(); for (String typeName : typeNames) { - Map<String, String> typeMap = new HashMap<String, String>(); + Map<String, String> typeMap = new ConcurrentHashMap<String, String>(); typeMap.put("name", typeName); typeList.add(typeMap); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 1f3bd21..83f9adb 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 @@ -18,6 +18,7 @@ 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; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java index 3f022d2..e5985ad 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java @@ -18,26 +18,48 @@ package org.apache.oodt.cas.filemgr.catalog; //JDK imports + import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; -import org.apache.lucene.search.*; -import org.apache.oodt.cas.filemgr.structs.*; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.Hits; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.RangeQuery; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.WildcardQuery; +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.validation.ValidationLayer; import org.apache.oodt.cas.metadata.Metadata; import org.apache.oodt.commons.pagination.PaginationUtils; + import org.safehaus.uuid.UUID; import org.safehaus.uuid.UUIDGenerator; import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -70,7 +92,7 @@ public class LuceneCatalog implements Catalog { * temporary Cache of product/metadata/reference information before it is * written to the index */ - private static HashMap<String, CompleteProduct> CATALOG_CACHE = new HashMap<String, CompleteProduct>(); + private static ConcurrentHashMap<String, CompleteProduct> CATALOG_CACHE = new ConcurrentHashMap<String, CompleteProduct>(); /* our product ID generator */ private static UUIDGenerator generator = UUIDGenerator.getInstance(); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 0377b4b..7a0d14e 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 @@ -33,7 +33,7 @@ import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -73,7 +73,7 @@ public class DefaultProductSerializer implements ProductSerializer { @Override public List<String> serialize(Product product, boolean create) { - Map<String, List<String>> fields = new HashMap<String, List<String>>(); + Map<String, List<String>> fields = new ConcurrentHashMap<String, List<String>>(); List<String> docs = new ArrayList<String>(); // add core product attributes to map @@ -111,7 +111,7 @@ public class DefaultProductSerializer implements ProductSerializer { */ public List<String> serialize(String productId, Reference rootReference, List<Reference> references, boolean replace) { - Map<String, List<String>> fields = new HashMap<String, List<String>>(); + Map<String, List<String>> fields = new ConcurrentHashMap<String, List<String>>(); // product root reference if (rootReference!=null) { @@ -178,7 +178,7 @@ public class DefaultProductSerializer implements ProductSerializer { */ public List<String> serialize(String productId, Metadata metadata, boolean replace) { - Map<String, List<String>> fields = new HashMap<String, List<String>>(); + Map<String, List<String>> fields = new ConcurrentHashMap<String, List<String>>(); for (String key : metadata.getKeys()) { if (! (key.startsWith(Parameters.NS) // skip metadata keys starting with reserved namespace http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java index bfaf3cd..5495aef 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java @@ -17,7 +17,7 @@ package org.apache.oodt.cas.filemgr.catalog.solr; import java.util.ArrayList; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.logging.Logger; @@ -218,7 +218,7 @@ public class SolrCatalog implements Catalog { public List<Product> getProducts() throws CatalogException { // build query parameters - Map<String, String[]> params = new HashMap<String, String[]>(); + Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "*:*" } ); //params.put("rows", new String[] { "20" } ); // control pagination ? @@ -241,7 +241,7 @@ public class SolrCatalog implements Catalog { private QueryResponse getProducts(Query query, ProductType type, int offset, int limit) throws CatalogException { // build HTTP request - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); // product type constraint params.put("q", new String[]{Parameters.PRODUCT_TYPE_NAME+":"+type.getName()} ); // convert filemgr query into a Solr query @@ -304,7 +304,7 @@ public class SolrCatalog implements Catalog { public List<Product> getProductsByProductType(ProductType type) throws CatalogException { // build query parameters - Map<String, String[]> params = new HashMap<String, String[]>(); + Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "*:*" } ); // use the product type name as query parameter params.put("fq", new String[] { Parameters.PRODUCT_TYPE_NAME+":"+type.getName() } ); @@ -326,7 +326,7 @@ public class SolrCatalog implements Catalog { public Metadata getReducedMetadata(Product product, List<String> elements) throws CatalogException { // build HTTP request - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[]{Parameters.PRODUCT_ID+":"+product.getProductId()} ); // request metadata elements explicitly params.put("fl", elements.toArray(new String[elements.size()]) ); @@ -486,7 +486,7 @@ public class SolrCatalog implements Catalog { public int getNumProducts(ProductType type) throws CatalogException { // build query parameters - Map<String, String[]> params = new HashMap<String, String[]>(); + Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "*:*" } ); params.put("rows", new String[] { "0" } ); // don't return any results http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 650d6b6..1b17b62 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 @@ -30,7 +30,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -139,7 +139,7 @@ public class SolrClient { */ public String queryProductById(String id, String mimeType) throws CatalogException { - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[]{Parameters.PRODUCT_ID+":"+id} ); return query(params, mimeType); @@ -153,7 +153,7 @@ public class SolrClient { */ public String queryProductByName(String name, String mimeType) throws CatalogException { - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[]{Parameters.PRODUCT_NAME+":"+name} ); return query(params, mimeType); @@ -167,7 +167,7 @@ public class SolrClient { */ public String queryProductsByDate(int n, String mimeType) throws CatalogException { - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[]{ "*:*"} ); params.put("rows", new String[]{ ""+n} ); params.put("sort", new String[]{ Parameters.PRODUCT_RECEIVED_TIME+" desc"} ); @@ -183,7 +183,7 @@ public class SolrClient { */ public String queryProductsByDateAndType(int n, ProductType type, String mimeType) throws CatalogException { - HashMap<String, String[]> params = new HashMap<String, String[]>(); + ConcurrentHashMap<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[]{ Parameters.PRODUCT_TYPE_NAME+type.getName() } ); params.put("rows", new String[]{ ""+n} ); params.put("sort", new String[]{ Parameters.PRODUCT_RECEIVED_TIME+" desc"} ); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 489b459..09257b8 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 @@ -28,7 +28,7 @@ import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import java.io.File; import java.net.URI; import java.net.URISyntaxException; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Vector; @@ -41,14 +41,14 @@ import java.util.logging.Logger; * @version $Revision$ * * <p> - * An abstract base class for data transfers that uses an in-memory HashMap to + * An abstract base class for data transfers that uses an in-memory ConcurrentHashMap to * keep track of data transfer status information. * </p> * */ public class TransferStatusTracker { - /* HashMap containing a list of current product transfers */ - protected HashMap<String, Product> currentProductTransfers = new HashMap<String, Product>(); + /* ConcurrentHashMap containing a list of current product transfers */ + protected ConcurrentHashMap<String, Product> currentProductTransfers = new ConcurrentHashMap<String, Product>(); /* our catalog object */ private Catalog catalog = null; http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 bf3ce42..bd41df6 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 @@ -29,7 +29,7 @@ import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -60,7 +60,7 @@ public class XMLRepositoryManager implements RepositoryManager { private List<String> productTypeHomeUris = null; /* our map of product types that the system knows about */ - private HashMap<String, ProductType> productTypeMap = new HashMap<String, ProductType>(); + private ConcurrentHashMap<String, ProductType> productTypeMap = new ConcurrentHashMap<String, ProductType>(); /* our log stream */ private static final Logger LOG = Logger.getLogger(XMLRepositoryManager.class http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java index 41ebc25..65b84a6 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java @@ -65,7 +65,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Map; import java.util.LinkedList; import java.util.List; @@ -172,7 +172,7 @@ public class XmlRpcFileManager { FileTransferStatus status = transferStatusTracker .getCurrentFileTransfer(); if (status == null) { - return new HashMap<String, Object>(); + return new ConcurrentHashMap<String, Object>(); } else { return XmlRpcStructFactory.getXmlRpcFileTransferStatus(status); } http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 b1e4485..3ce0db1 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 @@ -37,7 +37,7 @@ import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor; import org.apache.oodt.cas.filemgr.structs.type.TypeHandler; import org.apache.oodt.cas.metadata.Metadata; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Properties; @@ -65,7 +65,7 @@ public final class XmlRpcStructFactory { public static Map<String, Object> getXmlRpcFileTransferStatus( FileTransferStatus status) { - Map<String, Object> statusHash = new HashMap<String, Object>(); + Map<String, Object> statusHash = new ConcurrentHashMap<String, Object>(); statusHash.put("bytesTransferred",Long.toString(status .getBytesTransferred())); statusHash.put("parentProduct", getXmlRpcProduct(status @@ -112,7 +112,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcProductPage(ProductPage page) { - Map<String, Object>productPageHash = new HashMap<String, Object>(); + Map<String, Object>productPageHash = new ConcurrentHashMap<String, Object>(); productPageHash.put("totalPages", page.getTotalPages()); productPageHash.put("pageNum", page.getPageNum()); productPageHash.put("pageSize", page.getPageSize()); @@ -178,7 +178,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcQueryFilter(QueryFilter queryFilter) { - Map<String, Object> queryFilterHash = new HashMap<String, Object>(); + Map<String, Object> queryFilterHash = new ConcurrentHashMap<String, Object>(); queryFilterHash.put("startDateTimeMetKey", queryFilter.getStartDateTimeMetKey()); queryFilterHash.put("endDateTimeMetKey", queryFilter.getEndDateTimeMetKey()); queryFilterHash.put("priorityMetKey", queryFilter.getPriorityMetKey()); @@ -199,7 +199,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcFilterAlgor(FilterAlgor filterAlgor) { - Map<String, Object> filterAlgorHash = new HashMap<String, Object>(); + Map<String, Object> filterAlgorHash = new ConcurrentHashMap<String, Object>(); filterAlgorHash.put("class", filterAlgor.getClass().getCanonicalName()); filterAlgorHash.put("epsilon", Long.toString(filterAlgor.getEpsilon())); return filterAlgorHash; @@ -230,7 +230,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcQueryResult(QueryResult queryResult) { - Map<String, Object> queryResultHash = new HashMap<String, Object>(); + Map<String, Object> queryResultHash = new ConcurrentHashMap<String, Object>(); if (queryResult.getToStringFormat() != null) { queryResultHash.put("toStringFormat", queryResult.getToStringFormat()); } @@ -250,7 +250,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcProduct(Product product) { - Map<String, Object> productHash = new HashMap<String, Object>(); + Map<String, Object> productHash = new ConcurrentHashMap<String, Object>(); if (product.getProductId() != null) { productHash.put("id", product.getProductId()); } @@ -351,7 +351,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcProductType(ProductType type) { - Map<String, Object> productTypeHash = new HashMap<String, Object>(); + Map<String, Object> productTypeHash = new ConcurrentHashMap<String, Object>(); // TODO(bfoster): ProductType ID is currently required by XmlRpcFileManager. productTypeHash.put("id", type.getProductTypeId()); if (type.getName() != null) { @@ -417,7 +417,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcExtractorSpec(ExtractorSpec spec) { - Map<String, Object> extractorHash = new HashMap<String, Object>(); + Map<String, Object> extractorHash = new ConcurrentHashMap<String, Object>(); extractorHash.put("className", spec.getClassName()); extractorHash.put("config", getXmlRpcProperties(spec.getConfiguration())); @@ -437,7 +437,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcTypeHandler(TypeHandler typeHandler) { - Map<String, Object> handlerHash = new HashMap<String, Object>(); + Map<String, Object> handlerHash = new ConcurrentHashMap<String, Object>(); handlerHash.put("className", typeHandler != null ? typeHandler.getClass().getCanonicalName():""); handlerHash.put("elementName", typeHandler != null ? @@ -504,7 +504,7 @@ public final class XmlRpcStructFactory { } public static Map<String, String> getXmlRpcProperties(Properties props) { - Map<String, String> propHash = new HashMap<String, String>(); + Map<String, String> propHash = new ConcurrentHashMap<String, String>(); if (props != null && props.keySet().size() > 0) { for (Object o : props.keySet()) { @@ -542,7 +542,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcReference(Reference reference) { - Map<String, Object> referenceHash = new HashMap<String, Object>(); + Map<String, Object> referenceHash = new ConcurrentHashMap<String, Object>(); referenceHash.put("origReference", reference.getOrigReference()); referenceHash.put("dataStoreReference", reference .getDataStoreReference() != null ? reference @@ -583,7 +583,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcElement(Element element) { - Map<String, Object> elementHash = new HashMap<String, Object>(); + Map<String, Object> elementHash = new ConcurrentHashMap<String, Object>(); elementHash.put("id", element.getElementId()); elementHash.put("name", element.getElementName()); @@ -607,7 +607,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcQuery(Query query) { - Map<String, Object> queryHash = new HashMap<String, Object>(); + Map<String, Object> queryHash = new ConcurrentHashMap<String, Object>(); Vector<Map<String, Object>> criteriaVector = getXmlRpcQueryCriteriaList(query.getCriteria()); queryHash.put("criteria", criteriaVector); return queryHash; @@ -643,7 +643,7 @@ public final class XmlRpcStructFactory { } public static Map<String, Object> getXmlRpcQueryCriteria(QueryCriteria criteria) { - Map<String, Object> criteriaHash = new HashMap<String, Object>(); + Map<String, Object> criteriaHash = new ConcurrentHashMap<String, Object>(); criteriaHash.put("class",criteria.getClass().getCanonicalName()); if(criteria instanceof TermQueryCriteria){ http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java index dd0a68e..ee38140 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java @@ -20,7 +20,7 @@ package org.apache.oodt.cas.filemgr.util; //JDK imports import java.util.ArrayList; import java.util.Enumeration; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.Hashtable; import java.util.List; import java.util.Properties; @@ -213,8 +213,8 @@ public final class XmlStructFactory { return productType; } - public static void writeProductTypeMapXmLDocument(HashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeMap, - HashMap<String, String> subToSuperMap, String xmlFilePath) { + public static void writeProductTypeMapXmLDocument(ConcurrentHashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeMap, + ConcurrentHashMap<String, String> subToSuperMap, String xmlFilePath) { XMLUtils.writeXmlFile(getProductTypeMapXmlDocument(productTypeMap, subToSuperMap), xmlFilePath); } @@ -229,8 +229,8 @@ public final class XmlStructFactory { xmlFilePath); } - public static Document getProductTypeMapXmlDocument(HashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeMap, - HashMap<String, String> subToSuperMap) { + public static Document getProductTypeMapXmlDocument(ConcurrentHashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeMap, + ConcurrentHashMap<String, String> subToSuperMap) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document document; @@ -456,13 +456,13 @@ public final class XmlStructFactory { return element; } - public static HashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> - getProductTypeElementList(Node typeMapNode, HashMap<String, org.apache.oodt.cas.filemgr.structs.Element> elements) { + public static ConcurrentHashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> + getProductTypeElementList(Node typeMapNode, ConcurrentHashMap<String, org.apache.oodt.cas.filemgr.structs.Element> elements) { org.w3c.dom.Element typeMapElement = (org.w3c.dom.Element) typeMapNode; String typeId = typeMapElement.getAttribute("id"); - HashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeElementMap = new HashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>>(); + ConcurrentHashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>> productTypeElementMap = new ConcurrentHashMap<String, List<org.apache.oodt.cas.filemgr.structs.Element>>(); org.w3c.dom.Element elementListRoot = XMLUtils.getFirstElement( "elements", typeMapElement); http://git-wip-us.apache.org/repos/asf/oodt/blob/fb5cd1f0/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 e2a06aa..1c90e49 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 @@ -34,7 +34,7 @@ import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.List; import java.util.Map; import java.util.Vector; @@ -64,13 +64,13 @@ public class XMLValidationLayer implements ValidationLayer { .getName()); /* product type ID to element map */ - private HashMap<String, List<Element>> productTypeElementMap = new HashMap<String, List<Element>>(); + private ConcurrentHashMap<String, List<Element>> productTypeElementMap = new ConcurrentHashMap<String, List<Element>>(); /* sub-type to super-type map */ - private HashMap<String, String> subToSuperMap = new HashMap<String, String>(); + private ConcurrentHashMap<String, String> subToSuperMap = new ConcurrentHashMap<String, String>(); /* element map */ - private HashMap<String, Element> elementMap = new HashMap<String, Element>(); + private ConcurrentHashMap<String, Element> elementMap = new ConcurrentHashMap<String, Element>(); /* * URIs pointing to directories with product-type-element-map.xml and @@ -244,9 +244,9 @@ public class XMLValidationLayer implements ValidationLayer { /** * Gets the parent-child relationship between product types * - * @return HashMap of {@link ProductType} ids mapped to their parent id + * @return ConcurrentHashMap of {@link ProductType} ids mapped to their parent id */ - public HashMap<String, String> getSubToSuperMap() { + public ConcurrentHashMap<String, String> getSubToSuperMap() { return subToSuperMap; }
