コード例 #1
0
  private byte[] escidocTransform(byte[] src, Format srcFormat, Format trgFormat, String service)
      throws TransformationNotSupportedException {
    byte[] result = null;
    boolean supported = false;
    boolean list = false;

    if (srcFormat.getName().equalsIgnoreCase("eSciDoc-publication-item-list")) {
      list = true;
    }

    if (!supported) {
      this.logger.warn(
          "Transformation not supported: \n"
              + srcFormat.getName()
              + ", "
              + srcFormat.getType()
              + ", "
              + srcFormat.getEncoding()
              + "\n"
              + trgFormat.getName()
              + ", "
              + trgFormat.getType()
              + ", "
              + trgFormat.getEncoding());
      throw new TransformationNotSupportedException();
    }
    return result;
  }
コード例 #2
0
  /** {@inheritDoc} */
  public byte[] transform(
      byte[] src,
      Format srcFormat,
      Format trgFormat,
      String service,
      Map<String, String> configuration)
      throws TransformationNotSupportedException, RuntimeException {
    byte[] result = null;
    boolean supported = false;
    this.configuration = configuration;

    if (srcFormat.getName().toLowerCase().startsWith("escidoc")) {
      result = this.escidocTransform(src, srcFormat, trgFormat, service);
      supported = true;
    }

    if (!supported) {
      this.logger.warn(
          "Transformation not supported: \n "
              + srcFormat.getName()
              + ", "
              + srcFormat.getType()
              + ", "
              + srcFormat.getEncoding()
              + "\n"
              + trgFormat.getName()
              + ", "
              + trgFormat.getType()
              + ", "
              + trgFormat.getEncoding());
      throw new TransformationNotSupportedException();
    }

    return result;
  }