com.bea.campaign.model
Class ScenarioModelDocument

java.lang.Object
  extended by com.bea.p13n.model.DefaultDocumentModel
      extended by com.bea.campaign.model.ScenarioModelDocument
All Implemented Interfaces
DocumentModel, Serializable

public class ScenarioModelDocument
extends DefaultDocumentModel

A default model document for ScenarioModels. This also provides common methods for parsing and writing scenario xml in the preferred manner.

See Also
Serialized Form

Field Summary
static String schemaLocation
          The xsi:schemaLocation value for scenario documents.
static Map<String,String> suggestedPrefixes
          The unmodifiable map of namespace uri to preferred prefix for scenario xml.
 
Constructor Summary
ScenarioModelDocument(InputStream in)
          Constructor from an input stream.
ScenarioModelDocument(Reader in)
          Constructor from an input reader.
ScenarioModelDocument(ScenarioModel sc)
          Constructor from ScenarioModel.
ScenarioModelDocument(String in)
          Constructor from xml.
 
Method Summary
static org.apache.xmlbeans.XmlOptions getSaveOptions()
          Get default XmlOptions for saving/outputting scenario xml.
static ScenarioModel parseScenarioModel(InputStream xml, Collection errors)
          Parse a scenario model from an input stream
static ScenarioModel parseScenarioModel(Reader xml, Collection errors)
          Parse a scenario model from a reader.
static ScenarioModel parseScenarioModel(String xml, Collection errors)
          Parse a scenario model from xml.
static com.bea.campaign.schema.scenario.ScenarioDocument prepareForSave(ScenarioModel sc, String encoding, org.apache.xmlbeans.XmlOptions opts)
          Prepare a ScenarioDocument xml object from the ScenarioModel.
static InputStream toInputStream(ScenarioModel sc)
          Get an input stream of the specified ScenarioModel's xml.
static InputStream toInputStream(ScenarioModel sc, String encoding)
          Get an input stream of the specified ScenarioModel's xml.
static Reader toReader(ScenarioModel sc)
          Get a reader of the specified ScenarioModel's xml.
static Reader toReader(ScenarioModel sc, String encoding)
          Get a reader of the specified ScenarioModel's xml.
static String toString(ScenarioModel sc)
          Get the specified ScenarioModel's xml.
static String toString(ScenarioModel sc, String encoding)
          Get the specified ScenarioModel's xml.
 
Methods inherited from class com.bea.p13n.model.DefaultDocumentModel
addChangeListener, getRootModel, modelChildAdded, modelChildRemoved, modelPropertyChanged, removeChangeListener, setRootModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suggestedPrefixes

public static final Map<String,String> suggestedPrefixes
The unmodifiable map of namespace uri to preferred prefix for scenario xml.


schemaLocation

public static final String schemaLocation
The xsi:schemaLocation value for scenario documents.

See Also
Constants Summary
Constructor Detail

ScenarioModelDocument

public ScenarioModelDocument(ScenarioModel sc)
Constructor from ScenarioModel.


ScenarioModelDocument

public ScenarioModelDocument(Reader in)
                      throws org.apache.xmlbeans.XmlException,
                             IllegalArgumentException,
                             IOException
Constructor from an input reader.

Throws
org.apache.xmlbeans.XmlException - on a parsing exception
IllegalArgumentException - if the xml is not valid for ScenarioModel.
IOException - on an error reading from the stream.

ScenarioModelDocument

public ScenarioModelDocument(InputStream in)
                      throws org.apache.xmlbeans.XmlException,
                             IllegalArgumentException,
                             IOException
Constructor from an input stream.

Throws
org.apache.xmlbeans.XmlException - on a parsing exception
IllegalArgumentException - if the xml is not valid for ScenarioModel.
IOException - on an error reading from the stream.

ScenarioModelDocument

public ScenarioModelDocument(String in)
                      throws org.apache.xmlbeans.XmlException,
                             IllegalArgumentException
Constructor from xml.

Throws
org.apache.xmlbeans.XmlException - on a parsing exception
IllegalArgumentException - if the xml is not valid for ScenarioModel.
Method Detail

parseScenarioModel

public static ScenarioModel parseScenarioModel(String xml,
                                               Collection errors)
                                        throws org.apache.xmlbeans.XmlException,
                                               IllegalArgumentException
Parse a scenario model from xml.

Parameters
xml - the xml string.
errors - a collection to store any XmlErrors from the parse.
Returns
the ScenarioModel, initialized from the xml.
Throws
org.apache.xmlbeans.XmlException - on a parsing exception
IllegalArgumentException - if the xml is not valid for ScenarioModel.

parseScenarioModel

public static ScenarioModel parseScenarioModel(Reader xml,
                                               Collection errors)
                                        throws org.apache.xmlbeans.XmlException,
                                               IllegalArgumentException,
                                               IOException
Parse a scenario model from a reader.

Parameters
xml - the xml reader
errors - a collection to store any XmlErrors from the parse.
Returns
the ScenarioModel, initialized from the xml.
Throws
org.apache.xmlbeans.XmlException - on a parsing exception.
IllegalArgumentException - if the xml is not valid for ScenarioModel.
IOException - on an error reading from the stream.

parseScenarioModel

public static ScenarioModel parseScenarioModel(InputStream xml,
                                               Collection errors)
                                        throws org.apache.xmlbeans.XmlException,
                                               IllegalArgumentException,
                                               IOException
Parse a scenario model from an input stream

Parameters
xml - the xml input stream.
errors - a collection to store any XmlErrors from the parse.
Returns
the ScenarioModel, initialized from the xml.
Throws
org.apache.xmlbeans.XmlException - on a parsing exception.
IllegalArgumentException - if the xml is not valid for ScenarioModel.
IOException - on an error reading from the stream.

getSaveOptions

public static org.apache.xmlbeans.XmlOptions getSaveOptions()
Get default XmlOptions for saving/outputting scenario xml.

See Also
suggestedPrefixes

prepareForSave

public static com.bea.campaign.schema.scenario.ScenarioDocument prepareForSave(ScenarioModel sc,
                                                                               String encoding,
                                                                               org.apache.xmlbeans.XmlOptions opts)
Prepare a ScenarioDocument xml object from the ScenarioModel. This will save the encoding on the xml object and in the XmlOptions. The returned ScenarioDocument and modified XmlOptions can then be used to generate the xml.

Parameters
sc - the scenario model.
encoding - the encoding to use, null for default.
opts - the opts to modify appropriately.

toInputStream

public static InputStream toInputStream(ScenarioModel sc)
Get an input stream of the specified ScenarioModel's xml.


toInputStream

public static InputStream toInputStream(ScenarioModel sc,
                                        String encoding)
Get an input stream of the specified ScenarioModel's xml.


toReader

public static Reader toReader(ScenarioModel sc)
Get a reader of the specified ScenarioModel's xml.


toReader

public static Reader toReader(ScenarioModel sc,
                              String encoding)
Get a reader of the specified ScenarioModel's xml.

Parameters
cam - the scenario model.
encoding - the character encoding to use, null for the model's default encoding.

toString

public static String toString(ScenarioModel sc)
Get the specified ScenarioModel's xml.


toString

public static String toString(ScenarioModel sc,
                              String encoding)
Get the specified ScenarioModel's xml.

Parameters
cam - the scenario model.
encoding - the character encoding to use, null for the model's default encoding.


Copyright © 2011, Oracle. All rights reserved.