public TaskResponse run(Task k, TaskRequest req, TaskResponse res) {

        // Assertions.
        if (k == null) {
            String msg = "Argument 'k [Task]' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
        if (req == null) {
            String msg = "Argument 'req' cannot be null.";
            throw new IllegalArgumentException(msg);
        }

        // Set up Attributes.ORIGIN if possible...
        RuntimeRequestResponse tr = new RuntimeRequestResponse();
        tr.enclose(req);
        if (k instanceof TaskDecorator) {
            String origin = ((TaskDecorator) k).getOrigin();
            tr.setAttribute(Attributes.ORIGIN, origin);
        }

        // Provide a warning if there's no Attributes.ORIGIN at this point...
        if (!tr.hasAttribute(Attributes.ORIGIN)) {
            log.warn("Request attribute 'Attributes.ORIGIN' is not present.  " +
                    "Cernunnos may not be able to access resources relative " +
                    "to the script.");
        }
        
        // Set up Attributes.CACHE if not already provided...
        if (!tr.hasAttribute(Attributes.CACHE)) {
            tr.setAttribute(Attributes.CACHE, new ConcurrentHashMap<Object, Object>());
        }

        // Write the initial contents of the TaskRequest to the logs...
        if (log.isInfoEnabled()) {
            StringBuffer msg = new StringBuffer();
            msg.append("\n");
            msg.append("**************************************************\n");
            msg.append("** Invoking ScriptRunner.run(Task, TaskRequest)\n");
            msg.append("** TaskRequest contains ").append(tr.getAttributeNames().size()).append(" elements\n");
            for (String name : tr.getSortedAttributeNames()) {
                msg.append("**   - ").append(name).append("=").append(String.valueOf(tr.getAttribute(name))).append("\n");
            }
            msg.append("**************************************************\n");
            log.info(msg.toString());
        }

        // Invoke the task...
        k.perform(tr, res);
        return res;

    }
public TaskResponse run ( Task k , TaskRequest req , TaskResponse res ) { if ( k == null ) { String msg = "Argument 'k [Task]' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } if ( req == null ) { String msg = "Argument 'req' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } RuntimeRequestResponse tr = new RuntimeRequestResponse ( ) ; tr . enclose ( req ) ; if ( k instanceof TaskDecorator ) { String origin = ( ( TaskDecorator ) k ) . getOrigin ( ) ; tr . setAttribute ( Attributes . ORIGIN , origin ) ; } if ( ! tr . hasAttribute ( Attributes . ORIGIN ) ) { log . warn ( "Request attribute 'Attributes.ORIGIN' is not present.  " + "Cernunnos may not be able to access resources relative " + "to the script." ) ; } if ( ! tr . hasAttribute ( Attributes . CACHE ) ) { tr . setAttribute ( Attributes . CACHE , new ConcurrentHashMap < Object , Object > ( ) ) ; } if ( log . isInfoEnabled ( ) ) { StringBuffer msg = new StringBuffer ( ) ; msg . append ( "\n" ) ; msg . append ( "**************************************************\n" ) ; msg . append ( "** Invoking ScriptRunner.run(Task, TaskRequest)\n" ) ; msg . append ( "** TaskRequest contains " ) . append ( tr . getAttributeNames ( ) . size ( ) ) . append ( " elements\n" ) ; for ( String name : tr . getSortedAttributeNames ( ) ) { msg . append ( "**   - " ) . append ( name ) . append ( "=" ) . append ( String . valueOf ( tr . getAttribute ( name ) ) ) . append ( "\n" ) ; } msg . append ( "**************************************************\n" ) ; log . info ( msg . toString ( ) ) ; } k . perform ( tr , res ) ; return res ; }
Invokes the specified <code>Task</code> with the specified
<code>TaskRequest</code> and <code>TaskResponse</code>.  Use this
overload of the <code>run</code> method when you may need to
pre-load information into both the <code>TaskRequest</code> and
the <code>TaskResponse</code>.

@param k A fully-bootstrapped <code>Task</code> object.
@param req A <code>TaskRequest</code> prepared externally.
@param req A <code>TaskResponse</code> prepared externally.
@return The <code>TaskResponse</code> that results from invoking the
specified task.