org.eclipse.gmt.umlx.alien.adapter
Class AlienXMIResourceAdapter
java.lang.Object
org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.NotifierImpl
org.eclipse.emf.ecore.resource.impl.ResourceImpl
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl
org.eclipse.gmt.umlx.alien.adapter.AlienXMIResourceAdapter
- All Implemented Interfaces:
- org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource.Internal, org.eclipse.emf.ecore.xmi.XMIResource, org.eclipse.emf.ecore.xmi.XMLResource
public class AlienXMIResourceAdapter
- extends org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl
- implements org.eclipse.emf.common.notify.Adapter
An AlienXMIResourceAdapter supports an XMIResource that is an adaptation of some other Resource.
Typically this may be used to support an EMOF representation of an Ecore model.
Loading and saving the adapting resource loads and saves from the adapting representation.
Loading and saving the adapted resource loads and saves from the adapted representation.
The adapting resource has no inherited contents since all content is maintained as adapters of the
adapted content. Access to getContents() and transitively to all other content accessors return
adapters that obtain their state from the adapted model.
The adapting resource delegates getID/setID to the adapted resource.
The adapting resource has nominally independent URI and ResourceSet containment,
however typical loading of an adapted resources share the URI and ResourceSet, putting the adapting
resource into the ResourceSet before the adapted resource.
The adapting resource transiently maintains a set of extension objects. These are created
during preSave and destroyed during postSave, or created during load and destroyed during postLoad.
Typical preparation is:
MappingMetaData mappingMetaData = EMOFMappingMetaData.INSTANCE;
mappingMetaData.initialise();
ResourceSet resourceSet = new AlienResourceSet();
then typical usage is:
XMIResource ecoreResource = resourceSet.createResource(ecoreURI);
XMIResource alienResource = mappingMetaData.getAdapter(ecoreResource, alienURI);
alienResource.save(...);
or:
XMIResource alienResource = resourceSet.loadResource(alienURI, true);
XMIResource ecoreResource = ((AlienXMIResourceAdapter) alienResource).getTarget();
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> |
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter |
org.eclipse.emf.common.notify.Adapter.Internal |
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.xmi.XMLResource |
org.eclipse.emf.ecore.xmi.XMLResource.ResourceEntityHandler, org.eclipse.emf.ecore.xmi.XMLResource.ResourceHandler, org.eclipse.emf.ecore.xmi.XMLResource.URIHandler, org.eclipse.emf.ecore.xmi.XMLResource.XMLInfo, org.eclipse.emf.ecore.xmi.XMLResource.XMLMap |
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.Resource |
org.eclipse.emf.ecore.resource.Resource.Diagnostic, org.eclipse.emf.ecore.resource.Resource.Factory, org.eclipse.emf.ecore.resource.Resource.Internal, org.eclipse.emf.ecore.resource.Resource.IOWrappedException |
Fields inherited from interface org.eclipse.emf.ecore.xmi.XMIResource |
OPTION_USE_XMI_TYPE, VERSION_NAME, VERSION_VALUE, XMI_ID, XMI_NAMESPACE_PREFIX, XMI_NS, XMI_TAG_NAME, XMI_URI |
Fields inherited from interface org.eclipse.emf.ecore.xmi.XMLResource |
HREF, NIL, NO_NAMESPACE_SCHEMA_LOCATION, OPTION_ANY_SIMPLE_TYPE, OPTION_ANY_TYPE, OPTION_CONFIGURATION_CACHE, OPTION_DECLARE_XML, OPTION_DEFER_ATTACHMENT, OPTION_DEFER_IDREF_RESOLUTION, OPTION_DISABLE_NOTIFY, OPTION_DOM_USE_NAMESPACES_IN_SCOPE, OPTION_ENCODING, OPTION_EXTENDED_META_DATA, OPTION_FLUSH_THRESHOLD, OPTION_FORMATTED, OPTION_KEEP_DEFAULT_CONTENT, OPTION_LAX_FEATURE_PROCESSING, OPTION_LINE_WIDTH, OPTION_PARSER_FEATURES, OPTION_PARSER_PROPERTIES, OPTION_PROCESS_DANGLING_HREF, OPTION_PROCESS_DANGLING_HREF_DISCARD, OPTION_PROCESS_DANGLING_HREF_RECORD, OPTION_PROCESS_DANGLING_HREF_THROW, OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS, OPTION_RECORD_UNKNOWN_FEATURE, OPTION_RESOURCE_ENTITY_HANDLER, OPTION_RESOURCE_HANDLER, OPTION_ROOT_OBJECTS, OPTION_SAVE_DOCTYPE, OPTION_SAVE_TYPE_INFORMATION, OPTION_SCHEMA_LOCATION, OPTION_SCHEMA_LOCATION_IMPLEMENTATION, OPTION_SKIP_ESCAPE, OPTION_SKIP_ESCAPE_URI, OPTION_URI_HANDLER, OPTION_USE_CACHED_LOOKUP_TABLE, OPTION_USE_DEPRECATED_METHODS, OPTION_USE_ENCODED_ATTRIBUTE_STYLE, OPTION_USE_FILE_BUFFER, OPTION_USE_LEXICAL_HANDLER, OPTION_USE_PARSER_POOL, OPTION_USE_XML_NAME_TO_FEATURE_MAP, OPTION_XML_MAP, OPTION_XML_OPTIONS, OPTION_XML_VERSION, SCHEMA_LOCATION, TYPE, XML_NS, XML_SCHEMA_URI, XSI_NS, XSI_URI |
Fields inherited from interface org.eclipse.emf.ecore.resource.Resource |
OPTION_CIPHER, 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__URI, RESOURCE__WARNINGS |
Method Summary |
void |
doLoad(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options)
|
void |
doLoad(java.io.InputStream inputStream,
java.util.Map<?,?> options)
|
void |
doLoad(org.w3c.dom.Node node,
java.util.Map<?,?> options)
|
void |
doSave(java.io.OutputStream outputStream,
java.util.Map<?,?> options)
|
void |
doSave(java.io.Writer writer,
java.util.Map<?,?> options)
|
org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> |
getContents()
|
org.eclipse.emf.ecore.EObject |
getEObject(java.lang.String uriFragment)
|
java.util.Map<org.eclipse.emf.ecore.EObject,java.lang.String> |
getEObjectToIDMap()
Deprecated. |
java.lang.String |
getID(org.eclipse.emf.ecore.EObject object)
|
java.util.Map<java.lang.String,org.eclipse.emf.ecore.EObject> |
getIDToEObjectMap()
Deprecated. |
MappingMetaData |
getMappingMetaData()
|
org.eclipse.emf.ecore.resource.Resource |
getTarget()
|
org.eclipse.emf.common.util.URI |
getURI()
|
boolean |
isAdapterForType(java.lang.Object type)
|
void |
notifyChanged(org.eclipse.emf.common.notify.Notification notification)
|
void |
setID(org.eclipse.emf.ecore.EObject object,
java.lang.String id)
|
void |
setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
|
Methods inherited from class org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl |
getXMINamespace, getXMIVersion, setXMINamespace, setXMIVersion |
Methods inherited from class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl |
getDefaultLoadOptions, getDefaultSaveOptions, getDOMHelper, getEncoding, getEObjectToExtensionMap, getPublicId, getSystemId, getURIFragment, getXMLVersion, load, load, save, save, setDoctypeInfo, setEncoding, setUseZip, setXMLVersion, toKeyString, useZip |
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl |
attached, basicSetResourceSet, detached, getAllContents, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getWarnings, isLoaded, isLoading, isModified, isTrackingModification, load, load, save, save, setIntrinsicIDToEObjectMap, setModified, setTrackingModification, setURI, toString, unload |
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl |
eAdapters, eDeliver, eSetDeliver |
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl |
eNotificationRequired, eNotify |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.emf.ecore.xmi.XMLResource |
getDefaultLoadOptions, getDefaultSaveOptions, getDOMHelper, getEncoding, getEObjectToExtensionMap, getPublicId, getSystemId, getXMLVersion, load, load, save, save, setDoctypeInfo, setEncoding, setUseZip, setXMLVersion, useZip |
Methods inherited from interface org.eclipse.emf.ecore.resource.Resource |
getAllContents, getErrors, getResourceSet, getURIFragment, getWarnings, isLoaded, isModified, isTrackingModification, load, load, save, save, setModified, setTrackingModification, setURI, unload |
Methods inherited from interface org.eclipse.emf.common.notify.Notifier |
eAdapters, eDeliver, eNotify, eSetDeliver |
AlienXMIResourceAdapter
public AlienXMIResourceAdapter(org.eclipse.emf.ecore.resource.Resource target,
org.eclipse.emf.common.util.URI uri,
MappingMetaData mappingMetaData)
doLoad
public void doLoad(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options)
throws java.io.IOException
- Overrides:
doLoad
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
- Throws:
java.io.IOException
doLoad
public void doLoad(java.io.InputStream inputStream,
java.util.Map<?,?> options)
throws java.io.IOException
- Overrides:
doLoad
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
- Throws:
java.io.IOException
doLoad
public void doLoad(org.w3c.dom.Node node,
java.util.Map<?,?> options)
throws java.io.IOException
- Overrides:
doLoad
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
- Throws:
java.io.IOException
doSave
public void doSave(java.io.OutputStream outputStream,
java.util.Map<?,?> options)
throws java.io.IOException
- Overrides:
doSave
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
- Throws:
java.io.IOException
doSave
public void doSave(java.io.Writer writer,
java.util.Map<?,?> options)
throws java.io.IOException
- Overrides:
doSave
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
- Throws:
java.io.IOException
getContents
public org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContents()
- Specified by:
getContents
in interface org.eclipse.emf.ecore.resource.Resource
- Overrides:
getContents
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
getEObjectToIDMap
@Deprecated
public java.util.Map<org.eclipse.emf.ecore.EObject,java.lang.String> getEObjectToIDMap()
- Deprecated.
- Specified by:
getEObjectToIDMap
in interface org.eclipse.emf.ecore.xmi.XMLResource
- Overrides:
getEObjectToIDMap
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
getID
public java.lang.String getID(org.eclipse.emf.ecore.EObject object)
- Specified by:
getID
in interface org.eclipse.emf.ecore.xmi.XMLResource
- Overrides:
getID
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
getIDToEObjectMap
@Deprecated
public java.util.Map<java.lang.String,org.eclipse.emf.ecore.EObject> getIDToEObjectMap()
- Deprecated.
- Specified by:
getIDToEObjectMap
in interface org.eclipse.emf.ecore.xmi.XMLResource
- Overrides:
getIDToEObjectMap
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
getMappingMetaData
public MappingMetaData getMappingMetaData()
getTarget
public org.eclipse.emf.ecore.resource.Resource getTarget()
- Specified by:
getTarget
in interface org.eclipse.emf.common.notify.Adapter
getURI
public org.eclipse.emf.common.util.URI getURI()
- Specified by:
getURI
in interface org.eclipse.emf.ecore.resource.Resource
- Overrides:
getURI
in class org.eclipse.emf.ecore.resource.impl.ResourceImpl
isAdapterForType
public boolean isAdapterForType(java.lang.Object type)
- Specified by:
isAdapterForType
in interface org.eclipse.emf.common.notify.Adapter
notifyChanged
public void notifyChanged(org.eclipse.emf.common.notify.Notification notification)
- Specified by:
notifyChanged
in interface org.eclipse.emf.common.notify.Adapter
setID
public void setID(org.eclipse.emf.ecore.EObject object,
java.lang.String id)
- Specified by:
setID
in interface org.eclipse.emf.ecore.xmi.XMLResource
- Overrides:
setID
in class org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl
setTarget
public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
- Specified by:
setTarget
in interface org.eclipse.emf.common.notify.Adapter