org.netbeans.lib.cvsclient
Interface ClientServices

All Known Implementing Classes:
Client

public interface ClientServices

Clients that provide the ability to execute commands must implement this interface. All commands use this interface to get details about the environment in which it is being run, and to perform administrative functions such as obtaining Entry lines for specified files.


Method Summary
 void ensureConnection()
          Ensures, that the connection is open.
 boolean exists(java.io.File file)
          Tests for existence of the given file.
 java.util.Set getAllFiles(java.io.File directory)
          Get all the files contained within a given directory that are known to CVS.
 java.util.Iterator getEntries(java.io.File directory)
          Get the entries for a specified directory.
 Entry getEntry(java.io.File file)
          Get the Entry for the specified file, if one exists.
 GlobalOptions getGlobalOptions()
          Get the global options that are set to this client.
 IgnoreFileFilter getIgnoreFileFilter()
          Returns the IgnoreFileFilter used to ignore non-cvs files.
 java.lang.String getLocalPath()
          Get the local path that the command is executing in.
 java.lang.String getRepository()
          Get the repository used for this connection.
 java.lang.String getRepositoryForDirectory(java.io.File directory)
          Semantically equivalent to getRepositoryForDirectory(String) but does not try to recover from missing CVS/Repository file.
 java.lang.String getRepositoryForDirectory(java.lang.String directory)
          Get the repository path for a given directory, for example in the directory /home/project/foo/bar, the repository directory might be /usr/cvs/foo/bar.
 java.lang.String getStickyTagForDirectory(java.io.File directory)
          Checks for presence of CVS/Tag file and returns it's value.
 java.util.Map getWrappersMap()
          Returns the wrappers map associated with the CVS server The map is valid only after the connection is established
 boolean isAborted()
          Tests whether command execution should be aborted.
 boolean isFirstCommand()
          Returns true if no command was sent before.
 void processRequests(java.util.List requests)
          Process all the requests.
 void removeEntry(java.io.File file)
          Removes the Entry for the specified file.
 void setGzipFileHandler(FileHandler handler)
          Set the handler for Gzip data.
 void setIgnoreFileFilter(IgnoreFileFilter filter)
          Sets the specified IgnoreFileFilter to use to ignore non-cvs files.
 void setIsFirstCommand(boolean first)
          Set whether this is the first command.
 void setUncompressedFileHandler(FileHandler handler)
          Set the uncompressed file handler.
 boolean shouldBeIgnored(java.io.File directory, java.lang.String nonCvsFile)
          Returnes true to indicate, that the file specified by directory and nonCvsFile should be ignored.
 void updateAdminData(java.lang.String localDirectory, java.lang.String repositoryPath, Entry entry)
          Create or update the administration files for a particular file This will create the CVS directory if necessary, and the Root and Repository files if necessary.
 

Method Detail

processRequests

void processRequests(java.util.List requests)
                     throws java.io.IOException,
                            UnconfiguredRequestException,
                            ResponseException,
                            CommandAbortedException
Process all the requests.

Parameters:
requests - the requets to process
Throws:
java.io.IOException
UnconfiguredRequestException
ResponseException
CommandAbortedException

getRepository

java.lang.String getRepository()
Get the repository used for this connection.

Returns:
the repository, for example /home/bob/cvs

getRepositoryForDirectory

java.lang.String getRepositoryForDirectory(java.lang.String directory)
                                           throws java.io.IOException
Get the repository path for a given directory, for example in the directory /home/project/foo/bar, the repository directory might be /usr/cvs/foo/bar. The repository directory is commonly stored in the file
Repository
in the CVS directory on the client. (This is the case in the standard CVS command-line tool)

Parameters:
directory - the directory
Throws:
java.io.IOException

getRepositoryForDirectory

java.lang.String getRepositoryForDirectory(java.io.File directory)
                                           throws java.io.IOException
Semantically equivalent to getRepositoryForDirectory(String) but does not try to recover from missing CVS/Repository file.

