org.eclipse.emf.henshin.statespace.external
Class AbstractFileBasedValidator

java.lang.Object
  extended by org.eclipse.emf.henshin.statespace.impl.AbstractStateSpaceValidator
      extended by org.eclipse.emf.henshin.statespace.external.AbstractFileBasedValidator
All Implemented Interfaces:
StateSpaceValidator, Validator
Direct Known Subclasses:
CADPStateSpaceValidator, CTMCStateSpaceValidator, CTMCSteadyStateTool, MCRL2StateSpaceValidator, MDPStateSpaceValidator

public abstract class AbstractFileBasedValidator
extends AbstractStateSpaceValidator

Abstract state space validator implementation that is based on invoking external tools on files derived from the state space. Contains some helper methods for invoking commands and converting files.


Field Summary
static String AUT_FILE_EXPORT_KEY
          A key used for exported AUT files.
 
Fields inherited from class org.eclipse.emf.henshin.statespace.impl.AbstractStateSpaceValidator
index, property
 
Constructor Summary
AbstractFileBasedValidator()
           
 
Method Summary
protected  void addCachedFile(StateSpace stateSpace, String key, File file)
          Cache a file that is associated to a state space.
protected  void clearCachedFiles(StateSpace stateSpace)
          Clear the file cache for the argument state space.
protected  void convertFile(File input, File output, org.eclipse.core.runtime.IProgressMonitor monitor, String... command)
          Convert a file using a given command.
protected  File createTempFile(String prefix, String suffix, String content)
          Simple helper method for creating temporary files.
protected  File export(StateSpace stateSpace, StateSpaceExporter exporter, String parameters, String fileext, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  File exportAsAUT(StateSpace stateSpace, org.eclipse.core.runtime.IProgressMonitor monitor)
          Export a state space as an AUT file.
protected  File getCachedFile(StateSpace stateSpace, String key)
          Get a cached file.
protected  boolean isLinux()
          Check whether the current platform is Linux.
protected  boolean isWindows()
          Check whether the current platform is Windows.
 
Methods inherited from class org.eclipse.emf.henshin.statespace.impl.AbstractStateSpaceValidator
setProperty, setStateSpaceIndex
 
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.henshin.statespace.StateSpaceValidator
validate
 
Methods inherited from interface org.eclipse.emf.henshin.statespace.Validator
getName, usesProperty
 

Field Detail

AUT_FILE_EXPORT_KEY

public static final String AUT_FILE_EXPORT_KEY
A key used for exported AUT files. Used for caching.

See Also:
Constant Field Values
Constructor Detail

AbstractFileBasedValidator

public AbstractFileBasedValidator()
Method Detail

addCachedFile

protected void addCachedFile(StateSpace stateSpace,
                             String key,
                             File file)
Cache a file that is associated to a state space.

Parameters:
stateSpace - The state space.
key - Unique key for the file type.
file - The file to be cached.

getCachedFile

protected File getCachedFile(StateSpace stateSpace,
                             String key)
Get a cached file.

Parameters:
stateSpace - State space.
key - Unique key.
Returns:
Cached file.

clearCachedFiles

protected void clearCachedFiles(StateSpace stateSpace)
Clear the file cache for the argument state space. This deletes all files associated to this state space.

Parameters:
stateSpace - The state space.

exportAsAUT

protected File exportAsAUT(StateSpace stateSpace,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
                    throws IOException
Export a state space as an AUT file.

Parameters:
stateSpace - State space.
aut - The AUT file.
Throws:
IOException - On I/O errors.

export

protected File export(StateSpace stateSpace,
                      StateSpaceExporter exporter,
                      String parameters,
                      String fileext,
                      org.eclipse.core.runtime.IProgressMonitor monitor)
               throws Exception
Throws:
Exception

convertFile

protected void convertFile(File input,
                           File output,
                           org.eclipse.core.runtime.IProgressMonitor monitor,
                           String... command)
                    throws Exception
Convert a file using a given command.

Parameters:
input - Input file.
output - Output file.
command - Command.
Throws:
Exception - On

createTempFile

protected File createTempFile(String prefix,
                              String suffix,
                              String content)
                       throws IOException
Simple helper method for creating temporary files.

Parameters:
content - Content.
Throws:
IOException - I/O errors.

isWindows

protected boolean isWindows()
Check whether the current platform is Windows.

Returns:
true if it is Windows.

isLinux

protected boolean isLinux()
Check whether the current platform is Linux.

Returns:
true if it is Linux.