jrunx.xml
Class XMLMetaData

java.lang.Object
  |
  +--jrunx.xml.XMLMetaData
Direct Known Subclasses:
AbstractMethodMetaData, AdapterConfigMetaData, ApplicationMetaData, AssemblyDescriptorMetaData, AttributeMetaData, AuthConstraintMetaData, ClientJndiMetaData, CMPMetaData, CMPResourceMetaData, ConnectionFactoryMetaData, CookieConfigMetaData, DefaultResourcePrincipalMetaData, DescriptionMetaData, DestinationMetaData, DestinationsMetaData, DriverMappingMetaData, EJB20CMPMetaData, EJBContainerMetaData, EJBLocalRefMetaData, EJBRefMetaData, EJBRefMetaData, EnterpriseBeansMetaData, EnterpriseBeansMetaData, EnterpriseBeansMetaData, ErrorPageMetaData, FieldsMetaData, FilterMappingMetaData, FilterMetaData, FormLoginConfigMetaData, GarbageCollectionMetaData, GreylockMetaData, IconMetaData, InitParamMetaData, InitParamMetaData, InstancePoolMetaData, J2EEMetaData, J2EERISpecificInformationMetaData, JDBCDriversMetaData, JDBCMappingMetaData, JDBCMappingsMetaData, JmsConnectionFactoryMetaData, JmsDestinationMetaData, JRunApplicationMetaData, JRunConnectionfactoryMetaData, JRunDBMetaData, JRunDtdMappingsMetaData, JRunJMSMetaData, JRunResourcesMetaData, JRunServerMetaData, JRunUsersMetaData, ListenerMetaData, LocalDtdMappingMetaData, LoginConfigMetaData, MailConfigurationMetaData, MailSessionMetaData, MappingMetaData, MessageDrivenDestinationMetaData, MessageManagerMetaData, MethodParamsMetaData, MimeMappingMetaData, ModuleMetaData, ParamMetaData, ParamsMetaData, PersistenceAdapterMetaData, PersistenceConfigMetaData, PersistenceManagerMetaData, PoolMetaData, RefMetaData, ReplicationConfigMetaData, ResourceadapterMetaData, ResourceEnvRefMetaData, ResourceEnvRefMetaData, ResourceRefMetaData, ResourceRefMetaData, RunAsMetaData, SchedulerMetaData, SecurityConstraintMetaData, SecurityRoleMetaData, ServerMetaData, ServerMetaData, ServersMetaData, ServiceMetaData, ServiceMetaData, ServletMappingMetaData, SessionConfigMetaData, SessionConfigMetaData, SQLStatementMetaData, StatementMetaData, SubscriberMetaData, TaglibMetaData, TransportMetaData, TypeMappingMetaData, TypeMappingsMetaData, UrlResourceMetaData, UserDataConstraintMetaData, VirtualMappingMetaData, WebMetaData, WebResourceCollectionMetaData, WelcomeFileListMetaData

public abstract class XMLMetaData
extends java.lang.Object

XMLMetaData is a utility class useful for creating Java classes that represent an XML document. The objects are simple Java bean like objects that rely on the XMLMetaData base class for importing/exporting the XML document to a file. Base classes and consumers of these classes need not concern themselves with any XML parser APIs. By following a set of rules on member variable types and names the XML is imported and exported automatically. The rules are:

To remove an element each XMLMetaData class has a remove operation. To add an element the XMLMetaData constructor that takes in a parent should be used. transient and static fields are ignored with the following exceptions for statics: required fields are indicated by having a static boolean with the same name as the field with _required appended set to true, if the field doesn't exist or is false the element is optional if the type is a String and only certain values are allowed a static String[] with _values can be specified enumeratating the allowed values. Typically a MetaData object will have setters for terminals, when a terminal changes the method sync() can be called, this will sync all the terminals in that meta data class and export the XML to its orgin location


Inner Class Summary
 class XMLMetaData.BaseException
           
 class XMLMetaData.CouldNotCreateDocumentException
          Could not create document from location '{location}'
 class XMLMetaData.CreateInstanceException
          Could not create an instance of {className}
 class XMLMetaData.ElementRequiredException
          {location}:{line}: The '{child}' element is a required child of '{parent}'
 class XMLMetaData.IntegerExpectedException
          {location}:{line}: Expected an integer for {elementName} element, got {value}
 class XMLMetaData.InvalidElementException
          {location}:{line}: The '{name}' element's value must be one of {list}
 class XMLMetaData.InvalidObjectException
          {location}:{line}: {className}'s toString() method returned '{objStr}' but the variable passed into its String constructor was '{constStr}'.
 class XMLMetaData.MetaDataExportIOException
          IOException exporting document to {location}: {message}
 class XMLMetaData.NoLocationException
          Tried to export a XMLMetaData document with no source specified, setSource must be called first.
 class XMLMetaData.NoStringConstructorException
          {location}:{line}: Couldn't create an instance of {className}, which must have a String constructor: {excStr}
 class XMLMetaData.UnsupportedArrayTypeException
          The class {cls} has an array of type {arrayType} which is not supported
 
