Skip to content

Commit

Permalink
#111 fix phymove api nbr
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed May 18, 2015
1 parent e6c4357 commit 531a3a8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class DataObjInp extends AbstractIRODSPackingInstruction {
public static final int CREATE_FILE_API_NBR = 601;
public static final int DELETE_FILE_API_NBR = 615;
public static final int PHYMOVE_FILE_API_NBR = 631;
public static final int PHYMOVE_FILE_API_NBR_41 = 697;
public static final int OPEN_FILE_API_NBR = 602;
public static final int PUT_FILE_API_NBR = 606;
public static final int GET_FILE_API_NBR = 608;
Expand Down Expand Up @@ -77,35 +78,35 @@ public class DataObjInp extends AbstractIRODSPackingInstruction {

/*
* (Supported modes are:
*
*
* READ 'r' Open for reading only; place the file pointer at the beginning
* of the file.
*
*
* READ_TRUNCATE 'r+' Open for reading and writing; place the file pointer
* at the beginning of the file.
*
*
* WRITE 'w' Open for writing only; place the file pointer at the beginning
* of the file and truncate the file to zero length. If the file does not
* exist, attempt to create it.
*
*
* WRITE_TRUNCATE 'w+' Open for reading and writing; place the file pointer
* at the beginning of the file and truncate the file to zero length. If the
* file does not exist, attempt to create it.
*
*
* READ_WRITE 'a' Open for writing only; place the file pointer at the end
* of the file. If the file does not exist, attempt to create it.
*
*
* READ_WRITE_CREATE_IF_NOT_EXISTS 'a+' Open for reading and writing; place
* the file pointer at the end of the file. If the file does not exist,
* attempt to create it.
*
*
* WRITE_FAIL_IF_EXISTS 'x' Create and open for writing only; place the file
* pointer at the beginning of the file. If the file already exists, the
* fopen() call will fail by returning FALSE and generating an error of
* level E_WARNING. If the file does not exist, attempt to create it. This
* is equivalent to specifying O_EXCL|O_CREAT flags for the underlying
* open(2) system call.
*
*
* READ_WRITE_FAIL_IF_EXISTS 'x+' Create and open for reading and writing;
* place the file pointer at the beginning of the file. If the file already
* exists, the fopen() call will fail by returning FALSE and generating an
Expand Down Expand Up @@ -248,7 +249,7 @@ public static final DataObjInp instanceForPhymove(
*/
public static final DataObjInp instanceForReplicate(
final String fileAbsolutePath, final String resource)
throws JargonException {
throws JargonException {

if (resource == null || resource.length() == 0) {
throw new JargonException("null or missing destination resource");
Expand All @@ -264,15 +265,15 @@ public static final DataObjInp instanceForReplicate(

/**
* Replicate packing instruction for iRODS 4.1
*
*
* @param irodsFileAbsolutePath
* @param targetResource
* @return
* @throws JargonException
*/
public static DataObjInp instanceForReplicate410(
String irodsFileAbsolutePath, String targetResource)
throws JargonException {
throws JargonException {
if (targetResource == null || targetResource.length() == 0) {
throw new JargonException("null or missing destination resource");
}
Expand Down Expand Up @@ -300,7 +301,7 @@ public static DataObjInp instanceForReplicate410(
*/
public static final DataObjInp instanceForReplicateToResourceGroup(
final String fileAbsolutePath, final String resourceGroup)
throws JargonException {
throws JargonException {

if (resourceGroup == null || resourceGroup.length() == 0) {
throw new JargonException("null or missing resourceGroup");
Expand Down Expand Up @@ -333,7 +334,7 @@ public static final DataObjInp instanceForReplicateToResourceGroup(
*/
public static final DataObjInp instanceForPhysicalMoveSpecifyingResource(
final String fileAbsolutePath, final String resource)
throws JargonException {
throws JargonException {

if (resource == null || resource.length() == 0) {
throw new JargonException("null or missing destination resource");
Expand Down Expand Up @@ -385,7 +386,7 @@ public static final DataObjInp instanceForDataObjectChecksum(
*/
public static final DataObjInp instanceForOpen(
final String fileAbsolutePath, final OpenFlags openFlags)
throws JargonException {
throws JargonException {
DataObjInp dataObjInp = new DataObjInp(fileAbsolutePath,
DEFAULT_CREATE_MODE, openFlags, 0L, 0L, "", null);
if (openFlags == OpenFlags.WRITE
Expand Down Expand Up @@ -429,7 +430,7 @@ public static final DataObjInp instanceForInitialCallToPut(
final String destinationAbsolutePath, final long length,
final String destinationResource, final boolean overwrite,
final TransferOptions transferOptions, final boolean execFlag)
throws JargonException {
throws JargonException {

if (destinationAbsolutePath == null
|| destinationAbsolutePath.isEmpty()) {
Expand Down Expand Up @@ -492,7 +493,7 @@ public static final DataObjInp instanceForParallelPut(
final String destinationAbsolutePath, final long length,
final String destinationResource, final boolean overwrite,
final TransferOptions transferOptions, final boolean execFlag)
throws JargonException {
throws JargonException {

if (destinationAbsolutePath == null
|| destinationAbsolutePath.isEmpty()) {
Expand Down Expand Up @@ -559,7 +560,7 @@ public static final DataObjInp instanceForNormalPutStrategy(
final String destinationAbsolutePath, final long length,
final String destinationResource, final boolean overwrite,
final TransferOptions transferOptions, final boolean execFlag)
throws JargonException {
throws JargonException {

if (destinationAbsolutePath == null
|| destinationAbsolutePath.isEmpty()) {
Expand Down Expand Up @@ -596,7 +597,7 @@ public static final DataObjInp instanceForNormalPutStrategy(
public static final DataObjInp instanceForCopyDest(
final String destinationAbsolutePath,
final String destinationResource, final boolean overwrite)
throws JargonException {
throws JargonException {
DataObjInp dataObjInp = new DataObjInp(destinationAbsolutePath,
ZERO_CREATE_MODE, OpenFlags.READ, 0L, 0L, destinationResource,
null);
Expand Down Expand Up @@ -659,7 +660,7 @@ public static final DataObjInp instanceForGet(
public static final DataObjInp instanceForGetSpecifyingResource(
final String sourceAbsolutePath, final String resource,
final String localPath, final TransferOptions transferOptions)
throws JargonException {
throws JargonException {

if (sourceAbsolutePath == null || sourceAbsolutePath.isEmpty()) {
throw new JargonException("null or empty sourceAbsolutePath");
Expand Down Expand Up @@ -698,7 +699,7 @@ public static final DataObjInp instanceForGetSpecifyingResource(
*/
public static DataObjInp instanceForGetHostForGet(
final String sourceAbsolutePath, final String resource)
throws JargonException {
throws JargonException {

if (sourceAbsolutePath == null || sourceAbsolutePath.isEmpty()) {
throw new JargonException("null or empty sourceAbsolutePath");
Expand Down Expand Up @@ -731,7 +732,7 @@ public static DataObjInp instanceForGetHostForGet(
*/
public static DataObjInp instanceForGetHostForPut(
final String sourceAbsolutePath, final String resource)
throws JargonException {
throws JargonException {

if (sourceAbsolutePath == null || sourceAbsolutePath.isEmpty()) {
throw new JargonException("null or empty sourceAbsolutePath");
Expand All @@ -752,7 +753,7 @@ public static DataObjInp instanceForGetHostForPut(
private DataObjInp(final String fileAbsolutePath, final int createMode,
final OpenFlags openFlags, final long offset, final long dataSize,
final String resource, final TransferOptions transferOptions)
throws JargonException {
throws JargonException {

super();
if (fileAbsolutePath == null || fileAbsolutePath.length() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
* methods. Methods that back operations not defined in
* <code>java.io.File</code> are not implemented in this particular access
* object.
*
*
*
*
* @author Mike Conway - DICE (www.irods.org)
*/
public final class IRODSFileSystemAOImpl extends IRODSGenericAO implements
Expand Down Expand Up @@ -150,7 +150,7 @@ public boolean isFileExecutable(final IRODSFile irodsFile)

/**
* Do a query on the given file to see if it has an executable bit set
*
*
* @param irodsFile
* @return <code>boolean</code> of <code>true</code> if file is data object,
* exists, and is executable
Expand Down Expand Up @@ -1409,10 +1409,17 @@ public void physicalMove(final String absolutePathToSourceFile,
DataObjInp dataObjCopyInp = DataObjInp
.instanceForPhysicalMoveSpecifyingResource(
absolutePathToSourceFile, targetResource);
Tag response = getIRODSProtocol()
.irodsFunction(DataObjInp.PI_TAG,
dataObjCopyInp.getParsedTags(),
DataObjInp.PHYMOVE_FILE_API_NBR);

int apiNbr;

if (this.getIRODSServerProperties().isAtLeastIrods410()) {
apiNbr = DataObjInp.PHYMOVE_FILE_API_NBR_41;
} else {
apiNbr = DataObjInp.PHYMOVE_FILE_API_NBR;
}

Tag response = getIRODSProtocol().irodsFunction(DataObjInp.PI_TAG,
dataObjCopyInp.getParsedTags(), apiNbr);

if (response != null) {
log.warn("unexpected response from irods, expected null message - logged and ignored ");
Expand All @@ -1423,7 +1430,7 @@ public void physicalMove(final String absolutePathToSourceFile,

/**
* Respond to client status messages for an operation until exhausted.
*
*
* @param reply
* <code>Tag</code> containing status messages from IRODS
* @throws IOException
Expand Down

0 comments on commit 531a3a8

Please sign in to comment.