|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.xtools.transform.core.AbstractTransformElement
com.ibm.xtools.transform.core.AbstractTransform
com.ibm.xtools.transform.core.Transform
This Transform class contains the implementation for the default transformation engine.
In the default transformation engine, transforms are containers that traverse the transformation element hierarchy, executing extractors, rules and nested transforms. Extractors effectively walk the source model and rules create or update the target model.
All of these transformation elements (rules, extractors, transforms) contained by a transform are kept in a single list. Execution of the transform is achieved by executing its transformation elements, in sequence, with the same transform context.
In the default transformation engine architecture, every transform MUST have a unique identifier (within the transformation).
Constructor Summary | |
Transform()
The default constructor should only be used internally by the transformation service. |
|
Transform(ITransformationDescriptor descriptor)
Constructor for creating root transforms. |
|
Transform(String id)
Constructor for creating transforms within the transformation hierarchy. |
Method Summary | |
void |
add(AbstractTransformElement transformElement)
Add a transformation element to this transform by appending the new element to the end of the element list. |
void |
add(int index,
AbstractTransformElement transformElement)
Add a transformation element to this transform. |
boolean |
canAccept(ITransformContext context)
Determine if the context contains enough information so that the transform can execute it. |
void |
execute(ITransformContext context)
Execute the transform with the given context. |
AbstractTransform |
findTransform(String id)
Find a transform with the specified identifier that is contained within this transformation hierarchy. |
Collection |
getElements()
Return the collection of transformation elements associated with this transform. |
protected Collection |
getElements(ITransformContext context)
Retrieve a list of transformation elements for a given transform context. |
protected void |
handle(Exception exception,
ITransformContext context)
Handle exceptions in the transformation engine. |
protected void |
initializeProgress(IProgressMonitor monitor,
ITransformContext context)
Initializes the progress monitor for the execution of the transformation. |
protected void |
registerTransform(Transform transform)
Add a transform to the registry of all transforms in this transformation heirarchy. |
boolean |
remove(AbstractTransformElement transformElement)
Remove a transformation element from this transform |
String |
toString()
|
Methods inherited from class com.ibm.xtools.transform.core.AbstractTransform |
createContext, getTransformationDescriptor |
Methods inherited from class com.ibm.xtools.transform.core.AbstractTransformElement |
getAcceptCondition, getDescription, getId, getName, getProgressMonitor, setAcceptCondition, setDescription, setId, setName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Transform()
When this constructor is used, the caller must immediately call setId() to assign a unique identifier to this transform.
public Transform(String id)
id
- A unique id for the transform.public Transform(ITransformationDescriptor descriptor)
descriptor
- A transform descriptor.Method Detail |
public final void add(int index, AbstractTransformElement transformElement)
index
- the zero-based index where to insert the elementtransformElement
- the element to be insertedpublic void add(AbstractTransformElement transformElement)
transformElement
- the element to be appendedpublic final boolean remove(AbstractTransformElement transformElement)
transformElement
- the element to remove
public boolean canAccept(ITransformContext context)
canAccept
in class AbstractTransformElement
context
- the current context of the transformation execution
public void execute(ITransformContext context) throws Exception
AbstractTransform
execute
in class AbstractTransform
context
- the current context of the transformation execution
Exception
AbstractTransform.execute(com.ibm.xtools.transform.core.ITransformContext)
public final AbstractTransform findTransform(String id)
id
- the unique identifier of the transform to look for
public final Collection getElements()
protected Collection getElements(ITransformContext context)
context
- - a transformation context
protected final void registerTransform(Transform transform)
transform
- A transform to be registered.public String toString()
protected void handle(Exception exception, ITransformContext context)
Because of the recursive nature of the engine, an exception can be caught while quite deeping the execution hierarchy of the transformation. The goal is to catch the real exception and wrap it up in a special transform exception. This special exception is then rethrown and caught by all of the transforms executing in the trasform context stack. The root transform will simply throw the exception, which must be caught by the client executing the transformation.
When the execution is first caught, it is logged and traced. It is up to the client executing the transformation to display an error dialog if necessary.
exception
- the exception that was throwncontext
- the execute context in which the exception occurredprotected void initializeProgress(IProgressMonitor monitor, ITransformContext context)
monitor
- - the progress monitor for the transformationcontext
- the current context of the transformation execution
|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2004. All rights reserved.