agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/launchers/StartupScriptJobMacroResolver.java
/**
     * Resolves {@link StartupScriptJobVariableType} variable macros in the {@link ExecutionSystem#getStartupScript()}
     * value for the job's execution system. Tenancy is honored with respect to the system and job.
     *
     * @param job the job for which to resolve execution system
     * @param startupScriptVariable the {@link StartupScriptJobVariableType} to
     * @return resolved value of the variable.
     * @throws JobMacroResolutionException when the macro cannot be resolved. Generally this is due to an unavailable execution system
     */
Resolves  StartupScriptJobVariableType variable macros in the  ExecutionSystem#getStartupScript()
value for the job's execution system. Tenancy is honored with respect to the system and job.

@param job the job for which to resolve execution system
@param startupScriptVariable the  StartupScriptJobVariableType to
@return resolved value of the variable.
@throws JobMacroResolutionException when the macro cannot be resolved. Generally this is due to an unavailable execution system
Resolves StartupScriptJobVariableType variable macros in the ExecutionSystem#getStartupScript () value for the job ' s execution system . Tenancy is honored with respect to the system and job . @param job the job for which to resolve execution system @param startupScriptVariable the StartupScriptJobVariableType to @return resolved value of the variable . @throws JobMacroResolutionException when the macro cannot be resolved . Generally this is due to an unavailable execution system
protected String resolveStartupScriptJobMacro(Job job, ExecutionSystem executionSystem, StartupScriptJobVariableType startupScriptVariable) throws JobMacroResolutionException {
        switch (startupScriptVariable) {
            case AGAVE_JOB_NAME:
                return Slug.toSlug(getJob().getName());
            case AGAVE_JOB_ID:
                return StringUtils.isNotEmpty(getJob().getUuid()) ? getJob().getUuid() : "";
            case AGAVE_JOB_APP_ID:
                return getJob().getSoftwareName();
            case AGAVE_JOB_EXECUTION_SYSTEM:
                return StringUtils.isNotEmpty(getJob().getSystem()) ? getJob().getSystem() : "";
            case AGAVE_JOB_BATCH_QUEUE:
                return getJob().getBatchQueue();
            case AGAVE_JOB_BATCH_QUEUE_EFFECTIVE_NAME:
                BatchQueue queue = executionSystem.getQueue(getJob().getBatchQueue());
                if (queue != null) {
                    return queue.getEffectiveMappedName();
                } else {
                    throw new JobMacroResolutionException("Batch queue " + getJob().getBatchQueue() +
                            " is no longer available on system " + getJob().getSystem() +
                            " to resolve effective batch queue name for job " + getJob().getUuid());
                }
            case AGAVE_JOB_ARCHIVE_PATH:
                return (StringUtils.isNotEmpty(getJob().getArchivePath()) ? getJob().getArchivePath() : "");
            case AGAVE_JOB_OWNER:
                return getJob().getOwner();
            case AGAVE_JOB_TENANT:
                return getJob().getTenantId();
            case AGAVE_JOB_WORK_PATH:
                return getJob().getWorkPath();
            default:
                throw new NotYetImplementedException("The startupScript variable " + startupScriptVariable.name() + " is not yet supported.");
        }
    }
protected String resolveStartupScriptJobMacro ( Job job , ExecutionSystem executionSystem , StartupScriptJobVariableType startupScriptVariable ) throws JobMacroResolutionException { switch ( startupScriptVariable ) { case AGAVE_JOB_NAME : return Slug . toSlug ( getJob ( ) . getName ( ) ) ; case AGAVE_JOB_ID : return StringUtils . isNotEmpty ( getJob ( ) . getUuid ( ) ) ? getJob ( ) . getUuid ( ) : "" ; case AGAVE_JOB_APP_ID : return getJob ( ) . getSoftwareName ( ) ; case AGAVE_JOB_EXECUTION_SYSTEM : return StringUtils . isNotEmpty ( getJob ( ) . getSystem ( ) ) ? getJob ( ) . getSystem ( ) : "" ; case AGAVE_JOB_BATCH_QUEUE : return getJob ( ) . getBatchQueue ( ) ; case AGAVE_JOB_BATCH_QUEUE_EFFECTIVE_NAME : BatchQueue queue = executionSystem . getQueue ( getJob ( ) . getBatchQueue ( ) ) ; if ( queue != null ) { return queue . getEffectiveMappedName ( ) ; } else { throw new JobMacroResolutionException ( "Batch queue " + getJob ( ) . getBatchQueue ( ) + " is no longer available on system " + getJob ( ) . getSystem ( ) + " to resolve effective batch queue name for job " + getJob ( ) . getUuid ( ) ) ; } case AGAVE_JOB_ARCHIVE_PATH : return ( StringUtils . isNotEmpty ( getJob ( ) . getArchivePath ( ) ) ? getJob ( ) . getArchivePath ( ) : "" ) ; case AGAVE_JOB_OWNER : return getJob ( ) . getOwner ( ) ; case AGAVE_JOB_TENANT : return getJob ( ) . getTenantId ( ) ; case AGAVE_JOB_WORK_PATH : return getJob ( ) . getWorkPath ( ) ; default : throw new NotYetImplementedException ( "The startupScript variable " + startupScriptVariable . name ( ) + " is not yet supported." ) ; } }
Resolves {@link StartupScriptJobVariableType} variable macros in the {@link ExecutionSystem#getStartupScript()}
 value for the job's execution system.
Resolves { @link StartupScriptJobVariableType } variable macros in the { @link ExecutionSystem#getStartupScript () } value for the job ' s execution system .