batch/reactor.cleanup/reactor.cleanup.batch.js
function cleanupPrep(options) {
        var sourceResource = options.source;
        var targetResource = options.target;
        var targetReactor = options.reactor;
        var reactor;

        // if there is a target reactor, just use that cleanupPrep
        if (targetReactor) {
            reactor = reactors[targetReactor];
            if (reactor && reactor.cleanupPrep) {
                log.info('Running cleanupPrep for ' + targetReactor);
                return reactors[targetReactor].cleanupPrep();
            }
        }
        // else if source and target resources don't exist (i.e. we are doing everything) the try to call all
        else if (!sourceResource && !targetResource) {
            return Q.all(reactors.map(function (rctr) {
                log.info('Running cleanupPrep for ' + rctr);
                return rctr.cleanupPrep ? rctr.cleanupPrep() : true;
            }));
        }

        // else just return a resolved promise
        return new Q();
    }
function cleanupPrep(options) {
        var sourceResource = options.source;
        var targetResource = options.target;
        var targetReactor = options.reactor;
        var reactor;

        // if there is a target reactor, just use that cleanupPrep
        if (targetReactor) {
            reactor = reactors[targetReactor];
            if (reactor && reactor.cleanupPrep) {
                log.info('Running cleanupPrep for ' + targetReactor);
                return reactors[targetReactor].cleanupPrep();
            }
        }
        // else if source and target resources don't exist (i.e. we are doing everything) the try to call all
        else if (!sourceResource && !targetResource) {
            return Q.all(reactors.map(function (rctr) {
                log.info('Running cleanupPrep for ' + rctr);
                return rctr.cleanupPrep ? rctr.cleanupPrep() : true;
            }));
        }

        // else just return a resolved promise
        return new Q();
    }
function cleanupPrep ( options ) { var sourceResource = options . source ; var targetResource = options . target ; var targetReactor = options . reactor ; var reactor ; // if there is a target reactor, just use that cleanupPrep if ( targetReactor ) { reactor = reactors [ targetReactor ] ; if ( reactor && reactor . cleanupPrep ) { log . info ( 'Running cleanupPrep for ' + targetReactor ) ; return reactors [ targetReactor ] . cleanupPrep ( ) ; } } // else if source and target resources don't exist (i.e. we are doing everything) the try to call all else if ( ! sourceResource && ! targetResource ) { return Q . all ( reactors . map ( function ( rctr ) { log . info ( 'Running cleanupPrep for ' + rctr ) ; return rctr . cleanupPrep ? rctr . cleanupPrep ( ) : true ; } ) ) ; } // else just return a resolved promise return new Q ( ) ; }
Loop through reactors and clean them up

@param options
@returns {*}
Loop through reactors and clean them up