    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.cvs.CvsDirectory

    java.lang.Object
       |
       +----org.w3c.cvs.CvsDirectory

public class CvsDirectory
extends Object
implements LRUAble, CVS

##

cache
  Our cache of existing CVS managers.
cachesize
  Our recommended cache size.
clean
  Has this directory manager been cleaned up (removed from cache).
cvscheck_stamp
  The time at which we last checked the cvs status of that directory.
cvspath_def
  The default CVS path.
CVSPATH_P
  Property giving the path of the cvs binary.
cvsrep_stamp
  The time at which we last examined the repository for this directory.
cvsroot_def
  The default CVS root path.
CVSROOT_P
  Property giving your CVS repository.
cvswrap_def
  The default CVS wrapper path.
CVSWRAP_P
  Property giving the path of the cvswrapper.
defprops
  Get or create a manager for the given directory.
directory
  The directory we manage.
entries
  Known CVS entries (files)
lru
  All CVS entries are LRU maintained too.
next
  LRU management - next entry.
prev
  LRU management - previous entry.
props
  The properties we use for initialization.
repdir
  The corresponding repository directory (when available).
runner
  Our associated CvsRunner.

##

CvsDirectory(File, Properties, String, String, String[])
  Create a new CVS manager for the given directory.

##

add(String[])
  Add the given file to the CVS repository.
add(String[], String[])
  Add the given file to the CVS repository.
addRegexp(String, String[])
  Add the file matching the given regular expression to the CVS repository.
cacheLoaded()
  This directory manager is being fetched from the cache.
cacheUnload()
  Remove a directory manager from the cache.
checkDirectoryUse()
  This directory manager is about to be used for sub-directories.
checkUse()
  This directory manager is about to be used, check it.
checkUse(String)
  That file in the directory is about to be used, check its status.
commit(String)
  Commit pending actions to all that directory content.
commit(String, String)
  Commit pending actions on given file.
commit(String, String, String[])
  Commit pending actions on given file.
commit(String, String[])
  Commit pending actions to all that directory content.
commit(String[], String)
  Commit pending actions on given file.
commit(String[], String, String[])
  Commit pending actions on given file.
commitRegexp(String, String, String[])
  Commit pending actions on files matching the given regular expression.
createDirectoryEntry(long, String, int)
createFileEntry(long, String, int)
diff(String)
  Get the diff of given file against repository.
display(PrintStream)
  Display the status of the entries in that directory.
get(String)
  Perform a cvs get
getCvsDefaults()
getCvsWrapper()
getDirectory()
  Get the directory controlled by this manager.
getDirectoryEntry(String)
  Look for a sub-directory entry.
getDirectoryStatus(String)
  Get a sub-directory status.
getFileEntry(String)
  Look for a file entry.
getManager(CvsDirectory, File)
getManager(File)
  Get a CvsDirectory.
getManager(File, Properties)
getManager(File, Properties, String, String, String[])
  Get a CvsDirectory.
getNext()
  LRU management - Get next node.
getPrev()
  LRU management - Get previous node.
listDirectories()
  List available sub-directories of that directory.
listFiles()
  List all available file entries in that directory.
log(String)
  Get the log associated to the given file.
main(String[])
needsUpdate()
  Does this directory needs some CVS update ?
refresh()
  Refresh the file entries for that directory.
refresh(String)
  Refresh the file entries for that filename.
remove(String[], String, String[])
  Remove the given file from the repository.
revert(String, String, String, String[])
  Revert the file, make the given revision the current one.
revision(String)
  Get the revision number of the given file.
setNext(LRUAble)
  LRU management - Set next node.
setPrev(LRUAble)
  LRU management - Set previous node.
status(String)
  Get the status of a file entry.
statusToString(int)
update()
  Update all that directory's content.
update(String)
  Update this file from the repository.
update(String[])
  Update these files from the repository.
updateDirectory(String)
  Check out, or update a sub-directory.
updateRegexp(String)
  Update thes files matching the given regular expression from the repository.
usage()

##

CVSPATH_P

     public static final String CVSPATH_P

  Property giving the path of the cvs binary. This property should be set to the absolute path to the cvs command in your local environment.

  This property defaults to `/usr/local/bin/cvs`.

CVSROOT_P

     public static final String CVSROOT_P

  Property giving your CVS repository. This property should be set to the absolute path of your repository.

  This property defaults to `/afs/w3.org/pub/WWW`.

