Class: VORuby::Plastic::Application::Full

Inherits:
Base show all
Defined in:
lib/voruby/plastic/applications.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#app_id, #config, #description, #hub_id, #icon_url, #ivorn, #name, #plastic_version

Instance Method Summary collapse

Methods inherited from Base

#get_message_registered_ids, #get_name, #get_registered_ids, #get_understood_messages, #request, #request_asynch, #request_to_subset, #request_to_subset_asynch, #unregister

Constructor Details

#initialize(supported_messages = {}, port = 8080, mount_point = '/RPC2', name = nil, description = nil, icon_url = nil, ivorn = nil, plastic_version = 0.5) ⇒ Full

Returns a new instance of Full.



109
110
111
112
113
114
115
116
117
# File 'lib/voruby/plastic/applications.rb', line 109

def initialize(supported_messages={}, port=8080, mount_point='/RPC2',
               name=nil, description=nil, icon_url=nil, ivorn=nil, plastic_version=0.5)
  super(name, description, icon_url, ivorn, plastic_version)

  initialize_core_messages()
  @supported_messages = @core_messages.merge(supported_messages)

  initialize_xmlrpc_server(port, mount_point)
end

Instance Attribute Details

#call_back_urlObject (readonly)

Returns the value of attribute call_back_url.



107
108
109
# File 'lib/voruby/plastic/applications.rb', line 107

def call_back_url
  @call_back_url
end

#http_serverObject (readonly)

Returns the value of attribute http_server.



107
108
109
# File 'lib/voruby/plastic/applications.rb', line 107

def http_server
  @http_server
end

#supported_messagesObject (readonly)

Returns the value of attribute supported_messages.



107
108
109
# File 'lib/voruby/plastic/applications.rb', line 107

def supported_messages
  @supported_messages
end

#xmlrpc_serverObject (readonly)

Returns the value of attribute xmlrpc_server.



107
108
109
# File 'lib/voruby/plastic/applications.rb', line 107

def xmlrpc_server
  @xmlrpc_server
end

Instance Method Details

#registerObject



155
156
157
158
# File 'lib/voruby/plastic/applications.rb', line 155

def register
  @app_id = call('plastic.hub.registerXMLRPC', self.name,
                  self.supported_messages.keys.collect{ |msg| msg.to_s }, self.call_back_url.to_s)
end

#shutdownObject



164
165
166
167
# File 'lib/voruby/plastic/applications.rb', line 164

def shutdown
  self.unregister
  self.http_server.shutdown
end

#wait_for_requestsObject



160
161
162
# File 'lib/voruby/plastic/applications.rb', line 160

def wait_for_requests
  @server_thread.join
end