JDeveloper SCM API

oracle.ide.scm
Interface SCMFile


public interface SCMFile

Interface for URL-wrapping file representatives, holding convenience methods for operations to facilitate on a per-file basis. The use of these files as provided to operations is recommended, but access and conversion methods for other resource types are also given. This interface provides a useful and layer of separation between the underlying form of the resource an extension implementation.


Method Summary
 void copy(SCMFile dst)
          Copies the contents of the file at this location to another.
 void delete()
          Deletes the represented file from the filesystem.
 boolean exists()
          Asks whether a file exists at the URL.
 java.lang.Object getData()
          Get the arbitrary data object which is stored with this file.
 java.lang.String getExtension()
          Gets the suffix extension of this file, with the '.' prefix.
 java.lang.String getFileName()
          Gets the name of the file, not including any URL protocol, hostname authentication, directory path, anchor, or query.
 javax.swing.Icon getIcon()
          Provides access to the file element's icon.
 SCMFileStatus getLatestStatus()
          Gets the status of this file through the client, flushing any cached value.
 java.lang.String getName()
          Gets the name of this file, ie.
 SCMFile getParent()
          Gets the parent for this file, a directory.
 java.lang.String getPath()
          Gets the path of the file, translated into local filesystem form from the file's URL.
 java.util.Iterator getProjectSources()
          Gets all files for the source path of this project file.
 SCMFileStatus getStatus()
          Gets the status of this file through the client, represented by the client's chosen status constant.
 java.net.URL getURL()
          Gets the Uniform Resource Locator for the file.
 boolean hasParent(SCMFile file)
          Asks whether the given file is a parent directory for this file.
 boolean isDirectory()
          Asks whether this file, as represented by the URL, is a directory.
 boolean isProject()
          Asks whether this file represents a project in the IDE.
 boolean isReadOnly()
          Asks whether the file is read-only.
 boolean isWorkspace()
          Asks whether this file represents a workspace in the IDE.
 void renameTo(SCMFile dst)
          Renames this file to the name of the given destination file.
 java.io.File toFile()
          Converts this file to a java 'io' package File object.
 

Method Detail

getIcon

public javax.swing.Icon getIcon()
Provides access to the file element's icon.
Returns:
The element icon corresponding to this file.

getURL

public java.net.URL getURL()
Gets the Uniform Resource Locator for the file.
Returns:
a URL object for this file.

exists

public boolean exists()
Asks whether a file exists at the URL.
Returns:
a verdict on whether the file exists.

isDirectory

public boolean isDirectory()
Asks whether this file, as represented by the URL, is a directory.
Returns:
a verdict on the file being a directory

getStatus

public SCMFileStatus getStatus()
                        throws SCMException
Gets the status of this file through the client, represented by the client's chosen status constant. Note: status calls have the potential to be very expensive where there are multiple files within the selection, and should for this reason be avoided wherever possible. Do not call the client's status query method directly, since state information is cached within the framework.
Returns:
the cached status for this file.

getLatestStatus

public SCMFileStatus getLatestStatus()
                              throws SCMException
Gets the status of this file through the client, flushing any cached value. The resulting status is therefore reliably accurate, but for performance reasons this method should be avoided in favor of getStatus(). Only make this call when you cannot be sure that the client has caused a file state change, or when you can be sure the file state has changed but cannot predict the resulting status.
Returns:
the latest status for this file.

getFileName

public java.lang.String getFileName()
Gets the name of the file, not including any URL protocol, hostname authentication, directory path, anchor, or query.
Returns:
the name for the file, with extension.

getName

public java.lang.String getName()
Gets the name of this file, ie. the unqualified file name minus the file's extension.
Returns:
the name for the file.

getPath

public java.lang.String getPath()
Gets the path of the file, translated into local filesystem form from the file's URL.
Returns:
the fully qualified path for the file.

getExtension

public java.lang.String getExtension()
Gets the suffix extension of this file, with the '.' prefix.
Returns:
the extension for the file.

getParent

public SCMFile getParent()
Gets the parent for this file, a directory.
Returns:
the file's parent as a file, or null if the path represented by the file is the drive's root.

hasParent

public boolean hasParent(SCMFile file)
Asks whether the given file is a parent directory for this file.
Returns:
a verdict as to whether the file is a parent.

isWorkspace

public boolean isWorkspace()
Asks whether this file represents a workspace in the IDE.
Returns:
a verdict on whether this file is a workspace.

isProject

public boolean isProject()
Asks whether this file represents a project in the IDE.
Returns:
a verdict on whether this file is a project.

getProjectSources

public java.util.Iterator getProjectSources()
Gets all files for the source path of this project file.
Returns:
an iterator over project source files, or null if this file is not a project.

toFile

public java.io.File toFile()
Converts this file to a java 'io' package File object.
Returns:
the File form of this file identifier.

getData

public java.lang.Object getData()
Get the arbitrary data object which is stored with this file.
Returns:
an object stored with the file. Or null if there is no stored object.

isReadOnly

public boolean isReadOnly()
Asks whether the file is read-only.
Returns:
a verdict on whether the file has read-only permissions.

delete

public void delete()
            throws SCMException
Deletes the represented file from the filesystem. This method cannot delete directories which contain files. The model and node hierarchy will be correctly maintained by this method; for this reason, its use is recommended over equivalent offerings in URLFileSystem and File.
Throws:
SCMException - if the file deletion could not be achieved, for example if the location was found to be read-only.

renameTo

public void renameTo(SCMFile dst)
              throws SCMException
Renames this file to the name of the given destination file. The model and node hierarchy will be correctly maintained by this method; for this reason, its use is recommended over equivalent offerings in URLFileSystem and File.
Parameters:
dst - the desired destination for the renamed file.
Throws:
SCMException - if the file rename could not be achieved, for example if target folder creation failed.

copy

public void copy(SCMFile dst)
          throws SCMException
Copies the contents of the file at this location to another.
Parameters:
dst - the desired destination for the copied file.
Throws:
SCMException - if the file copy could not be achieved, for example if the target exists as a different file type (directory vs. file).

Copyright © 2002 Oracle Corporation