Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


   */
  protected void validate() throws InvalidDDMSException {
    requireAtLeastVersion("4.0.1");
    Util.requireQName(getXOMElement(), getDDMSVersion().getIsmNamespace(), Notice.getName(getDDMSVersion()));
    if (getNoticeTexts().isEmpty())
      throw new InvalidDDMSException("At least one ism:NoticeText must exist within an ism:Notice element.");
    super.validate();
  }
View Full Code Here


  public static void validateWithSchema(DDMSVersion version, String resourceXML) throws InvalidDDMSException {
    try {
      new DDMSReader(version).getElement(resourceXML);
    }
    catch (SAXException e) {
      throw new InvalidDDMSException(e);
    }
    catch (IOException e) {
      throw new InvalidDDMSException(e);
    }
  }
View Full Code Here

      Builder builder = new Builder(getReader(), true);
      Document doc = builder.build(reader);
      return (doc.getRootElement());
    }
    catch (ParsingException e) {
      throw new InvalidDDMSException(e);
    }
  }
View Full Code Here

      Document doc = builder.build(new FileReader(potentialResource));
      String namespace = doc.getRootElement().getNamespaceURI();
      return (DDMSVersion.getVersionForNamespace(namespace));
    }
    catch (Exception e) {
      throw new InvalidDDMSException("Could not create a valid element from potential resource: " + e.getMessage());
    }
  }
View Full Code Here

   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    Util.requireQName(getXOMElement(), getNamespace(), ProfileList.getName(getDDMSVersion()));
    if (getProfiles().isEmpty())
      throw new InvalidDDMSException("At least one profile must exist.");
    getSecurityAttributes().requireClassification();

    super.validate();
  }
View Full Code Here

    if (getPostalAddress() != null)
      validComponents++;
    if (getVerticalExtent() != null)
      validComponents++;
    if (validComponents == 0) {
      throw new InvalidDDMSException("At least 1 of geographicIdentifier, boundingBox, boundingGeometry, "
        + "postalAddress, or verticalExtent must be used.");
    }
    Util.requireBoundedChildCount(extElement, GeographicIdentifier.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(extElement, BoundingBox.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(extElement, BoundingGeometry.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(extElement, PostalAddress.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(extElement, VerticalExtent.getName(getDDMSVersion()), 0, 1);
    if (hasFacilityIdentifier() && validComponents > 1) {
      throw new InvalidDDMSException("A geographicIdentifier containing a facilityIdentifier must not be used in "
        + "tandem with any other coverage elements.");
    }
    if (!getDDMSVersion().isAtLeast("4.0.1")) {
      if (getOrder() != null) {
        throw new InvalidDDMSException("The ddms:order attribute must not be used until DDMS 4.0.1 or later.");
      }
      if (!Util.isEmpty(getPrecedence())) {
        throw new InvalidDDMSException(
          "The ddms:precedence attribute must not be used until DDMS 4.0.1 or later.");
      }
    }
    if (!Util.isEmpty(getPrecedence())) {
      if (!VALID_PRECEDENCE_VALUES.contains(getPrecedence())) {
        throw new InvalidDDMSException("The ddms:precedence attribute must have a value from: "
          + VALID_PRECEDENCE_VALUES);
      }
      if (getGeographicIdentifier() == null || getGeographicIdentifier().getCountryCode() == null) {
        throw new InvalidDDMSException("The ddms:precedence attribute must only be applied to a "
          + "geospatialCoverage containing a country code.");
      }
    }
    if (!getDDMSVersion().isAtLeast("3.0") && !getSecurityAttributes().isEmpty()) {
      throw new InvalidDDMSException(
        "Security attributes must not be applied to this component until DDMS 3.0 or later.");
    }
    super.validate();
  }
View Full Code Here

   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    Util.requireQName(getXOMElement(), getNamespace(), Group.getName(getDDMSVersion()));
    if (getGroupValues().isEmpty())
      throw new InvalidDDMSException("At least one group value must exist.");
    super.validate();
  }
View Full Code Here

    if (!Util.isEmpty(dateOfExemptedSource)) {
      try {
        _dateOfExemptedSource = getFactory().newXMLGregorianCalendar(dateOfExemptedSource);
      }
      catch (IllegalArgumentException e) {
        throw new InvalidDDMSException("The ism:dateOfExemptedSource attribute must adhere to a valid date format.");
      }
    }
    String declassDate = otherAttributes.get(DECLASS_DATE_NAME);
    if (!Util.isEmpty(declassDate)) {
      try {
        _declassDate = getFactory().newXMLGregorianCalendar(declassDate);
      }
      catch (IllegalArgumentException e) {
        throw new InvalidDDMSException("The ism:declassDate attribute must adhere to a valid date format.");
      }
    }
    _declassEvent = otherAttributes.get(DECLASS_EVENT_NAME);
    _declassException = otherAttributes.get(DECLASS_EXCEPTION_NAME);
    String manualReview = otherAttributes.get(DECLASS_MANUAL_REVIEW_NAME);
View Full Code Here

   * @param newParentVersion the version to test
   * @throws InvalidDDMSException if the versions do not match
   */
  protected void validateCompatibleVersion(DDMSVersion newParentVersion) throws InvalidDDMSException {
    if (!newParentVersion.getIsmNamespace().equals(getNamespace()))
      throw new InvalidDDMSException(INCOMPATIBLE_VERSION_MESSAGE);
  }
View Full Code Here

      Util.requireDDMSValue(PROTOCOL_NAME, getProtocol());
    if (!getDDMSVersion().isAtLeast("5.0")) {
      // Checks for ntk:access and virt:network are implicit in schema validation and data constructor.
    }
    if (!getDDMSVersion().isAtLeast("3.0") && !getSecurityAttributes().isEmpty()) {
      throw new InvalidDDMSException(
        "Security attributes must not be applied to this component until DDMS 3.0 or later.");
    }
    super.validate();
  }
View Full Code Here

TOP

Related Classes of buri.ddmsence.ddms.InvalidDDMSException

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.