public interface ExtendedResource
resources
including memory-optimized unloading, proxy creation
with custom URI formats, and caching of problem marker attributes.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLUMN_NUMBER_KEY_NAME |
static java.lang.String |
LINE_NUMBER_KEY_NAME |
static java.lang.String |
OPTION_ENABLE_SCHEMA_VALIDATION
Specifies weather the resource should be validated with a schema during loading.
|
static java.lang.String |
OPTION_MAX_PROBLEM_MARKER_COUNT
Specifies the maximum number of
errors and warnings
on this resource that are to be converted to problem markers on underlying IFile after this resource has
been loaded or saved. |
static java.lang.Integer |
OPTION_MAX_PROBLEM_MARKER_COUNT_DEFAULT |
static java.lang.Integer |
OPTION_MAX_PROBLEM_MARKER_COUNT_UNLIMITED |
static java.lang.String |
OPTION_PROBLEM_MARKER_FACTORY
Specifies a
resource problem marker factory that is used to convert the
errors and warnings on this resource to problem
markers on underlying IFile after this resource has been loaded or saved. |
static java.lang.String |
OPTION_PROGRESS_MONITOR
Specifies the
progress monitor to be used for monitoring the progress and allow for
cancellation while a resource is being loaded. |
static java.lang.String |
OPTION_RECORD_LINE_AND_COLUMN_NUMBERS |
static java.lang.String |
OPTION_RESOURCE_VERSION_DESCRIPTOR
Used for indicating the
version of specified resource . |
static java.lang.String |
OPTION_SCHEMA_LOCATION_CATALOG
Specifies a string to string map with namespace and system identifier pairs that are allowed to be written in the
resource's xsi:schemaLocation/xsi:noNamespaceSchemaLocation during saving.
|
static java.lang.String |
OPTION_TARGET_METAMODEL_DESCRIPTOR_ID
Specifies the target
metamodel descriptor identifier for this resource. |
static java.lang.String |
OPTION_UNLOAD_MEMORY_OPTIMIZED
Specifies whether unloading of this resource is to be performed in a limited but memory-optimized way.
|
static java.lang.String |
OPTION_USE_CONTEXT_AWARE_PROXY_URIS
Specifies whether to use context-aware proxy URIs when creating proxy objects or not.
|
static java.lang.String |
OPTION_XML_VALIDITY_PROBLEM_FORMAT_STRING
Specifies the format string to be used for creating problem marker messages for XML validity problems.
|
static java.lang.String |
OPTION_XML_VALIDITY_PROBLEM_FORMAT_STRING_DEFAULT |
static java.lang.String |
OPTION_XML_VALIDITY_PROBLEM_SEVERITY
Specifies the severity to be used for reporting XML validity problems.
|
static java.lang.String |
OPTION_XML_WELLFORMEDNESS_PROBLEM_FORMAT_STRING
Specifies the format string to be used for creating problem marker messages for XML well-formedness problems.
|
static java.lang.String |
OPTION_XML_WELLFORMEDNESS_PROBLEM_FORMAT_STRING_DEFAULT |
static java.lang.String |
URI_FRAGMENT_SEPARATOR
Special character signaling the start of the fragment of an URI.
|
static java.util.regex.Pattern |
URI_QUERY_FIELD_PATTERN |
static int |
URI_QUERY_FIELD_PATTERN_KEY_GROUP_IDX |
static int |
URI_QUERY_FIELD_PATTERN_VALUE_GROUP_IDX |
static java.lang.String |
URI_QUERY_FIELD_SEPARATOR
Special character separating a keys/value pairs within the query of an URI.
|
static java.lang.String |
URI_QUERY_KEY_VALUE_SEPARATOR
Special character separating keys from values within keys/value pairs in the query of an URI.
|
static java.lang.String |
URI_QUERY_SEPARATOR
Special character signaling the start of the query of an URI.
|
static java.lang.String |
URI_SCHEME_SEPARATOR
Special character signaling the end of the scheme of an URI.
|
static java.lang.String |
URI_SEGMENT_SEPARATOR
Special character separating individual segments within an URI.
|
Modifier and Type | Method and Description |
---|---|
void |
augmentToContextAwareProxy(org.eclipse.emf.ecore.EObject proxy)
Augments given
proxy to a context-aware proxy by adding key/value pairs that contain the
target metamodel descriptor and a context URI to the query string of the proxy URI. |
org.eclipse.emf.common.util.URI |
createURI(java.lang.String uriLiteral,
org.eclipse.emf.ecore.EClass eClass)
Creates a
URI from given uriLiteral that refers to an instance of given object
type . |
java.util.Map<java.lang.Object,java.lang.Object> |
getDefaultLoadOptions()
Returns the map of options that, in addition to the overriding options specified during load, are used to to
control load behavior.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getDefaultSaveOptions()
Returns the map of options that, in addition to the overriding options specified during save, are used to to
control save behavior.
|
org.eclipse.emf.common.util.URI |
getHREF(org.eclipse.emf.ecore.EObject eObject)
Returns a
URI representing an HREF to given EObject stored in underlying Resource . |
java.util.Map<java.lang.Object,java.lang.Object> |
getProblemHandlingOptions()
Returns the map of options that are used to control the handling of problems encountered while the
resource has been loaded or saved. |
org.eclipse.emf.common.util.URI |
getURI(org.eclipse.emf.ecore.EObject eObject)
Returns a
URI representing given InternalEObject . |
org.eclipse.emf.common.util.URI |
getURI(org.eclipse.emf.ecore.EObject eObject,
boolean resolve)
Returns a
URI representing given InternalEObject . |
org.eclipse.emf.common.util.URI |
getURI(org.eclipse.emf.ecore.EObject oldOwner,
org.eclipse.emf.ecore.EStructuralFeature oldFeature,
org.eclipse.emf.ecore.EObject eObject)
Returns a
URI representing given eObject owned by owner through provided
feature .If the eObject is stand-alone (i.e freshly removed and without
attached resource) the URI is determine using the owner and the
feature , if the eObject is still attached to a Resource the
URI is calculated using same implementation as in ResourceImpl.unload() . |
org.eclipse.emf.common.util.URI |
getURI(org.eclipse.emf.ecore.EObject oldOwner,
org.eclipse.emf.ecore.EStructuralFeature oldFeature,
org.eclipse.emf.ecore.EObject eObject,
boolean resolve)
Returns a
URI representing given eObject owned by owner through provided
feature .If the eObject is stand-alone (i.e freshly removed and without
attached resource) the URI is determine using the owner and the
feature , if the eObject is still attached to a Resource the
URI is calculated using same implementation as in ResourceImpl.unload() . |
org.eclipse.emf.common.util.URI |
trimProxyContextInfo(org.eclipse.emf.common.util.URI proxyURI)
If given
proxy URI contains proxy context-related key/value pairs on its query
string , returns the URI formed by removing those key/value pairs or removing the query string entirely in case
that no other key/value pairs exist; returns given proxy URI unchanged, otherwise. |
void |
unloaded(org.eclipse.emf.ecore.EObject eObject)
Improved implementation of org.eclipse.emf.ecore.resource.impl.ResourceImpl#unloaded(InternalEObject) enabling
memory-optimized unloading of
resource s and proxy creation with custom URI formats
during regular unload. |
org.eclipse.emf.common.util.Diagnostic |
validateURI(java.lang.String uri)
Determines whether or not the given URI string represents a valid URI.
|
static final java.lang.String URI_SCHEME_SEPARATOR
static final java.lang.String URI_SEGMENT_SEPARATOR
static final java.lang.String URI_QUERY_SEPARATOR
static final java.lang.String URI_QUERY_FIELD_SEPARATOR
static final java.lang.String URI_QUERY_KEY_VALUE_SEPARATOR
static final java.lang.String URI_FRAGMENT_SEPARATOR
static final java.util.regex.Pattern URI_QUERY_FIELD_PATTERN
static final int URI_QUERY_FIELD_PATTERN_KEY_GROUP_IDX
static final int URI_QUERY_FIELD_PATTERN_VALUE_GROUP_IDX
static final java.lang.String OPTION_RESOURCE_VERSION_DESCRIPTOR
version
of specified resource
. Can be
either identical with the version
of the metamodel behind the resource content or
one of the resource version descriptors
that are compatible with the metamodel version
.static final java.lang.String OPTION_USE_CONTEXT_AWARE_PROXY_URIS
Boolean.TRUE
.static final java.lang.String OPTION_TARGET_METAMODEL_DESCRIPTOR_ID
metamodel descriptor
identifier for this resource.static final java.lang.String OPTION_SCHEMA_LOCATION_CATALOG
XMLResource.OPTION_SCHEMA_LOCATION
is enabled and requires that ExtendedXMLSaveImpl
or
ExtendedXMISaveImpl
, or a subtype of them, is used as serializer
for this resource.XMLResource.OPTION_SCHEMA_LOCATION
,
XMLResourceImpl.createXMLSave()
,
ExtendedXMLSaveImpl.addNamespaceDeclarations()
,
ExtendedXMISaveImpl
,
Constant Field Valuesstatic final java.lang.String OPTION_ENABLE_SCHEMA_VALIDATION
ExtendedXMLLoadImpl
or ExtendedXMILoadImpl
, or a subtype of them, is used as
loader
for this resource. The default of this option is
Boolean.FALSE
.
The schema used for validation is expected to be defined by a xsi:schemaLocation or xsi:noNamespaceSchemaLocation
attribute on the resource's root element. The default strategy for retrieving the schema is to resolve the schema
location system identifier relative to the resource's URI. Other resolution strategies can be supported by
providing a SchemaLocationURIHandler
as XMLResource.OPTION_URI_HANDLER
as load option. In the
latter case it is recommended to provide an adequately initialized OPTION_RESOURCE_VERSION_DESCRIPTOR
along with that. It enables the SchemaLocationURIHandler
to resolve unknown schema location system
identifiers by falling back to a known system identifier corresponding to the resource's
namespace
.
XMLResource.OPTION_URI_HANDLER
,
SchemaLocationURIHandler
,
XMLResourceImpl.createXMLLoad()
,
ExtendedXMLLoadImpl
,
ExtendedXMILoadImpl
,
Constant Field Valuesstatic final java.lang.String OPTION_PROBLEM_MARKER_FACTORY
resource problem marker factory
that is used to convert the
errors
and warnings
on this resource to problem
markers on underlying IFile
after this resource has been loaded or saved.IResourceProblemMarkerFactory
,
Resource.getErrors()
,
Resource.getWarnings()
,
Constant Field Valuesstatic final java.lang.String OPTION_MAX_PROBLEM_MARKER_COUNT
errors
and warnings
on this resource that are to be converted to problem markers on underlying IFile
after this resource has
been loaded or saved. May be an arbitrary positive integer value or
OPTION_MAX_PROBLEM_MARKER_COUNT_UNLIMITED
. The default is
OPTION_MAX_PROBLEM_MARKER_COUNT_DEFAULT
.
Note that a high number of problem markers being generated for many files may have a negative impact on overall load and save performance.
Resource.getErrors()
,
Resource.getWarnings()
,
Constant Field Valuesstatic final java.lang.Integer OPTION_MAX_PROBLEM_MARKER_COUNT_DEFAULT
static final java.lang.Integer OPTION_MAX_PROBLEM_MARKER_COUNT_UNLIMITED
static final java.lang.String OPTION_XML_WELLFORMEDNESS_PROBLEM_FORMAT_STRING
{0}
) where the actual problem message can be inserted. The
default is OPTION_XML_WELLFORMEDNESS_PROBLEM_FORMAT_STRING_DEFAULT
.static final java.lang.String OPTION_XML_WELLFORMEDNESS_PROBLEM_FORMAT_STRING_DEFAULT
static final java.lang.String OPTION_XML_VALIDITY_PROBLEM_FORMAT_STRING
OPTION_XML_VALIDITY_PROBLEM_FORMAT_STRING_DEFAULT
.static final java.lang.String OPTION_XML_VALIDITY_PROBLEM_FORMAT_STRING_DEFAULT
static final java.lang.String OPTION_XML_VALIDITY_PROBLEM_SEVERITY
IMarker.SEVERITY_ERROR
, IMarker.SEVERITY_WARNING
, IMarker.SEVERITY_INFO
or undefined. The
default is undefined.static final java.lang.String OPTION_UNLOAD_MEMORY_OPTIMIZED
unloaded(InternalEObject)
method is overridden
and delegates to ExtendedResourceAdapter.unloaded(EObject)
. The default of this option is
Boolean.FALSE
.
This option involves the following behavioral modifications wrt to regular
unload strategy
:
EObject
s (for saving non negligible amounts of memory
consumption for proxy URIs required otherwise)EObject
s (to make sure that they get garbage collected as fast as
possible)Note that this kind of unload is not appropriate under all circumstances. More specifically, it must not be used when a resource is to be reloaded (lazily or eagerly). In this case proxies are needed for being able to resolve incoming cross-document references from other resources. However, when the complete ResourceSet is unloaded, or a self-contained set of resources with no outgoing and incoming cross-document references (which typically happens when a project or the entire workbench is closed), proxies are not needed and not creating them can reduce memory consumption quite dramatically.
ResourceImpl#unloaded()
,
Constant Field Valuesstatic final java.lang.String OPTION_PROGRESS_MONITOR
progress monitor
to be used for monitoring the progress and allow for
cancellation while a resource
is being loaded.static final java.lang.String OPTION_RECORD_LINE_AND_COLUMN_NUMBERS
static final java.lang.String LINE_NUMBER_KEY_NAME
static final java.lang.String COLUMN_NUMBER_KEY_NAME
java.util.Map<java.lang.Object,java.lang.Object> getDefaultLoadOptions()
java.util.Map<java.lang.Object,java.lang.Object> getDefaultSaveOptions()
java.util.Map<java.lang.Object,java.lang.Object> getProblemHandlingOptions()
resource
has been loaded or saved.void unloaded(org.eclipse.emf.ecore.EObject eObject)
resource
s and proxy creation with custom URI
formats
during regular unload.internalEObject
- The InternalEObject
that has just been removed from the resource and is to be further
processed by this method.OPTION_UNLOAD_MEMORY_OPTIMIZED
,
#getURI(InternalEObject)
org.eclipse.emf.common.util.URI getURI(org.eclipse.emf.ecore.EObject eObject)
URI
representing given InternalEObject
. Clients may implement/override this method when
they require URIs with custom formats to be created.InternalEObject
- The InternalEObject
for which the URI is to be created.InternalEObject
, or null
if no such could be created.org.eclipse.emf.common.util.URI getURI(org.eclipse.emf.ecore.EObject eObject, boolean resolve)
URI
representing given InternalEObject
. Clients may implement/override this method when
they require URIs with custom formats to be created.InternalEObject
- The InternalEObject
for which the URI is to be created.resolve
- indicates whether the URI should resolved against the URI of the resource which contains the provided
model object. This is useful is cases where the native model object URI evaluates in some sort of
fragment-based URI which does not contain any information about the resource that contains the model
object (e.g., hb:/#//MyComponent/MyParameterValue). By setting resolve to true, such fragment-based
URIs will be automatically expanded to a URI that starts with the URI of the model object's resource
and is followed by the fragment of the model object's native URI (e.g.,
platform:/resource/MyProject/MyResource/#//MyComponent/MyParameterValue).InternalEObject
, or null
if no such could be created.org.eclipse.emf.common.util.URI getURI(org.eclipse.emf.ecore.EObject oldOwner, org.eclipse.emf.ecore.EStructuralFeature oldFeature, org.eclipse.emf.ecore.EObject eObject)
URI
representing given eObject
owned by owner
through provided
feature
.If the eObject
is stand-alone (i.e freshly removed and without
attached resource) the URI
is determine using the owner
and the
feature
, if the eObject
is still attached to a Resource
the
URI
is calculated using same implementation as in ResourceImpl.unload()
.
Clients may implement/override this method when they require URIs with custom formats to be created.
oldOwner
- The EObject
owning the EObject
before it was deleted.oldFeature
- The EStructuralFeature
of the owner containing the eObject
before it was
deleted.eObject
- The EObject
for which the URI is to be created.eObject
, or null
if no such could be created.If the
provided EObject
has no eResource
and no owner
, the returned
value is null.org.eclipse.emf.common.util.URI getURI(org.eclipse.emf.ecore.EObject oldOwner, org.eclipse.emf.ecore.EStructuralFeature oldFeature, org.eclipse.emf.ecore.EObject eObject, boolean resolve)
URI
representing given eObject
owned by owner
through provided
feature
.If the eObject
is stand-alone (i.e freshly removed and without
attached resource) the URI
is determine using the owner
and the
feature
, if the eObject
is still attached to a Resource
the
URI
is calculated using same implementation as in ResourceImpl.unload()
.
Clients may implement/override this method when they require URIs with custom formats to be created.
oldOwner
- The EObject
owning the EObject
before it was deleted.oldFeature
- The EStructuralFeature
of the owner containing the eObject
before it was
deleted.eObject
- The EObject
for which the URI is to be created.resolve
- indicates whether the URI should resolved against the URI of the resource which contains the provided
model object. This is useful is cases where the native model object URI evaluates in some sort of
fragment-based URI which does not contain any information about the resource that contains the model
object (e.g., hb:/#//MyComponent/MyParameterValue). By setting resolve to true, such fragment-based
URIs will be automatically expanded to a URI that starts with the URI of the model object's resource
and is followed by the fragment of the model object's native URI (e.g.,
platform:/resource/MyProject/MyResource/#//MyComponent/MyParameterValue).eObject
, or null
if no such could be created.If the
provided EObject
has no eResource
and no owner
, the returned
value is null.org.eclipse.emf.common.util.URI createURI(java.lang.String uriLiteral, org.eclipse.emf.ecore.EClass eClass)
URI
from given uriLiteral
that refers to an instance of given object
type
. This method is typically called during deserialization of resources when it comes to creating proxy URIs
from serialized representations of cross-document references to objects in other resources.
Clients may implement/override this method when they require URIs with custom formats to be created
uriLiteral
- The string representation of the URI to be created.eClass
- The type of object that the URI to be created is supposed to refer to.uriLiteral
.org.eclipse.emf.common.util.URI getHREF(org.eclipse.emf.ecore.EObject eObject)
URI
representing an HREF to given EObject
stored in underlying Resource
. This
method is typically called during serialization of resources when it comes to creating serializable
representations of cross-document references for objects being referenced from other resources.
Clients may implement/override this method when they require HREFs with custom formats to be created.
eObject
- The object for which the HREF URI is to be created.org.eclipse.emf.common.util.Diagnostic validateURI(java.lang.String uri)
uri
- The URI string to be validated.Diagnostic.OK_INSTANCE
if given URI string is a valid URI or a Diagnostic
with
complementary information on error otherwise.void augmentToContextAwareProxy(org.eclipse.emf.ecore.EObject proxy)
proxy
to a context-aware proxy by adding key/value pairs that contain the
target metamodel descriptor
and a context URI
to the query string
of the proxy URI. Those are required to support the resolution of proxified references between
objects from different metamodels and to honor the resource scope
of the proxy URI when it
is being resolved.proxy
- The proxy to be handled.trimProxyContextInfo(URI)
org.eclipse.emf.common.util.URI trimProxyContextInfo(org.eclipse.emf.common.util.URI proxyURI)
proxy URI
contains proxy context-related key/value pairs on its query
string
, returns the URI formed by removing those key/value pairs or removing the query string entirely in case
that no other key/value pairs exist; returns given proxy URI unchanged, otherwise.proxyURI
- The context-aware proxy URI to be handled.augmentToContextAwareProxy(EObject)