org.sourcejammer.client.simpletools
Class SimpleInterface

java.lang.Object
  |
  +--org.sourcejammer.client.simpletools.SimpleInterface

public class SimpleInterface
extends java.lang.Object

Title: $FileName: SimpleInterface.java$

Version:
$VerNum: 12$
$Description: $
$KeyWordsOff: $

This singleton class provides a simplified interface into the SourceJammer client functionality for the purpose of building plugins to integrate SourceJammer into 3rd party development tools such as JBuilder and Eclipse.

To use this class, get the singleton instance, call the setConfDirectory() method to set the configuration, call the connect() method to connect to an archive, and then call the provided methods as needed.
Author:
$AuthorName: Rob MacGrogan$

Field Summary
private static SimpleInterface instance
           
 
Constructor Summary
private SimpleInterface()
           
 
Method Summary
 void addFile(long projectID, java.lang.String fileName, java.io.File localPath, int historyType, int fileType, java.lang.String description)
          Add specified file to specified project in SourceJammer archive.
 void addFile(long projectID, java.lang.String fileName, java.io.File localPath, int historyType, int fileType, java.lang.String description, java.lang.String afterAddAction)
          Add specified file to specified project in SourceJammer archive.
 void addFile(long projectID, java.lang.String fileName, java.io.File localPath, java.lang.String description)
          Add specified file to specified project in SourceJammer archive.
 void addFile(long projectID, java.lang.String fileName, java.io.File localPath, java.lang.String description, java.lang.String afterAddAction)
          Add specified file to specified project in SourceJammer archive.
 void addProject(long parentProjectID, java.lang.String projectName)
          Add a new project to the archive.
 void checkInFile(long fileID, java.lang.String fileName, java.io.File targetDir, java.lang.String comment)
          Check in the file.
 void checkInFile(long fileID, java.lang.String fileName, java.io.File targetDir, java.lang.String comment, java.lang.String afterCheckInAction)
          Check in the file.
 void checkOutFile(long fileID, java.lang.String fileName, java.io.File targetDir, int eolType)
          Check out the file.
 void checkOutFileToStream(long fileID, int eolType, java.io.OutputStream stmOut)
          Check out the file and stream file to the passed in OutputStream.
 org.sourcejammer.project.view.Project connect(java.lang.String archiveName, java.lang.String url, java.lang.String userName, java.lang.String password)
          Connects the SimpleInterface to the specified archive.
 void copyFile(long fileID, long fromProjectID, long toProjectID)
          Copy a file from one project to another within the SourceJammer archive.
 void copyProject(long projectID, long toProjectID, java.lang.String newProjectName)
          Copy a project and all of its contents to a new location within a SourceJammer archive.
 void disconnect()
          Disconnect.
 void getFile(long fileID, java.lang.String fileName, java.io.File targetDir, int eolType, boolean printMessages, boolean setReadOnly)
          Get the file to the specified target directory without checking it out.
 org.sourcejammer.project.view.File getFileObj(long fileID)
          Get File object for the specified file.
 void getFileToStream(long fileID, int eolType, java.io.OutputStream stmOut)
          Streams the requested file into the passed in OutputStream.
 long getFileUniqueID(java.lang.String sjPath)
          Returns unique id of File based on full sourcejammer path.
 GuiConf getGuiConf()
          Return GuiConf object for current archive/user.
static SimpleInterface getInstance()
          Returns the singleton instance.
 void getLabel(long labelID, java.io.File targetDir)
          Gets the specified label to the content directory.
 void getLabel(long labelID, int verNumber, java.io.File targetDir, boolean buildSubDirs, int eolType)
          Gets the specified label to the content directory.
 void getLabel(long labelID, int verNumber, java.io.File targetDir, boolean buildSubDirs, int eolType, boolean setReadOnly)
           
 void getProject(java.io.File targetDir, org.sourcejammer.project.view.Project proj, boolean bRecursive, boolean bBuildSubDirs, int iEOLType, boolean makeReadOnly, boolean verifyCheckIn)
          Retrieves all files in the specified Project to the specified targetDirectory.
 org.sourcejammer.project.view.Project getProjectObj(long projectID)
          Returns the Project object for the specified project.
 long getProjectUniqueID(java.lang.String sjPath)
          Returns unique id of Project based on full sourcejammer path.
