Sha256: 45169ac87a1be2cc7c604d89c0226de1bcc5a30720d8062544f6f22c8ca51cf6

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

require "set"

#This class is a singleton used for storing locations of model source files.
class Crdf_loader
  include Singleton
  attr_reader :rdf_model
  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_model.loadModelFromFile(fn)
    #log.debug "fn=#{fn}"
    #TODO: enlever les fragments
  end

  # clear current model and reloads it from file
  def reset
    #@rdf_model=Crdf_Model.new
    #TODO: supprimer adhérence UML
    @rdf_model=model_for_inspector
    #@rdf_model.loadUml2
    @sourceFiles.each { |fn|
      @rdf_model.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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ontomde-inspector-1.0.4 ./lib/ontomde-inspector/loader.rb
ontomde-inspector-1.0.6 ./lib/ontomde-inspector/loader.rb