SourceJammer 1.3.0 November 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan

org.sourcejammer.client.gui
Class CommandCentral

java.lang.Object
  |
  +--org.sourcejammer.client.gui.CommandCentral

public class CommandCentral
extends java.lang.Object

Central singleton that handles issuing all commands and performing all file system actions for GUI.


Field Summary
static java.lang.String APP_TITLE
           
static java.io.PrintStream out
           
 
Method Summary
 void addFile(long parentUniqueID, java.lang.String newFileName, java.lang.String localFileNameLocation, int fileType, int historyType, java.lang.String description, java.lang.String afterAddAction)
           
 void addUserToArchiveControllers(java.lang.String userName)
           
 void addUserToArchiveUsers(java.lang.String userName)
           
 void changePassword(java.lang.String sPassword)
           
 void changePassword(java.lang.String sPassword, java.lang.String userName)
           
 void checkInFile(long fileID, java.lang.String sFileName, java.io.File flTargetDirectory, java.lang.String comment, java.lang.String afterCheckInAction)
           
 void checkOutFile(long fileID, java.lang.String fileName, java.io.File flTargetDirectory)
           
 void checkOutFile(long fileID, java.lang.String fileName, java.io.File flTargetDirectory, int eolType)
           
 Project connectToArchive()
           
 void copyFile(long fileID, long fromProjectID, long toProjectID)
           
 void copyProject(long projectID, long fromProjectID, long toProjectID, java.lang.String newProjectName)
           
 java.lang.String currentURL()
           
 boolean deleteArchive(java.lang.String archiveName)
          Returns true if the archive deleted is the current archive and the user is now disconnected.
 void deleteRemoved(long lParentID, int iItemNumber)
           
 boolean disconnect()
           
 void displayErrorMessage(java.lang.String s)
           
 void displayErrorMessage(java.lang.String[] s)
           
 void displayErrorMessage(java.lang.String[] s, boolean eventThread)
           
 void displayErrorMessage(java.lang.String s, boolean eventThread)
           
 void forceCheckIn(long fileID, java.lang.String sFileName, java.io.File flTargetDirectory, java.lang.String comment, java.lang.String afterCheckInAction)
          Force local version of file into archive without checking file out.
 java.lang.String[] getAllCurrentFileNames()
           
 UserInfo[] getArchiveControllerList()
           
 java.lang.String getArchiveName()
           
 java.lang.String[] getArchiveNameList()
          Returns list of archives available on server user is currently connected to.
 ArchiveProperties getArchiveProperties()
           
 UserInfo[] getArchiveUserList()
           
 SourceVersionChecker getChecker(java.io.File flDirectory)
           
 int getClientDefaultEOLType()
          Gets the default EOL type for the client from AppConfig.
 UserInfo[] getCompleteUserList()
           
 SourceVersionChecker getCurrentProjectChecker()
           
 ProjectTreeNode getCurrentTreeNode()
           
 java.lang.String getCurrentUserName()
           
 void getFile(long lFileID, java.lang.String sFileName, java.io.File flTargetDirectory, boolean setReadOnly)
           
 void getFile(long lFileID, java.lang.String sFileName, java.io.File flTargetDirectory, int eolType, boolean setReadOnly)
           
 void getFile(long lFileID, java.lang.String sFileName, java.io.File flTargetDirectory, int eolType, boolean printMessages, boolean setReadOnly)
           
 File getFileInfo(long lFileID)
          Get file info
 long getFileLatestVersionID(long lFileID)
           
 long getFileUniqueID(java.lang.String sjPath)
          Returns unique id of file based on full path to sourcejammer node.
 void getFileVersion(long fileID, java.lang.String sName, java.io.File flTargetDirectory, int iVersion, long versionID, boolean setReadOnly)
           
 void getFileVersion(long fileID, java.lang.String sName, java.io.File flTargetDirectory, int iVersion, long versionID, boolean setReadOnly, boolean printMessages)
           
 void getFileVersion(long fileID, java.lang.String fileName, java.io.File flTargetDirectory, int iVersion, long versionID, int eolType, boolean setReadOnly)
           
 void getFileVersion(long fileID, java.lang.String fileName, java.io.File flTargetDirectory, int iVersion, long versionID, int eolType, boolean setReadOnly, boolean printMessages)
           
 GuiConf getGuiConf()
           
static CommandCentral getInstance()
           
