Class: Chronicle::ETL::Registry::ConnectorRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/chronicle/etl/registry/connector_registration.rb

Overview

Records details about a connector such as its source provider and a description

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ConnectorRegistration

Create a new connector registration



11
12
13
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 11

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def description
  @description
end

#from_schemaObject

Returns the value of attribute from_schema.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def from_schema
  @from_schema
end

#identifierObject

Returns the value of attribute identifier.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def identifier
  @identifier
end

#klassObject

Returns the value of attribute klass.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def klass
  @klass
end

#sourceObject

Returns the value of attribute source.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def source
  @source
end

#strategyObject

Returns the value of attribute strategy.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def strategy
  @strategy
end

#to_schemaObject

Returns the value of attribute to_schema.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def to_schema
  @to_schema
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 8

def type
  @type
end

Instance Method Details

#built_in?Boolean

Whether this connector is built-in to Chronicle

Returns:

  • (Boolean)


31
32
33
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 31

def built_in?
  @klass.to_s.include? 'Chronicle::ETL'
end

#descriptive_phraseObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 44

def descriptive_phrase
  prefix = case phase
           when :extractor
             'Extracts from'
           when :transformer
             'Transforms'
           when :loader
             'Loads to'
           end

  "#{prefix} #{description}"
end

#klass_nameObject



35
36
37
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 35

def klass_name
  @klass.to_s
end

#phaseObject

The ETL phase of this connector



16
17
18
19
20
21
22
23
24
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 16

def phase
  if klass.ancestors.include? Chronicle::ETL::Extractor
    :extractor
  elsif klass.ancestors.include? Chronicle::ETL::Transformer
    :transformer
  elsif klass.ancestors.include? Chronicle::ETL::Loader
    :loader
  end
end

#pluginObject

TODO: allow overriding here. Maybe through self-registration process



40
41
42
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 40

def plugin
  @source
end

#to_sObject



26
27
28
# File 'lib/chronicle/etl/registry/connector_registration.rb', line 26

def to_s
  "#{phase}-#{identifier}"
end