cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1711428 - in /cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347: ./ src/main/java/org/apache/cocoon/callstack/ src/main/java/org/apache/cocoon/servletscope/ src/main/java/org/apache/cocoon/servletservice/spring/
Date Fri, 30 Oct 2015 08:39:05 GMT
Author: ilgrosso
Date: Fri Oct 30 08:39:05 2015
New Revision: 1711428

URL: http://svn.apache.org/viewvc?rev=1711428&view=rev
Log:
[COCOON-2347] Applying provided patches + small reworks (removing deprecates and adding Override)

Added:
    cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/
      - copied from r1700478, cocoon/subprojects/cocoon-servlet-service-impl/trunk/
Modified:
    cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/pom.xml
    cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/callstack/CallScope.java
    cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletscope/ServletScope.java
    cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletservice/spring/ServletDecorator.java

Modified: cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/pom.xml?rev=1711428&r1=1700478&r2=1711428&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/pom.xml (original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/pom.xml Fri Oct 30
08:39:05 2015
@@ -24,12 +24,12 @@
   <parent>
     <artifactId>cocoon</artifactId>
     <groupId>org.apache.cocoon</groupId>
-    <version>9</version>
+    <version>10-COCOON-2347-SNAPSHOT</version>
     <relativePath />
   </parent>
   <artifactId>cocoon-servlet-service-impl</artifactId>
   <packaging>jar</packaging>
-  <version>1.3.3-SNAPSHOT</version>
+  <version>1.3.3-COCOON-2347-SNAPSHOT</version>
   <name>Cocoon Servlet Service Implementation</name>
   <description>
     The servlet service framework makes it easy to use servlets as Spring components.
@@ -61,7 +61,7 @@
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-spring-configurator</artifactId>
-      <version>2.2.1</version>
+      <version>2.2.2-COCOON-2347-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <!-- Spring Framework -->
@@ -92,16 +92,11 @@
     </dependency>
     <dependency>
       <groupId>org.aspectj</groupId>
-      <artifactId>aspectjrt</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.aspectj</groupId>
       <artifactId>aspectjweaver</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-jnet</artifactId>
-      <version>1.2.2</version>
     </dependency>
     <!-- commons -->
     <dependency>
@@ -125,7 +120,7 @@
     <plugins>
       <plugin>
         <artifactId>maven-release-plugin</artifactId>
-        <version>2.3.2</version>
+        <version>2.5.2</version>
         <configuration>
           <tagBase>https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-servlet-service-impl/tags/</tagBase>
         </configuration>
@@ -134,14 +129,14 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.2</version>
+        <version>3.4</version>
         <configuration>
           <locales>en</locales>
           <reportPlugins>
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-project-info-reports-plugin</artifactId>
-              <version>2.6</version>
+              <version>2.8</version>
               <configuration>
                 <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                 <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
@@ -172,7 +167,7 @@
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-javadoc-plugin</artifactId>
-              <version>2.8.1</version>
+              <version>2.10.3</version>
               <reportSets>
                 <reportSet>
                   <reports>

Modified: cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/callstack/CallScope.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/callstack/CallScope.java?rev=1711428&r1=1700478&r2=1711428&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/callstack/CallScope.java
(original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/callstack/CallScope.java
Fri Oct 30 08:39:05 2015
@@ -28,6 +28,7 @@ import org.springframework.beans.factory
  */
 public class CallScope implements Scope {
 
+    @Override
     public Object get(String name, ObjectFactory objectFactory) {
         CallFrame frame = CallStack.getCurrentFrame();
         Object scopedObject = frame.getAttribute(name);
@@ -39,6 +40,7 @@ public class CallScope implements Scope
         return scopedObject;
     }
 
+    @Override
     public Object remove(String name) {
         CallFrame frame = CallStack.getCurrentFrame();
         Object scopedObject = frame.getAttribute(name);
@@ -49,13 +51,20 @@ public class CallScope implements Scope
         return scopedObject;
     }
 
+    @Override
     public String getConversationId() {
         // There is no conversation id concept for the call stack
         return null;
     }
 
+    @Override
     public void registerDestructionCallback(String name, Runnable callback) {
         CallStack.getCurrentFrame().registerDestructionCallback(name, callback);
     }
 
+    @Override
+    public Object resolveContextualObject(String key) {
+        return null;
+    }
+
 }

Modified: cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletscope/ServletScope.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletscope/ServletScope.java?rev=1711428&r1=1700478&r2=1711428&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletscope/ServletScope.java
(original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletscope/ServletScope.java
Fri Oct 30 08:39:05 2015
@@ -25,27 +25,29 @@ import javax.servlet.ServletContext;
 import org.springframework.beans.factory.ObjectFactory;
 import org.springframework.beans.factory.config.Scope;
 
-
 /**
  * Stack based scope implementation. It is based on the CallStack and
  * an object is in scope when it is in the top frame of the stack.
  *
  * @version $Id: CallScope.java 562806 2007-08-05 02:26:41Z vgritsenko $
- * @since 2.2 
+ * @since 2.2
  */
 public class ServletScope implements Scope {
-    
-    static private String destructionCallbacksAttributeName = ServletScope.class.getName()
+ "/destructionCallbacks";
-    
+
+    private static final String DESTRUCTION_CALLBACKS_ATTRIBUTENAME =
+            ServletScope.class.getName() + "/destructionCallbacks";
+
     private ServletContext servletContext;
-    
+
     public void setServletContext(ServletContext servletContext) {
         this.servletContext = servletContext;
     }
 
     /* (non-Javadoc)
-     * @see org.springframework.beans.factory.config.Scope#get(java.lang.String, org.springframework.beans.factory.ObjectFactory)
+     * @see org.springframework.beans.factory.config.Scope#get(java.lang.String,
+     * org.springframework.beans.factory.ObjectFactory)
      */
+    @Override
     public Object get(String name, ObjectFactory objectFactory) {
         Object scopedObject = servletContext.getAttribute(name);
         if (scopedObject == null) {
@@ -59,6 +61,7 @@ public class ServletScope implements Sco
     /* (non-Javadoc)
      * @see org.springframework.beans.factory.config.Scope#remove(java.lang.String)
      */
+    @Override
     public Object remove(String name) {
         Object scopedObject = servletContext.getAttribute(name);
         if (scopedObject != null) {
@@ -71,42 +74,54 @@ public class ServletScope implements Sco
     /* (non-Javadoc)
      * @see org.springframework.beans.factory.config.Scope#getConversationId()
      */
+    @Override
     public String getConversationId() {
         // There is no conversation id concept for the call stack
         return null;
     }
 
     /* (non-Javadoc)
-     * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String,
java.lang.Runnable)
+     * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String,
+     * java.lang.Runnable)
      */
+    @Override
     public void registerDestructionCallback(String name, Runnable callback) {
-        Map destructionCallbacks = getDestructionCallbacks(servletContext);
+        Map<String, Runnable> destructionCallbacks = getDestructionCallbacks(servletContext);
         destructionCallbacks.put(name, callback);
     }
-    
+
     /**
      * @param servletContext
      * @return the destruction callbacks map that is stored as a attribute of servletContext
      */
-    private static Map getDestructionCallbacks(ServletContext servletContext) {
-        Map destructionCallbacks = (Map)servletContext.getAttribute(destructionCallbacksAttributeName);
+    private static Map<String, Runnable> getDestructionCallbacks(ServletContext servletContext)
{
+        @SuppressWarnings("unchecked")
+        Map<String, Runnable> destructionCallbacks =
+                (Map<String, Runnable>) servletContext.getAttribute(DESTRUCTION_CALLBACKS_ATTRIBUTENAME);
         if (destructionCallbacks == null) {
-            destructionCallbacks = new HashMap();
-            servletContext.setAttribute(destructionCallbacksAttributeName, destructionCallbacks);
+            destructionCallbacks = new HashMap<String, Runnable>();
+            servletContext.setAttribute(DESTRUCTION_CALLBACKS_ATTRIBUTENAME, destructionCallbacks);
         }
         return destructionCallbacks;
     }
-    
+
     /**
-     * Executes destruction callbacks of beans from servlet scope. This method should be
called once the Servlet that the scope
+     * Executes destruction callbacks of beans from servlet scope. This method should be
called once the Servlet that
+     * the scope
      * is tied to is being destroyed.
+     *
      * @param servletContext
      */
     public static void executeDestructionCallbacks(ServletContext servletContext) {
-        Map destructionCallbacks = getDestructionCallbacks(servletContext);
-        Iterator i = destructionCallbacks.values().iterator();
+        Map<String, Runnable> destructionCallbacks = getDestructionCallbacks(servletContext);
+        Iterator<Runnable> i = destructionCallbacks.values().iterator();
         while (i.hasNext()) {
-            ((Runnable) i.next()).run();
+            i.next().run();
         }
     }
+
+    @Override
+    public Object resolveContextualObject(String key) {
+        return null;
+    }
 }

Modified: cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletservice/spring/ServletDecorator.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletservice/spring/ServletDecorator.java?rev=1711428&r1=1700478&r2=1711428&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletservice/spring/ServletDecorator.java
(original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/branches/COCOON-2347/src/main/java/org/apache/cocoon/servletservice/spring/ServletDecorator.java
Fri Oct 30 08:39:05 2015
@@ -38,7 +38,7 @@ import org.w3c.dom.Node;
  * <code>http://cocoon.apache.org/schema/servlet</code> namespace which
  * defines following elements: <code>context</code> : with optional attributes
  * <code>mountPath</code> and <code>contextPath</code>. With optional
sub
- * elements <code>init-params", "context-params" and "connections".</p>
+ * elements <code>init-params</code>, <code>context-params</code>
and <code>connections</code>.</p>
  * <p>
  * The actual creation of the servlet service (= a bean) is done by {@link ServletFactoryBean}.</p>
  *
@@ -47,6 +47,7 @@ import org.w3c.dom.Node;
  */
 public class ServletDecorator implements BeanDefinitionDecorator {
 
+    @Override
     public BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder holder, ParserContext
ctx) {
         String embeddedServletBeanName = registerEmbeddedServletBean(holder, ctx);
         return createServletFactoryBeanDefinition((Element) source, holder, ctx, embeddedServletBeanName);
@@ -62,13 +63,15 @@ public class ServletDecorator implements
     }
 
     private BeanDefinitionHolder createServletFactoryBeanDefinition(Element source, BeanDefinitionHolder
holder,
-                    ParserContext ctx, String embeddedServletBeanName) {
+            ParserContext ctx, String embeddedServletBeanName) {
         String ns = source.getNamespaceURI();
-        if (!source.hasAttribute("mount-path"))
+        if (!source.hasAttribute("mount-path")) {
             throw new RuntimeException("The mount-path attribute is required.");
+        }
         String mountPath = source.getAttribute("mount-path");
-        if (!source.hasAttribute("context-path"))
+        if (!source.hasAttribute("context-path")) {
             throw new RuntimeException("The context-path attribute is required.");
+        }
         String contextPath = source.getAttribute("context-path");
 
         Element initParamsElem = (Element) source.getElementsByTagNameNS(ns, "init-params").item(0);
@@ -76,15 +79,16 @@ public class ServletDecorator implements
         Element connectionsElem = (Element) source.getElementsByTagNameNS(ns, "connections").item(0);
 
         BeanDefinitionBuilder servletFactoryDefBuilder = BeanDefinitionBuilder
-                        .rootBeanDefinition(ServletFactoryBean.class);
-        servletFactoryDefBuilder.setSource(ctx.extractSource(source));
+                .rootBeanDefinition(ServletFactoryBean.class);
+        servletFactoryDefBuilder.getRawBeanDefinition().setSource(ctx.extractSource(source));
         servletFactoryDefBuilder.addPropertyReference("embeddedServlet", embeddedServletBeanName);
         servletFactoryDefBuilder.setInitMethodName("init");
         servletFactoryDefBuilder.setDestroyMethodName("destroy");
         servletFactoryDefBuilder.addPropertyValue("serviceName", holder.getBeanName());
         //this dependency is needed because JNet must be called manually when init() method
is called on servlet
         //see COCOON-2236
-        servletFactoryDefBuilder.addPropertyReference("urlHandlerFactoryCollector", "org.apache.cocoon.jnet.URLHandlerFactoryCollector");
+        servletFactoryDefBuilder.addPropertyReference(
+                "urlHandlerFactoryCollector", "org.apache.cocoon.jnet.URLHandlerFactoryCollector");
 
         servletFactoryDefBuilder.addPropertyValue("mountPath", mountPath);
         servletFactoryDefBuilder.addPropertyValue("contextPath", contextPath);
@@ -97,15 +101,15 @@ public class ServletDecorator implements
             servletFactoryDefBuilder.addPropertyValue("contextParams", contextParams);
         }
         if (connectionsElem != null) {
-            Map connections = ctx.getDelegate().parseMapElement(connectionsElem, null);
+            Map<Object, Object> connections = ctx.getDelegate().parseMapElement(connectionsElem,
null);
             servletFactoryDefBuilder.addPropertyValue("connections", connections);
-            Map connectionNames = new HashMap();
-            for (Iterator it = connections.keySet().iterator(); it.hasNext();) {
+            Map<String, String> connectionNames = new HashMap<String, String>();
+            for (Iterator<Object> it = connections.keySet().iterator(); it.hasNext();)
{
                 TypedStringValue key = (TypedStringValue) it.next();
                 if (key.getValue().endsWith("+")) {
                     throw new InvalidBeanReferenceNameException(
-                                    "The key of a servlet connection mustn't use '+' as its
last character. "
-                                                    + "This is reserved for absolute references
in servlet sources.");
+                            "The key of a servlet connection mustn't use '+' as its last
character. "
+                            + "This is reserved for absolute references in servlet sources.");
                 }
                 RuntimeBeanReference beanNameReference = (RuntimeBeanReference) connections.get(key);
                 connectionNames.put(key.getValue(), beanNameReference.getBeanName());
@@ -118,6 +122,8 @@ public class ServletDecorator implements
 
     private class InvalidBeanReferenceNameException extends RuntimeException {
 
+        private static final long serialVersionUID = 5809126827892821270L;
+
         public InvalidBeanReferenceNameException(String message) {
             super(message);
         }



Mime
View raw message