org.modeshape.sequencer.xsd
Class XsdReader

java.lang.Object
  extended by org.modeshape.sequencer.xsd.XsdReader

@NotThreadSafe
public class XsdReader
extends Object

A class that can parse XML Schema Documents, derive a graph structure from the content, and output that graph structure to a supplied SequencerOutput.

This class can be subclassed and any of the 'process' methods overridden to customize the dervied graph structure.


Nested Class Summary
protected  class XsdReader.ResolveFuture
           
 
Field Summary
protected  StreamSequencerContext context
           
protected  Logger logger
           
protected  Map<Path,Multimap<Name,Integer>> namesByParentPath
           
protected  SequencerOutput output
           
protected  List<XsdReader.ResolveFuture> resolveFutures
           
protected  XsdResolvers resolvers
           
static String UNBOUNDED
           
 
Constructor Summary
XsdReader(SequencerOutput output, StreamSequencerContext context)
           
XsdReader(SequencerOutput output, StreamSequencerContext context, XsdResolvers resolvers)
           
 
Method Summary
 StreamSequencerContext getContext()
          Get the sequencing context in which this reader is being used.
 XsdResolvers getResolvers()
           
protected  Name name(String name)
           
protected  Name name(String namespaceUri, String name)
           
protected  Path nextPath(Path parentPath, Name name)
           
protected  Path path(Path parentPath, Name segment)
           
protected  Path path(Path parentPath, String segment)
           
protected  Path path(String path)
           
protected  String prefixForNamespace(String namespaceUri, String defaultPrefix)
           
protected
<Facet extends org.eclipse.xsd.XSDFacet>
void
process(Iterable<Facet> facets, Path path, Name propertyName, PropertyType type)
           
protected  Path process(Iterable<org.eclipse.xsd.XSDAnnotation> annotations, Path path)
           
protected  Path process(org.eclipse.xsd.XSDAnnotation annotation, Path path)
           
protected  Path process(org.eclipse.xsd.XSDAttributeDeclaration decl, Path parentPath, boolean isUse)
           
protected  Path process(org.eclipse.xsd.XSDAttributeGroupContent content, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDAttributeGroupDefinition defn, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDAttributeUse use, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDComplexTypeContent content, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDComplexTypeDefinition type, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDElementDeclaration decl, Path parentPath)
           
protected  void process(org.eclipse.xsd.XSDFacet facet, Path path, Name propertyName, PropertyType type)
           
protected  Path process(org.eclipse.xsd.XSDImport xsdImport, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDInclude xsdInclude, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDModelGroupDefinition defn, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDModelGroup group, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDParticle content, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDRedefine redefine, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDSchema schema, String encoding, String mimeType, long contentSize, Path path)
          Read an XSDSchema instance.
protected  Path process(org.eclipse.xsd.XSDSimpleTypeDefinition type, Path parentPath)
           
protected  Path process(org.eclipse.xsd.XSDWildcard wildcard, Path parentPath)
           
protected
<Enumerator extends org.eclipse.emf.common.util.AbstractEnumerator>
void
processEnumerator(Enumerator enumerator, Path path, Name propertyName)
           
protected
<Enumerator extends org.eclipse.emf.common.util.AbstractEnumerator>
void
processEnumerators(Iterable<Enumerator> enumerators, Path path, Name propertyName)
           
protected  Path processFacetsOf(org.eclipse.xsd.XSDSimpleTypeDefinition type, Path path, org.eclipse.xsd.XSDTypeDefinition baseType)
           
protected  Path processNonSchemaAttributes(org.eclipse.xsd.XSDConcreteComponent component, Path path)
           
 void read(InputSource source, Path docPath)
          Read the XML Schema Document from the supplied source, and produce the derived content.
 void read(InputStream stream, Path docPath)
          Read the XML Schema Document from the supplied stream, and produce the derived content.
 void read(String xsdContent, Path docPath)
          Read the XML Schema Document from the supplied string, and produce the derived content.
 void resolveReferences()
          Attempt to resolve any references that remain unresolved.
protected  UUID setReference(Path path, Name propertyName, XsdResolvers.SymbolSpace kind, String namespace, String name)
           
protected  UUID setUuid(Path path)
           
