org.eclipse.gmt.modisco.infra.query.core.internal
Class ReferedFileHandler

java.lang.Object
  extended by org.eclipse.gmt.modisco.infra.query.core.internal.ReferedFileHandler

public final class ReferedFileHandler
extends java.lang.Object

This class represents a reference to a file pointed by a model query attribute.

Author:
Gr?goire Dup? (Mia-Software)

Constructor Summary
ReferedFileHandler(java.lang.String containerName, java.lang.String fileLocation, ModelQuery modelQuery)
          This method returns an instance of ReferedFileHandler.
 
Method Summary
 boolean exists()
          This method returns true is the file exists.
 java.io.InputStream getInputStream()
          Return a input stream to the corresponding file
 IFile getWSFile()
          If the referred file is a workspace file, this method return return an IFile instance representing the referred file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferedFileHandler

public ReferedFileHandler(java.lang.String containerName,
                          java.lang.String fileLocation,
                          ModelQuery modelQuery)
This method returns an instance of ReferedFileHandler. The instance of ReferedFileHandler can be used to check the existence of a file and get its input stream.

Parameters:
containerName - The name of the containing plug-in or project. If containerName is null, the query model element container (plug-in or project) is used.
fileLocation - The location of the file into the container.
Method Detail

exists

public boolean exists()
This method returns true is the file exists.

Returns:
Returns true is the file exists.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.lang.Exception
Return a input stream to the corresponding file

Returns:
an input stream
Throws:
java.lang.Exception - If the file is not readable

getWSFile

public IFile getWSFile()
If the referred file is a workspace file, this method return return an IFile instance representing the referred file

Returns:
an IFile instance representing the referred file, null if this referred file is not a workspace file.