svn commit: r1416463 - in /cocoon/subprojects/cocoon-block-deployment/trunk: ./ src/main/java/org/apache/cocoon/blockdeployment/ src/main/resources/META-INF/cocoon/spring/

[email protected]
Newsgroups gmane.text.xml.cocoon.cvs
Message-ID <[email protected]>
Author: ilgrosso
Date: Mon Dec  3 11:51:08 2012
New Revision: 1416463

URL: http://svn.apache.org/viewvc?rev=1416463&view=rev
Log:
Reverting previously applied patch for COCOO3-105

Added:
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandlerFactory.java
      - copied unchanged from r1386497, cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandlerFactory.java
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-protocol.xml
      - copied unchanged from r1386497, cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-protocol.xml
Removed:
    cocoon/subprojects/cocoon-block-deployment/trunk/test
Modified:
    cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandler.java
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-resourcesholder.xml

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml?rev=1416463&r1=1416462&r2=1416463&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml Mon Dec  3 11:51:08 2012
@@ -10,13 +10,13 @@
 
       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.
- -->
+ 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.
+-->
 <!-- $Id$ -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
@@ -77,6 +77,7 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
     </dependency>
+    
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
@@ -104,14 +105,14 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.1</version>
+        <version>3.2</version>
         <configuration>
           <locales>en</locales>
           <reportPlugins>
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-project-info-reports-plugin</artifactId>
-              <version>2.4</version>
+              <version>2.6</version>
               <configuration>
                 <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                 <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
@@ -139,6 +140,18 @@
                 </reportSet>
               </reportSets>
             </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-javadoc-plugin</artifactId>
+              <version>2.8.1</version>
+              <reportSets>
+                <reportSet>
+                  <reports>
+                    <report>javadoc</report>
+                  </reports>
+                </reportSet>
+              </reportSets>
+            </plugin>
           </reportPlugins>
         </configuration>
         <executions>

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java?rev=1416463&r1=1416462&r2=1416463&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java Mon Dec  3 11:51:08 2012
@@ -30,8 +30,7 @@ public class BlockContextURLConnection e
 
     private URLConnection urlConnection;
 
