cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r392758 - in /cocoon/trunk/core: cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/ cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/ cocoon-core/META-INF/ cocoon-core/META-INF/xconf/ cocoon-core/src/main/jav...
Date Sun, 09 Apr 2006 15:39:21 GMT
Author: reinhard
Date: Sun Apr  9 08:39:19 2006
New Revision: 392758

URL: http://svn.apache.org/viewcvs?rev=392758&view=rev
Log:
Got the OSGiSpringECMFactory working (means that Spring beans and Avalon components created
in one bundle are available through a BeanFactoryService in other bundles) (DF/RP)

Added:
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java
  (with props)
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java
  (with props)
    cocoon/trunk/core/cocoon-core/META-INF/xconf/
    cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core-sitemap.xconf
      - copied unchanged from r392689, cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/xconf/cocoon-core-sitemap.xconf
    cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core.xconf
      - copied, changed from r392689, cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/xconf/cocoon-core.xconf
    cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon.xconf
      - copied, changed from r392689, cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/cocoon.xconf
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java
  (with props)
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java
  (with props)
Modified:
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/MANIFEST.MF
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/components.xml
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AllOSGiTests.java
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiLoggerTest.java
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSettingsTest.java
    cocoon/trunk/core/cocoon-core/META-INF/MANIFEST.MF
    cocoon/trunk/core/cocoon-core/META-INF/components.xml
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiLogger.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSettings.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/MANIFEST.MF?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/MANIFEST.MF (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/MANIFEST.MF Sun Apr
 9 08:39:19 2006
@@ -8,5 +8,11 @@
 Import-Package: junit.framework,
  junit.textui,
  org.apache.avalon.framework.logger,
+ org.apache.cocoon.components.thread,
  org.apache.cocoon.core,
- org.osgi.service.component
+ org.apache.cocoon.core.osgi,
+ org.apache.excalibur.store,
+ org.osgi.service.component,
+ org.springframework.beans,
+ org.springframework.beans.factory,
+ org.springframework.beans.factory.config

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/components.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/components.xml?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/components.xml (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/META-INF/components.xml Sun
Apr  9 08:39:19 2006
@@ -15,8 +15,11 @@
       bind="setLogger"/>  
   </scr:component>
   
-  <scr:component name="org.apache.cocoon.osgitests.allOSGiTests">
-    <scr:implementation class="org.apache.cocoon.osgitests.AllOSGiTests"/>  
+  <scr:component name="org.apache.cocoon.osgitests.OSGiSpringECMFactoryTest">
+    <scr:implementation class="org.apache.cocoon.osgitests.OSGiSpringECMFactoryTest"/>
 
+    <scr:reference name="beanFactory"
+      interface="org.apache.cocoon.core.osgi.CocoonSpringBeanRegistry"
+      bind="setBeanFactory"/>  
   </scr:component>  
 
 </components>

Added: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java?rev=392758&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java
(added)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java
Sun Apr  9 08:39:19 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.osgitests;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+abstract class AbstractOSGiTestCase extends TestCase {
+
+}

Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AbstractOSGiTestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AllOSGiTests.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AllOSGiTests.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AllOSGiTests.java
(original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/AllOSGiTests.java
Sun Apr  9 08:39:19 2006
@@ -23,8 +23,8 @@
 public class AllOSGiTests extends TestCase {
 
     protected void activate(ComponentContext componentContext) {
-    	TestRunner.run(OSGiLoggerTest.class);
-    	TestRunner.run(OSGiSettingsTest.class);
+//    	TestRunner.run(OSGiLoggerTest.class);
+//    	TestRunner.run(OSGiSettingsTest.class);
     }
 	
 }

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiLoggerTest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiLoggerTest.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiLoggerTest.java
(original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiLoggerTest.java
Sun Apr  9 08:39:19 2006
@@ -15,11 +15,15 @@
  */
 package org.apache.cocoon.osgitests;
 
-import junit.framework.TestCase;
+import junit.textui.TestRunner;
 
 import org.apache.avalon.framework.logger.Logger;
+import org.osgi.service.component.ComponentContext;
 
-public class OSGiLoggerTest extends TestCase {
+/**
+ * @version $Id$
+ */
+public class OSGiLoggerTest extends AbstractOSGiTestCase {
 
 	private static Logger logger;
 
@@ -28,11 +32,14 @@
 	}
 
 	protected void setLogger(Logger logger) {
-		this.logger = logger;
+		OSGiLoggerTest.logger = logger;
 	}
 	
 	public void testIsServiceAvailable() {
 		logger.debug("testIsServiceAvailable");
 	}
 	
+    protected void activate(ComponentContext componentContext) {
+    	TestRunner.run(OSGiLoggerTest.class);
+    }	
 }

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSettingsTest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSettingsTest.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSettingsTest.java
(original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSettingsTest.java
Sun Apr  9 08:39:19 2006
@@ -15,11 +15,15 @@
  */
 package org.apache.cocoon.osgitests;
 
-import junit.framework.TestCase;
+import junit.textui.TestRunner;
 
 import org.apache.cocoon.core.Settings;
+import org.osgi.service.component.ComponentContext;
 
-public class OSGiSettingsTest extends TestCase {
+/**
+ * @version $Id$
+ */
+public class OSGiSettingsTest extends AbstractOSGiTestCase {
 
 	private static Settings settings;
 
@@ -32,7 +36,11 @@
 	}
 
 	public void testIsServiceAvailable() {
-//		assertNotNull(settings);
+		assertNotNull(settings);
 	}
+	
+    protected void activate(ComponentContext componentContext) {
+    	TestRunner.run(OSGiSettingsTest.class);
+    }	
 	
 }

Added: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java?rev=392758&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java
(added)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java
Sun Apr  9 08:39:19 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.osgitests;
+
+import junit.textui.TestRunner;
+
+import org.apache.cocoon.core.osgi.CocoonSpringBeanRegistry;
+import org.apache.excalibur.store.Store;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * @version $Id$
+ */
+public class OSGiSpringECMFactoryTest extends AbstractOSGiTestCase {
+
+	private static CocoonSpringBeanRegistry beanFactory;
+
+	public void testIfBeansAreAvailable() {
+		Store store = (Store) beanFactory.getBean(Store.ROLE);
+		assertNotNull(store);
+	}
+	
+	/**
+	 * @return the beanFactory
+	 */
+	protected CocoonSpringBeanRegistry getBeanFactory() {
+		return beanFactory;
+	}
+
+	/**
+	 * @param beanFactory the beanFactory to set
+	 */
+	protected void setBeanFactory(CocoonSpringBeanRegistry beanFactory) {
+		OSGiSpringECMFactoryTest.beanFactory = beanFactory;
+	}
+	
+    protected void activate(ComponentContext componentContext) {
+    	TestRunner.run(OSGiSpringECMFactoryTest.class);
+    }		
+	
+}

Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-tests/src/test/java/org/apache/cocoon/osgitests/OSGiSpringECMFactoryTest.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: cocoon/trunk/core/cocoon-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/META-INF/MANIFEST.MF?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/META-INF/MANIFEST.MF (original)
+++ cocoon/trunk/core/cocoon-core/META-INF/MANIFEST.MF Sun Apr  9 08:39:19 2006
@@ -90,6 +90,7 @@
  org.apache.cocoon.core.container,
  org.apache.cocoon.core.container.spring,
  org.apache.cocoon.core.container.util,
+ org.apache.cocoon.core.osgi,
  org.apache.cocoon.core.servlet,
  org.apache.cocoon.environment,
  org.apache.cocoon.environment.commandline,
@@ -122,6 +123,7 @@
  org.apache.cocoon.xml,
  org.apache.cocoon.xml.dom,
  org.apache.cocoon.xml.xlink,
+ org.apache.excalibur.store,
  org.springframework.beans,
  org.springframework.beans.factory,
  org.springframework.beans.factory.config

Modified: cocoon/trunk/core/cocoon-core/META-INF/components.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/META-INF/components.xml?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/META-INF/components.xml (original)
+++ cocoon/trunk/core/cocoon-core/META-INF/components.xml Sun Apr  9 08:39:19 2006
@@ -22,11 +22,11 @@
       bind="setLogger"/>    
   </scr:component>
   
-  <scr:component name="org.apache.cocoon.osgi.springEcmFactory">
-    <scr:implementation class="org.apache.cocoon.core.osgi.SpringECMFactory"/>
-    <scr:property name="configFile" value="/META-INF/cocoon.xconf"/>
+  <scr:component name="org.apache.cocoon.core.osgi.springEcmFactory">
+    <scr:implementation class="org.apache.cocoon.core.osgi.OSGiSpringECMFactory"/>
+    <scr:property name="configFile" value="/META-INF/xconf/cocoon.xconf"/>
     <scr:service>
-      <scr:provide interface="org.springframework.beans.factory.config.ConfigureableListableBeanFactory"/>
+      <scr:provide interface="org.apache.cocoon.core.osgi.CocoonSpringBeanRegistry"/>
     </scr:service>    
     <scr:reference name="logger"
       interface="org.apache.avalon.framework.logger.Logger"

Copied: cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core.xconf (from r392689, cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/xconf/cocoon-core.xconf)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core.xconf?p2=cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core.xconf&p1=cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/xconf/cocoon-core.xconf&r1=392689&r2=392758&rev=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/xconf/cocoon-core.xconf (original)
+++ cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon-core.xconf Sun Apr  9 08:39:19 2006
@@ -44,7 +44,7 @@
       | For development environment, set the check-reload to yes.
       | For production environment, it is advisable to set check-reload to no.
       +-->
-  <sitemap file="context://sitemap.xmap" logger="sitemap"/>
+  <!-- sitemap file="context://sitemap.xmap" logger="sitemap"/-->
 
 <!-- ========================= Sitemap Flowscript ========================== -->
 

Copied: cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon.xconf (from r392689, cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/cocoon.xconf)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon.xconf?p2=cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon.xconf&p1=cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/cocoon.xconf&r1=392689&r2=392758&rev=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/cocoon.xconf (original)
+++ cocoon/trunk/core/cocoon-core/META-INF/xconf/cocoon.xconf Sun Apr  9 08:39:19 2006
@@ -16,27 +16,8 @@
 -->
 <!-- CVS $Id$ -->
 <cocoon version="2.2">
+  
+  <include src="context://META-INF/xconf/cocoon-core.xconf"/>
+  <include src="context://META-INF/xconf/cocoon-core-sitemap.xconf"/>  
 
-<!--+
-    | This is the main Apache Cocoon configuration file.
-    | It contains includes for the core components and for
-    | each of the blocks that are to be loaded.
-    |
-    | You can add your own components here or include some
-    | additional external files.
-    +-->
-
-  <include src="context://WEB-INF/xconf/cocoon-core.xconf"/>
-
-  <!--+
-      | Include all configuration files ending with ".xconf" 
-      | from the xconf directory.
-      +-->
-  <include dir="context://WEB-INF/xconf" pattern="*.xconf"/>
-
-  <!--+
-      | Include all configuration files ending with ".samplesxconf" 
-      | from the xconf directory.
-      +-->
-  <include dir="context://WEB-INF/xconf" pattern="*.samplesxconf"/>
 </cocoon>

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
Sun Apr  9 08:39:19 2006
@@ -81,7 +81,7 @@
      */
     public void contextualize(org.apache.avalon.framework.context.Context context)
     throws ContextException {
-        this.envContext = (Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+        this.envContext = (Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
         try {
             this.servletContext = ((ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG)).getServletContext();
         } catch (ContextException ignore) {

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Sun Apr
 9 08:39:19 2006
@@ -327,7 +327,9 @@
         appContext.put(Constants.CONTEXT_WORK_DIR, new File(settings.getWorkDirectory()));
         appContext.put(Constants.CONTEXT_UPLOAD_DIR, new File(settings.getUploadDirectory()));
         appContext.put(Constants.CONTEXT_CACHE_DIR, new File(settings.getCacheDirectory()));
-        appContext.put(Constants.CONTEXT_CONFIG_URL, new URL(settings.getConfiguration()));
+        if(settings.getConfiguration() != null) {
+        	appContext.put(Constants.CONTEXT_CONFIG_URL, new URL(settings.getConfiguration()));
+        }
         appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, settings.getFormEncoding());
         appContext.put(Constants.CONTEXT_CLASS_LOADER, classloader);
     }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
Sun Apr  9 08:39:19 2006
@@ -112,7 +112,10 @@
      */
     public static ConfigurableListableBeanFactory createRootBeanFactory(AvalonEnvironment
 env)
     throws Exception {
-        final ApplicationContext parent = (ApplicationContext)env.servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+    	ApplicationContext parent = null;
+    	if(env.servletContext != null) {
+    		parent = (ApplicationContext)env.servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+    	}
         CocoonBeanFactory factory = new CocoonBeanFactory(parent);
         factory.registerSingleton(ProcessingUtil.CONTEXT_ROLE, env.context);
         factory.registerSingleton(ProcessingUtil.LOGGER_ROLE, env.logger);

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java?rev=392758&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java
Sun Apr  9 08:39:19 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.core.osgi;
+
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+
+/**
+ * Another interface needed to be introduced because Equinox hat some problems with
+ * the name @link {@link ConfigurableListableBeanFactory} because of some introspection
+ * done on all classes that end on "Factory".
+ * 
+ * @version $Id$
+ */
+public interface CocoonSpringBeanRegistry extends ConfigurableListableBeanFactory {
+
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/CocoonSpringBeanRegistry.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiLogger.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiLogger.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiLogger.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiLogger.java
Sun Apr  9 08:39:19 2006
@@ -93,6 +93,7 @@
             result = new OSGiLogger();
             ((OSGiLogger) result).setCategory(category);
             ((OSGiLogger) result).setLogLevel(this.logLevel);
+            ((OSGiLogger) result).setLogService(this.logService);            
             loggers.put(category, result);
         }
         return result;

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java?rev=392758&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java
Sun Apr  9 08:39:19 2006
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.core.osgi;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.cocoon.environment.impl.AbstractContext;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * @version $Id$
+ */
+public class OSGiServletContext extends AbstractContext {
+	
+	private Logger logger;
+	private ComponentContext componentContext;
+	
+	public OSGiServletContext(Logger logger, ComponentContext componentContext) {
+		super();
+		this.logger = logger;
+		this.componentContext = componentContext;
+	}	
+
+	/**
+	 * @see org.apache.cocoon.environment.impl.AbstractContext#getResource(java.lang.String)
+	 */
+	public URL getResource(String path) throws MalformedURLException {
+		if(path.length() == 0 || path.charAt(0) != '/') {
+			throw new MalformedURLException("The path (" + path + ") must start with '/'.");
+		}
+		return this.componentContext.getBundleContext().getBundle().getEntry(path);
+	}
+
+	/**
+	 * Logging to debug
+	 */
+	public void log(String msg) {
+		this.logger.info(msg);
+	}
+
+	/**
+	 * Logging to debug
+	 */	
+	public void log(Exception e, String msg) {
+		this.logger.info(msg);
+	}
+
+	/**
+	 * Logging to debug
+	 */	
+	public void log(String msg, Throwable t) {
+		this.logger.info(msg, t);
+	}
+
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiServletContext.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSettings.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSettings.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSettings.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSettings.java
Sun Apr  9 08:39:19 2006
@@ -30,6 +30,7 @@
 	protected void activate(ComponentContext componentContext) {
     	CoreUtil.initSettingsFiles(this, this.logger);
         // componentContext.getBundleContext().getDataFile("cocoon-files");
+//    	this.setConfiguration("/META-INF/xconf/cocoon.xconf"); // TODO (DF/RP) probably not
used by the OSGi framework!
     	this.makeReadOnly();
     }
 

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java
Sun Apr  9 08:39:19 2006
@@ -17,6 +17,7 @@
 
 import java.beans.PropertyEditor;
 import java.net.URL;
+import java.util.Map;
 
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.logger.Logger;
@@ -24,17 +25,22 @@
 import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.container.spring.AvalonEnvironment;
 import org.apache.cocoon.core.container.spring.BeanFactoryUtil;
+import org.apache.cocoon.core.container.spring.ConfigReader;
+import org.apache.cocoon.core.container.spring.ConfigurationInfo;
+import org.apache.cocoon.environment.Context;
+import org.apache.excalibur.store.Store;
 import org.osgi.service.component.ComponentContext;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * @version $Id$
  */
-public class OSGiSpringECMFactory implements ConfigurableBeanFactory {
+public class OSGiSpringECMFactory implements ConfigurableListableBeanFactory, CocoonSpringBeanRegistry
{
 	
 	private static final String MANIFEST_FILE = "/META-INF/MANIFEST.MF";
 
@@ -42,7 +48,7 @@
 	
     private Logger logger;
 	private Settings settings;
-	private ConfigurableBeanFactory beanFactory;
+	private ConfigurableListableBeanFactory beanFactory;
 
 	protected Settings getSettings() {
 		return this.settings;
@@ -60,16 +66,28 @@
 		this.logger = logger;
 	}
 	
+	/*
+	 * TODO (DF/RP) move activation into a seperate thread
+	 */
 	protected void activate(ComponentContext componentContext) throws Exception {
-		URL manifestUrl = componentContext.getBundleContext().getBundle().getResource(MANIFEST_FILE);
+		URL manifestUrl = componentContext.getBundleContext().getBundle().getEntry(MANIFEST_FILE);
 		String contextPath = manifestUrl.toString();
-		contextPath = manifestUrl.toString().substring(0, contextPath.length() - MANIFEST_FILE.length());
+		contextPath = manifestUrl.toString().substring(0, contextPath.length() - (MANIFEST_FILE.length()
- 1));
 		
-		DefaultContext avalonContext = CoreUtil.createContext(this.settings, null, contextPath,
null, null);
+		this.logger.debug("Context path: " + contextPath);
+
+		// create a minimal OSGi servlet context
+		Context osgiServletContext = new OSGiServletContext(this.logger, componentContext);		
+		
+		// create a minimal Avalon Context
+		DefaultContext avalonContext = CoreUtil.createContext(this.settings, osgiServletContext,
contextPath, null, null);
 		
+		// create an Avalon environment (it's some kind of container for Avalon related information)
 		AvalonEnvironment avalonEnvironment = new AvalonEnvironment();
 		avalonEnvironment.context = avalonContext;
-		avalonEnvironment.logger = this.logger;		
+		avalonEnvironment.logger = this.logger;	
+		avalonEnvironment.settings = this.settings;
+		avalonEnvironment.servletContext = osgiServletContext;
 		
 		// get the configuration file property
 		String configFile= (String) componentContext.getProperties().get(CONFIG_FILE);
@@ -77,71 +95,259 @@
 			throw new ECMConfigurationFileNotSetException("You have to provide a ECM configurationf
file!");
 		}
 		
-		this.beanFactory = BeanFactoryUtil.createRootBeanFactory(avalonEnvironment);
-//		ConfigurationInfo springBeanConfiguration = ConfigReader.readConfiguration(source, env)
+		ConfigurableListableBeanFactory rootBeanFactory = BeanFactoryUtil.createRootBeanFactory(avalonEnvironment);
+		ConfigurationInfo springBeanConfiguration = ConfigReader.readConfiguration(configFile,
avalonEnvironment);
+		this.beanFactory = BeanFactoryUtil.createBeanFactory(avalonEnvironment, springBeanConfiguration,
+				null, rootBeanFactory, true);
+		Store store = (Store) beanFactory.getBean(Store.ROLE);
+		this.logger.debug("Store: " + store);
     }
-
-	// ~~~~~~~~~~~~~~~ delegating ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 	
-	public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
-		this.beanFactory.addBeanPostProcessor(beanPostProcessor);
+	// ~~~~~~~~~~~~~~~ delegating to this.beanFactory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+
+	/**	
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#addBeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor)
+	 */
+	public void addBeanPostProcessor(BeanPostProcessor arg0) {
+		this.beanFactory.addBeanPostProcessor(arg0);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#applyBeanPostProcessorsAfterInitialization(java.lang.Object,
java.lang.String)
+	 */
+	public Object applyBeanPostProcessorsAfterInitialization(Object arg0, String arg1) throws
BeansException {
+		return this.beanFactory.applyBeanPostProcessorsAfterInitialization(arg0, arg1);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#applyBeanPostProcessorsBeforeInitialization(java.lang.Object,
java.lang.String)
+	 */
+	public Object applyBeanPostProcessorsBeforeInitialization(Object arg0, String arg1) throws
BeansException {
+		return this.beanFactory.applyBeanPostProcessorsBeforeInitialization(arg0, arg1);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#applyBeanPropertyValues(java.lang.Object,
java.lang.String)
+	 */
+	public void applyBeanPropertyValues(Object arg0, String arg1) throws BeansException {
+		this.beanFactory.applyBeanPropertyValues(arg0, arg1);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#autowire(java.lang.Class,
int, boolean)
+	 */
+	public Object autowire(Class arg0, int arg1, boolean arg2) throws BeansException {
+		return this.beanFactory.autowire(arg0, arg1, arg2);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#autowireBeanProperties(java.lang.Object,
int, boolean)
+	 */
+	public void autowireBeanProperties(Object arg0, int arg1, boolean arg2) throws BeansException
{
+		this.beanFactory.autowireBeanProperties(arg0, arg1, arg2);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.BeanFactory#containsBean(java.lang.String)
+	 */
+	public boolean containsBean(String arg0) {
+		return this.beanFactory.containsBean(arg0);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.ListableBeanFactory#containsBeanDefinition(java.lang.String)
+	 */
+	public boolean containsBeanDefinition(String arg0) {
+		return this.beanFactory.containsBeanDefinition(arg0);
 	}
 
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#containsSingleton(java.lang.String)
+	 */
 	public boolean containsSingleton(String arg0) {
 		return this.beanFactory.containsSingleton(arg0);
 	}
 
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#destroySingletons()
+	 */
 	public void destroySingletons() {
 		this.beanFactory.destroySingletons();
 	}
 
-	public int getBeanPostProcessorCount() {
-		return this.beanFactory.getBeanPostProcessorCount();
+	/**
+	 * @throws NoSuchBeanDefinitionException
+	 * @see org.springframework.beans.factory.BeanFactory#getAliases(java.lang.String)
+	 */
+	public String[] getAliases(String arg0) throws NoSuchBeanDefinitionException {
+		return this.beanFactory.getAliases(arg0);
 	}
 
-	public void registerAlias(String arg0, String arg1) throws BeansException {
-		this.beanFactory.registerAlias(arg0, arg1);
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.String, java.lang.Class)
+	 */
+	public Object getBean(String arg0, Class arg1) throws BeansException {
+		return this.beanFactory.getBean(arg0, arg1);
 	}
 
-	public void registerCustomEditor(Class arg0, PropertyEditor arg1) {
-		this.beanFactory.registerCustomEditor(arg0, arg1);
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.String)
+	 */
+	public Object getBean(String arg0) throws BeansException {
+		return this.beanFactory.getBean(arg0);
 	}
 
-	public void registerSingleton(String arg0, Object arg1) throws BeansException {
-		this.beanFactory.registerSingleton(arg0, arg1);
+	/**
+	 * @throws NoSuchBeanDefinitionException
+	 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#getBeanDefinition(java.lang.String)
+	 */
+	public BeanDefinition getBeanDefinition(String arg0) throws NoSuchBeanDefinitionException
{
+		return this.beanFactory.getBeanDefinition(arg0);
 	}
 
-	public void setParentBeanFactory(BeanFactory arg0) {
-		this.beanFactory.setParentBeanFactory(arg0);
+	/**
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionCount()
+	 */
+	public int getBeanDefinitionCount() {
+		return this.beanFactory.getBeanDefinitionCount();
 	}
 
-	public BeanFactory getParentBeanFactory() {
-		return this.beanFactory.getParentBeanFactory();
+	/**
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionNames()
+	 */
+	public String[] getBeanDefinitionNames() {
+		return this.beanFactory.getBeanDefinitionNames();
 	}
 
-	public boolean containsBean(String arg0) {
-		return this.beanFactory.containsBean(arg0);
+	/**
+	 * @deprecated
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionNames(java.lang.Class)
+	 */
+	public String[] getBeanDefinitionNames(Class arg0) {
+		return this.beanFactory.getBeanDefinitionNames(arg0);
 	}
 
-	public String[] getAliases(String arg0) throws NoSuchBeanDefinitionException {
-		return this.beanFactory.getAliases(arg0);
+	/**
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanNamesForType(java.lang.Class,
boolean, boolean)
+	 */
+	public String[] getBeanNamesForType(Class arg0, boolean arg1, boolean arg2) {
+		return this.beanFactory.getBeanNamesForType(arg0, arg1, arg2);
 	}
 
-	public Object getBean(String arg0) throws BeansException {
-		return this.beanFactory.getBean(arg0);
+	/**
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanNamesForType(java.lang.Class)
+	 */
+	public String[] getBeanNamesForType(Class arg0) {
+		return this.beanFactory.getBeanNamesForType(arg0);
 	}
 
-	public Object getBean(String arg0, Class arg1) throws BeansException {
-		return this.beanFactory.getBean(arg0, arg1);
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#getBeanPostProcessorCount()
+	 */
+	public int getBeanPostProcessorCount() {
+		return this.beanFactory.getBeanPostProcessorCount();
 	}
 
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class,
boolean, boolean)
+	 */
+	public Map getBeansOfType(Class arg0, boolean arg1, boolean arg2) throws BeansException
{
+		return this.beanFactory.getBeansOfType(arg0, arg1, arg2);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class)
+	 */
+	public Map getBeansOfType(Class arg0) throws BeansException {
+		return this.beanFactory.getBeansOfType(arg0);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.HierarchicalBeanFactory#getParentBeanFactory()
+	 */
+	public BeanFactory getParentBeanFactory() {
+		return this.beanFactory.getParentBeanFactory();
+	}
+
+	/**
+	 * @throws NoSuchBeanDefinitionException
+	 * @see org.springframework.beans.factory.BeanFactory#getType(java.lang.String)
+	 */
 	public Class getType(String arg0) throws NoSuchBeanDefinitionException {
 		return this.beanFactory.getType(arg0);
 	}
 
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#ignoreDependencyInterface(java.lang.Class)
+	 */
+	public void ignoreDependencyInterface(Class arg0) {
+		this.beanFactory.ignoreDependencyInterface(arg0);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#ignoreDependencyType(java.lang.Class)
+	 */
+	public void ignoreDependencyType(Class arg0) {
+		this.beanFactory.ignoreDependencyType(arg0);
+	}
+
+	/**
+	 * @throws NoSuchBeanDefinitionException
+	 * @see org.springframework.beans.factory.BeanFactory#isSingleton(java.lang.String)
+	 */
 	public boolean isSingleton(String arg0) throws NoSuchBeanDefinitionException {
 		return this.beanFactory.isSingleton(arg0);
 	}
-	
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#preInstantiateSingletons()
+	 */
+	public void preInstantiateSingletons() throws BeansException {
+		this.beanFactory.preInstantiateSingletons();
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#registerAlias(java.lang.String,
java.lang.String)
+	 */
+	public void registerAlias(String arg0, String arg1) throws BeansException {
+		this.beanFactory.registerAlias(arg0, arg1);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#registerCustomEditor(java.lang.Class,
java.beans.PropertyEditor)
+	 */
+	public void registerCustomEditor(Class arg0, PropertyEditor arg1) {
+		this.beanFactory.registerCustomEditor(arg0, arg1);
+	}
+
+	/**
+	 * @throws BeansException
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#registerSingleton(java.lang.String,
java.lang.Object)
+	 */
+	public void registerSingleton(String arg0, Object arg1) throws BeansException {
+		this.beanFactory.registerSingleton(arg0, arg1);
+	}
+
+	/**
+	 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory(org.springframework.beans.factory.BeanFactory)
+	 */
+	public void setParentBeanFactory(BeanFactory arg0) {
+		this.beanFactory.setParentBeanFactory(arg0);
+	}
+
+	public Object getBeanFromReinhard(String name) {
+		return this.getBean(name);
+	}
 
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java?rev=392758&r1=392757&r2=392758&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
Sun Apr  9 08:39:19 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.environment.impl;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -127,9 +128,25 @@
     }
 
     /**
+     * Get access to the resource as @link {@link InputStream}. If there is any problem,
+     * <code>null</code> is returned.
+     * 
      * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
      */
-    public InputStream getResourceAsStream(String arg0) {
+    public InputStream getResourceAsStream(String path) {
+    	URL resourceURL = null;
+		try {
+			resourceURL = this.getResource(path);
+		} catch (MalformedURLException e) {
+			return null;
+		}
+    	if(resourceURL != null) {
+    		try {
+				return resourceURL.openStream();
+			} catch (IOException e) {
+				return null;
+			}
+    	}
         return null;
     }
 



Mime
View raw message