/** * Create an InvCatalog by reading catalog XML from a String. * * Failures and exceptions are handled by causing validate() to * fail. Therefore, be sure to call validate() before trying to use * the InvCatalog object. * * @param catAsString : the String from which to read the catalog. * @param baseUri : the base URI of the document, used for resolving reletive references. * @return an InvCatalogImpl object */ public InvCatalogImpl readXML( String catAsString, URI baseUri ) { return readXML( new StringReader( catAsString ), baseUri ); }
/** * Create an InvCatalog by reading catalog XML from a String. * * Failures and exceptions are handled by causing validate() to * fail. Therefore, be sure to call validate() before trying to use * the InvCatalog object. * * @param catAsString : the String from which to read the catalog. * @param baseUri : the base URI of the document, used for resolving reletive references. * @return an InvCatalogImpl object */ public InvCatalogImpl readXML( String catAsString, URI baseUri ) { return readXML( new StringReader( catAsString ), baseUri ); }
/** * Create an InvCatalog by reading catalog XML from a String. * * Failures and exceptions are handled by causing validate() to * fail. Therefore, be sure to call validate() before trying to use * the InvCatalog object. * * @param catAsString : the String from which to read the catalog. * @param baseUri : the base URI of the document, used for resolving reletive references. * @return an InvCatalogImpl object */ public InvCatalogImpl readXML( String catAsString, URI baseUri ) { return readXML( new StringReader( catAsString ), baseUri ); }
/** * This allows the possibility of reading a catalog in another thread. The default * implementation does not do that, but a subclass may override and implement. * If the catalog is read successfully, it is passed on to the callback. * * @param uriString : read this catalog. * @param callback : call this if successfully read. * @see CatalogSetCallback */ public void readXMLasynch(String uriString, CatalogSetCallback callback) { InvCatalogImpl cat = readXML(uriString); callback.setCatalog(cat); }
/** * This allows the possibility of reading a catalog in another thread. The default * implementation does not do that, but a subclass may override and implement. * If the catalog is read successfully, it is passed on to the callback. * * @param uriString : read this catalog. * @param callback : call this if successfully read. * @see CatalogSetCallback */ public void readXMLasynch(String uriString, CatalogSetCallback callback) { InvCatalogImpl cat = readXML(uriString); callback.setCatalog(cat); }
/** * This allows the possibility of reading a catalog in another thread. The default * implementation does not do that, but a subclass may override and implement. * If the catalog is read successfully, it is passed on to the callback. * * @param uriString : read this catalog. * @param callback : call this if successfully read. * @see CatalogSetCallback */ public void readXMLasynch(String uriString, CatalogSetCallback callback) { InvCatalogImpl cat = readXML(uriString); callback.setCatalog(cat); }
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(); } }
public static List<InvDataset> getCatalogDatasets(InputStream catalogIS, URI catalogBaseUri) { final InvCatalogFactory factory = InvCatalogFactory.getDefaultFactory(true); final InvCatalogImpl catalog = factory.readXML(catalogIS, catalogBaseUri); return catalog.getDatasets(); }
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(); 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 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 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(); } }
/** * Constructs the CatalogGen for the given config document. * * @param configDocURL - the URL of the configuration document */ public CatalogGen( URL configDocURL) { // Create a InvCatalogFactory with CATALOG_GEN_CONFIG MetadataType registered. log.debug( "CatalogGen(URL): create catalog and CatalogGenConfig converter." ); this.catFactory = InvCatalogFactory.getDefaultFactory( true ); this.catFactory.registerMetadataConverter( MetadataType.CATALOG_GEN_CONFIG.toString(), new CatGenConfigMetadataFactory()); // Read the given XML config file. log.debug( "CatalogGen(URL): reading the config doc <" + configDocURL.toString() + ">."); this.catalog = this.catFactory.readXML( configDocURL.toString()); log.debug( "CatalogGen(URL): done."); }
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(); } }
/** * Constructs the CatalogGen for the given config document. * * @param configDocURL - the URL of the configuration document */ public CatalogGen( URL configDocURL) { // Create a InvCatalogFactory with CATALOG_GEN_CONFIG MetadataType registered. log.debug( "CatalogGen(URL): create catalog and CatalogGenConfig converter." ); this.catFactory = InvCatalogFactory.getDefaultFactory( true ); this.catFactory.registerMetadataConverter( MetadataType.CATALOG_GEN_CONFIG.toString(), new CatGenConfigMetadataFactory()); // Read the given XML config file. log.debug( "CatalogGen(URL): reading the config doc <" + configDocURL.toString() + ">."); this.catalog = this.catFactory.readXML( configDocURL.toString()); log.debug( "CatalogGen(URL): done."); }
/** * Constructs the CatalogGen for the given config document InputStream. * * @param configDocInputStream - the InputStream from which to read the config document. * @param configDocURL - the URL for the config document. */ public CatalogGen( InputStream configDocInputStream, URL configDocURL ) { // Create a InvCatalogFactory with CATALOG_GEN_CONFIG MetadataType registered. log.debug( "CatalogGen(InputStream): create catalog and CatalogGenConfig converter." ); this.catFactory = new InvCatalogFactory( "default", true ); this.catFactory.registerMetadataConverter( MetadataType.CATALOG_GEN_CONFIG.toString(), new CatGenConfigMetadataFactory() ); // Read the given XML config file. log.debug( "CatalogGen(InputStream): reading the config doc <" + configDocURL.toString() + ">." ); this.catalog = this.catFactory.readXML( configDocInputStream, URI.create( configDocURL.toExternalForm()) ); log.debug( "CatalogGen(InputStream): CatalogGenConfig doc <" + this.catalog.getName() + "> read."); }