public class DefaultPersistentResource extends ResourceImpl implements PersistentResource
PersistentResource that contains PersistentEObject.
DefaultPersistentResources is backend-agnostic and only delegates model element operations
to its internal PersistentStore which is responsible of database access.
ResourceImpl.ContentsEList<E extends Object & EObject>, ResourceImpl.ModificationTrackingAdapterBasicNotifierImpl.EAdapterList<E extends Object & Adapter>, BasicNotifierImpl.EObservableAdapterListResource.Diagnostic, Resource.Factory, Resource.Internal, Resource.IOWrappedException| Modifier and Type | Field and Description |
|---|---|
protected PersistenceBackend |
backend
The underlying
PersistenceBackend that stores the data. |
protected PersistentStore |
store
The
PersistentStore responsible of the database serialization. |
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri, warningseAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAGOPTION_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 |
|---|
DefaultPersistentResource(URI uri)
Constructs a new
DefaultPersistentResource with the given uri. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
doUnload()
Does all the work of unloading the resource.
|
InternalEObject.EStore |
eStore()
Returns the
InternalEObject.EStore used to store the model. |
protected void |
finalize() |
EList<EObject> |
getAllInstances(EClass eClass)
Computes the set of instances of the given
EClass (including its sub-types). |
EList<EObject> |
getAllInstances(EClass eClass,
boolean strict)
Computes the set of instances of the given
EClass. |
EList<EObject> |
getContents()
Returns the list of the direct content objects;
each is of type
EObject. |
EObject |
getEObject(String uriFragment)
Returns the resolved object for the given URI
fragment. |
protected File |
getFile()
Returns the database file.
|
String |
getURIFragment(EObject eObject)
Returns the URI
fragment that,
when passed to getEObject will return the given object. |
void |
load(Map<?,?> options)
Loads the resource using the specified options.
|
void |
save(Map<?,?> options)
Saves the resource using the specified options.
|
addModificationTrackingAdapters, attached, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, doLoad, doSave, getAllContents, getAllProperContents, getAllProperContents, getDefaultURIConverter, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getUnloadingContents, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, handleLoadResponse, handleSaveResponse, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setModified, setTimeStamp, setTrackingModification, setURI, toKeyString, toString, unload, unloaded, useZipeAdapters, eBasicAdapters, eDeliver, eSetDelivereBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotifyclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitattached, basicSetResourceSet, detached, isLoadingdelete, getAllContents, getErrors, getResourceSet, getTimeStamp, getURI, getWarnings, isLoaded, isModified, isTrackingModification, load, save, setModified, setTimeStamp, setTrackingModification, setURI, unloadeAdapters, eDeliver, eNotify, eSetDeliverprotected PersistentStore store
PersistentStore responsible of the database serialization.protected PersistenceBackend backend
PersistenceBackend that stores the data.protected File getFile()
public EList<EObject> getContents()
org.eclipse.emf.ecore.resource.ResourceEObject.
The contents may be directly modified.
Removing an object will have the same effect as
EcoreUtil.remove(EObject).
Adding an object will remove it from the previous container;
it's container will be null
and it's resource will the this.
getContents in interface ResourcegetContents in class ResourceImplpublic String getURIFragment(EObject eObject)
org.eclipse.emf.ecore.resource.Resourcefragment 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 ResourcegetURIFragment in class ResourceImpleObject - the object to identify.fragment for the object.Resource.getEObject(String),
InternalEObject.eURIFragmentSegment(org.eclipse.emf.ecore.EStructuralFeature, EObject)public EObject getEObject(String uriFragment)
org.eclipse.emf.ecore.resource.Resourcefragment.
The fragment encoding will typically be that produced by getURIFragment.
getEObject in interface ResourcegetEObject in class ResourceImpluriFragment - 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 void save(Map<?,?> options) throws IOException
org.eclipse.emf.ecore.resource.ResourceOptions are handled generically as feature-to-setting entries; the resource will ignore options it doesn't recognize. The options could even include things like an Eclipse progress monitor...
An implementation typically uses the URI converter
of the containing resource set
to create an output stream,
and then delegates to save(OutputStream, Map).
save in interface Resourcesave in class ResourceImploptions - the save options.IOExceptionResource.save(OutputStream, Map)public void load(Map<?,?> options) throws IOException
org.eclipse.emf.ecore.resource.ResourceOptions are handled generically as feature-to-setting entries; the resource will ignore options it doesn't recognize. The options could even include things like an Eclipse progress monitor...
An implementation typically uses the URI converter
of the containing resource set
to create an input stream,
and then delegates to load(InputStream, Map).
When the load completes, the errors and warnings can be consulted.
An implementation will typically deserialize as much of a document as possible
while producing diagnostics for any problems that are encountered.
load in interface Resourceload in class ResourceImploptions - the load options.IOExceptionResource.load(InputStream, Map)protected void doUnload()
org.eclipse.emf.ecore.resource.impl.ResourceImplunloaded for each object it the content tree,
and clears the contents, errors, and warnings.doUnload in class ResourceImplpublic void close()
close in interface PersistentResourceclose in interface Closeableclose in interface AutoCloseablepublic InternalEObject.EStore eStore()
PersistentResourceInternalEObject.EStore used to store the model.eStore in interface PersistentResourceInternalEObject.EStorepublic EList<EObject> getAllInstances(EClass eClass)
PersistentResourceEClass (including its sub-types).
This method is similar to PersistentResource.getAllInstances(EClass, boolean) with strict=false.
getAllInstances in interface PersistentResourceeClass - the EClass for which look for instancesEClass from the resourcepublic EList<EObject> getAllInstances(EClass eClass, boolean strict)
PersistentResourceEClass.getAllInstances in interface PersistentResourceeClass - the EClass for which look for instancesstrict - true if the lookup searches for strict instancestrue then the method returns only the strict instances of the given EClass, otherwise
it also returns the instances of the sub-types of eClass.Copyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.