示例#1
0
 def _on_fs_recycle(self, evt):
     fs_node = evt.fs_node
     
     if fs_util.is_object(fs_node):
         object_ = self.get_object(fs_node.uuid)
         self.remove_object(object_)
         self._recycled_objects[object_.uuid] = object_
示例#2
0
 def _on_fs_modify(self, evt):
     fs_node = evt.fs_node
     
     if fs_util.is_object(fs_node):
         obj = self.get_object(fs_node.uuid, fs_util.get_object_clazz_name(fs_node))
         if obj:            
             self.project.ref_manager.update_references(obj, obj.get_refs())
         else:
             log.error('fs_node not in object manager: %s' % fs_node)
示例#3
0
    def _on_fs_restore(self, evt):
        fs_node = evt.fs_node
        
        if fs_util.is_object(fs_node):
            object_ = self.get_object(fs_node.uuid)
            assert not object_

            object_ = self._recycled_objects.get(fs_node.uuid)
            object_.verify()
            # self._manage_object( object_ )
            self.add_object(object_)
示例#4
0
 def load(self, vlog):
     for clazz in self.project.type_manager.get_clazzes():
         self._obj_map[clazz.name] = {}
     
     fsm = self.project.fs_manager
     for node in fsm.iter(False):
         if not fs_util.is_object(node):
             continue         
         
         try:
             obj = self._create_object(node, False)                                                
         except Exception, e:
             log.error(e, 'Failed to create object: %s', node.uuid)
             vlog.error('Failed to create object: %s(%s)', node.uuid, e)
         else:    
             # self.add_object(obj)
             self._obj_map[obj.clazz.name][obj.uuid] = obj
示例#5
0
 def _on_fs_create(self, evt):
     fs_node = evt.fs_node
     
     if fs_util.is_object(fs_node):
         obj = self._create_object(fs_node, verify=True)
         self.add_object(obj)
示例#6
0
        # verify all
        for obj in self.iter_all_objects():
            # noinspection PyBroadException
            try:
                obj.verify()
            except Exception, e:
                import traceback
                traceback.print_exc()
                vlog.error('Failed to verify object: %s(%s)', obj.uuid, e)

        # update references
        for obj in self.iter_all_objects():
            self.project.ref_manager.update_references(obj, obj.get_refs())
        
        for node in fsm.walk(fsm.recycle, True):
            if not fs_util.is_object(node):
                continue
            
            try:
                obj = self._create_object(node, verify=False)                            
            except Exception, e:            
                log.warn('Failed to create recycled object: %s(%s)', node.uuid, e)
            else:            
                self._recycled_objects[obj.uuid] = obj                

    def _on_fs_create(self, evt):
        fs_node = evt.fs_node
        
        if fs_util.is_object(fs_node):
            obj = self._create_object(fs_node, verify=True)
            self.add_object(obj)