public class CatalogCrawler
extends java.lang.Object
CatalogCrawler.Listener listener = new CatalogCrawler.Listener() { public void getDataset(InvDataset dd) { if (dd.isHarvest()) doHarvest(dd); } }; CatalogCrawler crawler = new CatalogCrawler( CatalogCrawler.USE_ALL_DIRECT, false, listener);
Modifier and Type | Class and Description |
---|---|
static interface |
CatalogCrawler.Filter |
static interface |
CatalogCrawler.Listener |
static class |
CatalogCrawler.Type |
Modifier and Type | Field and Description |
---|---|
static int |
USE_ALL |
static int |
USE_ALL_DIRECT |
static int |
USE_FIRST_DIRECT |
static int |
USE_RANDOM_DIRECT |
static int |
USE_RANDOM_DIRECT_NOT_FIRST_OR_LAST |
Constructor and Description |
---|
CatalogCrawler(CatalogCrawler.Type type,
CatalogCrawler.Filter filter,
CatalogCrawler.Listener listen)
Constructor.
|
CatalogCrawler(int type,
boolean skipDatasetScan,
CatalogCrawler.Listener listen)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
crawl(InvCatalogImpl cat,
CancelTask task,
java.io.PrintWriter out,
java.lang.Object context)
Crawl a catalog thats already been opened.
|
int |
crawl(java.lang.String catUrl,
CancelTask task,
java.io.PrintWriter out,
java.lang.Object context)
Open a catalog and crawl (depth first) all the datasets in it.
|
void |
crawlDataset(InvDataset ds,
CancelTask task,
java.io.PrintWriter out,
java.lang.Object context,
boolean release)
Crawl this dataset recursively, return all datasets
|
void |
crawlDirectDatasets(InvDataset ds,
CancelTask task,
java.io.PrintWriter out,
java.lang.Object context,
boolean release)
Crawl this dataset recursively.
|
public static final int USE_ALL
public static final int USE_ALL_DIRECT
public static final int USE_FIRST_DIRECT
public static final int USE_RANDOM_DIRECT
public static final int USE_RANDOM_DIRECT_NOT_FIRST_OR_LAST
public CatalogCrawler(int type, boolean skipDatasetScan, CatalogCrawler.Listener listen)
type
- CatalogCrawler.USE_XXX constant: When you get to a dataset containing leaf datasets,
do all, only the first, or a randomly chosen one.skipDatasetScan
- if true, dont recurse into DatasetScan elements. This is
useful if you are looking only for collection level metadata.listen
- this is called for each dataset.public CatalogCrawler(CatalogCrawler.Type type, CatalogCrawler.Filter filter, CatalogCrawler.Listener listen)
type
- CatalogCrawler.Typefilter
- dont process this dataset or its descendants. may be nulllisten
- each dataset gets passed to the listenerpublic int crawl(java.lang.String catUrl, CancelTask task, java.io.PrintWriter out, java.lang.Object context)
catUrl
- url of catalog to opentask
- user can cancel the task (may be null)out
- send status messages to here (may be null)context
- caller can pass this object in (used for thread safety)public int crawl(InvCatalogImpl cat, CancelTask task, java.io.PrintWriter out, java.lang.Object context)
cat
- the catalogtask
- user can cancel the task (may be null)out
- send status messages to here (may be null)context
- caller can pass this object in (used for thread safety)public void crawlDataset(InvDataset ds, CancelTask task, java.io.PrintWriter out, java.lang.Object context, boolean release)
ds
- the datasettask
- user can cancel the task (may be null)out
- send status messages to here (may be null)context
- caller can pass this object in (used for thread safety)public void crawlDirectDatasets(InvDataset ds, CancelTask task, java.io.PrintWriter out, java.lang.Object context, boolean release)
ds
- the datasettask
- user can cancel the task (may be null)out
- send status messages to here (may be null)context
- caller can pass this object in (used for thread safety)