EGF Engine
Release 0.1.0

org.eclipse.egf.pattern.ecore
Class AbstractPatternGenerator

java.lang.Object
  extended by org.eclipse.egf.pattern.ecore.AbstractPatternGenerator

public abstract class AbstractPatternGenerator
extends Object

Ecore pattern generator.


Field Summary
protected static String ECORE_ECORE_FILE_ABSOLUTE_PATH
          Ecore ecore file absolute path.
protected static String GENERATED_TEMPLATE_FOLDER_PATH
          Generated templates sub-folder path.
protected static String PATTERN_ECORE_FILE_RELATIVE_PATH
          Pattern ecore file absolute path.
protected static String PATTERN_PARENT_CLASS_NAME
          Pattern parent class name, that is 'Pattern'.
protected static String TEMPLATES_FOLDER_NAME
          Templates folder name.
 
Constructor Summary
AbstractPatternGenerator()
           
 
Method Summary
static EOperation addOperation(Pattern pattern_p, String operationName_p)
          Add a new operation to handled pattern.
static void computeOperationsAnnotations(Pattern pattern_p, String fcId_p, AnnotationHandler annotationHandler_p)
          (Re)Compute annotations for all pattern operations.
static void computeProductionAnnotation(Pattern pattern_p, PatternHandler.ProductionOptionsHandler handler_p, AnnotationHandler annotationHandler_p)
          Compute and add production annotation for given pattern.
protected abstract  void fillPattern(Pattern newPattern_p, AnnotationHandler handler_p, EOperation generate_p)
          Fill newly created pattern with expected content.
 boolean generateEcoreFile()
          Generate pattern ecore file.
protected static EClass getDependencyFromName(String name_p, String ecoreURI_p, ResourceSet resourceSet_p)
          Find the class corresponding to given name in pointed ecore file.
protected  String getParentClassName()
          Get parent parent class name.
protected  String getParentEcoreURI()
          Get pattern parent class ecore URI.
protected abstract  String getPatternContainingPluginId()
          Get pattern containing plug-in id.
protected abstract  String getPatternFullId()
          Get pattern full id.
static String getPatternModelRelativePath(String containerId_p, String patternId_p)
          Get pattern model relative path.
protected  List<ParameterRelation> getPatternParameters(ResourceSet resourceSet_p)
          Get pattern parameters.
protected  String getPatternShortId(Pattern pattern_p)
          Get pattern short id.
protected  String getTemplateRelativePath(String patternShortId_p, String operationName_p, String operationId_p)
          Get template relative path from operation name.
static void removeOperation(Pattern pattern_p, EOperation operation_p)
          Remove operation from given pattern.
static void setPatternParent(Pattern pattern_p, String parentClassName_p, String parentEcoreURI_p, ResourceSet resourceSet_p)
          Set pattern parent to identified one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ECORE_ECORE_FILE_ABSOLUTE_PATH

protected static final String ECORE_ECORE_FILE_ABSOLUTE_PATH
Ecore ecore file absolute path.

See Also:
Constant Field Values

PATTERN_ECORE_FILE_RELATIVE_PATH

protected static final String PATTERN_ECORE_FILE_RELATIVE_PATH
Pattern ecore file absolute path.

See Also:
Constant Field Values

PATTERN_PARENT_CLASS_NAME

protected static final String PATTERN_PARENT_CLASS_NAME
Pattern parent class name, that is 'Pattern'.

See Also:
Constant Field Values

TEMPLATES_FOLDER_NAME

protected static final String TEMPLATES_FOLDER_NAME
Templates folder name.

See Also:
Constant Field Values

GENERATED_TEMPLATE_FOLDER_PATH

protected static final String GENERATED_TEMPLATE_FOLDER_PATH
Generated templates sub-folder path.

See Also:
Constant Field Values
Constructor Detail

AbstractPatternGenerator

public AbstractPatternGenerator()
Method Detail

getDependencyFromName

