/** * Get the list of urls from the remote server * * @return List of urls */ public List getDataPaths() { List paths = new ArrayList(); AddeSoundingAdapter asa = (AddeSoundingAdapter) getRDS().getSoundingAdapter(); List obs = getRDS().getSoundingObs(); for (int i = 0; i < obs.size(); i++) { SoundingOb ob = (SoundingOb) obs.get(i); if (ob.getMandatoryFile() != null) { // file based paths.add(ob.getMandatoryFile()); paths.add(ob.getSigFile()); } else { paths.add(asa.getMandatoryURL(ob)); paths.add(asa.getSigURL(ob)); } } return paths; }
/** * _Save the remote data to local disk * * @param prefix Where to write the files to * @param loadId For the JobManager dialog * @param changeLinks Should we change the internal data references * @return List of files we wrote * @throws Exception On badness */ protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) throws Exception { List urls = new ArrayList(); List obs = getRDS().getSoundingObs(); AddeSoundingAdapter asa = (AddeSoundingAdapter) getRDS().getSoundingAdapter(); for (int i = 0; i < obs.size(); i++) { SoundingOb ob = (SoundingOb) obs.get(i); urls.add(asa.getMandatoryURL(ob) + "&rawstream=true"); urls.add(asa.getSigURL(ob) + "&rawstream=true"); } List newFiles = IOUtil.writeTo(urls, prefix, "raob", loadId); if (newFiles == null) { return null; } if (changeLinks) { for (int i = 0; i < newFiles.size(); i += 2) { SoundingOb ob = (SoundingOb) obs.get(i / 2); ob.setMandatoryFile(newFiles.get(i).toString()); ob.setSigFile(newFiles.get(i + 1).toString()); } } return newFiles; }