Package thredds.catalog

Examples of thredds.catalog.InvCatalogRef


    boolean isCatRef = (ds instanceof InvCatalogRef);
    boolean isDataScan = ds.findProperty("DatasetScan") != null;
    boolean skipScanChildren = skipDatasetScan && (ds instanceof InvCatalogRef) && isDataScan;

    if (isCatRef) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      if (out != null)
        out.println(" **CATREF " + catref.getURI() + " (" + ds.getName() + ") ");
      countCatrefs++;

      if (!listen.getCatalogRef( catref, context)) {
        if (release) catref.release();
        return;
      }
    }

    if (!isCatRef || skipScanChildren || isDataScan)
      listen.getDataset(ds, context);

    // recurse - depth first
    if (!skipScanChildren) {
      List<InvDataset> dlist = ds.getDatasets();
      if (isCatRef) {
        InvCatalogRef catref = (InvCatalogRef) ds;
        if (!isDataScan) {
          listen.getDataset(catref.getProxyDataset(), context); // wait till a catref is read, so all metadata is there !
        }
      }

      for (InvDataset dds : dlist) {
        crawlDataset(dds, task, out, context, release);
        if ((task != null) && task.isCancel())
          break;
      }
    }

    if (isCatRef && release) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      catref.release();
    }

  }
View Full Code Here


  public void crawlDirectDatasets(InvDataset ds, CancelTask task, PrintStream out, Object context, boolean release) {
    boolean isCatRef = (ds instanceof InvCatalogRef);
    boolean skipScanChildren = skipDatasetScan && (ds instanceof InvCatalogRef) && (ds.findProperty("DatasetScan") != null);

    if (isCatRef) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      if (out != null)
        out.println(" **CATREF " + catref.getURI() + " (" + ds.getName() + ") ");
      countCatrefs++;
     
      if (!listen.getCatalogRef( catref, context)) {
        if (release) catref.release();
        return;
      }
    }

    // get datasets with data access ("leaves")
    List<InvDataset> dlist = ds.getDatasets();
    List<InvDataset> leaves = new ArrayList<InvDataset>();
    for (InvDataset dds : dlist) {
      if (dds.hasAccess())
        leaves.add(dds);
    }

    if (leaves.size() > 0) {
      if (type == USE_FIRST_DIRECT) {
        InvDataset dds = (InvDataset) leaves.get(0);
        listen.getDataset(dds, context);

      } else if (type == USE_RANDOM_DIRECT) {
        listen.getDataset(chooseRandom(leaves), context);

      } else if (type == USE_RANDOM_DIRECT_NOT_FIRST_OR_LAST) {
        listen.getDataset(chooseRandomNotFirstOrLast(leaves), context);

      } else { // do all of them
        for (InvDataset dds : leaves) {
          listen.getDataset(dds, context);
          if ((task != null) && task.isCancel()) break;
        }
      }
    }

    // recurse
    if (!skipScanChildren) {
      for (InvDataset dds : dlist) {
        if (dds.hasNestedDatasets())
          crawlDirectDatasets(dds, task, out, context, release);
        if ((task != null) && task.isCancel())
          break;
      }
    }

    /* if (out != null) {
     int took = (int) (System.currentTimeMillis() - start);
     out.println(" ** " + ds.getName() + " took " + took + " msecs\n");
   } */

    if (ds instanceof InvCatalogRef && release) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      catref.release();
    }

  }
View Full Code Here

    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);
                }
View Full Code Here

TOP

Related Classes of thredds.catalog.InvCatalogRef

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.