You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/12/10 07:07:21 UTC
svn commit: r1044213 - in /oodt/trunk: ./ opendapps/ opendapps/src/
opendapps/src/main/ opendapps/src/main/java/ opendapps/src/main/java/org/
opendapps/src/main/java/org/apache/ opendapps/src/main/java/org/apache/oodt/
opendapps/src/main/java/org/apach...
Author: mattmann
Date: Fri Dec 10 06:07:20 2010
New Revision: 1044213
URL: http://svn.apache.org/viewvc?rev=1044213&view=rev
Log:
- fix for OODT-9 Create a generic OpenDAP profile server
Added:
oodt/trunk/opendapps/
oodt/trunk/opendapps/src/
oodt/trunk/opendapps/src/main/
oodt/trunk/opendapps/src/main/java/
oodt/trunk/opendapps/src/main/java/org/
oodt/trunk/opendapps/src/main/java/org/apache/
oodt/trunk/opendapps/src/main/java/org/apache/oodt/
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java (with props)
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java (with props)
oodt/trunk/opendapps/src/main/resources/
oodt/trunk/opendapps/src/main/resources/logging.properties
oodt/trunk/opendapps/src/main/resources/opendap.config.xml
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/pom.xml
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1044213&r1=1044212&r2=1044213&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Fri Dec 10 06:07:20 2010
@@ -4,6 +4,8 @@ Apache OODT Change Log
Release 0.2 (Current Development)
--------------------------------------------
+* OODT-9 Create a generic OpenDAP profile server (mattmann, Victor Hwang, smcclees)
+
* OODT-67 All Loggers should be "static final" (bfoster)
* OODT-66 Allow Filemgr XML-RPC connection retries and retry interval to be configurable (bfoster)
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps;
+
+//OPeNDAP imports
+import opendap.dap.DAS;
+
+/**
+ *
+ * A set of named constants for extracting information from OPeNDAP {@link DAS}
+ * profiles.
+ *
+ */
+public interface DapNames {
+
+ public static final String ACTUAL_RANGE = "actual_range";
+
+ public static final String UNITS = "units";
+
+ public static final String START = "start";
+
+ public static final String END = "end";
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,304 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps;
+
+//JDK imports
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//APACHE imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.commons.util.DateConvert;
+
+//OPeNDAP/THREDDS imports
+import thredds.catalog.InvAccess;
+import thredds.catalog.InvCatalogRef;
+import thredds.catalog.InvDataset;
+import thredds.catalog.InvDocumentation;
+import thredds.catalog.InvProperty;
+import thredds.catalog.ThreddsMetadata.Contributor;
+import thredds.catalog.ThreddsMetadata.GeospatialCoverage;
+import thredds.catalog.ThreddsMetadata.Range;
+import thredds.catalog.ThreddsMetadata.Source;
+import thredds.catalog.ThreddsMetadata.Variable;
+import thredds.catalog.ThreddsMetadata.Variables;
+import thredds.catalog.ThreddsMetadata.Vocab;
+import thredds.catalog.crawl.CatalogCrawler;
+import thredds.catalog.InvService;
+import ucar.nc2.units.DateType;
+import ucar.unidata.geoloc.LatLonRect;
+
+/**
+ * Crawls a catalog and returns all the datasets and their references.
+ *
+ */
+public class DatasetCrawler implements CatalogCrawler.Listener {
+
+ private static Logger LOG = Logger.getLogger(DatasetCrawler.class.getName());
+
+ private List<String> urls = new Vector<String>();
+
+ private Map<String, Metadata> datasetMet;
+
+ private String datasetURL = null;
+
+ public DatasetCrawler(String datasetURL) {
+ this.datasetURL = datasetURL.endsWith("/") ? datasetURL : datasetURL + "/";
+ this.datasetMet = new HashMap<String, Metadata>();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * thredds.catalog.crawl.CatalogCrawler.Listener#getCatalogRef(thredds.catalog
+ * .InvCatalogRef, java.lang.Object)
+ */
+ public boolean getCatalogRef(InvCatalogRef dd, Object context) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * thredds.catalog.crawl.CatalogCrawler.Listener#getDataset(thredds.catalog
+ * .InvDataset, java.lang.Object)
+ */
+ public void getDataset(InvDataset dd, Object context) {
+ String url = this.datasetURL + dd.getCatalogUrl().split("#")[1];
+ String id = dd.getID();
+ this.datasetMet.put(url, this.extractDatasetMet(dd));
+ LOG.log(Level.INFO, url + " is the computed access URL for this dataset");
+ List<InvAccess> datasets = dd.getAccess();
+ if (dd.getAccess() != null && dd.getAccess().size() > 0) {
+ Iterator<InvAccess> sets = datasets.iterator();
+ while (sets.hasNext()) {
+ InvAccess single = sets.next();
+ InvService service = single.getService();
+ if (service.getName().equals("odap")
+ || service.getName().equals("rdbmDods")) // only get the opendap one
+ {
+ LOG.log(Level.INFO,
+ "Found a service-specific dataset URL to over-ride the computed URL: "
+ + single.getUrlPath());
+ url = this.datasetURL + single.getUrlPath();
+ break;
+ }
+ }
+ }
+ if (url != null) {
+ this.urls.add(url);
+ }
+ }
+
+ /**
+ * Gets the set of String {@link URL}s crawled.
+ *
+ * @return A {@link List} of {@link String} representations of {@link URL}s.
+ */
+ public List<String> getURLs() {
+ return this.urls;
+ }
+
+ /**
+ * Returns the exracted THREDDS {@link InvDataset} metadata. The dataset
+ * metadata is mapped to the unique THREDDS dataset URL.
+ *
+ * @return the exracted THREDDS {@link InvDataset} metadata.
+ */
+ public Map<String, Metadata> getDatasetMet() {
+ return this.datasetMet;
+ }
+
+ private Metadata extractDatasetMet(InvDataset dataset) {
+ Metadata met = new Metadata();
+ this.addIfNotNull(met, "Authority", dataset.getAuthority());
+ this.addIfNotNull(met, "CatalogUrl", dataset.getCatalogUrl());
+ this.addIfNotNull(met, "DatasetFullName", dataset.getFullName());
+ if (dataset.getContributors() != null) {
+ for (Contributor contributor : dataset.getContributors()) {
+ this.addIfNotNull(met, "Contributor", contributor.getName());
+ }
+ }
+
+ if (dataset.getCreators() != null) {
+ for (Source source : dataset.getCreators()) {
+ this.addIfNotNull(met, "Creator", source.getName());
+ }
+ }
+
+ this.addIfNotNull(met, "DataFormatType", dataset.getDataFormatType()
+ .toString());
+ this.addIfNotNull(met, "DataType", dataset.getDataType().toString());
+ if (dataset.getDates() != null) {
+ for (DateType dateType : dataset.getDates()) {
+ String dateString = null;
+ try {
+ dateString = toISO8601(dateType.getDate());
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Error converting date: ["
+ + dateType.getDate() + "]: Message: " + e.getMessage());
+ }
+ this.addIfNotNull(met, "Dates", dateString);
+ }
+ }
+
+ if (dataset.getDocumentation() != null) {
+ for (InvDocumentation doc : dataset.getDocumentation()) {
+ this.addIfNotNull(met, "Documentation", doc.getInlineContent());
+ }
+ }
+
+ this.addIfNotNull(met, "FullName", dataset.getFullName());
+ GeospatialCoverage geoCoverage = dataset.getGeospatialCoverage();
+ if (geoCoverage != null) {
+ LatLonRect bbox = geoCoverage.getBoundingBox();
+ if (bbox != null) {
+ this.addIfNotNull(met, "SouthwestBC", bbox.getLowerLeftPoint()
+ .toString());
+ this.addIfNotNull(met, "NorthwestBC", bbox.getUpperLeftPoint()
+ .toString());
+ this.addIfNotNull(met, "NortheastBC", bbox.getUpperRightPoint()
+ .toString());
+ this.addIfNotNull(met, "SoutheastBC", bbox.getLowerRightPoint()
+ .toString());
+ } else {
+ // try north south, east west
+ if (geoCoverage.getNorthSouthRange() != null) {
+ Range nsRange = geoCoverage.getNorthSouthRange();
+ this.addIfNotNull(met, "NorthSouthRangeStart", String.valueOf(nsRange
+ .getStart()));
+ this.addIfNotNull(met, "NorthSouthRangeResolution", String
+ .valueOf(nsRange.getResolution()));
+ this.addIfNotNull(met, "NorthSouthRangeSize", String.valueOf(nsRange
+ .getSize()));
+ this.addIfNotNull(met, "NorthSouthRangeUnits", nsRange.getUnits());
+ }
+
+ if (geoCoverage.getEastWestRange() != null) {
+ Range nsRange = geoCoverage.getEastWestRange();
+ this.addIfNotNull(met, "EastWestRangeStart", String.valueOf(nsRange
+ .getStart()));
+ this.addIfNotNull(met, "EastWestRangeResolution", String
+ .valueOf(nsRange.getResolution()));
+ this.addIfNotNull(met, "EastWestRangeSize", String.valueOf(nsRange
+ .getSize()));
+ this.addIfNotNull(met, "EastWestRangeUnits", nsRange.getUnits());
+ }
+ }
+
+ this.addIfNotNull(met, "GeospatialCoverageLatitudeResolution", String
+ .valueOf(dataset.getGeospatialCoverage().getLatResolution()));
+ this.addIfNotNull(met, "GeospatialCoverageLongitudeResolution", String
+ .valueOf(dataset.getGeospatialCoverage().getLonResolution()));
+ this.addIfNotNull(met, "GeospatialCoverage", dataset
+ .getGeospatialCoverage().toString());
+ }
+
+ this.addIfNotNull(met, "History", dataset.getHistory());
+ this.addIfNotNull(met, "ID", dataset.getID());
+ if (dataset.getKeywords() != null) {
+ for (Vocab vocab : dataset.getKeywords()) {
+ this.addIfNotNull(met, "Keywords", vocab.getText());
+ }
+ }
+ this.addIfNotNull(met, "Name", dataset.getName());
+ this.addIfNotNull(met, "Processing", dataset.getProcessing());
+ if (dataset.getProjects() != null) {
+ for (Vocab vocab : dataset.getProjects()) {
+ this.addIfNotNull(met, "Projects", vocab.getText());
+ }
+ }
+
+ if (dataset.getProperties() != null) {
+ for (InvProperty prop : dataset.getProperties()) {
+ this.addIfNotNull(met, prop.getName(), prop.getValue());
+ }
+ }
+
+ if (dataset.getPublishers() != null) {
+ for (Source source : dataset.getPublishers()) {
+ this.addIfNotNull(met, "Publishers", source.getName());
+ }
+ }
+
+ this.addIfNotNull(met, "RestrictAccess", dataset.getRestrictAccess());
+ this.addIfNotNull(met, "Rights", dataset.getRights());
+ this.addIfNotNull(met, "Summary", dataset.getSummary());
+ if (dataset.getTimeCoverage() != null) {
+ String startDateTimeStr = null, endDateTimeStr = null;
+ try {
+ startDateTimeStr = toISO8601(dataset.getTimeCoverage()
+ .getStart().getDate());
+ endDateTimeStr = toISO8601(dataset.getTimeCoverage()
+ .getEnd().getDate());
+ } catch (Exception e) {
+ LOG.log(Level.WARNING,
+ "Error converting start/end date time strings: Message: "
+ + e.getMessage());
+ }
+
+ this.addIfNotNull(met, "StartDateTime", startDateTimeStr);
+ this.addIfNotNull(met, "EndDateTime", endDateTimeStr);
+ }
+
+ if (dataset.getTimeCoverage().getResolution() != null) {
+ this.addIfNotNull(met, "TimeCoverageResolution", dataset
+ .getTimeCoverage().getResolution().getText());
+ }
+ this.addIfNotNull(met, "UniqueID", dataset.getUniqueID());
+
+ if (dataset.getVariables() != null) {
+ for (Variables vars : dataset.getVariables()) {
+ if (vars.getVariableList() != null) {
+ for (Variable var : vars.getVariableList()) {
+ this.addIfNotNull(met, "Variables", var.getName());
+ }
+ }
+ }
+ }
+ return met;
+ }
+
+ private void addIfNotNull(Metadata met, String field, String value) {
+ if (value != null && !value.equals("")) {
+ met.addMetadata(field, value);
+ }
+ }
+
+ // inspired from ASLv2 code at:
+ // http://www.java2s.com/Code/Java/Data-Type/ISO8601dateparsingutility.htm
+ private String toISO8601(Date date) {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ df.setTimeZone(tz);
+ String output = df.format(date);
+ return output;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,174 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps;
+
+//JDK imports
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+//NetCDF-Java imports
+import thredds.catalog.crawl.CatalogCrawler;
+import ucar.nc2.util.CancelTask;
+import opendap.dap.DConnect;
+import opendap.dap.DataDDS;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.xmlquery.XMLQuery;
+
+/**
+ *
+ * This class takes in a query and the main catalog url and returns a list of
+ * relevant dataset urls
+ *
+ */
+public class DatasetExtractor {
+
+ private static Logger LOG = Logger
+ .getLogger(DatasetExtractor.class.getName());
+
+ public static final String FINDALL = "PFunction=findall";
+
+ public static final String FINDSOME = "PFunction=findsome";
+
+ public static final String FINDQUERY = "PFunction=findquery";
+
+ private String q;
+
+ private String mainCatalogURL;
+
+ private String datasetURL;
+
+ private List<String> allUrls;
+
+ private Map<String, Metadata> datasetMet;
+
+ public DatasetExtractor(XMLQuery q, String mainCatalogURL, String datasetURL) {
+ this.q = q.getKwdQueryString().trim();
+ this.mainCatalogURL = mainCatalogURL;
+ this.datasetURL = datasetURL;
+ this.initExtraction();
+ }
+
+ public List<String> getDapUrls() {
+ List<String> urls = null;
+
+ if (this.q.startsWith(FINDALL))
+ urls = this.allUrls;
+ else if (this.q.startsWith(FINDSOME))
+ urls = this.getFindSome();
+ else if (this.q.startsWith(FINDQUERY))
+ urls = this.getFindQuery();
+
+ return urls;
+ }
+
+ public Metadata getDatasetMet(String opendapUrl){
+ return this.datasetMet.get(opendapUrl);
+ }
+
+ private void initExtraction() {
+ DatasetCrawler listener = new DatasetCrawler(this.datasetURL);
+ CancelTask ignore = new CancelTask() {
+ public boolean isCancel() {
+ return false;
+ }
+
+ public void setError(String msg) {
+ LOG.log(Level.WARNING, msg);
+ }
+
+ };
+
+ LOG.log(Level.INFO, "catalogURL: " + this.mainCatalogURL);
+ CatalogCrawler crawler = new CatalogCrawler(CatalogCrawler.USE_ALL_DIRECT,
+ false, listener);
+ crawler.crawl(this.mainCatalogURL, ignore, System.out, this);
+ this.allUrls = listener.getURLs();
+ this.datasetMet = listener.getDatasetMet();
+ }
+
+ private List<String> getFindQuery() {
+ LOG.log(Level.INFO, "PFunction: findquery selected: orig query: [" + this.q
+ + "]");
+ String queryExpression = "";
+ Pattern parameterPattern = Pattern.compile("PParameter=\"(.+?)\"");
+ Matcher urlsMatch = parameterPattern.matcher(this.q);
+ while (urlsMatch.find()) {
+ queryExpression = urlsMatch.group(1);
+ }
+
+ List<String> datasetUrls = new Vector<String>();
+
+ for (String datasetUrl : this.allUrls) {
+ DConnect dConn = null;
+ try {
+ dConn = new DConnect(datasetUrl, true);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ LOG.log(Level.WARNING, datasetUrl
+ + " is neither a valid URL nor a filename.");
+ }
+ try {
+ DataDDS dds = dConn.getData(queryExpression, null);
+
+ if (dds != null) {
+ datasetUrls.add(datasetUrl);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG.log(Level.SEVERE, " Some DAP2Exception or not a validate DDS", e);
+ }
+ }
+
+ return datasetUrls;
+
+ }
+
+ private List<String> getFindSome() {
+ LOG.log(Level.INFO, "PFunction: findsome selected");
+ String urlsString = "";
+ Pattern parameterPattern = Pattern.compile("PParameter=\"(.+?)\"");
+ Matcher urlsMatch = parameterPattern.matcher(this.q);
+ while (urlsMatch.find()) {
+ urlsString = urlsMatch.group(1);
+ }
+
+ LOG.log(Level.INFO, "PParameter: [" + urlsString
+ + "] parsed from original string query: [" + this.q + "]");
+
+ List<String> openDapUrls = new ArrayList<String>();
+
+ StringTokenizer tokens = new StringTokenizer(urlsString, ",");
+ while (tokens.hasMoreTokens()) {
+ openDapUrls.add(tokens.nextToken());
+ }
+
+ LOG.log(Level.INFO, "OPeNDAP urls: [" + openDapUrls + "]");
+ return openDapUrls;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,142 @@
+package org.apache.oodt.opendapps;
+
+//JDK imports
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OPeNDAP/THREDDS imports
+import opendap.dap.Attribute;
+import opendap.dap.AttributeTable;
+import opendap.dap.DAS;
+import opendap.dap.NoSuchAttributeException;
+
+//OODT imports
+import org.apache.oodt.opendapps.config.OpendapConfig;
+import org.apache.oodt.profile.EnumeratedProfileElement;
+import org.apache.oodt.profile.Profile;
+import org.apache.oodt.profile.ProfileElement;
+import org.apache.oodt.profile.RangedProfileElement;
+
+import static org.apache.oodt.opendapps.DapNames.*;
+
+/**
+ *
+ *
+ * This class is used to set custom functionality for scraping data into
+ * different types of objects. The class looks at the {@link OpendapConfig} and
+ * then tries to stuff what's in each <var> into
+ * {@link RangedProfileElement} or {@link EnumeratedProfileElement}. The class
+ * is designed with extensibility in mind in case new {@link ProfileElement}
+ * types are created in the future.
+ *
+ */
+public class OpendapProfileElementExtractor {
+
+ private static final Logger LOG = Logger
+ .getLogger(OpendapProfileElementExtractor.class.getName());
+
+ private OpendapConfig conf;
+
+ public OpendapProfileElementExtractor(OpendapConfig conf) {
+ this.conf = conf;
+ }
+
+ public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
+ Profile profile, DAS das) throws NoSuchAttributeException {
+ RangedProfileElement elem = new RangedProfileElement(profile);
+ elem.setName(elemName);
+ AttributeTable attTable = null;
+ try {
+ attTable = das.getAttributeTable(varname);
+ if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
+ } catch (NoSuchAttributeException e) {
+ e.printStackTrace();
+ LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
+ + elemName + "]: Message: " + e.getMessage());
+ throw e;
+
+ }
+
+ Enumeration attributeNames = attTable.getNames();
+
+ while (attributeNames.hasMoreElements()) {
+ String attrName = (String) attributeNames.nextElement();
+ Attribute attr = attTable.getAttribute(attrName);
+ Enumeration attrValues = null;
+ try {
+ attrValues = attr.getValues();
+ } catch (NoSuchAttributeException e) {
+ e.printStackTrace();
+ LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
+ + "] failed: Message: " + e.getMessage());
+ continue;
+ }
+
+ while (attrValues.hasMoreElements()) {
+ String attrValue = (String) attrValues.nextElement();
+ if (attrName.equals(ACTUAL_RANGE)) {
+ elem.setMinValue(attrValue);
+ if (attrValues.hasMoreElements()) {
+ elem.setMaxValue((String) attrValues.nextElement());
+ }
+ } else if (attrName.equals(UNITS)) {
+ elem.setUnit(attrValue);
+ } else if (attrName.equals(START)) {
+ elem.setMinValue(attrValue);
+ } else if (attrName.equals(END)) {
+ elem.setMaxValue(attrValue);
+ }
+ }
+ }
+ return elem;
+ }
+
+ public EnumeratedProfileElement extractEnumeratedProfileElement(String elemName, String varname,
+ Profile profile, DAS das)
+ throws NoSuchAttributeException {
+ EnumeratedProfileElement elem = new EnumeratedProfileElement(profile);
+ elem.setName(elemName);
+
+ AttributeTable attTable = null;
+ try {
+ attTable = das.getAttributeTable(elemName);
+ } catch (NoSuchAttributeException e) {
+ LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
+ + elemName + "]: Message: " + e.getMessage());
+ throw e;
+
+ }
+
+ Enumeration attributeNames = attTable.getNames();
+ while (attributeNames.hasMoreElements()) {
+ String attrName = (String) attributeNames.nextElement();
+ Attribute attr = attTable.getAttribute(attrName);
+ Enumeration attrValues = null;
+ try {
+ attrValues = attr.getValues();
+ } catch (NoSuchAttributeException e) {
+ LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
+ + "] failed: Message: " + e.getMessage());
+ continue;
+ }
+
+ while (attrValues.hasMoreElements()) {
+ String attrValue = (String) attrValues.nextElement();
+ if (attrName.equals(ACTUAL_RANGE)) {
+ String[] vals = attrValue.split(" ");
+ elem.getValues().addAll(Arrays.asList(vals));
+ } else if (attrName.equals(UNITS)) {
+ elem.setUnit(attrValue);
+ } else {
+ elem.getValues().add(attrValue);
+ }
+ }
+
+ }
+
+ return elem;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps;
+
+//JDK imports
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OPeNDAP/THREDDS imports
+import opendap.dap.DConnect;
+
+//APACHE imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.opendapps.config.DapRoot;
+import org.apache.oodt.opendapps.config.OpendapConfig;
+import org.apache.oodt.opendapps.config.OpendapConfigReader;
+import org.apache.oodt.opendapps.util.ProfileUtils;
+import org.apache.oodt.profile.Profile;
+import org.apache.oodt.profile.ProfileException;
+import org.apache.oodt.profile.handlers.ProfileHandler;
+import org.apache.oodt.xmlquery.XMLQuery;
+
+/**
+ *
+ *
+ * A generic reusable OODT {@link ProfileHandler} for use in extracting metadata
+ * from OPeNDAP and THREDDS-accessible datasets.
+ *
+ */
+public class OpendapProfileHandler implements ProfileHandler {
+
+ private static final String PROFILE_HANDLER_ID = "OODT OPeNDAP Profile Handler";
+
+ private static Logger LOG = Logger.getLogger(OpendapProfileHandler.class
+ .getName());
+
+ private OpendapConfig conf;
+
+ public OpendapProfileHandler() throws InstantiationException,
+ FileNotFoundException, MalformedURLException {
+ String configFileLoc = System
+ .getProperty("org.apache.oodt.opendap.config.filePath");
+ if (configFileLoc == null)
+ throw new InstantiationException(
+ "Must specify System property opendap.config.filePath!");
+ this.conf = OpendapConfigReader.read(configFileLoc);
+ }
+
+ public List<Profile> findProfiles(XMLQuery xmlQuery) throws ProfileException {
+ List<Profile> profiles = new Vector<Profile>();
+ List<DapRoot> roots = this.conf.getRoots();
+
+ for (DapRoot root : roots) {
+ DatasetExtractor d = new DatasetExtractor(xmlQuery, root.getCatalogUrl()
+ .toExternalForm(), root.getDatasetUrl().toExternalForm());
+ if (d.getDapUrls() != null) {
+ for (String opendapUrl : d.getDapUrls()) {
+ Profile profile = new Profile();
+ DConnect dConn = null;
+ try {
+ dConn = new DConnect(opendapUrl, true);
+ } catch (FileNotFoundException e) {
+ LOG.log(Level.WARNING, "Opendap URL not found: [" + opendapUrl
+ + "]: Message: " + e.getMessage());
+ throw new ProfileException("Opendap URL not found: [" + opendapUrl
+ + "]: Message: " + e.getMessage());
+ }
+
+ Metadata datasetMet = d.getDatasetMet(opendapUrl);
+ profile.setResourceAttributes(ProfileUtils.getResourceAttributes(
+ this.conf, opendapUrl, dConn, datasetMet));
+ profile.setProfileAttributes(ProfileUtils
+ .getProfileAttributes(this.conf, datasetMet));
+ profile.getProfileElements().putAll(
+ ProfileUtils.getProfileElements(this.conf, dConn, datasetMet, profile));
+ profiles.add(profile);
+ }
+ }
+ }
+ return profiles;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.oodt.profile.handlers.ProfileHandler#get(java.lang.String)
+ */
+ public Profile get(String id) throws ProfileException {
+ throw new ProfileException("method not implemented yet!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.oodt.profile.handlers.ProfileHandler#getID()
+ */
+ public String getID() {
+ return PROFILE_HANDLER_ID;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+//APACHE imports
+import org.apache.oodt.profile.Profile;
+import org.apache.oodt.profile.ProfileAttributes;
+import org.apache.oodt.profile.ResourceAttributes;
+
+/**
+ *
+ * A specification of a constant field to flow through into either the generated
+ * {@link Profile}s {@link ProfileAttributes} section or its
+ * {@link ResourceAttributes} section. Part of the {@link OpendapConfig}.
+ *
+ */
+public class ConstantSpec {
+
+ private String type;
+
+ private String name;
+
+ private String value;
+
+ public ConstantSpec() {
+ this.type = null;
+ this.name = null;
+ this.value = null;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+//JDK imports
+import java.net.URL;
+
+/**
+ *
+ * A set of root {@link URL} information for OPeNDAP/THREDDS catalogs to crawl
+ * and obtain dataset metadata from.
+ *
+ */
+public class DapRoot {
+
+ private URL datasetUrl;
+
+ private URL catalogUrl;
+
+ private String filter;
+
+ public DapRoot() {
+ this.datasetUrl = null;
+ this.catalogUrl = null;
+ this.filter = null;
+ }
+
+ /**
+ * @return the datasetUrl
+ */
+ public URL getDatasetUrl() {
+ return datasetUrl;
+ }
+
+ /**
+ * @param datasetUrl
+ * the datasetUrl to set
+ */
+ public void setDatasetUrl(URL datasetUrl) {
+ this.datasetUrl = datasetUrl;
+ }
+
+ /**
+ * @return the catalogUrl
+ */
+ public URL getCatalogUrl() {
+ return catalogUrl;
+ }
+
+ /**
+ * @param catalogUrl
+ * the catalogUrl to set
+ */
+ public void setCatalogUrl(URL catalogUrl) {
+ this.catalogUrl = catalogUrl;
+ }
+
+ /**
+ * @return the filter
+ */
+ public String getFilter() {
+ return filter;
+ }
+
+ /**
+ * @param filter
+ * the filter to set
+ */
+ public void setFilter(String filter) {
+ this.filter = filter;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+//APACHE imports
+import org.apache.oodt.profile.EnumeratedProfileElement;
+
+/**
+ *
+ * Specification for the {@link OpendapConfig} that specifies what THREDDS
+ * dataset met to use to create {@link EnumeratedProfileElement}s from.
+ *
+ */
+public class DatasetMetElem {
+
+ private String profileElementName;
+
+ private String value;
+
+ public DatasetMetElem() {
+ this.profileElementName = null;
+ this.value = null;
+ }
+
+ /**
+ * @return the profileElementName
+ */
+ public String getProfileElementName() {
+ return profileElementName;
+ }
+
+ /**
+ * @param profileElementName
+ * the profileElementName to set
+ */
+ public void setProfileElementName(String profileElementName) {
+ this.profileElementName = profileElementName;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+
+/**
+ *
+ * The configuration object for the {@link OpendapProfileHandler}.
+ *
+ */
+public class OpendapConfig {
+
+ private List<DapRoot> roots;
+
+ private List<RewriteSpec> rewriteSpecs;
+
+ private List<ConstantSpec> constSpecs;
+
+ private List<DatasetMetElem> datasetMetSpecs;
+
+ public OpendapConfig() {
+ this.roots = new Vector<DapRoot>();
+ this.rewriteSpecs = new Vector<RewriteSpec>();
+ this.constSpecs = new Vector<ConstantSpec>();
+ this.datasetMetSpecs = new Vector<DatasetMetElem>();
+ }
+
+ /**
+ * @return the roots
+ */
+ public List<DapRoot> getRoots() {
+ return roots;
+ }
+
+ /**
+ * @param roots
+ * the roots to set
+ */
+ public void setRoots(List<DapRoot> roots) {
+ this.roots = roots;
+ }
+
+ /**
+ * @return the rewriteSpecs
+ */
+ public List<RewriteSpec> getRewriteSpecs() {
+ return rewriteSpecs;
+ }
+
+ /**
+ * @param rewriteSpecs
+ * the rewriteSpecs to set
+ */
+ public void setRewriteSpecs(List<RewriteSpec> rewriteSpecs) {
+ this.rewriteSpecs = rewriteSpecs;
+ }
+
+ /**
+ * @return the constSpecs
+ */
+ public List<ConstantSpec> getConstSpecs() {
+ return constSpecs;
+ }
+
+ /**
+ * @param constSpecs
+ * the constSpecs to set
+ */
+ public void setConstSpecs(List<ConstantSpec> constSpecs) {
+ this.constSpecs = constSpecs;
+ }
+
+ /**
+ * @return the datasetMetSpecs
+ */
+ public List<DatasetMetElem> getDatasetMetSpecs() {
+ return datasetMetSpecs;
+ }
+
+ /**
+ * @param datasetMetSpecs
+ * the datasetMetSpecs to set
+ */
+ public void setDatasetMetSpecs(List<DatasetMetElem> datasetMetSpecs) {
+ this.datasetMetSpecs = datasetMetSpecs;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+/**
+ *
+ * A set of metadata keys for reading the {@link OpendapConfig}.
+ *
+ */
+public interface OpendapConfigMetKeys {
+
+ public static final String RES_ATTR_SPEC_TYPE = "resAttr";
+
+ public static final String PROF_ATTR_SPEC_TYPE = "profAttr";
+
+ public static final String ENUM_ELEMENT_TYPE = "EnumeratedProfileElement";
+
+ public static final String RANGED_ELEMENT_TYPE = "RangedProfileElement";
+
+ public static final String DAP_ROOT_TAG = "root";
+
+ public static final String DATASET_URL_ATTR = "datasetURL";
+
+ public static final String CATALOG_URL_ATTR = "catalogURL";
+
+ public static final String FILTER_ATTR = "filter";
+
+ public static final String REWRITE_ROOT_TAG = "rewrite";
+
+ public static final String REWRITE_VAR_TAG = "var";
+
+ public static final String REWRITE_VAR_NAME_ATTR = "name";
+
+ public static final String REWRITE_VAR_RENAME_ATTR = "rename";
+
+ public static final String REWRITE_VAR_TYPE_ATTR = "type";
+
+ public static final String CONSTANT_ROOT_TAG = "constants";
+
+ public static final String CONSTANT_TAG = "const";
+
+ public static final String CONSTANT_NAME_ATTR = "name";
+
+ public static final String CONSTANT_TYPE_ATTR = "type";
+
+ public static final String CONSTANT_VALUE_ATTR = "value";
+
+ public static final String DATASET_MET_ROOT_TAG = "datasetMetadata";
+
+ public static final String DATASET_MET_ELEM_TAG = "elem";
+
+ public static final String DATASET_MET_NAME_ATTR = "name";
+
+ public static final String DATASET_MET_VALUE_ATTR = "value";
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+//JDK imports
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+//APACHE imports
+import org.apache.oodt.commons.xml.XMLUtils;
+import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.*;
+
+/**
+ *
+ * Reads the {@link OpendapConfig} from a provided file and returns it.
+ *
+ */
+public class OpendapConfigReader {
+
+ public static OpendapConfig read(String confFilePath)
+ throws FileNotFoundException, MalformedURLException {
+ OpendapConfig conf = new OpendapConfig();
+ Document doc = XMLUtils.getDocumentRoot(new FileInputStream(new File(
+ confFilePath)));
+ Element rootElem = doc.getDocumentElement();
+
+ NodeList dapRootNodeList = rootElem.getElementsByTagName(DAP_ROOT_TAG);
+ for (int i = 0; i < dapRootNodeList.getLength(); i++) {
+ Element dapRootElem = (Element) dapRootNodeList.item(i);
+ DapRoot root = new DapRoot();
+ root.setCatalogUrl(new URL(dapRootElem.getAttribute(CATALOG_URL_ATTR)));
+ root.setDatasetUrl(new URL(dapRootElem.getAttribute(DATASET_URL_ATTR)));
+ root.setFilter(dapRootElem.getAttribute(FILTER_ATTR));
+ conf.getRoots().add(root);
+ }
+
+ Element rewriteRootElem = XMLUtils.getFirstElement(REWRITE_ROOT_TAG,
+ rootElem);
+ NodeList rewriteNodeList = rewriteRootElem
+ .getElementsByTagName(REWRITE_VAR_TAG);
+ for (int i = 0; i < rewriteNodeList.getLength(); i++) {
+ Element rewriteElem = (Element) rewriteNodeList.item(i);
+ RewriteSpec spec = new RewriteSpec();
+ spec.setOrigName(rewriteElem.getAttribute(REWRITE_VAR_NAME_ATTR));
+ spec.setRename(rewriteElem.getAttribute(REWRITE_VAR_RENAME_ATTR));
+ spec.setElementType(rewriteElem.getAttribute(REWRITE_VAR_TYPE_ATTR));
+ conf.getRewriteSpecs().add(spec);
+ }
+
+ Element datasetMetRootElem = XMLUtils.getFirstElement(DATASET_MET_ROOT_TAG,
+ rootElem);
+ NodeList datasetMetElemNodeList = datasetMetRootElem
+ .getElementsByTagName(DATASET_MET_ELEM_TAG);
+ for (int i = 0; i < datasetMetElemNodeList.getLength(); i++) {
+ Element datasetMetElem = (Element) datasetMetElemNodeList.item(i);
+ DatasetMetElem datasetMetSpec = new DatasetMetElem();
+ datasetMetSpec.setProfileElementName(datasetMetElem
+ .getAttribute(DATASET_MET_NAME_ATTR));
+ datasetMetSpec.setValue(datasetMetElem
+ .getAttribute(DATASET_MET_VALUE_ATTR));
+ conf.getDatasetMetSpecs().add(datasetMetSpec);
+ }
+
+ Element constRootElem = XMLUtils.getFirstElement(CONSTANT_ROOT_TAG,
+ rootElem);
+ NodeList constNodeList = constRootElem.getElementsByTagName(CONSTANT_TAG);
+ for (int i = 0; i < constNodeList.getLength(); i++) {
+ Element constElem = (Element) constNodeList.item(i);
+ ConstantSpec constSpec = new ConstantSpec();
+ constSpec.setName(constElem.getAttribute(CONSTANT_NAME_ATTR));
+ constSpec.setType(constElem.getAttribute(CONSTANT_TYPE_ATTR));
+ constSpec.setValue(constElem
+ .getAttribute(CONSTANT_VALUE_ATTR));
+ conf.getConstSpecs().add(constSpec);
+ }
+
+ return conf;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.config;
+
+/**
+ *
+ * A specification for rewriting OPeNDAP element names and tags from their
+ * original OPeNDAP/THREDDS names into OODT profile elements, and their names
+ * and types. Part of the {@link OpendapConfig}.
+ *
+ */
+public class RewriteSpec {
+
+ private String origName;
+
+ private String rename;
+
+ private String elementType;
+
+ public RewriteSpec() {
+ this.origName = null;
+ this.rename = null;
+ this.elementType = null;
+ }
+
+ /**
+ * @return the origName
+ */
+ public String getOrigName() {
+ return origName;
+ }
+
+ /**
+ * @param origName
+ * the origName to set
+ */
+ public void setOrigName(String origName) {
+ this.origName = origName;
+ }
+
+ /**
+ * @return the rename
+ */
+ public String getRename() {
+ return rename;
+ }
+
+ /**
+ * @param rename
+ * the rename to set
+ */
+ public void setRename(String rename) {
+ this.rename = rename;
+ }
+
+ /**
+ * @return the elementType
+ */
+ public String getElementType() {
+ return elementType;
+ }
+
+ /**
+ * @param elementType
+ * the elementType to set
+ */
+ public void setElementType(String elementType) {
+ this.elementType = elementType;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.util;
+
+//JDK imports
+import java.io.IOException;
+
+//APACHE imports
+import org.apache.oodt.opendapps.DatasetExtractor;
+import org.apache.oodt.xmlquery.XMLQuery;
+
+/**
+ *
+ * Evaluates the resultant OPeNDAP URLs returned from a THREDDS catalog by the
+ * {@link DatasetExtractor}.
+ *
+ */
+public class OpendapURLEvaluator {
+
+ public static void main(String[] args) throws IOException {
+ String datasetUrl = args[0];
+ String catalogUrl = args[1];
+
+ DatasetExtractor gen = new DatasetExtractor(getQuery(), catalogUrl,
+ datasetUrl);
+ System.out.println(gen.getDapUrls());
+ }
+
+ private static XMLQuery getQuery() {
+ return new XMLQuery("PFunction=findall", "cmdline", "cmdline", null, null,
+ null, null, null, XMLQuery.DEFAULT_MAX_RESULTS, true);
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java (added)
+++ oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java Fri Dec 10 06:07:20 2010
@@ -0,0 +1,229 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.opendapps.util;
+
+//JDK imports
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OPeNDAP/THREDDS imports
+import opendap.dap.DConnect;
+
+//APACHE imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+import org.apache.oodt.opendapps.OpendapProfileElementExtractor;
+import org.apache.oodt.opendapps.config.ConstantSpec;
+import org.apache.oodt.opendapps.config.DatasetMetElem;
+import org.apache.oodt.opendapps.config.OpendapConfig;
+import org.apache.oodt.opendapps.config.RewriteSpec;
+import org.apache.oodt.profile.EnumeratedProfileElement;
+import org.apache.oodt.profile.Profile;
+import org.apache.oodt.profile.ProfileAttributes;
+import org.apache.oodt.profile.ProfileElement;
+import org.apache.oodt.profile.ResourceAttributes;
+
+import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.*;
+
+/**
+ *
+ * Static methods for unraveling and generating {@link ProfileElement}s,
+ * {@link ProfileAttributes} and {@link ResourceAttributes} for a
+ * {@link Profile}, derived from a set of OPeNDAP dataset information and an
+ * {@link OpendapConfig}.
+ *
+ *
+ */
+public class ProfileUtils {
+
+ private static final Logger LOG = Logger.getLogger(ProfileUtils.class
+ .getName());
+
+ public static ResourceAttributes getResourceAttributes(OpendapConfig conf,
+ String opendapUrl, DConnect dConn, Metadata datasetMet) {
+ ResourceAttributes resAttr = new ResourceAttributes();
+ for (ConstantSpec spec : conf.getConstSpecs()) {
+ if (spec.getType().equals(RES_ATTR_SPEC_TYPE)) {
+ try {
+ setResourceAttributes(resAttr, spec.getName(), PathUtils
+ .replaceEnvVariables(spec.getValue(), datasetMet, true));
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG.log(Level.WARNING, "Error setting field: [" + spec.getName()
+ + "] in resource attributes: Message: " + e.getMessage());
+ }
+ }
+ }
+
+ // set the identifier
+ if (resAttr.getIdentifier() == null
+ || (resAttr.getIdentifier() != null && (resAttr.getIdentifier().equals(
+ "") || resAttr.getIdentifier().equals("UNKNOWN")))) {
+ resAttr.setIdentifier(UUID.randomUUID().toString());
+ }
+
+ // set res location
+ if (resAttr.getResLocations() == null
+ || (resAttr.getResLocations() != null && resAttr.getResLocations()
+ .size() == 0)) {
+ resAttr.getResLocations().add(opendapUrl);
+ }
+
+ return resAttr;
+ }
+
+ public static ProfileAttributes getProfileAttributes(OpendapConfig conf, Metadata datasetMet) {
+ ProfileAttributes profAttr = new ProfileAttributes();
+ for (ConstantSpec spec : conf.getConstSpecs()) {
+ if (spec.getType().equals(PROF_ATTR_SPEC_TYPE)) {
+ setProfileAttributesProperty(profAttr, spec.getName(), PathUtils
+ .replaceEnvVariables(spec.getValue(), datasetMet, true));
+ }
+ }
+
+ return profAttr;
+
+ }
+
+ public static Map<String, ProfileElement> getProfileElements(
+ OpendapConfig conf, DConnect dConn, Metadata datasetMet, Profile profile) {
+ // TODO: later, we should just read all attributes instead of just those
+ // specified in the conf
+ OpendapProfileElementExtractor pe = new OpendapProfileElementExtractor(conf);
+ Map<String, ProfileElement> profElements = new HashMap<String, ProfileElement>();
+
+ for (RewriteSpec spec : conf.getRewriteSpecs()) {
+ String peName = spec.getRename() != null && !spec.getRename().equals("") ? spec
+ .getRename()
+ : spec.getOrigName();
+ try {
+ if (spec.getElementType().equals(RANGED_ELEMENT_TYPE)) {
+ profElements.put(peName, pe.extractRangedProfileElement(peName, spec
+ .getOrigName(), profile, dConn.getDAS()));
+ } else if (spec.getElementType().equals(ENUM_ELEMENT_TYPE)) {
+ profElements.put(peName, pe.extractEnumeratedProfileElement(peName,
+ spec.getOrigName(), profile, dConn.getDAS()));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG
+ .log(Level.WARNING, "Problem obtaining attribute: ["
+ + spec.getOrigName() + "] from OPeNDAP: Message: "
+ + e.getMessage());
+ continue;
+ }
+
+ }
+
+ if (datasetMet != null) {
+ for (DatasetMetElem datasetSpec : conf.getDatasetMetSpecs()) {
+ EnumeratedProfileElement epe = getEnumeratedProfileElement(datasetSpec
+ .getProfileElementName(), profile);
+ List<String> epeVals = datasetMet
+ .getAllMetadata(datasetSpec.getValue());
+ if (epeVals != null && epeVals.size() > 0)
+ epe.getValues().addAll(epeVals);
+ profElements.put(datasetSpec.getProfileElementName(), epe);
+ }
+ }
+
+ return profElements;
+
+ }
+
+ private static void setProfileAttributesProperty(ProfileAttributes attr,
+ String propName, String value) {
+ if (propName.equals("profId")) {
+ attr.setID(value);
+ } else if (propName.equals("profVersion")) {
+ attr.setVersion(value);
+ } else if (propName.equals("profType")) {
+ attr.setType(value);
+ } else if (propName.equals("profStatusId")) {
+ attr.setStatusID(value);
+ } else if (propName.equals("profSecurityType")) {
+ attr.setSecurityType(value);
+ } else if (propName.equals("profParentId")) {
+ attr.setParent(value);
+ } else if (propName.equals("profRegAuthority")) {
+ attr.setRegAuthority(value);
+ } else if (propName.equals("profChildId")) {
+ attr.getChildren().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("profRevisionNote")) {
+ attr.getRevisionNotes().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ }
+
+ }
+
+ private static void setResourceAttributes(ResourceAttributes resAttr,
+ String propName, String value) {
+
+ if (propName.equals("Identifier")) {
+ resAttr.setIdentifier(value);
+ } else if (propName.equals("Title")) {
+ resAttr.setTitle(value);
+ } else if (propName.equals("Format")) {
+ resAttr.getFormats().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Description")) {
+ resAttr.setDescription(value);
+ } else if (propName.equals("Creator")) {
+ resAttr.getCreators().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Subject")) {
+ resAttr.getSubjects().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Publisher")) {
+ resAttr.getPublishers().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Contributor")) {
+ resAttr.getContributors().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Date")) {
+ resAttr.getDates().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Type")) {
+ resAttr.getTypes().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Source")) {
+ resAttr.getSources().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Language")) {
+ resAttr.getLanguages().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Relation")) {
+ resAttr.getRelations().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Coverage")) {
+ resAttr.getCoverages().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("Rights")) {
+ resAttr.getRights().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("resContext")) {
+ resAttr.getResContexts().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ } else if (propName.equals("resAggregation")) {
+ resAttr.setResAggregation(value);
+ } else if (propName.equals("resClass")) {
+ resAttr.setResClass(value);
+ } else if (propName.equals("resLocation")) {
+ resAttr.getResLocations().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
+ }
+ }
+
+ private static EnumeratedProfileElement getEnumeratedProfileElement(
+ String name, Profile profile) {
+ EnumeratedProfileElement pe = new EnumeratedProfileElement(profile);
+ pe.setName(name);
+ return pe;
+ }
+
+}
Propchange: oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/opendapps/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/resources/logging.properties?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/resources/logging.properties (added)
+++ oodt/trunk/opendapps/src/main/resources/logging.properties Fri Dec 10 06:07:20 2010
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Specify the handlers to create in the root logger
+# (all loggers are children of the root logger)
+# The following creates two handlers
+handlers = java.util.logging.ConsoleHandler
+
+# Set the default logging level for the root logger
+.level = ALL
+
+# Set the default logging level for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.level = ALL
+
+# Set the default formatter for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+org.apache.oodt.opendapps = INFO
+org.apache.oodt.opendapps.util = INFO
+org.apache.oodt.opendapps.config = INFO
+
+# Tone down the Sun log messages
+sun.net.www.level=SEVERE
\ No newline at end of file
Added: oodt/trunk/opendapps/src/main/resources/opendap.config.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/opendapps/src/main/resources/opendap.config.xml?rev=1044213&view=auto
==============================================================================
--- oodt/trunk/opendapps/src/main/resources/opendap.config.xml (added)
+++ oodt/trunk/opendapps/src/main/resources/opendap.config.xml Fri Dec 10 06:07:20 2010
@@ -0,0 +1,152 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+Description: This file defines a set of information used by an OODT Profile Server
+to extract and deliver back OODT Profile metadata from an underlying OPeNDAP/THREDDS
+accessible data source. This configuration file builds on prior work that was only
+configurable in Java code, but is now configurable via this file.
+
+-->
+<oodt:opendap xmlns:oodt="http://oodt.apache.org/1.0" id="urn:oodt:opendap:psid" name="OPeNDAP Handler">
+
+ <!--
+ A set of THREDDS catalog roots to derive datasets from. Must specify at least one root.
+
+ datasetURL - the original URL to the THREDDS dataset.
+ catalogURL - the original URL to the THREDDS catalog.xml file used to obtain dataset metadata
+ and information from.
+ filter (optional) - defines an optional dataset filter for inclusion/exclusion.
+
+ -->
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMW/chla/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMH/chla/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatSW/chla/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatSA/chla/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatAG/tanm/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatAA/ssta/catalog.xml" filter=".*" />
+ <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMH/sstd/catalog.xml" filter=".*" />
+
+
+
+ <!--
+ A set of specifications for how to rewrite the names of underlying OPeNDAP/THREDDS dataset variables
+ into profile elements within the generated OODT profile. These information are used only to transform
+ OPeNDAP variables into OODT profile elements. If an OPeNDAP element part of a dataset is not specified
+ in this rewrite block, the variable not be extracted.
+
+ name: The original name of the OPeNDAP variable.
+ rename (optional): What to rename the variable to in the OODT Profile Elements section.
+ type: Either EnumeratedProfileElement or RangedProfileElement. EnumeratedProfileElement indicates this is
+ a variable with a select vocabulary of choices, with multiple values to specify those choices. RangedProfileElement
+ indicates this is an OPeNDAP variable with a specified min/max value.
+
+ -->
+ <rewrite>
+ <var name="altitude" type="RangedProfileElement"/>
+ <var name="lat" rename="latitude" type="RangedProfileElement"/>
+ <var name="lon" rename="longitude" type="RangedProfileElement"/>
+ <var name="time" type="RangedProfileElement"/>
+ </rewrite>
+
+
+ <!--
+ THREDDS Dataset metadata that you want to flow into the Profile
+ Elements portion of the profile. Each specified dataset metadata
+ will be turned into an EnumeratedProfileElement with 1 or more values.
+
+ name: The name of the profile element.
+ value: The dataset metadata element to extract the metadata from. The
+ extracted metadata is shoved into the generated EnumeratedProfileElement's
+ value set.
+ -->
+ <datasetMetadata>
+ <elem name="short_name" value="Name"/>
+ <elem name="long_name" value="FullName"/>
+ <elem name="mission_name" value="Projects"/>
+ <elem name="mission_description" value="Documentation"/>
+ <elem name="parameter" value="Variables"/>
+ <elem name="startdate" value="StartDateTime"/>
+ <elem name="enddate" value="EndDateTime"/>
+ <elem name="spatial_resolution" value="GeospatialCoverage"/>
+ <elem name="description" value="Documentation"/>
+ <elem name="spatial_coverage" value="GeospatialCoverage"/>
+ <elem name="processing_level" value="Processing"/>
+ <elem name="temporal_resolution" value="TimeCoverageResolution"/>
+ <elem name="latitude_resolution" value="GeospatialCoverageLatitudeResolution"/>
+ <elem name="longitude_resolution" value="GeospatialCoverageLongitudeResolution"/>
+ <elem name="creator" value="Creator"/>
+ <elem name="project" value="Project"/>
+ <elem name="access_type" value="Authority"/>
+ </datasetMetadata>
+
+ <!--
+ A set of constant metadata to plumb through into the profile, either in the
+ profileAttributes section or the resourceAttributes section. The type parameter
+ indicates the section name, and the rest of the attributes are fairly evident from there.
+ Note: the value tag can use CAS/OODT based environment variable replacement, by specifying
+ values within the '[' and ']' delimiters, e.g., [PROFILE_REG_AUTHORITY].
+
+ type: either profAttr or resAttr to indicate what section in the profile the information
+ should be part of.
+ name: the name of the profileAttribute or resourceAttribute field.
+ value: the value to be set.
+
+
+ profAttr can be any of:
+ profId
+ profVersion
+ profType
+ profStatusId
+ profSecurityType
+ profParentId
+ profRegAuthority
+ profChildId
+ profRevisionNote
+
+ resAttr can be any of:
+ Identifier
+ Title
+ Description
+ Creator
+ Subject
+ Publisher
+ Contributor
+ Date
+ Type
+ Source
+ Language
+ Relation
+ Coverage
+ Rights
+ resContext
+ resAggregation
+ resClass
+ resLocation
+ -->
+ <constants>
+ <const type="profAttr" name="profType" value="CMDS Ocean Dataset"/>
+ <const type="profAttr" name="profStatusId" value="active"/>
+ <const type="profAttr" name="profRegAuthority" value="NASA Coastal Marine Data Discovery Service" />
+ <const type="profAttr" name="profId" value="[UniqueID]"/>
+ <const type="resAttr" name="Publisher" value="CMDS CoastWatch Product Server" />
+ <const type="resAttr" name="resClass" value="system.dataset" />
+ <const type="resAttr" name="resContext" value="[Authority]"/>
+ <const type="resAttr" name="Type" value="[DataFormatType]"/>
+ <const type="resAttr" name="Date" value="[StartDateTime],[EndDateTime]"/>
+ <const type="resAttr" name="resLocation" value="http://thredds1.pfeg.noaa.gov/thredds/dodsC/[ID].dods,http://thredds1.pfeg.noaa.gov/thredds/dodsC/[ID].html"/>
+ </constants>
+
+</oodt:opendap>
Modified: oodt/trunk/pom.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/pom.xml?rev=1044213&r1=1044212&r2=1044213&view=diff
==============================================================================
--- oodt/trunk/pom.xml (original)
+++ oodt/trunk/pom.xml Fri Dec 10 06:07:20 2010
@@ -55,6 +55,7 @@ the License.
<module>profile</module>
<module>grid</module>
<module>xmlps</module>
+ <module>opendapps</module>
<module>webapp/filemgr</module>
<module>webapp/fmprod</module>
<module>webapp/workflow</module>