Java Doc for ModelBuilder.java in  » 6.0-JDK-Modules » j2me » com » sun » perseus » builder » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.perseus.builder 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.xml.sax.helpers.DefaultHandler
      com.sun.perseus.builder.ModelBuilder

ModelBuilder
public class ModelBuilder extends DefaultHandler (Code)
NOTE: need to change currentElement management so that there is only a need to do a getParent() and cast to (ElementNode). ModelBuilder is a SAX2 ContentHandler that builds a Model (i.e. a tree of ModelNodes from the SAX2 events.
This class also offers a static method to synchronously builds a Model given a URI: ModelBuilder.loadDocument loadDocument .
version:
   $Id: ModelBuilder.java,v 1.10 2006/07/13 00:55:57 st125089 Exp $


Field Summary
final public static  StringDTD_SUBSET
     The default DTD subset used when resolving the DTD entities.
final public static  StringLOAD_INTERRUPTED
    
protected  ElementNodecurrentElement
     Object keeping track of the current node, i.e., the last node that was built from an element.
protected static  Stringdtdids
     The accepted DTD public IDs.
protected  VectorentityStreams
     Keeps track of opened streams (entities) so that they can be closed when parsing completes.
protected  DocumentNodemodelRoot
    
protected  VectorpendingPrefixMapping
     Keeps pending namespaceURI to prefix mapping.
protected  VectorpendingPrefixMappingCache
     Used to allows quick check on pendingPrefixMapping.

Constructor Summary
 ModelBuilder(Vector modelFactoryIn, DocumentNode modelRootIn)
     The modelFactory is used to build ModelNode instances corresponding to individual nodes in the parsed XML documents.

Method Summary
 voidaddToParent(ElementNode child, CompositeNode parent)
     Adds the input node to the given parent.
final public  voidcharacters(char[] ch, int start, int length)
     Receive notification of character data inside an element.

By default, do nothing.

final public  voidendDocument()
     Receive notification of the end of the document.

By default, do nothing.

final public  voidendElement(String uri, String localName, String qName)
     Updates the currentElement.
final public  voidfatalError(SAXParseException e)
     Report a fatal XML parsing error.
final  DocumentNodegetModelRoot()
    
protected  voidinvokeAndWait(Runnable runnable)
     Utility method.
public static  DocumentNodeloadDocument(String svgURI)
     Loads an SVG Tiny document from a given URI
Parameters:
  svgURI - the URI of the SVG document to load.
public static  voidloadDocument(InputStream is, DocumentNode root)
     Load an SVG Tiny document at the given input stream. This method uses JAXP to define the SAX parser to use. Any error is reported to the input DocumentNode's UpdateListener's loadFailed method.
Parameters:
  is - the InputStream from which the SVG content isread.
public static  voidloadDocument(InputStream is, DocumentNode root, Vector modelFactory)
     Load an SVG Tiny document at the given input stream. This method uses JAXP to define the SAX parser to use. Any error is reported to the input DocumentNode's UpdateListener's loadFailed method.
Parameters:
  is - the InputStream from which the SVG content isread.
protected static  voidloadingFailed(UpdateListener updateListener, DocumentNode root, Exception e)
     Utility method to report an exception to the UpdateListener in the proper thread.
final public  InputSourceresolveEntity(String publicId, String systemId)
     Resolve an external entity.
Parameters:
  publicId - The public identifer, or null if none isavailable.
Parameters:
  systemId - The system identifier provided in the XML document.
final public  voidsetDocumentLocator(Locator locator)
     Receive a Locator object for document events.

By default, do nothing.

final public  voidstartDocument()
     SAX: Implements org.xml.sax.ContentHandler.startDocument ContentHander.startDocument .
final public  voidstartElement(String uri, String localName, String qName, Attributes attributes)
     Receive notification of the start of an element.
public  voidstartPrefixMapping(String prefix, String uri)
     Receive notification of the start of a Namespace mapping.

By default, do nothing.


Field Detail
DTD_SUBSET
final public static String DTD_SUBSET(Code)
The default DTD subset used when resolving the DTD entities.



LOAD_INTERRUPTED
final public static String LOAD_INTERRUPTED(Code)
The message used in the SAXException when the loading thread is interrupted



currentElement
protected ElementNode currentElement(Code)
Object keeping track of the current node, i.e., the last node that was built from an element.



dtdids
protected static String dtdids(Code)
The accepted DTD public IDs.



entityStreams
protected Vector entityStreams(Code)
Keeps track of opened streams (entities) so that they can be closed when parsing completes.
See Also:   ModelBuilder.resolveEntity



modelRoot
protected DocumentNode modelRoot(Code)
Root of the model tree



pendingPrefixMapping
protected Vector pendingPrefixMapping(Code)
Keeps pending namespaceURI to prefix mapping. This is used because the prefix mapping is declared in the startPrefixMapping method _before_ startElement is called. Therefore, the startElement method will use this pendingPrefixMapping vector to declare prefix mappings on the newly created element.



pendingPrefixMappingCache
protected Vector pendingPrefixMappingCache(Code)
Used to allows quick check on pendingPrefixMapping.




Constructor Detail
ModelBuilder
ModelBuilder(Vector modelFactoryIn, DocumentNode modelRootIn)(Code)
The modelFactory is used to build ModelNode instances corresponding to individual nodes in the parsed XML documents. This ModelBuilder aggregates the nodes manufactured by the modelFactory
Parameters:
  modelFactoryIn - the factory that contains elementprototypes for the supported element types
Parameters:
  modelRootIn - the DocumentNode that should be populated with the result of the build process.




Method Detail
addToParent
void addToParent(ElementNode child, CompositeNode parent) throws SAXException(Code)
Adds the input node to the given parent. If there is no associated RunnableQueue, the child is simply added to the parent in the calling thread. If there is a RunnableQueue, the child is added to the parent the RunnableQueue thread, by invoking a Runnable on the queue.
Parameters:
  child - node to add to the parent
Parameters:
  parent - node to which the child is added.
throws:
  SAXException - if the child cannot be added to the parentbecause the thread was interrupted or if the thread was interrupted to begin with.



characters
final public void characters(char[] ch, int start, int length) throws SAXException(Code)
Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).