-    protected BlockContextURLConnection(URL url,
-            Map<String, String> blockContexts) {
+    protected BlockContextURLConnection(URL url, Map<String, String> blockContexts) {
         super(url);
 
         // check if there the BlockContext map is not null.
@@ -39,13 +38,12 @@ public class BlockContextURLConnection e
         // environments, the cocoon-block-deployment library is available, but
         // you don't necessarily use the blockcontext protocol.
         if (blockContexts == null) {
-            throw new BlockContextInitializationException(
-                    "There are no block contexts available. Make sure that the "
-                            + BlockDeploymentServletContextListener.class
-                                    .getName()
-                            + " is configured correctly in the web.xml.");
+            throw new BlockContextInitializationException("There are no block contexts available. Make sure that the "
+                    + BlockDeploymentServletContextListener.class.getName()
+                    + " is configured correctly in the web.xml.");
         }
         this.blockContexts = blockContexts;
+        this.url = url;
     }
 
     @Override
@@ -60,33 +58,34 @@ public class BlockContextURLConnection e
 
     private URLConnection getConnection() {
         if (this.urlConnection == null) {
-            final String location = this.url.toExternalForm();
+            URL resolvedPath = null;
+            String location = this.url.toExternalForm();
 
             // Remove the protocol and the first '/'
             int pos = location.indexOf(":/");
             String path = location.substring(pos + 2);
 
             pos = path.indexOf('/');
-            if (pos == -1) {
-                throw new RuntimeException(
-                        "The block name part of a block context uri must end with a '/' in "
-                                + location);
-            }
-            // extract the block name and get the block context path
-            final String blockName = path.substring(0, pos);
-            path = path.substring(pos + 1);
-            final String blockContext = this.blockContexts.get(blockName);
-
-            if (blockContext == null) {
-                throw new RuntimeException("There is no block '" + blockName
-             +"' deployed. The available blocks are " + this.blockContexts + ".");
-            }
-
-            try {
-                final URL resolvedPath = new URL(new URL(blockContext), path);
-                this.urlConnection = resolvedPath.openConnection();
-            } catch (IOException e) {
-                throw new RuntimeException("Can create URL for '" + blockContext + path + "'.'");
+            if (pos != -1) {
+                // extract the block name and get the block context path
+                String blockName = path.substring(0, pos);
+                path = path.substring(pos + 1);
+                String blockContext = this.blockContexts.get(blockName);
+
+                if (blockContext == null) {
+                    throw new RuntimeException("There is no block '" + blockName
+                            + "' deployed. The available blocks are " + this.blockContexts + ".");
+                }
+
+                try {
+                    resolvedPath = new URL(new URL(blockContext), path);
+                    this.urlConnection = resolvedPath.openConnection();
+                } catch (IOException e) {
+                    throw new RuntimeException("Can create URL for '" + blockContext + path + "'.'");
+                }
+            } else {
+                throw new RuntimeException("The block name part of a block context uri must end with a '/' in "
+                        + location);
             }
         }
         return this.urlConnection;

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandler.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandler.java?rev=1416463&r1=1416462&r2=1416463&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandler.java (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandler.java Mon Dec  3 11:51:08 2012
@@ -28,12 +28,13 @@ public class BlockContextURLStreamHandle
 
     private final Map<String, String> blockContexts;
 
-    public BlockContextURLStreamHandler(final Map<String, String> blockContexts) {
+    public BlockContextURLStreamHandler(Map<String, String> blockContexts) {
         this.blockContexts = blockContexts;
     }
 
     @Override
-    protected URLConnection openConnection(final URL url) throws IOException {
+    protected URLConnection openConnection(URL url) throws IOException {
         return new BlockContextURLConnection(url, this.blockContexts);
     }
+
 }

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java?rev=1416463&r1=1416462&r2=1416463&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockDeploymentServletContextListener.java Mon Dec  3 11:51:08 2012
@@ -21,32 +21,33 @@ package org.apache.cocoon.blockdeploymen
 import java.io.File;
 import java.io.IOException;
 import java.util.Map;
+
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
 public class BlockDeploymentServletContextListener implements ServletContextListener {
 
-    public static final String BLOCK_CONTEXT_MAP =
-            BlockDeploymentServletContextListener.class.getName() + "/" + "block-context-map";
-
-    public void contextInitialized(final ServletContextEvent sce) {
-        final ServletContext servletContext = sce.getServletContext();
+    public static final String BLOCK_CONTEXT_MAP = BlockDeploymentServletContextListener.class.getName() + "/"
+            + "block-context-map";
 
+    public void contextInitialized(ServletContextEvent sce) {
         try {
-            final Map<String, String> blocks =
-                    DeploymentUtil.deployBlockArtifacts(this.getWorkdir(servletContext).getAbsolutePath());
+            ServletContext servletContext = sce.getServletContext();
+
+            Map<String, String> blocks = DeploymentUtil.deployBlockArtifacts(this.getWorkdir(servletContext)
+                    .getAbsolutePath());
             servletContext.setAttribute(BLOCK_CONTEXT_MAP, blocks);
         } catch (IOException e) {
             throw new RuntimeException("The available Cocoon blocks can't be deployed.", e);
         }
     }
 
-    public void contextDestroyed(final ServletContextEvent sce) {
+    public void contextDestroyed(ServletContextEvent sce) {
         sce.getServletContext().removeAttribute(BLOCK_CONTEXT_MAP);
     }
 
-    private File getWorkdir(final ServletContext servletContext) {
+    private File getWorkdir(ServletContext servletContext) {
         File workdir = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
         if (workdir == null) {
             workdir = new File("cocoon-files");

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-resourcesholder.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-resourcesholder.xml?rev=1416463&r1=1416462&r2=1416463&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-resourcesholder.xml (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-resourcesholder.xml Mon Dec  3 11:51:08 2012
@@ -1,31 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- 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. -->
-<!-- $Id: cocoon-blockdeployment-resourcesholder.xml 686263 2008-08-15 15:53:47Z 
-  gkossakowski $ -->
+<!--
+  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.
+-->
+<!-- $Id$ -->
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="
-  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
   <bean name="org.apache.cocoon.blockdeployment.BlockResourcesHolder"
     class="org.apache.cocoon.blockdeployment.DefaultBlockResourcesHolder">
-    <property name="servletContext" ref="javax.servlet.ServletContext" />
+    <property name="servletContext" ref="javax.servlet.ServletContext"/>
   </bean>
-
-  <!-- This bean is deprecated and is kept for back-compatiblity with Cocoon 
-    Core 2.2 -->
+  
+  <!-- This bean is deprecated and is kept for back-compatiblity with Cocoon Core 2.2 -->
   <bean name="org.apache.cocoon.spring.configurator.BlockResourcesHolder"
     class="org.apache.cocoon.blockdeployment.DefaultBlockResourcesHolder">
-    <property name="servletContext" ref="javax.servlet.ServletContext" />
+    <property name="servletContext" ref="javax.servlet.ServletContext"/>
   </bean>
 
 </beans>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.