com.jbase.jbuilder5vcs
Class P4Cmd

java.lang.Object
  |
  +--com.jbase.jbuilder5vcs.P4Cmd

public class P4Cmd
extends java.lang.Object

Title: JBuilder/Perforce Description: call command of P4.

command supported:
- sync
- edit
- submit
- revert
- client
- add
- have
- change
This class has a field variable with a p4ClientSpec. It's for
save on cash the definition of the P4 Client.
Company:
jBase.

Since:
JDK 1.3
Version:
1.0
Author:
Nicolas Jorand

Field Summary
static P4ClientSpec _mySpec
           
static java.lang.String CMD_ADD
           
static java.lang.String CMD_CHANGE
           
static java.lang.String CMD_CLIENT
           
static java.lang.String CMD_CLIENT_OPTION
           
static java.lang.String CMD_CONSOLE_INPUT
           
static java.lang.String CMD_CONSOLE_MODE
           
static java.lang.String CMD_EDIT
           
static java.lang.String CMD_FILE_TYPE
           
static java.lang.String CMD_FILE_TYPE_TEXT
           
static java.lang.String CMD_HAVE
           
static java.lang.String CMD_HOST_OPTION
           
static java.lang.String CMD_P4
           
static java.lang.String CMD_PASSWORD
           
static java.lang.String CMD_PORT_OPTION
           
static java.lang.String CMD_REVERT
           
static java.lang.String CMD_SUBMIT
           
static java.lang.String CMD_SYNC
           
static java.lang.String CMD_USER
           
static java.lang.String MSG_COMMIT
           
static java.lang.String MSG_COMMITTED
           
static java.lang.String MSG_CONNECT_IMPOSSIBLE
           
static java.lang.String MSG_CONNECT_TITLE
           
static java.lang.String MSG_ENTER_COMMENT
           
static java.lang.String MSG_IS_UPTODATE
           
static java.lang.String MSG_NO_ITEMS
           
static java.lang.String MSG_NO_SUBMITTED
           
static java.lang.String MSG_P4_ADD_TITLE
           
static java.lang.String MSG_P4_COMMIT_TITLE
           
static java.lang.String MSG_P4_EDIT_TITLE
           
static java.lang.String MSG_P4_FILE_NOT_ON_CLIENT
           
static java.lang.String MSG_P4_FILE_REVERTED
           
static java.lang.String MSG_P4_FILE_REVERTED_AFTER_ADD
           
static java.lang.String MSG_P4_NO_CONNECTION
           
static java.lang.String MSG_P4_OPEN_FOR_ADD
           
static java.lang.String MSG_P4_OPEN_FOR_EDIT
           
static java.lang.String MSG_P4_REVERT_TITLE
           
static java.lang.String MSG_P4_SUBMIT_TITLE
           
static java.lang.String MSG_P4_SUBMITTED
           
static java.lang.String MSG_P4_SYNCHRO_TITLE
           
static java.lang.String MSG_P4_UPDATING
           
static java.lang.String MSG_P4_UPTODATE
           
static java.lang.String MSG_P4_WAS_ADD
           
static java.lang.String MSG_SUCCESSFULL
           
static java.lang.String MSG_UNSUCCESSFULL
           
 
Constructor Summary
P4Cmd()
           
 
Method Summary
 java.lang.String add(com.borland.primetime.node.Node[] nodeList)
          Add file(s) to P4 and update the lists file on the P4ClientSpec
 java.lang.String add(com.borland.primetime.node.Node[] nodeList, java.util.Set fileList, com.borland.primetime.node.Project prj)
          Add file(s) to P4 and update the lists file on the P4ClientSpec
 java.lang.String add(java.util.Set fileList, com.borland.primetime.node.Project prj)
          Add file(s) to P4 and update the lists file on the P4ClientSpec
 java.lang.String commit(java.util.Set fileList, com.borland.primetime.util.runner.OutputRunnerListener oOutrunner, com.borland.primetime.node.Project prj)
          For submit all modifications selected on the status window to P4.
 boolean connect()
          Try to connect with P4, for this make a refresh
 java.lang.String edit(com.borland.primetime.node.Node[] nodeList)
          For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
 java.lang.String edit(com.borland.primetime.node.Node[] nodeList, java.util.Set fileList, com.borland.primetime.node.Project prj)
          For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
 java.lang.String edit(java.util.Set fileList, com.borland.primetime.node.Project prj)
          For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
 java.util.Map getStatus(com.borland.primetime.node.Project project)
          Get the status from the current description
 boolean isConnected()
          Check on a attribute of the P4ClientSpec, if it's null, the connection
is down
 boolean isOnVCS(com.borland.primetime.vfs.Url url, com.borland.primetime.node.Project project, int nDepotPending)
          Test if the file pass on parameter is under P4.
 void refresh()
          Refresch the class, get the description from P4
 java.lang.String revert(com.borland.primetime.node.Node[] nodeList)
          Undo the modifications and update the lists file on the P4ClientSpec
 java.lang.String revert(com.borland.primetime.node.Node[] nodeList, java.util.Set fileList, com.borland.primetime.node.Project prj)
          Undo the modifications and update the lists file on the P4ClientSpec
 java.lang.String revert(java.util.Set fileList, com.borland.primetime.node.Project prj)
          Undo the modifications and update the lists file on the P4ClientSpec
 java.lang.String submit(com.borland.primetime.node.Node[] nodeList, java.lang.String sDescription)
          For submit all modifications to P4 and update the lists file on the P4ClientSpec Warning: If another user had modified and submit the files, you must launch P4 for merge the files.
 java.lang.String sync(com.borland.primetime.node.Node[] nodeList)
          For synchronize file(s) with P4,
 java.lang.String sync(com.borland.primetime.node.Node[] nodeList, java.util.Set fileList, com.borland.primetime.node.Project prj)
          For synchronize file(s) with P4,
 java.lang.String sync(java.util.Set fileList, com.borland.primetime.node.Project prj)
          For synchronize file(s) with P4,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMD_P4

public static final java.lang.String CMD_P4

CMD_SYNC

public static final java.lang.String CMD_SYNC

CMD_EDIT

public static final java.lang.String CMD_EDIT

CMD_SUBMIT

public static final java.lang.String CMD_SUBMIT

CMD_REVERT

public static final java.lang.String CMD_REVERT

CMD_CLIENT

public static final java.lang.String CMD_CLIENT

CMD_ADD

public static final java.lang.String CMD_ADD

CMD_HAVE

public static final java.lang.String CMD_HAVE

CMD_CHANGE

public static final java.lang.String CMD_CHANGE

CMD_PASSWORD

public static final java.lang.String CMD_PASSWORD

CMD_USER

public static final java.lang.String CMD_USER

CMD_CLIENT_OPTION

public static final java.lang.String CMD_CLIENT_OPTION

CMD_CONSOLE_MODE

public static final java.lang.String CMD_CONSOLE_MODE

CMD_CONSOLE_INPUT

public static final java.lang.String CMD_CONSOLE_INPUT

CMD_FILE_TYPE

public static final java.lang.String CMD_FILE_TYPE

CMD_HOST_OPTION

public static final java.lang.String CMD_HOST_OPTION

CMD_PORT_OPTION

public static final java.lang.String CMD_PORT_OPTION

CMD_FILE_TYPE_TEXT

public static final java.lang.String CMD_FILE_TYPE_TEXT

MSG_CONNECT_IMPOSSIBLE

public static final java.lang.String MSG_CONNECT_IMPOSSIBLE

MSG_CONNECT_TITLE

public static final java.lang.String MSG_CONNECT_TITLE

MSG_NO_ITEMS

public static final java.lang.String MSG_NO_ITEMS

MSG_P4_SYNCHRO_TITLE

public static final java.lang.String MSG_P4_SYNCHRO_TITLE

MSG_P4_ADD_TITLE

public static final java.lang.String MSG_P4_ADD_TITLE

