<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,7 +6,7 @@ class ApplicationController &lt; ActionController::Base
 
   # See ActionController::RequestForgeryProtection for details
   # Uncomment the :secret if you're not using the cookie session store
-  protect_from_forgery # :secret =&gt; 'a1f3524526e38614030fe844529da315'
+#  protect_from_forgery :secret =&gt; 'a1f3524526e38614030fe844529da315'
   
   # See ActionController::Base for details 
   # Uncomment this to filter the contents of submitted sensitive data parameters</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
 &lt;appengine-web-app xmlns=&quot;http://appengine.google.com/ns/1.0&quot;&gt;
     &lt;application&gt;yarubyblog&lt;/application&gt;
-    &lt;version&gt;1&lt;/version&gt;
+    &lt;version&gt;2&lt;/version&gt;
     &lt;static-files /&gt;
     &lt;resource-files /&gt;
     &lt;sessions-enabled&gt;true&lt;/sessions-enabled&gt;</diff>
      <filename>appengine-web.xml</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
 
-#require 'big_table_servlet_store'
+require 'big_table_servlet_store'
 
 Rails::Initializer.run do |config|
   # Settings in config/environments/* take precedence over those specified here.
@@ -64,7 +64,8 @@ Rails::Initializer.run do |config|
   # Use the database for sessions instead of the cookie-based default,
   # which shouldn't be used to store highly confidential information
   # (create the session table with &quot;rake db:sessions:create&quot;)
-#  config.action_controller.session_store = :big_table_servlet_store
+  
+  config.action_controller.session_store = :big_table_servlet_store
 
   # Use SQL instead of Active Record's schema dumper when creating the test database.
   # This is necessary if your schema can't be completely dumped by the schema dumper,</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -75,6 +75,8 @@ Warbler::Config.new do |config|
   # the pool will grow as needed to service requests. It is recommended
   # that you fix these values when running a production server!
   config.webxml.jruby.min.runtimes = 1
+  config.webxml.jruby.max.runtimes = 2
+  config.webxml.jruby.runtime.initializer.threads = 1
   # config.webxml.jruby.max.runtimes = 4
 
   # JNDI data source name</diff>
      <filename>config/warble.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,52 +1,53 @@
-# $servlet_context.log(&quot;LOOOOOOOOOOOOOOOOOOOOOOOOOOOADING BigTableServletStore&quot;)
 
-# include_class &quot;com.google.appengine.api.datastore.DatastoreServiceFactory&quot;
-
-# class CGI #:nodoc:all
-#   class Session
-#     class BigTableServletStore
-#       DATASTORE = DatastoreServiceFactory.datastore_service
+module Google
+  import com.google.appengine.api.datastore.DatastoreServiceFactory
+  import com.google.appengine.api.datastore.Entity
+  import com.google.appengine.api.datastore.KeyFactory
+  import com.google.appengine.api.datastore.Key
+  import com.google.appengine.api.datastore.EntityNotFoundException
+end
+
+class CGI #:nodoc:all
+  class Session
+    class BigTableServletStore
+      DATASTORE = Google::DatastoreServiceFactory.datastore_service
+      RAILS_SESSION_ENTITY = &quot;__current_rails_session&quot;
+      RAILS_SESSION_KEY = &quot;__rails_session_data&quot;
       
-#       def initialize(session, option=nil)
-#         $servlet_context.log(&quot;BigTableServletStore.initialize&quot;)
-#       end
-
-#       def restore
-#         $servlet_context.log(&quot;BigTableServletStore.restore&quot;)
-#       end
-
-#       def update
-#         $servlet_context.log(&quot;BigTableServletStore.update&quot;)
-#       end
-
-#       def close
-#         $servlet_context.log(&quot;BigTableServletStore.close&quot;)
-#       end
-
-#       def delete
-#         $servlet_context.log(&quot;BigTableServletStore.delete&quot;)
-#       end
-
-#       def data
-#         $servlet_context.log(&quot;BigTableServletStore.data&quot;)
-#       end
-
-#       def []=(k, v)
-#         $servlet_context.log(&quot;BigTableServletStore.[]=&quot;)
-#       end
-
-#       def [](k)
-#         $servlet_context.log(&quot;BigTableServletStore.[]&quot;)
-#       end
-
-#       def each(&amp;b)
-#         $servlet_context.log(&quot;BigTableServletStore.each&quot;)
-#       end
-
-#       private
-#       # Attempts to redirect any messages to the data object.
-#       def method_missing(name, *args, &amp;block)
-#       end
-#     end
-#   end
-# end
+      def initialize(session, option=nil)
+        @session_id = session.session_id
+        @key = Google::KeyFactory.create_key(RAILS_SESSION_ENTITY, @session_id)
+        @data = {}
+      end
+      def marshal(data)   ActiveSupport::Base64.encode64(Marshal.dump(data)) if data end
+      def unmarshal(data) Marshal.load(ActiveSupport::Base64.decode64(data)) if data end
+
+      # Restore session state from the big table session
+      def restore
+        begin
+          entity = DATASTORE.get(@key)
+          if entity.has_property(RAILS_SESSION_KEY)
+            @data = unmarshal(entity.get_property(RAILS_SESSION_KEY))
+          end
+        rescue Google::EntityNotFoundException
+        end
+        
+        @data
+      end
+
+      def update
+        entity = Google::Entity.new(RAILS_SESSION_ENTITY, @session_id)
+        entity.set_property(RAILS_SESSION_KEY, marshal(@data))
+        DATASTORE.put(entity)
+      end
+
+      def close
+        update
+      end
+
+      def delete
+        DATASTORE.delete(@key)
+      end
+    end
+  end
+end</diff>
      <filename>lib/big_table_servlet_store.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>91a1a333588279fabbfc17439535c3ce044aa136</id>
    </parent>
  </parents>
  <author>
    <name>Ola Bini</name>
    <email>ola.bini@gmail.com</email>
  </author>
  <url>http://github.com/olabini/yarbl/commit/b755ebce59425c8b64054b9b7e0ef36869f9b37c</url>
  <id>b755ebce59425c8b64054b9b7e0ef36869f9b37c</id>
  <committed-date>2009-03-23T06:56:01-07:00</committed-date>
  <authored-date>2009-03-23T06:56:01-07:00</authored-date>
  <message>Update to latest version of everything, including the working big_table_servlet_store.</message>
  <tree>13ca6a1a5d3a4a325b2bdfc9bfd032b66ba78579</tree>
  <committer>
    <name>Ola Bini</name>
    <email>ola.bini@gmail.com</email>
  </committer>
</commit>
