Author: mattmann
Date: Fri Dec 24 06:31:29 2010
New Revision: 1052452

URL: http://svn.apache.org/viewvc?rev=1052452&view=rev
Log:
- fix for OODT-104 Allow const section to plumb information into profile 
elements

Modified:
    oodt/trunk/CHANGES.txt
    
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
    
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
    oodt/trunk/opendapps/src/main/resources/opendap.config.xml

Modified: oodt/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1052452&r1=1052451&r2=1052452&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Fri Dec 24 06:31:29 2010
@@ -3,6 +3,7 @@ Apache OODT Change Log
 
 Release 0.2 (Current Development)
 --------------------------------------------
+* OODT-104 Allow const section to plumb information into profile elements 
(mattmann)
 
 * OODT-90 (cas-crawler patch) CAS-PGE returns success even if product file(s) 
failed to ingest (bfoster)
 

Modified: 
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=1052452&r1=1052451&r2=1052452&view=diff
==============================================================================
--- 
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
 (original)
+++ 
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
 Fri Dec 24 06:31:29 2010
@@ -28,6 +28,8 @@ public interface OpendapConfigMetKeys {
 
   public static final String PROF_ATTR_SPEC_TYPE = "profAttr";
 
+  public static final String PROF_ELEM_SPEC_TYPE = "profElem";
+
   public static final String ENUM_ELEMENT_TYPE = "EnumeratedProfileElement";
 
   public static final String RANGED_ELEMENT_TYPE = "RangedProfileElement";

Modified: 
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=1052452&r1=1052451&r2=1052452&view=diff
==============================================================================
--- 
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
 (original)
+++ 
oodt/trunk/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
 Fri Dec 24 06:31:29 2010
@@ -146,6 +146,24 @@ public class ProfileUtils {
         profElements.put(datasetSpec.getProfileElementName(), epe);
       }
     }
+    
+    // now add const prof elems
+    for (ConstantSpec spec : conf.getConstSpecs()) {
+      if (spec.getType().equals(PROF_ELEM_SPEC_TYPE)) {
+        try {
+          EnumeratedProfileElement epe = 
getEnumeratedProfileElement(spec.getName(), profile);  
+          String replaceVal = PathUtils.replaceEnvVariables(spec.getValue(), 
datasetMet);
+          List<String> epeVals = 
Arrays.asList(replaceVal.split(PathUtils.DELIMITER));
+          if (epeVals != null && epeVals.size() > 0)
+            epe.getValues().addAll(epeVals);
+          profElements.put(spec.getName(), epe);
+        } catch (Exception e) {
+          e.printStackTrace();
+          LOG.log(Level.WARNING, "Error setting field: [" + spec.getName()
+              + "] in resource attributes: Message: " + e.getMessage());
+        }
+      }
+    }
 
     return profElements;
 

Modified: 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=1052452&r1=1052451&r2=1052452&view=diff
==============================================================================
--- oodt/trunk/opendapps/src/main/resources/opendap.config.xml (original)
+++ oodt/trunk/opendapps/src/main/resources/opendap.config.xml Fri Dec 24 
06:31:29 2010
@@ -75,12 +75,12 @@ configurable in Java code, but is now co
        <datasetMetadata>
           <elem name="short_name" value="Name"/>
           <elem name="long_name" value="FullName"/>
-          <elem name="mission_name" value="Projects"/>
+          <!-- <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="spatial_resolution" value="GeospatialCoverage"/>-->
           <elem name="description" value="Documentation"/>
           <elem name="spatial_coverage" value="GeospatialCoverage"/>
           <elem name="processing_level" value="Processing"/>
@@ -99,8 +99,9 @@ configurable in Java code, but is now co
            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.
+           type: either profAttr, resAttr, or profElem to indicate what 
section in the profile the information 
+           should be part of. If profElem is selected, then an 
EnumeratedProfileElement with the provided 
+           values will be created and added to the profile.
            name: the name of the profileAttribute or resourceAttribute field.
            value: the value to be set.
            
@@ -146,7 +147,9 @@ configurable in Java code, but is now co
                <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"/>
+               <const type="resAttr" name="resLocation" 
value="http://thredds1.pfeg.noaa.gov/thredds/dodsC/[ID].html,http://thredds1.pfeg.noaa.gov/thredds/dodsC/[ID].dods"/>
+               <const type="profElem" name="spatial_coverage" value="Global"/>
+               <const type="profElem" name="mission_name" value="Coastwatch"/>
        </constants>
 
 </oodt:opendap>


Reply via email to