Class: GlueEnv

Inherits:
Object
  • Object
show all
Defined in:
lib/tinkit_base_node.rb

Overview

TODO: Have Persistent Layer GlueEnv inherit from this GlueEnv Or better see if it can follow the FilesMgr interface move into its own file Also, put common code across glue envs here (can still be overwritten)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(glue_interface) ⇒ GlueEnv

Returns a new instance of GlueEnv.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/tinkit_base_node.rb', line 69

def initialize(glue_interface)
  #glue interface is the GlueEnv object for the persistence layer
  @glue_interface = glue_interface
  common_accessors = [ :user_id, :user_datastore_location, :metadata_keys, :required_instance_keys, :required_save_keys,
                                  :node_key, :model_key, :version_key, :namespace_key, :_files_mgr_class,
                                  :views, :model_save_params, :moab_data ]
  common_accessors.each do |acc_sym|
    accessor = "@#{acc_sym.to_s}".to_sym
    accessor_value = @glue_interface.__send__(acc_sym)
    self.instance_variable_set(accessor, accessor_value)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object

Raises:

  • (NameError)


62
63
64
65
66
67
# File 'lib/tinkit_base_node.rb', line 62

def method_missing(name)
  #resp = @glue_interface.__send__(name)
  raise NameError,"Method #{name} was not found in #{self.class.name}. Has it been"\
                  " built into the persistent model interface yet?"
  #resp
end

Instance Attribute Details

#_files_mgr_classObject

Returns the value of attribute _files_mgr_class.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def _files_mgr_class
  @_files_mgr_class
end

#glue_interfaceObject

Returns the value of attribute glue_interface.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def glue_interface
  @glue_interface
end

#metadata_keysObject

Returns the value of attribute metadata_keys.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def 
  @metadata_keys
end

#moab_dataObject

Returns the value of attribute moab_data.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def moab_data
  @moab_data
end

#model_keyObject

Returns the value of attribute model_key.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def model_key
  @model_key
end

#model_save_paramsObject

Returns the value of attribute model_save_params.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def model_save_params
  @model_save_params
end

#namespace_keyObject

Returns the value of attribute namespace_key.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def namespace_key
  @namespace_key
end

#node_keyObject

Returns the value of attribute node_key.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def node_key
  @node_key
end

#required_instance_keysObject

Returns the value of attribute required_instance_keys.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def required_instance_keys
  @required_instance_keys
end

#required_save_keysObject

Returns the value of attribute required_save_keys.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def required_save_keys
  @required_save_keys
end

#user_datastore_locationObject

Returns the value of attribute user_datastore_location.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def user_datastore_location
  @user_datastore_location
end

#user_idObject

Returns the value of attribute user_id.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def user_id
  @user_id
end

#version_keyObject

Returns the value of attribute version_key.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def version_key
  @version_key
end

#viewsObject

Returns the value of attribute views.



45
46
47
# File 'lib/tinkit_base_node.rb', line 45

def views
  @views
end

Instance Method Details

#destroy_bulk(list_of_native_records) ⇒ Object

common methods



83
84
85
# File 'lib/tinkit_base_node.rb', line 83

def destroy_bulk(list_of_native_records)
  @glue_interface.destroy_bulk(list_of_native_records)
end

#destroy_node(model_metadata) ⇒ Object



87
88
89
# File 'lib/tinkit_base_node.rb', line 87

def destroy_node()
  @glue_interface.destroy_node()
end

#generate_model_key(namespace, node_key) ⇒ Object



91
92
93
94
# File 'lib/tinkit_base_node.rb', line 91

def generate_model_key(namespace, node_key)
  #so far the model key is "#{namespace}::#{node_key}" in all persitence models
  @glue_interface.generate_model_key(namespace, node_key)
end

#get(id) ⇒ Object



96
97
98
# File 'lib/tinkit_base_node.rb', line 96

def get(id)
  @glue_interface.get(id)
end

#query_allObject



100
101
102
# File 'lib/tinkit_base_node.rb', line 100

def query_all
  @glue_interface.query_all
end

#raw_allObject



104
105
106
# File 'lib/tinkit_base_node.rb', line 104

def raw_all
  @glue_interface.raw_all
end

#save(new_data) ⇒ Object



108
109
110
# File 'lib/tinkit_base_node.rb', line 108

def save(new_data)
  @glue_interface.save(new_data)
end