Class StandaloneSetup

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

public class StandaloneSetup extends 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 Details

    • JAR_NAME_PATTERN

      protected static final Pattern JAR_NAME_PATTERN
    • resourceSet

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

      protected org.eclipse.emf.ecore.EPackage.Registry registry
  • Constructor Details

    • StandaloneSetup

      public StandaloneSetup()
  • Method Details

    • getPlatformRootPath

      public static 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)
    • doRegisterResourceMapping

      protected void doRegisterResourceMapping(File file)
    • findProjectFileForPossibleClassesFolder

      protected File findProjectFileForPossibleClassesFolder(File f)
    • setPlatformUri

      public void setPlatformUri(String pathToPlatform)
      sets the platform uri for standalone execution
      Parameters:
      pathToPlatform -
    • addProjectMapping

      public void addProjectMapping(ProjectMapping projectMapping)
    • scanFolder

      protected boolean scanFolder(File f)
    • scanFolder

      protected boolean scanFolder(File f, Set<String> visitedPathes)
    • registerBundle

      protected void registerBundle(File file)
    • getBundleNameFromManifest

      protected String getBundleNameFromManifest(JarFile jarFile) throws IOException
      Throws:
      IOException
    • getBundleNameFromJarName

      protected String getBundleNameFromJarName(String jarFileName)
    • registerMapping

      protected void registerMapping(String name, org.eclipse.emf.common.util.URI uri)
    • registerProject

      protected void registerProject(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(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(String fileName)
    • addRegisterEcoreFile

      public void addRegisterEcoreFile(String fileName) throws IllegalArgumentException, SecurityException
      Throws:
      IllegalArgumentException
      SecurityException
    • getPackage

      public org.eclipse.emf.ecore.EPackage getPackage(String nsUri)
    • addBundleNameMap

      public void addBundleNameMap(Mapping mapping)