|
||||||||||
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 |
String |
convertPathname(String localDirectory,
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 |
copyLocalFile(String pathname,
String newName)
Copy the local 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(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. |
Set |
getAllFiles(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) . |
Iterator |
getEntries(File directory)
Get the entries for a specified directory. |
Entry |
getEntry(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. |
String |
getLocalPath()
Get the local path; that is, the path to the directory in which the currently executing command is referring. |
Date |
getNextFileDate()
Get the modified date for the next file. |
String |
getRepository()
Get the repository path from the connection. |
String |
getRepositoryForDirectory(File directory)
Semantically equivalent to ClientServices.getRepositoryForDirectory(String) but does not try to recover from
missing CVS/Repository file. |
String |
getRepositoryForDirectory(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. |
String |
getStickyTagForDirectory(File directory)
Checks for presence of CVS/Tag file and returns it's value. |
FileHandler |
getUncompressedFileHandler()
Return the uncompressed file handler. |
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(List requests)
Process all the requests. |
void |
removeEntry(File file)
Remove the Entry for the specified file. |
void |
removeLocalFile(String pathname)
Remove the specified file from the local disk. |
void |
removeLocalFile(String pathName,
String repositoryName)
Removes the specified file determined by pathName and repositoryName. |
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(File file,
Entry entry)
Set the Entry for the specified file. |
void |
setErrorStream(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(String localPath)
Set the local path, i.e. |
void |
setNextFileDate(Date modifiedDate)
Set the modified date of the next file to be written. |
void |
setUncompressedFileHandler(FileHandler uncompFileHandler)
Set the uncompressed file handler. |
void |
setValidRequests(String requests)
This method is called when a response for the ValidRequests request is received. |
boolean |
shouldBeIgnored(File directory,
String noneCvsFile)
Returnes true to indicate, that the file specified by directory and nonCvsFile should be ignored. |
void |
updateAdminData(String localDirectory,
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(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 String getLocalPath()
getLocalPath
in interface ClientServices
public void setLocalPath(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(List requests) throws IOException, UnconfiguredRequestException, ResponseException, CommandAbortedException
processRequests
in interface ClientServices
requests
- the requets to process
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 String convertPathname(String localDirectory, 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 String getRepository()
getRepository
in interface ClientServices
Connection.getRepository()
public void updateAdminData(String localDirectory, String repositoryPath, Entry entry) throws 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
IOException
- if there is an error writing the filespublic void setNextFileDate(Date modifiedDate)
setNextFileDate
in interface ResponseServices
modifiedDate
- the date the file should be marked as modifiedpublic Date getNextFileDate()
getNextFileDate
in interface ResponseServices
public Entry getEntry(File f) throws IOException
getEntry
in interface ClientServices
f
- the file
IOException
- if the Entries file cannot be readpublic Iterator getEntries(File directory) throws IOException
getEntries
in interface ClientServices
directory
- the directory for which to get the entries
IOException
public boolean exists(File file)
ClientServices
exists
in interface ClientServices
file
- file to test for existence
public String getRepositoryForDirectory(String directory) throws 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
IOException
public String getRepositoryForDirectory(File directory) throws 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
IOException
- if the repository cannot be determined by reading CVS/Repository filepublic void setEntry(File file, Entry entry) throws IOException
setEntry
in interface ResponseServices
file
- the fileentry
- the new entry
IOException
- if an error occurs writing the detailspublic void removeEntry(File file) throws IOException
removeEntry
in interface ClientServices
removeEntry
in interface ResponseServices
file
- the file whose entry is to be removed
IOException
- if an error occurs writing the Entries filepublic void removeLocalFile(String pathname) throws IOException
removeLocalFile
in interface ResponseServices
pathname
- the full path to the file to remove
IOException
- if an IO error occurs while removing the filepublic void removeLocalFile(String pathName, String repositoryName) throws IOException
removeLocalFile
in interface ResponseServices
IOException
- if an IO error occurs while removing the filepublic void copyLocalFile(String pathname, String newName) throws IOException
ResponseServices
copyLocalFile
in interface ResponseServices
pathname
- the full path to the file to coypnewName
- the new name of the file (not the full path)
IOException
- if an IO error occurs while copying the filepublic EventManager getEventManager()
getEventManager
in interface ResponseServices
public GlobalOptions getGlobalOptions()
getGlobalOptions
in interface ClientServices
getGlobalOptions
in interface ResponseServices
public void abort()
public Set getAllFiles(File directory) throws IOException
getAllFiles
in interface ClientServices
directory
- the directory to look in
IOException
public void setIgnoreFileFilter(IgnoreFileFilter ignoreFileFilter)
ClientServices
setIgnoreFileFilter
in interface ClientServices
public IgnoreFileFilter getIgnoreFileFilter()
ClientServices
getIgnoreFileFilter
in interface ClientServices
public boolean shouldBeIgnored(File directory, String noneCvsFile)
ClientServices
shouldBeIgnored
in interface ClientServices
public String getStickyTagForDirectory(File directory)
getStickyTagForDirectory
in interface ClientServices
public void setValidRequests(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 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 |