You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by se...@apache.org on 2007/04/29 15:22:29 UTC
svn commit: r533501 - in /jakarta/turbine/core/branches/TURBINE_2_3_BRANCH:
./ src/java/org/apache/turbine/services/avaloncomponent/ src/test/
src/test/org/apache/turbine/services/avaloncomponent/ xdocs/ xdocs/services/
Author: seade
Date: Sun Apr 29 06:22:28 2007
New Revision: 533501
URL: http://svn.apache.org/viewvc?view=rev&rev=533501
Log:
Added Thomas's variation on Siegfried's TurbineYaafiComponentService that allows Fulcrum components to be used in Turbine 2.3 in a fulcrum-yaafi container.
This fixes TRB-27.
Added:
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentService.java
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentServiceTest.java
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentConfiguration.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentRoles.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiContainerConfiguration.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/yaafi-component-service.xml
Modified:
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/project.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/navigation.xml
jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/avalon-component-service.xml
Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/project.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/project.xml?view=diff&rev=533501&r1=533500&r2=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/project.xml (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/project.xml Sun Apr 29 06:22:28 2007
@@ -596,6 +596,16 @@
</properties>
</dependency>
<dependency>
+ <groupId>fulcrum</groupId>
+ <artifactId>fulcrum-yaafi</artifactId>
+ <version>1.0.4</version>
+ <url>http://jakarta.apache.org/turbine/fulcrum/fulcrum-yaafi/</url>
+ <type>jar</type>
+ <properties>
+ <dist.bundle>true</dist.bundle>
+ </properties>
+ </dependency>
+ <dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentService.java?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentService.java (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentService.java Sun Apr 29 06:22:28 2007
@@ -0,0 +1,272 @@
+package org.apache.turbine.services.avaloncomponent;
+
+/*
+ * 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 java.io.IOException;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.component.ComponentException;
+import org.apache.avalon.framework.logger.Log4JLogger;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.commons.configuration.Configuration;
+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.log4j.Logger;
+import org.apache.turbine.Turbine;
+import org.apache.turbine.services.InitializationException;
+import org.apache.turbine.services.TurbineBaseService;
+import org.apache.turbine.services.servlet.TurbineServlet;
+
+/**
+ * An implementation of Turbine service initializing the YAAFI container
+ *
+ * @author <a href="mailto:siegfried.goescfl@it20one.at">Siegfried Goeschl</a>
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id$
+ */
+public class ACSYaafiComponentService extends TurbineBaseService implements
+ AvalonComponentService, Initializable, Disposable
+{
+ /** The publically visible name of the service */
+ public static final String SERVICE_NAME = "YaafiComponentService";
+
+ /** property to lookup the container configuration file */
+ public static final String CONTAINER_CONFIGURATION_KEY
+ = "containerConfiguration";
+
+ /** the default value for the container configuration file */
+ public static final String CONTAINER_CONFIGURATION_VALUE
+ = "/WEB-INF/conf/containerConfiguration.xml";
+
+ /** property to lookup the properties file */
+ public static final String COMPONENT_PARAMETERS_KEY = "parameters";
+
+ /** the default value for the parameter file */
+ public static final String COMPONENT_PARAMETERS_VALUE
+ = "/WEB-INF/conf/parameters.properties";
+
+ /** YAFFI container */
+ private ServiceContainer container;
+
+ /** our Log4J logger */
+ private Logger logger;
+
+ // -------------------------------------------------------------
+ // Service initialization
+ // -------------------------------------------------------------
+
+ public ACSYaafiComponentService()
+ {
+ this.logger = Logger.getLogger(ACSYaafiComponentService.class);
+ }
+
+ /**
+ * Load all configured components and initialize them. This is a zero
+ * parameter variant which queries the Turbine Servlet for its config.
+ *
+ * @throws InitializationException Something went wrong in the init stage
+ */
+ public void init() throws InitializationException
+ {
+ try
+ {
+ this.logger.info("Initializing ACSYaafiComponentService ...");
+ initialize();
+ setInit(true);
+ }
+ catch (Exception e)
+ {
+ this.logger.error("Exception caught initializing service: ", e);
+ throw new InitializationException(
+ "Initializing ACSYaafiComponentService failed", e);
+ }
+ }
+
+ /**
+ * Shuts the Component Service down, calls dispose on the components that
+ * implement this interface
+ */
+ public void shutdown()
+ {
+ this.logger.info("Disposing ACSYaafiComponentService ...");
+ dispose();
+ setInit(false);
+ }
+
+ // -------------------------------------------------------------
+ // Avalon lifecycle interfaces
+ // -------------------------------------------------------------
+
+ /**
+ * Initializes the container
+ *
+ * @throws Exception generic exception
+ */
+ public void initialize() throws Exception
+ {
+ // get the configuration from the base class
+ Configuration conf = this.getConfiguration();
+
+ // determine the home directory
+ String homePath = Turbine.getRealPath("/");
+ if (homePath == null)
+ {
+ homePath = Turbine.getApplicationRoot();
+ }
+ File home = new File(homePath);
+
+ this.logger.info("Using the following home : "
+ + home.getAbsolutePath());
+
+ // create the configuration for YAAFI
+ ServiceContainerConfiguration config = this
+ .createServiceContainerConfiguration(conf,
+ home.getAbsolutePath());
+
+ try
+ {
+ this.container = ServiceContainerFactory.create(config);
+ }
+ catch (Throwable t)
+ {
+ this.logger.error("Initializing YAAFI failed", t);
+ }
+ }
+
+ /**
+ * Disposes of the container and releases resources
+ */
+ public void dispose()
+ {
+ if (this.container != null)
+ {
+ this.container.dispose();
+ this.container = null;
+ }
+ }
+
+ /**
+ * Returns an instance of the named component
+ *
+ * @param path Name of the role the component fills.
+ * @return an instance of the named component
+ * @throws Exception generic exception
+ */
+ public Component lookup(String path) throws ComponentException
+ {
+ try
+ {
+ return (Component) this.container.lookup(path);
+ }
+ catch (ServiceException e)
+ {
+ throw new ComponentException(e.getKey(), e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Releases the component
+ *
+ * @param component the component to release
+ */
+ public void release(Component component)
+ {
+ this.container.release(component);
+ }
+
+ /**
+ * Create a ServiceContainerConfiguration based on the Turbine configuration
+ *
+ * @param conf the Turbine configuration
+ * @param appRoot the absolute path to the application root directory
+ * @return the YAAFI configuration
+ * @throws IOException creating the YAAFI configuration failed
+ */
+ protected ServiceContainerConfiguration createServiceContainerConfiguration(
+ Configuration conf, String appRoot) throws IOException
+ {
+ ServiceContainerConfiguration result
+ = new ServiceContainerConfiguration();
+
+ result.setLogger(this.createAvalonLogger(AVALON_LOG_CATEGORY));
+ result.setApplicationRootDir(appRoot);
+
+ // are we using a "containerConfiguration.xml" ?!
+
+ if (conf.containsKey(CONTAINER_CONFIGURATION_KEY))
+ {
+ // determine the container configuration file
+
+ String containerConfiguration
+ = conf.getString(CONTAINER_CONFIGURATION_KEY);
+
+ result.loadContainerConfiguration(containerConfiguration);
+ }
+ else if (conf.containsKey(COMPONENT_ROLE_KEY))
+ {
+ // determine the location of the role configuration file
+
+ String roleConfigurationFileName
+ = conf.getString(COMPONENT_ROLE_KEY, COMPONENT_ROLE_VALUE);
+
+ // determine the location of component configuration file
+
+ String componentConfigurationFileName = conf.getString(
+ COMPONENT_CONFIG_KEY, COMPONENT_CONFIG_VALUE);
+
+ // determine the location of parameters file
+
+ String parametersFileName = conf.getString(
+ COMPONENT_PARAMETERS_KEY, COMPONENT_PARAMETERS_VALUE);
+
+ result.setComponentRolesLocation(roleConfigurationFileName);
+ result.setComponentConfigurationLocation(
+ componentConfigurationFileName);
+ result.setParametersLocation(parametersFileName);
+ }
+ else
+ {
+ // determine the container configuration file
+
+ String containerConfiguration = conf.getString(
+ CONTAINER_CONFIGURATION_KEY, CONTAINER_CONFIGURATION_VALUE);
+
+ result.loadContainerConfiguration(containerConfiguration);
+ }
+
+ return result;
+ }
+
+ /**
+ * Create the Avalon logger to be passed to YAAFI
+ *
+ * @param name the name of the logger
+ * @return an Avalon Logger
+ */
+ protected org.apache.avalon.framework.logger.Logger createAvalonLogger(
+ String name)
+ {
+ return new Log4JLogger(Logger.getLogger(name));
+ }
+}
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentServiceTest.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentServiceTest.java?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentServiceTest.java (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/org/apache/turbine/services/avaloncomponent/ACSYaafiComponentServiceTest.java Sun Apr 29 06:22:28 2007
@@ -0,0 +1,103 @@
+package org.apache.turbine.services.avaloncomponent;
+
+/*
+ * 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.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerService;
+import org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerServiceImpl;
+
+import org.apache.turbine.services.ServiceManager;
+import org.apache.turbine.services.TurbineServices;
+import org.apache.turbine.test.BaseTestCase;
+import org.apache.turbine.test.TestComponent;
+
+/**
+ * Simple test to make sure that the YaafiComponentService can be initialized.
+ *
+ * @author <a href="mailto:seade@backstagetech.com.au">Scott Eade</a>
+ * @version $Id$
+ */
+public class ACSYaafiComponentServiceTest
+ extends BaseTestCase
+{
+ private static final String PREFIX = "services."
+ + ACSYaafiComponentService.SERVICE_NAME + '.';
+
+ /**
+ * Initialize the unit test. The YaafiComponentService will be configured
+ * and initialized.
+ *
+ * @param name
+ */
+ public ACSYaafiComponentServiceTest(String name)
+ throws Exception
+ {
+ super(name);
+ ServiceManager serviceManager = TurbineServices.getInstance();
+ serviceManager.setApplicationRoot(".");
+
+ Configuration cfg = new BaseConfiguration();
+ cfg.setProperty(PREFIX + "classname",
+ ACSYaafiComponentService.class.getName());
+ cfg.setProperty(PREFIX + "earlyInit", "true");
+
+ // Configure the service to load test TEST configuration files
+ cfg.setProperty(PREFIX + "containerConfiguration",
+ "src/test/yaafiContainerConfiguration.xml");
+ serviceManager.setConfiguration(cfg);
+
+ try
+ {
+ serviceManager.init();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Use the service to get an instance of the TestComponent. The test()
+ * method will be called to simply write a log message. The component will
+ * then be released.
+ */
+ public void testGetAndUseTestComponent()
+ {
+ try
+ {
+ ServiceManagerService serviceManagerService
+ = ServiceManagerServiceImpl.getInstance();
+ assertNotNull(serviceManagerService);
+
+ assertTrue(serviceManagerService.hasService(TestComponent.ROLE));
+ TestComponent tc = (TestComponent)
+ serviceManagerService.lookup(TestComponent.ROLE);
+ tc.test();
+ serviceManagerService.release(tc);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentConfiguration.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentConfiguration.xml?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentConfiguration.xml (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentConfiguration.xml Sun Apr 29 06:22:28 2007
@@ -0,0 +1,22 @@
+<?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>
+ <test/>
+</componentConfig>
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentRoles.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentRoles.xml?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentRoles.xml (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiComponentRoles.xml Sun Apr 29 06:22:28 2007
@@ -0,0 +1,26 @@
+<?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.
+-->
+<role-list>
+ <role name="org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerService"
+ default-class="org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerServiceImpl"/>
+ <role name="org.apache.turbine.test.TestComponent"
+ shorthand="test"
+ default-class="org.apache.turbine.test.TestComponentImpl"/>
+</role-list>
\ No newline at end of file
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiContainerConfiguration.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiContainerConfiguration.xml?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiContainerConfiguration.xml (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/test/yaafiContainerConfiguration.xml Sun Apr 29 06:22:28 2007
@@ -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/yaafiComponentRoles.xml</location>
+ </componentRoles>
+ <componentConfiguration>
+ <location>src/test/yaafiComponentConfiguration.xml</location>
+ </componentConfiguration>
+</fulcrum-yaafi>
Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml?view=diff&rev=533501&r1=533500&r2=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml Sun Apr 29 06:22:28 2007
@@ -25,6 +25,11 @@
<body>
<release version="2.3.3-dev" date="in Subversion">
+ <action type="add" dev="seade" issue="TRB-27" due-to="Thomas Vandahl">
+ Added Thomas's variation on Siegfried's TurbineYaafiComponentService that
+ allows Fulcrum components to be used in Turbine 2.3 in a fulcrum-yaafi
+ container.
+ </action>
<action type="add" dev="tv">
Extended Intake to care for localization and to allow user-defined
field types (type "custom"). The Validator interface has been extended
Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/navigation.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/navigation.xml?view=diff&rev=533501&r1=533500&r2=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/navigation.xml (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/navigation.xml Sun Apr 29 06:22:28 2007
@@ -68,6 +68,7 @@
<item name="Velocity Service" href="/services/velocity-service.html"/>
<item name="XML-RPC Service" href="/services/xmlrpc-service.html"/>
<item name="XSLT Service" href="/services/xslt-service.html"/>
+ <item name="Yaafi Component Service" href="/services/yaafi-component-service.html"/>
</item>
<item name="Howtos" href="/howto/index.html" collapse="true">
<item name="Action Events Howto" href="/howto/action-event-howto.html"/>
Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/avalon-component-service.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/avalon-component-service.xml?view=diff&rev=533501&r1=533500&r2=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/avalon-component-service.xml (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/avalon-component-service.xml Sun Apr 29 06:22:28 2007
@@ -32,11 +32,9 @@
<a href="http://avalon.apache.org/">Avalon</a> lifecycle interfaces.
</p>
<p>
-The only supported component at this point in time is
-<a href="http://db.apache.org/torque/">Torque</a>, though the
-<a href="http://jakarta.apache.org/turbine/fulcrum/">Fulcrum</a>
-components are likely to be migrated to become Avalon components
-in the future.
+The only supported component is <a href="http://db.apache.org/torque/">Torque</a>.
+<a href="http://jakarta.apache.org/turbine/fulcrum/">Fulcrum</a> components are
+supported via the <a href="yaafi-component-service.html">Yaafi Component Service</a>.
</p>
</section>
Added: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/yaafi-component-service.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/yaafi-component-service.xml?view=auto&rev=533501
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/yaafi-component-service.xml (added)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/yaafi-component-service.xml Sun Apr 29 06:22:28 2007
@@ -0,0 +1,234 @@
+<?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.
+-->
+
+<document>
+
+ <properties>
+ <title>Turbine Services - Yaafi Component Service</title>
+ <author email="seade@backstagetech.com.au">Scott Eade</author>
+ </properties>
+
+<body>
+
+<section name="Avalon Component Service">
+<p>
+The Yaafi Component service loads external modules which implement the
+<a href="http://avalon.apache.org/">Avalon</a> lifecycle interfaces. This is
+a bridge between the Turbine 2.3 we have today and the
+<a href="http://jakarta.apache.org/turbine/fulcrum/">Fulcrum</a> components
+that until now have only been available to Turbine 2.4 (yet to be released).
+</p>
+
+<p>
+Most of the Fulcrum components should work using this service, however it is
+only being added in Turbine 2.3.3, so you should ensure that you perform your
+own testing to verify the desired behaviour of your application, though note
+that the author is successfully running <a href="http://db.apache.org/torque/">
+Torque</a>,
+<a href="http://jakarta.apache.org/turbine/fulcrum/fulcrum-quartz/index.html">
+Fulcrum Quartz</a> as well as making use for Yaafi's
+<a href="http://jakarta.apache.org/turbine/fulcrum/fulcrum-yaafi/services/servicemanagerservice.html">
+ServiceManager</a> and
+<a href="http://jakarta.apache.org/turbine/fulcrum/fulcrum-yaafi/services/systempropertyservice.html">
+SystemProperty</a> services - all under Turbine 2.3.
+</p>
+
+</section>
+
+<section name="Dependencies">
+
+<p>
+If you are using Yaafi Component Service you will need to add Yaafi as a
+dependency (the following is from a Maven 2 POM):
+</p>
+<source><![CDATA[
+ <dependency>
+ <groupId>fulcrum</groupId>
+ <artifactId>fulcrum-yaafi</artifactId>
+ <version>1.0.4</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+]]></source>
+
+<p>
+If you are no longer using the
+<a href="http://jakarta.apache.org/turbine/turbine/turbine-2.3.2/services/avalon-component-service.html">
+Avalon Component Service</a> you can stop your build from including the
+Excalibur dependencies thus (again from a Maven 2 POM):
+</p>
+<source><![CDATA[
+ <!--
+ The following four dependencies are for the Turbine AvalonComponentService.
+ They are not needed when using Yaafi Component Service as a replacement.
+ -->
+ <dependency>
+ <groupId>excalibur-component</groupId>
+ <artifactId>excalibur-component</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>excalibur-instrument</groupId>
+ <artifactId>excalibur-instrument-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>excalibur-logger</groupId>
+ <artifactId>excalibur-logger</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>excalibur-pool</groupId>
+ <artifactId>excalibur-pool-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+]]></source>
+
+<p>
+Whether or not you need the above will depend on how these dependencies are
+declared in the final version of the Turbine 2.3 POM (just including Yaafi
+should be enough if they are declared as optional).
+</p>
+</section>
+
+<section name="Configuration">
+
+<source><![CDATA[
+# -------------------------------------------------------------------
+#
+# S E R V I C E S
+#
+# -------------------------------------------------------------------
+# Classes for Turbine Services should be defined here.
+# Format: services.[name].classname=[implementing class]
+#
+# To specify properties of a service use the following syntax:
+# service.[name].[property]=[value]
+
+services.YaafiComponentService.classname=org.apache.turbine.services.avaloncomponent.ACSYaafiComponentService
+services.YaafiComponentService.earlyInit=true
+...
+
+# -------------------------------------------------------------------
+#
+# Y A A F I C O M P O N E N T S E R V I C E
+#
+# -------------------------------------------------------------------
+# Components implementing the avalon lifecycle interfaces can be
+# loaded, configured and initialized by Turbine
+# -------------------------------------------------------------------
+
+services.YaafiComponentService.containerConfiguration = /WEB-INF/conf/containerConfiguration.xml
+]]></source>
+<p>
+In /WEB-INF/conf you should provide containerConfiguration.xml:
+</p>
+<source><![CDATA[
+<fulcrum-yaafi>
+ <componentRoles>
+ <location>/WEB-INF/conf/componentRoles.xml</location>
+ </componentRoles>
+ <componentConfiguration>
+ <location>/WEB-INF/conf/componentConfiguration.xml</location>
+ </componentConfiguration>
+</fulcrum-yaafi>
+]]></source>
+<p>
+componentRoles.xml:
+</p>
+<source><![CDATA[
+<role-list>
+ <role name="org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerService"
+ default-class="org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerServiceImpl"/>
+ <role name="org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyService"
+ shorthand="SystemPropertyService"
+ default-class="org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyServiceImpl"
+ early-init="true"/>
+ <role name="org.apache.torque.avalon.Torque"
+ shorthand="torque"
+ default-class="org.apache.torque.avalon.TorqueComponent"/>
+ <!-- Details of other components and services you want to use. -->
+</role-list>]]></source>
+<p>
+and componentConfiguration.xml:
+</p>
+<source><![CDATA[
+<componentConfig>
+ <SystemPropertyService>
+ <property name="my.property">my property value</property>
+ </SystemPropertyService>
+
+ <torque>
+ <configfile>WEB-INF/conf/Torque.properties</configfile>
+ </torque>
+
+ <!-- Configuration for other components and services. -->
+</componentConfig>
+]]></source>
+<p>
+No changes to torque.properties are required.
+</p>
+<p>
+If all goes well you should see the following in your log file when Turbine
+starts up (actual output will depend on your logging configuration):
+</p>
+<source><![CDATA[
+...INFO...services.BaseServiceBroker - Added Mapping for Service: ACSYaafiComponentService
+...INFO...services.BaseServiceBroker - Start Initializing service (early): ACSYaafiComponentService
+...INFO...avaloncomponent.ACSYaafiComponentService - Initializing ACSYaafiComponentService ...
+...
+...DEBUG...avalon - Incarnating the service org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerService
+...
+...DEBUG...avalon - Incarnating the service SystemPropertyService
+...
+...DEBUG...avalon - Incarnating the service torque
+...INFO...avalon - YAAFI Avalon Service Container is up and running
+...INFO...services.BaseServiceBroker - Finish Initializing service (early): ACSYaafiComponentService
+]]></source>
+
+</section>
+
+<section name="Usage">
+
+<p>
+If you plan to use the decoupled Torque in your application, you should leave
+the Yaafi Component Service configured at all times. It is started at early
+startup time. See the
+<a href="http://jakarta.apache.org/turbine/fulcrum/fulcrum-yaafi/index.html">
+Yaafi documentation</a> for more information and for details of the various
+<a href="http://jakarta.apache.org/turbine/fulcrum/fulcrum-yaafi/services/index.html">
+services</a> that it provides and the
+<a href="http://jakarta.apache.org/turbine/fulcrum/">Fulcrum site</a> for
+details of the other components that are available.
+</p>
+</section>
+
+</body>
+
+</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org