Class: LanGrove::Adaptor::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/langrove/adaptor/adaptor_base.rb

Direct Known Subclasses

EventMachineAdaptor

Instance Attribute Summary

Attributes inherited from Base

#logger

Instance Method Summary collapse

Methods inherited from Base

#config_exception, #type

Constructor Details

#initialize(root, config, deamon_name) ⇒ Base

Returns a new instance of Base.



69
70
71
72
73
74
75
76
77
# File 'lib/langrove/adaptor/adaptor_base.rb', line 69

def initialize( root, config, deamon_name )
  
  super( root )

  @config = config

  validate_config_adaptor

end

Instance Method Details

#connector(params, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/langrove/adaptor/adaptor_base.rb', line 37

def connector( params, &block )
  
  #
  # OVERRIDE
  # 
  # To define the adaptor device to which clients 
  # connect.
  # 
  
  raise LanGrove::PluginException.new( 
  
    "#{self.class}.connector() - missing implementation."  
    
  )
  
end

#listen(handler, protocol, server) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/langrove/adaptor/adaptor_base.rb', line 91

def listen( handler, protocol, server )
  
  connector( {
    
    :handler  => handler,
    :protocol => protocol
    
  } ) do |connected_handler|

      #
      # A newly connected Handler
      #

      connected_handler.assign( {

        :root    => @root,
        :handler => handler,
        :protocol => protocol,
        :server => server
        
      } )
      
      connected_handler.start_handler
      
  end

end

#reloadObject



17
18
19
20
21
22
23
24
25
# File 'lib/langrove/adaptor/adaptor_base.rb', line 17

def reload

  #
  # OVERRIDE
  # 
  # Daemon has been called to HUP
  #

end

#reload_adaptorObject



63
64
65
66
67
# File 'lib/langrove/adaptor/adaptor_base.rb', line 63

def reload_adaptor

  reload

end

#stopObject



7
8
9
10
11
12
13
14
15
# File 'lib/langrove/adaptor/adaptor_base.rb', line 7

def stop
  
  #
  # OVERRIDE
  #
  # Daemon has been called to stop
  #

end

#stop_adaptorObject



57
58
59
60
61
# File 'lib/langrove/adaptor/adaptor_base.rb', line 57

def stop_adaptor

  stop

end

#validate_configObject



27
28
29
30
31
32
33
34
35
# File 'lib/langrove/adaptor/adaptor_base.rb', line 27

def validate_config

  #
  # OVERRIDE
  # 

  @config

end

#validate_config_adaptorObject



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/langrove/adaptor/adaptor_base.rb', line 79

def validate_config_adaptor

  unless @config.nil? or @config[:plugin].nil?

    @config[:plugin] = @root.config.get_plugin_config( @config[:plugin] )

  end

  validate_config

end