agave-apps/apps-core/src/main/java/org/iplantc/service/apps/managers/ApplicationManager.java
/**
	 * Checks that the app dependencies are present on the remote system as 
	 * part of the validation process.
	 * 
	 * @param username the user updating the software
	 * @param newSoftware the udpated software object
	 * @return true unless dependencies are not supported for the {@link Software#getExecutionType()}
	 * @throws RemoteDataException
	 * @throws RemoteCredentialException
	 * @throws IOException
	 * @throws SoftwareResourceException
	 * @throws PermissionException
	 * @throws FileNotFoundException
	 */
Checks that the app dependencies are present on the remote system as
part of the validation process.


Checks that the app dependencies are present on the remote system as part of the validation process .
protected boolean validateSoftwareDependencies(String username, Software newSoftware) 
	throws RemoteDataException, RemoteCredentialException, IOException, SoftwareResourceException,
			PermissionException, FileNotFoundException 
	{
		RemoteDataClient remoteDataClient = null;
		try {
			remoteDataClient = newSoftware.getStorageSystem().getRemoteDataClient();
			remoteDataClient.authenticate();
			String checkPath = newSoftware.getDeploymentPath();
			LogicalFile logicalFile = null;
			PermissionManager pm = null;
			try { logicalFile=LogicalFileDao.findBySystemAndPath(newSoftware.getStorageSystem(), checkPath); } catch(Exception ignored) {}
			pm = new PermissionManager(newSoftware.getStorageSystem(), remoteDataClient, logicalFile, username);
			if (!remoteDataClient.doesExist(checkPath)) {
				throw new SoftwareResourceException(CLIENT_ERROR_BAD_REQUEST,
						"Invalid deploymentPath value. " + checkPath + 
						" does not exist on deploymentSystem " + newSoftware.getStorageSystem().getSystemId() + 
						". Please specify a valid deploymentPath.");
			}
			else if (!pm.canRead(remoteDataClient.resolvePath(checkPath))) {
				throw new SoftwareResourceException(CLIENT_ERROR_FORBIDDEN,
						"Permission denied. You do not have permission to access the deployment path " + checkPath);
			}
			checkPath = newSoftware.getDeploymentPath() + "/" + newSoftware.getExecutablePath();
			try { logicalFile=LogicalFileDao.findBySystemAndPath(newSoftware.getStorageSystem(), checkPath); } catch(Exception ignored) {}
			pm = new PermissionManager(newSoftware.getStorageSystem(), remoteDataClient, logicalFile, username);
			if (!remoteDataClient.doesExist(checkPath)) {
				throw new SoftwareResourceException(CLIENT_ERROR_BAD_REQUEST,
						"Invalid templatePath value. " + checkPath + 
						" does not exist on the deploymentSystem " + newSoftware.getStorageSystem().getSystemId() + 
						". Please specify a valid templatePath.");
			}
			else if (!pm.canRead(remoteDataClient.resolvePath(checkPath))) {
				throw new SoftwareResourceException(CLIENT_ERROR_FORBIDDEN,
						"Permission denied. You do not have permission to access the wrapper script " + checkPath);
			}
			checkPath = newSoftware.getDeploymentPath() + "/" + newSoftware.getTestPath();
			try { logicalFile=LogicalFileDao.findBySystemAndPath(newSoftware.getStorageSystem(), checkPath); } catch(Exception ignored) {}
			pm = new PermissionManager(newSoftware.getStorageSystem(), remoteDataClient, logicalFile, username);
			if (!remoteDataClient.doesExist(checkPath)) {
				throw new SoftwareResourceException(CLIENT_ERROR_BAD_REQUEST,
						"Invalid testPath value. " + checkPath + 
						" does not exist on the deploymentSystem " + newSoftware.getStorageSystem().getSystemId() + 
						". Please specify a valid testPath.");
			}
			else if (!pm.canRead(remoteDataClient.resolvePath(checkPath))) {
				throw new SoftwareResourceException(CLIENT_ERROR_FORBIDDEN,
						"Permission denied. You do not have permission to access the test script " + checkPath);
			}
			return true;
		}
		finally {
			try { if (remoteDataClient != null) remoteDataClient.disconnect();} catch (Exception ignored) {}
		}
	}
protected boolean validateSoftwareDependencies ( String username , Software newSoftware ) throws RemoteDataException , RemoteCredentialException , IOException , SoftwareResourceException , PermissionException , FileNotFoundException { RemoteDataClient remoteDataClient = null ; try { remoteDataClient = newSoftware . getStorageSystem ( ) . getRemoteDataClient ( ) ; remoteDataClient . authenticate ( ) ; String checkPath = newSoftware . getDeploymentPath ( ) ; LogicalFile logicalFile = null ; PermissionManager pm = null ; try { logicalFile = LogicalFileDao . findBySystemAndPath ( newSoftware . getStorageSystem ( ) , checkPath ) ; } catch ( Exception ignored ) { } pm = new PermissionManager ( newSoftware . getStorageSystem ( ) , remoteDataClient , logicalFile , username ) ; if ( ! remoteDataClient . doesExist ( checkPath ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_BAD_REQUEST , "Invalid deploymentPath value. " + checkPath + " does not exist on deploymentSystem " + newSoftware . getStorageSystem ( ) . getSystemId ( ) + ". Please specify a valid deploymentPath." ) ; } else if ( ! pm . canRead ( remoteDataClient . resolvePath ( checkPath ) ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_FORBIDDEN , "Permission denied. You do not have permission to access the deployment path " + checkPath ) ; } checkPath = newSoftware . getDeploymentPath ( ) + "/" + newSoftware . getExecutablePath ( ) ; try { logicalFile = LogicalFileDao . findBySystemAndPath ( newSoftware . getStorageSystem ( ) , checkPath ) ; } catch ( Exception ignored ) { } pm = new PermissionManager ( newSoftware . getStorageSystem ( ) , remoteDataClient , logicalFile , username ) ; if ( ! remoteDataClient . doesExist ( checkPath ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_BAD_REQUEST , "Invalid templatePath value. " + checkPath + " does not exist on the deploymentSystem " + newSoftware . getStorageSystem ( ) . getSystemId ( ) + ". Please specify a valid templatePath." ) ; } else if ( ! pm . canRead ( remoteDataClient . resolvePath ( checkPath ) ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_FORBIDDEN , "Permission denied. You do not have permission to access the wrapper script " + checkPath ) ; } checkPath = newSoftware . getDeploymentPath ( ) + "/" + newSoftware . getTestPath ( ) ; try { logicalFile = LogicalFileDao . findBySystemAndPath ( newSoftware . getStorageSystem ( ) , checkPath ) ; } catch ( Exception ignored ) { } pm = new PermissionManager ( newSoftware . getStorageSystem ( ) , remoteDataClient , logicalFile , username ) ; if ( ! remoteDataClient . doesExist ( checkPath ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_BAD_REQUEST , "Invalid testPath value. " + checkPath + " does not exist on the deploymentSystem " + newSoftware . getStorageSystem ( ) . getSystemId ( ) + ". Please specify a valid testPath." ) ; } else if ( ! pm . canRead ( remoteDataClient . resolvePath ( checkPath ) ) ) { throw new SoftwareResourceException ( CLIENT_ERROR_FORBIDDEN , "Permission denied. You do not have permission to access the test script " + checkPath ) ; } return true ; } finally { try { if ( remoteDataClient != null ) remoteDataClient . disconnect ( ) ; } catch ( Exception ignored ) { } } }
Checks that the app dependencies are present on the remote system as
 part of the validation process.
Checks that the app dependencies are present on the remote system as part of the validation process .