cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r168074 - in /cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring: CocoonApplicationContext.java SpringComponentLocator.java
Date Wed, 04 May 2005 05:36:19 GMT
Author: cziegeler
Date: Tue May  3 22:36:19 2005
New Revision: 168074

URL: http://svn.apache.org/viewcvs?rev=168074&view=rev
Log:
Update to latest cocoon version

Modified:
    cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java
    cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java

Modified: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java?rev=168074&r1=168073&r2=168074&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java
(original)
+++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java
Tue May  3 22:36:19 2005
@@ -20,10 +20,10 @@
 
 import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.UrlResource;
-import org.springframework.web.context.support.ServletContextResource;
 import org.springframework.web.context.support.XmlWebApplicationContext;
 
 /**
@@ -38,7 +38,6 @@
     public static final String DEFAULT_SPRING_CONFIG = "conf/applicationContext.xml";
 
     protected SourceResolver resolver;
-    protected EnvironmentHelper environmentHelper;
     protected String baseURL;
 
     public void setSourceResolver(SourceResolver aResolver) {
@@ -46,8 +45,7 @@
     }
 
     public void setEnvironmentHelper(EnvironmentHelper eh) {
-        this.environmentHelper = eh;
-        this.baseURL = this.environmentHelper.getContext();
+        this.baseURL = eh.getContext();
         if ( !this.baseURL.endsWith("/") ) {
             this.baseURL = this.baseURL + '/';
         }
@@ -79,14 +77,18 @@
      * @return The default config locations if they exist otherwise an empty array.
      */
     protected String[] getDefaultConfigLocations() {
+        Source testSource = null;
         try {
-            if(resolver.resolveURI(DEFAULT_SPRING_CONFIG).exists()) {
+            testSource = this.resolver.resolveURI(DEFAULT_SPRING_CONFIG);
+            if (testSource.exists()) {
                 return new String[] {DEFAULT_SPRING_CONFIG};
             }
         } catch(MalformedURLException e) {
             throw new CascadingRuntimeException("Malformed URL when resolving Spring default
config location [ " + DEFAULT_SPRING_CONFIG + "]. This is an unrecoverable programming error.
Check the code where this exception was thrown.", e);
         } catch(IOException e) {
             throw new CascadingRuntimeException("Cannot resolve default config location ["+
DEFAULT_SPRING_CONFIG + "] due to an IOException. See cause for details.", e);
+        } finally {
+            this.resolver.release(testSource);
         }
         
         return new String[]{};

Modified: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java?rev=168074&r1=168073&r2=168074&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
(original)
+++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
Tue May  3 22:36:19 2005
@@ -33,6 +33,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.core.Core;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
@@ -176,9 +177,10 @@
     }
 
     /**
-     * @see org.apache.cocoon.sitemap.ComponentLocator#lookup(java.lang.String)
+     * @see org.apache.cocoon.sitemap.ComponentLocator#getComponent(java.lang.String)
      */
-    public Object lookup(String key) {
+    public Object getComponent(String key) 
+    throws ProcessingException {
         return this.wac.getBean(key);
     }
     



Mime
View raw message