org.eclipse.ocl.examples.modelregistry.environment
Interface FileHandle

All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
All Known Subinterfaces:
ProjectHandle
All Known Implementing Classes:
EclipseFileHandle, EclipseProjectHandle, JavaFileHandle, JavaProjectHandle

public interface FileHandle
extends org.eclipse.core.runtime.IAdaptable

A FileHandle provides access to a physical model storage medium. Handles are associated with an ProjectHandle that denotes a resource location of special significance. Relative access paths are resolved with respect to the ProjectHandle. Derived classes such as JavaFileHandle and EclipseFileHandle use java.io.File or org.eclipse.core.resources.IResource as the handler implementation. The JavaFileHandle is suitable for use in standalone applications. The EclipseFileHandle is suitable for use in Eclipse projects.


Method Summary
 boolean exists()
          Return true if file exists.
 java.lang.String getAbsoluteName()
          Return a name that can access the physical storage without reference to any other context.
 java.io.InputStream getContents()
          Return a stream from which the contents can be read.
 java.lang.String getName()
          Return a name that can access the physical storage with respect to its parent.
 FileHandle getParentFileHandle()
          Return the handle of the parent of this handle.
 ProjectHandle getProjectHandle()
          Return the handle of the project.
 java.lang.String getProjectRelativeName()
          Return a name that can access the physical storage with respect to the project.
 org.eclipse.emf.common.util.URI getURI()
          Get the URI of the file.
 java.lang.Object isFile()
          Return a non-null file object if this Handle applies to a file.
 java.lang.Object isFolder()
          Return a non-null folder object if this Handle applies to a folder or directory.
 java.lang.Object isProject()
          Return a non-null project object if this Handle applies to a project.
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Method Detail

exists

boolean exists()
Return true if file exists.

Returns:
true if exists.

getAbsoluteName

java.lang.String getAbsoluteName()
Return a name that can access the physical storage without reference to any other context.

Returns:
the absolute name.

getContents

java.io.InputStream getContents()
                                throws org.eclipse.core.runtime.CoreException,
                                       java.io.FileNotFoundException
Return a stream from which the contents can be read.

Returns:
the stream
Throws:
org.eclipse.core.runtime.CoreException - if Eclipse resource access problem
java.io.FileNotFoundException - if File access problem

getName

java.lang.String getName()
Return a name that can access the physical storage with respect to its parent. e.g the file name and extension without any devuice or directories.

Returns:
the name.

getParentFileHandle

FileHandle getParentFileHandle()
Return the handle of the parent of this handle.

Returns:
the parent handle, null for the parent of the project.

getProjectHandle

ProjectHandle getProjectHandle()
Return the handle of the project.

Returns:
the project handle.

getProjectRelativeName

java.lang.String getProjectRelativeName()
Return a name that can access the physical storage with respect to the project.

Returns:
the project relative name.

getURI

org.eclipse.emf.common.util.URI getURI()
Get the URI of the file.

Returns:
the file URI

isFile

java.lang.Object isFile()
Return a non-null file object if this Handle applies to a file.

Returns:
non-null file object.

isFolder

java.lang.Object isFolder()
Return a non-null folder object if this Handle applies to a folder or directory.

Returns:
non-null folder object.

isProject

java.lang.Object isProject()
Return a non-null project object if this Handle applies to a project.

Returns:
non-null project object.