Package nz.govt.natlib.meta.config

Examples of nz.govt.natlib.meta.config.ConfigMapEntry


                  LogMessage.ERROR,
                  "Problem removing " + fileName
                      + " from xml directory");
            }
            // Remove mappings associated with this file
            ConfigMapEntry map = (ConfigMapEntry) mapSet
                .get(fileName);
            if (map != null) {
              LogManager.getInstance().logMessage(
                  LogMessage.ERROR,
                  "Removing map using "
                      + map.getXsltFunction()
                      + " from mappings table");
              Config.getEditInstance().removeMapping(map);
              Config.getInstance().removeMapping(map);
            }
          }
View Full Code Here


  private void addNewMap() {
    int inputDTD = inputDTDCbx.getSelectedIndex();
    int mappingXSLT = mappingCbx.getSelectedIndex();
    int outputDTD = outputDTDCbx.getSelectedIndex();
    ConfigMapEntry map = new ConfigMapEntry((String) adapterOutputs
        .get(inputDTD), (String) configArray.get(outputDTD),
        (String) xsltMaps.get(mappingXSLT));
    if (isNewMap((String) adapterOutputs.get(inputDTD),
        (String) configArray.get(outputDTD))) {
      tableModel.addMap(map);
      Config.getEditInstance().addMapping(map);
      mappingTable.setRowSelectionInterval(tableModel.getRowCount() - 1,
          tableModel.getRowCount() - 1);
      LogManager.getInstance().logMessage(
          LogMessage.INFO,
          "Mapping added: " + map.getInputDTD() + " : "
              + map.getXsltFunction() + " : "
              + map.getOutputDTD());
    } else {
      LogManager.getInstance().logMessage(
          LogMessage.INFO,
          "Mapping not added - already exists: " + map.getInputDTD()
              + " : " + map.getXsltFunction() + " : "
              + map.getOutputDTD());
      JOptionPane.showMessageDialog(this,
          "A mapping already exists for the selected schemas",
          "Unable to create mapping", JOptionPane.WARNING_MESSAGE,
          mapPic);
    }
View Full Code Here

  private boolean isNewMap(String input, String output) {
    // System.out.println("Checking map creation: "+input+" - "+output);
    int num = tableModel.getRowCount();
    for (int i = 0; i < num; i++) {
      ConfigMapEntry map = tableModel.getMap(i);
      // System.out.println("Checking : "+map.getInputDTD()+" -
      // "+map.getOutputDTD());
      if (map.getInputDTD().equals(input)
          && map.getOutputDTD().equals(output)) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

  }

  private void delMap() {
    int idx = mappingTable.getSelectedRow();
    if (idx > -1) {
      ConfigMapEntry getMap = tableModel.getMap(idx);
      if (getMap.getInputDTD().equals("default.dtd")) {
        int res = JOptionPane
            .showConfirmDialog(
                this,
                "Are you sure you want to uninstall system mapping?\nthis could render the harvester inoperable!",
                "Remove mapping", JOptionPane.WARNING_MESSAGE);
        // JOptionPane.showConfirmDialog(this,
        // "Unable to uninstall system mapping",
        // "Unable to remove mapping",JOptionPane.WARNING_MESSAGE,
        // mapPic);
        if (res != JOptionPane.OK_OPTION) {
          return;
        }
      }
      ConfigMapEntry map = tableModel.removeMap(idx);
      Config.getEditInstance().removeMapping(map);
      if (tableModel.getRowCount() > 0) {
        int sel = Math.max(Math.min(idx, tableModel.getRowCount() - 1),
            0);
        mappingTable.setRowSelectionInterval(sel, sel);
View Full Code Here

      return (List) mappings.clone();
    }

    public ConfigMapEntry getMap(int index) {
      if (index < mappings.size()) {
        ConfigMapEntry map = (ConfigMapEntry) mappings.get(index);
        return map;
      }
      return null;
    }
View Full Code Here

      return null;
    }

    public ConfigMapEntry removeMap(int index) {
      if (index < mappings.size()) {
        ConfigMapEntry map = (ConfigMapEntry) mappings.get(index);
        mappings.remove(index);
        fireTableDataChanged();
        return map;
      }
      return null;
View Full Code Here

    public int getColumnCount() {
      return 3;
    }

    public Object getValueAt(int row, int col) {
      ConfigMapEntry map = (ConfigMapEntry) mappings.get(row);
      switch (col) {
      case 0:
        return map.getInputDTD();
      case 1:
        return map.getXsltFunction();
      case 2:
        return map.getOutputDTD();
      default:
        return null;
      }
    }
View Full Code Here

   *
   * @param inDTD
   * @param outDTD
   */
  public static TransformProcessor getInstance(String inDTD, String outDTD) {
    ConfigMapEntry tform = Config.getInstance().getMapping(inDTD, outDTD);

    // if the transform can't be done
    if ((outDTD != null) && (tform == null)) {
      throw new RuntimeException(
          "No transformation script available to convert " + inDTD
              + " into " + outDTD);
    }

    // decide what method to use
    String xsl = null;
    if (tform == null) {
      xsl = null;
    } else {
      xsl = tform.getXsltFunction();
    }

    xsl = xsl == null ? null : Config.getInstance().getXMLBaseURL() + "/"
        + xsl;
    // LogManager.getInstance().logMessage(LogMessage.WORTHLESS_CHATTER,"Identifying
View Full Code Here

TOP

Related Classes of nz.govt.natlib.meta.config.ConfigMapEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.