org.eclipse.xsd.util
Class XSDResourceImpl

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

public class XSDResourceImpl
extends 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 inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
ResourceImpl.ContentsEList, ResourceImpl.ModificationTrackingAdapter
 
Nested classes inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
BasicNotifierImpl.EAdapterList
 
Nested classes inherited from class org.eclipse.emf.ecore.resource.Resource
Resource.Diagnostic, Resource.Factory, Resource.Internal, Resource.IOWrappedException
 
Field Summary
protected  Collection attachedSchemas
           
protected static XSDResourceImpl.SchemaLocator SCHEMA_LOCATOR
           
static String XSD_ENCODING
           
static 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 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 String XSD_PROGRESS_MONITOR
           
static String XSD_TRACK_LOCATION
           
 
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
contents, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, uri, warnings
 
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
 
Fields inherited from interface org.eclipse.emf.ecore.resource.Resource
OPTION_CIPHER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__URI, RESOURCE__WARNINGS
 
Constructor Summary
XSDResourceImpl()
           
XSDResourceImpl(URI uri)
           
 
Method Summary
protected static void assignDiagnostics(XSDSchema xsdSchema, Collection xsdDiagnostics)
          Assigns diagnostics to a schema.
 void attached(EObject eObject)
           
protected static EntityResolver createEntityResolver()
          Creates an EntityResovler that can be used to help with parsing schema documents.
protected  void doLoad(InputSource inputSource, Map options)
           
protected  void doLoad(InputStream inputStream, Map options)
          Loads a new XSDResourceImpl into the resource set.
protected  void doSave(OutputStream os, Map options)
           
protected  void doSave(Writer writer, Map options)
           
protected static void doSerialize(OutputStream outputStream, Document document)
          Deprecated. since 2.2
protected static void doSerialize(OutputStream outputStream, Document document, Map options)
           
protected static void doSerialize(OutputStream outputStream, Document document, String encoding)
          Deprecated. since 2.2
protected static void doSerialize(OutputStream outputStream, Element element)
           
protected static void doSerialize(OutputStream outputStream, Element element, String encoding)
           
protected static void doSerialize(Writer writer, Document document, Map options)
           
protected  boolean findSchemas(Element element)
           
 Map getDefaultSaveOptions()
           
protected static Document getDocument(InputSource inputSource, ErrorHandler errorHandler)
          Deprecated. since 2.2
protected static Document getDocument(InputSource inputSource, ErrorHandler errorHandler, Map options)
          Builds DOM document using JAXP DocumentBuilder
protected static Document getDocument(InputStream inputStream, ErrorHandler errorHandler)
          Deprecated. since 2.2
 EObject getEObject(String uriFragment)
           
 Map getLoadSaveOptions()
           
 XSDSchema getSchema()
          This gets the resource's schema.
 String getURIFragment(EObject eObject)
           
protected  void handleSchemaElement(Element element, boolean isMeta)
           
 void load(InputSource inputSource, Map options)
           
 void save(Writer writer, Map options)
          Saves the resource to the writer using the specified options.
static void serialize(OutputStream outputStream, Document document)
           
static void serialize(OutputStream outputStream, Document document, String encoding)
           
static void serialize(OutputStream outputStream, Element element)
           
static void serialize(OutputStream outputStream, Element element, String encoding)
           
 void setModified(boolean isModified)
           
 
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, detached, detachedHelper, doUnload, getAllContents, getAllProperContents, getAllProperContents, getContents, getDefaultURIConverter, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, setIntrinsicIDToEObjectMap, setLoaded, 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
eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Field Detail

XSD_TRACK_LOCATION

public static String XSD_TRACK_LOCATION

XSD_PROGRESS_MONITOR

public static String XSD_PROGRESS_MONITOR

XSD_ENCODING

public static String XSD_ENCODING

XSD_JAXP_POOL

public static 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 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 Collection attachedSchemas
Constructor Detail

XSDResourceImpl

public XSDResourceImpl()

XSDResourceImpl

public XSDResourceImpl(URI uri)
Method Detail

serialize

public static void serialize(OutputStream outputStream,
                             Element element)

serialize

public static void serialize(OutputStream outputStream,
                             Element element,
                             String encoding)

doSerialize

protected static void doSerialize(OutputStream outputStream,
                                  Element element)
                           throws IOException
Throws:
IOException

doSerialize

protected static void doSerialize(OutputStream outputStream,
                                  Element element,
                                  String encoding)
                           throws IOException
Throws:
IOException

serialize

public static void serialize(OutputStream outputStream,
                             Document document)

serialize

public static void serialize(OutputStream outputStream,
                             Document document,
                             String encoding)

doSerialize

protected static void doSerialize(OutputStream outputStream,
                                  Document document)
                           throws IOException
Deprecated. since 2.2

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

doSerialize

protected static void doSerialize(OutputStream outputStream,
                                  Document document,
                                  Map options)
                           throws IOException
Throws:
IOException

doSerialize

protected static void doSerialize(OutputStream outputStream,
                                  Document document,
                                  String encoding)
                           throws IOException
Deprecated. since 2.2

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

doSerialize

protected static void doSerialize(Writer writer,
                                  Document document,
                                  Map options)
                           throws IOException
Throws:
IOException

getDocument

protected static Document getDocument(InputSource inputSource,
                                      ErrorHandler errorHandler)
                               throws 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:
IOException
See Also:
getDocument(InputSource, ErrorHandler, Map)

getDocument

protected static Document getDocument(InputSource inputSource,
                                      ErrorHandler errorHandler,
                                      Map options)
                               throws 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:
IOException
See Also:
XSD_JAXP_POOL, XSD_JAXP_CONFIG

getDocument

protected static Document getDocument(InputStream inputStream,
                                      ErrorHandler errorHandler)
                               throws IOException
Deprecated. since 2.2

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

createEntityResolver

protected static 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,
                                        Collection xsdDiagnostics)
Assigns diagnostics to a schema.

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

doSave

protected void doSave(OutputStream os,
                      Map options)
               throws IOException
Throws:
IOException

save

public final void save(Writer writer,
                       Map options)
                throws IOException
Saves the resource to the writer using the specified options.

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

doSave

protected void doSave(Writer writer,
                      Map options)
               throws IOException
Throws:
IOException

getSchema

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


load

public final void load(InputSource inputSource,
                       Map options)
                throws IOException
Throws:
IOException

doLoad

protected void doLoad(InputSource inputSource,
                      Map options)
               throws IOException
Throws:
IOException

doLoad

protected void doLoad(InputStream inputStream,
                      Map options)
               throws IOException
Loads a new XSDResourceImpl into the resource set.

Parameters:
inputStream - the contents of the new resource.
options - any options to influence loading behavior.
Returns:
a new XSDResourceImpl.
Throws:
IOException

findSchemas

protected boolean findSchemas(Element element)

handleSchemaElement

protected void handleSchemaElement(Element element,
                                   boolean isMeta)

attached

public void attached(EObject eObject)

getURIFragment

public String getURIFragment(EObject eObject)

getEObject

public EObject getEObject(String uriFragment)

getDefaultSaveOptions

public Map getDefaultSaveOptions()

getLoadSaveOptions

public Map getLoadSaveOptions()

setModified

public void setModified(boolean isModified)

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