Package thredds.catalog2.xml.writer

Examples of thredds.catalog2.xml.writer.ThreddsXmlWriterFactory


    else if ( this.parentDatasetNodeBuilder != null )
      this.selfBuilder = this.parentDatasetNodeBuilder.addDataset( name );
    else if ( builderFactory != null )
      this.selfBuilder = builderFactory.newDatasetBuilder( name );
    else
      throw new ThreddsXmlParserException( "" );

    this.datasetNodeElementParserHelper = new DatasetNodeElementParserHelper( this.parentDatasetNodeElementParserHelper,
                                                                              this.selfBuilder,
                                                                              this.builderFactory );
View Full Code Here


  void handleChildStartElement()
          throws ThreddsXmlParserException
  {
    String unexpectedElement = StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader );
    ThreddsXmlParserIssue issue = new ThreddsXmlParserIssue( ThreddsXmlParserIssue.Severity.ERROR, "Unrecognized element: " + unexpectedElement, this.selfBuilder, null);
    throw new ThreddsXmlParserException( issue);
  }
View Full Code Here

  void handleChildStartElement()
          throws ThreddsXmlParserException
  {
    String unexpectedElement = StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader );
    ThreddsXmlParserIssue issue = new ThreddsXmlParserIssue( ThreddsXmlParserIssue.Severity.ERROR, "Unrecognized element: " + unexpectedElement, this.selfBuilder, null);
    throw new ThreddsXmlParserException( issue);
  }
View Full Code Here

      this.resolutionParser.parseElement( this.reader );
    }
    else
    {
      String unexpectedElement = StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader );
      ThreddsXmlParserIssue issue = new ThreddsXmlParserIssue( ThreddsXmlParserIssue.Severity.ERROR, "Unrecognized element: " + unexpectedElement, this.parentBuilder, null);
      throw new ThreddsXmlParserException( issue);
    }
  }
View Full Code Here

      return;
    }
    if ( titleAtt == null || externalRefAtt == null )
    {
      String msg = "External reference metadata element has null title or URI.";
      ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForUnexpectedElement( msg, this.reader );
      log.warn( "parseStartElement(): " + issue.getMessage());
      // ToDo Gather issues rather than throw exception.
      throw new ThreddsXmlParserException( issue);
    }

    this.selfBuilder.setTitle( titleAtt.getValue() );

    String uriString = externalRefAtt.getValue();
    try
    {
      this.selfBuilder.setExternalReference( new URI( uriString ));
    }
    catch ( URISyntaxException e )
    {
      String msg = "External reference metadata element with bad URI syntax [" + uriString + "].";
      ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForException( msg, this.reader, e );
      log.warn( "parseStartElement(): " + issue.getMessage(), e );
      // ToDo Gather issues rather than throw exception.
      throw new ThreddsXmlParserException( issue );
    }
  }
View Full Code Here

       
      }
      else
      {
        String msg = "Expecting THREDDS Metadata, got non-THREDDS Metadata";
        ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForUnexpectedElement( msg, this.reader );
        // ToDo Instead of throwing exception, gather issues and continue.
        throw new ThreddsXmlParserException( issue );
      }

    }
    else
    {
      if ( this.threddsMetadataElementParserFactory.isEventMyStartElement( startElement ) )
      {
        String msg = "Unexpected THREDDS Metadata";
        ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForUnexpectedElement( msg, this.reader );
        // ToDo Instead of throwing exception, gather issues and continue.
        throw new ThreddsXmlParserException( issue);
      }
      else
      {
        if ( this.isContainedContent )
        {
          if ( this.content == null )
            this.content = new StringBuilder();
          this.content.append( StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader ) );
        }
        else
        {
          String msg = "Unexpected content";
          ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForUnexpectedElement( msg, this.reader );
          // ToDo Instead of throwing exception, gather issues and continue.
          throw new ThreddsXmlParserException( issue );
        }
      }
    }
View Full Code Here

      expires = expiresString != null ? new DateType( expiresString, null, null ) : null;
    }
    catch ( ParseException e )
    {
      String msg = "Failed to parse catalog expires date [" + expiresString + "].";
      ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForException( msg, this.reader, e );
      log.warn( "parseStartElement(): " + issue.getMessage(), e );
      // ToDo Gather issues rather than throw exception.
      throw new ThreddsXmlParserException( issue );
    }
    Attribute lastModifiedAtt = startElement.getAttributeByName( CatalogElementNames.CatalogElement_LastModified );
    String lastModifiedString = lastModifiedAtt != null ? lastModifiedAtt.getValue() : null;
    DateType lastModified = null;
    try {
      lastModified = lastModifiedString != null ? new DateType( lastModifiedString, null, null ) : null;
    }
    catch ( ParseException e )
    {
      String msg = "Failed to parse catalog lastModified date [" + lastModifiedString + "].";
      ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForException( msg, this.reader, e );
      log.warn( "parseStartElement(): " + issue.getMessage(), e );
      // ToDo Gather issues rather than throw exception.
      throw new ThreddsXmlParserException( issue );
    }
    URI docBaseUri = null;
    try {
      docBaseUri = new URI( docBaseUriString );
    }
    catch ( URISyntaxException e )
    {
      String msg = "Bad catalog base URI [" + docBaseUriString + "].";
      ThreddsXmlParserIssue issue = StaxThreddsXmlParserUtils.createIssueForException( msg, this.reader, e );
      log.warn( "parseStartElement(): " + issue.getMessage(), e );
      // ToDo Gather issues rather than throw exception.
      throw new ThreddsXmlParserException( issue );
    }
    this.selfBuilder = builderFactory.newCatalogBuilder( nameString, docBaseUri, versionString, expires, lastModified );
  }
View Full Code Here

  void handleChildStartElement()
          throws ThreddsXmlParserException
  {
    String unexpectedElement = StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader );
    ThreddsXmlParserIssue issue = new ThreddsXmlParserIssue( ThreddsXmlParserIssue.Severity.ERROR, "Unrecognized element: " + unexpectedElement, this.selfBuilder, null);
    throw new ThreddsXmlParserException( issue);
  }
View Full Code Here

  void handleChildStartElement()
          throws ThreddsXmlParserException
  {
    String unexpectedElement = StaxThreddsXmlParserUtils.consumeElementAndConvertToXmlString( this.reader );
    ThreddsXmlParserIssue issue = new ThreddsXmlParserIssue( ThreddsXmlParserIssue.Severity.ERROR, "Unrecognized element: " + unexpectedElement, this.selfBuilder, null);
    throw new ThreddsXmlParserException( issue);
  }
View Full Code Here

      return cp.parseIntoBuilder( new StringReader( catalogXml ), docBaseUri );
    }

    public static void writeCatalogXml( Catalog cat )
    {
        ThreddsXmlWriter txw = ThreddsXmlWriterFactory.newInstance().createThreddsXmlWriter();
        try {
            txw.writeCatalog( cat, System.out );
        }
        catch ( ThreddsXmlWriterException e )
        {
            e.printStackTrace();
            fail( "Failed writing catalog to sout: " + e.getMessage() );
View Full Code Here

TOP

Related Classes of thredds.catalog2.xml.writer.ThreddsXmlWriterFactory

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.