CVSWRAP_P

     public static final String CVSWRAP_P

  Property giving the path of the cvswrapper. Because CVS can't run without being in the right directory, this classes use a shell script wrapper to issue cvs commands, that will change directory appropriately.

  You should have gotten this wrapper in the distribution `bin` directory.

  This property defaults to `/afs/w3.org/usr/abaird/Jigsaw/bin/cvs_wrapper`.

cvspath_def

     public static final String cvspath_def

  The default CVS path.

cvsroot_def

     public static final String cvsroot_def

  The default CVS root path.

cvswrap_def

     public static final String cvswrap_def

  The default CVS wrapper path.

cache

     protected static Hashtable cache

  Our cache of existing CVS managers. Maps absolute directory names to appropriate CvsDirectory instance.

lru

     protected static LRUList lru

  All CVS entries are LRU maintained too.

cachesize

     protected static int cachesize

  Our recommended cache size.

prev

     protected LRUAble prev

  LRU management - previous entry.

next

     protected LRUAble next

  LRU management - next entry.

cvscheck_stamp

     protected long cvscheck_stamp

  The time at which we last checked the cvs status of that directory.

cvsrep_stamp

     protected long cvsrep_stamp

  The time at which we last examined the repository for this directory.

clean

     protected boolean clean

  Has this directory manager been cleaned up (removed from cache).

directory

     protected File directory

  The directory we manage.

repdir

     protected File repdir

  The corresponding repository directory (when available).

entries

     protected Hashtable entries

  Known CVS entries (files)

runner

     protected CvsRunner runner

  Our associated CvsRunner.

props

     public Properties props

  The properties we use for initialization.

defprops

     public static Properties defprops

  Get or create a manager for the given directory.

##

CvsDirectory

     protected CvsDirectory(File directory,
                            Properties props,
                            String cvspath,
                            String cvsroot,
                            String cvswrap[]) throws CvsException

  Create a new CVS manager for the given directory.

  Parameters:
    directory - The directory for which a manager is to be created.
    props - The cvs properties.
    cvspath - The absolute path of the cvs program.
    cvsroot - The absolute path of the CVS repository.
    cvswrap - The absolute path of the cvs wrapper program
  Throws: CvsException
    If some initialisation failed

##

getCvsWrapper

     protected String[] getCvsWrapper()

getCvsDefaults

     protected String[] getCvsDefaults()

createFileEntry

     protected synchronized void createFileEntry(long timestamp,
                                                 String name,
                                                 int status)

createDirectoryEntry

     protected synchronized void createDirectoryEntry(long timestamp,
                                                      String name,
                                                      int status)

getManager

     public static synchronized CvsDirectory getManager(File directory,
                                                        Properties props,
                                                        String cvspath,
                                                        String cvsroot,
                                                        String cvswrap[]) throws CvsException

  Get a CvsDirectory.

  Parameters:
    directory - The CVS directory.
    props - The cvs properties.
    cvspath - The absolute path of the cvs program.
    cvsroot - The absolute path of the CVS repository.
    cvswrap - The absolute path of the cvs wrapper program
  Returns:
    A CvsDirectory instance.
  Throws: CvsException
    If some initialisation failed

getManager

     public static CvsDirectory getManager(File directory) throws CvsException

  Get a CvsDirectory.

  Parameters:
    directory - The CVS directory
  Returns:
    A CvsDirectory instance.
  Throws: CvsException
    If some initialisation failed

getManager

     public static CvsDirectory getManager(File directory,
                                           Properties props) throws CvsException

  Parameters:
    directory - The CVS directory.
    props - The cvs properties.
  Returns:
    A CvsDirectory instance.
  Throws: CvsException
    If some initialisation failed

getManager

     protected static CvsDirectory getManager(CvsDirectory father,
                                              File dir) throws CvsException

  Parameters:
    father - The father CvsDirectory.
    directory - The CVS directory.
  Returns:
    A CvsDirectory instance.
  Throws: CvsException
    If some initialisation failed

getNext

     public LRUAble getNext()

  LRU management - Get next node.

  Returns:
    A CvsDirectory instance.

getPrev

     public LRUAble getPrev()

  LRU management - Get previous node.

  Returns:
    A CvsDirectory instance.

setNext

     public void setNext(LRUAble next)

  LRU management - Set next node.

  Returns:
    A CvsDirectory instance.