static CommandCentral getInstance(SJPrimaryWindow rootApplicationFrame)
           
 void getLabel(long labelID, int verNumber, java.io.File flToDirectory, boolean bBuildSubDirs, int eolType, boolean setReadOnly)
          Gets all of the file version in the specified label from the server and writes them to the specified directory (building subdirectories if required and allowed).
 NodeList getLabelList()
           
 java.lang.String getPassword()
           
 javax.swing.JTable getPrimaryTable()
           
 javax.swing.table.TableColumnModel getPrimaryTableColumnModel()
           
 javax.swing.JTree getProjectTree()
           
 long getProjectUniqueID(java.lang.String sjPath)
          Returns unique id of project based on full path to sourcejammer node.
 SJPrimaryWindow getRootAppFrame()
           
 java.lang.String[] getSelectedFileNames()
           
 NodeInfo getSelectedFileNodeInfo()
           
 NodeInfo[] getSelectedFilesNodeInfo()
           
 java.lang.String getUserName()
           
 boolean isAppWindowRendered()
           
 boolean isConnected()
           
 void makeArchive(java.lang.String name, int implementation, java.lang.String path)
           
 void makeArchiveDisconnected(java.lang.String userName, java.lang.String password, java.lang.String url, java.lang.String name, int implementation, java.lang.String path)
           
 void makeLabel(long labelRootProjectID, java.lang.String labelName, java.lang.String description)
           
 long makeProject(long parentProjectID, java.lang.String newProjectName)
          Make a new project on the server.
 void makeUser(java.lang.String sUserName, java.lang.String sPassword, java.lang.String sFullName)
           
 void moveFile(long fileID, long fromProjectID, long toProjectID)
           
 void moveProject(long projectID, long fromProjectID, long toProjectID, java.lang.String newProjectName)
           
 void rebuildLabel(long labelId, long parentProjectID, java.lang.String comment)
          Rebuild the specified label.
 void removeFile(long fileID, long parentID)
           
 void removeProject(long projectID, long parentID)
           
 void removeUser(java.lang.String sUserName)
           
 void removeUserFromArchiveControllers(java.lang.String userName)
           
 void removeUserFromArchiveUsers(java.lang.String userName)
           
 void renameFile(long fileID, long parentID, java.lang.String newName)
           
 void renameProject(long projectID, long parentID, java.lang.String newName)
           
 void resetAppTitle()
           
 void restoreRemoved(long parentID, int iItemNumber, java.lang.String newName)
           
protected  long retrieveFileFromServer(DownloadFileIdentifier id, SJResponse response)
          Returns temp file id.
 Project retrieveProject(long projectID)
          Retrieve info about a project from the server.
 void rollbackToVersion(long fileID, long versionID)
          Rolls back a file in the SourceJammer server to the specified previous version of the file.
 void selectProject(ProjectTreeNode nd)
          Select the specified project in the project tree.
protected  long sendFileToServer(java.io.File fl, SJRequest request)
           
 void setAlternateOut(java.io.PrintStream altOut)
          This method can be called to set the static out to some PrintStream other than the message pane.
 void setAppWindowRendered(boolean b)
           
 void setArchiveConnectInfo(java.lang.String archive, java.lang.String userName, java.lang.String password)
           
 void setArchiveProperties(ArchiveProperties props)
           
 void setCurrentTreeNode(ProjectTreeNode node)
           
 void setDisconnectedDisplaySettings()
           
 void setPrimaryTableColumnModel(javax.swing.table.TableColumnModel model)
           
 void setServerURL(java.lang.String url)
           
 void setUserAdminStatus(java.lang.String userName, boolean status)
           
 void undoCheckOut(long fileID, java.lang.String sFileName, java.io.File flTargetDirectory)
           
 RemovedItem[] viewRemoved(long projectID)
           
 java.lang.String viewVersionComment(long versionID)
           
protected  byte[] zipByteArrayIfNeeded(byte[] file, SJRequest request, java.lang.String fileName)
          Checks if a byte array about to be sent is larger than the minimum unzipped file size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_TITLE

public static final java.lang.String APP_TITLE

out

public static java.io.PrintStream out
Method Detail

setArchiveConnectInfo

public void setArchiveConnectInfo(java.lang.String archive,
                                  java.lang.String userName,
                                  java.lang.String password)
                           throws java.io.IOException

getArchiveName

public java.lang.String getArchiveName()

setAlternateOut

public void setAlternateOut(java.io.PrintStream altOut)
This method can be called to set the static out to some PrintStream other than the message pane. Typically, this will be called when SJ is being automated.

getUserName

public java.lang.String getUserName()

getPassword

public java.lang.String getPassword()

getGuiConf

public GuiConf getGuiConf()

setPrimaryTableColumnModel

public void setPrimaryTableColumnModel(javax.swing.table.TableColumnModel model)

