vc.corba.server
Class ProjectDB

java.lang.Object
  |
  +--vc.corba.server.ProjectDB

public class ProjectDB
extends java.lang.Object

ProjectDB is the mediator(pattern) class for VersionControl sesrver. It encapsulates all the functionality to integrate different kind of classs like CORBA, XML, Project management, Version management, JNI etc.


Field Summary
static java.util.Hashtable allDirectories
          Holds all the directories/projects
static java.util.Hashtable allFiles
          Holds all files
 java.lang.String dbName
          Holds the project Database name
static DirectoryContainer grandRootDirectory
          Holds all the grand root directories/projects
static java.util.Vector rootDirectories
          Holds all the root directories/projects
 
Constructor Summary
ProjectDB(java.lang.String dbName)
          Constructs th ProjectDb object and the actual database of the projects.
 
Method Summary
 DirectoryContainer addDirectory(Directory currentDirectory, java.lang.String parentID)
          Creates and Adds a directory as a sub directory to another directory.
 File addFile(File currentFile, java.lang.String parentID)
          Cretaes and Adds a file as a child to the specified directory.
 void addLabelForDirectories(java.lang.String creatorName, java.lang.String labelName, boolean recursive, java.lang.String[] directoryIDs)
          Create a new label for the directories identifiesd the IDs in the parameters
 void addLabelForFiles(java.lang.String creatorName, java.lang.String labelName, java.lang.String[] fileIDs)
          Create a new label for the files identifiesd the IDs in the parameters
 void addVersionForFiles(java.lang.String creatorName, java.lang.String versionName, java.lang.String[] fileIDs)
          Create a new version for the files identifiesd the IDs in the parameters
 void deleteDirectory(java.lang.String directoryID)
          Deletes an existing directory identified by the information in parameters
 void deleteFile(java.lang.String fileID, java.lang.String parentID)
          Deletes an existing file identified by the information in parameters
 DirDiskMap getDirDiskMap(java.lang.String diskMapUser, java.lang.String directoryID, boolean returnEmptyDiskMapIfEmpty)
          Gets the DirDiskMap set to the combination of user and directory identified by it's ID
 DirDiskMap[] getDirDiskMaps(java.lang.String directoryID)
          Gets the DirDiskMap under a particular directory identified by it's ID
 Directory getDirectory(java.lang.String directoryID)
          Gets the directory object by taking it's ID as the input
 DirectoryContainer getDirectoryContainer(java.lang.String directoryID)
          Gets the directory container object by taking taking the directory's ID as the input
 File getFile(java.lang.String fileID)
          Gets the file object by taking it's ID as the input
 FileContainer getFileContainer(java.lang.String fileID)
          Gets the file container object by taking taking the file's ID as the input
 DirDiskMap getFileDiskMap(java.lang.String diskMapUser, java.lang.String fileID, boolean returnParentsDiskMapIfNoneFound)
          Gets the DirDiskMap set to the combination of user and file identified by it's ID
 File[] getFiles(java.lang.String directoryID, java.lang.String userID)
          Gets all the files under a particular directory identified by the parameters
 File[] getFilesRecursively(java.lang.String directoryID, java.lang.String userID)
          Gets all the files recursively under a particular directory identified by the parameters
 HistoryElement[] getLabelsForFiles(java.lang.String[] fileIDs, java.lang.String user, java.lang.String startTime, java.lang.String endTime, boolean getLabels, boolean getVersions)
          This methos is to query and get all the labels and versions on the files that meet the criteria specified by the parameters.
 HistoryElement[] getLabelsOfDirectories(java.lang.String[] directoryIDs, java.lang.String user, java.lang.String startTime, java.lang.String endTime, boolean getLabels, boolean getVersions, boolean recursive, boolean getFiles, boolean getSubDirectories)
          This methos is to query and get all the labels and versions on the directories and files that meet the criteria specified by the parameters.
 Directory[] getSubDirectories(java.lang.String directoryID, java.lang.String userID)
          Gets all the sub directories of a particular directory identified by the parameters
 void removeLabelOfDirectories(java.lang.String creatorName, java.lang.String labelName, java.lang.String versionName, boolean recursive, java.lang.String[] directoryIDs)
          Removes an existing label of the directories(and inturn files) .
 void removeLabelOfFiles(java.lang.String creatorName, java.lang.String labelName, java.lang.String versionName, java.lang.String[] fileIDs)
          Removes an existing label of the files .
 void revertToLabelOfDirectories(java.lang.String creatorName, java.lang.String labelName, java.lang.String versionName, boolean recursive, boolean removeLatest, java.lang.String[] directoryIDs)
          Makes an existing label of the directories(and inturn files) as the latest version.
 void revertToLabelOfFiles(java.lang.String creatorName, java.lang.String labelName, java.lang.String versionName, boolean removeLatest, java.lang.String[] fileIDs)
          Makes an existing label of the files as the latest version.
 void saveChanges()
          Save the changes to the database for every XmlConstants.numOperationsToSaveXML number of changes made to theproject database
 void setDirDiskMap(DirDiskMap dirDiskMap, java.lang.String directoryID)
          Sets the DirDiskMap to the directory identified by it's ID
 void setFileDiskMap(DirDiskMap dirDiskMap, java.lang.String fileID)
          Sets the DirDiskMap to the file identified by it's ID
 void updateDirectory(Directory currentDirectory)
          Updates an existing directory with the new information.
 void updateFile(java.lang.String user, File currentFile)
          Updates an existing file with the new information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDirectories

