|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.lib.cvsclient.Client
public class Client
The main way of communication with a server using the CVS Protocol. The client is not responsible for setting up the connection with the server, only interacting with it.
Connection
Nested Class Summary | |
---|---|
static interface |
Client.Factory
Factory for creating clients. |
Constructor Summary | |
---|---|
Client(Connection connection,
AdminHandler adminHandler)
Construct a Client using a given connection and file handler. |
Method Summary | |
---|---|
void |
abort()
Call this method to abort the current command. |
void |
addWrapper(StringPattern pattern,
KeywordSubstitutionOptions option)
This method is called by WrapperSendResponse for each wrapper setting sent back by the CVS server |
java.lang.String |
convertPathname(java.lang.String localDirectory,
java.lang.String repository)
Convert a pathname in the CVS sense (see 5.10 in the protocol document) into a local absolute pathname for the file. |
void |
dontUseGzipFileHandler()
ReSet the filehandler for Gzip compressed data. |
void |
ensureConnection()
Ensures, that the connection is open. |
boolean |
executeCommand(Command command,
GlobalOptions globalOptions)
Execute a command. |
boolean |
exists(java.io.File file)
Tests for existence of the given file. |
AdminHandler |
getAdminHandler()
Get the admin handler uesd to read and write administrative information about files on the local machine. |
java.util.Set |
getAllFiles(java.io.File directory)
Get all the files contained within a given directory that are known to CVS. |
Connection |
getConnection()
Get the connection used for communicating with the server. |
long |
getCounter()
Counts processRequests(java.util.List) . |
java.util.Iterator |
getEntries(java.io.File directory)
Get the entries for a specified directory. |
Entry |
getEntry(java.io.File f)
Get the Entry for the specified file, if one exists. |
EventManager |
getEventManager()
Get the CVS event manager. |
GlobalOptions |
getGlobalOptions()
Get the global options that are set to this client. |
FileHandler |
getGzipFileHandler()
Return the Gzip stream handler. |
IgnoreFileFilter |
getIgnoreFileFilter()
Returns the IgnoreFileFilter used to ignore non-cvs files. |
java.lang.String |
getLocalPath()
Get the local path; that is, the path to the directory in which the currently executing command is referring. |
java.util.Date |
getNextFileDate()
Get the modified date for the next file. |
java.lang.String |
getRepository()
Get the repository path from the connection. |
java.lang.String |
getRepositoryForDirectory(java.io.File directory)
Semantically equivalent to ClientServices.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. |
FileHandler |
getUncompressedFileHandler()
Return the uncompressed file handler. |
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 previous command was executed using thiz. |
void |
processRequests(java.util.List requests)
Process all the requests. |
void |
removeEntry(java.io.File file)
Remove the Entry for the specified file. |
void |
removeLocalFile(java.lang.String pathname)
Remove the specified file from the local disk. |
void |
removeLocalFile(java.lang.String pathName,
java.lang.String repositoryName)
Removes the specified file determined by pathName and repositoryName. |
void |
renameLocalFile(java.lang.String pathname,
java.lang.String newName)
Rename the local file. |
void |
setAdminHandler(AdminHandler adminHandler)
Set the admin handler used to read and write administrative information about files on the local machine. |
void |
setConnection(Connection connection)
Set the connection used for communicating with the server. |
void |
setEntry(java.io.File file,
Entry entry)
Set the Entry for the specified file. |
void |
setErrorStream(java.io.PrintStream stderr)
|
void |
setGzipFileHandler(FileHandler gzipFileHandler)
Set the handler for Gzip data. |
void |
setIgnoreFileFilter(IgnoreFileFilter ignoreFileFilter)
Sets the specified IgnoreFileFilter to use to ignore non-cvs files. |
void |
setIsFirstCommand(boolean isFirstCommand)
Set whether this is the first command. |
void |
setLocalPath(java.lang.String localPath)
Set the local path, i.e. |
void |
setNextFileDate(java.util.Date modifiedDate)
Set the modified date of the next file to be written. |
void |
setUncompressedFileHandler(FileHandler uncompFileHandler)
Set the uncompressed file handler. |
void |
setValidRequests(java.lang.String requests)
This method is called when a response for the ValidRequests request is received. |
boolean |
shouldBeIgnored(java.io.File directory,
java.lang.String noneCvsFile)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Client(Connection connection, AdminHandler adminHandler)
// establish connection to the given CVS pserver
PServerConnection connection = new PServerConnection();
connection.setUserName(userName);
connection.setHostName(hostName);
connection.setEncodedPassword(StandardScrambler.getInstance().scramble(password));
connection.setRepository(repository);
// test the connection
try {
connection.open();
} catch (AuthenticationException e) {
// do something
}
// create a CVS client
Client cvsClient = new Client(connection,new StandardAdminHandler());
// set the directory in which we work
cvsClient.setLocalPath(localPath);
connection
- the connection to the cvs serveradminHandler
- the admin handler to useMethod Detail |
---|
public void setErrorStream(java.io.PrintStream stderr)
public Connection getConnection()
public void setConnection(Connection connection)
c
- the connection to use for all communication with the serverpublic AdminHandler getAdminHandler()
public void setAdminHandler(AdminHandler adminHandler)
public java.lang.String getLocalPath()
getLocalPath
in interface ClientServices
public void setLocalPath(java.lang.String localPath)
public boolean isFirstCommand()
isFirstCommand
in interface ClientServices
public void setIsFirstCommand(boolean isFirstCommand)
setIsFirstCommand
in interface ClientServices
public FileHandler getUncompressedFileHandler()
getUncompressedFileHandler
in interface ResponseServices
public void setUncompressedFileHandler(FileHandler uncompFileHandler)
setUncompressedFileHandler
in interface ClientServices
public FileHandler getGzipFileHandler()
getGzipFileHandler
in interface ResponseServices
public void setGzipFileHandler(FileHandler gzipFileHandler)
setGzipFileHandler
in interface ClientServices
public void dontUseGzipFileHandler()
dontUseGzipFileHandler
in interface ResponseServices
public boolean isAborted()
ClientServices
isAborted
in interface ClientServices
public void ensureConnection() throws AuthenticationException
ensureConnection
in interface ClientServices
AuthenticationException
- if it wasn't possible to connectpublic void processRequests(java.util.List requests) throws java.io.IOException, UnconfiguredRequestException, ResponseException, CommandAbortedException
processRequests
in interface ClientServices
requests
- the requets to process
java.io.IOException
UnconfiguredRequestException
ResponseException
CommandAbortedException
public boolean executeCommand(Command command, GlobalOptions globalOptions) throws CommandException, CommandAbortedException, AuthenticationException
GlobalOptions options = new GlobalOptions();
options.setCVSRoot(":pserver:"+userName+"@"+hostName+":"+cvsRoot);
command
- the command to executeoptions
- the global options to use for executing the command
CommandException
- if an error occurs when executing the command
CommandAbortedException
- if the command is aborted
AuthenticationException
public long getCounter()
processRequests(java.util.List)
. send and received bytes.
public java.lang.String convertPathname(java.lang.String localDirectory, java.lang.String repository)
convertPathname
in interface ResponseServices
localDirectory
- the name of the local directory, relative to the
directory in which the command was givenrepository
- the full repository name for the filepublic java.lang.String getRepository()
getRepository
in interface ClientServices
Connection.getRepository()
public void updateAdminData(java.lang.String localDirectory, java.lang.String repositoryPath, Entry entry) throws java.io.IOException
updateAdminData
in interface ClientServices
updateAdminData
in interface ResponseServices
localDirectory
- the local directory, relative to the directory
in which the command was given, where the file in question livesrepositoryPath
- the path of the file in the repository, in
absolute form.entry
- the entry object for that file
java.io.IOException
- if there is an error writing the filespublic void setNextFileDate(java.util.Date modifiedDate)
setNextFileDate
in interface ResponseServices
modifiedDate
- the date the file should be marked as modifiedpublic java.util.Date getNextFileDate()
getNextFileDate
in interface ResponseServices
public Entry getEntry(java.io.File f) throws java.io.IOException
getEntry
in interface ClientServices
f
- the file
java.io.IOException
- if the Entries file cannot be readpublic java.util.Iterator getEntries(java.io.File directory) throws java.io.IOException
getEntries
in interface ClientServices
directory
- the directory for which to get the entries
java.io.IOException
public boolean exists(java.io.File file)
ClientServices
exists
in interface ClientServices
file
- file to test for existence
public java.lang.String getRepositoryForDirectory(java.lang.String directory) throws java.io.IOException
Repositoryin the CVS directory on the client (this is the case in the standard CVS command-line tool). If no
CVS/Repositoryfile was found, the specified directory, the localpath are used to "guess" the repository path.
getRepositoryForDirectory
in interface ClientServices
directory
- the directory
java.io.IOException
public java.lang.String getRepositoryForDirectory(java.io.File directory) throws java.io.IOException
ClientServices
ClientServices.getRepositoryForDirectory(String)
but does not try to recover from
missing CVS/Repository file.
getRepositoryForDirectory
in interface ClientServices
directory
- the directory to get repository for
java.io.IOException
- if the repository cannot be determined by reading CVS/Repository filepublic void setEntry(java.io.File file, Entry entry) throws java.io.IOException
setEntry
in interface ResponseServices
file
- the fileentry
- the new entry
java.io.IOException
- if an error occurs writing the detailspublic void removeEntry(java.io.File file) throws java.io.IOException
removeEntry
in interface ClientServices
removeEntry
in interface ResponseServices
file
- the file whose entry is to be removed
java.io.IOException
- if an error occurs writing the Entries filepublic void removeLocalFile(java.lang.String pathname) throws java.io.IOException
removeLocalFile
in interface ResponseServices
pathname
- the full path to the file to remove
java.io.IOException
- if an IO error occurs while removing the filepublic void removeLocalFile(java.lang.String pathName, java.lang.String repositoryName) throws java.io.IOException
removeLocalFile
in interface ResponseServices
java.io.IOException
- if an IO error occurs while removing the filepublic void renameLocalFile(java.lang.String pathname, java.lang.String newName) throws java.io.IOException
renameLocalFile
in interface ResponseServices
pathname
- the full path to the file to renamenewName
- the new name of the file (not the full path)
java.io.IOException
- if an IO error occurs while renaming the filepublic EventManager getEventManager()
getEventManager
in interface ResponseServices
public GlobalOptions getGlobalOptions()
getGlobalOptions
in interface ClientServices
getGlobalOptions
in interface ResponseServices
public void abort()
public java.util.Set getAllFiles(java.io.File directory) throws java.io.IOException
getAllFiles
in interface ClientServices
directory
- the directory to look in
java.io.IOException
public void setIgnoreFileFilter(IgnoreFileFilter ignoreFileFilter)
ClientServices
setIgnoreFileFilter
in interface ClientServices
public IgnoreFileFilter getIgnoreFileFilter()
ClientServices
getIgnoreFileFilter
in interface ClientServices
public boolean shouldBeIgnored(java.io.File directory, java.lang.String noneCvsFile)
ClientServices
shouldBeIgnored
in interface ClientServices
public java.lang.String getStickyTagForDirectory(java.io.File directory)
getStickyTagForDirectory
in interface ClientServices
public void setValidRequests(java.lang.String requests)
setValidRequests
in interface ResponseServices
requests
- A List of requests that is valid for this CVS server
separated by spaces.public void addWrapper(StringPattern pattern, KeywordSubstitutionOptions option)
addWrapper
in interface ResponseServices
pattern
- A StringPattern indicating the pattern for which the
wrapper appliesoption
- A KeywordSubstituionOption corresponding to the settingpublic java.util.Map getWrappersMap() throws CommandException
getWrappersMap
in interface ClientServices
CommandException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |