Changeset 128

Show
Ignore:
Timestamp:
10/25/08 22:12:05 (5 years ago)
Author:
samuraraujo
Message:
 
Location:
Explorator/trunk/app
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • Explorator/trunk/app/controllers/explorator_controller.rb

    r121 r128  
    1515  # attr_accessor :resourceset 
    1616  #default rails method. returns the view index.rhtml. 
    17   def index     
    18      
     17  def index         
    1918end 
    2019  
  • Explorator/trunk/app/helpers/explorator_helper.rb

    r124 r128  
    2222    if((@filter!=nil)&&(@filter!="")) 
    2323      resources =   resources.select {|x|  
    24       puts x 
     24       
    2525      render_resource(x).to_s().downcase.index(@filter.downcase) != nil} 
    2626      @size = resources.size() 
  • Explorator/trunk/app/models/explorator_application.rb

    r119 r128  
    1717class Application   
    1818   attr_accessor :uri 
     19 
    1920  def initialize(id)    
    2021    super() 
    2122    @uri = 'http://www.tecweb.inf.puc-rio.br/application/id/'+  id + '/' 
    2223  end 
    23   def instance()    
    24     
    25     if @instance == nil       
     24  def instance()     
     25    if @instance == nil      
     26      @cache = Hash.new 
    2627      @instance=EXPLORATOR::Application.new(@uri + 'default') 
    2728      @instance.explorator::uuid=@uri 
     
    3637  def add(resourceset)     
    3738    raise ExploratorError.new('Must be a ResourceSet instance') if !resourceset.instance_of? EXPLORATOR::Set 
     39    puts '## Adding to cache ##' 
     40    puts resourceset.uri 
     41    @cache['<' + resourceset.uri + '>'] = resourceset 
     42     
    3843    if instance.explorator::set == nil 
    3944      instance.explorator::set = [resourceset] 
     
    4449  #get a resource set 
    4550  def get(uri)         
    46     EXPLORATOR::Set.new(uri)  
     51    #EXPLORATOR::Set.new(uri)  
     52    puts '## Retrieving from the cache ##' 
     53    puts uri 
     54    @cache[uri] 
    4755  end     
    4856  ##verifies whether the set was added in the pool 
     
    8593      end 
    8694    end 
     95    @cache = Hash.new 
    8796    #remove the resources from the application 
    8897    instance.explorator::set = [] 
     
    116125  #remove a specific resource set from the pool 
    117126  def remove(uri)       
     127    @cache[uri]=nil 
    118128    resource = EXPLORATOR::Set.new(uri)      
    119129    #before remove store the set expression.      
  • Explorator/trunk/app/models/resource_set.rb

    r111 r128  
    6464  end 
    6565  #defines a new expression and reevaluates the expression. 
    66   def expression=(exp)       
     66  def expression=(exp)   
     67    puts '## Evaluating Expression ##' 
    6768    puts exp 
    6869   # begin            
    6970      #for avoid loop evaluation. 
    70      current_expression = self.explorator::expression 
     71      current_expression = self.explorator::expression 
    7172      exp.gsub!("'" + self.to_s + "'",current_expression) if  current_expression != nil 
    72       #evaluates the expression 
    73        
    74       x = eval(exp) 
    75       
     73      #evaluates the expression       
     74      x = eval(exp)      
    7675#      updates the expression 
    7776      self.explorator::expression = exp