setCurrentTreeNode

public void setCurrentTreeNode(ProjectTreeNode node)

getCurrentProjectChecker

public SourceVersionChecker getCurrentProjectChecker()

getCurrentTreeNode

public ProjectTreeNode getCurrentTreeNode()

setAppWindowRendered

public void setAppWindowRendered(boolean b)

isAppWindowRendered

public boolean isAppWindowRendered()

getPrimaryTableColumnModel

public javax.swing.table.TableColumnModel getPrimaryTableColumnModel()

getInstance

public static CommandCentral getInstance(SJPrimaryWindow rootApplicationFrame)

setServerURL

public void setServerURL(java.lang.String url)
                  throws java.net.MalformedURLException

getInstance

public static CommandCentral getInstance()

getSelectedFileNames

public java.lang.String[] getSelectedFileNames()

getSelectedFileNodeInfo

public NodeInfo getSelectedFileNodeInfo()

getSelectedFilesNodeInfo

public NodeInfo[] getSelectedFilesNodeInfo()

getAllCurrentFileNames

public java.lang.String[] getAllCurrentFileNames()

currentURL

public java.lang.String currentURL()

getArchiveNameList

public java.lang.String[] getArchiveNameList()
                                      throws SourceJammerConnectionException,
                                             GUICommandException
Returns list of archives available on server user is currently connected to.

deleteArchive

public boolean deleteArchive(java.lang.String archiveName)
                      throws SourceJammerConnectionException,
                             GUICommandException
Returns true if the archive deleted is the current archive and the user is now disconnected. Signal to close any open dialog.

connectToArchive

public Project connectToArchive()
                         throws SourceJammerConnectionException,
                                GUICommandException,
                                NoSessionException

resetAppTitle

public void resetAppTitle()

getFileInfo

public File getFileInfo(long lFileID)
                 throws GUICommandException,
                        SourceJammerConnectionException
Get file info

makeProject

public long makeProject(long parentProjectID,
                        java.lang.String newProjectName)
                 throws SourceJammerConnectionException,
                        GUICommandException
Make a new project on the server.

renameProject

public void renameProject(long projectID,
                          long parentID,
                          java.lang.String newName)

renameFile

public void renameFile(long fileID,
                       long parentID,
                       java.lang.String newName)

retrieveProject

public Project retrieveProject(long projectID)
                        throws SourceJammerConnectionException,
                               GUICommandException
Retrieve info about a project from the server. Migrated to 1.1 unique ID approach. --rfm

getProjectUniqueID

public long getProjectUniqueID(java.lang.String sjPath)
                        throws SourceJammerConnectionException,
                               GUICommandException
Returns unique id of project based on full path to sourcejammer node.

getFileUniqueID

public long getFileUniqueID(java.lang.String sjPath)
                     throws SourceJammerConnectionException,
                            GUICommandException
Returns unique id of file based on full path to sourcejammer node.

addFile

public void addFile(long parentUniqueID,
                    java.lang.String newFileName,
                    java.lang.String localFileNameLocation,
                    int fileType,
                    int historyType,
                    java.lang.String description,
                    java.lang.String afterAddAction)
             throws GUICommandException,
                    SourceJammerConnectionException,
                    java.io.IOException

disconnect

public boolean disconnect()
                   throws SourceJammerConnectionException,
                          GUICommandException

setDisconnectedDisplaySettings

public void setDisconnectedDisplaySettings()

getFile

public void getFile(long lFileID,
                    java.lang.String sFileName,
                    java.io.File flTargetDirectory,
                    boolean setReadOnly)
             throws SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException

getFileLatestVersionID

public long getFileLatestVersionID(long lFileID)

getFile

public void getFile(long lFileID,
                    java.lang.String sFileName,
                    java.io.File flTargetDirectory,
                    int eolType,
                    boolean setReadOnly)
             throws SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException

getFile

public void getFile(long lFileID,
                    java.lang.String sFileName,
                    java.io.File flTargetDirectory,
                    int eolType,
                    boolean printMessages,
                    boolean setReadOnly)
             throws SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException

getClientDefaultEOLType

public int getClientDefaultEOLType()
Gets the default EOL type for the client from AppConfig.

checkOutFile

public void checkOutFile(long fileID,
                         java.lang.String fileName,
                         java.io.File flTargetDirectory)
                  throws SourceJammerConnectionException,
                         GUICommandException,
                         java.io.IOException

checkOutFile

public void checkOutFile(long fileID,
                         java.lang.String fileName,
                         java.io.File flTargetDirectory,
                         int eolType)
                  throws SourceJammerConnectionException,
                         GUICommandException,
                         java.io.IOException