Field Summary
protected  Logger logger
           
 
Constructor Summary
XMLMetaData()
          Use this to build a new MetaData object from scratch, if this isn't the root node use the constructor where you pass in the parent MetaData instead.
XMLMetaData(java.io.File file)
           
XMLMetaData(java.net.URL url)
           
XMLMetaData(java.net.URL url, java.lang.String[] pkgs)
           
XMLMetaData(java.net.URL url, java.lang.String[] pkgs, Logger lg)
           
XMLMetaData(XMLMetaData parent)
          Use this constructor to add a new XMLMetaData object to its parent, this will set the field for this type in the parent or add it to the List of metadatas in the parent.
 
Method Summary
 void addAcronym(java.lang.String acronym)
           
 void addAcronyms(java.util.Collection acronyms)
           
 void addPackagePrefix(java.lang.String prefix)
          add a package to search list for resolving List fields names into types
 void addPackagePrefixes(java.util.Collection packages)
           
 void exportDocument()
          Write document back out to its location
 java.lang.String getAttribute(java.lang.String name)
           
 java.net.URL getMetaDataSource()
           
 XMLMetaData getParent()
           
 PersistenceContext getPersistenceContext()
           
 java.lang.String getText()
           
protected  void importXML()
          Imports the information into this metadata object from a DOM element
 void importXML(java.net.URL url)
          Make this XMLMetaData object reflect the XML at the URL location
 void remove()
          Remove this MetaData element, this entails: - removing my element from my parent - if my parent refers to me in a List, remove myself from that list - if my parent refers to me directly, null out that field Note that there is no corresponding add, adding elements is done
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.String value)
           
 void setMetaDataSource(java.io.File file)
           
 void setMetaDataSource(java.net.URL url)
           
 void setParent(XMLMetaData parent)
          XMLMetaData objects that don't represent the top level element have a reference to their parent.
 void setParent(XMLMetaData parent, boolean sync)
           
 void setPersistenceContext(PersistenceContext persistence)
           
 void setPublicID(java.lang.String publicID)
           
 void setSystemID(java.lang.String systemID)
           
 void setText(java.lang.String text)
           
 void sync()
          sync terminals with DOM
 void sync(boolean force)
           
 java.lang.String toString()
          Return a String representation of the document
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected transient Logger logger
Constructor Detail

XMLMetaData

public XMLMetaData()
Use this to build a new MetaData object from scratch, if this isn't the root node use the constructor where you pass in the parent MetaData instead.

XMLMetaData

public XMLMetaData(XMLMetaData parent)
Use this constructor to add a new XMLMetaData object to its parent, this will set the field for this type in the parent or add it to the List of metadatas in the parent. If neither of those exist and exception is thrown

XMLMetaData

public XMLMetaData(java.io.File file)
            throws MetaDataException

XMLMetaData

public XMLMetaData(java.net.URL url)
            throws MetaDataException

XMLMetaData

public XMLMetaData(java.net.URL url,
                   java.lang.String[] pkgs)
            throws MetaDataException

XMLMetaData

public XMLMetaData(java.net.URL url,
                   java.lang.String[] pkgs,
                   Logger lg)
            throws MetaDataException
Method Detail

addAcronym

public void addAcronym(java.lang.String acronym)

addAcronyms

public void addAcronyms(java.util.Collection acronyms)

addPackagePrefix

public void addPackagePrefix(java.lang.String prefix)
add a package to search list for resolving List fields names into types

addPackagePrefixes

public void addPackagePrefixes(java.util.Collection packages)

importXML

public void importXML(java.net.URL url)
               throws MetaDataException
Make this XMLMetaData object reflect the XML at the URL location

exportDocument

public void exportDocument()
                    throws MetaDataException
Write document back out to its location

getMetaDataSource

public java.net.URL getMetaDataSource()

setMetaDataSource

public void setMetaDataSource(java.io.File file)

setMetaDataSource

public void setMetaDataSource(java.net.URL url)

remove

public void remove()
Remove this MetaData element, this entails: - removing my element from my parent - if my parent refers to me in a List, remove myself from that list - if my parent refers to me directly, null out that field Note that there is no corresponding add, adding elements is done

getParent

public XMLMetaData getParent()

setParent

public void setParent(XMLMetaData parent)
XMLMetaData objects that don't represent the top level element have a reference to their parent. This gives

setParent

public void setParent(XMLMetaData parent,
                      boolean sync)

setPublicID

public void setPublicID(java.lang.String publicID)

setSystemID

public void setSystemID(java.lang.String systemID)

sync

public void sync()
sync terminals with DOM

sync

public void sync(boolean force)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)

getAttribute

public java.lang.String getAttribute(java.lang.String name)

removeAttribute

public void removeAttribute(java.lang.String name)

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)

importXML

protected void importXML()
                  throws MetaDataException
Imports the information into this metadata object from a DOM element

setPersistenceContext

public void setPersistenceContext(PersistenceContext persistence)

getPersistenceContext

public PersistenceContext getPersistenceContext()

toString

public java.lang.String toString()
Return a String representation of the document
Overrides:
toString in class java.lang.Object


Copyright � 2002 Macromedia Corporation. All Rights Reserved.