siffer 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/LICENSE +1 -1
  2. data/README +63 -93
  3. data/Rakefile +60 -0
  4. data/bin/siffer +12 -0
  5. data/lib/sif.rb +38 -0
  6. data/lib/sif/code_sets.rb +9 -0
  7. data/lib/sif/code_sets/access_permission_error_codes.rb +17 -0
  8. data/lib/sif/code_sets/authentication_error_codes.rb +15 -0
  9. data/lib/sif/code_sets/base_code_set.rb +75 -0
  10. data/lib/sif/code_sets/encryption_error_codes.rb +6 -0
  11. data/lib/sif/code_sets/error_category_codes.rb +20 -0
  12. data/lib/sif/code_sets/event_reporting_processing_error_codes.rb +7 -0
  13. data/lib/sif/code_sets/generic_message_handling_error_codes.rb +12 -0
  14. data/lib/sif/code_sets/provision_error_codes.rb +8 -0
  15. data/lib/sif/code_sets/registration_error_codes.rb +13 -0
  16. data/lib/sif/code_sets/request_response_error_codes.rb +20 -0
  17. data/lib/sif/code_sets/smb_error_codes.rb +9 -0
  18. data/lib/sif/code_sets/status_codes.rb +13 -0
  19. data/lib/sif/code_sets/subscription_error_codes.rb +7 -0
  20. data/lib/sif/code_sets/system_error_codes.rb +6 -0
  21. data/lib/sif/code_sets/transport_error_codes.rb +9 -0
  22. data/lib/sif/code_sets/xml_validation_error_codes.rb +10 -0
  23. data/lib/sif/config.rb +100 -0
  24. data/lib/sif/core_ext/array.rb +12 -0
  25. data/lib/sif/error.rb +34 -0
  26. data/lib/sif/exceptions.rb +9 -0
  27. data/lib/sif/messages.rb +3 -0
  28. data/lib/sif/messages/ack.rb +29 -0
  29. data/lib/sif/messages/message.rb +32 -0
  30. data/lib/sif/messages/register.rb +38 -0
  31. data/lib/sif/protocols.rb +15 -0
  32. data/lib/sif/status.rb +17 -0
  33. data/lib/siffer.rb +1 -41
  34. data/spec/base_code_set_spec.rb +35 -0
  35. data/spec/config_spec.rb +42 -0
  36. data/spec/error_spec.rb +11 -0
  37. data/spec/messages/ack_spec.rb +25 -0
  38. data/spec/messages/header_spec.rb +21 -0
  39. data/spec/messages/message_spec.rb +27 -0
  40. data/spec/messages/register_spec.rb +53 -0
  41. data/spec/protocol_spec.rb +11 -0
  42. data/spec/spec_helper.rb +8 -0
  43. metadata +66 -31
  44. data/lib/siffer/agent.rb +0 -53
  45. data/lib/siffer/core_ext/hash.rb +0 -15
  46. data/lib/siffer/messages.rb +0 -41
  47. data/lib/siffer/messages/ack.rb +0 -168
  48. data/lib/siffer/messages/event.rb +0 -20
  49. data/lib/siffer/messages/message.rb +0 -60
  50. data/lib/siffer/messages/provide.rb +0 -25
  51. data/lib/siffer/messages/provision.rb +0 -17
  52. data/lib/siffer/messages/register.rb +0 -50
  53. data/lib/siffer/messages/request.rb +0 -138
  54. data/lib/siffer/messages/response.rb +0 -48
  55. data/lib/siffer/messages/subscribe.rb +0 -17
  56. data/lib/siffer/messages/system_control.rb +0 -94
  57. data/lib/siffer/models.rb +0 -1
  58. data/lib/siffer/models/address.rb +0 -39
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2009 Clint Hill - h3o(software)
1
+ Copyright (c) 2008 h3o(software)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -1,93 +1,63 @@
1
- = Siffer - h3o(software) SIF Implementation
2
-
3
- == Welcome to Siffer
4
-
5
- This is the h3o(software) implementation of the SIF (School Interoperability
6
- Framework) in Ruby. The project is Ruby based and includes all of the SIF
7
- infrastructure (Data Model, Agents, Zone Integration Servers and even database
8
- stores).
9
-
10
- Siffer is a platform - not a development kit. Certainly it's open source and
11
- you can take this code and do as you wish. However, Siffer provides out of the
12
- box all the things you need to run a SIF environment.
13
-
14
- Simply put you can do one of two things with Siffer:
15
-
16
- 1) You can download it and run the admin server and setup Servers and Agents.
17
- 2) You can download it and write the code to build your own Servers and Agents.
18
-
19
-
20
- It's currently incomplete - Stay Tuned!
21
-
22
- == Goal
23
-
24
- The overriding goal of this project is to provide anyone in the education
25
- industry a quick, easy and simple SIF implementation tool.
26
-
27
- == Philosophy
28
-
29
- Remove the complexity from the implementation. Make the execution and
30
- deployment of SIF easy.
31
-
32
- Make SIF more REST'ful. As much as possible expose the actions and data models
33
- through the URI and URL of ZIS and Agent components.
34
-
35
- Make SIF more useful. As much as possible remove the "XML" and "Database"
36
- questions out of the equation.
37
-
38
- Make it simple. Make it easy. Make it fun. Make it intuitive.
39
- Make it do exactly what needs to be done.
40
- You're too busy for anything else.
41
-
42
- == Implementation Information (sifinfo.org)
43
-
44
- This implementation is based on version 2.3 of the SIF Specification.
45
- It can be found here: http://specification.sifinfo.org/Implementation/2.3/
46
-
47
- More information here: http://sifinfo.org.
48
-
49
- == Description of Contents
50
-
51
- == Useage
52
-
53
- % siffer start agent "default agent" -p 8001 -d
54
- % siffer start server "default zis" -p 8002 -d
55
-
56
- % siffer stop agent "default agent"
57
- % siffer stop server "default zis"
58
-
59
- Or from the admin browser !!!
60
-
61
- % siffer start admin
62
-
63
- open http://0.0.0.0:2828 from any browser and enjoy!
64
-
65
- == License
66
-
67
- Siffer is released under the MIT License
68
-
69
- == Installation
70
-
71
- Siffer can be installed from the siffer gem:
72
-
73
- % [sudo] gem install siffer
74
-
75
- == Support
76
-
77
- Please contact the author (clint.hill@h3osoftware.com) for support
78
- issues. If you want to contribute do the same.
79
-
80
- === Contributors
81
-
82
- This project is developed by spec. Build spec tests (RSpec) for all of
83
- your features. Document everything.
84
-
85
- Fork the project and then make a pull request.
86
- http://github.com/clinth3o/siffer
87
-
88
- == Contact
89
-
90
- - Author:: Clint Hill clint.hill@h3osoftware.com
91
- - Home Page:: http://h3osoftware.com/siffer
92
- - GitHub:: git://github.com/clinth3o/siffer.git
93
- - RubyForge:: http://rubyforge.org/projects/siffer/
1
+ = Project: Siffer - h3o(software) SIF Implementation
2
+
3
+ == Welcome to Siffer
4
+
5
+ This is the h3o(software) implementation of the SIF (School Interoperability Framework) in Ruby.
6
+ The project is Ruby based and includes all of the SIF infrastructure (Data Model, Agents, Zone Integration
7
+ Servers and even database stores).
8
+
9
+ == Goal
10
+
11
+ The overriding goal of this project is to provide anyone in the education industry a quick, easy and
12
+ small SIF implementation tool. Sane Defaults in front of easy Configurations.
13
+
14
+ === Setup and Deployment
15
+
16
+ Siffer is easy to install and setup. Zone Integration Servers and Agents can be created at the command
17
+ line. Zone Integration Servers are managed by web based interfaces and Agents will be centrally managed
18
+ by a web based interface. Administrators will be able to manage all components of their deployment from a browser.
19
+
20
+ == Philosophy
21
+
22
+ Remove the complexity from the implementation. Make the execution and deployment of SIF easy.
23
+
24
+ == Implementation Information (sifinfo.org)
25
+
26
+ This implementation is based on version 2.2 of the SIF Specification. The Specification is in
27
+ {PDF}[link:../SIF%20ImplementationSpecification.pdf] format inside the docs folder.
28
+
29
+
30
+ More information here: http://sifinfo.org.
31
+
32
+ == Description of Contents
33
+
34
+ == Useage
35
+
36
+ == License
37
+
38
+ Siffer is released under the MIT License
39
+
40
+ == Installation
41
+
42
+ Siffer can be installed from the siffer gem:
43
+
44
+ % [sudo] gem install siffer
45
+
46
+ == Support
47
+
48
+ Please contact the author (mailto://clint.hill@h3osoftware.com) for support issues. If you want to
49
+ contribute do the same.
50
+
51
+ === Contributors
52
+
53
+ This project is developed by spec. Build spec tests for all of your features. Document everything.
54
+
55
+ == Contact
56
+
57
+ Author:: Clint Hill
58
+ Email:: mailto://clint.hill@h3osoftware.com
59
+ Home Page:: http://h3osoftware.com/siffer
60
+ SVN:: http://svn.h3osoftware.com/siffer
61
+
62
+
63
+
data/Rakefile ADDED
@@ -0,0 +1,60 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/gempackagetask'
4
+ require "rake/rdoctask"
5
+ require 'spec/rake/spectask'
6
+ require 'fileutils'
7
+ include FileUtils
8
+ require File.join(File.dirname(__FILE__),"lib","sif")
9
+ include Siffer
10
+
11
+ NAME = "siffer"
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = NAME
15
+ s.version = Siffer.version
16
+ s.platform = Gem::Platform::RUBY
17
+ s.author = "Clint Hill"
18
+ s.email = "clint.hill@h3osoftware.com"
19
+ s.homepage = "http://h3osoftware.com/siffer"
20
+ s.summary = "Siffer - School Interoperability Framework by h3o(software)"
21
+ s.rubyforge_project = "siffer"
22
+ s.require_path = "lib"
23
+ s.files = %w( LICENSE README Rakefile ) + Dir["{spec,lib,doc}/**/*"]
24
+ s.bindir = "bin"
25
+ s.executables = %w( siffer )
26
+ s.add_dependency "uuid"
27
+ s.required_ruby_version = ">= 1.8.7"
28
+ end
29
+
30
+ Rake::GemPackageTask.new(spec) do |package|
31
+ package.gem_spec = spec
32
+ end
33
+
34
+ ##############################################################################
35
+ # rSpec
36
+ ##############################################################################
37
+ desc 'Run all specs'
38
+ task :spec => ["spec:default"]
39
+
40
+ namespace :spec do
41
+ Spec::Rake::SpecTask.new('default') do |t|
42
+ t.spec_opts = ["--format", "specdoc", "--colour"]
43
+ t.spec_files = Dir['spec/**/*_spec.rb'].sort
44
+ end
45
+ end
46
+
47
+ ##############################################################################
48
+ # Documentation
49
+ ##############################################################################
50
+ task :doc => ["doc:rdoc"]
51
+ namespace :doc do
52
+ Rake::RDocTask.new do |rdoc|
53
+ files = ["README","LICENSE","lib/**/*.rb"]
54
+ rdoc.rdoc_files.add(files)
55
+ rdoc.main = "README"
56
+ rdoc.title = "Siffer == h3o(software) SIF"
57
+ rdoc.rdoc_dir = "docs/rdoc"
58
+ rdoc.options << "--line-numbers" << "--inline-source"
59
+ end
60
+ end
data/bin/siffer ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+
6
+ app_help = <<-EOF
7
+ =========================================
8
+ === h3o(software) siffer generator ===
9
+ =========================================
10
+ EOF
11
+
12
+ puts app_help
data/lib/sif.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'rubygems'
2
+ require 'uuid'
3
+
4
+ $: << File.expand_path(File.dirname(__FILE__))
5
+
6
+ module Siffer
7
+
8
+ VENDOR = "h3o(software)" unless defined?(Siffer::VENDOR)
9
+ VERSION = [0,1,0] unless defined?(Siffer::VERSION)
10
+ SIF_VERSION = [2,2,0] unless defined?(Siffer::SIF_VERSION)
11
+ SIF_XMLNS = "http://www.sifinfo.org/infrastructure/2.x" unless defined?(Siffer::SIF_XMLNS)
12
+
13
+ # The version of the h3o(software) SIF implementation
14
+ def self.version() VERSION.join(".") end
15
+
16
+ # The version of SIF being implemented - based on the specification
17
+ def self.sif_version() SIF_VERSION.join(".") end
18
+
19
+ # The SIF XML namespace to be used across this implementation
20
+ def self.sif_xmlns() SIF_XMLNS end
21
+
22
+ # The root directory that the SIF implementation is running from
23
+ def self.root() @root ||= Dir.pwd end
24
+ def self.root=(value) @root = value end
25
+
26
+ autoload :Messages, "sif/messages"
27
+ autoload :Exceptions, "sif/exceptions"
28
+ autoload :Protocols, "sif/protocols"
29
+ autoload :CodeSets, "sif/code_sets"
30
+
31
+ end
32
+ require "sif/config"
33
+ require "sif/status"
34
+ require "sif/error"
35
+ require "sif/core_ext/array"
36
+ class Array
37
+ include Siffer::CoreExtensions::Array::ExtractOptions
38
+ end
@@ -0,0 +1,9 @@
1
+ require 'lib/sif/code_sets/base_code_set'
2
+ %w[access_permission_error_codes authentication_error_codes encryption_error_codes
3
+ error_category_codes event_reporting_processing_error_codes generic_message_handling_error_codes
4
+ provision_error_codes registration_error_codes request_response_error_codes smb_error_codes
5
+ status_codes subscription_error_codes system_error_codes transport_error_codes
6
+ xml_validation_error_codes].each do |codes|
7
+ require "lib/sif/code_sets/#{codes}"
8
+ end
9
+
@@ -0,0 +1,17 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class AccessPermissionErrorCode < BaseCodeSet; end
4
+ AccessPermissionErrorCode.register(1,:generic,"Generic error")
5
+ AccessPermissionErrorCode.register(2,:register,"No permission to register")
6
+ AccessPermissionErrorCode.register(3,:provide,"No permission to provide this object")
7
+ AccessPermissionErrorCode.register(4,:subscribe,"No permission to subscribe to this SIF_Event")
8
+ AccessPermissionErrorCode.register(5,:requrest,"No permission to request this object")
9
+ AccessPermissionErrorCode.register(6,:responsd,"No permission to respond to this object request")
10
+ AccessPermissionErrorCode.register(7,:publish,"No permission to publish SIF_Event")
11
+ AccessPermissionErrorCode.register(8,:administer,"No permission to administer policies")
12
+ AccessPermissionErrorCode.register(9,:source_not_registered,"SIF_SourceId is not registered")
13
+ AccessPermissionErrorCode.register(10,:publish_add,"No permission to publish SIF_Event Add")
14
+ AccessPermissionErrorCode.register(11,:publish_change,"No permission to publish SIF_Event Change")
15
+ AccessPermissionErrorCode.register(12,:publish_delete,"No permission to publish SIF_Event Delete")
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class AuthenticationErrorCode < BaseCodeSet; end
4
+ AuthenticationErrorCode.register(1,:generic,"Generic error")
5
+ AuthenticationErrorCode.register(2,:generic_with_signature,"Generic authentication error (with signature)")
6
+ AuthenticationErrorCode.register(3,:missing_certification,"Missing sender's certificate")
7
+ AuthenticationErrorCode.register(4,:invalid_certificate,"Invalid certificate")
8
+ AuthenticationErrorCode.register(5,:not_trusted,"Sender's certificate is not trusted")
9
+ AuthenticationErrorCode.register(6,:expired,"Expired certificate")
10
+ AuthenticationErrorCode.register(7,:invalid_signature,"Invalid signature")
11
+ AuthenticationErrorCode.register(8,:invalid_encryption,"Invalid encryption algorithm (only accepts MD4)")
12
+ AuthenticationErrorCode.register(9,:missing_public_key,"Missing public key of the receiver (when decrypting message)")
13
+ AuthenticationErrorCode.register(10,:missing_private_key,"Missing receiver's private key (when decrypting message)")
14
+ end
15
+ end
@@ -0,0 +1,75 @@
1
+ module Siffer
2
+ module CodeSets
3
+ # This class supports a base for all Code Sets.
4
+ # It allows for a class to implement a symbol,
5
+ # code and a description.
6
+ #
7
+ # Example:
8
+ # def GenericCode < BaseCodeSet; end
9
+ # Siffer::CodeSets::GenericCode.register(0,:generic, "Generic Error")
10
+ # @error = Siffer::CodeSets::GenericCode[:generic]
11
+ # @error == 0
12
+ # #=> true
13
+ # @error == :generic
14
+ # #=> true
15
+ # puts @error.description
16
+ # #=> "Generic Error"
17
+ # @error == Siffer::CodeSets::GenericCode[:generic]
18
+ # #=> true
19
+ # @error.generic?
20
+ # #=> true
21
+ class BaseCodeSet
22
+
23
+ attr_reader :description
24
+ SET = []
25
+
26
+ def initialize(code, symbol, description)
27
+ @code = code
28
+ @symbol = symbol
29
+ @description = description
30
+ end
31
+
32
+ def to_s
33
+ @description
34
+ end
35
+
36
+ def to_str
37
+ to_s
38
+ end
39
+
40
+ def to_sym
41
+ @symbol
42
+ end
43
+
44
+ def ==(obj)
45
+ return @symbol == obj if obj.kind_of? Symbol
46
+ return @code == obj if obj.kind_of? Integer
47
+ end
48
+
49
+ class << self
50
+ def register(code, symbol, description)
51
+ self.instance_eval { const_set symbol.to_s.upcase, self.new(code,symbol,description) }
52
+ SET << self.const_get(symbol.to_s.upcase)
53
+ end
54
+
55
+ def [](index)
56
+ SET.each do |status|
57
+ return status if status == index
58
+ end
59
+ raise Exceptions::InvalidErrorCode, "#{index} code not found in #{self.name} codes."
60
+ end
61
+
62
+ end
63
+
64
+ private
65
+ def method_missing(method, *args)
66
+ if method.to_s =~ /(\w+)\?$/
67
+ $1.downcase.to_sym == to_sym
68
+ else
69
+ super
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,6 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class EncryptionErrorCode < BaseCodeSet; end
4
+ EncryptionErrorCode.register(1,:generic,"Generic error")
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class ErrorCategoryCode < BaseCodeSet; end
4
+ ErrorCategoryCode.register(0,:unknown,"This should never be used if possible.")
5
+ ErrorCategoryCode.register(1,:xml_validation, "XML Validation")
6
+ ErrorCategoryCode.register(2,:encryption,"Encryption")
7
+ ErrorCategoryCode.register(3,:authentication,"Authentication")
8
+ ErrorCategoryCode.register(4,:access_and_permissions,"Access and Permissions")
9
+ ErrorCategoryCode.register(5,:registration,"Registration")
10
+ ErrorCategoryCode.register(6,:provision,"Provision")
11
+ ErrorCategoryCode.register(7,:subscription,"Subscription")
12
+ ErrorCategoryCode.register(8,:requrest_and_response,"Request and Response")
13
+ ErrorCategoryCode.register(9,:event_reporting_and_processing,"Event Reporting and Processing")
14
+ ErrorCategoryCode.register(10,:transport,"Transport")
15
+ ErrorCategoryCode.register(11,:system,"System (OS, Database, Vendor localized, etc.)")
16
+ ErrorCategoryCode.register(12,:generic_message_handling,"Generic Message Handling")
17
+ ErrorCategoryCode.register(13,:smb_handling,"SMB Handling")
18
+ end
19
+ end
20
+
@@ -0,0 +1,7 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class EventReportingProcessingErrorCode < BaseCodeSet; end
4
+ EventReportingProcessingErrorCode.register(1,:generic,"Generic error")
5
+ EventReportingProcessingErrorCode.register(3,:invalid_event,"Invalid event")
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ module Siffer
2
+ module CodeSets
3
+ class GenericMessageHandlingErrorCode < BaseCodeSet; end
4
+ GenericMessageHandlingErrorCode.register(1,:generic,"Generic error")
5
+ GenericMessageHandlingErrorCode.register(2,:message_not_supported,"Message not supported")
6
+ GenericMessageHandlingErrorCode.register(3,:version_not_supported,"Version not supported")
7
+ GenericMessageHandlingErrorCode.register(4,:context_not_supported,"Context not supported")
8
+ GenericMessageHandlingErrorCode.register(5,:protocol_error,"Protocol error")
9
+ GenericMessageHandlingErrorCode.register(6,:no_such_message,"No such message (as identified by SIF_OriginalMsgId)")
10
+ GenericMessageHandlingErrorCode.register(7,:multiple_contexts_not_supported,"Multiple contexts not supported")
11
+ end
12
+ end