Package thredds.catalog

Examples of thredds.catalog.InvCatalogImpl


  }

  private void crawlCatalogs( File topCatalogFile)
  {
    InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false);
    InvCatalogImpl topCatalog = fac.readXML( topCatalogFile.toURI() );

    //topCatalog.g
    // TODO actually test something
  }
View Full Code Here


    OutputStream os = new BufferedOutputStream( new FileOutputStream( tmpCatalogWriteReadFile ) );
    factory.writeXML( (InvCatalogImpl) this.me.getCatalog(), os);
    os.close();

    InputStream is = new BufferedInputStream( new FileInputStream( tmpCatalogWriteReadFile ) );
    InvCatalogImpl justWrittenCatalog = factory.readXML( is, tmpCatalogWriteReadFile.toURI() );
    is.close();

    // Test that the expanded catalog is the same as the expanded catalog after
    // writing it to and then reading it from a file. (Tests that writing works!)
    assertTrue( "Expanded catalog does not equal the expected catalog after writing to and reading from a file.",
View Full Code Here

    }
    InputStream expectedCatalogInputStream = expectedCatalogURIName.getClass().getResourceAsStream( expectedCatalogResourceName );

    // Read in expected result catalog.
    InvCatalogFactory factory = new InvCatalogFactory( "default", true );
    InvCatalogImpl expectedCatalog = factory.readXML( expectedCatalogInputStream, expectedCatalogURI);

    // Close the CatalogGenConf and the expected catalog InputStreams.
    try
    {
      expectedCatalogInputStream.close();
View Full Code Here

    InputStream expectedCatalogInputStream = new FileInputStream( expectedCatalogDocFile);

    // Read in expected result catalog.
    InvCatalogFactory factory = new InvCatalogFactory( "default", true );
    InvCatalogImpl expectedCatalog = factory.readXML( expectedCatalogInputStream, expectedCatalogDocFile.toURI());

    expectedCatalogInputStream.close();

    if ( display )
    {
View Full Code Here

      }
    }

    File catFile = new File( catWriteDir, "catalog.xml" );

    InvCatalogImpl cat = catBuilder.generateCatalog( catCrDs );

    factory.writeXML( cat, catFile.getAbsolutePath());

    // Find child datasets that are collections and generate catalogs for those as well.
    List collectionChildren = catCrDs.listDatasets( collectionOnlyFilter);
View Full Code Here

      fail( "URISyntaxException: " + e.getMessage() );
      return;
    }

    InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false );
    InvCatalogImpl cat = fac.readXML( catAsString.toString(), catURI );

    InvDatasetImpl ds = (InvDatasetImpl) cat.getDatasets().get( 0 );
    double d = ds.getDataSize();

    fac.writeXML(cat, System.out);
    assertTrue( "Size of data <" + d + "> not as expected <" + sizeBytes + ">.", Misc.closeEnough(d, sizeBytes));
  }
View Full Code Here

   * @param context caller can pass this object in (used for thread safety)
   * @return number of catalog references opened and crawled
   */
  public int crawl(String catUrl, CancelTask task, PrintStream out, Object context) {
    InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true);
    InvCatalogImpl cat = catFactory.readXML(catUrl);
    StringBuilder buff = new StringBuilder();
    boolean isValid = cat.check(buff, false);

    if (out != null) {
      out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid");
      out.println(" validation output=\n" + buff);
    }
    if (isValid)
      return crawl(cat, task, out, context);
    return 0;
View Full Code Here

      System.exit(1);
    }

    URI catalogURI = new URI(args[0]);
    InvCatalogFactory factory = new InvCatalogFactory("default", true);
    InvCatalogImpl catalog = (InvCatalogImpl) factory.readXML( catalogURI);
    StringBuilder buff = new StringBuilder();
    if (!catalog.check( buff)) {
         logger.error("Invalid catalog <'{}'> \n {}",
             catalogURI, buff.toString());
    } else {
      logger.info("Good, no error found!");
    }
View Full Code Here

    } catch (URISyntaxException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    InvCatalogImpl catalog = (InvCatalogImpl) factory.readXML(cataURI);
    final StringBuilder buff = new StringBuilder();
    if (catalog.check(buff)) {

      for (String cata : catalogList) {
        // create
        InvCatalogRef ref = new InvCatalogRef(null,
            cata.substring(0, cata.lastIndexOf('.')), "1/"+ cata);
                catalog.removeDataset(ref);
                if ((args.length < 3) || (!args[2].equals("remove"))) {
                    catalog.addDataset(ref);
                }
      }
      catalog.finish();

    } else {
      throw new Exception(buff.toString());
    }
View Full Code Here

TOP

Related Classes of thredds.catalog.InvCatalogImpl

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.