def run(params)

      @adapter = ElFinderS3::Adapter.new(@options[:server], @options[:cache_connector])
      @root = ElFinderS3::Pathname.new(adapter, @options[:root]) #Change - Pass the root dir here

      begin
        @params = params.dup
        @headers = {}
        @response = {}
        @response[:errorData] = {}

        if VALID_COMMANDS.include?(@params[:cmd])

          if @options[:thumbs]
            @thumb_directory = @root + @options[:thumbs_directory]
            @thumb_directory.mkdir unless @thumb_directory.exist?
            raise(RuntimeError, "Unable to create thumbs directory") unless @thumb_directory.directory?
          end

          @current = @params[:current] ? from_hash(@params[:current]) : nil
          @target = (@params[:target] and !@params[:target].empty?) ? from_hash(@params[:target]) : nil
          if params[:targets]
            @targets = @params[:targets].map { |t| from_hash(t) }
          end

          begin
            send("_#{@params[:cmd]}")
          rescue Exception => exception
            puts exception.message
            puts exception.backtrace.inspect
            @response[:error] = 'Access Denied'
          end
        else
          invalid_request
        end

        @response.delete(:errorData) if @response[:errorData].empty?

        return @headers, @response
      ensure
        adapter.close
      end
    end
def run(params)

      @adapter = ElFinderS3::Adapter.new(@options[:server], @options[:cache_connector])
      @root = ElFinderS3::Pathname.new(adapter, @options[:root]) #Change - Pass the root dir here

      begin
        @params = params.dup
        @headers = {}
        @response = {}
        @response[:errorData] = {}

        if VALID_COMMANDS.include?(@params[:cmd])

          if @options[:thumbs]
            @thumb_directory = @root + @options[:thumbs_directory]
            @thumb_directory.mkdir unless @thumb_directory.exist?
            raise(RuntimeError, "Unable to create thumbs directory") unless @thumb_directory.directory?
          end

          @current = @params[:current] ? from_hash(@params[:current]) : nil
          @target = (@params[:target] and !@params[:target].empty?) ? from_hash(@params[:target]) : nil
          if params[:targets]
            @targets = @params[:targets].map { |t| from_hash(t) }
          end

          begin
            send("_#{@params[:cmd]}")
          rescue Exception => exception
            puts exception.message
            puts exception.backtrace.inspect
            @response[:error] = 'Access Denied'
          end
        else
          invalid_request
        end

        @response.delete(:errorData) if @response[:errorData].empty?

        return @headers, @response
      ensure
        adapter.close
      end
    end
Runs request-response cycle.
 @param [Hash] params Request parameters. :cmd option is required.
 @option params [String] :cmd Command to be performed.
 @see VALID_COMMANDS