org.eclipse.xsd.util
Class XSDResourceImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.common.notify.impl.NotifierImpl
          extended by org.eclipse.emf.ecore.resource.impl.ResourceImpl
              extended by org.eclipse.xsd.util.XSDResourceImpl
All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource.Internal

public class XSDResourceImpl
extends org.eclipse.emf.ecore.resource.impl.ResourceImpl

The Resource implementation for the model. This specialized resource implementation supports it's own way of making keys and hrefs, and it's own serialization. This class is not intended for subclassing outside of the model implementation; it is intended to be used as is with the Resource framework.


Nested Class Summary
static class XSDResourceImpl.SchemaLocator
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
org.eclipse.emf.ecore.resource.impl.ResourceImpl.ContentsEList<E extends java.lang.Object & org.eclipse.emf.ecore.EObject>, org.eclipse.emf.ecore.resource.impl.ResourceImpl.ModificationTrackingAdapter
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList
 
Field Summary
protected  java.util.Collection<XSDSchema> attachedSchemas
           
protected static XSDResourceImpl.SchemaLocator SCHEMA_LOCATOR
           
static java.lang.String XSD_ENCODING
           
static java.lang.String XSD_JAXP_CONFIG
          This option can be used as an option on Resource#load methods to specify JAXP configuration that creates and configures SAX, DOM parsers and Transformer.
static java.lang.String XSD_JAXP_POOL
          This option can be used as an option on Resource#load methods to specify JAXP pool to be used for loading and serializing XML Schemas.
static java.lang.String XSD_PROGRESS_MONITOR
           
static java.lang.String XSD_TRACK_LOCATION
           
 
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri, warnings
 
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
 
Constructor Summary
XSDResourceImpl()
           
XSDResourceImpl(org.eclipse.emf.common.util.URI uri)
           
 
Method Summary
protected static void assignDiagnostics(XSDSchema xsdSchema, java.util.Collection<XSDDiagnostic> xsdDiagnostics)
          Assigns diagnostics to a schema.
 void attached(org.eclipse.emf.ecore.EObject eObject)
           
protected static org.xml.sax.EntityResolver createEntityResolver()
          Creates an EntityResovler that can be used to help with parsing schema documents.
protected  void doLoad(org.xml.sax.InputSource inputSource, java.util.Map<?,?> options)
           
protected  void doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options)
          Loads a new XSDResourceImpl into the resource set.
protected  void doSave(java.io.OutputStream os, java.util.Map<?,?> options)
           
protected  void doSave(java.io.Writer writer, java.util.Map<?,?> options)
           
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document)
          Deprecated. since 2.2
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.util.Map<?,?> options)
           
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.lang.String encoding)
          Deprecated. since 2.2
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Element element)
           
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Element element, java.lang.String encoding)
           
protected static void doSerialize(java.io.Writer writer, org.w3c.dom.Document document, java.util.Map<?,?> options)
           
protected  boolean findSchemas(org.w3c.dom.Element element)
           
 java.util.Map<java.lang.Object,java.lang.Object> getDefaultSaveOptions()
           
protected static org.w3c.dom.Document getDocument(org.xml.sax.InputSource inputSource, org.xml.sax.ErrorHandler errorHandler)
          Deprecated. since 2.2
protected static org.w3c.dom.Document getDocument(org.xml.sax.InputSource inputSource, org.xml.sax.ErrorHandler errorHandler, java.util.Map<?,?> options)
          Builds DOM document using JAXP DocumentBuilder
protected static org.w3c.dom.Document getDocument(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler)
          Deprecated. since 2.2
 org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
           
 java.util.Map<java.lang.Object,java.lang.Object> getLoadSaveOptions()
           
 XSDSchema getSchema()
          This gets the resource's schema.
 java.lang.String getURIFragment(org.eclipse.emf.ecore.EObject eObject)
           
protected  void handleSchemaElement(org.w3c.dom.Element element, boolean isMeta)
           
 void load(org.xml.sax.InputSource inputSource, java.util.Map<?,?> options)
           
 void save(java.io.Writer writer, java.util.Map<?,?> options)
          Saves the resource to the writer using the specified options.
