org.netbeans.lib.cvsclient.admin
Class StandardAdminHandler

java.lang.Object
  extended by org.netbeans.lib.cvsclient.admin.StandardAdminHandler
All Implemented Interfaces:
AdminHandler

public class StandardAdminHandler
extends java.lang.Object
implements AdminHandler

A handler for administrative information that maintains full compatibility with the one employed by the original C implementation of a CVS client.

This implementation strives to provide complete compatibility with the standard CVS client, so that operations on locally checked-out files can be carried out by either this library or the standard client without causing the other to fail. Any such failure should be considered a bug in this library.


Constructor Summary
StandardAdminHandler()
           
 
Method Summary
 boolean exists(java.io.File file)
          Simply delegates to File.exists(), does not provide any virtual files.
 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[] getEntriesAsArray(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
 java.lang.String getRepositoryForDirectory(java.lang.String directory, java.lang.String repository)
          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.
 void removeEntry(java.io.File file)
          Remove the Entry for the specified file
 void setEntry(java.io.File file, Entry entry)
          Set the Entry for the specified file
 void updateAdminData(java.lang.String localDirectory, java.lang.String repositoryPath, Entry entry, GlobalOptions globalOptions)
          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

StandardAdminHandler

public StandardAdminHandler()
Method Detail

updateAdminData

public void updateAdminData(java.lang.String localDirectory,
                            java.lang.String repositoryPath,
                            Entry entry,
                            GlobalOptions globalOptions)
                     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

Specified by:
updateAdminData in interface AdminHandler
Parameters:
localDirectory - the local directory where the file in question lives (the absolute path). Must not end with a slash.
entry - the entry object for that file. If null, there is no entry to add, and the Entries file will not have any entries added to it (it will be created if it does not exist, however).
repositoryPath - the path of the file in the repository
globalOptions - the global command options
Throws:
java.io.IOException

exists

public boolean exists(java.io.File file)
Simply delegates to File.exists(), does not provide any virtual files.

Specified by:
exists in interface AdminHandler
Parameters:
file - file to test for existence
Returns:
true if the file exists on disk, false otherwise

getEntry

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

Specified by:
getEntry in interface AdminHandler
Parameters:
f - the file
Throws:
java.io.IOException - if the Entries file cannot be read

getEntriesAsArray

public Entry[] getEntriesAsArray(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 array of Entry objects
Throws:
java.io.IOException

getEntries

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

Specified by:
getEntries in interface AdminHandler
Parameters:
directory - the directory for which to get the entries (CVS/Entries is appended)
Returns:
an iterator of Entry objects
Throws:
java.io.IOException

setEntry

public void setEntry(java.io.File file,
                     Entry entry)
              throws java.io.IOException
Set the Entry for the specified file

Specified by:
setEntry in interface AdminHandler
Parameters:
f - the file whose entry is being updated
Throws:
java.io.IOException - if an error occurs writing the details

removeEntry

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

Specified by:
removeEntry in interface AdminHandler
Parameters:
f - the file whose entry is to be removed
Throws:
java.io.IOException - if an error occurs writing the Entries file

getRepositoryForDirectory

public java.lang.String getRepositoryForDirectory(java.lang.String directory,
                                                  java.lang.String repository)
                                           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). However, the path stored in that file is relative to the repository path

Specified by:
getRepositoryForDirectory in interface AdminHandler
Parameters:
directory - the directory
the - repository path on the server, e.g. /home/bob/cvs. Must not end with a slash.
Throws:
java.io.IOException

getAllFiles

public 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.

Specified by:
getAllFiles in interface AdminHandler
Parameters:
directory - the directory to look in
Returns:
a set of all files.
Throws:
java.io.IOException

getStickyTagForDirectory

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

Specified by:
getStickyTagForDirectory in interface AdminHandler
Returns:
the value of CVS/Tag file for the specified directory null if file doesn't exist

 

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