Confluence will be unusable 23-July-2024 at 06:00 due to a Crowd upgrade.
The code below (run against DEV) constructs a DataCatClient object and uses it to query DIGI and RECON files from the L1Proc folder, recursively. It currently returns 332 datasets. I then loop over the datasets and print their index in the list, their name, and their site/location information.
The Dataset object is a simple wrapper around the information in a dataset record:
public interface Dataset { public String getName(); public String getDataType(); public String getFileFormat(); public Set<String> getSites(); public String getLocation(String site); }
A dataset record in the database actually has more fields than this but they are not yet filled. When they are (soon) this interface will be expanded.
Here's the sample code:
DataCatClient client; try { client = new DataCatClient(DataCatConnectionManager.DatabaseServerAlias.DEV); System.out.println("getting datasets..."); List<Dataset> dsList = client.getDatasets("/L1Proc/*", "DataType == \"DIGI\" || DataType == \"RECON\""); System.out.println("got datasets..."); long i=1; System.out.println("Query returned " + dsList.size() + " dataset entries..."); for (Dataset ds : dsList) { System.out.println(i+\+ + " " + ds.getName() + ":"); for (String site : ds.getSites()) System.out.println("\t" + site + ": \t" + ds.getLocation(site)); } } catch (SQLException ex) { System.out.println("Couldn't connect"); ex.printStackTrace(); System.exit(0); }