static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Document document)
           
static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.lang.String encoding)
           
static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Element element)
           
static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Element element, java.lang.String encoding)
           
 void setModified(boolean isModified)
           
 
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, doUnload, getAllContents, getAllProperContents, getAllProperContents, getContents, getDefaultURIConverter, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setTimeStamp, setTrackingModification, setURI, toKeyString, toString, unload, unloaded, useZip
 
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XSD_TRACK_LOCATION

public static java.lang.String XSD_TRACK_LOCATION

XSD_PROGRESS_MONITOR

public static java.lang.String XSD_PROGRESS_MONITOR

XSD_ENCODING

public static java.lang.String XSD_ENCODING

XSD_JAXP_POOL

public static java.lang.String XSD_JAXP_POOL
This option can be used as an option on Resource#load methods to specify JAXP pool to be used for loading and serializing XML Schemas.

See Also:
Resource.load(InputStream, Map), Resource.load(Map)

XSD_JAXP_CONFIG

public static java.lang.String XSD_JAXP_CONFIG
This option can be used as an option on Resource#load methods to specify JAXP configuration that creates and configures SAX, DOM parsers and Transformer.

See Also:
Resource.load(InputStream, Map), Resource.load(Map)

SCHEMA_LOCATOR

protected static final XSDResourceImpl.SchemaLocator SCHEMA_LOCATOR

attachedSchemas

protected java.util.Collection<XSDSchema> attachedSchemas
Constructor Detail

XSDResourceImpl

public XSDResourceImpl()

XSDResourceImpl

public XSDResourceImpl(org.eclipse.emf.common.util.URI uri)
Method Detail

serialize

public static void serialize(java.io.OutputStream outputStream,
                             org.w3c.dom.Element element)

serialize

public static void serialize(java.io.OutputStream outputStream,
                             org.w3c.dom.Element element,
                             java.lang.String encoding)

doSerialize

protected static void doSerialize(java.io.OutputStream outputStream,
                                  org.w3c.dom.Element element)
                           throws java.io.IOException
Throws:
java.io.IOException

doSerialize

protected static void doSerialize(java.io.OutputStream outputStream,
                                  org.w3c.dom.Element element,
                                  java.lang.String encoding)
                           throws java.io.IOException
Throws:
java.io.IOException

serialize

public static void serialize(java.io.OutputStream outputStream,
                             org.w3c.dom.Document document)

serialize

public static void serialize(java.io.OutputStream outputStream,
                             org.w3c.dom.Document document,
                             java.lang.String encoding)

doSerialize

@Deprecated
protected static void doSerialize(java.io.OutputStream outputStream,
                                             org.w3c.dom.Document document)
                           throws java.io.IOException
Deprecated. since 2.2

Parameters:
outputStream -
document -
Throws:
java.io.IOException
See Also:
doSerialize(OutputStream, Document, Map), doSerialize(OutputStream, Document, Map)

doSerialize

protected static void doSerialize(java.io.OutputStream outputStream,
                                  org.w3c.dom.Document document,
                                  java.util.Map<?,?> options)
                           throws java.io.IOException
Throws:
java.io.IOException

doSerialize

@Deprecated
protected static void doSerialize(java.io.OutputStream outputStream,
                                             org.w3c.dom.Document document,
                                             java.lang.String encoding)
                           throws java.io.IOException
Deprecated. since 2.2

Parameters:
outputStream -
document -
encoding -
Throws:
java.io.IOException
See Also:
doSerialize(OutputStream, Document, Map)

doSerialize

protected static void doSerialize(java.io.Writer writer,
                                  org.w3c.dom.Document document,
                                  java.util.Map<?,?> options)
                           throws java.io.IOException
Throws:
java.io.IOException

getDocument

@Deprecated
protected static org.w3c.dom.Document getDocument(org.xml.sax.InputSource inputSource,
                                                             org.xml.sax.ErrorHandler errorHandler)
                                           throws java.io.IOException
Deprecated. since 2.2

Builds a document using default JAXP.

