Package thredds.catalog2.xml.parser

Examples of thredds.catalog2.xml.parser.ThreddsXmlParserIssue


    assertEquals( "DS1", dsBldr.getId() );
    return dsBldr;
  }

  private static DatasetBuilder assertGetDatasetTwo( CatalogBuilder catBuilder ) {
    DatasetBuilder dsBldr = assertGetDatasetOne( catBuilder);

    List<DatasetNodeBuilder> datasetNodes = dsBldr.getDatasetNodeBuilders();
    assertEquals( 1, datasetNodes.size() );
    dsBldr = (DatasetBuilder) datasetNodes.get( 0 );
    assertEquals( "DS2", dsBldr.getId() );
    return dsBldr;
  }
View Full Code Here


    if ( source == null )
      throw new IllegalArgumentException( "Source builder may not be null." );
    if ( builderFactory == null )
      throw new IllegalArgumentException( "Builder factory may not be null.");

    MetadataBuilder result = builderFactory.newMetadataBuilder();
    copyMetadataBuilder( source, result );
    return result;
  }
View Full Code Here

  }

  @Test
  public void checkCompoundServiceWhenContainingServiceWithNonuniqueName()
  {
    ServiceBuilder dupService = this.allService.addService( this.odapName, this.wcsType, this.wcsBaseUri );

    assertCompoundServiceAsExpected( 1 );

    assertEquals( dupService, this.allService.getServiceBuilders().get(3));
  }
View Full Code Here

  }

  @Test
  public void testAddGetRemoveServices() throws URISyntaxException
  {
    ServiceBuilder sb1 = this.allService.addService( "one", ServiceType.HTTPServer, new URI( "http://server/thredds/httpServer/") );
    ServiceBuilder sb2 = this.allService.addService( "two", ServiceType.HTTP, new URI( "http://server/thredds/two/") );

    assertCompoundServiceAsExpected( 2 );

    assertEquals( sb1, this.allService.getServiceBuilderByName( "one" ));
    assertEquals( sb2, this.allService.getServiceBuilderByName( "two" ));
View Full Code Here

  }

  @Test
  public void checkBuildIssuesOnCompoundServiceWhenContainingServiceWithNonuniqueName()
  {
    ServiceBuilder dupService = this.allService.addService( this.odapName, this.wcsType, this.wcsBaseUri );

    BuilderIssues issues = this.allService.getIssues();
    assertTrue( issues.toString(), issues.isValid() );
    assertFalse( issues.toString(), issues.isEmpty() );
  }
View Full Code Here

    if ( source == null )
      throw new IllegalArgumentException( "Source builder may not be null." );
    if ( builderFactory == null )
      throw new IllegalArgumentException( "Builder factory may not be null.");

    ThreddsMetadataBuilder result = builderFactory.newThreddsMetadataBuilder();
    copyThreddsMetadataBuilder( source, result );
    return result;
  }
View Full Code Here

  public static ThreddsMetadataBuilder mergeTwoThreddsMetadata( ThreddsMetadataBuilder first,
                                                                ThreddsMetadataBuilder second,
                                                                ThreddsBuilderFactory builderFactory )
  {
    ThreddsMetadataBuilder mergedResults = builderFactory.newThreddsMetadataBuilder();
    mergeTwoThreddsMetadata( first, second, mergedResults );
    return mergedResults;
  }
View Full Code Here

    try
    {
      XMLInputFactory factory = getFactory();
      XMLEventReader eventReader = factory.createXMLEventReader( source );

      ThreddsBuilderFactory catBuilderFac = new ThreddsBuilderFactoryImpl();
      ThreddsBuilder threddsBuilder = null;
      while ( eventReader.hasNext() )
      {
        XMLEvent event = eventReader.peek();
        if ( event.isEndDocument())
View Full Code Here

    }
    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

    {
      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

TOP

Related Classes of thredds.catalog2.xml.parser.ThreddsXmlParserIssue

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.