public class XSDResourceImpl extends ResourceImpl
Modifier and Type | Class and Description |
---|---|
static class |
XSDResourceImpl.SchemaLocator |
ResourceImpl.ContentsEList<E extends java.lang.Object & EObject>, ResourceImpl.ModificationTrackingAdapter
BasicNotifierImpl.EAdapterList<E extends java.lang.Object & Adapter>, BasicNotifierImpl.EObservableAdapterList
Resource.Diagnostic, Resource.Factory, Resource.Internal, Resource.IOWrappedException
Modifier and Type | Field and Description |
---|---|
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 |
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri, warnings
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
OPTION_CIPHER, OPTION_LINE_DELIMITER, OPTION_LINE_DELIMITER_UNSPECIFIED, OPTION_SAVE_ONLY_IF_CHANGED, OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER, OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__TIME_STAMP, RESOURCE__URI, RESOURCE__WARNINGS
Constructor and Description |
---|
XSDResourceImpl() |
XSDResourceImpl(URI uri) |
Modifier and Type | Method and Description |
---|---|
protected static void |
assignDiagnostics(XSDSchema xsdSchema,
java.util.Collection<XSDDiagnostic> xsdDiagnostics)
Assigns diagnostics to a schema.
|
void |
attached(EObject eObject)
Called when the object is attached to this resource,
i.e., when it's
eResource changes to be this one. |
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)
Called to save the resource.
|
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
|
EObject |
getEObject(java.lang.String uriFragment)
Returns the resolved object for the given URI
fragment . |
java.util.Map<java.lang.Object,java.lang.Object> |
getLoadSaveOptions() |
XSDSchema |
getSchema()
This gets the resource's schema.
|
java.lang.String |
getURIFragment(EObject eObject)
Returns the URI
fragment that,
when passed to getEObject will return the given object. |
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)
Sets whether this resource has been modified.
|
addModificationTrackingAdapters, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, doUnload, getAllContents, getAllProperContents, getAllProperContents, getContents, getDefaultURIConverter, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, handleLoadResponse, handleSaveResponse, 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
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
eAdapters, eDeliver, eNotify, eSetDeliver
public static java.lang.String XSD_TRACK_LOCATION
public static java.lang.String XSD_PROGRESS_MONITOR
public static java.lang.String XSD_ENCODING
public static java.lang.String XSD_JAXP_POOL
public static java.lang.String XSD_JAXP_CONFIG
protected static final XSDResourceImpl.SchemaLocator SCHEMA_LOCATOR
protected java.util.Collection<XSDSchema> attachedSchemas
public XSDResourceImpl()
public XSDResourceImpl(URI uri)
public static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Element element)
public static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Element element, java.lang.String encoding)
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Element element) throws java.io.IOException
java.io.IOException
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Element element, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Document document)
public static void serialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.lang.String encoding)
@Deprecated protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document) throws java.io.IOException
outputStream
- document
- java.io.IOException
doSerialize(OutputStream, Document, Map)
,
doSerialize(OutputStream, Document, Map)
protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.util.Map<?,?> options) throws java.io.IOException
java.io.IOException
@Deprecated protected static void doSerialize(java.io.OutputStream outputStream, org.w3c.dom.Document document, java.lang.String encoding) throws java.io.IOException
outputStream
- document
- encoding
- java.io.IOException
doSerialize(OutputStream, Document, Map)
protected static void doSerialize(java.io.Writer writer, org.w3c.dom.Document document, java.util.Map<?,?> options) throws java.io.IOException
java.io.IOException
@Deprecated protected static org.w3c.dom.Document getDocument(org.xml.sax.InputSource inputSource, org.xml.sax.ErrorHandler errorHandler) throws java.io.IOException
inputSource
- the contents to parse.errorHandler
- the handled used by the parser.java.io.IOException
getDocument(InputSource, ErrorHandler, Map)
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
inputSource
- the content to parsererrorHandler
- error handler for recording any loading errorsoptions
- loading optionsjava.io.IOException
XSD_JAXP_POOL
,
XSD_JAXP_CONFIG
@Deprecated protected static org.w3c.dom.Document getDocument(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler) throws java.io.IOException
inputStream
- the contents to parse.errorHandler
- the handled used by the parser.java.io.IOException
Builds a document using default JAXP implementation.
protected static org.xml.sax.EntityResolver createEntityResolver()
protected static void assignDiagnostics(XSDSchema xsdSchema, java.util.Collection<XSDDiagnostic> xsdDiagnostics)
xsdSchema
- the schema.xsdDiagnostics
- the XSDDiagnostic
s.protected void doSave(java.io.OutputStream os, java.util.Map<?,?> options) throws java.io.IOException
ResourceImpl
doSave
in class ResourceImpl
os
- the streamoptions
- the save options.java.io.IOException
public final void save(java.io.Writer writer, java.util.Map<?,?> options) throws java.io.IOException
writer
- the writeroptions
- the save options.java.io.IOException
protected void doSave(java.io.Writer writer, java.util.Map<?,?> options) throws java.io.IOException
java.io.IOException
public XSDSchema getSchema()
public final void load(org.xml.sax.InputSource inputSource, java.util.Map<?,?> options) throws java.io.IOException
java.io.IOException
protected void doLoad(org.xml.sax.InputSource inputSource, java.util.Map<?,?> options) throws java.io.IOException
java.io.IOException
protected void doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options) throws java.io.IOException
XSDResourceImpl
into the resource set.doLoad
in class ResourceImpl
inputStream
- the contents of the new resource.options
- any options to influence loading behavior.java.io.IOException
protected boolean findSchemas(org.w3c.dom.Element element)
protected void handleSchemaElement(org.w3c.dom.Element element, boolean isMeta)
public void attached(EObject eObject)
Resource.Internal
eResource
changes to be this one.
An implementation that resolves
based on IDs
will need to walk the tree
of this object
in order to tabulate an index.
An implementation that needs to track modification
will also need to walk the tree
in order to add the necessary adapter.
In either of these cases,
editing of containment relations will be significantly more expensive.
attached
in interface Resource.Internal
attached
in class ResourceImpl
eObject
- the attached object.Resource.Internal.detached(EObject)
public java.lang.String getURIFragment(EObject eObject)
Resource
fragment
that,
when passed to getEObject
will return the given object.
In other words,
the following is true
for any object contained by a resource:
Resource resource = eObject.eResource(); eObject == resource.getEObject(resource.getURIFragment(eObject))An implementation may choose to use IDs or to use structured URI fragments, as supported by
eURIFragmentSegment
.
getURIFragment
in interface Resource
getURIFragment
in class ResourceImpl
eObject
- the object to identify.fragment
for the object.Resource.getEObject(String)
,
InternalEObject.eURIFragmentSegment(org.eclipse.emf.ecore.EStructuralFeature, EObject)
public EObject getEObject(java.lang.String uriFragment)
Resource
fragment
.
The fragment encoding will typically be that produced by getURIFragment
.
getEObject
in interface Resource
getEObject
in class ResourceImpl
uriFragment
- the fragment to resolve.null
if it can't be resolved.Resource.getURIFragment(EObject)
,
ResourceSet.getEObject(URI, boolean)
,
EcoreUtil.resolve(EObject, ResourceSet)
,
InternalEObject.eObjectForURIFragmentSegment(String)
public java.util.Map<java.lang.Object,java.lang.Object> getDefaultSaveOptions()
public java.util.Map<java.lang.Object,java.lang.Object> getLoadSaveOptions()
public void setModified(boolean isModified)
Resource
A resource is automatically set to be unmodified after it is loaded or saved.
Automatic
modification tracking typically calls this directly.
setModified
in interface Resource
setModified
in class ResourceImpl
isModified
- whether this resource has been modified.Resource.isModified()