protected String createConfigFileIfNeeded(String serverDir, String[] commandLine, String xmlSnippet) {
        String utilityName = this.scriptName;
        String taskName = this.getTaskName();

        final String MAGICAL_SENTINEL = "@!$#%$#%32543265k425k4/3nj5k43n?m2|5k4\\n5k2345";

        /*
         * getArgumentValue() can return 3 possible values.
         * null - The ARG_OPT_CREATE_CONFIG_FILE option was provided, but no value was associated with it.
         * MAGICAL_SENTINEL - The ARG_OPT_CREATE_CONFIG_FILE option was not in the command-line at all.
         * ??? - The value associated with ARG_OPT_CREATE_CONFIG_FILE is ???.
         */
        String targetFilepath = getArgumentValue(ARG_CREATE_CONFIG_FILE, commandLine, MAGICAL_SENTINEL);

        if (targetFilepath == MAGICAL_SENTINEL) {
            // the config file is not needed
            return xmlSnippet;
        }

        // note that generateConfigFileName() will handle the case where targetFilepath == null
        File outputFile = generateConfigFileName(utilityName, taskName, serverDir, targetFilepath);

        String xmlTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + NL +
                             "<server description=\"This file was generated by the ''{0} {1}'' command on {2,date,yyyy-MM-dd HH:mm:ss z}.\">" + NL +
                             "{3}" + NL +
                             "</server>" + NL;

        String xmlData = MessageFormat.format(xmlTemplate, utilityName, taskName, Calendar.getInstance().getTime(), xmlSnippet);

        fileUtility.createParentDirectory(stdout, outputFile);
        fileUtility.writeToFile(stderr, xmlData, outputFile);

        String includeSnippet = "    <include location=\"" + outputFile.getAbsolutePath() + "\" />" + NL;

        return includeSnippet;
    }
protected String createConfigFileIfNeeded ( String serverDir , String [ ] commandLine , String xmlSnippet ) { String utilityName = this . scriptName ; String taskName = this . getTaskName ( ) ; final String MAGICAL_SENTINEL = "@!$#%$#%32543265k425k4/3nj5k43n?m2|5k4\\n5k2345" ; String targetFilepath = getArgumentValue ( ARG_CREATE_CONFIG_FILE , commandLine , MAGICAL_SENTINEL ) ; if ( targetFilepath == MAGICAL_SENTINEL ) { return xmlSnippet ; } File outputFile = generateConfigFileName ( utilityName , taskName , serverDir , targetFilepath ) ; String xmlTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + NL + "<server description=\"This file was generated by the ''{0} {1}'' command on {2,date,yyyy-MM-dd HH:mm:ss z}.\">" + NL + "{3}" + NL + "</server>" + NL ; String xmlData = MessageFormat . format ( xmlTemplate , utilityName , taskName , Calendar . getInstance ( ) . getTime ( ) , xmlSnippet ) ; fileUtility . createParentDirectory ( stdout , outputFile ) ; fileUtility . writeToFile ( stderr , xmlData , outputFile ) ; String includeSnippet = "    <include location=\"" + outputFile . getAbsolutePath ( ) + "\" />" + NL ; return includeSnippet ; }
This method acts like a filter for xml snippets. If the user provides the {@link #ARG_OPT_CREATE_CONFIG_FILE} option, then we will write it to a file and
provide an include snippet. Otherwise, we just return the provided xml snippet.

@param serverDir Path to the root of the server. e.g. /path/to/wlp/usr/servers/myServer/
@param commandLine The command-line arguments.
@param xmlSnippet The xml configuration the task produced.
@return An include snippet or the given xmlSnippet.