gov.nasa.arc.brahms.common.data.format.xml
Class XMLFormat

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.format.xml.XMLFormat
All Implemented Interfaces:
IFormat

public class XMLFormat
extends java.lang.Object
implements IFormat

The XMLFormat writes out BrahmsObjects in the Extended Markup Language

Version:
$Revision: 1.4 $ $Date: 2009/11/23 19:11:20 $ $Author: rnado $
Author:
Ron van Hoof

Field Summary
protected static java.lang.String LOG_PROPERTY
           
 
Constructor Summary
XMLFormat()
          Constructor, creates a new XMLFormat
 
Method Summary
protected static java.lang.String convertPackageToDirectory(java.lang.String sPackage)
          Converts a package to a directory by replacing the dots '.' to a path separator.
protected static java.lang.String createXMLString(java.lang.String s)
          Creates a new String from the specified String converting special characters such as &, <, >, " and ' to XML codes for support by XML parsers.
protected static java.lang.String getDTDLocation()
          Returns the default location of the Document Type Definitions
static IFormat getFormat()
          Returns an instance of the XMLFormat
 IFormatter getFormatter(BrahmsObject obj)
          Returns the XML formatter for the given object.
 void init()
          Initialize the format linking the objects to the appropriate formatter
protected static java.io.DataOutputStream openXMLFile(BrahmsObject o, java.util.Properties p)
          Determines the file name for the XML file for the given Brahms object, creates the file, opens it and returns the stream to that file.
 void writeFormat(BrahmsObject obj, java.util.Properties p, java.io.DataOutputStream out)
          Writes the given object out in the format defined for that object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_PROPERTY

protected static final java.lang.String LOG_PROPERTY
See Also:
Constant Field Values
Constructor Detail

XMLFormat

public XMLFormat()
Constructor, creates a new XMLFormat

Method Detail

getFormat

public static IFormat getFormat()
Returns an instance of the XMLFormat

Returns:
IFormat a SourceCodeFormat

openXMLFile

protected static java.io.DataOutputStream openXMLFile(BrahmsObject o,
                                                      java.util.Properties p)
Determines the file name for the XML file for the given Brahms object, creates the file, opens it and returns the stream to that file. This method should only be used by the model and concepts.

Parameters:
o - the BrahmsObject for which a file is to be opened for writing
Returns:
DataOutputStream the stream to write to the file

getDTDLocation

protected static java.lang.String getDTDLocation()
Returns the default location of the Document Type Definitions

Returns:
String the location of the DTDs

createXMLString

protected static java.lang.String createXMLString(java.lang.String s)
Creates a new String from the specified String converting special characters such as &, <, >, " and ' to XML codes for support by XML parsers. XML parsers cannot handle those special characters in Strings.

Parameters:
s - the String to be converted to an XML String
Returns:
String the converted XML String

convertPackageToDirectory

protected static java.lang.String convertPackageToDirectory(java.lang.String sPackage)
Converts a package to a directory by replacing the dots '.' to a path separator.

Parameters:
sPackage - the package
Returns:
String the directory for the package after the conversion

init

public void init()
Initialize the format linking the objects to the appropriate formatter


getFormatter

public IFormatter getFormatter(BrahmsObject obj)
Returns the XML formatter for the given object.

Specified by:
getFormatter in interface IFormat
Parameters:
obj - the BrahmsObject to be formatted
Returns:
IFormatter the object containing the formatting logic for the object

writeFormat

public void writeFormat(BrahmsObject obj,
                        java.util.Properties p,
                        java.io.DataOutputStream out)
Writes the given object out in the format defined for that object.

Specified by:
writeFormat in interface IFormat
Parameters:
obj - the BrahmsObject to be written out in this format
p - the Properties relevant for the formatting of the output
out - the DataOutputStream to write the format output to


Copyright © 1997-2012 All Rights Reserved.