org.eclipse.emf.mwe.utils
Class StandaloneSetup

java.lang.Object
  extended by org.eclipse.emf.mwe.utils.StandaloneSetup

public class StandaloneSetup
extends java.lang.Object

Initializes EMF support. Allows to register additional Packages.

Configuration

platformUri

Set the path to the root of the platform, usually ".."

Explicit platform mapping

If no .project files are available, an explicit mapping of projectName to path may be established.
 projectMapping = { 
   projectName = 'org.acme.myproject' 
   path = '../org.acme.myproject'
 }
 

URI Mapping

Map one URI to another. This is for example required when some resource refers to another with platform:/plugin URIs. Platform plugin URIs cannot be resolved in standalone mode, thus these URIs must be mapped to file or platform resource URIs.
 uriMap = {
   from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
   to = "platform:/resource/myproject/model/Ecore.ecore"
 }
 

Bundle name mapping

In the case that the folder name of a project does not match the bundle name, maps the bundle name to the real directory name on the platform.
 bundleNameMap = {
   from = "my.bundle.name"
   to = "bundledirectoryname"
 }
 


Field Summary
protected  org.eclipse.emf.ecore.EPackage.Registry registry
           
protected  org.eclipse.emf.ecore.resource.ResourceSet resourceSet
           
 
Constructor Summary
StandaloneSetup()
           
 
Method Summary
 void addBundleNameMap(Mapping mapping)
           
 void addExtensionMap(Mapping m)
          Adds an extension
 void addProjectMapping(ProjectMapping projectMapping)
           
 void addRegisterEcoreFile(java.lang.String fileName)
           
 void addRegisterGeneratedEPackage(java.lang.String interfacename)
           
 void addRegisterGenModelFile(java.lang.String fileName)
           
 void addUriMap(Mapping uriMap)
           
protected  GenModelHelper createGenModelHelper()
           
 org.eclipse.emf.ecore.EPackage getPackage(java.lang.String nsUri)
           
static java.lang.String getPlatformRootPath()
           
 boolean isIgnoreBrokenProjectFiles()
           
protected  void registerBundle(java.io.File file)
           
protected  void registerProject(java.io.File file)
           
protected  boolean scanFolder(java.io.File f)
           
protected  boolean scanFolder(java.io.File f, java.util.Set<java.lang.String> visitedPathes)
           
 void setIgnoreBrokenProjectFiles(boolean ignoreBrokenProjectFiles)
          Allows to ignore exception that occur while reading .project or Manifest.MF files.
 void setLogResourceUriMap(boolean doLog)
           
 void setPlatformUri(java.lang.String pathToPlatform)
          sets the platform uri for standalone execution
 void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
           
 void setResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl resourceSet)
           
 void setScanClassPath(boolean doScan)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceSet

protected org.eclipse.emf.ecore.resource.ResourceSet resourceSet

registry

protected org.eclipse.emf.ecore.EPackage.Registry registry
Constructor Detail

StandaloneSetup

public StandaloneSetup()
Method Detail

getPlatformRootPath

public static java.lang.String getPlatformRootPath()

setIgnoreBrokenProjectFiles

public void setIgnoreBrokenProjectFiles(boolean ignoreBrokenProjectFiles)
Allows to ignore exception that occur while reading .project or Manifest.MF files. Default is false.


isIgnoreBrokenProjectFiles

public boolean isIgnoreBrokenProjectFiles()

setLogResourceUriMap

public void setLogResourceUriMap(boolean doLog)

setScanClassPath

public void setScanClassPath(boolean doScan)

setPlatformUri

public void setPlatformUri(java.lang.String pathToPlatform)
sets the platform uri for standalone execution

Parameters:
pathToPlatform -

addProjectMapping

public void addProjectMapping(ProjectMapping projectMapping)

scanFolder

protected boolean scanFolder(java.io.File f)

scanFolder

protected boolean scanFolder(java.io.File f,
                             java.util.Set<java.lang.String> visitedPathes)

registerBundle

protected void registerBundle(java.io.File file)

registerProject

protected void registerProject(java.io.File file)

addUriMap

public void addUriMap(Mapping uriMap)
Parameters:
uriMap -

addExtensionMap

public void addExtensionMap(Mapping m)
                     throws ConfigurationException
Adds an extension

Parameters:
m - from: extension name, to factory classname
Throws:
ConfigurationException -
  • The factory class for the extension cannot be found
  • The inner factory class for the extension cannot be found

addRegisterGeneratedEPackage

public void addRegisterGeneratedEPackage(java.lang.String interfacename)

setResourceSet

public void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

setResourceSetImpl

public void setResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl resourceSet)

createGenModelHelper

protected GenModelHelper createGenModelHelper()

addRegisterGenModelFile

public void addRegisterGenModelFile(java.lang.String fileName)

addRegisterEcoreFile

public void addRegisterEcoreFile(java.lang.String fileName)
                          throws java.lang.IllegalArgumentException,
                                 java.lang.SecurityException
Throws:
java.lang.IllegalArgumentException
java.lang.SecurityException

getPackage

public org.eclipse.emf.ecore.EPackage getPackage(java.lang.String nsUri)

addBundleNameMap

public void addBundleNameMap(Mapping mapping)