/*
 * Copyright 2011 DTO Labs, Inc. (http://dtolabs.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
* ExecutionItemFactory.java
* 
* User: Greg Schueler <a href="mailto:greg@dtosolutions.com">greg@dtosolutions.com</a>
* Created: 3/28/11 6:51 PM
* 
*/
package com.dtolabs.rundeck.execution;

import com.dtolabs.rundeck.core.common.Framework;
import com.dtolabs.rundeck.core.execution.ExecutionItem;
import com.dtolabs.rundeck.core.execution.commands.ExecCommandBase;
import com.dtolabs.rundeck.core.execution.commands.ScriptFileCommandBase;

import java.io.File;

/**
 * ExecutionItemFactory is ...
 *
 * @author Greg Schueler <a href="mailto:greg@dtosolutions.com">greg@dtosolutions.com</a>
 */
public class ExecutionItemFactory {
    public static ExecutionItem createScriptFileItem(final String script) {
        return new ScriptFileCommandBase() {
            @Override
            public String getScript() {
                return script;
            }
        };
    }
    public static ExecutionItem createScriptFileItem(final File file){
        final String filepath = file.getAbsolutePath();
        return new ScriptFileCommandBase() {
            @Override
            public String getServerScriptFilePath() {
                return filepath;
            }
        };
    }
    public static ExecutionItem createExecCommand(final String[] command){

        return new ExecCommandBase() {
            public String[] getCommand() {
                return command;
            }
        };
    }
    public static ExecutionItem createJobRef(final String jobIdentifier, final String[] args){

        return new JobRefCommandBase() {
            public String getJobIdentifier() {
                return jobIdentifier;
            }

            @Override
            public String[] getArgs() {
                return args;
            }

        };
    }
}

@@ -814,58 +814,8 @@
 n;%0A%0A
-import com.dtolabs.rundeck.core.common.Framework;%0A
 impo
@@ -1272,16 +1272,40 @@
 g script
+, final String%5B%5D strings
 ) %7B%0A    
@@ -1443,32 +1443,141 @@
 t;%0A            %7D
+%0A%0A            @Override%0A            public String%5B%5D getArgs() %7B%0A                return strings;%0A            %7D
 %0A        %7D;%0A    
@@ -1646,16 +1646,40 @@
 ile file
+, final String%5B%5D strings
 )%7B%0A     
@@ -1888,32 +1888,141 @@
 h;%0A            %7D
+%0A%0A            @Override%0A            public String%5B%5D getArgs() %7B%0A                return strings;%0A            %7D
 %0A        %7D;%0A    

Add missing args