|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.modeler.BaseModelMBean org.ow2.jonas.resource.internal.mbean.ArchiveConfigMBean
public class ArchiveConfigMBean
A generic archive configuration MBean class which provides the ability to extract an XML configuration file from an archive (jar/war/ear/rar) as either a Document or as a String of XML. As well as storing an updated configuration file.
Field Summary |
---|
Fields inherited from class org.apache.commons.modeler.BaseModelMBean |
---|
attributeBroadcaster, attributes, generalBroadcaster, info, oname, registry, resource, resourceType, source |
Constructor Summary | |
---|---|
ArchiveConfigMBean()
Default constructor, constructs a BaseModelMBean. |
Method Summary | |
---|---|
void |
addXML(String archiveName,
String xmlFilePath,
String docString)
|
void |
createArchiveWithXmlFile(String archiveName,
String xmlFilePath,
String doc)
|
Document |
extractDocument(String archiveName,
String xmlFilePath)
Extracts a Document representation of the XML file provided by xmlFilePath within the archive archiveName . |
String |
extractXML(String archiveName,
String xmlFilePath)
Extracts a String representation of the XML file provided by xmlFilePath within the archive archiveName . |
protected EntityResolver |
getEntityResolver()
Return an EntityResolver for this MBean. |
protected List |
getSchemaList()
Get a list of possible schema locations to validate against. |
void |
saveXML(String archiveName,
String xmlFilePath,
Document doc)
Saves the given org.w3c.dom.Document back into an archive
of the name given by archiveName. |
void |
verifyDocument(Document doc)
Verifies that the Document is correct with respect to the schemas associated with the XML. |
Methods inherited from class org.apache.commons.modeler.BaseModelMBean |
---|
addAttributeChangeNotificationListener, addNotificationListener, createDefaultModelMBeanInfo, createResource, getAttribute, getAttributes, getClassName, getJmxName, getManagedResource, getMBeanInfo, getModelerType, getNotificationInfo, getObjectName, getRegistry, initModelInfo, invoke, isModelMBeanInfoValid, load, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedResource, setModeledType, setModelMBeanInfo, setRegistry, store, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArchiveConfigMBean() throws MBeanException
MBeanException
- from the super class.Method Detail |
---|
public void createArchiveWithXmlFile(String archiveName, String xmlFilePath, String doc) throws IOException
IOException
public void addXML(String archiveName, String xmlFilePath, String docString) throws IOException
IOException
public void saveXML(String archiveName, String xmlFilePath, Document doc) throws IOException
org.w3c.dom.Document
back into an archive
of the name given by archiveName.
The Java Jar/Archive classes apparently do not provide support for
simply updating a file in place in an archive, so a temporary archive
must be created and have the contents of the existing archive copied over
(with the exception of the updated Document file) then remove the existing
archive and rename the temporary one.
archiveName
- The name (and path) of the archive to updated.xmlFilePath
- The path within the archive to the XML file being updated.doc
- The Document representation of the XML file being updated.
IOException
- If the updating fails.public void verifyDocument(Document doc) throws SAXException, IOException
doc
- The Document to validate.
SAXException
- If the document fails validation.
IOException
- If there is an error opening a schema.protected EntityResolver getEntityResolver()
public Document extractDocument(String archiveName, String xmlFilePath) throws Exception
xmlFilePath
within the archive archiveName
.
archiveName
- The archive from which to extract the XML.xmlFilePath
- The path within the archive to the XML file.
Exception
- if the document cannot be extracted.public String extractXML(String archiveName, String xmlFilePath) throws Exception
xmlFilePath
within the archive archiveName
.
archiveName
- The archive from which to extract the XML.xmlFilePath
- The path within the archive to the XML file.
Exception
- if the XML cannot be extracted.protected List getSchemaList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |