|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.xml.XMLConversionService
Manages the conversion of XML files from one format to another using XSL or Java
classes. Caches the converted XML to disc and provides rapid access to the converted
format. Conversions may be accomplished using XSL stylesheets or Java classes that
implement one of either the XMLFormatConverter
or XMLDocumentFormatConverter
interfaces.
XMLFormatConverter
,
XMLDocumentFormatConverter
Constructor Summary | |
---|---|
XMLConversionService(File cacheDir,
boolean filter)
Constructor for the XMLConversionService. |
Method Summary | |
---|---|
void |
addJavaConverterClass(String fromFormat,
String toFormat,
String className,
ServletContext context)
Adds a concrete implementation of the XMLFormatConverter interface that can
convert XML from one format to another. |
void |
addXslStylesheet(String fromFormat,
String toFormat,
String xslFilePath)
Adds a XSL stylesheet that can convert from one XML format to another. |
boolean |
canConvert(String fromFormat,
String toFormat)
Determines whether this XMLConversionService can perform the given converstion. |
ArrayList |
getAvailableFormats(String fromFormat)
Gets the metadata format conversions that are available for the given format, including the given format. |
static String |
getContentFromXML(String input)
Gets the content from XML by stripping all XML tags. |
StringBuffer |
getConvertedXml(String fromFormat,
String toFormat,
File originalXMLFile)
Converts XML from one format to another, saving and retrieving the converted content to and from a file cache. |
StringBuffer |
getConvertedXml(String fromFormat,
String toFormat,
File originalXMLFile,
XMLDocReader luceneDoc)
Converts XML from one format to another, saving and retrieving the converted content to and from a file cache. |
static String |
getDateStamp()
Gets a datestamp of the current time formatted for display with logs and output. |
static void |
setDebug(boolean db)
Sets the debug attribute of the SimpleLuceneIndex object |
static StringBuffer |
stripXmlDeclaration(BufferedReader rdr)
Strips the XML declaration and DTD declaration from the given XML. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLConversionService(File cacheDir, boolean filter) throws IOException
cacheDir
- The directory where converted files will be cached and stored
for later retrieval by ID.filter
- Set to true to filter out the XML and DTD declarations in the
converted XML.
IOException
- If the directory is not valid or does not have read/write
access.Method Detail |
public StringBuffer getConvertedXml(String fromFormat, String toFormat, File originalXMLFile)
fromFormat
- The XML format to convert from. Example: 'dlese_ims.'toFormat
- The format to convert to. Example: 'adn.'originalXMLFile
- The original XML file, in the 'from' format.
public StringBuffer getConvertedXml(String fromFormat, String toFormat, File originalXMLFile, XMLDocReader luceneDoc)
fromFormat
- The XML format to convert from. Example: 'dlese_ims.'toFormat
- The format to convert to. Example: 'adn.'originalXMLFile
- The original XML file, in the 'from' format. Should not be
null.luceneDoc
- A Lucene Document
that
holds content that may be used by the conversion class, or null.
public boolean canConvert(String fromFormat, String toFormat)
fromFormat
- The format to convert from.toFormat
- The format to convert to.
public ArrayList getAvailableFormats(String fromFormat)
fromFormat
- The format to convert from.
public void addXslStylesheet(String fromFormat, String toFormat, String xslFilePath)
fromFormat
- The XML format from which the stylesheet will convert.toFormat
- The XML format to which the stylesheet will convert.xslFilePath
- The absolute path to the stylesheet.public void addJavaConverterClass(String fromFormat, String toFormat, String className, ServletContext context)
XMLFormatConverter
interface that can
convert XML from one format to another. The class must be available in the classpath
for Tomcat or the running JVM that is using this broker.
fromFormat
- The XML format from which the class will convert.toFormat
- The XML format to which the class will convert.className
- The fully-qualified class that will perform the conversion.public static StringBuffer stripXmlDeclaration(BufferedReader rdr) throws IOException
rdr
- A BufferedReader containing XML.
IOException
- If error.public static final String getContentFromXML(String input)
input
- A valid XML string.
public static final String getDateStamp()
public static final void setDebug(boolean db)
db
- The new debug value
|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |