org.ws4d.java.schema
Class Schema

java.lang.Object
  extended by org.ws4d.java.schema.Schema
All Implemented Interfaces:
Resource, SchemaConstants, Any

public class Schema
extends java.lang.Object
implements Resource

General XML Schema class.


Field Summary
static Type ANY_TYPE
           
 
Fields inherited from interface org.ws4d.java.schema.Any
ATTRIBUTE_NAME, ATTRIBUTE_TYPE, ATTRIBUTE_VALUE_FALSE, ATTRIBUTE_VALUE_TRUE, TAG_ANY, TAG_ANYATTRIBUTE
 
Fields inherited from interface org.ws4d.java.constants.SchemaConstants
ATTRIBUTE_ABSTRACT, ATTRIBUTE_DEFAULT, ATTRIBUTE_FIXED, ATTRIBUTE_USE, ATTRIBUTE_XSINIL, ATTRIBUTE_XSITYPE, DOCUMENTATION_LANG, ELEMENT_ALL, ELEMENT_CHOICE, ELEMENT_DEFAULT, ELEMENT_FIXED, ELEMENT_MAXOCCURS, ELEMENT_MINOCCURS, ELEMENT_NILLABLE, ELEMENT_PARENT, ELEMENT_RESTRICTIONS, ELEMENT_SEQUENCE, ELEMENT_SUBSTITUTIONS, ELEMENT_UNIONS, FACET_ENUMERATION, FACET_FRACTIONDIGITS, FACET_LENGTH, FACET_MAXEXCLUSIVE, FACET_MAXINCLUSIVE, FACET_MAXLENGTH, FACET_MINEXCLUSIVE, FACET_MININCLUSIVE, FACET_MINLENGTH, FACET_PATTERN, FACET_TOTALDIGITS, FACET_WHITESPACE, LIST_ITEMTYPE, MAXOCCURS_UNBOUNDED, SCHEMA_ANNOTATION, SCHEMA_ANY, SCHEMA_ANYATTRIBUTE, SCHEMA_APP_INFO, SCHEMA_ATTRIBUTE, SCHEMA_ATTRIBUTEFORMDEFAULT, SCHEMA_ATTRIBUTEGROUP, SCHEMA_BASE, SCHEMA_COMPLEXCONTENT, SCHEMA_COMPLEXTYPE, SCHEMA_DOCUMENTATION, SCHEMA_ELEMENT, SCHEMA_ELEMENTFORMDEFAULT, SCHEMA_EXTENSION, SCHEMA_FACETS, SCHEMA_FORM, SCHEMA_GROUP, SCHEMA_IMPORT, SCHEMA_INCLUDE, SCHEMA_ITEMLIST, SCHEMA_ITEMTYPE, SCHEMA_LIST, SCHEMA_LOCATION, SCHEMA_MEMBERTYPES, SCHEMA_NAME, SCHEMA_NAMESPACE, SCHEMA_NONAMESPACESCHEMALOCATION, SCHEMA_NOTATION, SCHEMA_PUBLIC, SCHEMA_QUALIFIED, SCHEMA_REDEFINE, SCHEMA_REF, SCHEMA_RESTRICTION, SCHEMA_SCHEMA, SCHEMA_SIMPLECONTENT, SCHEMA_SIMPLETYPE, SCHEMA_STYPES, SCHEMA_SUBSTITUTIONGROUP, SCHEMA_SYSTEM, SCHEMA_TARGETNAMESPACE, SCHEMA_TYPE, SCHEMA_UNION, SCHEMA_UNQUALIFIED, SCHEMA_VALUE, SCHEMA_VALUEVECTOR, USE_OPTIONAL, USE_PROHIBITED, USE_REQUIRED, XMLSCHEMA_NAMESPACE, XMLSCHEMA_PREFIX, XSD_ALLMODEL, XSD_ANYATTRIBUTE, XSD_ANYELEMENT, XSD_ATTRIBUTE, XSD_ATTRIBUTEGROUP, XSD_CHOICEMODEL, XSD_COMPLEXTYPE, XSD_ELEMENT, XSD_EXTENDEDCOMPLEXCONTENT, XSD_EXTENDEDSIMPLECONTENT, XSD_GROUP, XSD_NOTATION, XSD_RESTRICTEDCOMPLEXCONTENT, XSD_RESTRICTEDSIMPLECONTENT, XSD_RESTRICTEDSIMPLETYPE, XSD_SCHEMA, XSD_SEQUENCEMODEL, XSD_SIMPLETYPE, XSI_NAMESPACE
 