MSG_P4_REVERT_TITLE

public static final java.lang.String MSG_P4_REVERT_TITLE

MSG_P4_SUBMIT_TITLE

public static final java.lang.String MSG_P4_SUBMIT_TITLE

MSG_P4_EDIT_TITLE

public static final java.lang.String MSG_P4_EDIT_TITLE

MSG_P4_COMMIT_TITLE

public static final java.lang.String MSG_P4_COMMIT_TITLE

MSG_IS_UPTODATE

public static final java.lang.String MSG_IS_UPTODATE

MSG_SUCCESSFULL

public static final java.lang.String MSG_SUCCESSFULL

MSG_UNSUCCESSFULL

public static final java.lang.String MSG_UNSUCCESSFULL

MSG_ENTER_COMMENT

public static final java.lang.String MSG_ENTER_COMMENT

MSG_NO_SUBMITTED

public static final java.lang.String MSG_NO_SUBMITTED

MSG_COMMIT

public static final java.lang.String MSG_COMMIT

MSG_COMMITTED

public static final java.lang.String MSG_COMMITTED

MSG_P4_UPTODATE

public static final java.lang.String MSG_P4_UPTODATE

MSG_P4_UPDATING

public static final java.lang.String MSG_P4_UPDATING

MSG_P4_FILE_NOT_ON_CLIENT

public static final java.lang.String MSG_P4_FILE_NOT_ON_CLIENT

MSG_P4_OPEN_FOR_ADD

public static final java.lang.String MSG_P4_OPEN_FOR_ADD

MSG_P4_WAS_ADD

public static final java.lang.String MSG_P4_WAS_ADD

MSG_P4_OPEN_FOR_EDIT

public static final java.lang.String MSG_P4_OPEN_FOR_EDIT

MSG_P4_SUBMITTED

public static final java.lang.String MSG_P4_SUBMITTED

MSG_P4_NO_CONNECTION

public static final java.lang.String MSG_P4_NO_CONNECTION

MSG_P4_FILE_REVERTED

public static final java.lang.String MSG_P4_FILE_REVERTED

MSG_P4_FILE_REVERTED_AFTER_ADD

public static final java.lang.String MSG_P4_FILE_REVERTED_AFTER_ADD

_mySpec

public static P4ClientSpec _mySpec
Constructor Detail

P4Cmd

public P4Cmd()
Method Detail

sync

public java.lang.String sync(com.borland.primetime.node.Node[] nodeList)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For synchronize file(s) with P4,

First, get description of the P4 client for get the root path and the name of the depot

Second, Check the connection with p4 by read the description value.

Third, create the list of file to synchronize.

Fourth, create the command line for P4 by adding user, password, List of file and send to p4 Last, update the lists file on the P4ClientSpec

Parameters:
nodeList - List of file must be synchronize
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

sync

public java.lang.String sync(java.util.Set fileList,
                             com.borland.primetime.node.Project prj)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For synchronize file(s) with P4,

First, get description of the P4 client for get the root path and the name of the depot

Second, Check the connection with p4 by read the description value.

Third, create the list of file to synchronize.

Fourth, create the command line for P4 by adding user, password, List of file and send to p4 Last, update the lists file on the P4ClientSpec

Parameters:
fileList - List of file must be synchronize
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

sync

public java.lang.String sync(com.borland.primetime.node.Node[] nodeList,
                             java.util.Set fileList,
                             com.borland.primetime.node.Project prj)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For synchronize file(s) with P4,

First, get description of the P4 client for get the root path and the name of the depot

Second, Check the connection with p4 by read the description value.

Third, create the list of file to synchronize.

Fourth, create the command line for P4 by adding user, password, List of file and send to p4 Last, update the lists file on the P4ClientSpec

