You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by sg...@apache.org on 2008/07/18 17:59:13 UTC

svn commit: r677950 [1/2] - in /turbine/fulcrum/trunk/spring: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/fulcrum/ src/java/org/apache/fulcrum/spring/ src/main/ src/main/assembly/ src/site/ src/test/ src/test/org/ src/test/...

Author: sgoeschl
Date: Fri Jul 18 08:59:11 2008
New Revision: 677950

URL: http://svn.apache.org/viewvc?rev=677950&view=rev
Log:
Initial import of fulcrum-spring to allow integrating/accessing Spring beans from Avalon and the other way around.

Added:
    turbine/fulcrum/trunk/spring/
    turbine/fulcrum/trunk/spring/LICENSE.txt
    turbine/fulcrum/trunk/spring/NOTICE.txt
    turbine/fulcrum/trunk/spring/pom.xml
    turbine/fulcrum/trunk/spring/src/
    turbine/fulcrum/trunk/spring/src/java/
    turbine/fulcrum/trunk/spring/src/java/org/
    turbine/fulcrum/trunk/spring/src/java/org/apache/
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonContainerBean.java
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonServiceFactoryBean.java
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/BeanFactoryServiceManager.java
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkService.java
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkServiceImpl.java
    turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/YaafiContainerBean.java
    turbine/fulcrum/trunk/spring/src/main/
    turbine/fulcrum/trunk/spring/src/main/assembly/
    turbine/fulcrum/trunk/spring/src/main/assembly/bin.xml
    turbine/fulcrum/trunk/spring/src/main/assembly/src.xml
    turbine/fulcrum/trunk/spring/src/site/
    turbine/fulcrum/trunk/spring/src/site/site.xml
    turbine/fulcrum/trunk/spring/src/test/
    turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringApplicationContext.xml
    turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentConfiguration.xml
    turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentRoles.xml
    turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringContainerConfiguration.xml
    turbine/fulcrum/trunk/spring/src/test/org/
    turbine/fulcrum/trunk/spring/src/test/org/apache/
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/AvalonIntoSpringTest.java
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonService.java
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonServiceImpl.java
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringService.java
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringServiceImpl.java
    turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/SpringIntoAvalonTest.java
    turbine/fulcrum/trunk/spring/src/test/springIntoAvalonApplicationContext.xml
    turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentConfiguration.xml
    turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentRoles.xml
    turbine/fulcrum/trunk/spring/src/test/springIntoAvalonContainerConfiguration.xml
    turbine/fulcrum/trunk/spring/xdocs/
    turbine/fulcrum/trunk/spring/xdocs/changes.xml
    turbine/fulcrum/trunk/spring/xdocs/configuration.xml
    turbine/fulcrum/trunk/spring/xdocs/index.xml

Added: turbine/fulcrum/trunk/spring/LICENSE.txt
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/LICENSE.txt?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/LICENSE.txt (added)
+++ turbine/fulcrum/trunk/spring/LICENSE.txt Fri Jul 18 08:59:11 2008
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: turbine/fulcrum/trunk/spring/NOTICE.txt
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/NOTICE.txt?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/NOTICE.txt (added)
+++ turbine/fulcrum/trunk/spring/NOTICE.txt Fri Jul 18 08:59:11 2008
@@ -0,0 +1,6 @@
+Turbine Fulcrum YAAFI
+Copyright 2002-2008s The Apache Software Foundation.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+

