summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-10-19 10:42:29 +0200
committerAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-10-19 10:42:29 +0200
commit89cb43f228733bcbbdd751651aabf1ac41153b64 (patch)
treeea97c41658124359d6f6d18c8117203f77ea23e8
parent21a26c8afd28e0d77ebe88a73f62f512b74ab433 (diff)
downloadrasdaman-upstream-89cb43f228733bcbbdd751651aabf1ac41153b64.tar.gz
rasdaman-upstream-89cb43f228733bcbbdd751651aabf1ac41153b64.tar.xz
rasdaman-upstream-89cb43f228733bcbbdd751651aabf1ac41153b64.zip
Removed another stale file from WCPS
-rw-r--r--src/wcps/server/core/CachedMetadataSource.java119
1 files changed, 0 insertions, 119 deletions
diff --git a/src/wcps/server/core/CachedMetadataSource.java b/src/wcps/server/core/CachedMetadataSource.java
deleted file mode 100644
index b09f1a7..0000000
--- a/src/wcps/server/core/CachedMetadataSource.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This file is part of PetaScope.
- *
- * PetaScope is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * PetaScope is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with PetaScope. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information please see <http://www.PetaScope.org>
- * or contact Peter Baumann via <baumann@rasdaman.com>.
- *
- * Copyright 2009 Jacobs University Bremen, Peter Baumann.
- */
-
-
-package wcps.server.core;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A IMetadataSource that caches reads from another IMetadataSource. It reads
- * and caches all coverages at startup, in order to make reads faster and so
- * that WCPS will continue to work once it initializes correctly, even if the
- * database cannot be accessed, or metadata is changed into an invalid state.
- */
-
-public class CachedMetadataSource implements IMetadataSource
-{
- private Set<String> coverageNames;
- private Map<String, Metadata> metadata;
- private IMetadataSource metadataSource;
- private Map<String, String> supportedFormats;
-
- public CachedMetadataSource(IMetadataSource metadataSource)
- throws ResourceException, InvalidMetadataException
- {
- this.metadataSource = metadataSource;
-
- coverageNames = metadataSource.coverages();
- metadata = new HashMap<String, Metadata>(coverageNames.size());
- supportedFormats = new HashMap<String, String>();
- Iterator<String> i = coverageNames.iterator();
-
- try
- {
- while (i.hasNext())
- {
- String coverage = i.next();
- metadata.put(coverage, metadataSource.read(coverage));
- }
- }
- catch (InvalidRequestException ire)
- {
- throw(InvalidMetadataException) ire.getCause();
- }
-
- }
-
- public Set<String> coverages()
- {
- return coverageNames;
-
- }
-
- public String mimetype(String format)
- {
- if (supportedFormats.containsKey(format))
- {
- return supportedFormats.get(format);
- }
- else
- {
- String mimetype = metadataSource.mimetype(format);
-
- synchronized (this)
- {
- supportedFormats.put(format, mimetype);
- }
-
- return mimetype;
- }
-
- }
-
- public Metadata read(String coverageName) throws InvalidRequestException
- {
- if ((coverageName == null) || coverageName.equals(""))
- {
- throw new InvalidRequestException(
- "Cannot retrieve coverage with null or empty name");
- }
-
- if (!coverageNames.contains(coverageName))
- {
- throw new InvalidRequestException("Coverage '" + coverageName
- + "' is not served by this server");
- }
-
- return metadata.get(coverageName).clone();
-
- }
-
- public Collection<String> getAxisNames()
- {
- return metadataSource.getAxisNames();
- }
-}