Package thredds.crawlabledataset

Examples of thredds.crawlabledataset.CrawlableDataset


    TestFileDirUtils.addFile( gfs211Dir, "2004050312_gfs_211.nc" );
    TestFileDirUtils.addFile( gfs211Dir, "2004050318_gfs_211.nc" );


    File catWriteDir = new File( tmpDir, "catWriteDir");
    CrawlableDataset collectionCrDs = new CrawlableDatasetFile( tmpDir );
    InvService service = new InvService( "myServer", "File", collectionCrDs.getPath() + "/", null, null );
    CrawlableDatasetFilter filter = null;
    CrawlableDataset topCatCrDs = collectionCrDs.getDescendant( startPath );

    CatGenAndWrite cgaw = null;
    try
    {
      cgaw = new CatGenAndWrite( "DATA", "My data", "", service,
                                 collectionCrDs, topCatCrDs, filter, null, catWriteDir );
    }
    catch ( IllegalArgumentException e )
    {
      fail( "Bad argument: " + e.getMessage() );
      return;
    }

    try
    {
      cgaw.genAndWriteCatalogTree();
    }
    catch ( IOException e )
    {
      fail( "I/O error generating and writing catalogs at and under \"" + topCatCrDs.getPath() + "\": " + e.getMessage() );
      return;
    }

    crawlCatalogs( new File( new File( catWriteDir, startPath), "catalog.xml") );
  }
View Full Code Here


    TestFileDirUtils.addFile( gfs211Dir, "2004050312_gfs_211.nc" );
    TestFileDirUtils.addFile( gfs211Dir, "2004050318_gfs_211.nc" );


    File catWriteDir = new File( tmpDir, "catWriteDir" );
    CrawlableDataset collectionCrDs = new CrawlableDatasetFile( tmpDir );

    InvService service = new InvService( "myServer", "OPeNDAP", "/thredds/dodsC/", null, null );
    CrawlableDatasetFilter filter = null;
    CrawlableDataset topCatCrDs = collectionCrDs.getDescendant( startPath );

    CatGenAndWrite cgaw = null;
    try
    {
      cgaw = new CatGenAndWrite( "DATA", "My data", "tdr", service,
                                 collectionCrDs, topCatCrDs, filter, null, catWriteDir );
    }
    catch ( IllegalArgumentException e )
    {
      fail( "Bad argument: " + e.getMessage() );
      return;
    }

    try
    {
      cgaw.genAndWriteCatalogTree();
    }
    catch ( IOException e )
    {
      fail( "I/O error generating and writing catalogs at and under \"" + topCatCrDs.getPath() + "\": " + e.getMessage() );
      return;
    }

    crawlCatalogs( new File( new File( catWriteDir, startPath), "catalog.xml") );
  }
View Full Code Here

                    .getInstanceToMatchOnDatasetName(
                            matchPattern, substitutionPattern, duration );
    assertTrue( timeCoverageEnhancer != null );

    InvDatasetImpl ds = new InvDatasetImpl( null, dsName );
    CrawlableDataset crDs = new MockCrawlableDataset( dsName, false );

    assertTrue( "Failed to add metadata.",
                timeCoverageEnhancer.addMetadata( ds, crDs ));
  }
View Full Code Here

                    .getInstanceToMatchOnDatasetName(
                            matchPattern, substitutionPattern, duration );
    assertTrue( timeCoverageEnhancer != null );

    InvDatasetImpl ds = new InvDatasetImpl( null, dsName );
    CrawlableDataset crDs = new MockCrawlableDataset( dsName, false );

    assertTrue( "Unexpected success adding metadata.",
                ! timeCoverageEnhancer.addMetadata( ds, crDs ));
  }
View Full Code Here

                    .getInstanceToMatchOnDatasetPath(
                            matchPattern, substitutionPattern, duration );
    assertTrue( timeCoverageEnhancer != null );

    InvDatasetImpl ds = new InvDatasetImpl( null, dsName );
    CrawlableDataset crDs = new MockCrawlableDataset( dsName, false );

    assertTrue( "Failed to add metadata.",
                timeCoverageEnhancer.addMetadata( ds, crDs ) );

    // This dataset hasn't been finalized so ds.getTimeCoverage() doesn't work.