protected  String string(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNBOUNDED

public static final String UNBOUNDED
See Also:
Constant Field Values

output

protected final SequencerOutput output

context

protected final StreamSequencerContext context

logger

protected final Logger logger

namesByParentPath

protected final Map<Path,Multimap<Name,Integer>> namesByParentPath

resolvers

protected final XsdResolvers resolvers

resolveFutures

protected List<XsdReader.ResolveFuture> resolveFutures
Constructor Detail

XsdReader

public XsdReader(SequencerOutput output,
                 StreamSequencerContext context,
                 XsdResolvers resolvers)

XsdReader

public XsdReader(SequencerOutput output,
                 StreamSequencerContext context)
Method Detail

getResolvers

public XsdResolvers getResolvers()
Returns:
resolvers

getContext

public StreamSequencerContext getContext()
Get the sequencing context in which this reader is being used.

Returns:
context the context; never null

read

public void read(String xsdContent,
                 Path docPath)
Read the XML Schema Document from the supplied string, and produce the derived content. Any problems or exceptions are written to the context's problems.

Parameters:
xsdContent - the stream containing the XSD content; may not be null
docPath - the path at which the derived content for the XSD should be written (usually this path represents the XSD file itself); may not be null

read

public void read(InputStream stream,
                 Path docPath)
Read the XML Schema Document from the supplied stream, and produce the derived content. Any problems or exceptions are written to the context's problems.

Parameters:
stream - the stream containing the XSD content; may not be null
docPath - the path at which the derived content for the XSD should be written (usually this path represents the XSD file itself); may not be null

read

public void read(InputSource source,
                 Path docPath)
Read the XML Schema Document from the supplied source, and produce the derived content. Any problems or exceptions are written to the context's problems.

Parameters:
source - the input source containing the XSD content; may not be null
docPath - the path at which the derived content for the XSD should be written (usually this path represents the XSD file itself); may not be null

process

protected Path process(org.eclipse.xsd.XSDSchema schema,
                       String encoding,
                       String mimeType,
                       long contentSize,
                       Path path)
Read an XSDSchema instance.

Parameters:
schema -
encoding -
mimeType -
contentSize -
path - the desired path of the derived node representing the schema; may not be null
Returns:
the path of the derived node representing the schema; never null

process

protected Path process(org.eclipse.xsd.XSDImport xsdImport,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDInclude xsdInclude,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDRedefine redefine,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDSimpleTypeDefinition type,
                       Path parentPath)

processFacetsOf

protected Path processFacetsOf(org.eclipse.xsd.XSDSimpleTypeDefinition type,
                               Path path,
                               org.eclipse.xsd.XSDTypeDefinition baseType)

process

protected Path process(org.eclipse.xsd.XSDComplexTypeDefinition type,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDElementDeclaration decl,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDAttributeDeclaration decl,
                       Path parentPath,
                       boolean isUse)

process

protected Path process(org.eclipse.xsd.XSDComplexTypeContent content,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDParticle content,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDModelGroupDefinition defn,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDModelGroup group,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDAttributeGroupContent content,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDAttributeGroupDefinition defn,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDWildcard wildcard,
                       Path parentPath)

process

protected Path process(org.eclipse.xsd.XSDAttributeUse use,
                       Path parentPath)

processNonSchemaAttributes

protected Path processNonSchemaAttributes(org.eclipse.xsd.XSDConcreteComponent component,
                                          Path path)

prefixForNamespace

protected String prefixForNamespace(String namespaceUri,
                                    String defaultPrefix)

process

protected Path process(org.eclipse.xsd.XSDAnnotation annotation,
                       Path path)

process

protected Path process(Iterable<org.eclipse.xsd.XSDAnnotation> annotations,
                       Path path)

process

protected void process(org.eclipse.xsd.XSDFacet facet,
                       Path path,
                       Name propertyName,
                       PropertyType type)

process

protected <Facet extends org.eclipse.xsd.XSDFacet> void process(Iterable<Facet> facets,
                                                                Path path,
                                                                Name propertyName,
                                                                PropertyType type)

processEnumerators

protected <Enumerator extends org.eclipse.emf.common.util.AbstractEnumerator> void processEnumerators(Iterable<Enumerator> enumerators,
                                                                                                      Path path,
                                                                                                      Name propertyName)

processEnumerator

protected <Enumerator extends org.eclipse.emf.common.util.AbstractEnumerator> void processEnumerator(Enumerator enumerator,
                                                                                                     Path path,
                                                                                                     Name propertyName)

nextPath

protected Path nextPath(Path parentPath,
                        Name name)

path

protected Path path(Path parentPath,
                    Name segment)

path

protected Path path(Path parentPath,
                    String segment)

path

protected Path path(String path)

name

protected Name name(String name)

name

protected Name name(String namespaceUri,
                    String name)

string

protected String string(Object value)

setUuid

protected UUID setUuid(Path path)

resolveReferences

public void resolveReferences()
Attempt to resolve any references that remain unresolved. This should be called if sharing an XsdResolvers with multiple XsdReader instances.


setReference

protected UUID setReference(Path path,
                            Name propertyName,
                            XsdResolvers.SymbolSpace kind,
                            String namespace,
                            String name)


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.