com.ice.cvsc
Class CVSProject

java.lang.Object
  |
  +--com.ice.cvsc.CVSProject
All Implemented Interfaces:
CVSResponseHandler

public class CVSProject
extends java.lang.Object
implements CVSResponseHandler

The CVSProject class implements the concept of a local CVS project directory. A local project directory can be thought of as a local source code working directory that contains a CVS directory containing CVS administration files. Combined with CVSClient, this class provides everything you need to communicate with a CVS Server and maintain local working directories for CVS repositories.

Version:
$Revision: 2.26 $
Author:
Timothy Gerard Endres, .
See Also:
CVSClient

Field Summary
static boolean debugEntryIO
           
static boolean deepDebug
           
static boolean overTraceProcessing
           
static boolean overTraceRequest
           
static boolean overTraceResponse
           
static boolean overTraceTCP
           
static java.lang.String RCS_ID
           
static java.lang.String RCS_REV
           
 
Constructor Summary
CVSProject()
          Constructs a new CVSProject object.
CVSProject(CVSClient client)
          Constructs a new CVSProject object, setting the project's client to the one provided.
 
Method Summary
 void addEntryNotify(CVSEntryVector entries, java.lang.String type, java.lang.String options)
           
 void addNewEntry(CVSEntry entry)
           
static java.lang.String adminPathToRootPath(java.lang.String dirName)
          Parses a valid CVS Administration Directory path and returns the pathname of the working directory that the administration directory belongs to.
 boolean allowsGzipFileMode()
           
 boolean checkOverwrite(CVSEntry entry, java.io.File file)
           
 boolean checkReleaseStatus(CVSIgnore ignore, java.util.Vector mods, java.util.Vector adds, java.util.Vector rems, java.util.Vector unks)
          This is used for the 'release' command to determine if the project has any modifications the user might not want to lose.
 boolean copyFile(java.io.File from, java.io.File to, int translation, boolean isGZIPed)
           
 boolean copyFileAscii(java.io.File from, java.io.File to, boolean isGZIPed)
           
 boolean copyFileRaw(java.io.File from, java.io.File to, boolean isGZIPed)
           
 CVSEntry createItemEntry(CVSResponseItem item)
           
 java.lang.StringBuffer dumpCVSProject(java.lang.StringBuffer buf, java.lang.String description)
           
 java.lang.StringBuffer dumpEntry(java.lang.StringBuffer buf, java.lang.String prefix, CVSEntry dirEntry)
           
 boolean ensureEntryHierarchy(java.lang.String localDirectory, java.lang.String repository)
           
 boolean ensureLocalTree(java.io.File localFile, boolean ensureAdmin)
           
 boolean ensureProperWorkingDirectory(java.lang.String localRoot, java.lang.String subPath, boolean ensureAdmin)
           
 CVSResponse ensureRepositoryPath(CVSUserInterface ui, java.lang.String localDirectory, CVSResponse resultResp)
          Guarentees that the repository contains the path specified.
static java.lang.String entriesPathToAdminPath(java.lang.String entriesPath)
          Parses a valid CVS Entries File pathname and returns the pathname of the admin directory that the entries files belongs to.
 CVSEntry entryLineToEntry(java.lang.String entryLine)
           
 void establishNewDirSticky(CVSRequest request, CVSEntry entry)
          This methods deal with adding a new directory which is not yet in the repository, and yet, whose parent directory has a sticky tag set.
 void establishRootEntry(java.lang.String repository)
           
 void establishStatics(CVSRequest request)
           
 void establishStickys(CVSRequest request)
           
static java.lang.String getAdminEntriesPath(java.lang.String adminDirPath)
          Given the administrative directory pathname, return the full pathname of the 'Entries' file.
static java.lang.String getAdminNotifyPath(java.lang.String adminDirPath)
          Given the administrative directory pathname, return the full pathname of the 'Notify' file.
static java.lang.String getAdminPrefsPath(java.lang.String adminDirPath)
          Given the administrative directory pathname, return the full pathname of the project preferences file.
static java.lang.String getAdminRepositoryPath(java.lang.String adminDirPath)
          Given the administrative directory pathname, return the full pathname of the 'Repository' file.
