|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.impl.mapbased.rpc.func.client.ClientSystemFileCommands
public class ClientSystemFileCommands
Implements the simpler lower-level file commands that typically correspond to system commands such as chmod, delete, etc.
Field Summary | |
---|---|
static String |
DEFAULT_TMPFILE_PFX
|
static String |
DEFAULT_TMPFILE_SFX
|
protected static String |
FILE_DELETE_ON_ERR_KEY
|
protected static String |
FILE_OPEN_IS_SYMBOLIC_LINK_KEY
|
protected static String |
FILE_OPEN_MODTIME_KEY
|
protected static String |
FILE_OPEN_ORIG_ARGS_KEY
|
protected static String |
FILE_OPEN_PATH_KEY
|
protected static String |
FILE_OPEN_TARGET_FILE_KEY
|
protected static String |
FILE_OPEN_TARGET_STREAM_KEY
|
protected static String |
FILE_OPEN_TMP_FILE_KEY
|
protected static String |
FILE_OPEN_TMP_STREAM_KEY
|
static String |
PERMS_RW
|
protected static String |
RECONCILE_HANDLER_SKIP_ADD_KEY
|
static String |
SYSTEM_TMPDIR_DEFAULT
|
static String |
SYSTEM_TMPDIR_PROPS_KEY
|
static String |
TRACE_PREFIX
|
Constructor Summary | |
---|---|
protected |
ClientSystemFileCommands(Properties props,
RpcServer server)
|
Method Summary | |
---|---|
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
checkFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
The infamous checkFile omnibus method, used to, well, check files on the Perforce client side. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
chmodFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Change the r/w (etc.) mode of a file locally. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
closeFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Close a file that was opened earlier for writing. |
Map<String,Object> |
convertFileDataMap(Map<String,Object> map,
Charset charset,
boolean isUnicodeServer)
|
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
deleteFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
|
static void |
getFiles(File dir,
FilenameFilter filter,
List<File> files)
Recursively get all files in a directory. |
RpcOutputStream |
getTempOutputStream(CommandEnv cmdEnv)
Return the temp RPC output stream. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
moveFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Move a file from one location to another. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
openFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Open a client file for writing. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
reconcileAdd(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Reconcile add confirm - scans the directory (local syntax) and returns files in the directory using the full path. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
reconcileEdit(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
"inquire" about file, for 'p4 reconcile' |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
reconcileFlush(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Reconcile flush - remove the skip add files map from the reconcile handler. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
writeBinary(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
A specialised method to handle the client-OutputBinary command. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
writeFile(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Write file contents to the target file. |
protected RpcPacketDispatcher.RpcPacketDispatcherResult |
writeText(RpcConnection rpcConnection,
CommandEnv cmdEnv,
Map<String,Object> resultsMap)
Handles the client-OutputText command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TRACE_PREFIX
public static final String DEFAULT_TMPFILE_PFX
public static final String DEFAULT_TMPFILE_SFX
public static final String SYSTEM_TMPDIR_PROPS_KEY
public static final String SYSTEM_TMPDIR_DEFAULT
public static final String PERMS_RW
protected static final String FILE_DELETE_ON_ERR_KEY
protected static final String FILE_OPEN_PATH_KEY
protected static final String FILE_OPEN_TARGET_FILE_KEY
protected static final String FILE_OPEN_TMP_FILE_KEY
protected static final String FILE_OPEN_TMP_STREAM_KEY
protected static final String FILE_OPEN_TARGET_STREAM_KEY
protected static final String FILE_OPEN_ORIG_ARGS_KEY
protected static final String FILE_OPEN_MODTIME_KEY
protected static final String FILE_OPEN_IS_SYMBOLIC_LINK_KEY
protected static final String RECONCILE_HANDLER_SKIP_ADD_KEY
Constructor Detail |
---|
protected ClientSystemFileCommands(Properties props, RpcServer server)
Method Detail |
---|
protected RpcPacketDispatcher.RpcPacketDispatcherResult chmodFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult openFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
We also have to leave the associated file descriptor (or channel equivalent) lying around for the rest of the function sequence to be able to pick up.
Note that we also now implement the 10.2 sync (etc.) transfer integrity checks; this is actually fairly easy as it can be done on the raw (un-translated) data coming in to the write methods (as opposed to checkFile's version, which has to consider the translated data). We do most of this work in the RpcOutputStream and RpcPerforceFile classes after setting things up here; closeFile does the final round up and delivers the verdict. This all only happens if Server.nonCheckedSyncs is false.
The temp file created here will be deleted in the subsequent closeFile() method call.
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult writeFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult writeText(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
Basically uses writeBinary (below) with the twist that we currently throw an exception when we see the trans option (which we haven't implemented yet).
Note that -- like the C++ API -- no line end munging is performed -- we just throw what's coming at us straight back to whoever's catching it...
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult writeBinary(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
Note that this method fakes a handler to keep state around, and assumes that the target (tmp) stream has been passed-in by the higher levels in the cmdEnv state map.
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult closeFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult moveFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult deleteFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult checkFile(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
Much of the work happens off-stage in the support methods elsewhere. What follows is copied from the C++ API:
This routine, for compatibility purposes, has several modes.
1. If clientType is set, we know the type and we're checking to see if the file exists and (if digest is set) if the file has the same fingerprint. We return this in "status" with a value of "missing", "exists", or "same". This starts around version 1742.
2. If clientType is unset, we're looking for the type of the file, and we'll return it in "type". This is sort of overloaded, 'cause it can also get set with pseudo-types like "missing". In this case, we use the "xfiles" protocol check to make sure we don't return something the server doesn't expect.
- xfiles unset: return text, binary. - xfiles >= 0: also return xtext, xbinary. - xfiles >= 1: also return symlink. - xfiles >= 2; also return resource (mac resource file). - xfiles >= 3; also return ubinary - xfiles >= 4; also return appleIf forceType is set, we'll use that in preference over what we've discovered. We still check the file (to make sure they're not adding a directory, and so they get to right warning if they add an empty file), but we'll just override that back to the (typemap's) forceType.
We map empty/missing/unreadable into forceType/"text".
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult reconcileEdit(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
This routine performs clientCheckFile's scenario 1 checking, but also saves the list of files that are in the depot so they can be compared to the list of files on the client when reconciling later for add.
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult reconcileAdd(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
TODO: Check MapApi; if no mapping, continue; Currently, just rely on server side MapApi validation.
ConnectionException
protected RpcPacketDispatcher.RpcPacketDispatcherResult reconcileFlush(RpcConnection rpcConnection, CommandEnv cmdEnv, Map<String,Object> resultsMap) throws ConnectionException
ConnectionException
public RpcOutputStream getTempOutputStream(CommandEnv cmdEnv) throws ConnectionException
ConnectionException
public Map<String,Object> convertFileDataMap(Map<String,Object> map, Charset charset, boolean isUnicodeServer)
public static void getFiles(File dir, FilenameFilter filter, List<File> files)
Note: must pass in a non-null 'files' list as a parameter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |