Class: SAPNW::RFC::Connection
- Inherits:
-
Object
- Object
- SAPNW::RFC::Connection
- Defined in:
- lib/sapnwrfc/connection.rb
Instance Attribute Summary collapse
-
#connection_parameters ⇒ Object
readonly
Returns the value of attribute connection_parameters.
-
#functions ⇒ Object
readonly
Returns the value of attribute functions.
-
#handle ⇒ Object
Returns the value of attribute handle.
Instance Method Summary collapse
-
#close ⇒ Object
terminate an established RFC connection.
- #connection_attributes ⇒ Object
-
#discover(func = nil) ⇒ Object
discover() looks up the dictionary definition of an RFC interface storing away the meta data of the associated Parameters/Tables and returns this as an instance of SAPNW::RFC::FunctionDescriptor.
-
#initialize(args = nil) ⇒ Connection
constructor
A new instance of Connection.
-
#ping ⇒ Object
ping test a connection to see if it is still alive.
Constructor Details
#initialize(args = nil) ⇒ Connection
Returns a new instance of Connection.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/sapnwrfc/connection.rb', line 96 def initialize(args = nil) @connection_parameters = [] case args when nil when Hash args.each_pair { |key, val| @connection_parameters << {'name' => key.to_s, 'value' => val.to_s} } else raise "Wrong parameters for Connection - must pass a Hash\n" end SAP_LOGGER.debug("In #{self.class} initialize: #{@connection_parameters.inspect} ...") @functions = {} @handle = SAPNW::RFC::Handle.new(self) end |
Instance Attribute Details
#connection_parameters ⇒ Object (readonly)
Returns the value of attribute connection_parameters.
94 95 96 |
# File 'lib/sapnwrfc/connection.rb', line 94 def connection_parameters @connection_parameters end |
#functions ⇒ Object (readonly)
Returns the value of attribute functions.
94 95 96 |
# File 'lib/sapnwrfc/connection.rb', line 94 def functions @functions end |
#handle ⇒ Object
Returns the value of attribute handle.
93 94 95 |
# File 'lib/sapnwrfc/connection.rb', line 93 def handle @handle end |
Instance Method Details
#close ⇒ Object
terminate an established RFC connection. This will invalidate any currently in-scope FunctionDescriptors associated with this Connection.
135 136 137 138 139 140 141 142 143 |
# File 'lib/sapnwrfc/connection.rb', line 135 def close SAP_LOGGER.debug("In #{self.class} close ...") return nil unless self.handle SAP_LOGGER.debug("In #{self.class} handle: #{self.handle} ...") res = self.handle.close() self.handle = nil # XXX Should destroy all cached functions and structures and types tied to handle ? return true end |
#connection_attributes ⇒ Object
112 113 114 115 |
# File 'lib/sapnwrfc/connection.rb', line 112 def connection_attributes SAP_LOGGER.debug("In #{self.class} connection_attributes ...") return self.handle.connection_attributes() end |
#discover(func = nil) ⇒ Object
discover() looks up the dictionary definition of an RFC interface storing away the meta data of the associated Parameters/Tables and returns this as an instance of SAPNW::RFC::FunctionDescriptor. This is the MANDATORY starting point of all client side RFC.
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/sapnwrfc/connection.rb', line 121 def discover(func = nil) SAP_LOGGER.debug("In #{self.class} discover (#{func}) ...") case func when nil return nil else func_def = self.handle.function_lookup(SAPNW::RFC::FunctionDescriptor, SAPNW::RFC::Parameter, func.to_s) @functions[func_def.name] = func_def return func_def end end |
#ping ⇒ Object
ping test a connection to see if it is still alive
146 147 148 149 150 151 |
# File 'lib/sapnwrfc/connection.rb', line 146 def ping SAP_LOGGER.debug("In #{self.class} ping ...") return nil unless self.handle SAP_LOGGER.debug("In #{self.class} handle: #{self.handle} ...") return self.handle.ping() end |