IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.transform.core
Class ValidateEditRule

java.lang.Object
  extended bycom.ibm.xtools.transform.core.AbstractTransformElement
      extended bycom.ibm.xtools.transform.core.AbstractRule
          extended bycom.ibm.xtools.transform.core.ValidateEditRule
All Implemented Interfaces:
ITransformationItem

public class ValidateEditRule
extends AbstractRule

This Validate Edit Rule provides a mechanism for transformations to ensure that the files they want to modify will have the correct permissions. The transformation author should insert this rule into his transformation at a point where it will only be executed once and before any of the affected files are modified. Before the rule is executed, the transformation must indicate the files (IFile) that will be modified by calling the addAffectedFiles() methods. These (static) methods can be called multiple times to add files to the set of affected files maintained by the rule. The list of files is stored in the context.


Constructor Summary
ValidateEditRule()
          The default constructor should only be used internally by the transformation service.
ValidateEditRule(String id, String name)
          Construct a validate edit rule with an id and name.
 
Method Summary
static void addAffectedFile(ITransformContext context, IFile file)
          Add a file to the list of affected files.
static void addAffectedFiles(ITransformContext context, List fileList)
          Add the given files to the list of affected files.
protected  Object createTarget(ITransformContext context)
          Ensure the files to be affected (extracted from the context) can be modified.
protected  void reportError(IStatus status, ITransformContext context)
          Process error that occured during file validation.
 
Methods inherited from class com.ibm.xtools.transform.core.AbstractRule
execute, findTarget, isSourceConsumed, mapTarget, toString, updateTarget
 
Methods inherited from class com.ibm.xtools.transform.core.AbstractTransformElement
canAccept, 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

ValidateEditRule

public ValidateEditRule()
The default constructor should only be used internally by the transformation service.


ValidateEditRule

public ValidateEditRule(String id,
                        String name)
Construct a validate edit rule with an id and name.

Parameters:
id - A unique identifier for the rule.
name - The name of the rule.
Method Detail

addAffectedFile

public static void addAffectedFile(ITransformContext context,
                                   IFile file)
Add a file to the list of affected files.

Parameters:
context - the current context of the transformation execution
file - A file that will be created or modified by the transform.

addAffectedFiles

public static void addAffectedFiles(ITransformContext context,
                                    List fileList)
Add the given files to the list of affected files.

Parameters:
context - the current context of the transformation execution
fileList - a list of files (of type IFile)that will be created or modified by the transform.

createTarget

protected Object createTarget(ITransformContext context)
                       throws Exception
Ensure the files to be affected (extracted from the context) can be modified. This method does not create any target objects.

Specified by:
createTarget in class AbstractRule
Parameters:
context - the current context of the transformation execution
Returns:
Object - null is always returned (no target objects created)
Throws:
Exception

reportError

protected void reportError(IStatus status,
                           ITransformContext context)
Process error that occured during file validation. Can be overriden by subclasses to modify reaction to file validation error.

Parameters:
status - - file validation status
context - - the current context of the transformation execution

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.