Parameters:
inputSource - the contents to parse.
errorHandler - the handled used by the parser.
Returns:
a document.
Throws:
java.io.IOException
See Also:
getDocument(InputSource, ErrorHandler, Map)

getDocument

protected static org.w3c.dom.Document getDocument(org.xml.sax.InputSource inputSource,
                                                  org.xml.sax.ErrorHandler errorHandler,
                                                  java.util.Map<?,?> options)
                                           throws java.io.IOException
Builds DOM document using JAXP DocumentBuilder

Parameters:
inputSource - the content to parser
errorHandler - error handler for recording any loading errors
options - loading options
Returns:
document DOM document
Throws:
java.io.IOException
See Also:
XSD_JAXP_POOL, XSD_JAXP_CONFIG

getDocument

@Deprecated
protected static org.w3c.dom.Document getDocument(java.io.InputStream inputStream,
                                                             org.xml.sax.ErrorHandler errorHandler)
                                           throws java.io.IOException
Deprecated. since 2.2

Parameters:
inputStream - the contents to parse.
errorHandler - the handled used by the parser.
Returns:
a document.
Throws:
java.io.IOException
See Also:
Builds a document using default JAXP implementation.

createEntityResolver

protected static org.xml.sax.EntityResolver createEntityResolver()
Creates an EntityResovler that can be used to help with parsing schema documents.

Returns:
an EntityResolver.

assignDiagnostics

protected static void assignDiagnostics(XSDSchema xsdSchema,
                                        java.util.Collection<XSDDiagnostic> xsdDiagnostics)
Assigns diagnostics to a schema.

Parameters:
xsdSchema - the schema.
xsdDiagnostics - the XSDDiagnostics.

doSave

protected void doSave(java.io.OutputStream os,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Overrides:
doSave in class org.eclipse.emf.ecore.resource.impl.ResourceImpl
Throws:
java.io.IOException

save

public final void save(java.io.Writer writer,
                       java.util.Map<?,?> options)
                throws java.io.IOException
Saves the resource to the writer using the specified options.

Parameters:
writer - the writer
options - the save options.
Throws:
java.io.IOException

doSave

protected void doSave(java.io.Writer writer,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Throws:
java.io.IOException

getSchema

public XSDSchema getSchema()
This gets the resource's schema.


load

public final void load(org.xml.sax.InputSource inputSource,
                       java.util.Map<?,?> options)
                throws java.io.IOException
Throws:
java.io.IOException

doLoad

protected void doLoad(org.xml.sax.InputSource inputSource,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Throws:
java.io.IOException

doLoad

protected void doLoad(java.io.InputStream inputStream,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Loads a new XSDResourceImpl into the resource set.

Overrides:
doLoad in class org.eclipse.emf.ecore.resource.impl.ResourceImpl
Parameters:
inputStream - the contents of the new resource.
options - any options to influence loading behavior.
Throws:
java.io.IOException

findSchemas

protected boolean findSchemas(org.w3c.dom.Element element)

handleSchemaElement

protected void handleSchemaElement(org.w3c.dom.Element element,
                                   boolean isMeta)

attached

public void attached(org.eclipse.emf.ecore.EObject eObject)
Specified by:
attached in interface org.eclipse.emf.ecore.resource.Resource.Internal
Overrides:
attached in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

getURIFragment

public java.lang.String getURIFragment(org.eclipse.emf.ecore.EObject eObject)
Specified by:
getURIFragment in interface org.eclipse.emf.ecore.resource.Resource
Overrides:
getURIFragment in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

getEObject

public org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
Specified by:
getEObject in interface org.eclipse.emf.ecore.resource.Resource
Overrides:
getEObject in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

getDefaultSaveOptions

public java.util.Map<java.lang.Object,java.lang.Object> getDefaultSaveOptions()

getLoadSaveOptions

public java.util.Map<java.lang.Object,java.lang.Object> getLoadSaveOptions()

setModified

public void setModified(boolean isModified)
Specified by:
setModified in interface org.eclipse.emf.ecore.resource.Resource
Overrides:
setModified in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.