commit e34242cc8b82ffc5af17cab2ed570334fa81d0ac
Author: Marc Dequènes (Duck) <Duck@DuckCorp.org>
Date:   Sat Oct 17 13:36:40 2009 +0200

    [cleanup] s/mapper/shadow/ for consistency

diff --git a/lib/ldap_shadows/object.rb b/lib/ldap_shadows/object.rb
index dc69c08..cc35e0c 100755
--- a/lib/ldap_shadows/object.rb
+++ b/lib/ldap_shadows/object.rb
@@ -19,7 +19,7 @@
 
 module LdapShadows
   class LdapObject < ActiveLdap::Base
-    class_inheritable_accessor :handle, :presentation, :mapper, :relations_info
+    class_inheritable_accessor :handle, :presentation, :shadow, :relations_info
 
     ldap_mapping :prefix => '', :classes => ['top'], :scope => :sub
 
@@ -78,7 +78,7 @@ module LdapShadows
       rel_list += self.class.presentation[:associated_relations] if self.class.presentation[:associated_relations]
 
       aspects.each do |aspect|
-        aspect_data = self.class.mapper.get_aspect(aspect)
+        aspect_data = self.class.shadow.get_aspect(aspect)
         if defined?(aspect_data[:presentation][:associated_relations]) and aspect_data[:presentation][:associated_relations]
           rel_list += aspect_data[:presentation][:associated_relations]
         end
@@ -95,7 +95,7 @@ module LdapShadows
     def aspects
       present_aspects = []
       (self.class.presentation[:allowed_aspects] || []).each do |aspect|
-        aspect_data = self.class.mapper.get_aspect(aspect)
+        aspect_data = self.class.shadow.get_aspect(aspect)
         aspect_mapping = aspect_data[:mapping]
         present_aspects << aspect if self.classes & aspect_mapping[:classes] == aspect_mapping[:classes]
       end
@@ -119,7 +119,7 @@ module LdapShadows
     end
 
     def self.possible_attributes_for_aspect(aspect)
-      aspect_data = self.mapper.get_aspect(aspect)
+      aspect_data = self.shadow.get_aspect(aspect)
       self.objectclasses_attr_list(aspect_data[:mapping][:classes])
     end
 
@@ -130,7 +130,7 @@ module LdapShadows
     end
 
     def organized_data
-      ignored_attrs = self.mapper.get_shadow_config[:hidden_attributes] || []
+      ignored_attrs = self.shadow.get_shadow_config[:hidden_attributes] || []
       ignored_attrs += self.class.presentation[:hidden_attributes] || []
       attr_list = self.nonempty_attributes - ignored_attrs
 
@@ -145,7 +145,7 @@ module LdapShadows
       # first pass to take aspects forced relations into account
       obj_aspects = {}
       aspects.each do |aspect|
-        aspect_data = self.class.mapper.get_aspect(aspect)
+        aspect_data = self.class.shadow.get_aspect(aspect)
 
         if defined?(aspect_data[:presentation][:associated_attributes]) and aspect_data[:presentation][:associated_attributes]
           taken_attr_list = aspect_data[:presentation][:associated_attributes] & (attr_list + ignored_attrs)
@@ -451,7 +451,7 @@ module LdapShadows
 
     def self.ldap_search_string_aspects(field, op, val_list)
       ldap_search_parts = val_list.split(",").collect do |val|
-        aspect_data = self.mapper.get_aspect(val)
+        aspect_data = self.shadow.get_aspect(val)
         raise PreProcessingError, _("No such aspect '%s'") % val if aspect_data.nil?
 
         ldap_classes = aspect_data[:mapping][:classes]
@@ -471,7 +471,7 @@ module LdapShadows
     end
 
     def self.find_raw_item_object(raw_item)
-      self.mapper.objects.each do |obj_hdl|
+      self.shadow.objects.each do |obj_hdl|
         obj_klass = $ldapctl.find_klass(obj_hdl)
         ldap_classes = obj_klass.required_classes
         return obj_hdl if raw_item.classes & ldap_classes == ldap_classes
