Class: Crdf_loader

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/ontomde-core/inspector/loader.rb

Overview

This class is a singleton used for storing locations of model source files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCrdf_loader

Returns a new instance of Crdf_loader.



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ontomde-core/inspector/loader.rb', line 38

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

Instance Attribute Details

#activeProfilesObject (readonly)

Returns the value of attribute activeProfiles.



7
8
9
# File 'lib/ontomde-core/inspector/loader.rb', line 7

def activeProfiles
  @activeProfiles
end

#availableProfilesObject (readonly)

Returns the value of attribute availableProfiles.



7
8
9
# File 'lib/ontomde-core/inspector/loader.rb', line 7

def availableProfiles
  @availableProfiles
end

#rdf_RepositoryObject (readonly)

Returns the value of attribute rdf_Repository.



6
7
8
# File 'lib/ontomde-core/inspector/loader.rb', line 6

def rdf_Repository
  @rdf_Repository
end

#sourceFilesObject (readonly)

attr_writer :availableProfiles,:activeProfiles



9
10
11
# File 'lib/ontomde-core/inspector/loader.rb', line 9

def sourceFiles
  @sourceFiles
end

Instance Method Details

#addModelFile(fn) ⇒ Object

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.


19
20
21
22
23
24
25
# File 'lib/ontomde-core/inspector/loader.rb', line 19

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

#profilesObject



11
12
# File 'lib/ontomde-core/inspector/loader.rb', line 11

def profiles
end

#resetObject

clear current model and reloads it from file



28
29
30
31
32
33
34
35
36
# File 'lib/ontomde-core/inspector/loader.rb', line 28

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