agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/JobRequestProcessor.java
/**
	 * Creates the job archive directory if not already present
	 * @param archiveSystem the system to which the job output will be archived
	 * @param archivePath the agave relative path on the remote system
	 * @throws JobProcessingException if the remote directory cannot be created.
	 */
Creates the job archive directory if not already present
@param archiveSystem the system to which the job output will be archived
@param archivePath the agave relative path on the remote system
@throws JobProcessingException if the remote directory cannot be created.
Creates the job archive directory if not already present @param archiveSystem the system to which the job output will be archived @param archivePath the agave relative path on the remote system @throws JobProcessingException if the remote directory cannot be created .
public boolean createArchivePath(RemoteSystem archiveSystem, String archivePath) throws JobProcessingException
	{
		RemoteDataClient remoteDataClient = null;
		try
		{
		    remoteDataClient = archiveSystem.getRemoteDataClient(getInternalUsername());
		    remoteDataClient.authenticate();
		    LogicalFile logicalFile = LogicalFileDao.findBySystemAndPath(archiveSystem, archivePath);
		    PermissionManager pm = new PermissionManager(archiveSystem, remoteDataClient, logicalFile, getUsername());
		    if (!pm.canWrite(remoteDataClient.resolvePath(archivePath)))
		    {
		        throw new JobProcessingException(403,
		                "User does not have permission to access the provided archive path " + archivePath);
		    }
		    else
		    {
		        if (!remoteDataClient.doesExist(archivePath))
		        {
		            if (!remoteDataClient.mkdirs(archivePath, getUsername())) {
		                throw new JobProcessingException(400,
		                        "Unable to create job archive directory " + archivePath);
		            }
		        }
		        else
		        {
		            if (!remoteDataClient.isDirectory(archivePath))
		            {
		                throw new JobProcessingException(400,
		                        "Archive path is not a folder");
		            }
		        }
		    }
		    return true;
		}
		catch (JobProcessingException e) {
		    throw e;
		}
		catch (RemoteDataException e) {
		    int httpcode = 500;
		    if (e.getMessage().contains("No credentials associated")) {
		        httpcode = 400;
		    }
		    throw new JobProcessingException(httpcode, e.getMessage(), e);
		}
		catch (Throwable e) {
		    throw new JobProcessingException(500, "Could not verify archive path", e);
		}
		finally {
		    try {
				if (remoteDataClient != null) {
					remoteDataClient.disconnect();
				}
			} catch (Exception ignored) {}
		}
	}
public boolean createArchivePath ( RemoteSystem archiveSystem , String archivePath ) throws JobProcessingException { RemoteDataClient remoteDataClient = null ; try { remoteDataClient = archiveSystem . getRemoteDataClient ( getInternalUsername ( ) ) ; remoteDataClient . authenticate ( ) ; LogicalFile logicalFile = LogicalFileDao . findBySystemAndPath ( archiveSystem , archivePath ) ; PermissionManager pm = new PermissionManager ( archiveSystem , remoteDataClient , logicalFile , getUsername ( ) ) ; if ( ! pm . canWrite ( remoteDataClient . resolvePath ( archivePath ) ) ) { throw new JobProcessingException ( 403 , "User does not have permission to access the provided archive path " + archivePath ) ; } else { if ( ! remoteDataClient . doesExist ( archivePath ) ) { if ( ! remoteDataClient . mkdirs ( archivePath , getUsername ( ) ) ) { throw new JobProcessingException ( 400 , "Unable to create job archive directory " + archivePath ) ; } } else { if ( ! remoteDataClient . isDirectory ( archivePath ) ) { throw new JobProcessingException ( 400 , "Archive path is not a folder" ) ; } } } return true ; } catch ( JobProcessingException e ) { throw e ; } catch ( RemoteDataException e ) { int httpcode = 500 ; if ( e . getMessage ( ) . contains ( "No credentials associated" ) ) { httpcode = 400 ; } throw new JobProcessingException ( httpcode , e . getMessage ( ) , e ) ; } catch ( Throwable e ) { throw new JobProcessingException ( 500 , "Could not verify archive path" , e ) ; } finally { try { if ( remoteDataClient != null ) { remoteDataClient . disconnect ( ) ; } } catch ( Exception ignored ) { } } }
Creates the job archive directory if not already present
 @param archiveSystem the system to which the job output will be archived
 @param archivePath the agave relative path on the remote system
 @throws JobProcessingException if the remote directory cannot be created.
Creates the job archive directory if not already present @param archiveSystem the system to which the job output will be archived @param archivePath the agave relative path on the remote system @throws JobProcessingException if the remote directory cannot be created .