View Full Code Here

    File dataDirFile = new File( dataDir );
    InvService service = new InvService( this.serviceId, this.serviceType.toString(), this.serviceBase, null, null );
    DirectoryScanner me = new DirectoryScanner( service, this.serviceTitle, new File( dataDirHeader ), null, true );
    assertTrue( me != null );

    CrawlableDataset catalogCrDs;
    try
    {
      catalogCrDs = CrawlableDatasetFactory.createCrawlableDataset( dataDirFile.getAbsolutePath(), null, null );
    }
    catch ( ClassNotFoundException e )
    {
      throw new IllegalArgumentException( "Did not find class: " + e.getMessage() );
    }
    catch ( NoSuchMethodException e )
    {
      throw new IllegalArgumentException( "Required constructor not found in class: " + e.getMessage() );
    }
    catch ( IllegalAccessException e )
    {
      throw new IllegalArgumentException( "Did not have necessary access to class: " + e.getMessage() );
    }
    catch ( InvocationTargetException e )
    {
      throw new IllegalArgumentException( "Could not invoke required method in class: " + e.getMessage() );
    }
    catch ( InstantiationException e )
    {
      throw new IllegalArgumentException( "Could not instatiate class: " + e.getMessage() );
    }
    if ( ! catalogCrDs.isCollection() )
      throw new IllegalArgumentException( "catalog directory is not a directory <" + dataDir + ">." );

    InvCatalog catalog = me.getDirCatalog( catalogCrDs, ".*", true, "idBase", false, null, null, null);

    // Compare the resulting catalog an the expected catalog resource.
View Full Code Here

    File dataDirFile = new File( dataDir );
    InvService service = new InvService( this.serviceId, this.serviceType.toString(), this.serviceBase, null, null );
    DirectoryScanner me = new DirectoryScanner( service, this.serviceTitle, new File( dataDirHeader ), null, true );
    assertTrue( me != null );

    CrawlableDataset catalogCrDs;
    try
    {
      catalogCrDs = CrawlableDatasetFactory.createCrawlableDataset( dataDirFile.getAbsolutePath(), null, null );
    }
    catch ( ClassNotFoundException e )
    {
      throw new IllegalArgumentException( "Did not find class: " + e.getMessage() );
    }
    catch ( NoSuchMethodException e )
    {
      throw new IllegalArgumentException( "Required constructor not found in class: " + e.getMessage() );
    }
    catch ( IllegalAccessException e )
    {
      throw new IllegalArgumentException( "Did not have necessary access to class: " + e.getMessage() );
    }
    catch ( InvocationTargetException e )
    {
      throw new IllegalArgumentException( "Could not invoke required method in class: " + e.getMessage() );
    }
    catch ( InstantiationException e )
    {
      throw new IllegalArgumentException( "Could not instatiate class: " + e.getMessage() );
    }
    if ( ! catalogCrDs.isCollection() )
      throw new IllegalArgumentException( "catalog directory is not a directory <" + dataDir + ">." );

    InvCatalog catalog = me.getDirCatalog( catalogCrDs, ".*", true, "idBase", false, null, null, null);

    // Compare the resulting catalog an the expected catalog resource.
View Full Code Here

  public void testBasic() throws IOException
  {
    String collectionPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat";
    String catalogPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat/eta_211";

    CrawlableDataset collectionCrDs = null;
    try
    {
      collectionCrDs = CrawlableDatasetFactory.createCrawlableDataset( collectionPath, null, null );
    }
    catch ( Exception e )
    {
      assertTrue( "Failed to create collection level dataset <" + collectionPath + ">: " + e.getMessage(),
                  false );
      return;
    }

    SimpleCatalogBuilder builder = new SimpleCatalogBuilder( "", collectionCrDs, "server", "OPENDAP", "http://my.server/opendap/" );
    assertTrue( "SimpleCatalogBuilder is null.",
                builder != null );

    CrawlableDataset catalogCrDs = null;
    try
    {
      catalogCrDs = CrawlableDatasetFactory.createCrawlableDataset( catalogPath, null, null );
    }
    catch ( Exception e )
View Full Code Here

    String resultResourceName = resourcePath + "/" + resource_simpleWithEmptyServiceBase_result;
    File expectedCatalogDocFile = new File( resultResourceName );

    String collectionPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat";
    String catalogPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat/eta_211";
    CrawlableDataset collCrDs;
    CrawlableDataset catCrDs;
    try
    {
      collCrDs = CrawlableDatasetFactory.createCrawlableDataset( collectionPath, null, null );
      catCrDs = CrawlableDatasetFactory.createCrawlableDataset( catalogPath, null, null );
    }
View Full Code Here

    String resultResourceName = resourcePath + "/" + resource_simpleWithNotEmptyServiceBase_result;
    File expectedCatalogDocFile = new File( resultResourceName );

    String collectionPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat";
    String catalogPath = "src/test/data/thredds/cataloggen/testData/modelNotFlat/eta_211";
    CrawlableDataset collCrDs;
    CrawlableDataset catCrDs;
    try
    {
      collCrDs = CrawlableDatasetFactory.createCrawlableDataset( collectionPath, null, null );
      catCrDs = CrawlableDatasetFactory.createCrawlableDataset( catalogPath, null, null );
    }
View Full Code Here

TOP

Related Classes of thredds.crawlabledataset.CrawlableDataset

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.