org.eclipse.emf.mwe.core.lib
Class AbstractWorkflowComponent

java.lang.Object
  extended by org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent
All Implemented Interfaces:
WorkflowComponent, WorkflowComponentWithID, IWorkflowComponent
Direct Known Subclasses:
AbstractWorkflowAdvice, AbstractWorkflowComponent2, FileCopy, WorkflowComponentWithModelSlot

public abstract class AbstractWorkflowComponent
extends java.lang.Object
implements WorkflowComponentWithID, IWorkflowComponent

Base class useful for implementing custom WorkflowComponents.


Constructor Summary
AbstractWorkflowComponent()
           
 
Method Summary
 void checkRequiredConfigProperty(java.lang.String configPropertyName, java.lang.Object configPropertyValue, Issues issues)
          Utility method that can be used in method checkConfiguration to check required properties.
protected  Mwe2Bridge getBridge()
           
 java.lang.String getComponentName()
          Returns the component's name.
 CompositeComponent getContainer()
          Returns the containing component if there is one.
 java.lang.String getId()
          Returns the ID of the component.
 Location getLocation()
          Returns the location in the source file that invokes the current component.
 java.lang.String getLogMessage()
          Returns the log message,
 void invoke(IWorkflowContext ctx)
           
 void invoke(WorkflowContext ctx, ProgressMonitor monitor, Issues issues)
          Invokes the component.
protected abstract  void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues)
          Internal method for component execution.
 void postInvoke()
           
 void preInvoke()
           
 void setContainer(CompositeComponent container)
          Sets the containing component.
 void setId(java.lang.String id)
          Sets the ID of the workflow component.
 void setLocation(Location location)
          Sets the location in the source file that invokes the current component.
 void setSkipOnErrors(boolean skipOnErrors)
          Sets if the current component should be skipped if previous components caused errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.mwe.core.WorkflowComponent
checkConfiguration
 

Constructor Detail

AbstractWorkflowComponent

public AbstractWorkflowComponent()
Method Detail

checkRequiredConfigProperty

public void checkRequiredConfigProperty(java.lang.String configPropertyName,
                                        java.lang.Object configPropertyValue,
                                        Issues issues)
Utility method that can be used in method checkConfiguration to check required properties. If configPropertyValue is null or a blank string then this method will add an error issue.

Parameters:
configPropertyName - Name of the checked config property.
configPropertyValue - The config property value.
issues - The Issues instance.

getComponentName

public java.lang.String getComponentName()
Returns the component's name. Overridable by custom components.

Specified by:
getComponentName in interface WorkflowComponent
Returns:
simple class name by default
Since:
4.3.1

getContainer

public CompositeComponent getContainer()
Description copied from interface: WorkflowComponent
Returns the containing component if there is one.

Specified by:
getContainer in interface WorkflowComponent
Returns:
The containing component if any

getId

public java.lang.String getId()
Description copied from interface: WorkflowComponentWithID
Returns the ID of the component.

Specified by:
getId in interface WorkflowComponentWithID
Returns:
the component ID
See Also:
WorkflowComponentWithID.getId()

getLocation

public Location getLocation()
Description copied from interface: WorkflowComponent
Returns the location in the source file that invokes the current component.

Specified by:
getLocation in interface WorkflowComponent
Returns:
the location
See Also:
WorkflowComponent.getLocation()

getLogMessage

public java.lang.String getLogMessage()
Description copied from interface: WorkflowComponentWithID
Returns the log message,

Specified by:
getLogMessage in interface WorkflowComponentWithID
Returns:
the log message
See Also:
WorkflowComponentWithID.getLogMessage()

invoke

public final void invoke(WorkflowContext ctx,
                         ProgressMonitor monitor,
                         Issues issues)
Description copied from interface: WorkflowComponent
Invokes the component.

Specified by:
invoke in interface WorkflowComponent
Parameters:
ctx - current workflow context
monitor - implementors should provide some feedback about the progress using this monitor
See Also:
WorkflowComponent.invoke(org.eclipse.emf.mwe.core.WorkflowContext, org.eclipse.emf.mwe.core.monitor.ProgressMonitor, org.eclipse.emf.mwe.core.issues.Issues)

setContainer

public void setContainer(CompositeComponent container)
Description copied from interface: WorkflowComponent
Sets the containing component.

Specified by:
setContainer in interface WorkflowComponent
Parameters:
container - the containing component
See Also:
WorkflowComponent.setContainer(org.eclipse.emf.mwe.core.container.CompositeComponent)

setId

public void setId(java.lang.String id)
Description copied from interface: WorkflowComponentWithID
Sets the ID of the workflow component.

Specified by:
setId in interface WorkflowComponentWithID
Parameters:
id - the ID
See Also:
WorkflowComponentWithID.setId(java.lang.String)

setLocation

public void setLocation(Location location)
Description copied from interface: WorkflowComponent
Sets the location in the source file that invokes the current component.

Specified by:
setLocation in interface WorkflowComponent
Parameters:
location - the location
See Also:
WorkflowComponent.setLocation(org.eclipse.emf.mwe.internal.core.ast.parser.Location)

setSkipOnErrors

public void setSkipOnErrors(boolean skipOnErrors)
Sets if the current component should be skipped if previous components caused errors.

Parameters:
skipOnErrors - if true, the current component is skipped if errors have occurred, if false, the component is not skipped.

invokeInternal

protected abstract void invokeInternal(WorkflowContext ctx,
                                       ProgressMonitor monitor,
                                       Issues issues)
Internal method for component execution.

Parameters:
ctx - the workflow context
monitor - the progress monitor
issues - container of execution issues

getBridge

protected Mwe2Bridge getBridge()

preInvoke

public void preInvoke()
Specified by:
preInvoke in interface IWorkflowComponent

invoke

public void invoke(IWorkflowContext ctx)
Specified by:
invoke in interface IWorkflowComponent

postInvoke

public void postInvoke()
Specified by:
postInvoke in interface IWorkflowComponent