Added: turbine/fulcrum/trunk/spring/pom.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/pom.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/pom.xml (added)
+++ turbine/fulcrum/trunk/spring/pom.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<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">
+  <parent>
+    <groupId>fulcrum</groupId>
+    <artifactId>fulcrum-parent</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>fulcrum-spring</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <name>Fulcrum Spring</name>
+  <inceptionYear>2008</inceptionYear>
+  <description>Fulcrum Spring Container Integration Service</description>
+  <url>http://turbine.apache.org/fulcrum/fulcrum-spring</url>
+		
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/turbine/fulcrum/trunk/spring/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/spring/</developerConnection>
+    <url>http://svn.apache.org/viewcvs/turbine/fulcrum/trunk/spring/</url>
+  </scm>
+
+  <distributionManagement>
+    <site>
+      <id>fulcrum.website</id>
+      <name>Fulcrum Website</name>
+      <!-- <url>${fulcrum.deployment.protocol}://people.apache.org/www/turbine.apache.org/fulcrum/fulcrum-spring/</url> -->
+      <url>${fulcrum.deployment.protocol}://people.apache.org/x1/home/sgoeschl/public_html/download/fulcrum-spring/</url>
+    </site>    
+  </distributionManagement>
+	
+  <developers>
+    <developer>
+      <name>Siegfried Goeschl</name>
+      <id>sgoeschl</id>
+      <email>sgoeschl@apache.org</email>
+      <organization></organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+    </developer>
+  </developers>
+
+  <dependencies>
+    <!-- Avalon dependencies -->
+    <dependency>
+      <groupId>avalon-framework</groupId>
+      <artifactId>avalon-framework-api</artifactId>
+      <version>4.3</version>
+      <exclusions>
+        <exclusion>
+          <groupId>avalon-logkit</groupId>
+          <artifactId>avalon-logkit</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- Fulcrum dependecies -->
+    <dependency>
+      <groupId>fulcrum</groupId>
+      <artifactId>fulcrum-servicemanager</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>               
+    <!-- The YaafiContainerBean requires YAAFI -->
+    <dependency>
+      <groupId>fulcrum</groupId>
+      <artifactId>fulcrum-yaafi</artifactId>
+      <version>1.0.6-SNAPSHOT</version>
+      <optional>true</optional>
+    </dependency>
+    <!-- Spring depedencies - these are optional so you have to declare your Spring dependency manually -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>${spring.version}</version>    
+      <optional>true</optional>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.mail</groupId>
+          <artifactId>mail</artifactId>
+        </exclusion>
+      </exclusions>            
+    </dependency>    
+    <!-- testing dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>${basedir}/src/java</sourceDirectory>
+    <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
+  </build>
+	
+  <properties>  
+    <!-- Default configuration for compiler source and target JVM -->
+    <maven.compile.source>1.4</maven.compile.source>
+    <maven.compile.target>1.4</maven.compile.target>
+    <!-- the version to pick up -->
+    <spring.version>1.2.9</spring.version>    
+  </properties>  
+
+</project>

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonContainerBean.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonContainerBean.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonContainerBean.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonContainerBean.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,209 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import java.util.Map;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.logger.CommonsLogger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanNameAware;
+import org.springframework.beans.BeansException;
+
+/**
+ * Base class to create an Avalon container as Spring bean.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public abstract class AvalonContainerBean implements BeanNameAware, BeanFactoryAware, ServiceManager, Initializable, Disposable
+{
+    /** The service manager used for service lookups */
+    private ServiceManager serviceManager;
+
+    /** The logger being used */
+    private Logger logger;
+
+    /** the name of the bean */
+    private String beanName;
+
+    /** the Spring bean factory creating this instance */
+    private BeanFactory beanFactory;
+
+    /** the Avalon default context passed to the container */
+    private Map defaultContext;
+
+    /**
+     * Constructor
+     */
+    public AvalonContainerBean()
+    {
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Service Interface Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Initialize the instance. This method must be configured using
+     * the 'init-method' attribute.
+     *
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     * @throws Exception the initialization failed
+     */
+    public abstract void initialize() throws Exception;
+
+    /**
+     * Dispose the YAAFI container. This method must be configured using
+     * the 'destroy-method' attribute.
+     *
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public abstract void dispose();
+
+    /**
+     * @see org.apache.avalon.framework.service.ServiceManager#lookup(String)
+     */
+    public Object lookup(String s) throws ServiceException
+    {
+        return this.getServiceManager().lookup(s);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.ServiceManager#hasService(String)
+     */
+    public boolean hasService(String s)
+    {
+        return this.getServiceManager().hasService(s);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.ServiceManager#release(Object)
+     */
+    public void release(Object o)
+    {
+        this.getServiceManager().release(o);
+    }
+
+    /**
+     * @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
+     */
+    public void setBeanFactory(BeanFactory beanFactory) throws BeansException
+    {
+        this.beanFactory = beanFactory;
+    }
+
+    /**
+     * @see org.springframework.beans.factory.BeanNameAware#setBeanName(String)
+     */
+    public void setBeanName(String name)
+    {
+        this.beanName = name;
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Generated getters & setters
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * @return Returns the logger.
+     */
+    public Logger getLogger()
+    {
+        if(this.logger == null)
+        {
+            this.logger = this.createLogger();
+        }
+
+        return this.logger;
+    }
+
+    /**
+     * @param logger The logger to set.
+     */
+    public void setLogger(Logger logger)
+    {
+        this.logger = logger;
+    }
+
+
+    /**
+     * Get the values for the custom Avalon context
+     *
+     * @return the Avalon default context
+     */
+    public Map getDefaultContext() {
+        return defaultContext;
+    }
+
+    /**
+     * Allows setting a custom Avalon context.
+     * 
+     * @param defaultContext The Avalon default context to set
+     */
+    public void setDefaultContext(Map defaultContext) {
+        this.defaultContext = defaultContext;
+    }
+
+    /**
+     * @return the Spring bean name
+     */
+    public String getBeanName() {
+        return beanName;
+    }
+
+    /**
+     * @return the Spring bean factory
+     */
+    public BeanFactory getBeanFactory() {
+        return beanFactory;
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Create the Avalon Logger to be used for the Avalon container. This
+     * method can be overridden if you don't want a CommonsLogger.
+     *
+     * @return avalon loggger
+     */
+    protected Logger createLogger()
+    {
+        Log log = LogFactory.getLog(this.getBeanName());
+        return new CommonsLogger(log, this.getBeanName());
+    }
+
+    protected ServiceManager getServiceManager()
+    {
+        return this.serviceManager;
+    }
+
+    protected void setServiceManager(ServiceManager serviceManager) {
+        this.serviceManager = serviceManager;
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonServiceFactoryBean.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonServiceFactoryBean.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/AvalonServiceFactoryBean.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,93 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.apache.avalon.framework.service.ServiceManager;
+
+/**
+ * A Spring factory bean to lookup Avalon service and get a hold on
+ * them as Spring bean. Such spring bean can than be injected as dependency
+ * into other beans.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class AvalonServiceFactoryBean implements FactoryBean, InitializingBean {
+
+    /** the Avalon ServiceManager */
+    private ServiceManager serviceManager;
+
+    /** the name of the Avalon service to resolve */
+    private String serviceName;
+
+    /** the resolved Avalon service */
+    private Object service;
+
+    /**
+     * Resolve the service name to a service.
+     * 
+     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+     */
+    public void afterPropertiesSet() throws Exception
+    {
+        this.service = this.serviceManager.lookup(this.serviceName);            
+    }
+
+    /**
+     * Set the Avalon ServiceManager to lookup the Avalon service.
+     *
+     * @param serviceManager the Avalon ServiceManager
+     */
+    public void setServiceManager(ServiceManager serviceManager)
+    {
+        this.serviceManager = serviceManager;
+    }
+
+    /**
+     * Set the name of the Avalon service to be resolved by
+     * this Spring bean factory.
+     *
+     * @param serviceName the Avalon service name
+     */
+    public void setServiceName(String serviceName)
+    {
+        this.serviceName = serviceName;
+    }
+
+    /** @see org.springframework.beans.factory.FactoryBean#getObject() */
+    public Object getObject() throws Exception
+    {
+        return this.service;
+    }
+
+    /** @see org.springframework.beans.factory.FactoryBean#getObjectType() */
+    public Class getObjectType()
+    {
+        return this.service.getClass();
+    }
+
+    /** @see org.springframework.beans.factory.FactoryBean#isSingleton() */
+    public boolean isSingleton()
+    {
+        return true;
+    }
+}

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/BeanFactoryServiceManager.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/BeanFactoryServiceManager.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/BeanFactoryServiceManager.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/BeanFactoryServiceManager.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,71 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.springframework.beans.factory.BeanFactory;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+
+/**
+ * Wraps a Spring bean factory to implement an Avalon service
+ * lookup - this allows to delegate a service lookup to Spring.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class BeanFactoryServiceManager implements ServiceManager
+{
+    /** Spring's bean factory */
+    private BeanFactory beanFactory;
+
+    /**
+     * Constructor
+     *
+     * @param beanFactory Spring's bean factory
+     */
+    public BeanFactoryServiceManager(BeanFactory beanFactory)
+    {
+        this.beanFactory = beanFactory;
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#lookup(String) */
+    public Object lookup(String key) throws ServiceException
+    {
+        try
+        {
+            return beanFactory.getBean(key);
+        }
+        catch(Exception e)
+        {
+            throw new ServiceException(key, "Unable to lookup service using Spring's BeanFactory", e);
+        }
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#hasService(String) */
+    public boolean hasService(String key)
+    {
+        return beanFactory.containsBean(key);
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#release(Object) */
+    public void release(Object o)
+    {
+        // nothing to do for Spring beans
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkService.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkService.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkService.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,36 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.springframework.context.support.AbstractApplicationContext;
+
+/**
+ * Starts an instance of the Spring Service Framework as Avalon service.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public interface SpringFrameworkService
+{
+    /**
+     * @return the underlying Spring container
+     */
+    AbstractApplicationContext getAbstractApplicationContext();
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkServiceImpl.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkServiceImpl.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/SpringFrameworkServiceImpl.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,163 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ * Starts an instance of the Spring Service Framework as Avalon service.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class SpringFrameworkServiceImpl
+    extends AbstractLogEnabled
+    implements SpringFrameworkService, Configurable, Initializable, Disposable, ServiceManager
+{
+    /** the list of configuration files passed to the Spring container */
+    private String[] configLocations;
+
+    /** the Spring service container */
+    private AbstractApplicationContext ctx;
+
+    /** ServiceManager facade to lookup Spring services */
+    private BeanFactoryServiceManager beanFactoryServiceManager;
+
+    /////////////////////////////////////////////////////////////////////////
+    // Avalon Service Lifecycle Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructor
+     */
+    public SpringFrameworkServiceImpl()
+    {
+        this.configLocations = new String[0];
+    }
+
+    /**
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(Configuration configuration) throws ConfigurationException
+    {
+
+        // parse the 'configLocations' to passed to Spring
+
+        Configuration[] configLocationConfigurationList = configuration.getChild("configurations").getChildren("configuration");
+        this.configLocations = new String[configLocationConfigurationList.length];
+
+        for(int i=0; i<configLocations.length; i++)
+        {
+            this.configLocations[i] = configLocationConfigurationList[i].getValue();
+        }
+
+        if(this.configLocations.length == 0)
+        {
+            String msg = "No configuration files for the Spring container are defined";
+            throw new ConfigurationException(msg);
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    public void initialize() throws Exception
+    {
+        this.ctx = new FileSystemXmlApplicationContext(this.configLocations);
+        this.beanFactoryServiceManager = new BeanFactoryServiceManager(ctx);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose()
+    {
+        if(this.ctx != null)
+        {
+            try
+            {
+                this.ctx.close();
+            }
+            catch(Exception e)
+            {
+                String msg = "Failed to dispose the Spring service";
+                this.getLogger().error(msg, e);
+            }
+            finally
+            {
+                this.ctx = null;
+            }
+        }
+
+        this.beanFactoryServiceManager = null;        
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Service interface implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /** @see SpringFrameworkService#getAbstractApplicationContext() */ 
+    public AbstractApplicationContext getAbstractApplicationContext()
+    {
+        return this.ctx;
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#lookup(String) */
+    public Object lookup(String key) throws ServiceException
+    {
+        if(this.beanFactoryServiceManager == null)
+        {
+            throw new RuntimeException("The SpringFrameworkService is not yet initialized");
+        }
+
+        return this.beanFactoryServiceManager.lookup(key);
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#hasService(String)  */
+    public boolean hasService(String key)
+    {
+        if(this.beanFactoryServiceManager == null)
+        {
+            throw new RuntimeException("The SpringFrameworkService is not yet initialized");
+        }
+
+        return this.beanFactoryServiceManager.hasService(key);
+    }
+
+    /** @see org.apache.avalon.framework.service.ServiceManager#release(Object)  */
+    public void release(Object o)
+    {
+        if(this.beanFactoryServiceManager == null)
+        {
+            throw new RuntimeException("The SpringFrameworkService is not yet initialized");
+        }
+
+        this.beanFactoryServiceManager.release(o);
+    }    
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/YaafiContainerBean.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/YaafiContainerBean.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/YaafiContainerBean.java (added)
+++ turbine/fulcrum/trunk/spring/src/java/org/apache/fulcrum/spring/YaafiContainerBean.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,194 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
+
+/**
+ * A POJO starting/stopping the YAAFI container and exposing a ServiceManager.
+ * This allows to run an Avalon container within Spring and to lookup Avalon
+ * services using the exposed ServiceManager.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class YaafiContainerBean extends AvalonContainerBean
+{
+    /** The location of the container configuration */
+    private String containerConfigValue;
+
+    /** the working directory */
+    private String applicationHome;
+
+    /** the temp directory */
+    private String tempHome;
+    
+    /**
+     * Constructor
+     */
+    public YaafiContainerBean()
+    {
+        super();
+        
+        this.containerConfigValue   = "./conf/containerConfiguration.xml";
+        this.applicationHome        = ".";
+        this.tempHome               = System.getProperty("java.io.tmpdir",".");
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Interface Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Initialize the instance. This method must be configured using
+     * the 'init-method' attribute. 
+     *
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     * @throws Exception the initialization failed
+     */
+    public void initialize() throws Exception
+    {
+        ServiceContainerConfiguration config = new ServiceContainerConfiguration();
+
+        // wrap Spring's BeanFactory to allow service lookups
+        BeanFactoryServiceManager beanFactoryServiceManager = new BeanFactoryServiceManager(this.getBeanFactory());
+
+        // intialize the Avalon serviceContainer
+        config.setLogger( this.getLogger() );
+        config.setApplicationRootDir( this.getApplicationHome() );
+        config.setTempRootDir( this.getTempHome() );
+        config.loadContainerConfiguration( this.getContainerConfigValue(), "auto" );
+        config.setParentServiceManager(beanFactoryServiceManager);
+        config.setContext(new DefaultContext(this.getDefaultContext()));
+
+        this.setServiceManager(ServiceContainerFactory.create(config));
+    }
+
+    /**
+     * Dispose the YAAFI container. This method must be configured using
+     * the 'destroy-method' attribute.
+     *
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose()
+    {
+        if( this.getServiceManager() == null)
+        {
+            return;
+        }
+
+        try
+        {
+            // dispose the service serviceContainer
+            ((Disposable) this.getServiceManager()).dispose();
+        }
+        catch (Exception e)
+        {
+            String msg = "Failed to terminate " + this.getClass().getName();
+            this.getLogger().error(msg,e);
+        }
+        finally {
+            this.setServiceManager(null);
+        }
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Generated getters & setters
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * @return Returns the applicationHome.
+     */
+    public String getApplicationHome()
+    {
+        return this.applicationHome;
+    }
+
+    /**
+     * @param applicationHome The applicationHome to set.
+     */
+    public void setApplicationHome(String applicationHome)
+    {
+        this.applicationHome = applicationHome;
+    }
+
+    /**
+     * @return Returns the containerConfigValue.
+     */
+    public String getContainerConfigValue()
+    {
+        return containerConfigValue;
+    }
+
+    /**
+     * @param containerConfigValue The containerConfigValue to set.
+     */
+    public void setContainerConfigValue(String containerConfigValue)
+    {
+        this.containerConfigValue = containerConfigValue;
+    }
+
+    /**
+     * @return Returns the tempHome.
+     */
+    public String getTempHome()
+    {
+        return this.tempHome;
+    }
+
+    /**
+     * @param tempHome The tempHome to set.
+     */
+    public void setTempHome(String tempHome)
+    {
+        this.tempHome = tempHome;
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuffer result = new StringBuffer();
+        result.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode()));
+        result.append('[');
+        result.append("beanName=").append(this.getBeanName());
+        result.append(',');
+        result.append("workingDir=").append(new File("").getAbsolutePath());
+        result.append(',');
+        result.append("applicationHome=").append(this.getApplicationHome());
+        result.append(',');
+        result.append("tempHome=").append(this.getTempHome());
+        result.append(',');
+        result.append("logger=").append(this.getLogger().getClass().getName());
+        result.append(',');
+        result.append("containerConfigValue=").append(this.getContainerConfigValue());
+        result.append(']');
+        return result.toString();
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/main/assembly/bin.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/main/assembly/bin.xml (added)
+++ turbine/fulcrum/trunk/spring/src/main/assembly/bin.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,43 @@
+<!--
+ 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.
+-->
+<assembly>
+    <id>bin</id>
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+    <includeSiteDirectory>false</includeSiteDirectory>
+    <fileSets>
+        <fileSet>
+            <includes>
+                <include>LICENSE.txt</include>
+                <include>NOTICE.txt</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>*.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target/site/apidocs</directory>
+            <outputDirectory>apidocs</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>

Added: turbine/fulcrum/trunk/spring/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/main/assembly/src.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/main/assembly/src.xml (added)
+++ turbine/fulcrum/trunk/spring/src/main/assembly/src.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,41 @@
+<!--
+ 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.
+-->
+<assembly>
+    <id>src</id>
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+    <baseDirectory>${artifactId}-${version}-src</baseDirectory>
+    <fileSets>
+        <fileSet>
+            <includes>
+                <include>build.xml</include>
+                <include>LICENSE.txt</include>
+                <include>NOTICE.txt</include>
+                <include>pom.xml</include>
+                <include>STATUS</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>src</directory>
+        </fileSet>
+        <fileSet>
+            <directory>xdocs</directory>
+        </fileSet>
+    </fileSets>
+</assembly>

Added: turbine/fulcrum/trunk/spring/src/site/site.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/site/site.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/site/site.xml (added)
+++ turbine/fulcrum/trunk/spring/src/site/site.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,28 @@
+<?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.
+-->
+<project name="Fulcrum Spring Framework">
+  <body>
+    <menu name="Overview">
+      <item name="About"               href="/index.html"/>
+      <item name="Configuration"       href="/configuration.html"/>
+    </menu>  
+    ${reports}
+  </body>
+</project>

Added: turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringApplicationContext.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringApplicationContext.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringApplicationContext.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringApplicationContext.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">        
+<!--
+ 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.
+-->
+<beans>
+
+    <!-- Instantiate YAAFI using a container configuration file -->
+    <bean id="avalonContainerBean" class="org.apache.fulcrum.spring.YaafiContainerBean" init-method="initialize"
+          destroy-method="dispose">
+        <property name="containerConfigValue" value="./src/test/avalonIntoSpringContainerConfiguration.xml"/>
+        <property name="defaultContext">
+            <map>
+                <entry>
+                    <key>
+                        <value>container</value>
+                    </key>
+                    <value>yaafi</value>
+                </entry>
+            </map>
+        </property>
+    </bean>
+
+    <!-- Create service bean using a factory bean -->
+    <bean id="systemPropertyService" class="org.apache.fulcrum.spring.AvalonServiceFactoryBean">
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="serviceName" value="systemPropertyService"/>
+    </bean>
+
+    <!-- Create a Spring bean using Avalon services -->    
+    <bean id="customSpringService" class="org.apache.fulcrum.spring.CustomSpringServiceImpl">
+        <property name="greeting" value="Hello Avalon!!!"/>
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="systemPropertyService" ref="systemPropertyService"/>
+    </bean>
+
+    <!-- Create service bean using a factory bean -->
+    <bean id="customAvalonService" class="org.apache.fulcrum.spring.AvalonServiceFactoryBean">
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="serviceName" value="customAvalonService"/>
+    </bean>
+    
+</beans>

Added: turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentConfiguration.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentConfiguration.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentConfiguration.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentConfiguration.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,24 @@
+<?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.
+-->
+<componentConfig>
+  <systemPropertyService>
+    <property name="FOO">BAR</property>
+  </systemPropertyService>
+</componentConfig>

Added: turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentRoles.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentRoles.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentRoles.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringComponentRoles.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,37 @@
+<?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.
+-->
+<!-- This configuration file for Avalon components is used for testing the TestComponent -->
+<role-list>
+    <role
+        name="systemPropertyService"
+        default-class="org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyServiceImpl"
+    />
+    <!--
+      we have to rely on lazy init otherwise the service lookups between the to
+      service frameworks fails (Yaafi tries to resolve the Sprin Bean, whereas Spring
+      tries to resolve the Avalon service at the same time)
+    -->
+    <role
+        name="customAvalonService"
+        default-class="org.apache.fulcrum.spring.CustomAvalonServiceImpl"
+        early-init="false"
+    />
+
+</role-list>

Added: turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringContainerConfiguration.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringContainerConfiguration.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringContainerConfiguration.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/avalonIntoSpringContainerConfiguration.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,27 @@
+<?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.
+-->
+<fulcrum-yaafi>
+  <componentRoles>
+    <location>./src/test/avalonIntoSpringComponentRoles.xml</location>
+  </componentRoles>
+  <componentConfiguration>
+    <location>./src/test/avalonIntoSpringComponentConfiguration.xml</location>
+  </componentConfiguration>
+</fulcrum-yaafi>

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/AvalonIntoSpringTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/AvalonIntoSpringTest.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/AvalonIntoSpringTest.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/AvalonIntoSpringTest.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,138 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.beans.BeansException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+
+/**
+ * Instantiate an Avalon container within Spring and use
+ * the available services.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class AvalonIntoSpringTest extends TestCase
+{
+    private static final String GREETING = "Hello Avalon!!!";
+    private AbstractApplicationContext ctx;
+
+    /** @see junit.framework.TestCase#setUp() */
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.ctx = new FileSystemXmlApplicationContext("./src/test/avalonIntoSpringApplicationContext.xml");
+    }
+
+    /** @see junit.framework.TestCase#tearDown() () */
+    protected void tearDown() throws Exception {
+        this.ctx.close();        
+        super.tearDown();
+    }
+
+    /**
+     * Constructor
+     *
+     * @param name the name of the test case
+     */
+    public AvalonIntoSpringTest( String name )
+    {
+        super(name);
+    }
+
+    /**
+     * Get the Avalon container.
+     *
+     * @throws Exception the test failed
+     */
+    public void testGetAvalonContainer() throws Exception
+    {
+        ServiceManager serviceManager = (ServiceManager) ctx.getBean("avalonContainerBean");
+        assertNotNull(serviceManager);
+    }
+
+    /**
+     * Test the Avalon into Spring integration.
+     *
+     * @throws Exception the test failed
+     */
+    public void testAvalonIntoSpringIntegration() throws Exception
+    {
+        // ensure that the Avalon SystemPropertyService updated the system properties (so it was properly started)
+        assertTrue(System.getProperty("FOO").equals("BAR"));
+
+        CustomAvalonService customAvalonService;
+        CustomSpringService customSpringService;
+        ServiceManager serviceManager = (ServiceManager) ctx.getBean("avalonContainerBean");
+
+        // lookup and use the Spring bean using Spring's context
+        customSpringService = (CustomSpringService) ctx.getBean("customSpringService");
+        customSpringService.sayGretting();
+        assertEquals(customSpringService.getGreeting(), GREETING);
+
+        // lookup and use the Spring bean using Avalon's Service Manager
+        customSpringService = (CustomSpringService) serviceManager.lookup("customSpringService");
+        customSpringService.sayGretting();
+        assertEquals(customSpringService.getGreeting(), GREETING);
+
+        // lookup and use the Avalon service using Spring's context
+        customAvalonService = (CustomAvalonService) ctx.getBean("customAvalonService");
+        customAvalonService.sayGretting();
+        assertEquals(customAvalonService.getGreeting(), GREETING);
+
+        // lookup and use the Avalon service using Avalon's Service Manager
+        customAvalonService = (CustomAvalonService) serviceManager.lookup("customAvalonService");
+        customAvalonService.sayGretting();
+        assertEquals(customAvalonService.getGreeting(), GREETING);
+
+        // try to find a non-existing service using Avalon's Service Manager
+        try
+        {
+            serviceManager.lookup("foo");
+            fail("Looking up a non-existing service must throw a ServiceException");
+        }
+        catch(ServiceException e)
+        {
+            // nothing to do
+        }
+        catch(Exception e)
+        {
+            fail("Looking up a non-existing service must throw a ServiceException");
+        }
+
+        // try to find a non-existing service using Spring's context
+        try
+        {
+            ctx.getBean("foo");
+            fail("Looking up a non-existing service must throw a BeansException");
+        }
+        catch(BeansException e)
+        {
+            // nothing to do
+        }
+        catch(Exception e)
+        {
+            fail("Looking up a non-existing service must throw a BeansException");                        
+        }
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonService.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonService.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonService.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,26 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+public interface CustomAvalonService
+{
+    void sayGretting();
+    String getGreeting();
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonServiceImpl.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonServiceImpl.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomAvalonServiceImpl.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,63 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+
+
+/**
+ * Copies the properties found in the configuration into the SystemProperties
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class CustomAvalonServiceImpl
+    implements CustomAvalonService, Serviceable
+{
+    // a spring bean resolved by the Avalon ServiceManager */
+    private CustomSpringService customSpringService;
+    
+    /**
+     * Constructor
+     */
+    public CustomAvalonServiceImpl()
+    {
+        // nothing to do here
+    }
+
+    public void service(ServiceManager serviceManager) throws ServiceException
+    {
+        this.customSpringService = (CustomSpringService) serviceManager.lookup("customSpringService");
+    }
+
+    public void sayGretting()
+    {
+        // delegate the functionality to the Spring bean
+        this.customSpringService.sayGretting();
+    }
+
+    public String getGreeting()
+    {
+        // delegate the functionality to the Spring bean
+        return this.customSpringService.getGreeting();
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringService.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringService.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringService.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,26 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+public interface CustomSpringService {
+
+    String getGreeting();
+    void sayGretting();
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringServiceImpl.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringServiceImpl.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/CustomSpringServiceImpl.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,63 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyService;
+import org.apache.avalon.framework.service.ServiceManager;
+
+/**
+ * A Spring bean using Avalon services.
+ */
+public class CustomSpringServiceImpl implements CustomSpringService {
+
+    /** message injected from the Spring configuration */
+    private String greeting;
+
+    /** directly injected as reference*/
+    private ServiceManager serviceManager;
+
+    /** injected using AvalonServiceFactoryBean (the service is instantiated by YAAFI) */
+    private SystemPropertyService systemPropertyService;
+
+    public CustomSpringServiceImpl() {
+    }
+
+    public String getGreeting() {
+        return greeting;
+    }
+
+    public void setGreeting(String greeting) {
+        this.greeting = greeting;
+    }
+
+    public void setServiceManager(ServiceManager serviceManager) {
+        this.serviceManager = serviceManager;
+    }
+
+    public void setSystemPropertyService(SystemPropertyService systemPropertyService) {
+        this.systemPropertyService = systemPropertyService;
+    }
+
+    public void sayGretting() {
+        System.out.println(this.greeting);
+        System.out.println(this.serviceManager.toString());
+        System.out.println(this.systemPropertyService.toString());
+    }
+}

Added: turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/SpringIntoAvalonTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/SpringIntoAvalonTest.java?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/SpringIntoAvalonTest.java (added)
+++ turbine/fulcrum/trunk/spring/src/test/org/apache/fulcrum/spring/SpringIntoAvalonTest.java Fri Jul 18 08:59:11 2008
@@ -0,0 +1,158 @@
+package org.apache.fulcrum.spring;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
+import org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyService;
+import org.apache.fulcrum.spring.SpringFrameworkService;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.beans.BeansException;
+
+/**
+ * Instantiate a Spring framework instance within an Avalon
+ * Container and use the services.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class SpringIntoAvalonTest extends TestCase
+{
+    private static final String GREETING = "Hello Avalon!!!";
+    private ServiceContainer container;
+    
+    /**
+     * Constructor
+     * @param name the name of the test case
+     */
+    public SpringIntoAvalonTest( String name )
+    {
+        super(name);
+    }
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        ServiceContainerConfiguration config = new ServiceContainerConfiguration();
+        config.loadContainerConfiguration( "./src/test/springIntoAvalonContainerConfiguration.xml" );
+        this.container = ServiceContainerFactory.create( config );
+    }
+
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        ServiceContainerFactory.dispose(this.container);
+        super.tearDown();
+    }
+
+    /**
+     * Get the SpringFrameworkService.
+     *
+     * @throws Exception the test failed 
+     */
+    public void testGetSpringFrameworkService() throws Exception
+    {
+        SpringFrameworkService service = (SpringFrameworkService) this.container.lookup("springFrameworkService");
+        assertNotNull(service);
+    }
+
+    /**
+     * Test the Avalon into Spring integration.
+     *
+     * @throws Exception the test failed
+     */
+    public void testAvalonIntoSpringIntegration() throws Exception
+    {
+        SpringFrameworkService service = (SpringFrameworkService) this.container.lookup("springFrameworkService");
+        AbstractApplicationContext ctx = service.getAbstractApplicationContext();
+        
+        // ensure that the Avalon SystemPropertyService updated the system properties (so it was properly started)
+        assertTrue(System.getProperty("FOO").equals("BAR"));
+
+        CustomAvalonService customAvalonService;
+        CustomSpringService customSpringService;
+        SystemPropertyService systemPropertyService;
+        ServiceManager serviceManager = (ServiceManager) ctx.getBean("avalonContainerBean");
+
+        // lookup and use the Spring bean using Spring's context
+        systemPropertyService = (SystemPropertyService) ctx.getBean("systemPropertyService");
+        assertNotNull(systemPropertyService);
+
+        // lookup and use the Spring bean using Spring's context
+        customSpringService = (CustomSpringService) ctx.getBean("customSpringService");
+        customSpringService.sayGretting();
+        assertEquals(customSpringService.getGreeting(), GREETING);
+
+        // lookup and use the Spring bean using Avalon's Service Manager
+        customSpringService = (CustomSpringService) serviceManager.lookup("customSpringService");
+        customSpringService.sayGretting();
+        assertEquals(customSpringService.getGreeting(), GREETING);
+
+        // lookup and use the Avalon service using Spring's context
+        customAvalonService = (CustomAvalonService) ctx.getBean("customAvalonService");
+        customAvalonService.sayGretting();
+        assertEquals(customAvalonService.getGreeting(), GREETING);
+        
+        // lookup and use the Avalon service using Avalon's Service Manager
+        customAvalonService = (CustomAvalonService) serviceManager.lookup("customAvalonService");
+        customAvalonService.sayGretting();
+        assertEquals(customAvalonService.getGreeting(), GREETING);
+
+        // try to find a non-existing service using Avalon's Service Manager
+        try
+        {
+            serviceManager.lookup("foo");
+            fail("Looking up a non-existing service must throw a ServiceException");
+        }
+        catch(ServiceException e)
+        {
+            // nothing to do
+        }
+        catch(Exception e)
+        {
+            fail("Looking up a non-existing service must throw a ServiceException");
+        }
+
+        // try to find a non-existing service using Spring's context
+        try
+        {
+            ctx.getBean("foo");
+            fail("Looking up a non-existing service must throw a BeansException");
+        }
+        catch(BeansException e)
+        {
+            // nothing to do
+        }
+        catch(Exception e)
+        {
+            fail("Looking up a non-existing service must throw a BeansException");
+        }        
+    }
+}
\ No newline at end of file

Added: turbine/fulcrum/trunk/spring/src/test/springIntoAvalonApplicationContext.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/springIntoAvalonApplicationContext.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/springIntoAvalonApplicationContext.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/springIntoAvalonApplicationContext.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">        
+<!--
+ 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.
+-->
+<beans>
+
+    <!-- Get a hold on an Avalon Service Manager -->
+    <bean id="avalonContainerBean" 
+      class="org.apache.fulcrum.servicemanager.ServiceManagerServiceImpl" 
+      factory-method="getInstance"
+    />
+
+    <!-- Create service bean using a factory bean -->
+    <bean id="systemPropertyService" class="org.apache.fulcrum.spring.AvalonServiceFactoryBean">
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="serviceName" value="systemPropertyService"/>
+    </bean>
+    
+    <!-- Create a Spring bean using Avalon services -->    
+    <bean id="customSpringService" class="org.apache.fulcrum.spring.CustomSpringServiceImpl">
+        <property name="greeting" value="Hello Avalon!!!"/>
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="systemPropertyService" ref="systemPropertyService"/>
+    </bean>
+    
+    <!-- 
+      Create service bean using a factory bean. We have to rely on lazy init otherwise 
+      the service lookups between the to service frameworks fails (YAAFI tries to resolve 
+      the Spring Bean, whereas Spring tries to resolve the Avalon service at the same time)
+    -->    
+    <bean id="customAvalonService" class="org.apache.fulcrum.spring.AvalonServiceFactoryBean" lazy-init="true">
+        <property name="serviceManager" ref="avalonContainerBean"/>
+        <property name="serviceName" value="customAvalonService"/>
+    </bean>    
+
+</beans>

Added: turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentConfiguration.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentConfiguration.xml?rev=677950&view=auto
==============================================================================
--- turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentConfiguration.xml (added)
+++ turbine/fulcrum/trunk/spring/src/test/springIntoAvalonComponentConfiguration.xml Fri Jul 18 08:59:11 2008
@@ -0,0 +1,29 @@
+<?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.
+-->
+<componentConfig>
+  <systemPropertyService>
+    <property name="FOO">BAR</property>
+  </systemPropertyService>
+  <springFrameworkService>
+    <configurations>
+      <configuration>./src/test/springIntoAvalonApplicationContext.xml</configuration>
+    </configurations>
+  </springFrameworkService>  
+</componentConfig>