incubator-composer-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject svn commit: r618171 - in /incubator/composer/trunk/composer-core: apache-composer-core.iml pom.xml src/main/java/org/apache/composer/core/web/ src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java
Date Mon, 04 Feb 2008 05:41:58 GMT
Author: hammant
Date: Sun Feb  3 21:41:55 2008
New Revision: 618171

URL: http://svn.apache.org/viewvc?rev=618171&view=rev
Log:
http session adapter added from gems

Added:
    incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/
    incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java
Modified:
    incubator/composer/trunk/composer-core/apache-composer-core.iml
    incubator/composer/trunk/composer-core/pom.xml

Modified: incubator/composer/trunk/composer-core/apache-composer-core.iml
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/apache-composer-core.iml?rev=618171&r1=618170&r2=618171&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/apache-composer-core.iml (original)
+++ incubator/composer/trunk/composer-core/apache-composer-core.iml Sun Feb  3 21:41:55 2008
@@ -23,6 +23,15 @@
     <orderEntry type="module-library">
       <library>
         <CLASSES>
+          <root url="jar://$M2_REPOSITORY$/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar!/"
/>
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
           <root url="jar://$M2_REPOSITORY$/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar!/"
/>
         </CLASSES>
         <JAVADOC />

Modified: incubator/composer/trunk/composer-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/pom.xml?rev=618171&r1=618170&r2=618171&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/pom.xml (original)
+++ incubator/composer/trunk/composer-core/pom.xml Sun Feb  3 21:41:55 2008
@@ -45,7 +45,14 @@
           <artifactId>cglib-nodep</artifactId>
           <scope>provided</scope>
       </dependency>
-      
+      <!-- For proxy -->
+      <dependency>
+          <groupId>javax.servlet</groupId>
+          <artifactId>servlet-api</artifactId>
+          <version>2.3</version>
+          <optional>true</optional>
+      </dependency>
+
   </dependencies>
 
   <build>

Added: incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java?rev=618171&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java
(added)
+++ incubator/composer/trunk/composer-core/src/main/java/org/apache/composer/core/web/HttpSessionStoringAdapter.java
Sun Feb  3 21:41:55 2008
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.composer.core.web;
+
+
+import org.apache.composer.core.behaviors.Storing;
+
+import javax.servlet.http.HttpSession;
+
+/** @author Paul Hammant */
+public class HttpSessionStoringAdapter {
+
+    private Storing storingBehavior;
+    private final String name;
+
+    public HttpSessionStoringAdapter(Storing storingBehavior, String name) {
+        this.storingBehavior = storingBehavior;
+        this.name = name;
+    }
+
+    public synchronized void retrieveOrCreateStore(HttpSession session) {
+        Storing.StoreWrapper sr = (Storing.StoreWrapper)session.getAttribute(name);
+        if (sr != null) {
+            storingBehavior.putCacheForThread(sr);
+        } else {
+            session.setAttribute(name, storingBehavior.resetCacheForThread());
+
+        }
+    }
+
+    public void resetStore() {
+        storingBehavior.resetCacheForThread();
+    }
+
+    public void invalidateStore() {
+        storingBehavior.invalidateCacheForThread();
+    }
+
+}
\ No newline at end of file



Mime
View raw message