Parameters:
  ch - The characters.
Parameters:
  start - The start position in the character array.
Parameters:
  length - The number of characters to use from thecharacter array.
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.characters



endDocument
final public void endDocument() throws SAXException(Code)
Receive notification of the end of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).


exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.endDocument



endElement
final public void endElement(String uri, String localName, String qName) throws SAXException(Code)
Updates the currentElement.
Parameters:
  uri - The element's namespace uri.
Parameters:
  localName - The element's local name
Parameters:
  qName - The element's qualified name
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.endElement



fatalError
final public void fatalError(SAXParseException e) throws SAXException(Code)
Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.


Parameters:
  e - The error information encoded as an exception.
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ErrorHandler.fatalError
See Also:   org.xml.sax.SAXParseException



getModelRoot
final DocumentNode getModelRoot()(Code)
the root of the tree built by this builder.null is returned if no tree was built yet



invokeAndWait
protected void invokeAndWait(Runnable runnable) throws SAXException(Code)
Utility method. Invokes the Runnable on the modelRoot.invokeAndWait.
Parameters:
  runnable - the Runnable to run
throws:
  SAXException - if the input Runnable is interrupted while pending execution or while running.



loadDocument
public static DocumentNode loadDocument(String svgURI) throws IOException(Code)
Loads an SVG Tiny document from a given URI
Parameters:
  svgURI - the URI of the SVG document to load. the DocumentNode built from the requested svgURI.
throws:
  IOException - if the file cannot be loaded.



loadDocument
public static void loadDocument(InputStream is, DocumentNode root)(Code)
Load an SVG Tiny document at the given input stream. This method uses JAXP to define the SAX parser to use. Any error is reported to the input DocumentNode's UpdateListener's loadFailed method.
Parameters:
  is - the InputStream from which the SVG content isread. This might be GZIPed compressed stream. If the input streamis null, an input stream is opened from the root's document URI.
Parameters:
  root - the documentNode to populate with the document's content
throws:
  IllegalArgumentException - if the root's URI is null, if root is null or if the root's UpdateListener is null



loadDocument
public static void loadDocument(InputStream is, DocumentNode root, Vector modelFactory)(Code)
Load an SVG Tiny document at the given input stream. This method uses JAXP to define the SAX parser to use. Any error is reported to the input DocumentNode's UpdateListener's loadFailed method.
Parameters:
  is - the InputStream from which the SVG content isread. This might be GZIPed compressed stream. If the input streamis null, an input stream is opened from the root's document URI.
Parameters:
  root - the documentNode to populate with the document's content
Parameters:
  modelFactory - the ModelFactory used to turn XML elements into ModelNode instances.
throws:
  IllegalArgumentException - if the root's URI is null, if root is null or if the root's UpdateListener is null



loadingFailed
protected static void loadingFailed(UpdateListener updateListener, DocumentNode root, Exception e)(Code)
Utility method to report an exception to the UpdateListener in the proper thread.
Parameters:
  updateListener - the UpdateListener to which the error should be reported.
Parameters:
  root - the DocumentNode which was being loaded.
Parameters:
  e - the Exception which caused the failure.



resolveEntity
final public InputSource resolveEntity(String publicId, String systemId) throws SAXException(Code)
Resolve an external entity.
Parameters:
  publicId - The public identifer, or null if none isavailable.
Parameters:
  systemId - The system identifier provided in the XML document. The new input source, or null to require thedefault behaviour.
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.EntityResolver.resolveEntity



setDocumentLocator
final public void setDocumentLocator(Locator locator)(Code)
Receive a Locator object for document events.

By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.


Parameters:
  locator - A locator for all SAX document events.
See Also:   org.xml.sax.ContentHandler.setDocumentLocator
See Also:   org.xml.sax.Locator



startDocument
final public void startDocument()(Code)
SAX: Implements org.xml.sax.ContentHandler.startDocument ContentHander.startDocument .



startElement
final public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)
Receive notification of the start of an element.
Parameters:
  uri - The element's namespace uri
Parameters:
  localName - The element's local name, i.e., within the given namespace
Parameters:
  qName - The element's qualified name, i.e., including the namespace prefix
Parameters:
  attributes - The specified or defaulted attributes.
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.startElement



startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)
Receive notification of the start of a Namespace mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each Namespace prefix scope (such as storing the prefix mapping).


Parameters:
  prefix - The Namespace prefix being declared.
Parameters:
  uri - The Namespace URI mapped to the prefix.
exception:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.startPrefixMapping



Methods inherited from org.xml.sax.helpers.DefaultHandler
public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void endDocument() throws SAXException(Code)(Java Doc)
public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc)
public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc)
public void error(SAXParseException e) throws SAXException(Code)(Java Doc)
public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc)
public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc)
public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc)
public InputSource resolveEntity(String publicId, String systemId) throws SAXException(Code)(Java Doc)
public void setDocumentLocator(Locator locator)(Code)(Java Doc)
public void skippedEntity(String name) throws SAXException(Code)(Java Doc)
public void startDocument() throws SAXException(Code)(Java Doc)
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)(Java Doc)
public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc)
public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.