Class Reader
- java.lang.Object
-
- org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent
-
- org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2
-
- org.eclipse.xtext.mwe.AbstractReader
-
- org.eclipse.xtext.mwe.Reader
-
- All Implemented Interfaces:
org.eclipse.emf.mwe.core.WorkflowComponent,org.eclipse.emf.mwe.core.WorkflowComponentWithID,org.eclipse.emf.mwe2.runtime.workflow.IWorkflowComponent
public class Reader extends AbstractReader
A Reader used to read EMF resources from a set of pathes. A path can point to a folder or an archive (zips and jars are supported). Those pathes are recursively scanned and all resources for which an
IResourceServiceProvideris registered in theIResourceServiceProvider.Registrywill be available.The
ISetupof an Xtext language registers such anIResourceServiceProviderautomatically. If you want to integrate with non Xtext-based models, make sure to addIResourceServiceProvidermanually. The easiest way might be to implement anISetup.A
SlotEntryis responsible for selecting certain EObjects from the loaded resources. It supports selecting EObjects by their name (seeIEObjectDescription) or by an EClass. In many cases such selction returns multiple EObjects, if you're only interested in one element set thefirstOnlyflag totrue.You might want to populate multiple workflow slots with model elements.
Below are examples of a usage in the MWE2 DSL and MWE XML syntax:
component = org.eclipse.xtext.mwe.Reader { useJavaClassPath = true register = foo.bar.MyLanguageStandaloneSetup {} load = { slot = "types" type = "Type" } validate = org.eclipse.xtext.mwe.Validator { stopOnError = false } }<component class="org.eclipse.xtext.mwe.Reader" useJavaClassPath="true"> <register class="foo.bar.MyLanguageStandaloneSetup"/> <load slot="types" type="Type"/> <validate/> </component>
It supports fetching elements by typeIResourceServiceProvider.getResourceDescriptionManager()is used to identify model elements within these resources.
-
-
Constructor Summary
Constructors Constructor Description Reader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPath(java.lang.String path)A comma-separated list of paths pointing to a folder, jar or zip which contains EMF resources.protected voidcheckConfigurationInternal(org.eclipse.emf.mwe.core.issues.Issues issues)ContainersStateFactorygetContainersStateFactory()java.util.List<java.lang.String>getPathes()protected PathTraversergetPathTraverser()UriFiltergetUriFilter()protected voidinstallAsAdapter(org.eclipse.emf.ecore.resource.ResourceSet set, IAllContainersState containersState)protected voidinvokeInternal(org.eclipse.emf.mwe.core.WorkflowContext ctx, org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor, org.eclipse.emf.mwe.core.issues.Issues issues)protected voidpopulateResourceSet(org.eclipse.emf.ecore.resource.ResourceSet set, com.google.common.collect.Multimap<java.lang.String,org.eclipse.emf.common.util.URI> uris)voidsetContainersStateFactory(ContainersStateFactory containersStateFactory)voidsetUriFilter(UriFilter filter)Optionally set a filter that specifies which URIs are valid to be read.voidsetUseJavaClassPath(boolean isUse)Automatically adds all class path entries of the current process (more specifically uses 'java.class.path' system property).-
Methods inherited from class org.eclipse.xtext.mwe.AbstractReader
addLoad, addLoadFromResourceSet, addLoadResource, addModelElementsToContext, addRegister, getInjectors, getRegistry, getResourceDescriptionsProvider, getResourceSet, getResourceSetProvider, getSlotEntries, getValidator, setResourceDescriptionsProvider, setResourceSetProvider, setValidate
-
Methods inherited from class org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2
checkConfiguration
-
-
-
-
Method Detail
-
addPath
public void addPath(java.lang.String path)
A comma-separated list of paths pointing to a folder, jar or zip which contains EMF resources.
Example use (MWE2):
path = "./foo/bar.jar,./src/main/model"Example use (MWE1):
<path value="./foo/bar.jar,./src/main/model"/>
-
getPathes
public java.util.List<java.lang.String> getPathes()
-
setUseJavaClassPath
public void setUseJavaClassPath(boolean isUse)
Automatically adds all class path entries of the current process (more specifically uses 'java.class.path' system property).
Example use (MWE2):
useJavaClassPath = trueExample use (MWE1):
<useJavaClassPath value="true"/>
-
setUriFilter
public void setUriFilter(UriFilter filter)
Optionally set a filter that specifies which URIs are valid to be read. A common use-case for filters is a file-name based selection of valid URIs.
-
getUriFilter
public UriFilter getUriFilter()
-
setContainersStateFactory
public void setContainersStateFactory(ContainersStateFactory containersStateFactory)
-
getContainersStateFactory
public ContainersStateFactory getContainersStateFactory()
-
checkConfigurationInternal
protected void checkConfigurationInternal(org.eclipse.emf.mwe.core.issues.Issues issues)
- Overrides:
checkConfigurationInternalin classAbstractReader
-
invokeInternal
protected void invokeInternal(org.eclipse.emf.mwe.core.WorkflowContext ctx, org.eclipse.emf.mwe.core.monitor.ProgressMonitor monitor, org.eclipse.emf.mwe.core.issues.Issues issues)- Specified by:
invokeInternalin classorg.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent
-
getPathTraverser
protected PathTraverser getPathTraverser()
-
populateResourceSet
protected void populateResourceSet(org.eclipse.emf.ecore.resource.ResourceSet set, com.google.common.collect.Multimap<java.lang.String,org.eclipse.emf.common.util.URI> uris)
-
installAsAdapter
protected void installAsAdapter(org.eclipse.emf.ecore.resource.ResourceSet set, IAllContainersState containersState) throws org.eclipse.emf.mwe.core.WorkflowInterruptedException- Throws:
org.eclipse.emf.mwe.core.WorkflowInterruptedException
-
-