static java.lang.String getAdminRootPath(java.lang.String adminDirPath)
          Given the administrative directory pathname, return the full pathname of the 'Root' file.
 CVSClient getClient()
          Returns the client this project is set to use.
 int getConnectionMethod()
           
 int getConnectionPort()
           
 CVSEntry getDirEntryForLocalDir(java.lang.String localDir)
          Given a 'local directory' (in the protocol sense), get the corresponding directory CVSEntry.
 java.io.File getEntryFile(CVSEntry entry)
           
 int getGzipStreamLevel()
           
 java.io.File getLocalEntryFile(CVSEntry entry)
           
 java.lang.String getLocalRootDirectory()
           
 java.lang.String getLocalRootPath()
          Returns the full local pathname for the root directory of this project.
 java.lang.String getPassword()
           
 CVSProjectDef getProjectDef()
           
 java.lang.String getRepository()
           
 java.lang.String getRootDirectory()
           
 CVSEntry getRootEntry()
           
 java.lang.String getRshProcess()
           
 java.lang.String getServerCommand()
           
 java.lang.String[] getSetVariables()
          Returns the project's user set variables.
 java.lang.String getTempDirectory()
           
 java.lang.String getUserName()
           
 boolean handleResponseItem(CVSRequest request, CVSResponse response, CVSResponseItem item)
           
 boolean hasValidLogin(java.lang.String userName)
           
 void includeNotifies(CVSRequest request)
           
 boolean isLocalFileModified(CVSEntry entry)
           
 boolean isPServer()
           
 boolean isSSHServer()
           
static boolean isValidAdminPath(java.lang.String dirName)
          Determines if a pathname, provided by the dirName parameter, is a valid CVS administration directory (i.e., is a directory named 'CVS').
 CVSEntry locateEntry(java.lang.String fullPath)
           
 void moveLocalFile(java.io.File localFile, java.lang.String versionStr)
           
 java.lang.String normalizeLocalDirectory(java.lang.String pathName, java.lang.String repository)
          Given a local-directory returned from the server, make sure the local-directory is in a format that jCVS can make use of (i.e., via the pathTable).
 void openProject(java.io.File localRootFile)
           
 CVSNotifyItem parseNotifyLine(java.lang.String notifyLine)
           
 boolean performCopyFile(CVSResponseItem item)
           
 boolean performCVSRequest(CVSRequest request)
           
 boolean performCVSRequest(CVSRequest request, CVSResponse response)
           
 boolean processCVSResponse(CVSRequest request, CVSResponse response)
           
protected  boolean processNotified(CVSResponseItem item)
           
 void pruneEmptySubDirs(boolean saveAdminFiles)
           
 void pruneEmptySubDirs(CVSEntry parent)
           
 boolean readEntries()
           
 CVSEntryVector readEntriesFile(CVSEntry dirEntry, java.io.File workingDirectory)
           
 java.lang.String readRepository(java.io.File reposFile)
           
 java.lang.String readRootDirectory(java.io.File rootFile)
           
 void releaseProject()
           
 void removeAllEntries()
           
 boolean removeEntriesItem(CVSResponseItem item)
           
 java.lang.String reposNameToFileName(java.lang.String fullRepos)
           
 java.lang.String reposNameToRepository(java.lang.String fullRepos)
           
static java.lang.String rootPathToAdminPath(java.lang.String dirName)
          Given a root path, returns the administration directory path corresponding to root's project.
 void setAllowsGzipFileMode(boolean allow)
           
 void setClient(CVSClient client)
           
 void setConnectionMethod(int method)
           
 void setConnectionPort(int port)
           
 void setGzipStreamLevel(int level)
           
 void setLocalRootDirectory(java.lang.String dirName)
           
 void setPassword(java.lang.String password)
           
 void setProjectDef(CVSProjectDef projectDef)
           
 void setPServer(boolean isPServer)
           
 void setRepository(java.lang.String repository)
           
 void setRootDirectory(java.lang.String rootDirectory)
           
 void setRshProcess(java.lang.String rshProcess)
           
 void setServerCommand(java.lang.String command)
           
 void setSetVariables(java.lang.String[] vars)
          Sets the project's user set variables.
 boolean setStaticDirectory(CVSResponseItem item, boolean isSet, boolean writeFile)
           
 boolean setSticky(CVSResponseItem item, boolean isSet, boolean writeFile)
           
 void setTempDirectory(java.lang.String dirName)
           
 void setUserName(java.lang.String name)
           
 java.lang.String toString()
           
 void uiDisplayProgramError(java.lang.String error)
           
 void uiDisplayProgressMsg(java.lang.String message)
           
 void uiDisplayResponse(CVSResponse response)
           
 void updateEntriesItem(CVSEntry newEntry)
          Given an entry, update the entry in our project.
 boolean updateLocalFile(CVSResponseItem item, CVSEntry entry, java.io.File localFile)
           