Parameters:
directory - the directory to get repository for
Returns:
repository path that corresponds to the given local working directory or null if local directory is not versioned or does not exist
Throws:
java.io.IOException - if the repository cannot be determined by reading CVS/Repository file

getLocalPath

java.lang.String getLocalPath()
Get the local path that the command is executing in.

Returns:
the local path

getEntry

Entry getEntry(java.io.File file)
               throws java.io.IOException
Get the Entry for the specified file, if one exists.

Parameters:
file - the file
Throws:
java.io.IOException - if the Entries file cannot be read

getEntries

java.util.Iterator getEntries(java.io.File directory)
                              throws java.io.IOException
Get the entries for a specified directory.

Parameters:
directory - the directory for which to get the entries
Returns:
an iterator of Entry objects
Throws:
java.io.IOException

updateAdminData

void updateAdminData(java.lang.String localDirectory,
                     java.lang.String repositoryPath,
                     Entry entry)
                     throws java.io.IOException
Create or update the administration files for a particular file This will create the CVS directory if necessary, and the Root and Repository files if necessary. It will also update the Entries file with the new entry

Parameters:
localDirectory - the local directory, relative to the directory in which the command was given, where the file in question lives
entry - the entry object for that file
Throws:
java.io.IOException - if there is an error writing the files

getAllFiles

java.util.Set getAllFiles(java.io.File directory)
                          throws java.io.IOException
Get all the files contained within a given directory that are known to CVS.

Parameters:
directory - the directory to look in
Returns:
a set of all files.
Throws:
java.io.IOException

isFirstCommand

boolean isFirstCommand()
Returns true if no command was sent before. This is used, because the server rejects some doubled commands.


setIsFirstCommand

void setIsFirstCommand(boolean first)
Set whether this is the first command. Normally you do not need to set this yourself - after execution the first command will have set this to false.


removeEntry

void removeEntry(java.io.File file)
                 throws java.io.IOException
Removes the Entry for the specified file.

Throws:
java.io.IOException

setIgnoreFileFilter

void setIgnoreFileFilter(IgnoreFileFilter filter)
Sets the specified IgnoreFileFilter to use to ignore non-cvs files. TS, 2001-11-23: really needed in the interface (it's never used)?


getIgnoreFileFilter

IgnoreFileFilter getIgnoreFileFilter()
Returns the IgnoreFileFilter used to ignore non-cvs files. TS, 2001-11-23: really needed in the interface (it's never used)?


shouldBeIgnored

boolean shouldBeIgnored(java.io.File directory,
                        java.lang.String nonCvsFile)
Returnes true to indicate, that the file specified by directory and nonCvsFile should be ignored.


setUncompressedFileHandler

void setUncompressedFileHandler(FileHandler handler)
Set the uncompressed file handler.


setGzipFileHandler

void setGzipFileHandler(FileHandler handler)
Set the handler for Gzip data.


getStickyTagForDirectory

java.lang.String getStickyTagForDirectory(java.io.File directory)
Checks for presence of CVS/Tag file and returns it's value.

Returns:
the value of CVS/Tag file for the specified directory null if file doesn't exist

ensureConnection

void ensureConnection()
                      throws AuthenticationException
Ensures, that the connection is open.

Throws:
AuthenticationException - if it wasn't possible to connect

getWrappersMap

java.util.Map getWrappersMap()
                             throws CommandException
Returns the wrappers map associated with the CVS server The map is valid only after the connection is established

Throws:
CommandException

getGlobalOptions

GlobalOptions getGlobalOptions()
Get the global options that are set to this client. Individual commands can get the global options via this method.


exists

boolean exists(java.io.File file)
Tests for existence of the given file. Normally this method delegates to File.exists() but it may also return true for files that exists only virtually (in memory). Is such case the file/directory will not exist on disk but its metadata will be available via getEntries() methods.

Parameters:
file - file to test for existence
Returns:
true if the file exists, false otherwise

isAborted

boolean isAborted()
Tests whether command execution should be aborted. Commands are encouraged to regulary poll this value if they expect to block for a long time in their code.

Returns:
true if currently running command should abort, false otherwise

 

Built on August 7 2008.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.