forceCheckIn

public void forceCheckIn(long fileID,
                         java.lang.String sFileName,
                         java.io.File flTargetDirectory,
                         java.lang.String comment,
                         java.lang.String afterCheckInAction)
                  throws SourceJammerConnectionException,
                         GUICommandException,
                         java.io.IOException
Force local version of file into archive without checking file out.

checkInFile

public void checkInFile(long fileID,
                        java.lang.String sFileName,
                        java.io.File flTargetDirectory,
                        java.lang.String comment,
                        java.lang.String afterCheckInAction)
                 throws SourceJammerConnectionException,
                        GUICommandException,
                        java.io.IOException

undoCheckOut

public void undoCheckOut(long fileID,
                         java.lang.String sFileName,
                         java.io.File flTargetDirectory)
                  throws SourceJammerConnectionException,
                         GUICommandException

viewVersionComment

public java.lang.String viewVersionComment(long versionID)
                                    throws SourceJammerConnectionException,
                                           GUICommandException

getFileVersion

public void getFileVersion(long fileID,
                           java.lang.String sName,
                           java.io.File flTargetDirectory,
                           int iVersion,
                           long versionID,
                           boolean setReadOnly)
                    throws SourceJammerConnectionException,
                           GUICommandException,
                           java.io.IOException

getFileVersion

public void getFileVersion(long fileID,
                           java.lang.String sName,
                           java.io.File flTargetDirectory,
                           int iVersion,
                           long versionID,
                           boolean setReadOnly,
                           boolean printMessages)
                    throws SourceJammerConnectionException,
                           GUICommandException,
                           java.io.IOException

getFileVersion

public void getFileVersion(long fileID,
                           java.lang.String fileName,
                           java.io.File flTargetDirectory,
                           int iVersion,
                           long versionID,
                           int eolType,
                           boolean setReadOnly)
                    throws SourceJammerConnectionException,
                           GUICommandException,
                           java.io.IOException

getFileVersion

public void getFileVersion(long fileID,
                           java.lang.String fileName,
                           java.io.File flTargetDirectory,
                           int iVersion,
                           long versionID,
                           int eolType,
                           boolean setReadOnly,
                           boolean printMessages)
                    throws SourceJammerConnectionException,
                           GUICommandException,
                           java.io.IOException

removeProject

public void removeProject(long projectID,
                          long parentID)
                   throws SourceJammerConnectionException,
                          GUICommandException

removeFile

public void removeFile(long fileID,
                       long parentID)
                throws SourceJammerConnectionException,
                       GUICommandException

viewRemoved

public RemovedItem[] viewRemoved(long projectID)
                          throws SourceJammerConnectionException,
                                 GUICommandException

restoreRemoved

public void restoreRemoved(long parentID,
                           int iItemNumber,
                           java.lang.String newName)

deleteRemoved

public void deleteRemoved(long lParentID,
                          int iItemNumber)
                   throws SourceJammerConnectionException,
                          GUICommandException

makeUser

public void makeUser(java.lang.String sUserName,
                     java.lang.String sPassword,
                     java.lang.String sFullName)
              throws GUICommandException,
                     SourceJammerConnectionException

removeUser

public void removeUser(java.lang.String sUserName)
                throws GUICommandException,
                       SourceJammerConnectionException

changePassword

public void changePassword(java.lang.String sPassword)
                    throws SourceJammerConnectionException,
                           GUICommandException

changePassword

public void changePassword(java.lang.String sPassword,
                           java.lang.String userName)
                    throws SourceJammerConnectionException,
                           GUICommandException

makeArchive

public void makeArchive(java.lang.String name,
                        int implementation,
                        java.lang.String path)
                 throws SourceJammerConnectionException,
                        GUICommandException

makeArchiveDisconnected

public void makeArchiveDisconnected(java.lang.String userName,
                                    java.lang.String password,
                                    java.lang.String url,
                                    java.lang.String name,
                                    int implementation,
                                    java.lang.String path)
                             throws SourceJammerConnectionException,
                                    GUICommandException,
                                    java.net.MalformedURLException,
                                    NoSessionException

getLabelList

public NodeList getLabelList()
                      throws SourceJammerConnectionException,
                             GUICommandException,
                             NodeExistsException

makeLabel

public void makeLabel(long labelRootProjectID,
                      java.lang.String labelName,
                      java.lang.String description)
               throws SourceJammerConnectionException,
                      GUICommandException

moveFile

public void moveFile(long fileID,
                     long fromProjectID,
                     long toProjectID)
              throws SourceJammerConnectionException,
                     GUICommandException