setPrev

     public void setPrev(LRUAble prev)

  LRU management - Set previous node.

  Returns:
    A CvsDirectory instance.

statusToString

     public static String statusToString(int st)

cacheLoaded

     protected void cacheLoaded() throws CvsException

  This directory manager is being fetched from the cache. Perform any action before we return it back to the user.

  Throws: CvsException
    If some CVS action fails during reinitialization.

cacheUnload

     protected static synchronized void cacheUnload()

  Remove a directory manager from the cache. Clear al references to other objects in order to free up memory even if the caller maintains a pointer to the manager.

getFileEntry

     protected CvsEntry getFileEntry(String filename)

  Look for a file entry.

  Parameters:
    filename - The name of the entry to look for.

getDirectoryEntry

     protected CvsEntry getDirectoryEntry(String filename)

  Look for a sub-directory entry.

  Parameters:
    filename - The name of the entry to look for.

refresh

     protected void refresh() throws CvsException

  Refresh the file entries for that directory.

  Throws: CvsException
    If the underlying CVS command failed.

refresh

     protected void refresh(String filename) throws CvsException

  Refresh the file entries for that filename.

  Throws: CvsException
    If the underlying CVS command failed.

checkUse

     protected synchronized void checkUse() throws CvsException

  This directory manager is about to be used, check it.

  Throws: CvsException
    If some CVS error occurs in that process.

checkUse

     protected synchronized void checkUse(String filename) throws CvsException

  That file in the directory is about to be used, check its status.

  Parameters:
    filename - The name of the entry that is about to be used.
  Throws: CvsException
    If a CVS error occurs.

checkDirectoryUse

     protected synchronized void checkDirectoryUse() throws CvsException

  This directory manager is about to be used for sub-directories.

  Throws: CvsException
    If a CVS error occurs.

needsUpdate

     protected boolean needsUpdate()

  Does this directory needs some CVS update ?

listFiles

     public Enumeration listFiles() throws CvsException

  List all available file entries in that directory. This method will list all possible files:
  - The ones that exist but are not in the repository.
  - The ones that are in the repository but not in local space.
  - All the other ones.

  Returns:
    An enumeration listing zero or more String instances.
  Throws: CvsException
    If some CVS error occured while examining the cvs status of entries.

listDirectories

     public Enumeration listDirectories() throws CvsException

  List available sub-directories of that directory. This method will list of possible directories. If access to the repository is permitted, it will look into that to get a list of unchecked out directories, otherwise, it will just list the checked out ones.

  Returns:
    An enumeration listing zero or more File instances.
  Throws: CvsException
    If some CVS error occured while examining the cvs status of entries.

status

     public int status(String filename) throws CvsException

  Get the status of a file entry.

  Parameters:
    filename - The file whose status is to be fetched.
  Returns:
    A integer status indicating the CVS status of that file within the repository.
  Throws: CvsException
    If some CVS error occured while examining the cvs status of entries.

revision

     public String revision(String filename) throws CvsException

  Get the revision number of the given file.

  Parameters:
    filename - The File name
  Returns:
    A String instance
  Throws: CvsException
    if some CVS errors occurs

update

     public void update(String files[]) throws CvsException

  Update these files from the repository.

  Parameters:
    files - The name of the files to update (as a String array).
  Throws: CvsException
    If CVS process failed.

update

     public void update(String file) throws CvsException

  Update this file from the repository.

  Parameters:
    file - The name of the file to update (as a String).
  Throws: CvsException
    If CVS process failed.

update

     public void update() throws CvsException

  Update all that directory's content.

  Throws: CvsException
    If some CVS error occured during update.

updateRegexp

     public void updateRegexp(String regexp) throws CvsException

  Update thes files matching the given regular expression from the repository.

  Parameters:
    files - The name of the files to update (as a String array).
  Throws: CvsException
    If CVS process failed.

get

     public void get(String path) throws CvsException

  Perform a cvs get

  Parameters:
    path - the file (or directory) path
  Throws: CvsException
    If CVS process failed.

commit

     public void commit(String names[],
                        String msg,
                        String env[]) throws CvsException

  Commit pending actions on given file.

  Parameters:
    names - The name of the files to commit.
    msg - The associated message.
    env - The extra env to use during commit.
  Throws: CvsException
    If some error occured during the CVS process.

commit

     public void commit(String file,
                        String msg,
                        String env[]) throws CvsException

  Commit pending actions on given file.

  Parameters:
    file - The file to commit.
    msg - The associated message.
    env - The extra env to use during commit.
  Throws: CvsException
    If some error occured during the CVS process.

commit

     public void commit(String names[],
                        String msg) throws CvsException

  Commit pending actions on given file.

  Parameters:
    names - The name of the files to commit.
    msg - The associated message.
  Throws: CvsException
    If some error occured during the CVS process.

commit

     public void commit(String file,
                        String msg) throws CvsException

  Commit pending actions on given file.

  Parameters:
    file - The file to commit.
    msg - The associated message.
  Throws: CvsException
    If some error occured during the CVS process.

commit

     public void commit(String msg) throws CvsException

  Commit pending actions to all that directory content.

  Parameters:
    msg - The associated message.
  Throws: CvsException
    If some CVS error occurs during the CVS process.

commit

     public void commit(String msg,
                        String env[]) throws CvsException

  Commit pending actions to all that directory content.

  Parameters:
    msg - The associated message.
    env - The extra environment.
  Throws: CvsException
    If some CVS error occurs during the CVS process.

commitRegexp

     public void commitRegexp(String regexp,
                              String comment,
                              String env[]) throws CvsException

  Commit pending actions on files matching the given regular expression.

  Parameters:
    regexp - The regular expresion.
    msg - The associated message.
    env - The extra env to use during commit.
  Throws: CvsException
    If some error occured during the CVS process.

revert

     public void revert(String filename,
                        String revision,
                        String msg,
                        String env[]) throws CvsException

  Revert the file, make the given revision the current one.
  - First remove the file
  - perform a cvs update -p -r

  Parameters:
    filename - The name of the file to revert.
    revision - The revision number to get.
    msg - The associated message.
    env - The extra environment.
  Throws: CvsException
    If some CVS error occurs during the CVS process.

log

     public String log(String filename) throws CvsException

  Get the log associated to the given file.

  Parameters:
    filename - The name of the file whose log is to be fetched.
  Throws: CvsException
    If some CVS error occurs in the process.

diff

     public String diff(String filename) throws CvsException

  Get the diff of given file against repository.

  Parameters:
    filename - The name of the file to diff.
  Returns:
    The diffs has a String, or null if the file is in sync with the repository.
  Throws: CvsException
    If some CVS exception occurs within the process.

add

     public void add(String names[]) throws CvsException

  Add the given file to the CVS repository. The addition will have to be commited through a commit of the same file before taking effect.

  Parameters:
    names - The name of the files to add.
  Throws: CvsException
    If some CVS error occurs during the process.

add

     public void add(String names[],
                     String env[]) throws CvsException

  Add the given file to the CVS repository. The addition will have to be commited through a commit of the same file before taking effect.

  Parameters:
    names - The name of the files to add.
    env - The extra env to use during the process.
  Throws: CvsException
    If some CVS error occurs during the process.

addRegexp

     public void addRegexp(String regexp,
                           String env[]) throws CvsException

  Add the file matching the given regular expression to the CVS repository. The addition will have to be commited through a commit of the same file before taking effect.

  Parameters:
    regexp - The regular expression.
    env - The extra env to use during the process.
  Throws: CvsException
    If some CVS error occurs during the process.

remove

     public void remove(String names[],
                        String msg,
                        String env[]) throws CvsException

  Remove the given file from the repository.

  Parameters:
    names - The files to be removed.
  Throws: CvsException
    If some CVS error occurs during that process.

display

     public void display(PrintStream prt)

  Display the status of the entries in that directory.

  Parameters:
    prt - A print stream to print to.

getDirectoryStatus

     public int getDirectoryStatus(String subdir) throws CvsException

  Get a sub-directory status.

  Parameters:
    subdir - The name of the subdirectory.
  Returns:
    An integer CVS status for the given sub-directory.
  Throws: CvsException
    if the CVS process failed.

updateDirectory

     public void updateDirectory(String subdir) throws CvsException

  Check out, or update a sub-directory.

  Parameters:
    subdir - The sub directory to update.
  Throws: CvsException
    If the CVS process failed.

getDirectory

     public File getDirectory()

  Get the directory controlled by this manager.

  Returns:
    A File instance locating the directory.

usage

     public static void usage()

main

     public static void main(String args[])

    All Packages  Class Hierarchy  This Package  Previous  Next  Index