Class: Sbuilder::ApiLoaderPlugin

Inherits:
Object
  • Object
show all
Includes:
Utils::MyLogger
Defined in:
lib/sbuilder/facade/api_loader_plugin.rb

Overview

Abstract Parent class for Sbuilder for API loaders.

Class implements following service groups

  • Constructor and Object Initialize

  • Framework Services for API loader

  • configure plugin

Constructor and Object Initialize (collapse)

Framework Services (collapse)

Configure Plugin (collapse)

Constructor Details

- (ApiLoaderPlugin) initialize(factory, options = {})




20
21
# File 'lib/sbuilder/facade/api_loader_plugin.rb', line 20

def initialize( factory, options = {} )
end

Class Method Details

+ (Object) configure(configuration)

Configure API loader - MUST be implemented by plugin class

Parameters:

  • configuration (Hash)

    properties to configure



57
58
59
60
61
# File 'lib/sbuilder/facade/api_loader_plugin.rb', line 57

def self.configure( configuration )
  raise PluginException.new <<-EOS
  Plugin classes should implement method #{__method__}.
  EOS
end

Instance Method Details

- (Sbuilder::ApiLoader) facade

Returns facade to access Sbuilder servivices ( set in 'setFacade')

Returns:



40
41
42
# File 'lib/sbuilder/facade/api_loader_plugin.rb', line 40

def facade
  @facade
end

- (Logger) logger

Returns log to Sbuiler log-file

Returns:

  • (Logger)

    log to Sbuiler log-file



45
46
47
48
49
# File 'lib/sbuilder/facade/api_loader_plugin.rb', line 45

def logger
  # return STDERR logger - if logger not yet ready
  Logger.new( STDERR ) unless @logger
  @logger
end

- (Object) setFacade(facade)

Sbuilder controller calls 'setFacade' when new API loader object is contstructed. Sets instance variable '@facade' and '@logger'.

Parameters:



28
29
30
31
# File 'lib/sbuilder/facade/api_loader_plugin.rb', line 28

def setFacade( facade )
  @facade = facade
  @logger = facade.createLogger( self.class.name.split('::').last )
end