Crossfire JXClient, Trunk
|
Public Member Functions | |
synchronized ScanManagerConfig | readFromFile () throws IOException |
synchronized void | writeToFile (ScanManagerConfig bean) throws IOException |
XmlConfigUtils (String file) | |
Static Public Member Functions | |
static File | createNewXmlFile (String basename) throws IOException |
static ScanManagerConfig | read (File f) throws JAXBException |
static String | toString (Object bean) |
static void | write (ResultRecord bean, OutputStream os, boolean fragment) throws JAXBException |
static void | write (ScanManagerConfig bean, OutputStream os, boolean fragment) throws JAXBException |
static DirectoryScannerConfig | xmlClone (DirectoryScannerConfig bean) |
static ScanManagerConfig | xmlClone (ScanManagerConfig bean) |
Static Public Attributes | |
static final String | NAMESPACE |
Package Attributes | |
final String | file |
Static Private Member Functions | |
static File | commit (String basename, File tmpFile) throws IOException |
static Object | copy (Object bean) |
static Marshaller | createMarshaller () throws JAXBException |
static Unmarshaller | createUnmarshaller () throws JAXBException |
static synchronized JAXBContext | getContext () throws JAXBException |
static File | newXmlTmpFile (String basename) throws IOException |
static void | writeXml (Object bean, OutputStream os, boolean fragment) throws JAXBException |
Static Private Attributes | |
static JAXBContext | context |
static final Logger | LOG |
The class XmlConfigUtils is used to deal with XML serialization and XML files.
Definition at line 62 of file XmlConfigUtils.java.
com.sun.jmx.examples.scandir.config.XmlConfigUtils.XmlConfigUtils | ( | String | file | ) |
Creates a new instance of XmlConfigUtils.
file | The file name of the XML file in which an instance of this object will read and write XML data. |
Definition at line 89 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.file.
|
staticprivate |
Definition at line 358 of file XmlConfigUtils.java.
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.createNewXmlFile(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeToFile().
|
staticprivate |
Creates an XML clone of the given bean.
In other words, this method XML-serializes the given bean, and XML-deserializes a copy of that bean.
IllegalArgumentException | if the bean class is not known by the underlying XML binding context. |
Definition at line 180 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.createMarshaller(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.createUnmarshaller().
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.xmlClone().
|
staticprivate |
Definition at line 298 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.getContext().
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.copy(), com.sun.jmx.examples.scandir.config.XmlConfigUtils.toString(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeXml().
|
static |
Creates a new committed XML file for
, containing only the
header.
This method will rename
to
, if it exists.
basename | The name of the new file. |
IOException | if the new XML file couldn't be created. |
Definition at line 389 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.commit(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.newXmlTmpFile().
Referenced by com.sun.jmx.examples.scandir.ResultLogManager.createNewLogFile().
|
staticprivate |
Definition at line 293 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.getContext().
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.copy(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.read().
|
staticprivate |
Definition at line 309 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.context.
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.createMarshaller(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.createUnmarshaller().
|
staticprivate |
Definition at line 334 of file XmlConfigUtils.java.
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.createNewXmlFile(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeToFile().
|
static |
Reads the configuration from the given XML configuration file.
f | the file to read from. |
javax.xml.bind.JAXBException | if it fails to read the configuration. |
Definition at line 240 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.createUnmarshaller().
Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.guessConfigName(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.readFromFile().
synchronized ScanManagerConfig com.sun.jmx.examples.scandir.config.XmlConfigUtils.readFromFile | ( | ) | throws IOException |
Reads the configuration from the XML configuration file.
IOException | if it fails to read the configuration. |
Definition at line 217 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.file, and com.sun.jmx.examples.scandir.config.XmlConfigUtils.read().
Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.load(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddDirectoryScanner(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener(), com.sun.jmx.examples.scandir.config.XmlConfigUtilsTest.testReadFromFile(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testSave().
|
static |
Creates an XML string representation of the given bean.
IllegalArgumentException | if the bean class is not known by the underlying XMLbinding context. |
Definition at line 139 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.createMarshaller().
Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testGetXmlConfigString(), and com.sun.jmx.examples.scandir.config.ScanManagerConfig.toString().
|
static |
Writes the given bean to the given output stream.
bean | the bean to write. |
os | the output stream to write to. |
fragment | whether the <?xml ... ?>
|
JAXBException | An XML Binding exception occurred. |
Definition at line 271 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeXml().
|
static |
Writes the given bean to the given output stream.
bean | the bean to write. |
os | the output stream to write to. |
fragment | whether the <?xml ... ?>
|
JAXBException | An XML Binding exception occurred. |
Definition at line 256 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeXml().
Referenced by com.sun.jmx.examples.scandir.ResultLogManager.logToFile(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testLoad(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeToFile().
synchronized void com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeToFile | ( | ScanManagerConfig | bean | ) | throws IOException |
Write the given bean to the XML file.
Performs an atomic write, first writing in
, then renaming
to
, then renaming renaming
to
.
bean | The configuration to write in the XML file. |
IOException | if write to file failed. |
Definition at line 103 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.commit(), com.sun.jmx.examples.scandir.config.XmlConfigUtils.file, com.sun.jmx.examples.scandir.config.XmlConfigUtils.newXmlTmpFile(), and com.sun.jmx.examples.scandir.config.XmlConfigUtils.write().
Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.save(), com.sun.jmx.examples.scandir.config.XmlConfigUtilsTest.testReadFromFile(), and com.sun.jmx.examples.scandir.config.XmlConfigUtilsTest.testWriteToFile().
|
staticprivate |
Writes the given bean to the given output stream.
bean | the bean to write. |
os | the output stream to write to. |
fragment | whether the <?xml ... ?>
|
JAXBException | An XML Binding exception occurred. |
Definition at line 285 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.createMarshaller().
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.write().
|
static |
Creates an XML clone of the given bean.
In other words, this method XML-serializes the given bean, and XML-deserializes a copy of that bean.
IllegalArgumentException | if the bean class is not known by the underlying XML binding context. |
bean | The bean to clone. |
Definition at line 206 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.copy().
|
static |
Creates an XML clone of the given bean.
In other words, this method XML-serializes the given bean, and XML-deserializes a copy of that bean.
IllegalArgumentException | if the bean class is not known by the underlying XML binding context. |
bean | The bean to clone. |
Definition at line 165 of file XmlConfigUtils.java.
References com.sun.jmx.examples.scandir.config.XmlConfigUtils.copy().
Referenced by com.sun.jmx.examples.scandir.config.ScanManagerConfig.copy(), com.sun.jmx.examples.scandir.DirectoryScanner.DirectoryScanner(), and com.sun.jmx.examples.scandir.ScanDirConfig.getConfiguration().
|
staticprivate |
Definition at line 78 of file XmlConfigUtils.java.
Referenced by com.sun.jmx.examples.scandir.config.XmlConfigUtils.getContext().
|
package |
|
staticprivate |
A logger for this class.
Definition at line 74 of file XmlConfigUtils.java.
|
static |
A URI for our XML configuration namespace. This doesn't start with http:// because we are not going to publish this private schema anywhere.
Definition at line 69 of file XmlConfigUtils.java.