/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getName()) result = 37 * result + getName().hashCode(); result = 37 * result + getServices().hashCode(); result = 37 * result + getDatasets().hashCode(); hashCode = result; } return hashCode; }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getName()) result = 37 * result + getName().hashCode(); result = 37 * result + getServices().hashCode(); result = 37 * result + getDatasets().hashCode(); hashCode = result; } return hashCode; }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getName()) result = 37 * result + getName().hashCode(); result = 37 * result + getServices().hashCode(); result = 37 * result + getDatasets().hashCode(); hashCode = result; } return hashCode; }
/** * Debugging: dump entire data structure. * * @return String representation. */ public String dump() { StringBuilder buff = new StringBuilder(1000); buff.setLength(0); buff.append("Catalog <").append(getName()) .append("> <").append(getVersion()) .append("> <").append(getCreateFrom()).append(">\n"); buff.append(topDataset.dump(2)); return buff.toString(); }
/** * Debugging: dump entire data structure. * * @return String representation. */ public String dump() { StringBuilder buff = new StringBuilder(1000); buff.setLength(0); buff.append("Catalog <").append(getName()) .append("> <").append(getVersion()) .append("> <").append(getCreateFrom()).append(">\n"); buff.append(topDataset.dump(2)); return buff.toString(); }
/** * Debugging: dump entire data structure. * * @return String representation. */ public String dump() { StringBuilder buff = new StringBuilder(1000); buff.setLength(0); buff.append("Catalog <").append(getName()) .append("> <").append(getVersion()) .append("> <").append(getCreateFrom()).append(">\n"); buff.append(topDataset.dump(2)); return buff.toString(); }
private static InvCatalogImpl doOne(InvCatalogFactory fac, String urlString, boolean show) { System.out.println("***read " + urlString); if (show) System.out.println(" original catalog=\n" + IO.readURLcontents(urlString)); try { InvCatalogImpl cat = fac.readXML(new URI(urlString)); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); System.out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // if (show) System.out.println(" parsed catalog=\n" + fac.writeXML(cat)); //System.out.println(" -----\n"+cat.dump()); return cat; } catch (Exception e) { e.printStackTrace(); return null; } }
private static InvCatalogImpl doOne(InvCatalogFactory fac, String urlString, boolean show) { System.out.println("***read " + urlString); if (show) System.out.println(" original catalog=\n" + IO.readURLcontents(urlString)); try { InvCatalogImpl cat = fac.readXML(new URI(urlString)); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); System.out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // if (show) System.out.println(" parsed catalog=\n" + fac.writeXML(cat)); //System.out.println(" -----\n"+cat.dump()); return cat; } catch (Exception e) { e.printStackTrace(); return null; } }
private static InvCatalogImpl doOne(InvCatalogFactory fac, String urlString, boolean show) { System.out.println("***read " + urlString); if (show) System.out.println(" original catalog=\n" + IO.readURLcontents(urlString)); try { InvCatalogImpl cat = fac.readXML(new URI(urlString)); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); System.out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // if (show) System.out.println(" parsed catalog=\n" + fac.writeXML(cat)); //System.out.println(" -----\n"+cat.dump()); return cat; } catch (Exception e) { e.printStackTrace(); return null; } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); ADNWriter w = new ADNWriter(); StringBuffer sbuff = new StringBuffer(); w.writeDatasetEntries( cat, "C:/temp/adn3", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); DCWriter w = new DCWriter( cat); w.writeItems( "C:/temp/dif"); } catch (Exception e) { e.printStackTrace(); } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); ADNWriter w = new ADNWriter(); StringBuilder sbuff = new StringBuilder(); w.writeDatasetEntries( cat, "C:/temp/adn3", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
private static void doCatalog( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); System.out.println(" catalog=\n" + fac.writeXML(cat)); DIFWriter w = new DIFWriter(); StringBuilder sbuff = new StringBuilder(); w.writeDatasetEntries( cat, "C:/temp/dif2", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); ADNWriter w = new ADNWriter(); StringBuilder sbuff = new StringBuilder(); w.writeDatasetEntries( cat, "C:/temp/adn3", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
private static void doCatalog( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); System.out.println(" catalog=\n" + fac.writeXML(cat)); DIFWriter w = new DIFWriter(); StringBuilder sbuff = new StringBuilder(); w.writeDatasetEntries( cat, "C:/temp/dif2", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = (InvCatalogImpl) fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); DCWriter w = new DCWriter( cat); w.writeItems( "C:/temp/dif"); } catch (Exception e) { e.printStackTrace(); } }
private static void doOne( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); // System.out.println(" catalog=\n" + fac.writeXML(cat)); DCWriter w = new DCWriter( cat); w.writeItems( "C:/temp/dif"); } catch (Exception e) { e.printStackTrace(); } }
private static void doCatalog( InvCatalogFactory fac, String url) { System.out.println("***read "+url); try { InvCatalogImpl cat = fac.readXML(url); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check( buff, false); System.out.println("catalog <" + cat.getName()+ "> "+ (isValid ? "is" : "is not") + " valid"); System.out.println(" validation output=\n" + buff); System.out.println(" catalog=\n" + fac.writeXML(cat)); DIFWriter w = new DIFWriter(); StringBuffer sbuff = new StringBuffer(); w.writeDatasetEntries( cat, "C:/temp/dif2", sbuff); System.out.println(" messages=\n"+sbuff); } catch (Exception e) { e.printStackTrace(); } }
/** * Open a catalog and crawl (depth first) all the datasets in it. * Close catalogs and release their resources as you. * * @param catUrl url of catalog to open * @param task user can cancel the task (may be null) * @param out send status messages to here (may be null) * @param context caller can pass this object in (used for thread safety) * @return number of catalog references opened and crawled */ public int crawl(String catUrl, CancelTask task, PrintStream out, Object context) { InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true); InvCatalogImpl cat = catFactory.readXML(catUrl); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); if (out != null) { out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); out.println(" validation output=\n" + buff); } if (isValid) return crawl(cat, task, out, context); return 0; }
/** * Open a catalog and crawl (depth first) all the datasets in it. * Close catalogs and release their resources as you. * * @param catUrl url of catalog to open * @param task user can cancel the task (may be null) * @param out send status messages to here (may be null) * @param context caller can pass this object in (used for thread safety) * @return number of catalog references opened and crawled */ public int crawl(String catUrl, CancelTask task, PrintStream out, Object context) { InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true); InvCatalogImpl cat = catFactory.readXML(catUrl); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); if (out != null) { out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); out.println(" validation output=\n" + buff); } if (isValid) return crawl(cat, task, out, context); return 0; }