Add in hook to only provide the deprecated API when the client doesn't require 'thrif...
authorKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 00:55:29 +0000 (00:55 +0000)
committerKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 00:55:29 +0000 (00:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668908 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/lib/thrift.rb
lib/rb/lib/thrift/protocol/tbinaryprotocol.rb

index 210e60b..9c9c4b2 100644 (file)
 
 $:.unshift File.dirname(__FILE__)
 
-require 'thrift/exceptions'
-TException = Thrift::Exception
-TApplicationException = Thrift::ApplicationException
+module Thrift
+  # prevent the deprecation layer from being loaded if you require 'thrift'
+  DEPRECATION = false unless const_defined? :DEPRECATION
+end
 
+require 'thrift/deprecation'
+require 'thrift/exceptions'
 require 'thrift/types'
-TType = Thrift::Types
-TMessageType = Thrift::MessageTypes
-
 require 'thrift/processor'
-TProcessor = Thrift::Processor
-
 require 'thrift/client'
-ThriftClient = Thrift::Client
-
 require 'thrift/struct'
-ThriftStruct = Thrift::Struct
-
 require 'thrift/protocol/tprotocol'
-TProtocol = Thrift::Protocol
-TProtocolException = Thrift::ProtocolException
-
 require 'thrift/transport/tsocket'
 require 'thrift/transport/ttransport'
-
 require 'thrift/server/tserver'
-
-
-
-
index 3a3fcac..a0618b6 100644 (file)
@@ -183,7 +183,9 @@ module Thrift
   end
 end
 
-TBinaryProtocol = Thrift::BinaryProtocol
+if Thrift::DEPRECATION
+  TBinaryProtocol = Thrift::BinaryProtocol
+end
 
 class TBinaryProtocolFactory < TProtocolFactory
   def getProtocol(trans)