incubator-oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r964663 [4/5] - in /incubator/oodt/trunk: ./ commons/ commons/src/main/java/org/apache/oodt/commons/date/ core/ crawler/src/main/java/org/apache/oodt/cas/crawl/ crawler/src/main/java/org/apache/oodt/cas/crawl/action/ crawler/src/main/java/o...
Date Fri, 16 Jul 2010 03:00:31 GMT
Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileReader.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileReader.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileReader.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileReader.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,318 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/**
+ * 
+ * <p>
+ * A Reader for reading the constructs defined in a {@link PGEConfigurationFile}.
+ * The constructs are read and a new {@link PGEConfigurationFile} object is
+ * constructed and returned.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEConfigFileReader {
+
+  /**
+   * <p>
+   * Default Constructor
+   * </p>
+   */
+  public PGEConfigFileReader() {
+  }
+
+  /**
+   * 
+   * <p>
+   * Reads the PGE Configuration file from the given <code>url</code>.
+   * </p>
+   * 
+   * @param url
+   *          The {@link URL} pointer to the pge configuration file.
+   * @return A new {@link PGEConfigurationFile} object, created from the
+   *         specified URL.
+   * @throws PGEConfigFileException
+   *           If there is an error reading the url.
+   */
+  public PGEConfigurationFile read(URL url) throws PGEConfigFileException {
+    PGEConfigurationFile configFile = null;
+
+    try {
+      configFile = read(url.openStream());
+    } catch (IOException e) {
+      throw new PGEConfigFileException("Unable to read PGE "
+          + "configuration file from url: " + url + ": Message: "
+          + e.getMessage());
+    }
+
+    return configFile;
+  }
+
+  /**
+   * 
+   * <p>
+   * Reads a PGEConfigurationFile from the specified <code>is</code>
+   * InputStream.
+   * </p>
+   * 
+   * @param is
+   *          The InputStream to read the PGEConfigurationFile from.
+   * @return A new {@link PGEConfigurationFile}, created from the specified
+   *         InputStream.
+   * @throws PGEConfigFileException
+   *           If any error occurs.
+   */
+  public PGEConfigurationFile read(InputStream is)
+      throws PGEConfigFileException {
+    PGEConfigurationFile configFile = null;
+
+    DocumentBuilderFactory factory = null;
+    DocumentBuilder parser = null;
+    Document document = null;
+
+    if (is == null) {
+      return null;
+    }
+
+    InputSource inputSource = new InputSource(is);
+
+    try {
+      factory = DocumentBuilderFactory.newInstance();
+      parser = factory.newDocumentBuilder();
+      document = parser.parse(inputSource);
+    } catch (Exception parseException) {
+      parseException.printStackTrace();
+      return null;
+    }
+
+    // okay, construct the PGEConfigurationFile now
+    configFile = new PGEConfigurationFile();
+
+    Element pgeConf = document.getDocumentElement();
+
+    NodeList pgeGroups = pgeConf.getElementsByTagName("group");
+
+    for (int i = 0; i < pgeGroups.getLength(); i++) {
+      // get the name of the group
+      Element group = (Element) pgeGroups.item(i);
+      String groupName = group.getAttribute("name");
+
+      if (groupName.equals("PGENameGroup")) {
+        addPGEName(configFile, group);
+      } else if (groupName.equals("InputProductFiles")) {
+        addInputProductFiles(configFile, group);
+      } else if (groupName.equals("StaticFileIdentificationFiles")) {
+        addSFIFFiles(configFile, group);
+      } else if (groupName.equals("DynamicAuxiliaryInputFiles")) {
+        addDynamicAuxInputFiles(configFile, group);
+      } else if (groupName.equals("RecordedAuxiliaryInputFiles")) {
+        addRecAuxInputFiles(configFile, group);
+      } else if (groupName.equals("ProductPathGroup")) {
+        addProductPath(configFile, group);
+      } else if (groupName.equals("MonitorGroup")) {
+        addMonitorGroup(configFile, group);
+      } else if (groupName.equals("MonitorLevel")) {
+        addMonitorLevels(configFile, group);
+      } else {
+        // pge specific groups, just add generic groups
+        addPGESpecificGroup(configFile, group);
+      }
+    }
+
+    return configFile;
+  }
+
+  private void addPGESpecificGroup(PGEConfigurationFile configFile,
+      Element group) throws PGEConfigFileException {
+
+    List scalars = PGEXMLFileUtils.getScalars(group);
+    List vectors = PGEXMLFileUtils.getVectors(group);
+    List matrixs = PGEXMLFileUtils.getMatrixs(group);
+
+    PGEGroup pgeGroup = new PGEGroup(group.getAttribute("name"));
+
+    for (Iterator i = scalars.iterator(); i.hasNext();) {
+      PGEScalar s = (PGEScalar) i.next();
+      pgeGroup.addScalar(s);
+    }
+
+    for (Iterator i = vectors.iterator(); i.hasNext();) {
+      PGEVector v = (PGEVector) i.next();
+      pgeGroup.addVector(v);
+    }
+
+    for (Iterator i = matrixs.iterator(); i.hasNext();) {
+      PGEMatrix m = (PGEMatrix) i.next();
+      pgeGroup.addMatrix(m);
+    }
+
+    configFile.getPgeSpecificGroups().put(pgeGroup.getName(), pgeGroup);
+
+  }
+
+  private void addMonitorLevels(PGEConfigurationFile configFile, Element group)
+      throws PGEConfigFileException {
+
+    List scalars = PGEXMLFileUtils.getScalars(group);
+
+    if (scalars != null && scalars.size() > 0) {
+      for (Iterator i = scalars.iterator(); i.hasNext();) {
+        PGEScalar scalar = (PGEScalar) i.next();
+        configFile.getMonitorLevelGroup().addScalar(scalar);
+      }
+    }
+
+  }
+
+  private void addMonitorGroup(PGEConfigurationFile configFile, Element group)
+      throws PGEConfigFileException {
+
+    List scalars = PGEXMLFileUtils.getScalars(group);
+
+    // the list should be not be null
+    if (scalars == null) {
+      throw new PGEConfigFileException(
+          "There is no monitor path or monitor filename format defined in the MonitorGroup!");
+    }
+
+    PGEScalar monPath = null, monFilenameFormat = null;
+
+    for (Iterator i = scalars.iterator(); i.hasNext();) {
+      PGEScalar scalar = (PGEScalar) i.next();
+
+      if (scalar.getName().equals("MonitorPath")) {
+        monPath = scalar;
+      } else if (scalar.getName().equals("MonitorFilenameFormat")) {
+        monFilenameFormat = scalar;
+      }
+    }
+
+    configFile.setMonitorPath(monPath);
+    configFile.setMonitorFilenameFormat(monFilenameFormat);
+
+  }
+
+  private void addProductPath(PGEConfigurationFile configFile, Element group)
+      throws PGEConfigFileException {
+    List scalars = PGEXMLFileUtils.getScalars(group);
+
+    // the list should be size 1
+    if (scalars == null || (scalars != null && scalars.size() != 1)) {
+      throw new PGEConfigFileException(
+          "There is no product path defined in the configuration file, or there is more than one scalar listed in the ProductPathGroup!");
+    }
+
+    PGEScalar scalar = (PGEScalar) scalars.get(0);
+
+    // the name of the product path should be ProductPath
+
+    if (!scalar.getName().equals("ProductPath")) {
+      throw new PGEConfigFileException(
+          "The product path should be defined as a scalar with the name \"ProductPath\"!");
+    }
+
+    configFile.setProductPath(scalar);
+  }
+
+  private void addPGEName(PGEConfigurationFile configFile, Element group)
+      throws PGEConfigFileException {
+
+    // get the scalars, there should be only one
+    List scalars = PGEXMLFileUtils.getScalars(group);
+
+    // the list should be size 1
+    if (scalars == null || (scalars != null && scalars.size() != 1)) {
+      throw new PGEConfigFileException(
+          "There is no PGEName defined in the configuration file, or there is more than one scalar listed in the PGENameGroup");
+    }
+
+    // the name of the scalar should be PGEName
+    PGEScalar scalar = (PGEScalar) scalars.get(0);
+
+    if (!scalar.getName().equals("PGEName")) {
+      throw new PGEConfigFileException(
+          "The name of the PGE should be defined as a scalar with the name \"PGEName\"!");
+    }
+
+    // okay, we're set, set the PGE Name
+    configFile.setPgeName(scalar);
+
+  }
+
+  private void addInputProductFiles(PGEConfigurationFile configFile,
+      Element group) throws PGEConfigFileException {
+    addScalarFilesToGroup(group, configFile.getInputProductFiles());
+    addVectorFilesToGroup(group, configFile.getInputProductFiles());
+  }
+
+  private void addSFIFFiles(PGEConfigurationFile configFile, Element group)
+      throws PGEConfigFileException {
+    addScalarFilesToGroup(group, configFile.getStaticFileIdentificationFiles());
+  }
+
+  private void addDynamicAuxInputFiles(PGEConfigurationFile configFile,
+      Element group) throws PGEConfigFileException {
+    addScalarFilesToGroup(group, configFile.getDynamicAuxiliaryInputFiles());
+  }
+
+  private void addRecAuxInputFiles(PGEConfigurationFile configFile,
+      Element group) throws PGEConfigFileException {
+    addScalarFilesToGroup(group, configFile.getRecordedAuxiliaryInputFiles());
+  }
+
+  private void addScalarFilesToGroup(Element group, PGEGroup pgeGroup)
+      throws PGEConfigFileException {
+    // get the scalars, and add them to the group
+    List scalars = PGEXMLFileUtils.getScalars(group);
+
+    if (scalars != null && scalars.size() > 0) {
+      for (Iterator i = scalars.iterator(); i.hasNext();) {
+        PGEScalar scalar = (PGEScalar) i.next();
+        pgeGroup.addScalar(scalar);
+      }
+    }
+  }
+
+  private void addVectorFilesToGroup(Element group, PGEGroup pgeGroup)
+      throws PGEConfigFileException {
+    // get the vectors, and add them to the group
+    List vectors = PGEXMLFileUtils.getVectors(group);
+
+    if (vectors != null && vectors.size() > 0) {
+      for (Iterator i = vectors.iterator(); i.hasNext();) {
+        PGEVector vector = (PGEVector) i.next();
+        pgeGroup.addVector(vector);
+      }
+    }
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileWriter.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileWriter.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileWriter.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigFileWriter.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,357 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+import org.apache.oodt.commons.xml.XMLUtils;
+
+//JDK imports
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * <p>
+ * A Configuration File Writer for PGEs.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public final class PGEConfigFileWriter implements PGEConfigFileKeys,
+    PGEDataParseKeys {
+
+  /* the PGE configuration file that we're writing */
+  private PGEConfigurationFile configFile = null;
+
+  /* our log stream */
+  private static Logger LOG = Logger.getLogger(PGEConfigFileWriter.class
+      .getName());
+
+  /*
+   * whether or not the values in the XML file should be URLEncoded: if true,
+   * the values will be encoded using UTF-8.
+   */
+  private boolean urlEncoding = false;
+
+  /* schema location for the PGE input.xsd file */
+  private String schemaLocation = null;
+
+  /**
+   * <p>
+   * Default Constructor
+   * </p>
+   * .
+   * 
+   * @param config
+   *          The ConfigurationFile that this writer is responsible for writing.
+   * 
+   */
+  public PGEConfigFileWriter(PGEConfigurationFile config) {
+    this.configFile = config;
+  }
+
+  /**
+   * <p>
+   * Writes the ConfigurationFile to the specified filePath.
+   * </p>
+   * 
+   * @param filePath
+   *          The filePath of the XML config file to write.
+   * @throws Exception
+   *           If any error occurs.
+   */
+  public void writeToXmlFile(String filePath) throws Exception {
+    XMLUtils.writeXmlFile(getConfigFileXml(), filePath);
+  }
+
+  /**
+   * 
+   * @return An XML DOM {@link Document} representation of the internal
+   *         PGEConfigurationFile.
+   * @throws Exception
+   *           If any error occurs.
+   */
+  public Document getConfigFileXml() throws Exception {
+    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    factory.setNamespaceAware(true);
+    Document document = null;
+
+    try {
+      DocumentBuilder builder = factory.newDocumentBuilder();
+      document = builder.newDocument();
+
+      Element root = (Element) document.createElement(PGE_INPUT_TAG_NAME);
+      root.setAttribute("xmlns:xsi",
+          "http://www.w3.org/2001/XMLSchema-instance");
+      root
+          .setAttribute(
+              "xsi:noNamespaceSchemaLocation",
+              (schemaLocation == null
+                  || (schemaLocation != null && schemaLocation.equals("")) ? "input.xsd"
+                  : schemaLocation));
+      document.appendChild(root);
+
+      if (configFile != null) {
+        // write the PGE Name group
+        if (configFile.getPgeName() != null) {
+          PGEGroup pgeNameGroup = new PGEGroup(PGE_NAME_GROUP);
+          pgeNameGroup.addScalar(configFile.getPgeName());
+          root.appendChild(getGroupElement(pgeNameGroup, document));
+        }
+
+        // write the input product files
+        root.appendChild(getGroupElement(configFile.getInputProductFiles(),
+            document));
+
+        // write the static file identification files
+        root.appendChild(getGroupElement(configFile
+            .getStaticFileIdentificationFiles(), document));
+
+        // write the dynamic auxilliary files
+        root.appendChild(getGroupElement(configFile
+            .getDynamicAuxiliaryInputFiles(), document));
+
+        // write the recorded auxilliary files
+        root.appendChild(getGroupElement(configFile
+            .getRecordedAuxiliaryInputFiles(), document));
+
+        // write the product path group
+        if (configFile.getProductPath() != null) {
+          PGEGroup productPathGroup = new PGEGroup(PRODUCT_PATH_GROUP);
+          productPathGroup.addScalar(configFile.getProductPath());
+          root.appendChild(getGroupElement(productPathGroup, document));
+        }
+
+        // write the monitor level group
+        root.appendChild(getGroupElement(configFile.getMonitorLevelGroup(),
+            document));
+
+        // write the monitor group
+        if (configFile.getMonitorFilenameFormat() != null
+            && configFile.getMonitorPath() != null) {
+          PGEGroup monitorGroup = new PGEGroup(MONITOR_GROUP);
+          monitorGroup.addScalar(configFile.getMonitorPath());
+          monitorGroup.addScalar(configFile.getMonitorFilenameFormat());
+          root.appendChild(getGroupElement(monitorGroup, document));
+        }
+
+        // write the pge specific groups
+        for (Iterator i = configFile.getPgeSpecificGroups().keySet().iterator(); i
+            .hasNext();) {
+          String pgeSpecificGroupName = (String) i.next();
+          PGEGroup pgeSpecificGroup = (PGEGroup) configFile
+              .getPgeSpecificGroups().get(pgeSpecificGroupName);
+
+          root.appendChild(getGroupElement(pgeSpecificGroup, document));
+        }
+
+      }
+
+      return document;
+
+    } catch (ParserConfigurationException pce) {
+      pce.printStackTrace();
+      LOG.log(Level.WARNING, "Error generating pge configuration file!: "
+          + pce.getMessage());
+      throw new Exception("Error generating pge configuration file!: "
+          + pce.getMessage());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+
+  }
+
+  private Element getGroupElement(PGEGroup group, Document document)
+      throws Exception {
+    Element groupElem = document.createElement(GROUP_TAG_NAME);
+    groupElem.setAttribute(NAME_ATTR, group.getName());
+
+    if (group.getNumScalars() > 0) {
+      for (Iterator i = group.getScalars().keySet().iterator(); i.hasNext();) {
+        String scalarName = (String) i.next();
+        PGEScalar scalar = group.getScalar(scalarName);
+
+        Element scalarElem = document.createElement(SCALAR_TAG_NAME);
+        scalarElem.setAttribute(NAME_ATTR, scalar.getName());
+
+        if (scalar.getValue() == null) {
+          throw new Exception("Attempt to write null value for scalar: ["
+              + scalarName + "] to PGE config file!");
+        }
+
+        if (urlEncoding) {
+          try {
+            scalarElem.appendChild(document.createTextNode(URLEncoder.encode(
+                scalar.getValue(), "UTF-8")));
+          } catch (UnsupportedEncodingException e) {
+            LOG.log(Level.WARNING,
+                "Error creating text node for scalar element: "
+                    + scalar.getName() + " in pge group: " + group.getName()
+                    + " Message: " + e.getMessage());
+          }
+
+        } else {
+          scalarElem.appendChild(document.createTextNode(scalar.getValue()));
+        }
+
+        groupElem.appendChild(scalarElem);
+      }
+
+    }
+
+    if (group.getNumVectors() > 0) {
+      for (Iterator i = group.getVectors().keySet().iterator(); i.hasNext();) {
+        String vectorName = (String) i.next();
+        PGEVector vector = group.getVector(vectorName);
+
+        Element vectorElem = document.createElement(VECTOR_TAG_NAME);
+        vectorElem.setAttribute(NAME_ATTR, vector.getName());
+
+        for (Iterator j = vector.getElements().iterator(); j.hasNext();) {
+          String element = (String) j.next();
+
+          if (element == null) {
+            throw new Exception("Attempt to write null value for vector: ["
+                + vectorName + "] to PGE config file!");
+          }
+
+          Element elementElem = document.createElement(VECTOR_ELEMENT_TAG);
+          if (urlEncoding) {
+            try {
+              elementElem.appendChild(document.createTextNode(URLEncoder
+                  .encode(element, "UTF-8")));
+            } catch (UnsupportedEncodingException e) {
+              LOG.log(Level.WARNING,
+                  "Error creating text node for vector element: "
+                      + vector.getName() + " in pge group: " + group.getName()
+                      + " Message: " + e.getMessage());
+            }
+          } else {
+            elementElem.appendChild(document.createTextNode(element));
+          }
+
+          vectorElem.appendChild(elementElem);
+        }
+
+        groupElem.appendChild(vectorElem);
+      }
+    }
+
+    if (group.getNumMatrixs() > 0) {
+      for (Iterator i = group.getMatrixs().keySet().iterator(); i.hasNext();) {
+        String matrixName = (String) i.next();
+        PGEMatrix matrix = group.getMatrix(matrixName);
+
+        Element matrixElem = document.createElement(MATRIX_TAG_NAME);
+        matrixElem.setAttribute(NAME_ATTR, matrix.getName());
+
+        int rowNum = 0;
+        for (Iterator j = matrix.getRows().iterator(); j.hasNext();) {
+          List rowValues = (List) j.next();
+
+          Element rowElem = document.createElement(MATRIX_ROW_TAG);
+
+          int colNum = 0;
+          for (Iterator k = rowValues.iterator(); k.hasNext();) {
+            String colValue = (String) k.next();
+            Element colElem = document.createElement(MATRIX_COL_TAG);
+
+            if (colValue == null) {
+              throw new Exception("Attempt to write null value for matrix: ["
+                  + matrixName + "]: " + "(" + rowNum + "," + colNum + ")");
+            }
+
+            if (urlEncoding) {
+              try {
+                colElem.appendChild(document.createTextNode(URLEncoder.encode(
+                    colValue, "UTF-8")));
+              } catch (UnsupportedEncodingException e) {
+                LOG.log(Level.WARNING,
+                    "Error creating node for matrix element: "
+                        + matrix.getName() + " (" + rowNum + "," + colNum
+                        + ") in pge group: " + group.getName() + " Message: "
+                        + e.getMessage());
+              }
+
+            } else {
+              colElem.appendChild(document.createTextNode(colValue));
+            }
+
+            colNum++;
+          }
+
+          rowNum++;
+        }
+
+        groupElem.appendChild(matrixElem);
+      }
+    }
+
+    if (group.getNumGroups() > 0) {
+      for (Iterator i = group.getGroups().keySet().iterator(); i.hasNext();) {
+        String groupName = (String) i.next();
+        PGEGroup subgroup = group.getGroup(groupName);
+        Element subgroupElem = getGroupElement(subgroup, document);
+        groupElem.appendChild(subgroupElem);
+      }
+
+    }
+
+    return groupElem;
+
+  }
+
+  /**
+   * @return Returns the urlEncoding.
+   */
+  public boolean isUrlEncoding() {
+    return urlEncoding;
+  }
+
+  /**
+   * @param urlEncoding
+   *          The urlEncoding to set.
+   */
+  public void setUrlEncoding(boolean urlEncoding) {
+    this.urlEncoding = urlEncoding;
+  }
+
+  /**
+   * @return Returns the schemaLocation.
+   */
+  public String getSchemaLocation() {
+    return schemaLocation;
+  }
+
+  /**
+   * @param schemaLocation
+   *          The schemaLocation to set.
+   */
+  public void setSchemaLocation(String schemaLocation) {
+    this.schemaLocation = schemaLocation;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigurationFile.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigurationFile.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigurationFile.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEConfigurationFile.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,235 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//OCO imports
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 
+ * <p>
+ * A configuration file to record input similar to HDF format. The configuration
+ * file is a set of named {@link PGEGroup}s.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEConfigurationFile implements PGEConfigFileKeys {
+
+  /* the name of the PGE that uses this configuration file */
+  private PGEScalar pgeName = null;
+
+  /* the list of data product files for tihs PGE */
+  private PGEGroup inputProductFiles = null;
+
+  /* the list of static file identification files */
+  private PGEGroup staticFileIdentificationFiles = null;
+
+  /* the list of ancillary files identified by the PCS */
+  private PGEGroup dynamicAuxiliaryInputFiles = null;
+
+  /*
+   * the list of ancillary files that are not used by the PGE directly, but are
+   * recorded in the AncillaryDataDescriptors metadata element
+   */
+  private PGEGroup recordedAuxiliaryInputFiles = null;
+
+  /* the location to put any output products */
+  private PGEScalar productPath = null;
+
+  /* the location to which to save monitor files */
+  private PGEScalar monitorPath = null;
+
+  /* the filename format of the monitor files */
+  private PGEScalar monitorFilenameFormat = null;
+
+  private PGEGroup monitorLevelGroup = null;
+
+  /* the pge specific groups in the configuration file */
+  private Map<String, PGEGroup> pgeSpecificGroups = null;
+
+  /**
+   * <p>
+   * Constructs a new PGEConfigurationFile with no groups.
+   * </p>
+   */
+  public PGEConfigurationFile() {
+    this.pgeSpecificGroups = new HashMap<String, PGEGroup>();
+    this.inputProductFiles = new PGEGroup(INPUT_PRODUCT_FILES_GROUP);
+    this.staticFileIdentificationFiles = new PGEGroup(SFIF_FILE_GROUP);
+    this.dynamicAuxiliaryInputFiles = new PGEGroup(
+        DYNAMIC_AUX_INPUT_FILES_GROUP);
+    this.recordedAuxiliaryInputFiles = new PGEGroup(
+        RECORDED_AUX_INPUT_FILES_GROUP);
+    this.monitorLevelGroup = new PGEGroup(MONITOR_LEVEL_GROUP);
+  }
+
+  /**
+   * @return the pgeName
+   */
+  public PGEScalar getPgeName() {
+    return pgeName;
+  }
+
+  /**
+   * @param pgeName
+   *          the pgeName to set
+   */
+  public void setPgeName(PGEScalar pgeName) {
+    this.pgeName = pgeName;
+  }
+
+  /**
+   * @return the inputProductFiles
+   */
+  public PGEGroup getInputProductFiles() {
+    return inputProductFiles;
+  }
+
+  /**
+   * @param inputProductFiles
+   *          the inputProductFiles to set
+   */
+  public void setInputProductFiles(PGEGroup inputProductFiles) {
+    this.inputProductFiles = inputProductFiles;
+  }
+
+  /**
+   * @return the staticFileIdentificationFiles
+   */
+  public PGEGroup getStaticFileIdentificationFiles() {
+    return staticFileIdentificationFiles;
+  }
+
+  /**
+   * @param staticFileIdentificationFiles
+   *          the staticFileIdentificationFiles to set
+   */
+  public void setStaticFileIdentificationFiles(
+      PGEGroup staticFileIdentificationFiles) {
+    this.staticFileIdentificationFiles = staticFileIdentificationFiles;
+  }
+
+  /**
+   * @return the dynamicAuxiliaryInputFiles
+   */
+  public PGEGroup getDynamicAuxiliaryInputFiles() {
+    return dynamicAuxiliaryInputFiles;
+  }
+
+  /**
+   * @param dynamicAuxiliaryInputFiles
+   *          the dynamicAuxiliaryInputFiles to set
+   */
+  public void setDynamicAuxiliaryInputFiles(PGEGroup dynamicAuxiliaryInputFiles) {
+    this.dynamicAuxiliaryInputFiles = dynamicAuxiliaryInputFiles;
+  }
+
+  /**
+   * @return the recordedAuxiliaryInputFiles
+   */
+  public PGEGroup getRecordedAuxiliaryInputFiles() {
+    return recordedAuxiliaryInputFiles;
+  }
+
+  /**
+   * @param recordedAuxiliaryInputFiles
+   *          the recordedAuxiliaryInputFiles to set
+   */
+  public void setRecordedAuxiliaryInputFiles(
+      PGEGroup recordedAuxiliaryInputFiles) {
+    this.recordedAuxiliaryInputFiles = recordedAuxiliaryInputFiles;
+  }
+
+  /**
+   * @return the productPath
+   */
+  public PGEScalar getProductPath() {
+    return productPath;
+  }
+
+  /**
+   * @param productPath
+   *          the productPath to set
+   */
+  public void setProductPath(PGEScalar productPath) {
+    this.productPath = productPath;
+  }
+
+  /**
+   * @return the monitorPath
+   */
+  public PGEScalar getMonitorPath() {
+    return monitorPath;
+  }
+
+  /**
+   * @param monitorPath
+   *          the monitorPath to set
+   */
+  public void setMonitorPath(PGEScalar monitorPath) {
+    this.monitorPath = monitorPath;
+  }
+
+  /**
+   * @return the monitorFilenameFormat
+   */
+  public PGEScalar getMonitorFilenameFormat() {
+    return monitorFilenameFormat;
+  }
+
+  /**
+   * @param monitorFilenameFormat
+   *          the monitorFilenameFormat to set
+   */
+  public void setMonitorFilenameFormat(PGEScalar monitorFilenameFormat) {
+    this.monitorFilenameFormat = monitorFilenameFormat;
+  }
+
+  /**
+   * @return the monitorLevelGroup
+   */
+  public PGEGroup getMonitorLevelGroup() {
+    return monitorLevelGroup;
+  }
+
+  /**
+   * @param monitorLevelGroup
+   *          the monitorLevelGroup to set
+   */
+  public void setMonitorLevelGroup(PGEGroup monitorLevelGroup) {
+    this.monitorLevelGroup = monitorLevelGroup;
+  }
+
+  /**
+   * @return the pgeSpecificGroups
+   */
+  public Map<String, PGEGroup> getPgeSpecificGroups() {
+    return pgeSpecificGroups;
+  }
+
+  /**
+   * @param pgeSpecificGroups
+   *          the pgeSpecificGroups to set
+   */
+  public void setPgeSpecificGroups(Map<String, PGEGroup> pgeSpecificGroups) {
+    this.pgeSpecificGroups = pgeSpecificGroups;
+  }
+  
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataHandler.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataHandler.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataHandler.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,253 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * 
+ * <p>
+ * A SAX-based event handler to parse PGE data out of an underlying XML file.
+ * </p>
+ * 
+ * 
+ * @author mattmann
+ * @version $Revision$
+ */
+public class PGEDataHandler extends DefaultHandler implements PGEDataParseKeys {
+
+  /* our log stream */
+  private static final Logger LOG = Logger.getLogger(PGEDataHandler.class
+      .getName());
+
+  /* scalars to be set as tags are encountered */
+  private Map scalars = new HashMap();
+
+  /* vectors to be set as tags are encountered */
+  private Map vectors = new HashMap();
+
+  /* matrices to be set as tags are encountered */
+  private Map matrices = new HashMap();
+
+  /* the status of the parse handler */
+  private int parseStatus = UNSET;
+
+  private boolean vecElement;
+
+  private boolean matrixElement;
+
+  private PGEScalar currentScalar = null;
+
+  private PGEVector currentVector = null;
+
+  private PGEMatrix currentMatrix = null;
+
+  private StringBuffer charBuf;
+
+  // needed for parsing matrix
+  private int currentRow = 0;
+
+  private int currentCol = 0;
+
+  public PGEDataHandler() {
+    vecElement = false;
+    matrixElement = false;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
+   * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+   */
+  public void startElement(String uri, String localName, String qName,
+      Attributes attributes) throws SAXException {
+    if (notParsing()) {
+      // only care about if it's a scalar/vector or matrix
+      if (qName.equals(SCALAR_TAG_NAME)) {
+        parseStatus = PARSING_SCALAR;
+        currentScalar = new PGEScalar();
+        currentScalar.setName(attributes.getValue(NAME_ATTR));
+        charBuf = new StringBuffer();
+      } else if (qName.equals(VECTOR_TAG_NAME)) {
+        parseStatus = PARSING_VEC;
+        currentVector = new PGEVector();
+        currentVector.setName(attributes.getValue(NAME_ATTR));
+      } else if (qName.equals(MATRIX_TAG_NAME)) {
+        parseStatus = PARSING_MATRIX;
+        currentMatrix = new PGEMatrix(attributes.getValue(NAME_ATTR), Integer
+            .parseInt(attributes.getValue(ROWS_ATTR)), Integer
+            .parseInt(attributes.getValue(COLS_ATTR)));
+      }
+    } else if (isParsingScalar()) {
+      // shouldn't encountere another tag here
+      throw new SAXException("Parsing scalar: [" + this.currentScalar.getName()
+          + "]: Should not encounter another tag within");
+    } else if (isParsingVector()) {
+      if (qName.equals(VECTOR_ELEMENT_TAG)) {
+        vecElement = true;
+        charBuf = new StringBuffer();
+      }
+
+    } else if (isParsingMatrix()) {
+      if (qName.equals(MATRIX_COL_TAG)) {
+        matrixElement = true;
+        charBuf = new StringBuffer();
+      }
+    }
+
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
+   * java.lang.String, java.lang.String)
+   */
+  public void endElement(String uri, String localName, String qName)
+      throws SAXException {
+    if (qName.equals(SCALAR_TAG_NAME)) {
+      this.currentScalar.setValue(this.charBuf.toString());
+      this.scalars.put(this.currentScalar.getName(), this.currentScalar);
+      clearCharBuf();
+      parseStatus = UNSET;
+    } else if (qName.equals(VECTOR_ELEMENT_TAG)) {
+      this.currentVector.getElements().add(this.charBuf.toString());
+      clearCharBuf();
+      this.vecElement = false;
+    } else if (qName.equals(VECTOR_TAG_NAME)) {
+      // add the vector
+      if (this.currentVector != null) {
+        this.vectors.put(this.currentVector.getName(), this.currentVector);
+        parseStatus = UNSET;
+      }
+    } else if (qName.equals(MATRIX_TAG_NAME)) {
+      if (this.currentMatrix != null) {
+        this.matrices.put(this.currentMatrix.getName(), this.currentMatrix);
+
+        parseStatus = UNSET;
+        this.currentCol = 0;
+        this.currentRow = 0;
+      }
+    } else if (qName.equals(MATRIX_ROW_TAG)) {
+      this.currentRow++;
+      this.currentCol = 0;
+    } else if (qName.equals(MATRIX_COL_TAG)) {
+      this.currentMatrix.addValue(this.charBuf.toString(), this.currentRow,
+          this.currentCol);
+      this.currentCol++;
+      clearCharBuf();
+      this.matrixElement = false;
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
+   */
+  public void characters(char[] ch, int start, int length) throws SAXException {
+    /*
+     * String val = new String(ch, start, length).trim(); if(!val.equals("")){
+     * this.charBuf.append(val); }
+     */
+    if (isParsingScalar() || isParsingVectorElement()
+        || isParsingMatrixElement()) {
+      this.charBuf.append(ch, start, length);
+    }
+  }
+
+  /**
+   * @return the matrices
+   */
+  public Map getMatrices() {
+    return matrices;
+  }
+
+  /**
+   * @param matrices
+   *          the matrices to set
+   */
+  public void setMatrices(Map matrices) {
+    this.matrices = matrices;
+  }
+
+  /**
+   * @return the scalars
+   */
+  public Map getScalars() {
+    return scalars;
+  }
+
+  /**
+   * @param scalars
+   *          the scalars to set
+   */
+  public void setScalars(Map scalars) {
+    this.scalars = scalars;
+  }
+
+  /**
+   * @return the vectors
+   */
+  public Map getVectors() {
+    return vectors;
+  }
+
+  /**
+   * @param vectors
+   *          the vectors to set
+   */
+  public void setVectors(Map vectors) {
+    this.vectors = vectors;
+  }
+
+  public boolean isParsingScalar() {
+    return parseStatus == PARSING_SCALAR;
+  }
+
+  public boolean isParsingVector() {
+    return parseStatus == PARSING_VEC;
+  }
+
+  public boolean isParsingMatrix() {
+    return parseStatus == PARSING_MATRIX;
+  }
+
+  public boolean isParsingMatrixElement() {
+    return matrixElement;
+  }
+
+  public boolean isParsingVectorElement() {
+    return vecElement;
+  }
+
+  public boolean notParsing() {
+    return parseStatus == UNSET;
+  }
+
+  private void clearCharBuf() {
+    this.charBuf.setLength(0);
+    this.charBuf = null;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataParseKeys.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataParseKeys.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataParseKeys.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEDataParseKeys.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,59 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+/**
+ * 
+ * <p>
+ * A collection of metadata keys relating to the {@link PGEDataHandler}
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public interface PGEDataParseKeys {
+
+  public static final int PARSING_VEC = -10;
+
+  public static final int PARSING_SCALAR = -20;
+
+  public static final int PARSING_MATRIX = -30;
+
+  public static final int UNSET = -1;
+
+  public static final String GROUP_TAG_NAME = "group";
+
+  public static final String SCALAR_TAG_NAME = "scalar";
+
+  public static final String VECTOR_TAG_NAME = "vector";
+
+  public static final String MATRIX_TAG_NAME = "matrix";
+
+  public static final String PGE_INPUT_TAG_NAME = "input";
+
+  public static final String VECTOR_ELEMENT_TAG = "element";
+
+  public static final String MATRIX_ROW_TAG = "tr";
+
+  public static final String MATRIX_COL_TAG = "td";
+
+  public static final String NAME_ATTR = "name";
+
+  public static final String ROWS_ATTR = "rows";
+
+  public static final String COLS_ATTR = "cols";
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,211 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>
+ * A PGEGroup is a named set of named {@link PGEVector}s, {@link PGEScalar}s and
+ * {@link PGEMatrix}s.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEGroup {
+
+  /* the name of the PGEGroup */
+  private String name = null;
+
+  /* the HashMap of PGEScalars */
+  private Map<String, PGEScalar> scalars = null;
+
+  /* the HashMap of PGEVectors */
+  private Map<String, PGEVector> vectors = null;
+
+  /* the HashMap of PGEMatrixs */
+  private Map<String, PGEMatrix> matrixs = null;
+
+  /* the HashMap of PGEGroups */
+  private Map<String, PGEGroup> groups = null;
+
+  /**
+   * <p>
+   * Constructs a new PGEGroup with the given name
+   * </p>
+   */
+  public PGEGroup(String name) {
+    this.name = name;
+    this.scalars = new HashMap<String, PGEScalar>();
+    this.vectors = new HashMap<String, PGEVector>();
+    this.matrixs = new HashMap<String, PGEMatrix>();
+    this.groups = new HashMap<String, PGEGroup>();
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @param name
+   *          the name to set
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return the scalars
+   */
+  public Map<String, PGEScalar> getScalars() {
+    return scalars;
+  }
+
+  /**
+   * @param scalars
+   *          the scalars to set
+   */
+  public void setScalars(Map<String, PGEScalar> scalars) {
+    this.scalars = scalars;
+  }
+
+  /**
+   * @return the vectors
+   */
+  public Map<String, PGEVector> getVectors() {
+    return vectors;
+  }
+
+  /**
+   * @param vectors
+   *          the vectors to set
+   */
+  public void setVectors(Map<String, PGEVector> vectors) {
+    this.vectors = vectors;
+  }
+
+  /**
+   * @return the matrixs
+   */
+  public Map<String, PGEMatrix> getMatrixs() {
+    return matrixs;
+  }
+
+  /**
+   * @param matrixs
+   *          the matrixs to set
+   */
+  public void setMatrixs(Map<String, PGEMatrix> matrixs) {
+    this.matrixs = matrixs;
+  }
+
+  /**
+   * @return the groups
+   */
+  public Map<String, PGEGroup> getGroups() {
+    return groups;
+  }
+
+  /**
+   * @param groups
+   *          the groups to set
+   */
+  public void setGroups(Map<String, PGEGroup> groups) {
+    this.groups = groups;
+  }
+
+  public void addScalar(PGEScalar scalar) {
+    if (this.scalars != null && !this.scalars.containsKey(scalar.getName())) {
+      this.scalars.put(scalar.getName(), scalar);
+    }
+  }
+
+  public void addVector(PGEVector vector) {
+    if (this.vectors != null && !this.vectors.containsKey(vector.getName())) {
+      this.vectors.put(vector.getName(), vector);
+    }
+  }
+
+  public void addMatrix(PGEMatrix matrix) {
+    if (this.matrixs != null && !this.matrixs.containsKey(matrix.getName())) {
+      this.matrixs.put(matrix.getName(), matrix);
+    }
+  }
+
+  public PGEScalar getScalar(String name) {
+    if (this.scalars != null) {
+      return this.scalars.get(name);
+    } else
+      return null;
+  }
+
+  public PGEVector getVector(String name) {
+    if (this.vectors != null) {
+      return this.vectors.get(name);
+    } else
+      return null;
+  }
+
+  public PGEMatrix getMatrix(String name) {
+    if (this.matrixs != null) {
+      return this.matrixs.get(name);
+    } else
+      return null;
+  }
+
+  public PGEGroup getGroup(String name) {
+    if (this.groups != null) {
+      return this.groups.get(name);
+    } else
+      return null;
+  }
+
+  public int getNumScalars() {
+    if (this.scalars != null) {
+      return this.scalars.size();
+    } else
+      return 0;
+  }
+
+  public int getNumVectors() {
+    if (this.vectors != null) {
+      return this.vectors.size();
+    } else
+      return 0;
+  }
+
+  public int getNumMatrixs() {
+    if (this.matrixs != null) {
+      return this.matrixs.size();
+    } else
+      return 0;
+  }
+
+  public int getNumGroups() {
+    if (this.groups != null) {
+      return this.groups.size();
+    } else
+      return 0;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEMatrix.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEMatrix.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEMatrix.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEMatrix.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,133 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * 
+ * <p>
+ * A PGEMatrix is a set of rows and columns with values in each cell defined by
+ * a row number and column number.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEMatrix {
+
+  private List<List<Object>> rows;
+
+  private int numCols;
+
+  private String name;
+
+  /**
+   * <p>
+   * Constructs a new PGEMatrix with no rows or columns.
+   * </p>
+   */
+  public PGEMatrix() {
+    this(null, 0, 0);
+  }
+
+  /**
+   * <p>
+   * Constructs a new PGEMatrix with the specified <code>numrows</code> and
+   * <code>numcols</code>.
+   * 
+   * @param numrows
+   *          The number of rows in the matrix.
+   * @param numcols
+   *          The number of columns for each row in the matrix.
+   */
+  public PGEMatrix(String name, int numrows, int numcols) {
+    super();
+    this.rows = new Vector<List<Object>>(numrows);
+    this.numCols = numcols;
+    this.name = name;
+
+    for (int i = 0; i < numrows; i++) {
+      List<Object> colVector = new Vector<Object>(numcols);
+      this.rows.add(i, colVector);
+    }
+  }
+
+  public void addValue(Object value, int row, int col) {
+    if ((row > this.rows.size() || row < 0) || (col > this.numCols || col < 0)) {
+      return;
+    }
+
+    ((List<Object>) this.rows.get(row)).add(col, value);
+  }
+
+  public Object getValue(int row, int col) {
+    if ((row > this.rows.size() || row < 0) || (col > this.numCols || col < 0)) {
+      return null;
+    }
+
+    return ((List<Object>) this.rows.get(row)).get(col);
+  }
+
+  /**
+   * @return Returns the rows.
+   */
+  public List<List<Object>> getRows() {
+    return this.rows;
+  }
+
+  /**
+   * @param rows
+   *          The rows to set.
+   */
+  public void setRows(List<List<Object>> rows) {
+    this.rows = rows;
+  }
+
+  /**
+   * @return Returns the name.
+   */
+  public String getName() {
+    return this.name;
+  }
+
+  /**
+   * @param name
+   *          The name to set.
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return Returns the numCols.
+   */
+  public int getNumCols() {
+    return this.numCols;
+  }
+
+  /**
+   * @param numCols
+   *          The numCols to set.
+   */
+  public void setNumCols(int numCols) {
+    this.numCols = numCols;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEScalar.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEScalar.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEScalar.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEScalar.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+/**
+ * 
+ * <p>
+ * A PGE Scalar represents a named unit of information. In essence, it is a
+ * name/value pair.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEScalar {
+
+  private String name;
+
+  private String value;
+
+  /**
+     * 
+     */
+  public PGEScalar() {
+    super();
+  }
+
+  /**
+   * @param name
+   * @param value
+   */
+  public PGEScalar(String name, String value) {
+    super();
+    this.name = name;
+    this.value = value;
+  }
+
+  /**
+   * @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;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEVector.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEVector.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEVector.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEVector.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,86 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * 
+ * <p>
+ * A PGEVector is a dynamic set of information, coupled with a name. The
+ * information may include number, or string data.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEVector {
+
+  private String name;
+
+  private List<Object> elements;
+
+  /**
+   * @param name
+   * @param elements
+   */
+  public PGEVector(String name, List<Object> elements) {
+    super();
+    this.name = name;
+    this.elements = elements;
+  }
+
+  /**
+   * 
+   */
+  public PGEVector() {
+    this(null, new Vector<Object>());
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @param name
+   *          the name to set
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return the elements
+   */
+  public List<Object> getElements() {
+    return elements;
+  }
+
+  /**
+   * @param elements
+   *          the elements to set
+   */
+  public void setElements(List<Object> elements) {
+    this.elements = elements;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java (added)
+++ incubator/oodt/trunk/pcs-input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,365 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//OODT imports
+import org.apache.oodt.commons.xml.DOMUtil;
+
+//JDK imports
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/**
+ * <p>
+ * Low-level reading API to get {@link PGEVector}s, {@link PGEScalar}s, and
+ * {@link PGEMatrix}s from underlying OCO XML files.
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ */
+public final class PGEXMLFileUtils {
+
+  /* our log stream */
+  private static final Logger LOG = Logger.getLogger(PGEXMLFileUtils.class
+      .getName());
+
+  public static Map getMatrixsAsMap(Element group)
+      throws PGEConfigFileException {
+    // get the nodelist for the matrixs
+    NodeList matrixs = group.getElementsByTagName("matrix");
+
+    // if it's null, return null
+    if (matrixs == null) {
+      return null;
+    }
+
+    Map matrixMap = new HashMap(matrixs.getLength());
+
+    // for each matrix in the list, create a PGEMatrix with the name
+    // attribute and the appropriate value
+
+    for (int i = 0; i < matrixs.getLength(); i++) {
+      Element matrix = (Element) matrixs.item(i);
+
+      // get the name of the matrix
+      String matrixName = matrix.getAttribute("name");
+
+      // get the number of cols
+      NodeList rowNodeList = matrix.getElementsByTagName("tr");
+
+      // there has to be at least one 1
+      if (rowNodeList == null
+          || (rowNodeList != null && rowNodeList.getLength() <= 0)) {
+        throw new PGEConfigFileException(
+            "there must be at least one row in a matrix!");
+      }
+
+      PGEMatrix pgeMatrix = new PGEMatrix();
+      pgeMatrix.setName(matrixName);
+
+      for (int j = 0; j < rowNodeList.getLength(); j++) {
+        Element rowElem = (Element) rowNodeList.item(j);
+
+        // get the number of cols
+        NodeList colNodeList = rowElem.getElementsByTagName("td");
+
+        // there must be at least one colum in each row
+        if (colNodeList == null
+            || (colNodeList != null && colNodeList.getLength() <= 0)) {
+          throw new PGEConfigFileException(
+              "there must be at least one column a matrix row!");
+        }
+
+        if (pgeMatrix.getNumCols() == 0) {
+          // then set it
+          pgeMatrix.setNumCols(colNodeList.getLength());
+        }
+
+        List colList = new Vector(colNodeList.getLength());
+
+        for (int k = 0; k < colNodeList.getLength(); k++) {
+          Element colElement = (Element) colNodeList.item(k);
+          colList.add(DOMUtil.getSimpleElementText(colElement));
+        }
+
+        pgeMatrix.getRows().add(colList);
+      }
+
+      matrixMap.put(pgeMatrix.getName(), pgeMatrix);
+    }
+    return matrixMap;
+  }
+
+  public static List getMatrixs(Element group) throws PGEConfigFileException {
+    // get the nodelist for the matrixs
+    NodeList matrixs = group.getElementsByTagName("matrix");
+
+    // if it's null, return null
+    if (matrixs == null) {
+      return null;
+    }
+
+    List matrixList = new Vector(matrixs.getLength());
+
+    // for each matrix in the list, create a PGEMatrix with the name
+    // attribute and the appropriate value
+
+    for (int i = 0; i < matrixs.getLength(); i++) {
+      Element matrix = (Element) matrixs.item(i);
+
+      // get the name of the matrix
+      String matrixName = matrix.getAttribute("name");
+
+      // get the number of cols
+      NodeList rowNodeList = matrix.getElementsByTagName("tr");
+
+      // there has to be at least one 1
+      if (rowNodeList == null
+          || (rowNodeList != null && rowNodeList.getLength() <= 0)) {
+        throw new PGEConfigFileException(
+            "there must be at least one row in a matrix!");
+      }
+
+      PGEMatrix pgeMatrix = new PGEMatrix();
+      pgeMatrix.setName(matrixName);
+
+      for (int j = 0; j < rowNodeList.getLength(); j++) {
+        Element rowElem = (Element) rowNodeList.item(j);
+
+        // get the number of cols
+        NodeList colNodeList = rowElem.getElementsByTagName("td");
+
+        // there must be at least one colum in each row
+        if (colNodeList == null
+            || (colNodeList != null && colNodeList.getLength() <= 0)) {
+          throw new PGEConfigFileException(
+              "there must be at least one column a matrix row!");
+        }
+
+        if (pgeMatrix.getNumCols() == 0) {
+          // then set it
+          pgeMatrix.setNumCols(colNodeList.getLength());
+        }
+
+        List colList = new Vector(colNodeList.getLength());
+
+        for (int k = 0; k < colNodeList.getLength(); k++) {
+          Element colElement = (Element) colNodeList.item(k);
+          colList.add(DOMUtil.getSimpleElementText(colElement));
+        }
+
+        pgeMatrix.getRows().add(colList);
+      }
+
+      matrixList.add(pgeMatrix);
+    }
+
+    return matrixList;
+  }
+
+  public static Map getScalarsAsMap(Element group)
+      throws PGEConfigFileException {
+    // get the nodelist for scalars
+    NodeList scalars = group.getElementsByTagName("scalar");
+
+    // if it's null, return null
+    if (scalars == null) {
+      return null;
+    }
+
+    Map scalarMap = new HashMap(scalars.getLength());
+
+    // for each scalar in the list, create a PGEScalar with the name
+    // attribute, and appropriate value
+    for (int i = 0; i < scalars.getLength(); i++) {
+      Element scalar = (Element) scalars.item(i);
+
+      // name of the scalar is in the name attribute
+      String scalarName = scalar.getAttribute("name");
+
+      // get the value of it
+      String scalarValue = DOMUtil.getSimpleElementText(scalar);
+
+      scalarMap.put(scalarName, new PGEScalar(scalarName, scalarValue));
+    }
+
+    return scalarMap;
+  }
+
+  public static List getScalars(Element group) throws PGEConfigFileException {
+    // get the nodelist for scalars
+    NodeList scalars = group.getElementsByTagName("scalar");
+
+    // if it's null, return null
+    if (scalars == null) {
+      return null;
+    }
+
+    List scalarList = new Vector(scalars.getLength());
+
+    // for each scalar in the list, create a PGEScalar with the name
+    // attribute, and appropriate value
+    for (int i = 0; i < scalars.getLength(); i++) {
+      Element scalar = (Element) scalars.item(i);
+
+      // name of the scalar is in the name attribute
+      String scalarName = scalar.getAttribute("name");
+
+      // get the value of it
+      String scalarValue = DOMUtil.getSimpleElementText(scalar);
+
+      scalarList.add(new PGEScalar(scalarName, scalarValue));
+    }
+
+    return scalarList;
+  }
+
+  public static Map getVectorsAsMap(Element group)
+      throws PGEConfigFileException {
+    // get the nodelist for scalars
+    NodeList vectors = group.getElementsByTagName("vector");
+
+    // if it's null, return null
+    if (vectors == null) {
+      return null;
+    }
+
+    Map vectorMap = new HashMap(vectors.getLength());
+
+    // for each vector in the list, create a PGEVector with the name
+    // attribute, and appropriate value
+    for (int i = 0; i < vectors.getLength(); i++) {
+      Element vector = (Element) vectors.item(i);
+
+      // name of the vector is in the name attribute
+      String vectorName = vector.getAttribute("name");
+
+      PGEVector vec = new PGEVector();
+      vec.setName(vectorName);
+
+      // get the nodelist of elements
+      NodeList vecElems = vector.getElementsByTagName("element");
+
+      if (vecElems == null || (vecElems != null && vecElems.getLength() <= 0)) {
+        throw new PGEConfigFileException(
+            "There must be at least one element in a PGEVector!");
+      }
+
+      List vecElemList = new Vector(vecElems.getLength());
+
+      for (int j = 0; j < vecElems.getLength(); j++) {
+        Element vecElem = (Element) vecElems.item(j);
+        vecElemList.add(DOMUtil.getSimpleElementText(vecElem));
+      }
+
+      vec.setElements(vecElemList);
+      vectorMap.put(vec.getName(), vec);
+    }
+
+    return vectorMap;
+  }
+
+  public static List getVectors(Element group) throws PGEConfigFileException {
+    // get the nodelist for scalars
+    NodeList vectors = group.getElementsByTagName("vector");
+
+    // if it's null, return null
+    if (vectors == null) {
+      return null;
+    }
+
+    List vectorList = new Vector(vectors.getLength());
+
+    // for each vector in the list, create a PGEVector with the name
+    // attribute, and appropriate value
+    for (int i = 0; i < vectors.getLength(); i++) {
+      Element vector = (Element) vectors.item(i);
+
+      // name of the vector is in the name attribute
+      String vectorName = vector.getAttribute("name");
+
+      PGEVector vec = new PGEVector();
+      vec.setName(vectorName);
+
+      // get the nodelist of elements
+      NodeList vecElems = vector.getElementsByTagName("element");
+
+      if (vecElems == null || (vecElems != null && vecElems.getLength() <= 0)) {
+        throw new PGEConfigFileException(
+            "There must be at least one element in a PGEVector!");
+      }
+
+      List vecElemList = new Vector(vecElems.getLength());
+
+      for (int j = 0; j < vecElems.getLength(); j++) {
+        Element vecElem = (Element) vecElems.item(j);
+        vecElemList.add(DOMUtil.getSimpleElementText(vecElem));
+      }
+
+      vec.setElements(vecElemList);
+      vectorList.add(vec);
+    }
+
+    return vectorList;
+  }
+
+  public static Document getDocumentRoot(String xmlFile) {
+    // open up the XML file
+    DocumentBuilderFactory factory = null;
+    DocumentBuilder parser = null;
+    Document document = null;
+    InputSource inputSource = null;
+
+    InputStream xmlInputStream = null;
+
+    try {
+      xmlInputStream = new File(xmlFile).toURL().openStream();
+    } catch (IOException e) {
+      LOG.log(Level.WARNING, "IOException when getting input stream from ["
+          + xmlFile + "]: returning null document root");
+      return null;
+    }
+
+    inputSource = new InputSource(xmlInputStream);
+
+    try {
+      factory = DocumentBuilderFactory.newInstance();
+      parser = factory.newDocumentBuilder();
+      document = parser.parse(inputSource);
+    } catch (Exception e) {
+      LOG.warning("Unable to parse xml file [" + xmlFile + "]." + "Reason is ["
+          + e + "]");
+      return null;
+    }
+
+    return document;
+  }
+
+}

Added: incubator/oodt/trunk/pcs-input/src/main/resources/pge-config-example.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/resources/pge-config-example.xml?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/resources/pge-config-example.xml (added)
+++ incubator/oodt/trunk/pcs-input/src/main/resources/pge-config-example.xml Fri Jul 16 03:00:26 2010
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements.  See the NOTICE.txt 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.
+-->
+<!-- Configuration file for running PGE Test -->
+<!-- Created by mattmann -->
+<!-- Created on November 11, 2005 at 09:22:00 -->
+<!-- GDS Build n.mm.pp -->
+<!-- Test name: testPGEConfigFileReader -->
+
+<input>
+   <group name="PGENameGroup">
+     <scalar name="PGEName">Test PGE</scalar>
+   </group>
+   
+   <group name="InputProductFiles">
+     <scalar name="VCID17Stream">/data/o04521/10/oco_10_200090503_o04521_p125_vcid17_mcf200901051234ops.hdf</scalar>
+     <scalar name="VCID32Stream">/data/o04521/10/oco_10_200090503_o04521_p125_vcid32_mcf200901051234ops.hdf</scalar>
+     <scalar name="VCID33Stream">/data/o04521/10/oco_10_200090503_o04521_p125_vcid33_mcf200901051234ops.hdf</scalar>
+     <scalar name="VCID34Stream">/data/o04521/10/oco_10_200090503_o04521_p125_vcid34_mcf200901051234ops.hdf</scalar>
+   </group>
+
+   <group name="StaticFileIdentificationFiles">
+     <scalar name="SFIF12Stream">/data/o04521/10/oco_10_200090503_o04521_p125_sfif12_mcf200901051234ops.hdf</scalar>
+     <scalar name="SFIF34Stream">/data/o04521/10/oco_10_200090503_o04521_p125_sfif34_mcf200901051234ops.hdf</scalar>
+   </group>
+   
+   <group name="DynamicAuxiliaryInputFiles">
+     <scalar name="AuxStream1">/data/o04521/10/oco_10_200090503_o04521_p125_aux1_mcf200901051234ops.aux</scalar>
+   </group>
+   
+   <group name="RecordedAuxiliaryInputFiles">
+      <scalar name="RecAuxStream1">/data/o04521/10/oco_10_200090503_o04521_p125_raux1_mcf200901051234ops.raux</scalar>
+   </group>
+   
+   <group name="ProductPathGroup">
+      <scalar name="ProductPath">/data</scalar>
+   </group>
+   
+   <group name="MonitorGroup">
+      <scalar name="MonitorPath">/data/monitor</scalar>
+      <scalar name="MonitorFilenameFormat">.monitor</scalar>
+   </group>
+
+   <group name="MonitorLevel">
+      <scalar name="MonIO">High</scalar>
+      <scalar name="MonAlg">Off</scalar>
+      <scalar name="MonControl">Med</scalar>
+   </group>
+   
+   <!--  PGE Specific Info -->
+   
+   <group name="MyPGEInfo">
+     <scalar name="TestScalar1">Scalar1</scalar>
+     <vector name="TestVector1">
+       <element>10</element>
+       <element>test string</element>
+       <element>55.5</element>
+       <element>/data/1/2/3/file.file</element>
+     </vector>
+     
+     <matrix name="TestMatrix1">
+       <tr>
+         <td>55</td>
+         <td>12</td>
+         <td>1</td>
+       </tr>
+        <tr>
+         <td>44</td>
+         <td>33</td>
+         <td>100</td>
+       </tr>    
+     </matrix>
+   </group>
+   
+   
+</input>

Added: incubator/oodt/trunk/pcs-input/src/main/resources/pge-data-sax-example.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/main/resources/pge-data-sax-example.xml?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/main/resources/pge-data-sax-example.xml (added)
+++ incubator/oodt/trunk/pcs-input/src/main/resources/pge-data-sax-example.xml Fri Jul 16 03:00:26 2010
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements.  See the NOTICE.txt 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.
+-->
+<!DOCTYPE pgedata [
+
+<!--define the internal DTD-->
+  <!ELEMENT pgedata (scalar*,vector*,matrix*)>
+  <!ELEMENT matrix (tr+)>
+  <!ELEMENT tr (td+)>
+  <!ELEMENT td (#PCDATA)>
+  <!ELEMENT scalar (#PCDATA)>
+  <!ATTLIST scalar name CDATA ''>
+  <!ATTLIST matrix name CDATA ''>
+  <!ATTLIST matrix rows CDATA ''>
+  <!ATTLIST matrix cols CDATA ''>
+  <!ELEMENT vector (element*)>
+  <!ATTLIST vector name CDATA ''>
+  <!ELEMENT element (#PCDATA)>
+
+<!--close the DOCTYPE declaration-->
+]>
+
+<pgedata>
+<scalar name="foo">bar</scalar>
+<vector name="solar_degrad_stddev_pixel_strong_co2">
+<element>7.156829408322501e-18</element>
+<element>1.001230034697944e-17</element>
+<element>2.516345810183765e-18</element>
+<element>5.094596673550921e-18</element>
+<element>3.255014963930512e-18</element>
+<element>5.462772487746047e-18</element>
+<element>4.855160146533748e-18</element>
+<element>9.933721983075038e-18</element>
+<element>6.690502587946044e-18</element>
+<element>9.151933719744191e-18</element>
+<element>5.650032685446839e-07</element>
+<element>5.650032683079101e-07</element>
+<element>5.650032675464667e-07</element>
+<element>5.650032673675753e-07</element>
+<element>5.650032682784805e-07</element>
+<element>5.650032672186995e-07</element>
+<element>5.650032673387105e-07</element>
+<element>5.650032679108124e-07</element>
+<element>5.650032677826825e-07</element>
+<element>5.650032673930709e-07</element>
+<element>5.650032675232457e-07</element>
+<element>5.650032685245339e-07</element>
+<element>5.650032680052611e-07</element>
+<element>5.65003268542033e-07</element>
+<element>5.650032679906624e-07</element>
+<element>5.650032673606469e-07</element>
+<element>5.650032675613922e-07</element>
+<element>5.650032683106426e-07</element>
+<element>5.650032689379945e-07</element>
+<element>5.650032676014303e-07</element>
+<element>5.65003266960909e-07</element>
+<element>5.650032677139583e-07</element>
+<element>5.650032674960097e-07</element>
+<element>5.650032681530792e-07</element>
+<element>5.650032675200847e-07</element>
+<element>5.650032686111758e-07</element>
+<element>5.650032686858376e-07</element>
+<element>5.65003268010127e-07</element>
+<element>5.650032682342422e-07</element>
+<element>5.650032678880181e-07</element>
+<element>5.650032682061757e-07</element>
+<element>5.65003267883388e-07</element>
+<element>5.650032675152441e-07</element>
+<element>5.650032682394885e-07</element>
+<element>5.650032674941117e-07</element>
+<element>5.650032684140377e-07</element>
+<element>5.650032683660305e-07</element>
+<element>5.650032682050788e-07</element>
+<element>5.650032687935118e-07</element>
+<element>5.650032683845967e-07</element>
+<element>5.650032676294086e-07</element>
+<element>5.650032679809725e-07</element>
+<element>5.650032676793177e-07</element>
+<element>5.65003268781788e-07</element>
+<element>5.650032684167456e-07</element>
+<element>5.650032680698273e-07</element>
+<element>5.650032682093531e-07</element>
+<element>5.650032668567917e-07</element>
+<element>5.650032684921305e-07</element>
+<element>5.650032678442659e-07</element>
+<element>5.650032683200177e-07</element>
+<element>5.650032674059403e-07</element>
+<element>5.650032675556752e-07</element>
+<element>5.650032672721777e-07</element>
+<element>5.65003268435877e-07</element>
+<element>5.65003268168295e-07</element>
+<element>5.650032672004772e-07</element>
+<element>5.65003268343149e-07</element>
+<element>5.650032672935149e-07</element>
+<element>5.650032673435717e-07</element>
+<element>5.650032676094195e-07</element>
+<element>5.650032684139997e-07</element>
+<element>5.650032685593072e-07</element>
+<element>5.65003268364404e-07</element>
+<element>5.650032679422686e-07</element>
+<element>5.650032675656163e-07</element>
+<element>5.650032684983817e-07</element>
+<element>5.650032677526585e-07</element>
+<element>5.650032675956273e-07</element>
+<element>5.650032687894096e-07</element>
+<element>5.650032678559322e-07</element>
+<element>5.650032682914911e-07</element>
+<element>5.650032679964352e-07</element>
+<element>5.650032684764378e-07</element>
+<element>5.650032674968119e-07</element>
+<element>5.650032681637797e-07</element>
+<element>5.650032681947215e-07</element>
+<element>5.650032678251767e-07</element>
+<element>5.650032690991248e-07</element>
+<element>5.650032690235313e-07</element>
+<element>5.650032680351119e-07</element>
+<element>5.650032676168338e-07</element>
+<element>5.647772123356515e-07</element>
+<element>4.376496495071942e-07</element>
+<element>4.376496497473271e-07</element>
+<element>4.376496497611925e-07</element>
+<element>4.376496496419958e-07</element>
+<element>4.376496499490122e-07</element>
+<element>4.376496491453507e-07</element>
+<element>4.376496496199902e-07</element>
+<element>4.376496496313135e-07</element>
+<element>4.376496493560163e-07</element>
+<element>4.37649649415751e-07</element>
+<element>4.376496487438027e-07</element>
+<element>4.376496490231489e-07</element>
+<element>4.376496487693666e-07</element>
+<element>4.376496497192663e-07</element>
+<element>4.376496495310717e-07</element>
+<element>4.37649648937335e-07</element>
+<element>4.376496500508244e-07</element>
+<element>4.376496494235092e-07</element>
+<element>4.376496487765641e-07</element>
+<element>4.376496502573037e-07</element>
+<element>4.376496491797974e-07</element>
+<element>4.376496499778206e-07</element>
+<element>4.376496500770006e-07</element>
+<element>4.376496494665307e-07</element>
+<element>4.376496491597167e-07</element>
+<element>4.376496489798316e-07</element>
+<element>4.376496494860262e-07</element>
+<element>4.37649649797094e-07</element>
+<element>4.376496497130217e-07</element>
+<element>4.376496486902971e-07</element>
+<element>4.376496495729736e-07</element>
+<element>4.376496496595051e-07</element>
+<element>4.376496499103306e-07</element>
+<element>4.376496500715821e-07</element>
+<element>4.37649648393365e-07</element>
+<element>4.376496484669906e-07</element>
+<element>4.376496492303731e-07</element>
+<element>4.376496495606573e-07</element>
+<element>4.376496490041646e-07</element>
+<element>4.37649649320577e-07</element>
+<element>4.376496495126756e-07</element>
+<element>4.376496494133791e-07</element>
+<element>4.376496502085632e-07</element>
+<element>4.376496503500403e-07</element>
+<element>4.376496494589024e-07</element>
+<element>4.376496498368655e-07</element>
+<element>4.376496500551011e-07</element>
+<element>4.376496497645193e-07</element>
+<element>4.376496500291563e-07</element>
+<element>4.376496502373919e-07</element>
+<element>4.376496509054261e-07</element>
+<element>4.376496493571226e-07</element>
+<element>4.376496494287977e-07</element>
+<element>4.376496480356845e-07</element>
+<element>4.376496498622485e-07</element>
+<element>4.376496492795068e-07</element>
+<element>4.376496493635472e-07</element>
+<element>4.376496495742711e-07</element>
+<element>4.376496492800899e-07</element>
+<element>4.376496486776432e-07</element>
+<element>4.376496491663729e-07</element>
+<element>4.376496487538479e-07</element>
+<element>4.376496505841974e-07</element>
+<element>4.376496494712244e-07</element>
+<element>4.376496507553076e-07</element>
+<element>4.376496496479507e-07</element>
+<element>4.376496489174097e-07</element>
+<element>4.376496506213675e-07</element>
+<element>4.376496492764853e-07</element>
+<element>4.376496503826606e-07</element>
+<element>4.376496497457357e-07</element>
+<element>4.376496500068803e-07</element>
+<element>4.376496491424506e-07</element>
+<element>4.376496490184349e-07</element>
+<element>4.376496499516555e-07</element>
+<element>4.376496508092893e-07</element>
+<element>4.376496497149663e-07</element>
+<element>4.376496490162042e-07</element>
+<element>4.376496497150526e-07</element>
+<element>4.376496496328375e-07</element>
+<element>4.376496508772949e-07</element>
+<element>4.376496494788424e-07</element>
+<element>4.376496495435055e-07</element>
+<element>4.376496488787512e-07</element>
+<element>4.376496496375363e-07</element>
+<element>4.376496496740998e-07</element>
+<element>4.37649649215851e-07</element>
+<element>4.376496489065544e-07</element>
+<element>4.376496492788316e-07</element>
+<element>4.376496490897931e-07</element>
+<element>4.37649649440043e-07</element>
+<element>4.376496498238065e-07</element>
+<element>4.376496494226082e-07</element>
+<element>4.376496497567646e-07</element>
+<element>4.376496493141858e-07</element>
+<element>4.37649648813068e-07</element>
+<element>4.376496501462642e-07</element>
+<element>4.376496497298497e-07</element>
+<element>4.376496492198953e-07</element>
+<element>4.376496503621545e-07</element>
+<element>4.376496508834365e-07</element>
+<element>4.37649649716903e-07</element>
+<element>4.376496497673743e-07</element>
+<element>4.376496492369553e-07</element>
+<element>4.376496488408098e-07</element>
+<element>4.376496497061842e-07</element>
+<element>4.376496492088419e-07</element>
+<element>4.376496505378924e-07</element>
+<element>4.376496500324374e-07</element>
+<element>4.376496505858961e-07</element>
+<element>4.376496483579881e-07</element>
+<element>4.376496492047949e-07</element>
+<element>4.37649650283361e-07</element>
+<element>4.37649649931959e-07</element>
+<element>4.37649650345139e-07</element>
+<element>4.376496499007843e-07</element>
+<element>4.376496490379377e-07</element>
+<element>1.061115853951698e-17</element>
+<element>1.044441840201302e-17</element>
+<element>4.957385254465431e-18</element>
+<element>4.329574642053506e-18</element>
+<element>7.235238887322188e-18</element>
+<element>6.979433064230618e-18</element>
+<element>1.100843453633496e-17</element>
+<element>7.519914554272377e-18</element>
+<element>4.874490654891152e-18</element>
+<element>1.716558331680342e-18</element>
+</vector>
+<matrix name="foomatrix" rows="2" cols="2">
+ <tr>
+   <td>194</td>
+   <td>192</td>
+ </tr>
+ <tr>
+   <td>1</td>
+   <td>2.2</td>
+ </tr>
+</matrix>
+</pgedata>

Added: incubator/oodt/trunk/pcs-input/src/test/org/apache/oodt/pcs/input/PGEConfigFileReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/pcs-input/src/test/org/apache/oodt/pcs/input/PGEConfigFileReaderTest.java?rev=964663&view=auto
==============================================================================
--- incubator/oodt/trunk/pcs-input/src/test/org/apache/oodt/pcs/input/PGEConfigFileReaderTest.java (added)
+++ incubator/oodt/trunk/pcs-input/src/test/org/apache/oodt/pcs/input/PGEConfigFileReaderTest.java Fri Jul 16 03:00:26 2010
@@ -0,0 +1,168 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements.  See the NOTICE.txt 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.pcs.input;
+
+//JDK imports
+import java.util.Iterator;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * A TestCase to test the PGEConfigFileReader
+ * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class PGEConfigFileReaderTest extends TestCase {
+
+  private PGEConfigurationFile configFile = null;
+
+  protected void setUp() {
+    PGEConfigFileReader reader = new PGEConfigFileReader();
+
+    try {
+      configFile = reader.read(this.getClass().getResource(
+          "pge-config-example.xml"));
+    } catch (PGEConfigFileException e) {
+      e.printStackTrace();
+      fail(e.getMessage());
+    }
+  }
+
+  public void testPGEName() {
+    assertEquals("The PGE Name: " + configFile.getPgeName().getValue()
+        + " is not equal to TestPGE", "Test PGE", configFile.getPgeName()
+        .getValue());
+  }
+
+  public void testInputProductFiles() {
+    PGEGroup inputProductFiles = configFile.getInputProductFiles();
+
+    assertEquals("There is not 4 input product files!", 4, inputProductFiles
+        .getNumScalars());
+    assertEquals(
+        "The VCID17Stream does not have the correct value!",
+        "/data/o04521/10/oco_10_200090503_o04521_p125_vcid17_mcf200901051234ops.hdf",
+        inputProductFiles.getScalar("VCID17Stream").getValue());
+
+    assertEquals(
+        "The VCID34Stream does not have the correct value!",
+        "/data/o04521/10/oco_10_200090503_o04521_p125_vcid34_mcf200901051234ops.hdf",
+        inputProductFiles.getScalar("VCID34Stream").getValue());
+  }
+
+  public void testSFIFInputFiles() {
+    PGEGroup sfifFiles = configFile.getStaticFileIdentificationFiles();
+
+    assertEquals("There is not 2 sfif files!", 2, sfifFiles.getNumScalars());
+
+    assertEquals(
+        "The SFIF34Stream does not have the correct value!",
+        "/data/o04521/10/oco_10_200090503_o04521_p125_sfif34_mcf200901051234ops.hdf",
+        sfifFiles.getScalar("SFIF34Stream").getValue());
+  }
+
+  public void testDynamicAuxFiles() {
+    PGEGroup dynAuxFiles = configFile.getDynamicAuxiliaryInputFiles();
+
+    assertEquals("There is not 1 dynamic aux file!", 1, dynAuxFiles
+        .getNumScalars());
+
+    assertEquals(
+        "The AuxStream1 does not have the correct value!",
+        "/data/o04521/10/oco_10_200090503_o04521_p125_aux1_mcf200901051234ops.aux",
+        dynAuxFiles.getScalar("AuxStream1").getValue());
+  }
+
+  public void testRecordedAuxFiles() {
+    PGEGroup recAuxFiles = configFile.getRecordedAuxiliaryInputFiles();
+
+    assertEquals("There is not 1 recorded aux file!", 1, recAuxFiles
+        .getNumScalars());
+
+    assertEquals(
+        "The RecAuxStream1 does not have the correct value!",
+        "/data/o04521/10/oco_10_200090503_o04521_p125_raux1_mcf200901051234ops.raux",
+        recAuxFiles.getScalar("RecAuxStream1").getValue());
+  }
+
+  public void testProductPath() {
+    assertEquals("The product path: " + configFile.getProductPath().getValue()
+        + " is not equal to /data", "/data", configFile.getProductPath()
+        .getValue());
+  }
+
+  public void testMonitorPath() {
+    assertEquals("The monitor path: " + configFile.getMonitorPath().getValue()
+        + " is not equal to /data/monitor", "/data/monitor", configFile
+        .getMonitorPath().getValue());
+  }
+
+  public void testMonitorFilenameFormat() {
+    assertEquals("The monitor filename format: "
+        + configFile.getMonitorFilenameFormat().getValue()
+        + " is not equal to .monitor", ".monitor", configFile
+        .getMonitorFilenameFormat().getValue());
+  }
+
+  public void testMonitorLevels() {
+    assertEquals("The MonIO level was not set to High!", "High", configFile
+        .getMonitorLevelGroup().getScalar("MonIO").getValue());
+    assertEquals("The MonAlg level was not set to Off!", "Off", configFile
+        .getMonitorLevelGroup().getScalar("MonAlg").getValue());
+    assertEquals("The MonControl level was not set to Med!", "Med", configFile
+        .getMonitorLevelGroup().getScalar("MonControl").getValue());
+  }
+
+  public void testPGESpecificInfo() {
+
+    PGEGroup pgeSpecific = (PGEGroup) configFile.getPgeSpecificGroups().get(
+        "MyPGEInfo");
+
+    assertNotNull(pgeSpecific);
+
+    // test that the scalar is read
+    assertEquals("The test scalar 1 does not have a value of Scalar1",
+        "Scalar1", pgeSpecific.getScalar("TestScalar1").getValue());
+
+    // test that the vector is read
+    PGEVector testVec = pgeSpecific.getVector("TestVector1");
+
+    String testVal = "/data/1/2/3/file.file";
+    boolean hasValue = false;
+
+    for (Iterator i = testVec.getElements().iterator(); i.hasNext();) {
+      String elem = (String) i.next();
+      if (elem.equals(testVal)) {
+        hasValue = true;
+      }
+    }
+
+    assertTrue("The vector TestVector1 does not have the value " + testVal
+        + "!", hasValue);
+
+    // test that the matrix was read right
+    PGEMatrix testMatrix = pgeSpecific.getMatrix("TestMatrix1");
+
+    // row 1, col 0 should be 44
+    assertEquals("The matrix value isn't 44!", 44, Integer
+        .parseInt((String) testMatrix.getValue(1, 0)));
+  }
+}



Mime
View raw message