Method Summary
 void addImport(java.lang.String targetNamespace, java.lang.String location)
          Adds an import information to this schema.
 void addInclude(java.lang.String schemaLocation)
           
 void addType(Type t)
           
static void flushSchemaCache()
          Removes all entries from the schema cache.
 int getAttributCount()
           
 Attribute getAttribute(QName name)
           
 Attribute getAttribute(java.lang.String name, java.lang.String namespace)
           
 AttributeGroup getAttributeGroup(QName name)
           
 AttributeGroup getAttributeGroup(java.lang.String name, java.lang.String namespace)
           
 int getAttributeGroupCount()
           
 Iterator getAttributes()
           
 InternetMediaType getContentType()
          Returns the content type of this resource.
 Element getElement(QName name)
           
 Element getElement(java.lang.String name, java.lang.String namespace)
           
 int getElementCount()
           
 Iterator getElements()
           
 Group getGroup(QName name)
           
 Group getGroup(java.lang.String name, java.lang.String namespace)
           
 int getGroupCount()
           
 HashMap getHeaderFields()
          Returns additional header fields for this resource.
 HashMap getImports()
           
 Set getIncludes()
           
 long getLastModifiedDate()
          Returns the last time where this resource was modified as UNIX timestamp.
 Iterator getLinkedSchemas()
           
 Notation getNotation(java.lang.String name)
           
 int getNotationCount()
           
 int getSchemaIdentifier()
           
 java.lang.String getTargetNamespace()
           
 Type getType(QName name)
           
 Type getType(java.lang.String name, java.lang.String namespace)
           
 int getTypeCount()
           
 Iterator getTypes()
           
static Schema parse(java.io.InputStream in, URI fromUri, boolean loadReferencedFiles)
           
static Schema parse(URI fromUri)
           
static Schema parse(URI fromUri, boolean loadReferencedFiles)
           
static Schema parse(org.xmlpull.v1.XmlPullParser parser, URI fromUri, java.lang.String targetNamespace, boolean loadReferencedFiles)
           
 void removeImport(java.lang.String targetNamespace)
          Removes an import from this schema.
 void serialize(URI request, RequestHeader requestHeader, java.io.InputStream requestBody, java.io.OutputStream out)
          Serializes this resource to the given output stream out.
 void serialize(org.xmlpull.v1.XmlSerializer serializer)
           
 java.lang.String shortDescription()
          A short string representation of this resource.
 long size()
          The size of the resource.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY_TYPE

public static final Type ANY_TYPE
Method Detail

flushSchemaCache

public static void flushSchemaCache()
Removes all entries from the schema cache.


parse

public static Schema parse(org.xmlpull.v1.XmlPullParser parser,
                           URI fromUri,
                           java.lang.String targetNamespace,
                           boolean loadReferencedFiles)
                    throws org.xmlpull.v1.XmlPullParserException,
                           java.io.IOException,
                           SchemaException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException
SchemaException

parse

public static Schema parse(URI fromUri)
                    throws org.xmlpull.v1.XmlPullParserException,
                           java.io.IOException,
                           SchemaException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException
SchemaException

parse

public static Schema parse(URI fromUri,
                           boolean loadReferencedFiles)
                    throws org.xmlpull.v1.XmlPullParserException,
                           java.io.IOException,
                           SchemaException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException
SchemaException

parse

public static Schema parse(java.io.InputStream in,
                           URI fromUri,
                           boolean loadReferencedFiles)
                    throws org.xmlpull.v1.XmlPullParserException,
                           java.io.IOException,
                           SchemaException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException
SchemaException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getSchemaIdentifier

public int getSchemaIdentifier()
Specified by:
getSchemaIdentifier in interface Any

getContentType

public InternetMediaType getContentType()
Description copied from interface: Resource
Returns the content type of this resource.

If it is not possible to determinate the content type of the resource, the Resource.getContentType() method should return at least the application/octet-stream content type.

Specified by:
getContentType in interface Resource
Returns:
the content type of this resource.

serialize

public void serialize(URI request,
                      RequestHeader requestHeader,
                      java.io.InputStream requestBody,
                      java.io.OutputStream out)
               throws java.io.IOException
Description copied from interface: Resource
Serializes this resource to the given output stream out.

Specified by:
serialize in interface Resource
Parameters:
request - the request URI
requestHeader - the header of the request
requestBody - makes the content of the request body available
out - the outputs stream to serialize this resource over
Throws:
java.io.IOException - if an IO failure occurs during serialization

size

public long size()
Description copied from interface: Resource
The size of the resource.

If it is not possible to determinate the size of the resource. The implementation should return -1. This will allow to send the resource as chunked content.

Specified by:
size in interface Resource
Returns:
the size of the resource.

getTargetNamespace

public java.lang.String getTargetNamespace()

getLinkedSchemas

public Iterator getLinkedSchemas()

getElements

public Iterator getElements()

getElement

public Element getElement(QName name)

getElement

public Element getElement(java.lang.String name,
                          java.lang.String namespace)

getElementCount

public int getElementCount()

getTypes

public Iterator getTypes()

getType

public Type getType(java.lang.String name,
                    java.lang.String namespace)

getType

public Type getType(QName name)

getTypeCount

public int getTypeCount()

getAttributes

public Iterator getAttributes()

getAttribute

public Attribute getAttribute(java.lang.String name,
                              java.lang.String namespace)

getAttribute

public Attribute getAttribute(QName name)

getAttributCount

public int getAttributCount()

getGroup

public Group getGroup(java.lang.String name,
                      java.lang.String namespace)

getGroup

public Group getGroup(QName name)

getGroupCount

public int getGroupCount()

getAttributeGroup

public AttributeGroup getAttributeGroup(java.lang.String name,
                                        java.lang.String namespace)

getAttributeGroup

public AttributeGroup getAttributeGroup(QName name)

getAttributeGroupCount

public int getAttributeGroupCount()

getNotation

public Notation getNotation(java.lang.String name)

getNotationCount

public int getNotationCount()

addImport

public void addImport(java.lang.String targetNamespace,
                      java.lang.String location)
Adds an import information to this schema.

Parameters:
targetNamespace - the target namespace of the imported schema.
location - the location.

removeImport

public void removeImport(java.lang.String targetNamespace)
Removes an import from this schema.

Parameters:
targetNamespace - the target namespace of the import.

getImports

public HashMap getImports()
Returns:

addInclude

public void addInclude(java.lang.String schemaLocation)

getIncludes

public Set getIncludes()

serialize

public void serialize(org.xmlpull.v1.XmlSerializer serializer)
               throws java.io.IOException
Throws:
java.io.IOException

addType

public void addType(Type t)

getHeaderFields

public HashMap getHeaderFields()
Description copied from interface: Resource
Returns additional header fields for this resource.

The additional header fields allow to add header fields to the response which will be created to send this resource.

NOTICE: The map must contain a String, String mapping.

Specified by:
getHeaderFields in interface Resource
Returns:
a map which contains the header=>value mapping.

shortDescription

public java.lang.String shortDescription()
Description copied from interface: Resource
A short string representation of this resource.

Specified by:
shortDescription in interface Resource
Returns:
a short string representation.

getLastModifiedDate

public long getLastModifiedDate()
Description copied from interface: Resource
Returns the last time where this resource was modified as UNIX timestamp.

Specified by:
getLastModifiedDate in interface Resource
Returns:
last time where this resource was modified.