public static java.util.Vector rootDirectories
Holds all the root directories/projects

allDirectories

public static java.util.Hashtable allDirectories
Holds all the directories/projects

allFiles

public static java.util.Hashtable allFiles
Holds all files

grandRootDirectory

public static DirectoryContainer grandRootDirectory
Holds all the grand root directories/projects

dbName

public java.lang.String dbName
Holds the project Database name
Constructor Detail

ProjectDB

public ProjectDB(java.lang.String dbName)
Constructs th ProjectDb object and the actual database of the projects. It also creates the root object for the database from where all the projects will be derived.
Parameters:
dbName - Name of the database to which this VersionControl server is attached
Method Detail

addDirectory

public DirectoryContainer addDirectory(Directory currentDirectory,
                                       java.lang.String parentID)
Creates and Adds a directory as a sub directory to another directory.
Parameters:
currentDirectory - information of the directory that is to be created
parentID - ID of the directory to whom the new directory is added as sub directory
Returns:
returns the newly creted directorie's container

addFile

public File addFile(File currentFile,
                    java.lang.String parentID)
Cretaes and Adds a file as a child to the specified directory.
Parameters:
currentFile - information of the file that is to be created
parentID - ID of the directory to whom the file is to be added as a child
Returns:
returns the newly creted file's container

updateDirectory

public void updateDirectory(Directory currentDirectory)
Updates an existing directory with the new information.
Parameters:
currentDirectory - information of the directory that is to be updated

updateFile

public void updateFile(java.lang.String user,
                       File currentFile)
Updates an existing file with the new information.
Parameters:
user - to track the changes and creator of this new information
currentFile - information of the file that is to be updated

deleteFile

public void deleteFile(java.lang.String fileID,
                       java.lang.String parentID)
Deletes an existing file identified by the information in parameters
Parameters:
fileID - ID of the file that is to be deleted
parentID - ID of the directory having the file that is to be deleted

deleteDirectory

public void deleteDirectory(java.lang.String directoryID)
Deletes an existing directory identified by the information in parameters
Parameters:
directoryID - ID of the directory that is to be deleted

getSubDirectories

public Directory[] getSubDirectories(java.lang.String directoryID,
                                     java.lang.String userID)
Gets all the sub directories of a particular directory identified by the parameters
Parameters:
directoryID - ID of the directory whose subdirectories are to be returned.
userID - to send the directory information specific to the user
Returns:
returns all sub directories of the requested directory

getFiles

public File[] getFiles(java.lang.String directoryID,
                       java.lang.String userID)
Gets all the files under a particular directory identified by the parameters
Parameters:
directoryID - ID of the directory whose files are to be returned.
userID - to send the file information specific to the user
Returns:
returns all files of the requested directory

getFilesRecursively

public File[] getFilesRecursively(java.lang.String directoryID,
                                  java.lang.String userID)
Gets all the files recursively under a particular directory identified by the parameters
Parameters:
directoryID - ID of the directory whose files are to be returned recursively.
userID - to send the file information specific to the user
Returns:
returns all files recursively from the requested directory

getDirDiskMaps

public DirDiskMap[] getDirDiskMaps(java.lang.String directoryID)
                            throws VCException
Gets the DirDiskMap under a particular directory identified by it's ID
Parameters:
directoryID - ID of the directory whose disk map is to be returned
Returns:
returns the DirDiskMap under the directory identified by it's ID
Throws:
Throws - VCException which is a CORBA enabled exception

setDirDiskMap

public void setDirDiskMap(DirDiskMap dirDiskMap,
                          java.lang.String directoryID)
Sets the DirDiskMap to the directory identified by it's ID
Parameters:
dirDiskMap - Diskmap which is to be set for the particular directory
directoryID - ID of the new directory which is to be mapped to the file system directory

getDirDiskMap

public DirDiskMap getDirDiskMap(java.lang.String diskMapUser,
                                java.lang.String directoryID,
                                boolean returnEmptyDiskMapIfEmpty)
                         throws VCException
Gets the DirDiskMap set to the combination of user and directory identified by it's ID
Parameters:
diskMapUser - the user whose disk maps are to be fetched
directoryID - ID of the directory whose disk map is to be returned
returnEmptyDiskMapIfEmpty - if this is true and no disk map is found then it returns an empty DirDiskMap object
Returns:
returns the DirDiskMap with the matching user identified by connection ID
Throws:
Throws - VCException which is a CORBA enabled exception

setFileDiskMap

public void setFileDiskMap(DirDiskMap dirDiskMap,
                           java.lang.String fileID)
Sets the DirDiskMap to the file identified by it's ID
Parameters:
dirDiskMap - disk map that is to be set for the File
fileID - ID of the file which is to be mapped to the file system directory

getFileDiskMap

public DirDiskMap getFileDiskMap(java.lang.String diskMapUser,
                                 java.lang.String fileID,
                                 boolean returnParentsDiskMapIfNoneFound)
                          throws VCException
Gets the DirDiskMap set to the combination of user and file identified by it's ID
Parameters:
diskMapUser - the user whose disk maps are to be fetched
fileID - ID of the file whose disk map is to be returned
returnParentsDiskMapIfNoneFound - if this is true and no disk map is found then it returns the parent's DirDiskMap objects
Returns:
returns the DirDiskMap with the matching user identified by connection ID
Throws:
Throws - VCException which is a CORBA enabled exception

getFile

public File getFile(java.lang.String fileID)
Gets the file object by taking it's ID as the input
Parameters:
fileID - ID of the file which is to be returned
Returns:
Returns the file with the matching fileID

getDirectory

public Directory getDirectory(java.lang.String directoryID)
Gets the directory object by taking it's ID as the input
Parameters:
directoryID - ID of the directory which is to be returned
Returns:
Returns the directory with the matching directoryID

getFileContainer

public FileContainer getFileContainer(java.lang.String fileID)
Gets the file container object by taking taking the file's ID as the input
Parameters:
fileID - ID of the file which is to be returned
Returns:
Returns the file contaainer holding the file with the matching fileID

getDirectoryContainer

public DirectoryContainer getDirectoryContainer(java.lang.String directoryID)
Gets the directory container object by taking taking the directory's ID as the input
Parameters:
directoryID - ID of the directory which is to be returned
Returns:
Returns the directory contaainer holding the file with the matching directoryID

addLabelForDirectories

public void addLabelForDirectories(java.lang.String creatorName,
                                   java.lang.String labelName,
                                   boolean recursive,
                                   java.lang.String[] directoryIDs)
                            throws java.lang.Throwable
Create a new label for the directories identifiesd the IDs in the parameters
Parameters:
creatorName - Name of the user creating this label
labelName - Name of the label being added to the directory
recursive - if true then the label wil be added to the subdirectories recursively
directoryIDs - IDs of the directories to which the label is to be added

addLabelForFiles

public void addLabelForFiles(java.lang.String creatorName,
                             java.lang.String labelName,
                             java.lang.String[] fileIDs)
                      throws java.lang.Throwable
Create a new label for the files identifiesd the IDs in the parameters
Parameters:
creatorName - Name of the user creating this label
labelName - Name of the label being added to the files
fileIDs - IDs of the files to which the label is to be added

addVersionForFiles

public void addVersionForFiles(java.lang.String creatorName,
                               java.lang.String versionName,
                               java.lang.String[] fileIDs)
                        throws java.lang.Throwable
Create a new version for the files identifiesd the IDs in the parameters
Parameters:
creatorName - Name of the user creating this version
versionName - Name of the version being added to the files
fileIDs - IDs of the files to which the version is to be added

getLabelsOfDirectories

