temp.rb in rflow-0.0.5 vs temp.rb in rflow-1.0.0a1

- old
+ new

@@ -38,12 +38,12 @@ attr_accessor :class_registry attr_accessor :schema_registry end # Pointer to encapsulating message - attr_accessor :message - + attr_accessor :message + def initialize(data_type_name, serialized_data=nil, schema_name=nil, schema_type=nil, schema=nil, message=nil) # schema_name ||= 'org.rflow.Messages.GenericStringMap' # schema_type ||= 'avro' # schema ||= 'default avro schema' @@ -56,13 +56,13 @@ if registered_schema.nil? && schema # If you were given a schema and didn't get one from the # registry register the schema? self.class.schema_registry.register(data_type_name, schema_name, schema_type, schema) else - + end - + end def self.create(data_type_name, data=nil, schema_name=nil, schema_type=nil, schema=nil) # look for object in registry by data_type_name # if object found, call new on that object @@ -100,22 +100,22 @@ def self.create(data_type_name, data, schema_name, schema_type, schema) # figure out if you are being called with incompatible arguments, # i.e. schema stuff end - + end - + class Message # contains all definitions about what to do for a message # has a default Avro schema for a data type class << self attr_accessor :data_class_registry end - + # Should load all the data stuff, perhaps to top level method on object attr_accessor :data_type_name, :provenance, :origination_context, :data_type_schema, :data def initialize(data_type_name, provenance=nil, origination_context=nil, data_type_schema=nil, data=nil) @@ -136,11 +136,11 @@ message_data = Message::Data.new message_data.extend message_data_class if message_data_class.is_a? Module end end end - + end class Port def read_message parts = read_all_parts @@ -172,12 +172,12 @@ else port_name = port_def port_incidence = :single end @@input_ports[port_name] = InputPort.new port_name, port_incidence - end - + end + def self.output_port # same as input port with different stuffs end STATES = [:initialized, :started, :configured, :running, :stopping, :stopped] @@ -190,11 +190,11 @@ CONFIG_DEFAULTS = { :logger, :working_directory_path, } - + def initialize(config, run_directory) # configure component config = { } @@ -207,65 +207,65 @@ process_input(port, message) # read from the port and think about things out.send('stuff') another_out.send('more stuff') end - # listen to + # listen to end def process_message(input_port, message) end def receive_message(port) port.receive end - + def send_message(port, message) port.send(message) end end class HTTPServer < RFlow::Component input_port :responses output_port :requests - + input_types "HTTP::Response" output_types "HTTP::Request" - + end class PassThrough < RFlow::Component input_port [:in] input_port :another_in output_port :out output_port :another_out - output_types - + output_types + def initialize(config, run_directory) # This will initialize the ports super # Do stuff to initialize component. Don't assume singleton - end + end def process_message(input_port, data) out.send(message) another_out.send(message) - + end def process_data(input_port - + end class Transform < RFlow::Component - + end # Plugins: # MessageData subclass: rflow-data-http_request