Bug 145221 - KM3 Startup does undesirable startup activity
Summary: KM3 Startup does undesirable startup activity
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: gmt (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gmt-atl-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 145239
Blocks:
  Show dependency tree
 
Reported: 2006-06-04 02:49 EDT by Ed Willink CLA
Modified: 2017-04-11 15:12 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2006-06-04 02:49:12 EDT
org.atl.eclipse.km3.StartUp loads EMF models, slowing Eclipse start-up.
This is bad Eclipse practice.

Suggestion: change AtlModelHandler.defaultModelHandlers to an initialise on first access policy:

Map getDefaultModelHandlers() {
    if (defaultModelHandlers == null) {
        defaultModelHandlers = new HashMap();
        ... load extension points
    }
    return defaultModelHandlers;
}
Comment 1 Frédéric Jouault CLA 2006-06-05 08:17:20 EDT
I believe the KM3 plugin should register the KM3 metamodel.

EMF provides some support for metamodel registration.
For instance, the org.eclipse.emf.ecore.generated_package extension point does register a metamodel but requires generated code to be provided.

Is there an EMF extension point appropriate for the KM3 plugin?
If this is not the case, what other option do we have?
Comment 2 Ed Willink CLA 2006-06-05 15:57:31 EDT
Meta-models registered in plug-ins should definitely use the EMF registration point, since this does nothing until an Ecore plug-in is started, and then populates the registry with model references, which are not resolved until the model is used.

If you add:
    the missing nsURI and nsPrefix to PrimitiveTypes
    the missing instanceClassName to each of Bollean, Integer, String

you can create an EMF project from km3.ecore, use genmodel to generate the
model code and plugin. Using EMF 2.2.0RC6a there is one warning in the manifest due to an expecation that there will be a PrimitiveTypes.util package which is not generated for a DataType only package. Just delete the spurious package export.

This can all quite happily fit in the existing km3 plugin. (no need to generate edit and editor or test plug-ins). The plugin will be more standard if km3.ecore is at model/km3.ecore.

Since PrimitiveTypes is a regular requirement for ATL, you might care to factor it out as a separate model.
Comment 3 Frédéric Jouault CLA 2006-06-05 16:50:20 EDT
I do not consider generating Java code for the KM3 metamodel to be an appropriate solution:
- the purpose of a metamodel is not to generate code,
- the KM3 metamodel is not handled by Java code but by model transformations. Therefore, I believe it does not make a lot of sense to generate Java code for it.

Isn't there a simpler way to register metamodels?
Comment 4 Ed Willink CLA 2006-06-06 02:16:30 EDT
Generating Java code is the required solution today - because EMF has always been perceived as a Java code generator.

EMF package registration works by installing instances of EPackage.Descriptor in the global package registry. These are converted on demand by the getEPackage() method.

It should be possible for KM3 to install an EPackage.Descriptor that implements getEPackage() to load the Ecore file, rather than access the eINSTANCE of the generated code as EPackageDescriptor does at present.

This would solve the KM3 problem, and could also form the basis of an interactively invoked meta-model registration. Perhaps a .metamodels file in a project with GMT nature would automatically install its content.

I think we could contribute the alternate EPackage.Descriptor back to EMF so that it is automatically used for package registrations of the form

  <extension point="org.eclipse.emf.ecore.generated_package">
    <package 
       uri = "http://www.eclipse.org/gmt/2005/KM3" 
       ecoreModel = "model/KM3.ecore" /> 
  </extension>

although this is perhaps twisting 'generated_package' a bit far.
Comment 5 Ed Merks CLA 2006-06-06 06:37:10 EDT
Ed,

The idea of using generated_package or a new extension point just like it (dynamic_package) to register the location of a dynamic package seems reasonable.  Unless KM3 is some huge monster of a model whose generated code will bloat the byte code of the system significantly, generating the package/code for it is likely to result in a better performing and more compact instances even if only dynamic APIs are typically used.
Comment 6 Ed Willink CLA 2006-06-06 14:33:43 EDT
I shall continue this discussion for a potentially wider audience under the "Is Ecore fit for MOF meta-modelling?" thread on the Modeling project newsgroup.

There are some much wider philosophical issues.
Comment 7 Ed Willink CLA 2006-06-10 07:01:23 EDT
I have made this contribution as part of Bug 145239.

Once/if implemented you can just put something like

  <extension point="org.eclipse.emf.ecore.generated_package">
    <resource 
       uri = "http://www.eclipse.org/gmt/2005/KM3" 
       model = "model/KM3.ecore" 
       package = "KM3" /> 
    <resource 
       uri = "http://www.eclipse.org/gmt/2005/KM3Primitives" 
       model = "model/KM3.ecore" 
       package = "PrimitiveTypes" /> 
  </extension>

in plugin.xml.

You might even be able to imitate org.eclipse.emf.ecore.xmi.impl.EMOF* to support use of *.km3 as a first class model representation.