deja-vu 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Change.log +4 -0
  2. data/LICENSE +19 -0
  3. data/Makefile +0 -0
  4. data/README +22 -0
  5. data/Rakefile +31 -0
  6. data/example-playback/README +6 -0
  7. data/example-playback/analysis.rb +7 -0
  8. data/example-playback/playback.rb +7 -0
  9. data/example-playback/repo/recordings/DejaVuNS/DejaVu/recordings +1 -0
  10. data/example-playback/repo/recordings/DejaVuNS/Recording/bah7aa==/n--ab7689c618445bb17b626741588b50c0500c8f79 +1 -0
  11. data/example/Makefile +6 -0
  12. data/example/config.ru +9 -0
  13. data/example/deja-vu-recordings/6b44093baa40d257106bae6dbcda53af9a57e61f.session +53 -0
  14. data/example/deja-vu-recordings/BAh7AA==/n--ab7689c618445bb17b626741588b50c0500c8f79.session +598 -0
  15. data/example/deja-vu-recordings/README +1 -0
  16. data/example/myapp.rb +15 -0
  17. data/example/repo/recordings/DejaVuNS/DejaVu/recordings +1 -0
  18. data/example/repo/recordings/DejaVuNS/Recording/bah7aa==/n--ab7689c618445bb17b626741588b50c0500c8f79 +1 -0
  19. data/example/views/index.haml +0 -0
  20. data/example/views/layout.haml +0 -0
  21. data/lib/deja-vu.rb +72 -0
  22. data/lib/deja-vu/analyzer.rb +133 -0
  23. data/lib/deja-vu/init.rb +3 -0
  24. data/lib/deja-vu/model/dejavu.rb +42 -0
  25. data/lib/deja-vu/model/generated_model/DejaVuNS.rb +1536 -0
  26. data/lib/deja-vu/model/init.rb +3 -0
  27. data/lib/deja-vu/model/record.rb +58 -0
  28. data/lib/deja-vu/model/recording.rb +55 -0
  29. data/lib/deja-vu/model/xampl-gen.rb +39 -0
  30. data/lib/deja-vu/model/xml/dejavu.xml +28 -0
  31. data/lib/deja-vu/player.rb +241 -0
  32. data/lib/deja-vu/recorder.rb +93 -0
  33. data/lib/rack-session-listener.rb +29 -0
  34. metadata +94 -0
