123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
- module Import
- class Base
- # Checks if the backend is active.
- #
- # @example
- # Import::ExampleBackend.active?
- # #=> true
- #
- # return [Boolean]
- def self.active?
- true
- end
- # Checks if the backend is able to get queued by the Scheduler.
- #
- # @example
- # Import::ExampleBackend.queueable?
- # #=> true
- #
- # return [Boolean]
- def self.queueable?
- true
- end
- # Checks if the backend is able to get rescheduled in case the Scheduler
- # got (re-)started while this ImportJob was running. Defaults to false.
- #
- # @example
- # instance = Import::LDAP.new(import_job)
- # instance.reschedule?(delayed_job)
- # #=> false
- #
- # return [false]
- def reschedule?(_delayed_job)
- false
- end
- # Initializes a new instance with a stored reference to the ImportJob.
- #
- # @example
- # instance = Import::ExampleBackend.new(import_job)
- #
- # return [Import::ExampleBackend]
- def initialize(import_job)
- @import_job = import_job
- end
- # Starts the life or dry run import of the backend.
- #
- # @example
- # instance = Import::ExampleBackend.new(import_job)
- #
- # @raise [RuntimeError] Raised if the implementation of this mandatory method is missing
- #
- # return [nil]
- def start
- raise "Missing implementation if the 'start' method."
- end
- end
- end
|