private  boolean isDefaultReadOnlyOnGet()
           
 void moveFile(long fileID, long fromProjectID, long toProjectID)
          Move a file from one project to another within the SourceJammer archive.
 void moveProject(long projectID, long toProjectID, java.lang.String newProjectName)
          Move a project and all of its contents to a new location within a SourceJammer archive.
 void setConfDirectory(java.io.File confDir)
          Sets the configuration directory.
 void setConfDirectory(java.lang.String confDir)
          Sets the configuration directory.
 void setOut(java.io.PrintStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static SimpleInterface instance
Constructor Detail

SimpleInterface

private SimpleInterface()
Method Detail

getInstance

public static SimpleInterface getInstance()
Returns the singleton instance.


setConfDirectory

public void setConfDirectory(java.io.File confDir)
                      throws java.io.IOException
Sets the configuration directory. Should be the directory that contains the conf.xml and other sourcejammer configuration files. This method must be called before any of the other methods of this class can be used.

java.io.IOException

setConfDirectory

public void setConfDirectory(java.lang.String confDir)
                      throws java.io.IOException
Sets the configuration directory. Should be the directory that contains the conf.xml and other sourcejammer configuration files. This method must be called before any of the other methods of this class can be used.

java.io.IOException

connect

public org.sourcejammer.project.view.Project connect(java.lang.String archiveName,
                                                     java.lang.String url,
                                                     java.lang.String userName,
                                                     java.lang.String password)
                                              throws java.net.MalformedURLException,
                                                     java.io.IOException,
                                                     org.sourcejammer.util.SourceJammerConnectionException,
                                                     GUICommandException,
                                                     NoSessionException
Connects the SimpleInterface to the specified archive. Returns the root project for the archive.

Parameters:
archiveName - -- Name of archive to connect to.
url - -- URL of SourceJammer server.
userName - -- name of user to use when connecting.
password - -- user's password.
java.net.MalformedURLException
java.io.IOException
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
NoSessionException

getProjectObj

public org.sourcejammer.project.view.Project getProjectObj(long projectID)
                                                    throws org.sourcejammer.util.SourceJammerConnectionException,
                                                           GUICommandException
Returns the Project object for the specified project.

org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

getFileObj

public org.sourcejammer.project.view.File getFileObj(long fileID)
                                              throws org.sourcejammer.util.SourceJammerConnectionException,
                                                     GUICommandException
Get File object for the specified file.

org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

checkInFile

public void checkInFile(long fileID,
                        java.lang.String fileName,
                        java.io.File targetDir,
                        java.lang.String comment)
                 throws java.io.IOException,
                        org.sourcejammer.util.SourceJammerConnectionException,
                        GUICommandException
Check in the file. Uses default after checkin action from SourceJammerClient (clientconf.xml).

java.io.IOException
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

checkInFile

public void checkInFile(long fileID,
                        java.lang.String fileName,
                        java.io.File targetDir,
                        java.lang.String comment,
                        java.lang.String afterCheckInAction)
                 throws java.io.IOException,
                        org.sourcejammer.util.SourceJammerConnectionException,
                        GUICommandException
Check in the file. afterCheckInAction specifies action to perform on local copy of file after it is checked in. Possible options are the same as after add action options on addFile().

java.io.IOException
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

getFile

public void getFile(long fileID,
                    java.lang.String fileName,
                    java.io.File targetDir,
                    int eolType,
                    boolean printMessages,
                    boolean setReadOnly)
             throws java.io.IOException,
                    org.sourcejammer.util.SourceJammerConnectionException,
                    GUICommandException
Get the file to the specified target directory without checking it out.

Parameters:
fileID - -- unique id of the file.
fileName - -- name of the file (File.java, for example).
targetDir - -- directory whe the file will be "got" to.
eolType - -- the eol type to apply to all text files. This value must be in AppConfig.EndOfLineType.
setReadOnly - -- if true, file will be set to read-only after it's been downloaded.
java.io.IOException
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

getFileToStream

public void getFileToStream(long fileID,
                            int eolType,
                            java.io.OutputStream stmOut)
                     throws GUICommandException,
                            java.io.IOException,
                            org.sourcejammer.util.SourceJammerConnectionException
Streams the requested file into the passed in OutputStream.

Parameters:
fileID - -- unique id of the file.
eolType - -- the eol type to apply to all text files. This value must be in AppConfig.EndOfLineType.
stmOut - -- an OutputStream to receive the file.
GUICommandException
java.io.IOException
org.sourcejammer.util.SourceJammerConnectionException

checkOutFile

public void checkOutFile(long fileID,
                         java.lang.String fileName,
                         java.io.File targetDir,
                         int eolType)
                  throws org.sourcejammer.util.SourceJammerConnectionException,
                         GUICommandException,
                         java.io.IOException
Check out the file.

Parameters:
fileID - -- unique id of the file.
fileName - -- name of the file (File.java, for example).
targetDir - -- directory whe the file will be "got" to.
eolType - -- the eol type to apply to all text files. This value must be in AppConfig.EndOfLineType.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

checkOutFileToStream

public void checkOutFileToStream(long fileID,
                                 int eolType,
                                 java.io.OutputStream stmOut)
                          throws org.sourcejammer.util.SourceJammerConnectionException,
                                 GUICommandException,
                                 java.io.IOException
Check out the file and stream file to the passed in OutputStream.

Parameters:
fileID - -- unique id of the file.
eolType - -- the eol type to apply to all text files. This value must be in AppConfig.EndOfLineType.
stmOut - -- an OutputStream to receive the file.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

addFile

public void addFile(long projectID,
                    java.lang.String fileName,
                    java.io.File localPath,
                    int historyType,
                    int fileType,
                    java.lang.String description)
             throws org.sourcejammer.util.SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException
Add specified file to specified project in SourceJammer archive.

Parameters:
projectID - -- id of parent project for file being added.
fileName - -- full name of file.
localPath - -- java.io.File object pointing file to be added.
historyType - -- History type. Must be a value in AppConfig.FileHistoryStorageTypes.
fileType - -- File type. Must be a value in AppConfig.FileTypes, but not LABEL.
description - -- a description of the file.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

addFile

public void addFile(long projectID,
                    java.lang.String fileName,
                    java.io.File localPath,
                    int historyType,
                    int fileType,
                    java.lang.String description,
                    java.lang.String afterAddAction)
             throws org.sourcejammer.util.SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException
Add specified file to specified project in SourceJammer archive.

Parameters:
projectID - -- id of parent project for file being added.
fileName - -- full name of file.
localPath - -- java.io.File object pointing file to be added.
historyType - -- History type. Must be a value in AppConfig.FileHistoryStorageTypes.
fileType - -- File type. Must be a value in AppConfig.FileTypes, but not LABEL.
description - -- a description of the file.
afterAddAction - -- Action to take on local file after it has been added. Choices are in SourceJammerClient--lfa_DELETE, lfa_NO_SPECIAL_ACTION, and lfa_SET_READ_ONLY.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

moveFile

public void moveFile(long fileID,
                     long fromProjectID,
                     long toProjectID)
              throws org.sourcejammer.util.SourceJammerConnectionException,
                     GUICommandException
Move a file from one project to another within the SourceJammer archive.

Parameters:
fileID - -- unique ID of the file to be moved.
fromProjectID - -- unique ID of current parent project of file to be moved.
toProjectID - -- uniquie ID of new parent project of file to be moved.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

copyFile

public void copyFile(long fileID,
                     long fromProjectID,
                     long toProjectID)
              throws org.sourcejammer.util.SourceJammerConnectionException,
                     GUICommandException
Copy a file from one project to another within the SourceJammer archive.

Parameters:
fileID - -- unique ID of the file to be copied.
fromProjectID - -- unique ID of current parent project of file to be copied.
toProjectID - -- uniquie ID of new parent project of file to be copied.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

copyProject

public void copyProject(long projectID,
                        long toProjectID,
                        java.lang.String newProjectName)
                 throws org.sourcejammer.util.SourceJammerConnectionException,
                        GUICommandException
Copy a project and all of its contents to a new location within a SourceJammer archive. All files within new project will start over with no history. Existing project will not be changed.

Parameters:
projectID - -- unique id of project to be copied.
toProjectID - -- unique id of new parent project of project to be copied.
newProjectName - -- new name to use for new project that is created by this copy action. If null, current name of project to be copied will be used.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

moveProject

public void moveProject(long projectID,
                        long toProjectID,
                        java.lang.String newProjectName)
                 throws org.sourcejammer.util.SourceJammerConnectionException,
                        GUICommandException
Move a project and all of its contents to a new location within a SourceJammer archive. All files will maintain their exact same history once move operation is complete.

Parameters:
projectID - -- unique id of project to be moved.
toProjectID - -- unique id of new parent project of project to be moved.
newProjectName - -- new name to use for new project that is created by this move action. If null, current name of project to be moved will be used.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

addFile

public void addFile(long projectID,
                    java.lang.String fileName,
                    java.io.File localPath,
                    java.lang.String description)
             throws org.sourcejammer.util.SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException
Add specified file to specified project in SourceJammer archive. File type and history type will be set automatically using HistoryTypeMapper.

Parameters:
projectID - -- id of parent project for file being added.
fileName - -- full name of file.
localPath - -- java.io.File object pointing file to be added.
description - -- a description of the file.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

addFile

public void addFile(long projectID,
                    java.lang.String fileName,
                    java.io.File localPath,
                    java.lang.String description,
                    java.lang.String afterAddAction)
             throws org.sourcejammer.util.SourceJammerConnectionException,
                    GUICommandException,
                    java.io.IOException
Add specified file to specified project in SourceJammer archive. File type and history type will be set automatically using HistoryTypeMapper.

Parameters:
projectID - -- id of parent project for file being added.
fileName - -- full name of file.
localPath - -- java.io.File object pointing file to be added.
description - -- a description of the file.
afterAddAction - -- Action to take on local file after it has been added. Choices are in SourceJammerClient--lfa_DELETE, lfa_NO_SPECIAL_ACTION, and lfa_SET_READ_ONLY.
org.sourcejammer.util.SourceJammerConnectionException
GUICommandException
java.io.IOException

addProject

public void addProject(long parentProjectID,
                       java.lang.String projectName)
                throws org.sourcejammer.util.SourceJammerConnectionException,
                       GUICommandException
Add a new project to the archive.

org.sourcejammer.util.SourceJammerConnectionException
GUICommandException

getLabel

public void getLabel(long labelID,
                     int verNumber,
                     java.io.File targetDir,
                     boolean buildSubDirs,
                     int eolType)
              throws GUICommandException,
                     org.sourcejammer.util.SourceJammerConnectionException,
                     java.io.IOException
Gets the specified label to the content directory.

Parameters:
labelID - -- id of the label.
verNumber - -- version number of the label that you want to get. Use -1 to use the latest version of the label.
targetDir - -- directory where the files will be downloaded to.
eolType - -- the eol type to apply to all text files. This value must be in AppConfig.EndOfLineType.
GUICommandException
org.sourcejammer.util.SourceJammerConnectionException
java.io.IOException

isDefaultReadOnlyOnGet

private boolean isDefaultReadOnlyOnGet()

getLabel

public void getLabel(long labelID,
                     int verNumber,
                     java.io.File targetDir,
                     boolean buildSubDirs,
                     int eolType,
                     boolean setReadOnly)
              throws GUICommandException,
                     org.sourcejammer.util.SourceJammerConnectionException,
                     java.io.IOException
GUICommandException
org.sourcejammer.util.SourceJammerConnectionException
java.io.IOException

getLabel

public void getLabel(long labelID,
                     java.io.File targetDir)
              throws GUICommandException,
                     org.sourcejammer.util.SourceJammerConnectionException,
                     java.io.IOException
Gets the specified label to the content directory. All required subdirectories will be created if they do not already exist. All text files will be returned with the default EOL type specified in the clientconf.xml file. The latest version of the label will be used.

GUICommandException
org.sourcejammer.util.SourceJammerConnectionException
java.io.IOException

getFileUniqueID

public long getFileUniqueID(java.lang.String sjPath)
                     throws GUICommandException,
                            org.sourcejammer.util.SourceJammerConnectionException
Returns unique id of File based on full sourcejammer path.

GUICommandException
org.sourcejammer.util.SourceJammerConnectionException

getProjectUniqueID

public long getProjectUniqueID(java.lang.String sjPath)
                        throws GUICommandException,
                               org.sourcejammer.util.SourceJammerConnectionException
Returns unique id of Project based on full sourcejammer path.

GUICommandException
org.sourcejammer.util.SourceJammerConnectionException

disconnect

public void disconnect()
                throws GUICommandException,
                       org.sourcejammer.util.SourceJammerConnectionException
Disconnect.

GUICommandException
org.sourcejammer.util.SourceJammerConnectionException

setOut

public void setOut(java.io.PrintStream out)

getProject

public void getProject(java.io.File targetDir,
                       org.sourcejammer.project.view.Project proj,
                       boolean bRecursive,
                       boolean bBuildSubDirs,
                       int iEOLType,
                       boolean makeReadOnly,
                       boolean verifyCheckIn)
                throws GUICommandException,
                       org.sourcejammer.util.SourceJammerConnectionException,
                       java.io.IOException
Retrieves all files in the specified Project to the specified targetDirectory.

GUICommandException
org.sourcejammer.util.SourceJammerConnectionException
java.io.IOException

getGuiConf

public GuiConf getGuiConf()
Return GuiConf object for current archive/user. GuiConf is used to obtain the user's default directory for each project in the archive.



Copyright © 2003 Soucejammer project.