static boolean verifyAdminDirectory(java.lang.String dirName)
          Verifies that a directory path is a valid CVS administration directory.
 boolean verifyPassword(CVSUserInterface ui, java.lang.String userName, java.lang.String password, boolean trace)
           
 boolean writeAdminEntriesFile(java.io.File entriesFile, CVSEntryVector entries)
           
 boolean writeAdminFiles()
           
 boolean writeAdminRepositoryFile(java.io.File repFile, java.lang.String repository)
           
 boolean writeAdminRootFile(java.io.File rootFile, java.lang.String rootDirectoryStr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
See Also:
Constant Field Values

RCS_REV

public static final java.lang.String RCS_REV
See Also:
Constant Field Values

overTraceRequest

public static boolean overTraceRequest

overTraceResponse

public static boolean overTraceResponse

overTraceProcessing

public static boolean overTraceProcessing

overTraceTCP

public static boolean overTraceTCP

deepDebug

public static boolean deepDebug

debugEntryIO

public static boolean debugEntryIO
Constructor Detail

CVSProject

public CVSProject()
Constructs a new CVSProject object.


CVSProject

public CVSProject(CVSClient client)
Constructs a new CVSProject object, setting the project's client to the one provided.

Parameters:
client - A CVSClient object to be used by this project for all CVS server requests.
Method Detail

isValidAdminPath

public static boolean isValidAdminPath(java.lang.String dirName)
Determines if a pathname, provided by the dirName parameter, is a valid CVS administration directory (i.e., is a directory named 'CVS').

Parameters:
dirName - the pathname of the directory in question

rootPathToAdminPath

public static java.lang.String rootPathToAdminPath(java.lang.String dirName)
Given a root path, returns the administration directory path corresponding to root's project.

Parameters:
dirName - the pathname of the root directory

adminPathToRootPath

public static java.lang.String adminPathToRootPath(java.lang.String dirName)
Parses a valid CVS Administration Directory path and returns the pathname of the working directory that the administration directory belongs to. In other words, it returns the directory's parent.

Parameters:
dirName - the pathname of the admin directory

entriesPathToAdminPath

public static java.lang.String entriesPathToAdminPath(java.lang.String entriesPath)
Parses a valid CVS Entries File pathname and returns the pathname of the admin directory that the entries files belongs to. In other words, it returns the directory's parent.

Parameters:
entriesPath - The pathname of the Entries file.

verifyAdminDirectory

public static boolean verifyAdminDirectory(java.lang.String dirName)
Verifies that a directory path is a valid CVS administration directory. This checks for the correct name ('CVS'), and that the necessary files ('Entries', 'Root' and 'Repository') are present.

Parameters:
dirName - the pathname of the admin directory
Returns:
true if directory is valid, otherwise false

getAdminEntriesPath

public static java.lang.String getAdminEntriesPath(java.lang.String adminDirPath)
Given the administrative directory pathname, return the full pathname of the 'Entries' file.

Parameters:
adminDirPath - The pathname of the admin ('CVS') directory.

getAdminRepositoryPath

public static java.lang.String getAdminRepositoryPath(java.lang.String adminDirPath)
Given the administrative directory pathname, return the full pathname of the 'Repository' file.

Parameters:
adminDirPath - The pathname of the admin ('CVS') directory.

getAdminRootPath

public static java.lang.String getAdminRootPath(java.lang.String adminDirPath)
Given the administrative directory pathname, return the full pathname of the 'Root' file.

Parameters:
adminDirPath - The pathname of the admin ('CVS') directory.

getAdminNotifyPath

public static java.lang.String getAdminNotifyPath(java.lang.String adminDirPath)
Given the administrative directory pathname, return the full pathname of the 'Notify' file.

Parameters:
adminDirPath - The pathname of the admin ('CVS') directory.

getAdminPrefsPath

public static java.lang.String getAdminPrefsPath(java.lang.String adminDirPath)
Given the administrative directory pathname, return the full pathname of the project preferences file.

Parameters:
adminDirPath - The pathname of the admin ('CVS') directory.

getClient

public CVSClient getClient()
Returns the client this project is set to use.

Returns:
the project's client.
See Also:
CVSClient

setClient

public void setClient(CVSClient client)

getRepository

public java.lang.String getRepository()

setRepository

public void setRepository(java.lang.String repository)

isPServer

public boolean isPServer()

setPServer

public void setPServer(boolean isPServer)

allowsGzipFileMode

public boolean allowsGzipFileMode()

setAllowsGzipFileMode

public void setAllowsGzipFileMode(boolean allow)

getGzipStreamLevel

public int getGzipStreamLevel()

setGzipStreamLevel

public void setGzipStreamLevel(int level)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String name)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getRootDirectory

public java.lang.String getRootDirectory()

setRootDirectory

public void setRootDirectory(java.lang.String rootDirectory)

getLocalRootPath

public java.lang.String getLocalRootPath()
Returns the full local pathname for the root directory of this project.

Returns:
Full pathname of project's local root directory.

getLocalRootDirectory

public java.lang.String getLocalRootDirectory()

setLocalRootDirectory

public void setLocalRootDirectory(java.lang.String dirName)

getTempDirectory

public java.lang.String getTempDirectory()

setTempDirectory

public void setTempDirectory(java.lang.String dirName)

getConnectionPort

public int getConnectionPort()

setConnectionPort

public void setConnectionPort(int port)

getConnectionMethod

public int getConnectionMethod()

setConnectionMethod

public void setConnectionMethod(int method)

isSSHServer

public boolean isSSHServer()

getServerCommand

public java.lang.String getServerCommand()

setServerCommand

public void setServerCommand(java.lang.String command)

getRshProcess

public java.lang.String getRshProcess()

setRshProcess

public void setRshProcess(java.lang.String rshProcess)

getSetVariables

public java.lang.String[] getSetVariables()
Returns the project's user set variables.

Returns:
The project's user set variables.

setSetVariables

public void setSetVariables(java.lang.String[] vars)
Sets the project's user set variables.

Parameters:
vars - The new user set variables.

getRootEntry

public CVSEntry getRootEntry()

getProjectDef

public CVSProjectDef getProjectDef()

setProjectDef

public void setProjectDef(CVSProjectDef projectDef)

getEntryFile

public java.io.File getEntryFile(CVSEntry entry)

hasValidLogin

public boolean hasValidLogin(java.lang.String userName)

addEntryNotify

public void addEntryNotify(CVSEntryVector entries,
                           java.lang.String type,
                           java.lang.String options)

includeNotifies

public void includeNotifies(CVSRequest request)

verifyPassword

public boolean verifyPassword(CVSUserInterface ui,
                              java.lang.String userName,
                              java.lang.String password,
                              boolean trace)

getDirEntryForLocalDir

public CVSEntry getDirEntryForLocalDir(java.lang.String localDir)
Given a 'local directory' (in the protocol sense), get the corresponding directory CVSEntry. This method will return null if the directory hierarchy has not been "ensured" yet.

Parameters:
localDir - The directory's 'local directory' name.

ensureRepositoryPath

public CVSResponse ensureRepositoryPath(CVSUserInterface ui,
                                        java.lang.String localDirectory,
                                        CVSResponse resultResp)
Guarentees that the repository contains the path specified. This will in turn invoke server commands to create the directories needed to make the path exist, so this can and will change the repository on the server. The repositoryPath is relative to the repository's root directory.

Parameters:
ui - The CVS User Interface to display the progress.
localDirectory - The relative path to ensure.
Returns:
A CVSResponse with the results of each directory 'add'.

establishNewDirSticky

public void establishNewDirSticky(CVSRequest request,
                                  CVSEntry entry)
This methods deal with adding a new directory which is not yet in the repository, and yet, whose parent directory has a sticky tag set. We wish to "inherit" that tag...


establishStickys

public void establishStickys(CVSRequest request)

establishStatics

public void establishStatics(CVSRequest request)

performCVSRequest

public boolean performCVSRequest(CVSRequest request)

performCVSRequest

public boolean performCVSRequest(CVSRequest request,
                                 CVSResponse response)

entryLineToEntry

public CVSEntry entryLineToEntry(java.lang.String entryLine)

getLocalEntryFile

public java.io.File getLocalEntryFile(CVSEntry entry)

normalizeLocalDirectory

public java.lang.String normalizeLocalDirectory(java.lang.String pathName,
                                                java.lang.String repository)
Given a local-directory returned from the server, make sure the local-directory is in a format that jCVS can make use of (i.e., via the pathTable). Currently, the only case handled is when local-directory is './', which forces us to locate from pathTable.

Parameters:
pathName - The local-directory from the server.
repository - The repository the server sent with this local-directory.
Returns:
The normalized local-directory, or null if it does not exist.

createItemEntry

public CVSEntry createItemEntry(CVSResponseItem item)

handleResponseItem

public boolean handleResponseItem(CVSRequest request,
                                  CVSResponse response,
                                  CVSResponseItem item)
Specified by:
handleResponseItem in interface CVSResponseHandler

processCVSResponse

public boolean processCVSResponse(CVSRequest request,
                                  CVSResponse response)

performCopyFile

public boolean performCopyFile(CVSResponseItem item)

setSticky

public boolean setSticky(CVSResponseItem item,
                         boolean isSet,
                         boolean writeFile)

setStaticDirectory

public boolean setStaticDirectory(CVSResponseItem item,
                                  boolean isSet,
                                  boolean writeFile)

parseNotifyLine

public CVSNotifyItem parseNotifyLine(java.lang.String notifyLine)

processNotified

protected boolean processNotified(CVSResponseItem item)

readRootDirectory

public java.lang.String readRootDirectory(java.io.File rootFile)

readRepository

public java.lang.String readRepository(java.io.File reposFile)

establishRootEntry

public void establishRootEntry(java.lang.String repository)
Parameters:
repository - The server's repository pathname for the root.

openProject

public void openProject(java.io.File localRootFile)
                 throws java.io.IOException
java.io.IOException

removeAllEntries

public void removeAllEntries()

addNewEntry

public void addNewEntry(CVSEntry entry)

reposNameToRepository

public java.lang.String reposNameToRepository(java.lang.String fullRepos)

reposNameToFileName

public java.lang.String reposNameToFileName(java.lang.String fullRepos)

removeEntriesItem

public boolean removeEntriesItem(CVSResponseItem item)

updateEntriesItem

public void updateEntriesItem(CVSEntry newEntry)
Given an entry, update the entry in our project. If the entry is new (not found), then add it to our project.

Parameters:
newEntry - The entry to update.

readEntries

public boolean readEntries()

readEntriesFile

public CVSEntryVector readEntriesFile(CVSEntry dirEntry,
                                      java.io.File workingDirectory)
Parameters:
dirEntry - The entry of the directory being loaded.
workingDirectory - The local file system directory of dirEntry.

writeAdminFiles

public boolean writeAdminFiles()

writeAdminEntriesFile

public boolean writeAdminEntriesFile(java.io.File entriesFile,
                                     CVSEntryVector entries)

writeAdminRootFile

public boolean writeAdminRootFile(java.io.File rootFile,
                                  java.lang.String rootDirectoryStr)

writeAdminRepositoryFile

public boolean writeAdminRepositoryFile(java.io.File repFile,
                                        java.lang.String repository)

isLocalFileModified

public boolean isLocalFileModified(CVSEntry entry)

checkReleaseStatus

public boolean checkReleaseStatus(CVSIgnore ignore,
                                  java.util.Vector mods,
                                  java.util.Vector adds,
                                  java.util.Vector rems,
                                  java.util.Vector unks)
This is used for the 'release' command to determine if the project has any modifications the user might not want to lose.

Returns:
True if the project has any changes user might want to save.

pruneEmptySubDirs

public void pruneEmptySubDirs(boolean saveAdminFiles)

pruneEmptySubDirs

public void pruneEmptySubDirs(CVSEntry parent)

releaseProject

public void releaseProject()

checkOverwrite

public boolean checkOverwrite(CVSEntry entry,
                              java.io.File file)

locateEntry

public CVSEntry locateEntry(java.lang.String fullPath)

ensureEntryHierarchy

public boolean ensureEntryHierarchy(java.lang.String localDirectory,
                                    java.lang.String repository)

ensureProperWorkingDirectory

public boolean ensureProperWorkingDirectory(java.lang.String localRoot,
                                            java.lang.String subPath,
                                            boolean ensureAdmin)

ensureLocalTree

public boolean ensureLocalTree(java.io.File localFile,
                               boolean ensureAdmin)

moveLocalFile

public void moveLocalFile(java.io.File localFile,
                          java.lang.String versionStr)
                   throws CVSFileException
CVSFileException

updateLocalFile

public boolean updateLocalFile(CVSResponseItem item,
                               CVSEntry entry,
                               java.io.File localFile)

copyFile

public boolean copyFile(java.io.File from,
                        java.io.File to,
                        int translation,
                        boolean isGZIPed)

copyFileAscii

public boolean copyFileAscii(java.io.File from,
                             java.io.File to,
                             boolean isGZIPed)

copyFileRaw

public boolean copyFileRaw(java.io.File from,
                           java.io.File to,
                           boolean isGZIPed)

uiDisplayProgressMsg

public void uiDisplayProgressMsg(java.lang.String message)

uiDisplayProgramError

public void uiDisplayProgramError(java.lang.String error)

uiDisplayResponse

public void uiDisplayResponse(CVSResponse response)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dumpCVSProject

public java.lang.StringBuffer dumpCVSProject(java.lang.StringBuffer buf,
                                             java.lang.String description)

dumpEntry

public java.lang.StringBuffer dumpEntry(java.lang.StringBuffer buf,
                                        java.lang.String prefix,
                                        CVSEntry dirEntry)


Copyright © 1997-2003, Timothy G. Endres, All Rights Reserved.