copyFile

public void copyFile(long fileID,
                     long fromProjectID,
                     long toProjectID)
              throws SourceJammerConnectionException,
                     GUICommandException

copyProject

public void copyProject(long projectID,
                        long fromProjectID,
                        long toProjectID,
                        java.lang.String newProjectName)
                 throws SourceJammerConnectionException,
                        GUICommandException

moveProject

public void moveProject(long projectID,
                        long fromProjectID,
                        long toProjectID,
                        java.lang.String newProjectName)
                 throws SourceJammerConnectionException,
                        GUICommandException

rebuildLabel

public void rebuildLabel(long labelId,
                         long parentProjectID,
                         java.lang.String comment)
                  throws SourceJammerConnectionException,
                         GUICommandException,
                         java.io.IOException
Rebuild the specified label.

getLabel

public void getLabel(long labelID,
                     int verNumber,
                     java.io.File flToDirectory,
                     boolean bBuildSubDirs,
                     int eolType,
                     boolean setReadOnly)
              throws SourceJammerConnectionException,
                     GUICommandException,
                     java.io.IOException
Gets all of the file version in the specified label from the server and writes them to the specified directory (building subdirectories if required and allowed).

getCompleteUserList

public UserInfo[] getCompleteUserList()
                               throws SourceJammerConnectionException,
                                      GUICommandException

getArchiveProperties

public ArchiveProperties getArchiveProperties()
                                       throws GUICommandException,
                                              SourceJammerConnectionException

setArchiveProperties

public void setArchiveProperties(ArchiveProperties props)
                          throws GUICommandException,
                                 SourceJammerConnectionException

getArchiveControllerList

public UserInfo[] getArchiveControllerList()
                                    throws SourceJammerConnectionException,
                                           GUICommandException

getArchiveUserList

public UserInfo[] getArchiveUserList()
                              throws SourceJammerConnectionException,
                                     GUICommandException

getCurrentUserName

public java.lang.String getCurrentUserName()

setUserAdminStatus

public void setUserAdminStatus(java.lang.String userName,
                               boolean status)
                        throws SourceJammerConnectionException,
                               GUICommandException

addUserToArchiveControllers

public void addUserToArchiveControllers(java.lang.String userName)
                                 throws SourceJammerConnectionException,
                                        GUICommandException

addUserToArchiveUsers

public void addUserToArchiveUsers(java.lang.String userName)
                           throws SourceJammerConnectionException,
                                  GUICommandException

removeUserFromArchiveControllers

public void removeUserFromArchiveControllers(java.lang.String userName)
                                      throws SourceJammerConnectionException,
                                             GUICommandException

removeUserFromArchiveUsers

public void removeUserFromArchiveUsers(java.lang.String userName)
                                throws SourceJammerConnectionException,
                                       GUICommandException

rollbackToVersion

public void rollbackToVersion(long fileID,
                              long versionID)
                       throws SourceJammerConnectionException,
                              GUICommandException
Rolls back a file in the SourceJammer server to the specified previous version of the file.

isConnected

public boolean isConnected()

getRootAppFrame

public SJPrimaryWindow getRootAppFrame()

getProjectTree

public javax.swing.JTree getProjectTree()

getPrimaryTable

public javax.swing.JTable getPrimaryTable()

displayErrorMessage

public void displayErrorMessage(java.lang.String s,
                                boolean eventThread)

displayErrorMessage

public void displayErrorMessage(java.lang.String[] s,
                                boolean eventThread)

displayErrorMessage

public void displayErrorMessage(java.lang.String[] s)

displayErrorMessage

public void displayErrorMessage(java.lang.String s)

selectProject

public void selectProject(ProjectTreeNode nd)
Select the specified project in the project tree.

zipByteArrayIfNeeded

protected byte[] zipByteArrayIfNeeded(byte[] file,
                                      SJRequest request,
                                      java.lang.String fileName)
                               throws java.io.IOException
Checks if a byte array about to be sent is larger than the minimum unzipped file size. If so, zips the file and sets the flag in the SJRequest.

getChecker

public SourceVersionChecker getChecker(java.io.File flDirectory)
                                throws java.io.IOException

retrieveFileFromServer

protected long retrieveFileFromServer(DownloadFileIdentifier id,
                                      SJResponse response)
                               throws java.io.IOException,
                                      SourceJammerConnectionException
Returns temp file id.

sendFileToServer

protected long sendFileToServer(java.io.File fl,
                                SJRequest request)
                         throws java.io.IOException,
                                SourceJammerConnectionException

SourceJammer 1.3.0 November 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan