PageRenderTime 99ms CodeModel.GetById 81ms app.highlight 10ms RepoModel.GetById 7ms app.codeStats 0ms

/tools/Ruby/lib/ruby/1.8/soap/encodingstyle/handler.rb

http://github.com/agross/netopenspace
Ruby | 100 lines | 61 code | 26 blank | 13 comment | 0 complexity | e619f86af9b6350ec44e01c9f18e94e5 MD5 | raw file
  1# SOAP4R - EncodingStyle handler library
  2# Copyright (C) 2001, 2003  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
  3
  4# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
  5# redistribute it and/or modify it under the same terms of Ruby's license;
  6# either the dual license version in 2003, or any later version.
  7
  8
  9require 'soap/soap'
 10require 'soap/baseData'
 11require 'soap/element'
 12
 13
 14module SOAP
 15module EncodingStyle
 16
 17
 18class Handler
 19  @@handlers = {}
 20
 21  class EncodingStyleError < Error; end
 22
 23  class << self
 24    def uri
 25      self::Namespace
 26    end
 27
 28    def handler(uri)
 29      @@handlers[uri]
 30    end
 31
 32    def each
 33      @@handlers.each do |key, value|
 34	yield(value)
 35      end
 36    end
 37
 38  private
 39
 40    def add_handler
 41      @@handlers[self.uri] = self
 42    end
 43  end
 44
 45  attr_reader :charset
 46  attr_accessor :generate_explicit_type
 47  def decode_typemap=(definedtypes)
 48    @decode_typemap = definedtypes
 49  end
 50
 51  def initialize(charset)
 52    @charset = charset
 53    @generate_explicit_type = true
 54    @decode_typemap = nil
 55  end
 56
 57  ###
 58  ## encode interface.
 59  #
 60  # Returns a XML instance as a string.
 61  def encode_data(generator, ns, data, parent)
 62    raise NotImplementError
 63  end
 64
 65  def encode_data_end(generator, ns, data, parent)
 66    raise NotImplementError
 67  end
 68
 69  def encode_prologue
 70  end
 71
 72  def encode_epilogue
 73  end
 74
 75  ###
 76  ## decode interface.
 77  #
 78  # Returns SOAP/OM data.
 79  def decode_tag(ns, name, attrs, parent)
 80    raise NotImplementError.new('Method decode_tag must be defined in derived class.')
 81  end
 82
 83  def decode_tag_end(ns, name)
 84    raise NotImplementError.new('Method decode_tag_end must be defined in derived class.')
 85  end
 86
 87  def decode_text(ns, text)
 88    raise NotImplementError.new('Method decode_text must be defined in derived class.')
 89  end
 90
 91  def decode_prologue
 92  end
 93
 94  def decode_epilogue
 95  end
 96end
 97
 98
 99end
100end