public HistoryElement[] getLabelsOfDirectories(java.lang.String[] directoryIDs,
                                               java.lang.String user,
                                               java.lang.String startTime,
                                               java.lang.String endTime,
                                               boolean getLabels,
                                               boolean getVersions,
                                               boolean recursive,
                                               boolean getFiles,
                                               boolean getSubDirectories)
                                        throws java.lang.Throwable
This methos is to query and get all the labels and versions on the directories and files that meet the criteria specified by the parameters.
Parameters:
directoryIDs - IDs of the directories whose labels are to be extracted
user - Is to select the labels created by user same as this parameter
startTime - if this is a non empty string then the labels created on or after this will be selected
endTime - if this is a non empty string then the labels created on or before this will be selected
getLabels - if this is true then the labels meeting the criteria will be selected
getVersions - if this is true then the versions meeting the criteria will be selected
recursive - if this is true then labels and versions will be selected recursively from sub directories also
getFiles - if this is true then labels and versions will be selected for files also
getSubDirectories - if this is true then labels and versions will be selected for getSubDirectories also
Returns:
Returns HistoryElements where each represent eigther a version or a label

getLabelsForFiles

public HistoryElement[] getLabelsForFiles(java.lang.String[] fileIDs,
                                          java.lang.String user,
                                          java.lang.String startTime,
                                          java.lang.String endTime,
                                          boolean getLabels,
                                          boolean getVersions)
                                   throws java.lang.Throwable
This methos is to query and get all the labels and versions on the files that meet the criteria specified by the parameters.
Parameters:
fileIDs - IDs of the files whose labels/versions are to be extracted
user - Is to select the labels created by user same as this parameter
startTime - if this is a non empty string then the labels created on or after this will be selected
endTime - if this is a non empty string then the labels created on or before this will be selected
getLabels - if this is true then the labels meeting the criteria will be selected
getVersions - if this is true then the versions meeting the criteria will be selected
Returns:
Returns HistoryElements where each represent eigther a version or a label

revertToLabelOfDirectories

public void revertToLabelOfDirectories(java.lang.String creatorName,
                                       java.lang.String labelName,
                                       java.lang.String versionName,
                                       boolean recursive,
                                       boolean removeLatest,
                                       java.lang.String[] directoryIDs)
                                throws java.lang.Throwable
Makes an existing label of the directories(and inturn files) as the latest version.
Parameters:
creatorName - Name of the user who is reverting the label
labelName - Name of the label being reverted to for the directories
versionName - Name of the version being reverted to for the directories
recursive - if this is true then the label is reverted recursively to the subdirectories and files of each directory
removeLatest - Remove the labels that are old labels
directoryIDs - IDs of the directories whose old label is being made the latest

revertToLabelOfFiles

public void revertToLabelOfFiles(java.lang.String creatorName,
                                 java.lang.String labelName,
                                 java.lang.String versionName,
                                 boolean removeLatest,
                                 java.lang.String[] fileIDs)
                          throws java.lang.Throwable
Makes an existing label of the files as the latest version.
Parameters:
creatorName - Name of the user who is reverting the label
labelName - Name of the label being reverted for the files
versionName - Name of the version being reverted for the files
removeLatest - Remove the labels that are old labels
fileIDs - IDs of the files whose old label is being made the latest

removeLabelOfDirectories

public void removeLabelOfDirectories(java.lang.String creatorName,
                                     java.lang.String labelName,
                                     java.lang.String versionName,
                                     boolean recursive,
                                     java.lang.String[] directoryIDs)
                              throws java.lang.Throwable
Removes an existing label of the directories(and inturn files) .
Parameters:
creatorName - name of the user removing tha label
labelName - Name of the label being deleted for the directories
recursive - if this is true then the label is deleted recursively to the subdirectories and files of each directory
directoryIDs - IDs of the directories whose label is deleted

removeLabelOfFiles

public void removeLabelOfFiles(java.lang.String creatorName,
                               java.lang.String labelName,
                               java.lang.String versionName,
                               java.lang.String[] fileIDs)
                        throws java.lang.Throwable
Removes an existing label of the files .
Parameters:
creatorName - name of the user removing tha label
labelName - Name of the label being removed for the files
versionName - Name of the version being removed for the files
fileIDs - IDs of the files whose old label is being made the latest

saveChanges

public void saveChanges()
Save the changes to the database for every XmlConstants.numOperationsToSaveXML number of changes made to theproject database