/** * Write the InvCatalogImpl to the OutputStream as a InvCatalog 1.0 document. * * @param catalog - the catalog to be written * @param os - the OutputStream to write to * @throws IOException when the OutputStream can't be written * @throws IllegalStateException when the factory doesn't know how to write a 1.0 document. */ public void writeXML(InvCatalogImpl catalog, OutputStream os) throws IOException { writeXML(catalog, os, false); }
/** * Write the InvCatalogImpl to the OutputStream as a InvCatalog 1.0 document. * * @param catalog - the catalog to be written * @param os - the OutputStream to write to * @throws IOException when the OutputStream can't be written * @throws IllegalStateException when the factory doesn't know how to write a 1.0 document. */ public void writeXML(InvCatalogImpl catalog, OutputStream os) throws IOException { writeXML(catalog, os, false); }
/** * Write the InvCatalogImpl to the OutputStream as a InvCatalog 1.0 document. * * @param catalog - the catalog to be written * @param os - the OutputStream to write to * @throws IOException when the OutputStream can't be written * @throws IllegalStateException when the factory doesn't know how to write a 1.0 document. */ public void writeXML(InvCatalogImpl catalog, OutputStream os) throws IOException { writeXML(catalog, os, false); }
/** * Write the catalog as an XML document to a String. * * @param catalog write this catalog * @return string containing XML representation * @throws IOException on write error */ public String writeXML(InvCatalogImpl catalog) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(10000); writeXML(catalog, os, false); return os.toString(); }
/** * Write the catalog as an XML document to a String. * * @param catalog write this catalog * @return string containing XML representation * @throws IOException on write error */ public String writeXML(InvCatalogImpl catalog) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(10000); writeXML(catalog, os, false); return new String(os.toByteArray(), CDM.utf8Charset); }
/** * Write the catalog as an XML document to a String. * * @param catalog write this catalog * @return string containing XML representation * @throws IOException on write error */ public String writeXML(InvCatalogImpl catalog) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(10000); writeXML(catalog, os, false); return new String(os.toByteArray(), CDM.utf8Charset); }
public void writeXML(InvCatalogImpl catalog, String filename) throws IOException { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); writeXML(catalog, os, false); os.close(); }
public void writeXML(InvCatalogImpl catalog, String filename) throws IOException { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); writeXML(catalog, os, false); os.close(); }
public void writeXML(InvCatalogImpl catalog, String filename) throws IOException { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); writeXML(catalog, os, false); os.close(); }
static String convertCatalogToString( InvCatalog catalog ) { InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false ); try { return fac.writeXML( (InvCatalogImpl) catalog ); } catch ( IOException e ) { return null; } } }
static String convertCatalogToString( InvCatalog catalog ) { InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false ); try { return fac.writeXML( (InvCatalogImpl) catalog ); } catch ( IOException e ) { return null; } } }
static String convertCatalogToString( InvCatalog catalog ) { InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false ); try { return fac.writeXML( (InvCatalogImpl) catalog ); } catch ( IOException e ) { return null; } } }
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 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 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(); } }
private void genCatAndSubCats( CrawlableDataset catCrDs ) throws IOException { String catWritePath = catCrDs.getPath().substring( topCatCrDs.getPath().length() ); File catWriteDir = new File( topCatWriteDir, catWritePath ); if ( ! catWriteDir.exists() ) { if ( ! catWriteDir.mkdirs() ) { log.error( "genCatAndSubCats(): could not create directory(s) for " + catWriteDir.getPath() ); throw new IOException( "Could not create directory(s) for " + catWriteDir.getPath() ); } } File catFile = new File( catWriteDir, "catalog.xml" ); InvCatalogImpl cat = catBuilder.generateCatalog( catCrDs ); factory.writeXML( cat, catFile.getAbsolutePath()); // Find child datasets that are collections and generate catalogs for those as well. List collectionChildren = catCrDs.listDatasets( collectionOnlyFilter); for ( Iterator it = collectionChildren.iterator(); it.hasNext(); ) { CrawlableDataset curCrDs = (CrawlableDataset) it.next(); genCatAndSubCats( curCrDs ); } }
private void genCatAndSubCats( CrawlableDataset catCrDs ) throws IOException { String catWritePath = catCrDs.getPath().substring( topCatCrDs.getPath().length() ); File catWriteDir = new File( topCatWriteDir, catWritePath ); if ( ! catWriteDir.exists() ) { if ( ! catWriteDir.mkdirs() ) { log.error( "genCatAndSubCats(): could not create directory(s) for " + catWriteDir.getPath() ); throw new IOException( "Could not create directory(s) for " + catWriteDir.getPath() ); } } File catFile = new File( catWriteDir, "catalog.xml" ); InvCatalogImpl cat = catBuilder.generateCatalog( catCrDs ); factory.writeXML( cat, catFile.getAbsolutePath()); // Find child datasets that are collections and generate catalogs for those as well. List collectionChildren = catCrDs.listDatasets( collectionOnlyFilter); for ( Iterator it = collectionChildren.iterator(); it.hasNext(); ) { CrawlableDataset curCrDs = (CrawlableDataset) it.next(); genCatAndSubCats( curCrDs ); } }
private void genCatAndSubCats( CrawlableDataset catCrDs ) throws IOException { String catWritePath = catCrDs.getPath().substring( topCatCrDs.getPath().length() ); File catWriteDir = new File( topCatWriteDir, catWritePath ); if ( ! catWriteDir.exists() ) { if ( ! catWriteDir.mkdirs() ) { log.error( "genCatAndSubCats(): could not create directory(s) for " + catWriteDir.getPath() ); throw new IOException( "Could not create directory(s) for " + catWriteDir.getPath() ); } } File catFile = new File( catWriteDir, "catalog.xml" ); InvCatalogImpl cat = catBuilder.generateCatalog( catCrDs ); factory.writeXML( cat, catFile.getAbsolutePath()); // Find child datasets that are collections and generate catalogs for those as well. List collectionChildren = catCrDs.listDatasets( collectionOnlyFilter); for ( Iterator it = collectionChildren.iterator(); it.hasNext(); ) { CrawlableDataset curCrDs = (CrawlableDataset) it.next(); genCatAndSubCats( curCrDs ); } }