Class: Disloku::BaseTask

Inherits:
Object
  • Object
show all
Defined in:
lib/disloku/BaseTask.rb

Direct Known Subclasses

Tasks::FolderTask, Tasks::NetSftpTask

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseTask

Returns a new instance of BaseTask.



6
7
8
# File 'lib/disloku/BaseTask.rb', line 6

def initialize()
	@result = {}
end

Instance Attribute Details

#changesetsObject

Returns the value of attribute changesets.



4
5
6
# File 'lib/disloku/BaseTask.rb', line 4

def changesets
  @changesets
end

Instance Method Details

#afterExecuteObject



37
38
# File 'lib/disloku/BaseTask.rb', line 37

def afterExecute()
end

#beforeExecuteObject



30
31
# File 'lib/disloku/BaseTask.rb', line 30

def beforeExecute()
end

#executeObject



21
22
23
24
25
26
27
28
# File 'lib/disloku/BaseTask.rb', line 21

def execute()
	Log.instance.info("running task '#{self.class}'")
	if (beforeExecute() != false)
		executeTask()
		afterExecute()
	end
	return @result
end

#executeTaskObject

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/disloku/BaseTask.rb', line 33

def executeTask()
	raise NotImplementedError.new()
end

#getInputParam(input, name, klass) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/disloku/BaseTask.rb', line 10

def getInputParam(input, name, klass)
	if (!input.has_key?(name))
		raise ArgumentError.new("Missing input argument '#{name}' of type '#{klass}'")
	end
	if (!input[name].kind_of?(klass))
		raise ArgumentError.new("Input argument '#{name}' is not of type '#{klass}'")
	end

	return input[name]
end