require "set" #This class is a singleton used for storing locations of model source files. class Crdf_loader include Singleton attr_reader :rdf_Repository attr_reader :availableProfiles,:activeProfiles #attr_writer :availableProfiles,:activeProfiles attr_reader :sourceFiles def profiles end # Add fn file to the list of model source files and loads it. # Note: # source file is stored internaly as full path (expanded) # because running program current directory is subject to change # especialy when rails server is used. def addModelFile(fn) fn=File.expand_path(fn) @sourceFiles << fn if !@sourceFiles.include?(fn) @rdf_Repository.loadModelFromFile(fn) #log.debug "fn=#{fn}" #TODO: enlever les fragments end # clear current model and reloads it from file def reset #@rdf_Repository=Crdf_Repository.new #TODO: supprimer adhérence UML @rdf_Repository=model_for_inspector #@rdf_Repository.loadUml2 @sourceFiles.each { |fn| @rdf_Repository.loadModelFromFile(fn) } end def initialize log.debug "Crdf_loader: initialisation singleton" #TODO: REWRITE (currently KO) @sourceFiles=Array.new() @availableProfiles=Set.new() @availableProfiles.add("uml2/uml2.rb") @availableProfiles.add("java/java.rb") #@availableProfiles[2]="java/hibernate.rb" @activeProfiles=Set.new() log.debug "Crdf_loader: fin initialisation singleton" reset end ## def loadProfile ## log.warn "TODO: reecrire" ## return ## log.debug "loadProfile ...." ## @availableProfiles.each { |prof| ## if @activeProfiles.include?(prof) ## #c=cookies[:user_name] ## log.debug "load profile #{prof}" ## require prof ## else ## log.debug "skip profile #{prof}" ## require prof ## end ## } ## load "uml2/uml2.rdfs.nt.rb" ## end end #Crdf_loader.instance