コード例 #1
0
  /**
   * Checks the given document data to compute the probability of whether this factory module would
   * be able to handle the given data.
   *
   * @param documentInfo the document information collection.
   * @return an integer value indicating how good the document matches the factories requirements.
   */
  public int getDocumentSupport(final XmlDocumentInfo documentInfo) {
    final String rootNamespace = documentInfo.getRootElementNameSpace();
    if (rootNamespace != null && rootNamespace.length() > 0) {
      if (BundleNamespaces.STYLE.equals(rootNamespace) == false) {
        return XmlFactoryModule.NOT_RECOGNIZED;
      } else if ("style".equals(documentInfo.getRootElement())) {
        return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE;
      }
    } else if ("style".equals(documentInfo.getRootElement())) {
      return XmlFactoryModule.RECOGNIZED_BY_TAGNAME;
    }

    return XmlFactoryModule.NOT_RECOGNIZED;
  }
コード例 #2
0
  public int getDocumentSupport(final XmlDocumentInfo documentInfo) {
    final String rootNamespace = documentInfo.getRootElementNameSpace();
    if (rootNamespace != null && rootNamespace.length() > 0) {
      if (KettleDataFactoryModule.NAMESPACE.equals(rootNamespace) == false) {
        return NOT_RECOGNIZED;
      } else if ("kettle-datasource".equals(documentInfo.getRootElement())) {
        return RECOGNIZED_BY_NAMESPACE;
      }
    } else if ("kettle-datasource".equals(documentInfo.getRootElement())) {
      return RECOGNIZED_BY_TAGNAME;
    }

    return NOT_RECOGNIZED;
  }