Package org.eclipse.xtext.xbase.resource
Class BatchLinkableResource
- 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.xtext.resource.XtextResource
-
- org.eclipse.xtext.linking.lazy.LazyLinkingResource
-
- org.eclipse.xtext.resource.persistence.StorageAwareResource
-
- org.eclipse.xtext.resource.DerivedStateAwareResource
-
- org.eclipse.xtext.xbase.resource.BatchLinkableResource
-
- All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier,org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.ecore.resource.Resource.Internal,org.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource,org.eclipse.xtext.resource.IBatchLinkableResource,org.eclipse.xtext.resource.ISynchronizable<BatchLinkableResource>
public class BatchLinkableResource extends org.eclipse.xtext.resource.DerivedStateAwareResource implements org.eclipse.xtext.resource.ISynchronizable<BatchLinkableResource>, org.eclipse.xtext.resource.IBatchLinkableResource, org.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource
A specialized EMF resource that is capable of resolving proxies in batch mode. That is, ongetEObject(String), theBatchLinkingServiceis used to resolve a chunk of proxies.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
org.eclipse.xtext.linking.lazy.LazyLinkingResource.CyclicLinkingException, org.eclipse.xtext.linking.lazy.LazyLinkingResource.DiagnosticMessageContext
-
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
org.eclipse.emf.ecore.resource.impl.ResourceImpl.ContentsEList<E extends java.lang.Object & org.eclipse.emf.ecore.EObject>, org.eclipse.emf.ecore.resource.impl.ResourceImpl.ModificationTrackingAdapter
-
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>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EScannableAdapterList
-
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
-
-
Field Summary
-
Fields inherited from class org.eclipse.xtext.resource.DerivedStateAwareResource
fullyInitialized, isInitializing
-
Fields inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource
UNRESOLVABLE_FRAGMENT
-
Fields inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT, cyclicLinkingDectectionCounterLimit, resolving, UNRESOLVEABLE_PROXIES_KEY
-
Fields inherited from class org.eclipse.xtext.resource.XtextResource
isUpdating, operationCanceledManager, OPTION_ENCODING, OPTION_FORMAT, OPTION_RESOLVE_ALL, OPTION_SERIALIZATION_OPTIONS
-
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, 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_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 Summary
Constructors Constructor Description BatchLinkableResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJvmMemberInitializer(java.lang.Runnable runnable)Register runnables to be executed when themembersoftypesin this resource are initialized.protected voiddoDiscardDerivedState()voidensureJvmMembersInitialized()Executes anyRunnables added throughaddJvmMemberInitializer(Runnable)<Result> Resultexecute(org.eclipse.xtext.util.concurrent.IUnitOfWork<Result,? super BatchLinkableResource> unit)org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject>getContents()org.eclipse.emf.ecore.EObjectgetEObject(java.lang.String uriFragment)Delegates to theBatchLinkingServiceif the requested reference islinkeable in batch mode.java.lang.ObjectgetLock()Returns the lock of the owningResourceSet, if it exposes such a lock.protected org.eclipse.emf.ecore.EObjecthandleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)booleanhasJvmMemberInitializers()booleanisInitializingJvmMembers()voidlinkBatched(org.eclipse.xtext.util.CancelIndicator monitor)voidresolveLazyCrossReferences(org.eclipse.xtext.util.CancelIndicator monitor)Delegates to the BatchLinkingService to resolve all references.-
Methods inherited from class org.eclipse.xtext.resource.DerivedStateAwareResource
clearInternalState, discardDerivedState, doGetContents, doUnload, getEObjectForURIFragmentRootSegment, getUnloadingContents, getURIFragmentRootSegment, installDerivedState, isFullyInitialized, isInitializing, setDerivedStateComputer, setFullyInitialized, updateInternalState, updateInternalState
-
Methods inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource
getPortableURIs, getResourceDescription, getResourceStorageFacade, getUnresolvableURIFragments, isLoadedFromStorage, load, loadFromStorage, setIsLoadedFromStorage, setResourceDescription
-
Methods inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
addLazyProxyInformation, clearLazyProxyInformation, createAndAddDiagnostic, createAndAddDiagnostic, createDiagnostic, createDiagnosticMessage, createDiagnosticMessageContext, doLinking, doLoad, doResolveLazyCrossReference, getDiagnosticList, getDiagnosticMessageProvider, getEncoder, getEObject, getLazyProxyInformation, getLazyProxyInformation, getLinkingHelper, getLinkingService, getReferences, hasLazyProxyInformation, isEagerLinking, isPotentialLazyCrossReference, isUnresolveableProxyCacheable, markUnresolvable, removeDiagnostic, removeLazyProxyInformation, resolveLazyCrossReference, setDiagnosticMessageProvider, setEagerLinking, setEncoder, setLinkingHelper, setLinkingService
-
Methods inherited from class org.eclipse.xtext.resource.XtextResource
addSyntaxDiagnostic, addSyntaxErrors, basicGetEObject, clearCache, clearErrorsAndWarnings, createReader, doSave, getCache, getConcreteSyntaxValidator, getEncoding, getEntryPoint, getFragmentProvider, getLanguageName, getLinker, getModificationStamp, getParser, getParseResult, getResourceServiceProvider, getSerializer, getUnloader, getURIFragment, isValidationDisabled, reattachModificationTracker, relink, reparse, setCache, setEncodingFromOptions, setEntryPoint, setFragmentProvider, setInjectedParser, setLanguageName, setLinker, setModificationStamp, setParser, setParseResult, setResourceServiceProvider, setSerializer, setUnloader, setValidationDisabled, unload, update, validateConcreteSyntax
-
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attached, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, getAllContents, getAllProperContents, getAllProperContents, getDefaultURIConverter, getEObject, getEObjectByID, getErrors, getIDForEObject, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getWarnings, handleLoadResponse, handleSaveResponse, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setModified, setTimeStamp, setTrackingModification, setURI, supportIDRelativeURIFragmentPaths, 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
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
-
-
-
-
Method Detail
-
getLock
public java.lang.Object getLock()
Returns the lock of the owningResourceSet, if it exposes such a lock. Otherwise this resource itself is used as the lock context.- Specified by:
getLockin interfaceorg.eclipse.xtext.resource.ISynchronizable<BatchLinkableResource>
-
execute
public <Result> Result execute(org.eclipse.xtext.util.concurrent.IUnitOfWork<Result,? super BatchLinkableResource> unit) throws java.lang.Exception
- Specified by:
executein interfaceorg.eclipse.xtext.resource.ISynchronizable<BatchLinkableResource>- Throws:
java.lang.Exception- Since:
- 2.4
-
getEObject
public org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
Delegates to theBatchLinkingServiceif the requested reference islinkeable in batch mode. Implementation detail: This specialization ofgetEObjectsynchronizes on thelockwhich is exposed by the synchronizable resource rather than on the resource directly. This guards against reentrant resolution from different threads that could block each other. Usually one would want to lock only in theBatchLinkingServicebut we could have intermixedlazy cross referenceand vanilla EMF cross references which again could lead to a dead lock.- Specified by:
getEObjectin interfaceorg.eclipse.emf.ecore.resource.Resource- Overrides:
getEObjectin classorg.eclipse.xtext.resource.persistence.StorageAwareResource
-
getContents
public org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContents()
Implementation detail: Overridden to use the shared
lock.- Specified by:
getContentsin interfaceorg.eclipse.emf.ecore.resource.Resource- Overrides:
getContentsin classorg.eclipse.xtext.resource.DerivedStateAwareResource
-
resolveLazyCrossReferences
public void resolveLazyCrossReferences(org.eclipse.xtext.util.CancelIndicator monitor)
Delegates to the BatchLinkingService to resolve all references. The linking service is responsible to lock the resource or resource set.- Overrides:
resolveLazyCrossReferencesin classorg.eclipse.xtext.linking.lazy.LazyLinkingResource
-
handleCyclicResolution
protected org.eclipse.emf.ecore.EObject handleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple) throws java.lang.AssertionError- Overrides:
handleCyclicResolutionin classorg.eclipse.xtext.linking.lazy.LazyLinkingResource- Throws:
java.lang.AssertionError
-
linkBatched
public void linkBatched(org.eclipse.xtext.util.CancelIndicator monitor)
- Specified by:
linkBatchedin interfaceorg.eclipse.xtext.resource.IBatchLinkableResource
-
ensureJvmMembersInitialized
public void ensureJvmMembersInitialized()
Executes anyRunnables added throughaddJvmMemberInitializer(Runnable)- Specified by:
ensureJvmMembersInitializedin interfaceorg.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource- Since:
- 2.8
- Noreference:
- This method is not intended to be referenced by clients.
-
isInitializingJvmMembers
public boolean isInitializingJvmMembers()
- Specified by:
isInitializingJvmMembersin interfaceorg.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource
-
doDiscardDerivedState
protected void doDiscardDerivedState()
- Overrides:
doDiscardDerivedStatein classorg.eclipse.xtext.resource.DerivedStateAwareResource
-
addJvmMemberInitializer
public void addJvmMemberInitializer(java.lang.Runnable runnable)
Register runnables to be executed when themembersoftypesin this resource are initialized.- Specified by:
addJvmMemberInitializerin interfaceorg.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource- Since:
- 2.8
- Noreference:
- This method is not intended to be referenced by clients.
-
hasJvmMemberInitializers
public boolean hasJvmMemberInitializers()
- Specified by:
hasJvmMemberInitializersin interfaceorg.eclipse.xtext.common.types.xtext.JvmMemberInitializableResource
-
-