org.eclipse.ocl.examples.modelregistry.standalone
Class JavaFileHandle

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.ocl.examples.modelregistry.standalone.JavaFileHandle
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, FileHandle
Direct Known Subclasses:
JavaProjectHandle

public class JavaFileHandle
extends org.eclipse.core.runtime.PlatformObject
implements FileHandle


Field Summary
protected  java.io.File file
           
protected  JavaProjectHandle projectHandle
           
 
Constructor Summary
protected JavaFileHandle(java.io.File projectFile)
           
  JavaFileHandle(JavaProjectHandle projectHandle, java.io.File file)
           
 
Method Summary
static java.lang.String createCanonicalFileName(java.io.File file)
           
 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.io.File getFile()
           
 java.lang.String getName()
          Return a name that can access the physical storage with respect to its parent.
 JavaFileHandle 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.core.runtime.IPath getProjectRelativePath()
           
 org.eclipse.emf.common.util.URI getURI()
          Get the URI of the file.
 java.io.File isFile()
          Return a non-null file object if this Handle applies to a file.
 java.io.File isFolder()
          Return a non-null folder object if this Handle applies to a folder or directory.
 java.io.File isProject()
          Return a non-null project object if this Handle applies to a project.
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

projectHandle

protected final JavaProjectHandle projectHandle

file

protected final java.io.File file
Constructor Detail

JavaFileHandle

protected JavaFileHandle(java.io.File projectFile)
                  throws java.io.IOException
Throws:
java.io.IOException

JavaFileHandle

public JavaFileHandle(JavaProjectHandle projectHandle,
                      java.io.File file)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

createCanonicalFileName

public static java.lang.String createCanonicalFileName(java.io.File file)
                                                throws java.io.IOException
Throws:
java.io.IOException

exists

public boolean exists()
Description copied from interface: FileHandle
Return true if file exists.

Specified by:
exists in interface FileHandle
Returns:
true if exists.

getAbsoluteName

public java.lang.String getAbsoluteName()
Description copied from interface: FileHandle
Return a name that can access the physical storage without reference to any other context.

Specified by:
getAbsoluteName in interface FileHandle
Returns:
the absolute name.

getContents

public java.io.InputStream getContents()
                                throws java.io.FileNotFoundException
Description copied from interface: FileHandle
Return a stream from which the contents can be read.

Specified by:
getContents in interface FileHandle
Returns:
the stream
Throws:
java.io.FileNotFoundException - if File access problem

getFile

public java.io.File getFile()

getName

public java.lang.String getName()
Description copied from interface: FileHandle
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.

Specified by:
getName in interface FileHandle
Returns:
the name.

getParentFileHandle

public JavaFileHandle getParentFileHandle()
Description copied from interface: FileHandle
Return the handle of the parent of this handle.

Specified by:
getParentFileHandle in interface FileHandle
Returns:
the parent handle, null for the parent of the project.

getProjectHandle

public ProjectHandle getProjectHandle()
Description copied from interface: FileHandle
Return the handle of the project.

Specified by:
getProjectHandle in interface FileHandle
Returns:
the project handle.

getProjectRelativeName

public java.lang.String getProjectRelativeName()
Description copied from interface: FileHandle
Return a name that can access the physical storage with respect to the project.

Specified by:
getProjectRelativeName in interface FileHandle
Returns:
the project relative name.

getProjectRelativePath

public org.eclipse.core.runtime.IPath getProjectRelativePath()

getURI

public org.eclipse.emf.common.util.URI getURI()
Description copied from interface: FileHandle
Get the URI of the file.

Specified by:
getURI in interface FileHandle
Returns:
the file URI

isFile

public java.io.File isFile()
Description copied from interface: FileHandle
Return a non-null file object if this Handle applies to a file.

Specified by:
isFile in interface FileHandle
Returns:
non-null file object.

isFolder

public java.io.File isFolder()
Description copied from interface: FileHandle
Return a non-null folder object if this Handle applies to a folder or directory.

Specified by:
isFolder in interface FileHandle
Returns:
non-null folder object.

isProject

public java.io.File isProject()
Description copied from interface: FileHandle
Return a non-null project object if this Handle applies to a project.

Specified by:
isProject in interface FileHandle
Returns:
non-null project object.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object