[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 thredds questions





Anne Wilson wrote:
Hi John,

I'm opening an existing catalog and adding a new dataset (i.e., adding it right in, not a catref). Should I be able to add a service to that catalog as well? In an arbitrary order?

you may need to add the service elements before you construct the dataset that uses them.

I say that because my code is
adding the dataset to the catalog, but not the additional service element and it's components are not showing up. There's some [prototype-quality] code below.

Also, could you point me to the few lines of code that make an http call that you were referring to in our meeting yesterday? I searched for httpget and found thredds.util.net.EasySSLProtocolSocketFactory, but that doesn't look right. Would you point me to the right code?

have a look at thredds.util.IO.readURLtoFileWithExceptions()


Anne -----------

// This is in the class ThreddsCataloger
...
private InvCatalogImpl catalog = null; // XML acquired in the constructor
...


public void catalog(String name, ThreddsMetadata metadata, User user) {
//ADD: metadata instanceof ThreddsMetadata
//ADD: use name to locate appropriate catalog in the hierarchy
logger.debug("name: " + name);
logger.debug("metadataLogicalName: " + metadata.getLogicalName());
// set dataset elements
InvDatasetImpl dataset = (InvDatasetImpl) metadata.exportNativeMetadata();
logger.debug("dataset FullName: " + dataset.getFullName());
logger.debug("dataset ID: " + dataset.getID());
logger.debug("dataset Name: " + dataset.getName());
dataset.setServiceName("all"); // TODO: is "all" correct here?
logger.debug("dataset ServiceName is \"all\"");
dataset.setDataType(DataType.GRID);
logger.debug("dataset DataType is DataType.GRID");
//TODO: build this path rather than hard coding it
dataset.setUrlPath(dataset.getName());
logger.debug("datatset urlPath: " + dataset.getName());
// Set catalog elements
String serviceName = "all";
String serviceType = "DODS";
String base = "This is a test"; // this string just for debugging
String suffix = "";
String desc = "";
InvService service = new InvService(serviceName, serviceType, base, suffix, desc);
catalog.addService(service);
catalog.addDataset(dataset);
logger.debug("added catalog named: " + catalog.getName());
save(); }


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.