| Class | OpenWFE::UuidWfidGenerator |
| In: |
lib/openwfe/expool/wfidgen.rb
|
| Parent: | Service |
A wfid generator that uses any underlying "uuidgen" command it might find. By default, it favours "uuidgen -t".
You can specifying a command by passing a :uuid_command param in the application context, or simply by overriding the generate() method.
| COMMANDS | = | [ "uuidgen -t", "uuidgen" |
# File lib/openwfe/expool/wfidgen.rb, line 302
302: def initialize (service_name, application_context)
303:
304: super
305:
306: @command = @application_context[:uuid_command] \
307: if @application_context
308:
309: unless @command
310: COMMANDS.each do |c|
311: c = "#{c} 2> /dev/null"
312: s = `#{c}`
313: h = s[0, 8].hex
314: if h > 0
315: @command = c
316: break
317: end
318: end
319: end
320:
321: raise "no command found for generating an uuid found..." \
322: unless @command
323:
324: linfo { "new() command that will be used : '#{@command}'" }
325: end
This method is called by OpenWFE::split_wfid() when it has detected a wfid that is a UUID.
Splits the first part of the uuid (will be used for the expression storage directory structure).
# File lib/openwfe/expool/wfidgen.rb, line 352
352: def self.split_wfid (wfid)
353:
354: s = wfid[0, 8]
355: a = []
356: 4.times do |i|
357: a << s[i*2, 2]
358: end
359: a
360: end