@@ -532,7 +532,7 @@ module LdapShadows
     def add_aspect(aspect)
       return unless self.class.possible_aspects.include?(aspect)
 
-      aspect_data = self.mapper.get_aspect(aspect)
+      aspect_data = self.shadow.get_aspect(aspect)
       add_class(*aspect_data[:mapping][:classes])
 
       # recursive dependency enforcement
@@ -545,7 +545,7 @@ module LdapShadows
     def remove_aspect(aspect)
       return unless self.class.possible_aspects.include?(aspect)
 
-      aspect_data = self.mapper.get_aspect(aspect)
+      aspect_data = self.shadow.get_aspect(aspect)
       remove_class(*aspect_data[:mapping][:classes])
     end
 
@@ -619,27 +619,27 @@ module LdapShadows
       case action
       when :save
         if self.new_entry?
-          self.class.hook_before_create(self.class.mapper, self)
+          self.class.hook_before_create(self.class.shadow, self)
         else
-          self.class.hook_before_modify(self.class.mapper, self)
+          self.class.hook_before_modify(self.class.shadow, self)
         end
       when :delete
-        self.class.hook_before_delete(self.class.mapper, self)
+        self.class.hook_before_delete(self.class.shadow, self)
       end
 
       self.aspects.each do |aspect|
-        aklass = self.class.mapper.get_aspect_klass(aspect)
+        aklass = self.class.shadow.get_aspect_klass(aspect)
         next if aklass.nil?
 
         case action
         when :save
           if self.new_entry?
-            aklass.hook_before_create(self.class.mapper, self)
+            aklass.hook_before_create(self.class.shadow, self)
           else
-            aklass.hook_before_modify(self.class.mapper, self)
+            aklass.hook_before_modify(self.class.shadow, self)
           end
         when :delete
-          aklass.hook_before_delete(self.class.mapper, self)
+          aklass.hook_before_delete(self.class.shadow, self)
         end
       end
     end
@@ -668,30 +668,30 @@ module LdapShadows
 
     def check_hooks_after(action)
       self.aspects.each do |aspect|
-        aklass = self.class.mapper.get_aspect_klass(aspect)
+        aklass = self.class.shadow.get_aspect_klass(aspect)
         next if aklass.nil?
 
         case action
         when :save
           if self.new_entry?
-            aklass.hook_after_create(self.class.mapper, self)
+            aklass.hook_after_create(self.class.shadow, self)
           else
-            aklass.hook_after_modify(self.class.mapper, self)
+            aklass.hook_after_modify(self.class.shadow, self)
           end
         when :delete
-          aklass.hook_after_delete(self.class.mapper, self)
+          aklass.hook_after_delete(self.class.shadow, self)
         end
       end
 
       case action
       when :save
         if self.new_entry?
-          self.class.hook_after_create(self.class.mapper, self)
+          self.class.hook_after_create(self.class.shadow, self)
         else
-          self.class.hook_after_modify(self.class.mapper, self)
+          self.class.hook_after_modify(self.class.shadow, self)
         end
       when :delete
-        self.class.hook_after_delete(self.class.mapper, self)
+        self.class.hook_after_delete(self.class.shadow, self)
       end
     end
 
diff --git a/lib/ldap_shadows/shadow.rb b/lib/ldap_shadows/shadow.rb
index d4dc17f..c0bb5f3 100755
--- a/lib/ldap_shadows/shadow.rb
+++ b/lib/ldap_shadows/shadow.rb
@@ -32,7 +32,7 @@ module LdapShadows
     def initialize(name)
       @name = name
 
-      LdapShadows::LdapObject.mapper = self
+      LdapShadows::LdapObject.shadow = self
 
       @config = Config.instance
 
@@ -103,7 +103,7 @@ module LdapShadows
       klass = find_klass(object_name)
       klass.handle = object_name
       klass.presentation = object_def[:presentation]
-      klass.mapper = self
+      klass.shadow = self
       klass.ldap_mapping object_def[:mapping]
 
       # store definition for later relations processing
