Package eu.planets_project.ifr.core.services.migration.genericwrapper2

Examples of eu.planets_project.ifr.core.services.migration.genericwrapper2.GenericMigrationWrapper


      final ServiceDescriptionFactory serviceFactory = new ServiceDescriptionFactory(
        toolIdentifier, serviceProvider, configuration);
      this.serviceDescription = serviceFactory.getServiceDescription();
  } catch (Exception e) {
      throw new MigrationInitialisationException(
        "Failed initialising migration path data from the configuration document: "
          + configuration.getNodeName(), e);
  }
    }
View Full Code Here


    migrationPaths
      .addAll(createMigrationPathInstances(currentPathNode));
      }
      return migrationPaths;
  } catch (Exception exception) {
      throw new MigrationPathConfigException(
        "Failed parsing the migration path configurations in the "
          + "configuration document.", exception);
  }
    }
View Full Code Here

  // Get the output format
  final List<URI> outputFormatURIs = getURIList(pathNode,
    ConfigurationFileTagsV1.OUTPUT_FORMAT_ELEMENT);

  if (outputFormatURIs.size() != 1) {
      throw new MigrationPathConfigException(String.format(
        "The '%s' element of a '%s' element must contain exactly "
          + "one format URI element and not "
          + outputFormatURIs.size() + " elements.",
        ConfigurationFileTagsV1.OUTPUT_FORMAT_ELEMENT, pathNode
          .getNodeName()));
View Full Code Here

      final Map<String, String> tempFileMapping = getTempFileDeclarations(
        pathNode, toolIOProfileElementName);

      if (!tempFileMapping.isEmpty() && toolIOProfile.usePipedIO()) {
    throw new MigrationPathConfigException(
      "Both piped IO and temporary file is specified in the "
        + "tool IO profile. Only one type may be "
        + "specified in the '"
        + toolIOProfileElementName
        + "' element of the '" + pathNode.getNodeName()
        + "' element.");
      }

      if (tempFileMapping.isEmpty() && !toolIOProfile.usePipedIO()) {
    throw new MigrationPathConfigException(
      "Either piped IO or a temporary file must be specified"
        + " in the '" + toolIOProfileElementName
        + "' element of the '" + pathNode.getNodeName()
        + "' element.");
      }

      if (tempFileMapping.size() > 1) {
    throw new MigrationPathConfigException(
      "Only one temporary file may be specified in the tool"
        + " IO profile. " + tempFileMapping.size()
        + " were specified in the '"
        + toolIOProfileElementName
        + "' element of the '" + pathNode.getNodeName()
        + "' element.");
      }

      if (!toolIOProfile.usePipedIO()) {
    // Based on the above code, we are sure that the temp. file map
    // contains exactly one element, thus this is OK.
    final String tempFileLabel = tempFileMapping.keySet()
      .iterator().next();
    toolIOProfile.setCommandLineFileLabel(tempFileLabel);
    toolIOProfile.setDesiredTempFileName(tempFileMapping
      .get(tempFileLabel));
      }

      return toolIOProfile;
  } catch (XPathExpressionException xPathExpressionException) {
      throw new MigrationPathConfigException(
        "Failed reading tool IO profile information from the '"
          + toolIOProfileElementName + "' element in the '"
          + pathNode.getNodeName() + "' element.",
        xPathExpressionException);
  }
View Full Code Here

      final Node elementWithDefaultAttribute = (Node) pathsXPath
        .evaluate(nameOfElementWithDefaultAttribute, pathNode,
          XPathConstants.NODE);

      if (elementWithDefaultAttribute == null) {
    throw new MigrationPathConfigException("No '"
      + nameOfElementWithDefaultAttribute
      + "' element declared in node: "
      + pathNode.getNodeName());
      }

      final String defaultAttributeValue = getAttributeValue(
        elementWithDefaultAttribute,
        ConfigurationFileTagsV1.DEFAULT_ATTRIBUTE);

      if (defaultAttributeValue.length() == 0) {
    throw new MigrationPathConfigException(String.format(
      "Empty '%s' attribute declared in node: ",
      ConfigurationFileTagsV1.DEFAULT_ATTRIBUTE)
      + elementWithDefaultAttribute.getNodeName());
      }

      return defaultAttributeValue;
  } catch (XPathExpressionException xPathExpressionException) {
      throw new MigrationPathConfigException(String.format(
        "Failed reading the '%s' attribute of the '",
        ConfigurationFileTagsV1.DEFAULT_ATTRIBUTE)
        + nameOfElementWithDefaultAttribute
        + "' element in the '"
        + pathNode.getNodeName() + "' element.",
View Full Code Here

    final Node presetNode = presetNodes.item(presetIndex);

    final String presetName = getAttributeValue(presetNode,
      ConfigurationFileTagsV1.NAME_ATTRIBUTE);
    if (presetName.length() == 0) {
        throw new MigrationPathConfigException(
          "Empty \"name\" attribute declared in node: "
            + presetNode.getNodeName());
    }

    final String defaultPresetName = getAttributeValue(presetNode,
      ConfigurationFileTagsV1.DEFAULT_ATTRIBUTE);

    final Node descriptionNode = (Node) pathsXPath.evaluate(
      ConfigurationFileTagsV1.DESCRIPTION_ELEMENT,
      presetNode, XPathConstants.NODE);

    final String description = descriptionNode.getTextContent();

    final Collection<PresetSetting> presetSettings = getPresetSettings(presetNode);

    final Preset newPreset = new Preset(presetName, presetSettings,
      defaultPresetName);
    newPreset.setDescription(description);

    presets.add(newPreset);
      }

      toolPresets = new ToolPresets();
      toolPresets.setToolPresets(presets);

      String defaultPresetName = null;
      if (presets.size() > 0) {
    defaultPresetName = getDefaultAttributeValue(pathNode,
      presetsElementName);
      }
      toolPresets.setDefaultPresetName(defaultPresetName);
      return toolPresets;
  } catch (XPathExpressionException xpee) {
      throw new MigrationPathConfigException(
        "Failed reading tool preset elements from the '"
          + presetsElementName + "' element in the '"
          + pathNode.getNodeName() + "' element.", xpee);
  }
    }