@@ -0,0 +1 @@
1
+ This directory is where the recordings will go
@@ -0,0 +1,15 @@
1
+ require 'sinatra/base'
2
+ require 'haml'
3
+ require 'dirge'
4
+ require 'deja-vu' unless require ~'../lib/deja-vu'
5
+
6
+ class MyApp < Sinatra::Base
7
+
8
+ use SoldierOfCode::DejaVu::Middleware, {:cookie_name=>"a-stupid-cookie-name",:enable_record=>true}
9
+
10
+ get '*' do
11
+ puts "#{__FILE__}:#{__LINE__} #{__method__} HERE"
12
+ "Hello"
13
+ end
14
+
15
+ end
@@ -0,0 +1 @@
1
+ <dejavu:deja-vu pid="recordings" xmlns:dejavu="http://soldierofcode.com/deja-vu"><dejavu:recording pid="bah7aa==&#10;--ab7689c618445bb17b626741588b50c0500c8f79"/></dejavu:deja-vu>
@@ -0,0 +1 @@
1
+ <dejavu:recording pid="bah7aa==&#10;--ab7689c618445bb17b626741588b50c0500c8f79" stamp="1260219390" agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en; rv:1.9.0.16) Gecko/2009120123 Camino/2.0.1 (like Firefox/3.0.16)" ip="127.0.0.1" xmlns:dejavu="http://soldierofcode.com/deja-vu"><dejavu:record id="1260219390" stamp="1260219390" status="200" httpmethod="GET" url="http://localhost:9999/favicon.ico" request-time="0.00220799446105957"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260219395" stamp="1260219395" status="200" httpmethod="GET" url="http://localhost:9999/one" request-time="0.00183606147766113"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260219397" stamp="1260219397" status="200" httpmethod="GET" url="http://localhost:9999/one/two" request-time="0.000412940979003906"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260219400" stamp="1260219400" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three" request-time="0.000966072082519531"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260219403" stamp="1260219403" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four" request-time="0.00429487228393555"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260219408" stamp="1260219408" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true" request-time="0.0016019344329834"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/></dejavu:record><dejavu:record id="1260219416" stamp="1260219416" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven" request-time="0.00183486938476562"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/></dejavu:record><dejavu:record id="1260219422" stamp="1260219422" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.00100898742675781"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221769" stamp="1260221769" status="200" httpmethod="GET" url="http://localhost:9999/favicon.ico" request-time="0.000567913055419922"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221787" stamp="1260221787" status="200" httpmethod="GET" url="http://localhost:9999/favicon.ico" request-time="0.000334978103637695"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221818" stamp="1260221818" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000411033630371094"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221824" stamp="1260221824" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000397920608520508"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221844" stamp="1260221844" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000352859497070312"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221866" stamp="1260221866" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000344038009643555"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221911" stamp="1260221911" status="200" httpmethod="GET" url="http://localhost:9999/one" request-time="0.000502824783325195"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221916" stamp="1260221916" status="200" httpmethod="GET" url="http://localhost:9999/one/two" request-time="0.00030517578125"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221918" stamp="1260221918" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three" request-time="0.000346183776855469"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221921" stamp="1260221921" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four" request-time="0.000700950622558594"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260221924" stamp="1260221924" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true" request-time="0.0004119873046875"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/></dejavu:record><dejavu:record id="1260221929" stamp="1260221929" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven" request-time="0.000627994537353516"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/></dejavu:record><dejavu:record id="1260221937" stamp="1260221937" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.00176286697387695"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260221967" stamp="1260221967" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000349044799804688"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record><dejavu:record id="1260222028" stamp="1260222028" status="200" httpmethod="GET" url="http://localhost:9999/one" request-time="0.000318050384521484"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260222033" stamp="1260222033" status="200" httpmethod="GET" url="http://localhost:9999/one/two" request-time="0.000352144241333008"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260222035" stamp="1260222035" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three" request-time="0.000670194625854492"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260222038" stamp="1260222038" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four" request-time="0.00086212158203125"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body></dejavu:record><dejavu:record id="1260222041" stamp="1260222041" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true" request-time="0.000391006469726562"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/></dejavu:record><dejavu:record id="1260222046" stamp="1260222046" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven" request-time="0.000481843948364258"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/></dejavu:record><dejavu:record id="1260222054" stamp="1260222054" status="200" httpmethod="GET" url="http://localhost:9999/one/two/three/four?five=true&amp;six=seven&amp;eight=9" request-time="0.000367164611816406"><dejavu:header name="Content-Type" value="text/html"/><dejavu:header name="Content-Length" value="5"/><dejavu:body>&lt;![CDATA[["Hello"]]]&gt;</dejavu:body><dejavu:param name="five" value="true"/><dejavu:param name="six" value="seven"/><dejavu:param name="eight" value="9"/></dejavu:record></dejavu:recording>
File without changes
File without changes
@@ -0,0 +1,72 @@
1
+ require ~'deja-vu/init'
2
+ require ~'rack-session-listener'
3
+ require 'digest/sha1'
4
+ require 'xampl'
5
+
6
+ module SoldierOfCode
7
+ module DejaVu
8
+ class Middleware
9
+
10
+ #
11
+ #
12
+ #
13
+ #
14
+ # Possible Options:
15
+ # ----------------------
16
+ #
17
+ # :cookie_name => optional - name of the cookie to watch for and use as identifier - defaults to deja-vu
18
+ # :enable_record => optional - (true|false)
19
+ # :session_items => optional - [array of session keys] if present will capture
20
+ #
21
+ def initialize(app, opt={:enable_record=>true, :cookie_name=>'deja-vu'})
22
+ @app = app
23
+ @opt = opt
24
+ @identifier = opt[:cookie_name]
25
+ end
26
+
27
+ def call(env)
28
+
29
+ if @opt[:enable_record] then
30
+ user_identifier_before = get_user_identifier(env)
31
+ env_before = env
32
+ t_start = Time.new
33
+ resp = @app.call(env) # would be nice to capture all log output from the downstream as well.... TODO add log object as logger
34
+ t_stop = Time.new
35
+ user_identifier_after = get_user_identifier(env)
36
+
37
+ current_request = Rack::Request.new(env)
38
+
39
+ dejavu_recorder = nil
40
+ if user_identifier_before != user_identifier_after then
41
+ # something changed the identifier
42
+ dejavu_recorder = Recorder.new(@opt)
43
+ dejavu_recorder.identifier_change(user_identifier_after)
44
+ end
45
+
46
+ dejavu_recorder = Recorder.new(@opt) unless dejavu_recorder
47
+
48
+ dejavu_recorder.record(env, resp, current_request, t_start, t_stop, user_identifier_after)
49
+
50
+ resp
51
+ else
52
+ @app.call(env)
53
+ end
54
+ end
55
+
56
+ #
57
+ #
58
+ # will use the identified cookie if available
59
+ # otherwise will create a hash based on the env data available
60
+ #
61
+ def get_user_identifier(env) # => a string representing a specific browser client user
62
+
63
+ http_accept = env['HTTP_ACCEPT']
64
+ http_agent = env['HTTP_USER_AGENT']
65
+ user_ip = env['REMOTE_ADDR']
66
+
67
+ Rack::Request.new(env).cookies[@identifier] || Digest::SHA1.hexdigest("#{user_ip}#{http_agent}#{http_accept}")
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,133 @@
1
+ require ~'model/init'
2
+
3
+ module SoldierOfCode
4
+ module DejaVu
5
+ class Analyzer
6
+
7
+ def initialize
8
+
9
+ end
10
+
11
+ def overview_formatted(specific_recording_pid=nil, start_stamp=nil, end_stamp=nil)
12
+ ovr = overview(specific_recording_pid, start_stamp, end_stamp)
13
+
14
+ puts "==================================================================================================="
15
+ puts " Overview: #{ovr.analysis_title}"
16
+ puts "==================================================================================================="
17
+ puts " Number Of Requests: #{ovr.number_of_requests}"
18
+ puts " Number Of Errors: #{ovr.number_of_errors}"
19
+ puts " Percentage Success: #{ovr.success_percentile}%"
20
+ puts " Average Response Time: #{ovr.avg_response_time}"
21
+ puts " Number Of Unique Requests: #{ovr.number_of_unique_requests}"
22
+ puts " Number Of Unique Users: #{ovr.number_of_unique_users}"
23
+
24
+ #:number_of_requests, :number_of_errors, :success_percentile, :analysis_title, :avg_response_time, :number_of_unique_requests, :number_of_unique_users
25
+ end
26
+
27
+ def overview(specific_recording_pid=nil, start_stamp=nil, end_stamp=nil)
28
+
29
+ recordings = []
30
+ unless specific_recording_pid
31
+ # anlyize all the recordings as a mass
32
+ DejaVuNS::Recording.all_recordings.each do |rec|
33
+ recordings << rec
34
+ end
35
+ else
36
+ # only analyize overview of the provided pid
37
+ recordings << DejaVuNS::Recording.find_by_pid(specific_recording_pid)
38
+ end
39
+
40
+ perform_overview(recordings, start_stamp, end_stamp)
41
+
42
+ end
43
+
44
+ def perform_overview(recordings, start_stamp=nil, end_stamp=nil)
45
+
46
+ analysis = Analysis.new
47
+
48
+ analysis.analysis_title = "Single User: #{recordings.first.ip}"
49
+
50
+ records = []
51
+ recordings.each do |rec|
52
+
53
+ analysis.add_user
54
+
55
+ rec.record.each do |record|
56
+ if start_stamp && !end_stamp && record.stamp.to_i >= start_stamp # only a start stamp is provided so add all upto this date
57
+ records << record
58
+ elsif start_stamp && end_stamp && record.stamp.to_i >= start_stamp && record.stamp.to_i <= end_stamp # start and end stamps provided (envelope of time)
59
+ records << record
60
+ elsif !start_stamp && end_stamp && record.stamp.to_i <= end_stamp # Just an end time provided - everthing upto this time stamp
61
+ records << record
62
+ elsif !start_stamp && !end_stamp
63
+ records << record
64
+ end
65
+ end
66
+ end
67
+
68
+ # these are vetted against the stamps
69
+ urls_seen = []
70
+ records.each do |record|
71
+
72
+ analysis.add_request(record.request_time.to_f)
73
+
74
+ unless urls_seen.include?(record.url)
75
+ analysis.add_unique
76
+ urls_seen << record.url
77
+ end
78
+
79
+ analysis.add_error if record.status.to_i >= 400
80
+
81
+ end
82
+
83
+ analysis
84
+ end
85
+
86
+ end
87
+
88
+ class Analysis
89
+ attr_accessor :number_of_requests, :number_of_errors, :success_percentile, :analysis_title, :avg_response_time, :number_of_unique_requests, :number_of_unique_users
90
+
91
+ def initialize
92
+ @number_of_requests = 0
93
+ @number_of_errors = 0
94
+ @success_percentile = 1
95
+ @analysis_title = "Untitled"
96
+ @avg_response_time = 0.0
97
+ @number_of_unique_requests = 0
98
+ @number_of_unique_users = 0
99
+ @total_request_time = 0
100
+ end
101
+
102
+ def add_request(rep_time)
103
+ @number_of_requests += 1
104
+ recalculate_succes_error_percentile
105
+ @total_request_time += rep_time
106
+ puts "#{__FILE__}:#{__LINE__} #{__method__} #{rep_time}"
107
+ recalculate_avg_resp_time
108
+ end
109
+
110
+ def add_unique
111
+ @number_of_unique_requests += 1
112
+ end
113
+
114
+ def add_user
115
+ @number_of_unique_users += 1
116
+ end
117
+
118
+ def add_error
119
+ @number_of_errors += 1
120
+ recalculate_succes_error_percentile
121
+ end
122
+
123
+ def recalculate_avg_resp_time
124
+ @avg_response_time = @total_request_time / @number_of_requests
125
+ end
126
+
127
+ def recalculate_succes_error_percentile
128
+ @success_percentile = ((@number_of_requests - @number_of_errors) / @number_of_requests) * 100 if @number_of_requests > 0
129
+ @success_percentile = 100 if @number_of_requests == 0
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,3 @@
1
+ require ~'player'
2
+ require ~'recorder'
3
+ require ~'analyzer'
@@ -0,0 +1,42 @@
1
+ require ~'generated_model/DejaVuNS'
2
+
3
+ module DejaVuNS
4
+ Xampl.set_default_persister_kind(:filesystem)
5
+ Xampl.set_default_persister_format(:xml_format)
6
+
7
+ def self.persistence_type
8
+ Xampl.default_persister_kind
9
+ end
10
+
11
+ def self.root
12
+ root = nil
13
+ DejaVuNS.transaction do
14
+ root = DejaVu['recordings']
15
+
16
+ unless root
17
+
18
+ root = DejaVu.lookup('recordings')
19
+
20
+ unless root
21
+
22
+ root = DejaVu.new('recordings') do | it |
23
+ #it.setup_defaults
24
+ end
25
+ end
26
+ end
27
+ end
28
+ root
29
+ end
30
+
31
+ def self.transaction
32
+ result = nil
33
+ Xampl.transaction('recordings') do
34
+ result = yield
35
+ end
36
+ result
37
+ end
38
+
39
+ def self.pid_from_string(string)
40
+ string.downcase.gsub(/[ \/\\:\?'"%!@#\$\^&\*\(\)\+]/, '')
41
+ end
42
+ end
@@ -0,0 +1,1536 @@
1
+ module DejaVuNS
2
+
3
+ require "xamplr"
4
+ include Xampl
5
+
6
+
7
+ XamplObject.ns_preferred_prefix("http://soldierofcode.com/deja-vu", "dejavu")
8
+
9
+ module DejaVuAsChild
10
+ require "xamplr/indexed-array"
11
+
12
+ def deja_vu_child
13
+ accessed
14
+ @deja_vu_child
15
+ end
16
+
17
+ def deja_vu_child=(v)
18
+ accessed
19
+ @deja_vu_child = v
20
+ end
21
+
22
+ alias deja_vu deja_vu_child
23
+ alias deja_vu= deja_vu_child=
24
+
25
+ def init_deja_vu_as_child
26
+ @deja_vu_child = IndexedArray.new
27
+ end
28
+
29
+ def add_deja_vu(deja_vu)
30
+ accessed
31
+ index = deja_vu.get_the_index
32
+ if(nil == index) then
33
+ raise Xampl::XamplException.new("no value for the index 'pid' of deja_vu defined in : " << deja_vu.pp_xml)
34
+ end
35
+
36
+ existing = @deja_vu_child[index]
37
+
38
+ return existing if existing == deja_vu
39
+
40
+ self.remove_deja_vu(index) if existing
41
+
42
+ @children << deja_vu
43
+ @deja_vu_child[index] = deja_vu
44
+
45
+ deja_vu.add_parent(self)
46
+
47
+ changed
48
+ return deja_vu
49
+ end
50
+
51
+ def new_deja_vu(index)
52
+ accessed
53
+
54
+ deja_vu = nil
55
+ deja_vu = DejaVu.lookup(index) if Xampl.persister and Xampl.persister.automatic
56
+ deja_vu = DejaVu.new(index) unless deja_vu
57
+
58
+ yield(deja_vu) if block_given?
59
+ return add_deja_vu(deja_vu)
60
+ end
61
+
62
+ def ensure_deja_vu(index)
63
+ accessed
64
+
65
+ deja_vu = @deja_vu_child[index]
66
+ return deja_vu if deja_vu
67
+
68
+ deja_vu = DejaVu.lookup(index) if Xampl.persister and Xampl.persister.automatic
69
+ deja_vu = DejaVu.new(index) unless deja_vu
70
+
71
+ yield(deja_vu) if block_given?
72
+ return add_deja_vu(deja_vu)
73
+ end
74
+
75
+ def remove_deja_vu(index)
76
+ accessed
77
+ changed
78
+ unless String === index or Symbol === index then
79
+ index = index.get_the_index
80
+ end
81
+ deja_vu = @deja_vu_child.delete(index) if index
82
+ @children.delete(deja_vu)
83
+ end
84
+ end
85
+
86
+ module RecordingAsChild
87
+ require "xamplr/indexed-array"
88
+
89
+ def recording_child
90
+ accessed
91
+ @recording_child
92
+ end
93
+
94
+ def recording_child=(v)
95
+ accessed
96
+ @recording_child = v
97
+ end
98
+
99
+ alias recording recording_child
100
+ alias recording= recording_child=
101
+
102
+ def init_recording_as_child
103
+ @recording_child = IndexedArray.new
104
+ end
105
+
106
+ def add_recording(recording)
107
+ accessed
108
+ index = recording.get_the_index
109
+ if(nil == index) then
110
+ raise Xampl::XamplException.new("no value for the index 'pid' of recording defined in : " << recording.pp_xml)
111
+ end
112
+
113
+ existing = @recording_child[index]
114
+
115
+ return existing if existing == recording
116
+
117
+ self.remove_recording(index) if existing
118
+
119
+ @children << recording
120
+ @recording_child[index] = recording
121
+
122
+ recording.add_parent(self)
123
+
124
+ changed
125
+ return recording
126
+ end
127
+
128
+ def new_recording(index)
129
+ accessed
130
+
131
+ recording = nil
132
+ recording = Recording.lookup(index) if Xampl.persister and Xampl.persister.automatic
133
+ recording = Recording.new(index) unless recording
134
+
135
+ yield(recording) if block_given?
136
+ return add_recording(recording)
137
+ end
138
+
139
+ def ensure_recording(index)
140
+ accessed
141
+
142
+ recording = @recording_child[index]
143
+ return recording if recording
144
+
145
+ recording = Recording.lookup(index) if Xampl.persister and Xampl.persister.automatic
146
+ recording = Recording.new(index) unless recording
147
+
148
+ yield(recording) if block_given?
149
+ return add_recording(recording)
150
+ end
151
+
152
+ def remove_recording(index)
153
+ accessed
154
+ changed
155
+ unless String === index or Symbol === index then
156
+ index = index.get_the_index
157
+ end
158
+ recording = @recording_child.delete(index) if index
159
+ @children.delete(recording)
160
+ end
161
+ end
162
+
163
+ module RecordAsChild
164
+ require "xamplr/indexed-array"
165
+
166
+ def record_child
167
+ accessed
168
+ @record_child
169
+ end
170
+
171
+ def record_child=(v)
172
+ accessed
173
+ @record_child = v
174
+ end
175
+
176
+ alias record record_child
177
+ alias record= record_child=
178
+
179
+ def init_record_as_child
180
+ @record_child = IndexedArray.new
181
+ end
182
+
183
+ def add_record(record)
184
+ accessed
185
+ index = record.get_the_index
186
+ if(nil == index) then
187
+ raise Xampl::XamplException.new("no value for the index 'id' of record defined in : " << record.pp_xml)
188
+ end
189
+
190
+ existing = @record_child[index]
191
+
192
+ return existing if existing == record
193
+
194
+ self.remove_record(index) if existing
195
+
196
+ @children << record
197
+ @record_child[index] = record
198
+
199
+ record.add_parent(self)
200
+
201
+ changed
202
+ return record
203
+ end
204
+
205
+ def new_record(index)
206
+ accessed
207
+
208
+ record = nil
209
+ record = Record.new(index) unless record
210
+
211
+ yield(record) if block_given?
212
+ return add_record(record)
213
+ end
214
+
215
+ def ensure_record(index)
216
+ accessed
217
+
218
+ record = @record_child[index]
219
+ return record if record
220
+
221
+ record = Record.new(index) unless record
222
+
223
+ yield(record) if block_given?
224
+ return add_record(record)
225
+ end
226
+
227
+ def remove_record(index)
228
+ accessed
229
+ changed
230
+ unless String === index or Symbol === index then
231
+ index = index.get_the_index
232
+ end
233
+ record = @record_child.delete(index) if index
234
+ @children.delete(record)
235
+ end
236
+ end
237
+
238
+ module HeaderAsChild
239
+ def header_child
240
+ accessed
241
+ @header_child
242
+ end
243
+
244
+ def header_child=(v)
245
+ accessed
246
+ @header_child = v
247
+ end
248
+
249
+ alias header header_child
250
+ alias header= header_child=
251
+
252
+ def init_header_as_child
253
+ @header_child = []
254
+ end
255
+
256
+ def add_header(header)
257
+ accessed
258
+ @children << header
259
+ @header_child << header
260
+ header.add_parent(self)
261
+ changed
262
+ return header
263
+ end
264
+
265
+ def new_header
266
+ accessed
267
+ header = Header.new
268
+ yield(header) if block_given?
269
+ return add_header(header)
270
+ end
271
+
272
+ def ensure_header
273
+ accessed
274
+ new_header if 0 == header.size
275
+ end
276
+
277
+ def remove_header(header)
278
+ accessed
279
+ changed
280
+ @header_child.delete(header)
281
+ @children.delete(header)
282
+ end
283
+ end
284
+
285
+ module BodyAsChild
286
+ def body_child
287
+ accessed
288
+ @body_child
289
+ end
290
+
291
+ def body_child=(v)
292
+ accessed
293
+ @body_child = v
294
+ end
295
+
296
+ alias body body_child
297
+ alias body= body_child=
298
+
299
+ def init_body_as_child
300
+ @body_child = []
301
+ end
302
+
303
+ def add_body(body)
304
+ accessed
305
+ @children << body
306
+ @body_child << body
307
+ body.add_parent(self)
308
+ changed
309
+ return body
310
+ end
311
+
312
+ def new_body
313
+ accessed
314
+ body = Body.new
315
+ yield(body) if block_given?
316
+ return add_body(body)
317
+ end
318
+
319
+ def ensure_body
320
+ accessed
321
+ new_body if 0 == body.size
322
+ end
323
+
324
+ def remove_body(body)
325
+ accessed
326
+ changed
327
+ @body_child.delete(body)
328
+ @children.delete(body)
329
+ end
330
+ end
331
+
332
+ module ParamAsChild
333
+ def param_child
334
+ accessed
335
+ @param_child
336
+ end
337
+
338
+ def param_child=(v)
339
+ accessed
340
+ @param_child = v
341
+ end
342
+
343
+ alias param param_child
344
+ alias param= param_child=
345
+
346
+ def init_param_as_child
347
+ @param_child = []
348
+ end
349
+
350
+ def add_param(param)
351
+ accessed
352
+ @children << param
353
+ @param_child << param
354
+ param.add_parent(self)
355
+ changed
356
+ return param
357
+ end
358
+
359
+ def new_param
360
+ accessed
361
+ param = Param.new
362
+ yield(param) if block_given?
363
+ return add_param(param)
364
+ end
365
+
366
+ def ensure_param
367
+ accessed
368
+ new_param if 0 == param.size
369
+ end
370
+
371
+ def remove_param(param)
372
+ accessed
373
+ changed
374
+ @param_child.delete(param)
375
+ @children.delete(param)
376
+ end
377
+ end
378
+
379
+ module MultipartReferenceAsChild
380
+ def multipart_reference_child
381
+ accessed
382
+ @multipart_reference_child
383
+ end
384
+
385
+ def multipart_reference_child=(v)
386
+ accessed
387
+ @multipart_reference_child = v
388
+ end
389
+
390
+ alias multipart_reference multipart_reference_child
391
+ alias multipart_reference= multipart_reference_child=
392
+
393
+ def init_multipart_reference_as_child
394
+ @multipart_reference_child = []
395
+ end
396
+
397
+ def add_multipart_reference(multipart_reference)
398
+ accessed
399
+ @children << multipart_reference
400
+ @multipart_reference_child << multipart_reference
401
+ multipart_reference.add_parent(self)
402
+ changed
403
+ return multipart_reference
404
+ end
405
+
406
+ def new_multipart_reference
407
+ accessed
408
+ multipart_reference = MultipartReference.new
409
+ yield(multipart_reference) if block_given?
410
+ return add_multipart_reference(multipart_reference)
411
+ end
412
+
413
+ def ensure_multipart_reference
414
+ accessed
415
+ new_multipart_reference if 0 == multipart_reference.size
416
+ end
417
+
418
+ def remove_multipart_reference(multipart_reference)
419
+ accessed
420
+ changed
421
+ @multipart_reference_child.delete(multipart_reference)
422
+ @children.delete(multipart_reference)
423
+ end
424
+ end
425
+
426
+ class DejaVu
427
+ include Xampl::XamplPersistedObject
428
+
429
+ @@default_persister_format = nil
430
+
431
+ def default_persister_format
432
+ @@default_persister_format
433
+ end
434
+ def DejaVu.default_persister_format
435
+ @@default_persister_format
436
+ end
437
+ def DejaVu.set_default_persister_format(format)
438
+ @@default_persister_format = format
439
+ end
440
+
441
+ def DejaVu.find_by_query
442
+ things = Xampl.find_xampl do | q |
443
+ q.add_condition('class', :equals, self.name)
444
+ yield(q)
445
+ end
446
+ end
447
+
448
+
449
+ include Xampl::XamplWithDataContent
450
+
451
+ @@tag = "deja-vu"
452
+ @@ns = "http://soldierofcode.com/deja-vu"
453
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}deja-vu"
454
+ @@module_name = "DejaVuNS"
455
+ @@safe_name = "DejaVuNS_deja_vu"
456
+ @@attributes = [
457
+ [ :@pid, "pid" ],
458
+ [ :@scheduled_for_deletion_at, "scheduled-for-deletion-at" ],
459
+ ]
460
+ include DejaVuNS::RecordingAsChild
461
+
462
+
463
+ def DejaVu.lookup(pid)
464
+ Xampl.lookup(DejaVu, pid)
465
+ end
466
+
467
+ def DejaVu.[](pid)
468
+ Xampl.lookup(DejaVu, pid)
469
+ end
470
+
471
+ def pid
472
+ @pid
473
+ end
474
+
475
+ def pid=(v)
476
+ accessed
477
+ # This is kind of optimistic, I think you are in trouble if you do this
478
+ Xampl.auto_uncache(self) if @pid
479
+ @pid = v
480
+ changed
481
+ Xampl.auto_cache(self) if v
482
+ end
483
+
484
+ def scheduled_for_deletion_at
485
+ accessed
486
+ @scheduled_for_deletion_at
487
+ end
488
+
489
+ def scheduled_for_deletion_at=(v)
490
+ accessed
491
+ changed
492
+ @scheduled_for_deletion_at = v
493
+ end
494
+
495
+ def initialize(index=nil)
496
+ @pid = index if index
497
+ super()
498
+
499
+ @pid = nil if not defined? @pid
500
+ @scheduled_for_deletion_at = nil if not defined? @scheduled_for_deletion_at
501
+
502
+ init_xampl_object
503
+ init_data_content
504
+ init_recording_as_child
505
+
506
+ yield(self) if block_given?
507
+ init_hook
508
+
509
+ changed
510
+ end
511
+
512
+ def clear_non_persistent_index_attributes
513
+ @scheduled_for_deletion_at = nil
514
+ end
515
+
516
+ def append_to(other)
517
+ other.add_deja_vu(self)
518
+ end
519
+
520
+ def DejaVu.persisted?
521
+ return :pid
522
+ end
523
+
524
+ def persisted?
525
+ return :pid
526
+ end
527
+
528
+ def DejaVu.tag
529
+ @@tag
530
+ end
531
+
532
+ def DejaVu.ns
533
+ @@ns
534
+ end
535
+
536
+ def DejaVu.ns_tag
537
+ @@ns_tag
538
+ end
539
+
540
+ def DejaVu.safe_name
541
+ @@safe_name
542
+ end
543
+
544
+ def DejaVu.module_name
545
+ @@module_name
546
+ end
547
+
548
+ def tag
549
+ @@tag
550
+ end
551
+
552
+ def ns
553
+ @@ns
554
+ end
555
+
556
+ def ns_tag
557
+ @@ns_tag
558
+ end
559
+
560
+ def safe_name
561
+ @@safe_name
562
+ end
563
+
564
+ def module_name
565
+ @@module_name
566
+ end
567
+
568
+ def attributes
569
+ @@attributes
570
+ end
571
+
572
+ def indexed_by
573
+ :pid
574
+ end
575
+
576
+ def get_the_index
577
+ @pid
578
+ end
579
+
580
+ def set_the_index(index)
581
+ @pid = index
582
+ end
583
+
584
+ def substitute_in_visit(visitor)
585
+ return visitor.substitute_in_visit_deja_vu(self) || self
586
+ end
587
+
588
+ def before_visit(visitor)
589
+ visitor.before_visit_deja_vu(self)
590
+ end
591
+
592
+ def visit(visitor)
593
+ visitor.visit_deja_vu(self)
594
+ end
595
+
596
+ def after_visit(visitor)
597
+ visitor.after_visit_deja_vu(self)
598
+ end
599
+
600
+ Xampl::FromXML::register(DejaVu::tag, DejaVu::ns_tag, DejaVu)
601
+ end
602
+
603
+ class Recording
604
+ include Xampl::XamplPersistedObject
605
+
606
+ @@default_persister_format = nil
607
+
608
+ def default_persister_format
609
+ @@default_persister_format
610
+ end
611
+ def Recording.default_persister_format
612
+ @@default_persister_format
613
+ end
614
+ def Recording.set_default_persister_format(format)
615
+ @@default_persister_format = format
616
+ end
617
+
618
+ def Recording.find_by_query
619
+ things = Xampl.find_xampl do | q |
620
+ q.add_condition('class', :equals, self.name)
621
+ yield(q)
622
+ end
623
+ end
624
+
625
+
626
+ include Xampl::XamplWithDataContent
627
+
628
+ @@tag = "recording"
629
+ @@ns = "http://soldierofcode.com/deja-vu"
630
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}recording"
631
+ @@module_name = "DejaVuNS"
632
+ @@safe_name = "DejaVuNS_recording"
633
+ @@attributes = [
634
+ [ :@pid, "pid" ],
635
+ [ :@cookie, "cookie" ],
636
+ [ :@stamp, "stamp" ],
637
+ [ :@agent, "agent" ],
638
+ [ :@ip, "ip" ],
639
+ [ :@scheduled_for_deletion_at, "scheduled-for-deletion-at" ],
640
+ ]
641
+ include DejaVuNS::RecordAsChild
642
+
643
+
644
+ def Recording.lookup(pid)
645
+ Xampl.lookup(Recording, pid)
646
+ end
647
+
648
+ def Recording.[](pid)
649
+ Xampl.lookup(Recording, pid)
650
+ end
651
+
652
+ def pid
653
+ @pid
654
+ end
655
+
656
+ def pid=(v)
657
+ accessed
658
+ # This is kind of optimistic, I think you are in trouble if you do this
659
+ Xampl.auto_uncache(self) if @pid
660
+ @pid = v
661
+ changed
662
+ Xampl.auto_cache(self) if v
663
+ end
664
+
665
+ def cookie
666
+ accessed
667
+ @cookie
668
+ end
669
+
670
+ def cookie=(v)
671
+ accessed
672
+ changed
673
+ @cookie = v
674
+ end
675
+
676
+ def stamp
677
+ accessed
678
+ @stamp
679
+ end
680
+
681
+ def stamp=(v)
682
+ accessed
683
+ changed
684
+ @stamp = v
685
+ end
686
+
687
+ def agent
688
+ accessed
689
+ @agent
690
+ end
691
+
692
+ def agent=(v)
693
+ accessed
694
+ changed
695
+ @agent = v
696
+ end
697
+
698
+ def ip
699
+ accessed
700
+ @ip
701
+ end
702
+
703
+ def ip=(v)
704
+ accessed
705
+ changed
706
+ @ip = v
707
+ end
708
+
709
+ def scheduled_for_deletion_at
710
+ accessed
711
+ @scheduled_for_deletion_at
712
+ end
713
+
714
+ def scheduled_for_deletion_at=(v)
715
+ accessed
716
+ changed
717
+ @scheduled_for_deletion_at = v
718
+ end
719
+
720
+ def initialize(index=nil)
721
+ @pid = index if index
722
+ super()
723
+
724
+ @pid = nil if not defined? @pid
725
+ @cookie = nil if not defined? @cookie
726
+ @stamp = nil if not defined? @stamp
727
+ @agent = nil if not defined? @agent
728
+ @ip = nil if not defined? @ip
729
+ @scheduled_for_deletion_at = nil if not defined? @scheduled_for_deletion_at
730
+
731
+ init_xampl_object
732
+ init_data_content
733
+ init_record_as_child
734
+
735
+ yield(self) if block_given?
736
+ init_hook
737
+
738
+ changed
739
+ end
740
+
741
+ def clear_non_persistent_index_attributes
742
+ @cookie = nil
743
+ @stamp = nil
744
+ @agent = nil
745
+ @ip = nil
746
+ @scheduled_for_deletion_at = nil
747
+ end
748
+
749
+ def append_to(other)
750
+ other.add_recording(self)
751
+ end
752
+
753
+ def Recording.persisted?
754
+ return :pid
755
+ end
756
+
757
+ def persisted?
758
+ return :pid
759
+ end
760
+
761
+ def Recording.tag
762
+ @@tag
763
+ end
764
+
765
+ def Recording.ns
766
+ @@ns
767
+ end
768
+
769
+ def Recording.ns_tag
770
+ @@ns_tag
771
+ end
772
+
773
+ def Recording.safe_name
774
+ @@safe_name
775
+ end
776
+
777
+ def Recording.module_name
778
+ @@module_name
779
+ end
780
+
781
+ def tag
782
+ @@tag
783
+ end
784
+
785
+ def ns
786
+ @@ns
787
+ end
788
+
789
+ def ns_tag
790
+ @@ns_tag
791
+ end
792
+
793
+ def safe_name
794
+ @@safe_name
795
+ end
796
+
797
+ def module_name
798
+ @@module_name
799
+ end
800
+
801
+ def attributes
802
+ @@attributes
803
+ end
804
+
805
+ def indexed_by
806
+ :pid
807
+ end
808
+
809
+ def get_the_index
810
+ @pid
811
+ end
812
+
813
+ def set_the_index(index)
814
+ @pid = index
815
+ end
816
+
817
+ def substitute_in_visit(visitor)
818
+ return visitor.substitute_in_visit_recording(self) || self
819
+ end
820
+
821
+ def before_visit(visitor)
822
+ visitor.before_visit_recording(self)
823
+ end
824
+
825
+ def visit(visitor)
826
+ visitor.visit_recording(self)
827
+ end
828
+
829
+ def after_visit(visitor)
830
+ visitor.after_visit_recording(self)
831
+ end
832
+
833
+ Xampl::FromXML::register(Recording::tag, Recording::ns_tag, Recording)
834
+ end
835
+
836
+ class Record
837
+ include Xampl::XamplObject
838
+ include Xampl::XamplWithDataContent
839
+
840
+ @@tag = "record"
841
+ @@ns = "http://soldierofcode.com/deja-vu"
842
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}record"
843
+ @@module_name = "DejaVuNS"
844
+ @@safe_name = "DejaVuNS_record"
845
+ @@attributes = [
846
+ [ :@id, "id" ],
847
+ [ :@stamp, "stamp" ],
848
+ [ :@status, "status" ],
849
+ [ :@httpmethod, "httpmethod" ],
850
+ [ :@url, "url" ],
851
+ [ :@request_time, "request-time" ],
852
+ ]
853
+ include DejaVuNS::HeaderAsChild
854
+ include DejaVuNS::BodyAsChild
855
+ include DejaVuNS::ParamAsChild
856
+ include DejaVuNS::MultipartReferenceAsChild
857
+
858
+
859
+ def id
860
+ accessed
861
+ @id
862
+ end
863
+
864
+ def id=(v)
865
+ accessed
866
+ changed
867
+ @id = v
868
+ end
869
+
870
+ def stamp
871
+ accessed
872
+ @stamp
873
+ end
874
+
875
+ def stamp=(v)
876
+ accessed
877
+ changed
878
+ @stamp = v
879
+ end
880
+
881
+ def status
882
+ accessed
883
+ @status
884
+ end
885
+
886
+ def status=(v)
887
+ accessed
888
+ changed
889
+ @status = v
890
+ end
891
+
892
+ def httpmethod
893
+ accessed
894
+ @httpmethod
895
+ end
896
+
897
+ def httpmethod=(v)
898
+ accessed
899
+ changed
900
+ @httpmethod = v
901
+ end
902
+
903
+ def url
904
+ accessed
905
+ @url
906
+ end
907
+
908
+ def url=(v)
909
+ accessed
910
+ changed
911
+ @url = v
912
+ end
913
+
914
+ def request_time
915
+ accessed
916
+ @request_time
917
+ end
918
+
919
+ def request_time=(v)
920
+ accessed
921
+ changed
922
+ @request_time = v
923
+ end
924
+
925
+ def initialize(index=nil)
926
+ @id = index if index
927
+ super()
928
+
929
+ @id = nil if not defined? @id
930
+ @stamp = nil if not defined? @stamp
931
+ @status = nil if not defined? @status
932
+ @httpmethod = nil if not defined? @httpmethod
933
+ @url = nil if not defined? @url
934
+ @request_time = nil if not defined? @request_time
935
+
936
+ init_xampl_object
937
+ init_data_content
938
+ init_header_as_child
939
+ init_body_as_child
940
+ init_param_as_child
941
+ init_multipart_reference_as_child
942
+
943
+ yield(self) if block_given?
944
+ init_hook
945
+
946
+ changed
947
+ end
948
+
949
+ def clear_non_persistent_index_attributes
950
+ @id = nil
951
+ @stamp = nil
952
+ @status = nil
953
+ @httpmethod = nil
954
+ @url = nil
955
+ @request_time = nil
956
+ end
957
+
958
+ def append_to(other)
959
+ other.add_record(self)
960
+ end
961
+
962
+ def Record.persisted?
963
+ return nil
964
+ end
965
+
966
+ def persisted?
967
+ return nil
968
+ end
969
+
970
+ def Record.tag
971
+ @@tag
972
+ end
973
+
974
+ def Record.ns
975
+ @@ns
976
+ end
977
+
978
+ def Record.ns_tag
979
+ @@ns_tag
980
+ end
981
+
982
+ def Record.safe_name
983
+ @@safe_name
984
+ end
985
+
986
+ def Record.module_name
987
+ @@module_name
988
+ end
989
+
990
+ def tag
991
+ @@tag
992
+ end
993
+
994
+ def ns
995
+ @@ns
996
+ end
997
+
998
+ def ns_tag
999
+ @@ns_tag
1000
+ end
1001
+
1002
+ def safe_name
1003
+ @@safe_name
1004
+ end
1005
+
1006
+ def module_name
1007
+ @@module_name
1008
+ end
1009
+
1010
+ def attributes
1011
+ @@attributes
1012
+ end
1013
+
1014
+ def indexed_by
1015
+ :id
1016
+ end
1017
+
1018
+ def get_the_index
1019
+ @id
1020
+ end
1021
+
1022
+ def set_the_index(index)
1023
+ @id = index
1024
+ end
1025
+
1026
+ def substitute_in_visit(visitor)
1027
+ return visitor.substitute_in_visit_record(self) || self
1028
+ end
1029
+
1030
+ def before_visit(visitor)
1031
+ visitor.before_visit_record(self)
1032
+ end
1033
+
1034
+ def visit(visitor)
1035
+ visitor.visit_record(self)
1036
+ end
1037
+
1038
+ def after_visit(visitor)
1039
+ visitor.after_visit_record(self)
1040
+ end
1041
+
1042
+ Xampl::FromXML::register(Record::tag, Record::ns_tag, Record)
1043
+ end
1044
+
1045
+ class Header
1046
+ include Xampl::XamplObject
1047
+ include Xampl::XamplWithoutContent
1048
+
1049
+ @@tag = "header"
1050
+ @@ns = "http://soldierofcode.com/deja-vu"
1051
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}header"
1052
+ @@module_name = "DejaVuNS"
1053
+ @@safe_name = "DejaVuNS_header"
1054
+ @@attributes = [
1055
+ [ :@name, "name" ],
1056
+ [ :@value, "value" ],
1057
+ ]
1058
+
1059
+ def name
1060
+ accessed
1061
+ @name
1062
+ end
1063
+
1064
+ def name=(v)
1065
+ accessed
1066
+ changed
1067
+ @name = v
1068
+ end
1069
+
1070
+ def value
1071
+ accessed
1072
+ @value
1073
+ end
1074
+
1075
+ def value=(v)
1076
+ accessed
1077
+ changed
1078
+ @value = v
1079
+ end
1080
+
1081
+ def initialize
1082
+ super
1083
+
1084
+ @name = nil if not defined? @name
1085
+ @value = nil if not defined? @value
1086
+
1087
+ init_xampl_object
1088
+
1089
+ yield(self) if block_given?
1090
+ init_hook
1091
+
1092
+ changed
1093
+ end
1094
+
1095
+ def clear_non_persistent_index_attributes
1096
+ @name = nil
1097
+ @value = nil
1098
+ end
1099
+
1100
+ def append_to(other)
1101
+ other.add_header(self)
1102
+ end
1103
+
1104
+ def Header.persisted?
1105
+ return nil
1106
+ end
1107
+
1108
+ def persisted?
1109
+ return nil
1110
+ end
1111
+
1112
+ def Header.tag
1113
+ @@tag
1114
+ end
1115
+
1116
+ def Header.ns
1117
+ @@ns
1118
+ end
1119
+
1120
+ def Header.ns_tag
1121
+ @@ns_tag
1122
+ end
1123
+
1124
+ def Header.safe_name
1125
+ @@safe_name
1126
+ end
1127
+
1128
+ def Header.module_name
1129
+ @@module_name
1130
+ end
1131
+
1132
+ def tag
1133
+ @@tag
1134
+ end
1135
+
1136
+ def ns
1137
+ @@ns
1138
+ end
1139
+
1140
+ def ns_tag
1141
+ @@ns_tag
1142
+ end
1143
+
1144
+ def safe_name
1145
+ @@safe_name
1146
+ end
1147
+
1148
+ def module_name
1149
+ @@module_name
1150
+ end
1151
+
1152
+ def attributes
1153
+ @@attributes
1154
+ end
1155
+
1156
+ def substitute_in_visit(visitor)
1157
+ return visitor.substitute_in_visit_header(self) || self
1158
+ end
1159
+
1160
+ def before_visit(visitor)
1161
+ visitor.before_visit_header(self)
1162
+ end
1163
+
1164
+ def visit(visitor)
1165
+ visitor.visit_header(self)
1166
+ end
1167
+
1168
+ def after_visit(visitor)
1169
+ visitor.after_visit_header(self)
1170
+ end
1171
+
1172
+ Xampl::FromXML::register(Header::tag, Header::ns_tag, Header)
1173
+ end
1174
+
1175
+ class Body
1176
+ include Xampl::XamplObject
1177
+ include Xampl::XamplWithSimpleContent
1178
+
1179
+ @@tag = "body"
1180
+ @@ns = "http://soldierofcode.com/deja-vu"
1181
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}body"
1182
+ @@module_name = "DejaVuNS"
1183
+ @@safe_name = "DejaVuNS_body"
1184
+ @@attributes = [
1185
+ ]
1186
+
1187
+ def initialize
1188
+ super
1189
+
1190
+ init_xampl_object
1191
+
1192
+ yield(self) if block_given?
1193
+ init_hook
1194
+
1195
+ changed
1196
+ end
1197
+
1198
+ def clear_non_persistent_index_attributes
1199
+ end
1200
+
1201
+ def append_to(other)
1202
+ other.add_body(self)
1203
+ end
1204
+
1205
+ def Body.persisted?
1206
+ return nil
1207
+ end
1208
+
1209
+ def persisted?
1210
+ return nil
1211
+ end
1212
+
1213
+ def Body.tag
1214
+ @@tag
1215
+ end
1216
+
1217
+ def Body.ns
1218
+ @@ns
1219
+ end
1220
+
1221
+ def Body.ns_tag
1222
+ @@ns_tag
1223
+ end
1224
+
1225
+ def Body.safe_name
1226
+ @@safe_name
1227
+ end
1228
+
1229
+ def Body.module_name
1230
+ @@module_name
1231
+ end
1232
+
1233
+ def tag
1234
+ @@tag
1235
+ end
1236
+
1237
+ def ns
1238
+ @@ns
1239
+ end
1240
+
1241
+ def ns_tag
1242
+ @@ns_tag
1243
+ end
1244
+
1245
+ def safe_name
1246
+ @@safe_name
1247
+ end
1248
+
1249
+ def module_name
1250
+ @@module_name
1251
+ end
1252
+
1253
+ def attributes
1254
+ @@attributes
1255
+ end
1256
+
1257
+ def substitute_in_visit(visitor)
1258
+ return visitor.substitute_in_visit_body(self) || self
1259
+ end
1260
+
1261
+ def before_visit(visitor)
1262
+ visitor.before_visit_body(self)
1263
+ end
1264
+
1265
+ def visit(visitor)
1266
+ visitor.visit_body(self)
1267
+ end
1268
+
1269
+ def after_visit(visitor)
1270
+ visitor.after_visit_body(self)
1271
+ end
1272
+
1273
+ Xampl::FromXML::register(Body::tag, Body::ns_tag, Body)
1274
+ end
1275
+
1276
+ class Param
1277
+ include Xampl::XamplObject
1278
+ include Xampl::XamplWithoutContent
1279
+
1280
+ @@tag = "param"
1281
+ @@ns = "http://soldierofcode.com/deja-vu"
1282
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}param"
1283
+ @@module_name = "DejaVuNS"
1284
+ @@safe_name = "DejaVuNS_param"
1285
+ @@attributes = [
1286
+ [ :@name, "name" ],
1287
+ [ :@value, "value" ],
1288
+ ]
1289
+
1290
+ def name
1291
+ accessed
1292
+ @name
1293
+ end
1294
+
1295
+ def name=(v)
1296
+ accessed
1297
+ changed
1298
+ @name = v
1299
+ end
1300
+
1301
+ def value
1302
+ accessed
1303
+ @value
1304
+ end
1305
+
1306
+ def value=(v)
1307
+ accessed
1308
+ changed
1309
+ @value = v
1310
+ end
1311
+
1312
+ def initialize
1313
+ super
1314
+
1315
+ @name = nil if not defined? @name
1316
+ @value = nil if not defined? @value
1317
+
1318
+ init_xampl_object
1319
+
1320
+ yield(self) if block_given?
1321
+ init_hook
1322
+
1323
+ changed
1324
+ end
1325
+
1326
+ def clear_non_persistent_index_attributes
1327
+ @name = nil
1328
+ @value = nil
1329
+ end
1330
+
1331
+ def append_to(other)
1332
+ other.add_param(self)
1333
+ end
1334
+
1335
+ def Param.persisted?
1336
+ return nil
1337
+ end
1338
+
1339
+ def persisted?
1340
+ return nil
1341
+ end
1342
+
1343
+ def Param.tag
1344
+ @@tag
1345
+ end
1346
+
1347
+ def Param.ns
1348
+ @@ns
1349
+ end
1350
+
1351
+ def Param.ns_tag
1352
+ @@ns_tag
1353
+ end
1354
+
1355
+ def Param.safe_name
1356
+ @@safe_name
1357
+ end
1358
+
1359
+ def Param.module_name
1360
+ @@module_name
1361
+ end
1362
+
1363
+ def tag
1364
+ @@tag
1365
+ end
1366
+
1367
+ def ns
1368
+ @@ns
1369
+ end
1370
+
1371
+ def ns_tag
1372
+ @@ns_tag
1373
+ end
1374
+
1375
+ def safe_name
1376
+ @@safe_name
1377
+ end
1378
+
1379
+ def module_name
1380
+ @@module_name
1381
+ end
1382
+
1383
+ def attributes
1384
+ @@attributes
1385
+ end
1386
+
1387
+ def substitute_in_visit(visitor)
1388
+ return visitor.substitute_in_visit_param(self) || self
1389
+ end
1390
+
1391
+ def before_visit(visitor)
1392
+ visitor.before_visit_param(self)
1393
+ end
1394
+
1395
+ def visit(visitor)
1396
+ visitor.visit_param(self)
1397
+ end
1398
+
1399
+ def after_visit(visitor)
1400
+ visitor.after_visit_param(self)
1401
+ end
1402
+
1403
+ Xampl::FromXML::register(Param::tag, Param::ns_tag, Param)
1404
+ end
1405
+
1406
+ class MultipartReference
1407
+ include Xampl::XamplObject
1408
+ include Xampl::XamplWithoutContent
1409
+
1410
+ @@tag = "multipart-reference"
1411
+ @@ns = "http://soldierofcode.com/deja-vu"
1412
+ @@ns_tag = "{http://soldierofcode.com/deja-vu}multipart-reference"
1413
+ @@module_name = "DejaVuNS"
1414
+ @@safe_name = "DejaVuNS_multipart_reference"
1415
+ @@attributes = [
1416
+ [ :@name, "name" ],
1417
+ [ :@file_path, "file_path" ],
1418
+ ]
1419
+
1420
+ def name
1421
+ accessed
1422
+ @name
1423
+ end
1424
+
1425
+ def name=(v)
1426
+ accessed
1427
+ changed
1428
+ @name = v
1429
+ end
1430
+
1431
+ def file_path
1432
+ accessed
1433
+ @file_path
1434
+ end
1435
+
1436
+ def file_path=(v)
1437
+ accessed
1438
+ changed
1439
+ @file_path = v
1440
+ end
1441
+
1442
+ def initialize
1443
+ super
1444
+
1445
+ @name = nil if not defined? @name
1446
+ @file_path = nil if not defined? @file_path
1447
+
1448
+ init_xampl_object
1449
+
1450
+ yield(self) if block_given?
1451
+ init_hook
1452
+
1453
+ changed
1454
+ end
1455
+
1456
+ def clear_non_persistent_index_attributes
1457
+ @name = nil
1458
+ @file_path = nil
1459
+ end
1460
+
1461
+ def append_to(other)
1462
+ other.add_multipart_reference(self)
1463
+ end
1464
+
1465
+ def MultipartReference.persisted?
1466
+ return nil
1467
+ end
1468
+
1469
+ def persisted?
1470
+ return nil
1471
+ end
1472
+
1473
+ def MultipartReference.tag
1474
+ @@tag
1475
+ end
1476
+
1477
+ def MultipartReference.ns
1478
+ @@ns
1479
+ end
1480
+
1481
+ def MultipartReference.ns_tag
1482
+ @@ns_tag
1483
+ end
1484
+
1485
+ def MultipartReference.safe_name
1486
+ @@safe_name
1487
+ end
1488
+
1489
+ def MultipartReference.module_name
1490
+ @@module_name
1491
+ end
1492
+
1493
+ def tag
1494
+ @@tag
1495
+ end
1496
+
1497
+ def ns
1498
+ @@ns
1499
+ end
1500
+
1501
+ def ns_tag
1502
+ @@ns_tag
1503
+ end
1504
+
1505
+ def safe_name
1506
+ @@safe_name
1507
+ end
1508
+
1509
+ def module_name
1510
+ @@module_name
1511
+ end
1512
+
1513
+ def attributes
1514
+ @@attributes
1515
+ end
1516
+
1517
+ def substitute_in_visit(visitor)
1518
+ return visitor.substitute_in_visit_multipart_reference(self) || self
1519
+ end
1520
+
1521
+ def before_visit(visitor)
1522
+ visitor.before_visit_multipart_reference(self)
1523
+ end
1524
+
1525
+ def visit(visitor)
1526
+ visitor.visit_multipart_reference(self)
1527
+ end
1528
+
1529
+ def after_visit(visitor)
1530
+ visitor.after_visit_multipart_reference(self)
1531
+ end
1532
+
1533
+ Xampl::FromXML::register(MultipartReference::tag, MultipartReference::ns_tag, MultipartReference)
1534
+ end
1535
+
1536
+ end