예제 #1
0
  /**
   * loads <maps> settings from the descriptor.xml file
   *
   * @param maps The <maps> DOM Element from the descriptor.xml file
   */
  private void configureMaps(Element maps) {
    // TODO: add pattern support for mappings, as an alternative to path - deliriumsky

    // Get the map element(s)
    NodeList nlMap = maps.getElementsByTagName("map");

    // Setup the hashmap to hold the map elements
    mapList = new String[nlMap.getLength()][2];

    Element elem = null; // temporary holds map elements

    // Iterate through the map elements
    for (int i = 0; i < nlMap.getLength(); i++) {
      elem = (Element) nlMap.item(i); // <map>
      String path = elem.getAttribute("path"); // @path
      // String pattern = elem.getAttribute("pattern");//@pattern
      String view = elem.getAttribute("view"); // @view

      // must be a path or a pattern to map from
      if (path == null /*&& pattern == null*/) {
        LOG.warn("Error element 'map' requires an attribute 'path' or an attribute 'pattern'");
        return;
      }
      path =
          path.replaceAll(
              "\\$\\{WEBAPP_HOME\\}",
              SingleInstanceConfiguration.getWebappHome().getAbsolutePath().replace('\\', '/'));

      // must be a view to map to
      if (view == null) {
        LOG.warn("Error element 'map' requires an attribute 'view'");
        return;
      }
      view =
          view.replaceAll(
              "\\$\\{WEBAPP_HOME\\}",
              SingleInstanceConfiguration.getWebappHome().getAbsolutePath().replace('\\', '/'));

      // store what to map from
      /* if(path != null)
      {*/
      // store the path
      mapList[i][0] = path;
      /*}
      else
      {
      	//store the pattern
      	mapList[i][0] = pattern;
      }*/

      // store what to map to
      mapList[i][1] = view;
    }
  }
예제 #2
0
  /**
   * loads <allow-source> settings from the descriptor.xml file
   *
   * @param allowsourcexqueries The <allow-source> DOM Element from the descriptor.xml file
   */
  private void configureAllowSourceXQuery(Element allowsourcexqueries) {
    // Get the xquery element(s)
    NodeList nlXQuery = allowsourcexqueries.getElementsByTagName("xquery");

    // Setup the hashmap to hold the xquery elements
    allowSourceXQueryList = new String[nlXQuery.getLength()];

    Element elem = null; // temporary holds xquery elements

    // Iterate through the xquery elements
    for (int i = 0; i < nlXQuery.getLength(); i++) {
      elem = (Element) nlXQuery.item(i); // <xquery>
      String path = elem.getAttribute("path"); // @path

      // must be a path to allow source for
      if (path == null) {
        LOG.warn("Error element 'xquery' requires an attribute 'path'");
        return;
      }
      path =
          path.replaceAll(
              "\\$\\{WEBAPP_HOME\\}",
              SingleInstanceConfiguration.getWebappHome().getAbsolutePath().replace('\\', '/'));

      // store the path
      allowSourceXQueryList[i] = path;
    }
  }