View Full Code Here

    final String settingsName = getAttributeValue(settingsNode,
      ConfigurationFileTagsV1.NAME_ATTRIBUTE);

    if (settingsName.length() == 0) {
        throw new MigrationPathConfigException(
          "Empty \"name\" attribute declared in node: "
            + settingsNode.getNodeName());
    }

    Collection<Parameter> parameters = getSettingsParameters(settingsNode);

    final Node descriptionNode = (Node) pathsXPath.evaluate(
      ConfigurationFileTagsV1.DESCRIPTION_ELEMENT,
      settingsNode, XPathConstants.NODE);

    final String description = descriptionNode.getTextContent();

    final PresetSetting presetSetting = new PresetSetting(
      settingsName, parameters);
    presetSetting.setDescription(description);
    presetSettings.add(presetSetting);
      }

      return presetSettings;
  } catch (XPathExpressionException xpee) {
      throw new MigrationPathConfigException(
        "Failed reading preset settings elements from the '"
          + presetNode.getNodeName() + "' element.", xpee);
  }

    }
View Full Code Here

    final Node parameterNode = parameterNodes.item(parameterIndex);

    final String parameterName = getAttributeValue(parameterNode,
      ConfigurationFileTagsV1.NAME_ATTRIBUTE);
    if (parameterName == null) {
        throw new MigrationPathConfigException(
          "No \"name\" attribute declared in node: "
            + parameterNode.getNodeName());
    }

    final Node descriptionNode = (Node) pathsXPath.evaluate(
      ConfigurationFileTagsV1.DESCRIPTION_ELEMENT,
      parameterNode, XPathConstants.NODE);

    String description = null;
    if (descriptionNode != null) {
        description = descriptionNode.getTextContent();
    }

    final Builder parameterBuilder = new Builder(parameterName,
      null);
    parameterBuilder.description(description);

    toolParameters.add(parameterBuilder.build());
      }

      return toolParameters;
  } catch (XPathExpressionException xpee) {
      throw new MigrationPathConfigException(
        "Failed reading tool parameter elements from the '"
          + nameOfElementContainingParameters
          + "' element in the '" + pathNode.getNodeName()
          + "' element.", xpee);
  }
View Full Code Here

    final Node parameterNode = parameterNodes.item(parameterIndex);

    final String parameterName = getAttributeValue(parameterNode,
      ConfigurationFileTagsV1.NAME_ATTRIBUTE);
    if (parameterName == null) {
        throw new MigrationPathConfigException(
          "No \"name\" attribute declared in node: "
            + parameterNode.getNodeName());
    }

    final String parameterValue = parameterNode.getTextContent()
      .trim();
    final Builder parameterBuilder = new Builder(parameterName,
      parameterValue);

    settingsParameters.add(parameterBuilder.build());
      }

      return settingsParameters;
  } catch (XPathExpressionException xpee) {
      throw new MigrationPathConfigException(
        "Failed reading settings parameter elements from the '"
          + settingsNode.getNodeName() + "' element.", xpee);
  }
    }
View Full Code Here

    final Node tempfileNode = tempFileNodes.item(tempfileIndex);

    final String tempFileLabel = getAttributeValue(tempfileNode,
      ConfigurationFileTagsV1.LABEL_ATTRIBUTE);
    if (tempFileLabel == null) {
        throw new MigrationPathConfigException(
          "The \"label\" attribute has no value. Declared in node: "
            + tempfileNode.getNodeName());

    }

    String tempFileName = null;
    try {
        tempFileName = getAttributeValue(tempfileNode,
          ConfigurationFileTagsV1.NAME_ATTRIBUTE);
    } catch (MigrationPathConfigException mpce) {
        // This can safely be to ignored. The name attribute is
        // optional.
    }

    tempFileMappings.put(tempFileLabel, tempFileName);
      }

      return tempFileMappings;
  } catch (XPathExpressionException xpee) {
      throw new MigrationPathConfigException(
        "Failed reading temp. file elements from the '"
          + tempFilesElementName + "' element in the '"
          + pathNode.getNodeName() + "' element.", xpee);
  }
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.services.migration.genericwrapper2.GenericMigrationWrapper

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.