com.togethersoft.openapi.vcs
Class DefaultVcsProvider


public class DefaultVcsProvider
implements VcsProvider, VcsProviderConstants

A default implementation of VcsProvider which defines basic functinality of the provider.
The implementation may inherit from this class to reuse this functionality.

Author:
TogetherSoft
Since: Together 4.0

Field Summary
 private FilemyCurrentWorkingDirectory
           
 private StringmyPassword
           
 private StringmyRootProject
           
 private FilemyRootWorkingDirectory
           
 private StringmyUser
           

Method Summary
 voidaddListener(VcsProviderListener listener)
          Adds provider event listenter
 voidchangeWorkingDirectory(File workingDirectory)
          Changes the value of internal current working directory field.
 voidclearAdvancedOptions(String command)
          Throws CapabilityException.
 voidendSession()
          Clears all internal fields.
 intexecAddFiles(String[] files, int[] fileTypes, String comment, boolean makeCheckedOut, boolean removeLocal)
          Throws CapabilityException.
 intexecChangeFileType(String fileName, int newFileType)
           
 intexecCheckInFiles(String[] files, String comment, boolean keepCheckedOut, boolean removeLocal, boolean wholeProject, boolean projectRecursively, VcsCommitInfo info)
          Throws CapabilityException.
 intexecCheckOutFiles(String[] files, String comment, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
          Throws CapabilityException.
 VcsVersionInfoexecFindVersionChangeAuthor(String fileName, String versionId, int lineNo)
          Find the first version in which specified string appears
A session must be started prior to call this method.
 intexecGetFileHistory(String file, List versions)
           
 intexecGetFileInfo(String[] files, boolean wholeProject, boolean projectRecursively, List fileInfo)
          Throws CapabilityException.
 intexecGetFiles(String[] files, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
          Throws CapabilityException.
 intexecGetFilesStatuses(String[] files, int[] statuses)
          Throws CapabilityException.
 intexecGetMissingFiles(Vector files)
          Throws CapabilityException.
 intexecGetRawFileDiff(String fileName, boolean ignoreCase, boolean ignoreSpace, StringBuffer diff)
          Throws CapabilityException.
 intexecGetRawFilesHistory(String[] files, boolean wholeProject, boolean projectRecursively, StringBuffer buffer)
           
 intexecGetRawVersionsDiff(String versionID1, String versionID2, boolean ignoreCase, boolean ignoreSpace, StringBuffer buf)
          Throws CapabilityException.
 intexecGetVersion(String versionID, java.io.OutputStream stream)
           
 intexecLockFiles(String[] files, boolean wholeProject, boolean projectRecursively)
          Throws CapabilityException.
 intexecRemoveFiles(String[] files, String comment, boolean removeLocal)
          Throws CapabilityException.
 intexecRenameFile(String fileName, String newFileName)
          This method should be overridden by subclass if the command is supported.
 intexecSearchFileHistory(String file, String pattern, List searchResult)
           
 intexecSelectProject(String defaultProject, File workingDir, boolean createNewProject, StringBuffer selectedProject)
          Throws CapabilityException.
 intexecSetFilesLabel(String[] files, String label, boolean wholeProject, boolean projectRecursively)
          Throws CapabilityException.
 intexecShowAdvancedOptions(String command, boolean project)
          Throws CapabilityException.
 intexecShowFileDiff(String fileName, boolean ignoreCase, boolean ignoreSpace)
          Throws CapabilityException.
 intexecShowFileProperties(String fileName)
          Throws CapabilityException.
 intexecShowFilesHistory(String[] files, boolean wholeProject, boolean projectRecursively)
          Throws CapabilityException.
 intexecUnCheckOutFiles(String[] files, boolean removeLocal, boolean wholeProject, boolean projectRecursively)
          Throws CapabilityException.
 intexecUnLockFiles(String[] files, boolean wholeProject, boolean projectRecursively)
          Throws CapabilityException.
 intexecUnSetFilesLabel(String[] files, String label, boolean wholeProject, boolean projectRecursively)
           
 intexecUpdateFiles(String[] files, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
          Throws CapabilityException.
 voidfree()
          Clears all internal fields.
 StringgetCurrentProject()
          Returns root project + path from root working directory to current
working directory.
 FilegetCurrentWorkingDirectory()
          Returns value of internal current project field.
 intgetFileStatus(String filename)
          Returns FILE_STATUS_NONE.
 StringgetID()
          Returns "DEFAULT" as provider ID.
 StringgetRootProject()
          Returns value of internal root project field.
 FilegetRootWorkingDirectory()
          Returns value of internal root working directory field.
 booleanisSessionStarted()
          Returns true if both internal root project and working directories are not null.
 booleanisValid()
          Always returns false.
 booleanisVcsInternalFile(String fileName)
           
 voidremoveListener(VcsProviderListener listener)
          Removes provider event listenter
 voidsetListener(VcsProviderListener listener)
          Set provider event listenter
 voidstartSession(String rootProject, File rootWorkingDir, String user, String password)
          Initializes internal root project and working directory values.
 voidstartSession(String rootProject, File rootWorkingDir)
           

Field Detail

myCurrentWorkingDirectory

private File myCurrentWorkingDirectory

myPassword

private String myPassword

myRootProject

private String myRootProject

myRootWorkingDirectory

private File myRootWorkingDirectory

myUser

private String myUser
Method Detail

addListener

public void addListener(VcsProviderListener listener)
Adds provider event listenter
Stereotype new

changeWorkingDirectory

public void changeWorkingDirectory(File workingDirectory)
throws VcsProviderException
Changes the value of internal current working directory field.

clearAdvancedOptions

public void clearAdvancedOptions(String command)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

endSession

public void endSession()
throws VcsProviderException
Clears all internal fields.

execAddFiles

public int execAddFiles(String[] files, int[] fileTypes, String comment, boolean makeCheckedOut, boolean removeLocal)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execChangeFileType

public int execChangeFileType(String fileName, int newFileType)
throws VcsProviderException

execCheckInFiles

public int execCheckInFiles(String[] files, String comment, boolean keepCheckedOut, boolean removeLocal, boolean wholeProject, boolean projectRecursively, VcsCommitInfo info)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execCheckOutFiles

public int execCheckOutFiles(String[] files, String comment, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execFindVersionChangeAuthor

public VcsVersionInfo execFindVersionChangeAuthor(String fileName, String versionId, int lineNo)
throws VcsProviderException
Find the first version in which specified string appears
A session must be started prior to call this method.
Parameters:
fileName - name of file in the current directory
versionId - identifier of version iof the file from which line is taken
lineNo - line number to be searched in the specified version of the file
Returns: information about the version where the specified line first appeared

execGetFileHistory

public int execGetFileHistory(String file, List versions)
throws VcsProviderException

execGetFileInfo

public int execGetFileInfo(String[] files, boolean wholeProject, boolean projectRecursively, List fileInfo)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetFiles

public int execGetFiles(String[] files, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetFilesStatuses

public int execGetFilesStatuses(String[] files, int[] statuses)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetMissingFiles

public int execGetMissingFiles(Vector files)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetRawFileDiff

public int execGetRawFileDiff(String fileName, boolean ignoreCase, boolean ignoreSpace, StringBuffer diff)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetRawFilesHistory

public int execGetRawFilesHistory(String[] files, boolean wholeProject, boolean projectRecursively, StringBuffer buffer)
throws VcsProviderException

execGetRawVersionsDiff

public int execGetRawVersionsDiff(String versionID1, String versionID2, boolean ignoreCase, boolean ignoreSpace, StringBuffer buf)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execGetVersion

public int execGetVersion(String versionID, java.io.OutputStream stream)
throws VcsProviderException

execLockFiles

public int execLockFiles(String[] files, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execRemoveFiles

public int execRemoveFiles(String[] files, String comment, boolean removeLocal)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execRenameFile

public int execRenameFile(String fileName, String newFileName)
throws VcsProviderException
This method should be overridden by subclass if the command is supported.

execSearchFileHistory

public int execSearchFileHistory(String file, String pattern, List searchResult)
throws VcsProviderException

execSelectProject

public int execSelectProject(String defaultProject, File workingDir, boolean createNewProject, StringBuffer selectedProject)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execSetFilesLabel

public int execSetFilesLabel(String[] files, String label, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execShowAdvancedOptions

public int execShowAdvancedOptions(String command, boolean project)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execShowFileDiff

public int execShowFileDiff(String fileName, boolean ignoreCase, boolean ignoreSpace)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execShowFileProperties

public int execShowFileProperties(String fileName)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execShowFilesHistory

public int execShowFilesHistory(String[] files, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execUnCheckOutFiles

public int execUnCheckOutFiles(String[] files, boolean removeLocal, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execUnLockFiles

public int execUnLockFiles(String[] files, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

execUnSetFilesLabel

public int execUnSetFilesLabel(String[] files, String label, boolean wholeProject, boolean projectRecursively)
throws VcsProviderException

execUpdateFiles

public int execUpdateFiles(String[] files, boolean wholeProject, boolean projectRecursively, VcsUpdateInfo updateInfo)
throws VcsProviderException
Throws CapabilityException. This method should be overridden by subclass if the command is supported.

free

public void free()
Clears all internal fields.

getCurrentProject

public String getCurrentProject()
Returns root project + path from root working directory to current
working directory. All delimiters guaranteed to be "/". This method may be overridden to get correct project.

getCurrentWorkingDirectory

public File getCurrentWorkingDirectory()
Returns value of internal current project field.

getFileStatus

public int getFileStatus(String filename)
throws VcsProviderException
Returns FILE_STATUS_NONE.

getID

public String getID()
Returns "DEFAULT" as provider ID. Should be overridden by subclass.

getRootProject

public String getRootProject()
Returns value of internal root project field.

getRootWorkingDirectory

public File getRootWorkingDirectory()
Returns value of internal root working directory field.

isSessionStarted

public boolean isSessionStarted()
Returns true if both internal root project and working directories are not null.

isValid

public boolean isValid()
Always returns false.

isVcsInternalFile

public boolean isVcsInternalFile(String fileName)

removeListener

public void removeListener(VcsProviderListener listener)
Removes provider event listenter
Stereotype new

setListener

public void setListener(VcsProviderListener listener)
Set provider event listenter

startSession

public void startSession(String rootProject, File rootWorkingDir, String user, String password)
throws VcsProviderException
Initializes internal root project and working directory values.
Current working directory set to root. None of parameters can be null.
throw IllegalArgumentException if any of parameters is null.

startSession

public void startSession(String rootProject, File rootWorkingDir)
throws VcsProviderException

Association Links

to Class java.io.File

to Class java.io.File

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String