Parameters:
nodeList - List of file must be synchronize
fileList - List of file must be synchronize(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

edit

public java.lang.String edit(com.borland.primetime.node.Node[] nodeList)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be edited
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

edit

public java.lang.String edit(java.util.Set fileList,
                             com.borland.primetime.node.Project prj)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
Parameters:
fileList - List of file must be edited
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

edit

public java.lang.String edit(com.borland.primetime.node.Node[] nodeList,
                             java.util.Set fileList,
                             com.borland.primetime.node.Project prj)
                      throws P4ErrorApplication,
                             P4ErrorConnection
For "check-out" file(s) from P4 and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be edited
fileList - List of file must be edited(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

submit

public java.lang.String submit(com.borland.primetime.node.Node[] nodeList,
                               java.lang.String sDescription)
                        throws P4ErrorApplication,
                               P4ErrorConnection
For submit all modifications to P4 and update the lists file on the P4ClientSpec Warning: If another user had modified and submit the files, you must launch P4 for merge the files. A Information box will throw to the user!!!
Parameters:
nodeList - List of file must be submit
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

commit

public java.lang.String commit(java.util.Set fileList,
                               com.borland.primetime.util.runner.OutputRunnerListener oOutrunner,
                               com.borland.primetime.node.Project prj)
                        throws P4ErrorApplication,
                               P4ErrorConnection
For submit all modifications selected on the status window to P4. I separate the submit
and the commit methode, because, the first think was to change the icon directly on the jBuilder
project tree, but I don't found how change dynamically. At the moment I use the VCSCommitBrowser Warning: If another user had modified and submit the files, you must launch P4 for merge the files. A Information box will throw to the user!!!
Parameters:
nodeList - List of file must be submit
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

revert

public java.lang.String revert(com.borland.primetime.node.Node[] nodeList)
                        throws P4ErrorApplication,
                               P4ErrorConnection
Undo the modifications and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be reverted
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

revert

public java.lang.String revert(java.util.Set fileList,
                               com.borland.primetime.node.Project prj)
                        throws P4ErrorApplication,
                               P4ErrorConnection
Undo the modifications and update the lists file on the P4ClientSpec
Parameters:
fileList - List of file must be reverted(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

revert

public java.lang.String revert(com.borland.primetime.node.Node[] nodeList,
                               java.util.Set fileList,
                               com.borland.primetime.node.Project prj)
                        throws P4ErrorApplication,
                               P4ErrorConnection
Undo the modifications and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be reverted
fileList - List of file must be reverted(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

add

public java.lang.String add(com.borland.primetime.node.Node[] nodeList)
                     throws P4ErrorApplication,
                            P4ErrorConnection
Add file(s) to P4 and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be added
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

add

public java.lang.String add(java.util.Set fileList,
                            com.borland.primetime.node.Project prj)
                     throws P4ErrorApplication,
                            P4ErrorConnection
Add file(s) to P4 and update the lists file on the P4ClientSpec
Parameters:
fileList - List of file must be added(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

add

public java.lang.String add(com.borland.primetime.node.Node[] nodeList,
                            java.util.Set fileList,
                            com.borland.primetime.node.Project prj)
                     throws P4ErrorApplication,
                            P4ErrorConnection
Add file(s) to P4 and update the lists file on the P4ClientSpec
Parameters:
nodeList - List of file must be added(if come form the commit browser)
fileList - List of file must be added(if come form the commit browser)
prj - The active project for get P4 information (eg: User,...)
Returns:
String The successfull response from P4
Throws:
P4ErrorApplication - Applicative error from P4
P4ErrorConnection - Connection to P4 defect

isOnVCS

public boolean isOnVCS(com.borland.primetime.vfs.Url url,
                       com.borland.primetime.node.Project project,
                       int nDepotPending)
Test if the file pass on parameter is under P4.

Return true if it's


connect

public boolean connect()
                throws P4ErrorConnection
Try to connect with P4, for this make a refresh
Returns:
boolean, true if connect sucessfull.

refresh

public void refresh()
Refresch the class, get the description from P4

getStatus

public java.util.Map getStatus(com.borland.primetime.node.Project project)
Get the status from the current description

isConnected

public boolean isConnected()
Check on a attribute of the P4ClientSpec, if it's null, the connection
is down