Package com.portal.pcm
Class XMLToFlist
java.lang.Object
com.portal.pcm.XMLToFlist
- All Implemented Interfaces:
XMLConstants
Processes XML of the form
<?xml version="1.0" encoding="UTF-8"?> <flist> <POID xmlns="">0.0.0.1 /account 1234</POID> <AR_ACCOUNT_OBJ xmlns="">0.0.0.1 /account 9876</AR_ACCOUNT_OBJ> <INCLUDE_CHILDREN xmlns="">123</INCLUDE_CHILDREN> <NAMEINFO elem="1"> <ADDRESS>10200 South De Anza Blvd</ADDRESS> <CITY>Cupertino</CITY> <CANON_COMPANY>Portal Software</CANON_COMPANY> <CANON_COUNTRY>USA</CANON_COUNTRY> </NAMEINFO> <WRITE_ACCESS xmlns="">some string</WRITE_ACCESS> </flist>To use, get an instance of converter and specify an input stream containing the xml data via
convert
. The generated flist is retrieved
using getFList
.
Note: The XML formats this converter currently supports are
PIN_XML_BY_SHORT_NAME and PIN_XML_BY_NAME.
It is also possible to invoke this converter from the command line. See
main
method for usage.-
Field Summary
FieldsFields inherited from interface com.portal.pcm.XMLConstants
PIN_XML_BY_NAME, PIN_XML_BY_SHORT_NAME, PIN_XML_NOTIFICATION, PIN_XML_TYPE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
XMLToFlist
(int xmlType) Instantiate XML to Flist converter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeDoc
(InputStream xmlInputStream) Sets the source of the XML document for the new schema support.void
convert
(InputSource xmlInputSource) Set the source of the XML document.getFList()
Get the flist represented by the XML.static XMLToFlist
Factory method to get an instance of the converter for default, PIN_XML_BY_SHORT_NAME, XML format.static XMLToFlist
getInstance
(int xmlType) Factory method to get an instance of the converter for specified, XML format.static String
getTimeStampInUnixFormat
(String srcFormat, String src) This method gets timestamp in unix format, taking the input in a format specified by the first argument.static void
Invokes the XML to flist converter from the command line.static Node
This method masks sensitive data in the xml
-
Field Details
-
EMPTY_STRING
- See Also:
-
-
Constructor Details
-
XMLToFlist
protected XMLToFlist(int xmlType) Instantiate XML to Flist converter. The constructor is protected, usegetInstance
factory method to get an appropriate instance.- Parameters:
xmlType
- Known XML types are defined in XMLConstants. The XML formats this converter currently supports isXMLConstants.PIN_XML_BY_SHORT_NAME
.XMLConstants.PIN_XML_BY_NAME
.- See Also:
-
-
Method Details
-
getInstance
Factory method to get an instance of the converter for default, PIN_XML_BY_SHORT_NAME, XML format. -
getInstance
Factory method to get an instance of the converter for specified, XML format.- Parameters:
xmlType
- Known XML types are defined in XMLConstants. The XML formats this converter currently supports isXMLConstants.PIN_XML_BY_SHORT_NAME
.XMLConstants.PIN_XML_BY_NAME
.
-
convert
public void convert(InputSource xmlInputSource) throws IOException, SAXException, ParserConfigurationException Set the source of the XML document. This memeber function is used to support the old XML schema being supported.- Parameters:
xmlInputSource
- Input source containing XML content to be parsed- Throws:
IOException
- If any IO errors occur.SAXException
- If any parse errors occur.IllegalArgumentException
- If the InputStream is nullParserConfigurationException
- See Also:
-
getFList
Get the flist represented by the XML.- Returns:
- FList form of the XML
-
changeDoc
public void changeDoc(InputStream xmlInputStream) throws IOException, SAXException, ParserConfigurationException Sets the source of the XML document for the new schema support. This member function is being used to support the new standardized XML schema support.- Parameters:
xmlInputStream
- Input stream containing XML content to be parsed- Throws:
IOException
- If any IO errors occur.SAXException
- If any parse errors occur.IllegalArgumentException
- If the InputStream is nullParserConfigurationException
- See Also:
-
getTimeStampInUnixFormat
This method gets timestamp in unix format, taking the input in a format specified by the first argument.- Parameters:
srcFormat
- Input date formatsrc
- Input date in srcFormat- Returns:
- Converts String in the UNIX timestamp with the adjusted Timezone
-
maskTree
This method masks sensitive data in the xml- Parameters:
inNode
- data requiring masking- Returns:
- masked data
-
main
Invokes the XML to flist converter from the command line. Outputs the created flist in testnap format on the console and writes it to file. The output filename is the input filename with ".flist.txt" appended to it.Usage:
java com.portal.pcm.XMLToFlist -[n]ew filename
-