agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/launchers/WrapperTemplateMacroResolver.java
/**
     * Resolves the runtime notifications defined by the user in their wrapper templates. This includes all notifications
     * that match the following forms:
     * <ul>
     *     <li>{@code JOB_RUNTIME_CALLBACK_EVENT}: an empty callback equal to a {@link JobStatusType#HEARTBEAT}  callback.</li>
     *     <li>{@code JOB_RUNTIME_CALLBACK_EVENT:}</li>
     * </ul>
     * @param wrapperTemplate the resolved wrapper template
     * @return
     */
Resolves the runtime notifications defined by the user in their wrapper templates. This includes all notifications
that match the following forms:

 JOB_RUNTIME_CALLBACK_EVENT: an empty callback equal to a  JobStatusType#HEARTBEAT  callback.
 JOB_RUNTIME_CALLBACK_EVENT:

@param wrapperTemplate the resolved wrapper template
@return
Resolves the runtime notifications defined by the user in their wrapper templates . This includes all notifications that match the following forms : JOB_RUNTIME_CALLBACK_EVENT : an empty callback equal to a JobStatusType#HEARTBEAT callback . JOB_RUNTIME_CALLBACK_EVENT : @param wrapperTemplate the resolved wrapper template @return
public String resolveRuntimeNotificationMacros(String wrapperTemplate) {
        String resolvedTemplate = wrapperTemplate;
        Pattern emptyCallbackPattern = Pattern.compile(EMPTY_CALLBACK_MACRO_REGEX);
        Matcher callbackMatcher = emptyCallbackPattern.matcher(resolvedTemplate);
        while (callbackMatcher.matches()) {
            String callbackSnippet = resolveNotificationEventMacro(
                    "JOB_RUNTIME_CALLBACK_EVENT", new String[]{});
            resolvedTemplate = StringUtils.replace(resolvedTemplate, callbackMatcher.group(0), callbackSnippet);
            callbackMatcher = emptyCallbackPattern.matcher(resolvedTemplate);
        }
        Pattern defaultCallbackPattern = Pattern.compile(DEFAULT_CALLBACK_MACRO_REGEX);
        callbackMatcher = defaultCallbackPattern.matcher(resolvedTemplate);
        while (callbackMatcher.matches()) {
            String callbackSnippet = resolveNotificationEventMacro(
                    "JOB_RUNTIME_CALLBACK_EVENT", StringUtils.split(callbackMatcher.group(2), ","));
            resolvedTemplate = StringUtils.replace(resolvedTemplate, callbackMatcher.group(1), callbackSnippet);
            callbackMatcher = defaultCallbackPattern.matcher(resolvedTemplate);
        }
        Pattern customCallbackPattern = Pattern.compile(CUSTOM_CALLBACK_MACRO_REGEX);
        callbackMatcher = customCallbackPattern.matcher(resolvedTemplate);
        while (callbackMatcher.matches()) {
            String callbackSnippet = resolveNotificationEventMacro(
                    callbackMatcher.group(2), StringUtils.split(callbackMatcher.group(3), ","));
            resolvedTemplate = StringUtils.replace(resolvedTemplate, callbackMatcher.group(1), callbackSnippet);
            callbackMatcher = customCallbackPattern.matcher(resolvedTemplate);
        }
        return resolvedTemplate;
    }
public String resolveRuntimeNotificationMacros ( String wrapperTemplate ) { String resolvedTemplate = wrapperTemplate ; Pattern emptyCallbackPattern = Pattern . compile ( EMPTY_CALLBACK_MACRO_REGEX ) ; Matcher callbackMatcher = emptyCallbackPattern . matcher ( resolvedTemplate ) ; while ( callbackMatcher . matches ( ) ) { String callbackSnippet = resolveNotificationEventMacro ( "JOB_RUNTIME_CALLBACK_EVENT" , new String [ ] { } ) ; resolvedTemplate = StringUtils . replace ( resolvedTemplate , callbackMatcher . group ( 0 ) , callbackSnippet ) ; callbackMatcher = emptyCallbackPattern . matcher ( resolvedTemplate ) ; } Pattern defaultCallbackPattern = Pattern . compile ( DEFAULT_CALLBACK_MACRO_REGEX ) ; callbackMatcher = defaultCallbackPattern . matcher ( resolvedTemplate ) ; while ( callbackMatcher . matches ( ) ) { String callbackSnippet = resolveNotificationEventMacro ( "JOB_RUNTIME_CALLBACK_EVENT" , StringUtils . split ( callbackMatcher . group ( 2 ) , "," ) ) ; resolvedTemplate = StringUtils . replace ( resolvedTemplate , callbackMatcher . group ( 1 ) , callbackSnippet ) ; callbackMatcher = defaultCallbackPattern . matcher ( resolvedTemplate ) ; } Pattern customCallbackPattern = Pattern . compile ( CUSTOM_CALLBACK_MACRO_REGEX ) ; callbackMatcher = customCallbackPattern . matcher ( resolvedTemplate ) ; while ( callbackMatcher . matches ( ) ) { String callbackSnippet = resolveNotificationEventMacro ( callbackMatcher . group ( 2 ) , StringUtils . split ( callbackMatcher . group ( 3 ) , "," ) ) ; resolvedTemplate = StringUtils . replace ( resolvedTemplate , callbackMatcher . group ( 1 ) , callbackSnippet ) ; callbackMatcher = customCallbackPattern . matcher ( resolvedTemplate ) ; } return resolvedTemplate ; }
Resolves the runtime notifications defined by the user in their wrapper templates.
Resolves the runtime notifications defined by the user in their wrapper templates .
// process the notification template first so there is no confusion or namespace conflict prior to resolution