protected static EClass getDependencyFromName(String name_p,
                                              String ecoreURI_p,
                                              ResourceSet resourceSet_p)
Find the class corresponding to given name in pointed ecore file.

Parameters:
name_p -
ecoreURI_p -
resourceSet_p -
Returns:

getPatternParameters

protected List<ParameterRelation> getPatternParameters(ResourceSet resourceSet_p)
Get pattern parameters.
Ordered.

Parameters:
resourceSet_p -
Returns:

setPatternParent

public static void setPatternParent(Pattern pattern_p,
                                    String parentClassName_p,
                                    String parentEcoreURI_p,
                                    ResourceSet resourceSet_p)
Set pattern parent to identified one.
Default parent is Pattern.

Parameters:
pattern_p - The pattern that should be updated.
parentClassName_p - Parent class name, literally, or null if parent is to be reset.
parentEcoreURI_p - Parent class containing ecore uri, or null if parent is to be reset.
resourceSet_p - An existing one, or null if none is available.

generateEcoreFile

public boolean generateEcoreFile()
Generate pattern ecore file.


computeOperationsAnnotations

public static void computeOperationsAnnotations(Pattern pattern_p,
                                                String fcId_p,
                                                AnnotationHandler annotationHandler_p)
(Re)Compute annotations for all pattern operations.

Parameters:
pattern_p -
fcId_p -
annotationHandler_p -

computeProductionAnnotation

public static void computeProductionAnnotation(Pattern pattern_p,
                                               PatternHandler.ProductionOptionsHandler handler_p,
                                               AnnotationHandler annotationHandler_p)
Compute and add production annotation for given pattern.

Parameters:
pattern_p - The pattern needing to be tagged with a production annotation.
handler_p - The production options handler, containing the annotation value.
annotationHandler_p - A possibly existing annotation handler, null if none to provide at call time.

getPatternModelRelativePath

public static String getPatternModelRelativePath(String containerId_p,
                                                 String patternId_p)
Get pattern model relative path.

Parameters:
containerId_p - either the factory component or the plug-in id, depending on the caller.
It is up to the caller to make sure that given plug-in id (if so) is up-to-date (for instance after a refactoring).
patternId_p -
Returns:
null if one of the given parameter is null.

addOperation

public static EOperation addOperation(Pattern pattern_p,
                                      String operationName_p)
Add a new operation to handled pattern.

Parameters:
operationName_p -
Returns:
The annotation that will contain the resulting method contents (as defined by the pattern annotation grammar).
Empty at this time.

removeOperation

public static void removeOperation(Pattern pattern_p,
                                   EOperation operation_p)
Remove operation from given pattern.

Parameters:
pattern_p -
operation_p -

getPatternShortId

protected String getPatternShortId(Pattern pattern_p)
Get pattern short id.

Parameters:
pattern_p -
Returns:

getTemplateRelativePath

protected String getTemplateRelativePath(String patternShortId_p,
                                         String operationName_p,
                                         String operationId_p)
Get template relative path from operation name.

Parameters:
patternShortId_p -
operationName_p -
operationId_p -
Returns:

fillPattern

protected abstract void fillPattern(Pattern newPattern_p,
                                    AnnotationHandler handler_p,
                                    EOperation generate_p)
Fill newly created pattern with expected content.
The given operation is the 'generate' one, as defined by the pattern metamodel.

Parameters:
newPattern_p -
handler_p -
generateContent_p -

getParentClassName

protected String getParentClassName()
Get parent parent class name.

Returns:

getParentEcoreURI

protected String getParentEcoreURI()
Get pattern parent class ecore URI.

Returns:

getPatternContainingPluginId

protected abstract String getPatternContainingPluginId()
Get pattern containing plug-in id.

Returns:

getPatternFullId

protected abstract String getPatternFullId()
Get pattern full id.

Returns:

EGF Engine
Release 0.1.0

Copyright (c) Thales Corporate Services S.A.S, 2009.

This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.