Author: cziegeler Date: Fri Mar 18 05:23:46 2005 New Revision: 158061 URL: http://svn.apache.org/viewcvs?view=rev&rev=158061 Log: Initial import
Added: cocoon/blocks/spring-app/ cocoon/blocks/spring-app/trunk/ cocoon/blocks/spring-app/trunk/bin/ cocoon/blocks/spring-app/trunk/conf/ cocoon/blocks/spring-app/trunk/java/ cocoon/blocks/spring-app/trunk/java/org/ cocoon/blocks/spring-app/trunk/java/org/apache/ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java (with props) cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java (with props) cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java (with props) cocoon/blocks/spring-app/trunk/legal/ cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt (with props) cocoon/blocks/spring-app/trunk/lib/ cocoon/blocks/spring-app/trunk/lib/spring-1.1.5.jar (with props) cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf (with props) cocoon/blocks/spring-app/trunk/readme.txt (with props) cocoon/blocks/spring-app/trunk/samples/ cocoon/blocks/spring-app/trunk/samples/conf/ cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml (with props) cocoon/blocks/spring-app/trunk/samples/flow.js (with props) cocoon/blocks/spring-app/trunk/samples/sitemap.xmap (with props) cocoon/blocks/spring-app/trunk/samples/test.xml (with props) Added: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java (added) +++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java Fri Mar 18 05:23:46 2005 @@ -0,0 +1,84 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.spring; + +import java.net.MalformedURLException; + +import org.apache.cocoon.environment.internal.EnvironmentHelper; +import org.apache.excalibur.source.SourceResolver; +import org.springframework.core.io.Resource; +import org.springframework.core.io.UrlResource; +import org.springframework.web.context.support.XmlWebApplicationContext; + +/** + * The application context implementation. By default we search the configuration + * at "conf/applicationContext.xml" in the sitemap directory. + * + * TODO - we should make the Cocoon Core object available for Spring components. + * This gives Spring components access to Cocoon information. + * + * @version $Id:$ + */ +public class CocoonApplicationContext + extends XmlWebApplicationContext { + + public static final String DEFAULT_SPRING_CONFIG = "conf/applicationContext.xml"; + + protected SourceResolver resolver; + protected EnvironmentHelper environmentHelper; + protected String baseURL; + + public void setSourceResolver(SourceResolver aResolver) { + this.resolver = aResolver; + } + + public void setEnvironmentHelper(EnvironmentHelper eh) { + this.environmentHelper = eh; + this.baseURL = this.environmentHelper.getContext(); + if ( !this.baseURL.endsWith("/") ) { + this.baseURL = this.baseURL + '/'; + } + } + + /** + * Resolve file paths beneath the root of the web application. + * <p>Note: Even if a given path starts with a slash, it will get + * interpreted as relative to the web application root directory + * (which is the way most servlet containers handle such paths). + * @see ServletContextResource + */ + protected Resource getResourceByPath(String path) { + if ( path.startsWith("/") ) { + path = path.substring(1); + } + path = this.baseURL + path; + try { + return new UrlResource(path); + } catch (MalformedURLException mue) { + // FIXME - for now, we simply call super + return super.getResourceByPath(path); + } + } + + /** + * The default location for the context is "conf/applicationContext.xml" + * which is searched relative to the current sitemap. + */ + protected String[] getDefaultConfigLocations() { + return new String[] {DEFAULT_SPRING_CONFIG}; + } + +} Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/CocoonApplicationContext.java ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java (added) +++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java Fri Mar 18 05:23:46 2005 @@ -0,0 +1,269 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.spring; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +import org.apache.avalon.framework.activity.Disposable; +import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.context.Context; +import org.apache.avalon.framework.context.ContextException; +import org.apache.avalon.framework.context.Contextualizable; +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.service.Serviceable; +import org.apache.cocoon.Constants; +import org.apache.cocoon.environment.internal.EnvironmentHelper; +import org.apache.cocoon.servlet.CocoonServlet; +import org.apache.cocoon.sitemap.ComponentLocator; +import org.apache.excalibur.source.SourceResolver; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.access.BeanFactoryLocator; +import org.springframework.beans.factory.access.BeanFactoryReference; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextException; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.access.ContextSingletonBeanFactoryLocator; +import org.springframework.util.StringUtils; +import org.springframework.web.context.ConfigurableWebApplicationContext; + +/** + * This is the connection between Cocoon and Spring. + * We create an own web application context. + * Part of this code is based on Springs ContextLoader class. + * + * TODO - we need to store the application context somewhere to use the context + * of a parent sitemap as the parent of a sub sitemap. + * + * @version $Id:$ + */ +public class SpringComponentLocator + extends AbstractLogEnabled + implements ComponentLocator, + Contextualizable, + Serviceable, + Configurable, + Initializable, + Disposable { + + protected Context context; + protected ServletContext servletContext; + protected EnvironmentHelper environmentHelper; + protected ServiceManager manager; + protected SourceResolver resolver; + + protected CocoonApplicationContext wac; + + protected String contextClassName; + protected String configLocation; + protected String locatorFactorySelector; + protected String parentContextKey; + + /** + * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) + */ + public void contextualize(Context context) throws ContextException { + this.context = context; + this.servletContext = ((ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG)).getServletContext(); + // FIXME - we shouldn't use the environment helper + this.environmentHelper = (EnvironmentHelper)context.get(Constants.CONTEXT_ENV_HELPER); + } + + /** + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) + */ + public void service(ServiceManager aManager) throws ServiceException { + this.manager = aManager; + this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE); + } + + /** + * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) + */ + public void configure(Configuration config) throws ConfigurationException { + this.contextClassName = config.getChild("contextClass").getValue(null); + this.configLocation = config.getChild("contextConfigLocation").getValue(null); + this.locatorFactorySelector = config.getChild("locatorFactorySelector").getValue(null); + this.parentContextKey = config.getChild("parentContextKey").getValue(null); + } + + /** + * Initialize Spring's web application context. + * @throws BeansException if the context couldn't be initialized + * + * @see org.apache.avalon.framework.activity.Initializable#initialize() + */ + public void initialize() throws Exception { + if ( this.getLogger().isInfoEnabled() ) { + this.getLogger().info("Loading Spring web application context"); + } + + try { + // Determine parent for application context, if any. + ApplicationContext parent = this.loadParentContext(); + + this.wac = this.createWebApplicationContext(parent); + + if (this.getLogger().isInfoEnabled()) { + this.getLogger().info("Using context class [" + wac.getClass().getName() + + "] for root WebApplicationContext"); + this.getLogger().info("Web application context: initialization completed"); + } + } catch (RuntimeException ex) { + this.getLogger().error("Context initialization failed", ex); + throw ex; + } catch (Error err) { + this.getLogger().error("Context initialization failed", err); + throw err; + } + } + + /** + * Close Spring's web application context. + * + * @see org.apache.avalon.framework.activity.Disposable#dispose() + */ + public void dispose() { + if (this.getLogger().isInfoEnabled()) { + this.getLogger().info("Closing Spring web application context"); + } + try { + ((ConfigurableApplicationContext) this.wac).close(); + } finally { + if (this.beanFactoryRef != null) { + this.beanFactoryRef.release(); + this.beanFactoryRef = null; + } + } + if ( this.manager != null ) { + this.manager.release(this.resolver); + this.resolver = null; + this.manager = null; + } + } + + /** + * @see org.apache.cocoon.sitemap.ComponentLocator#hasComponent(java.lang.String) + */ + public boolean hasComponent(String key) { + return this.wac.containsBean(key); + } + + /** + * @see org.apache.cocoon.sitemap.ComponentLocator#lookup(java.lang.String) + */ + public Object lookup(String key) { + return this.wac.getBean(key); + } + + /** + * @see org.apache.cocoon.sitemap.ComponentLocator#release(java.lang.Object) + */ + public void release(Object component) { + // nothing to do + } + + /** + * Holds BeanFactoryReference when loading parent factory via + * ContextSingletonBeanFactoryLocator. + */ + protected BeanFactoryReference beanFactoryRef; + + + /** + * Instantiate the web application context for this loader, either a + * default CocoonApplicationContext or a custom context class if specified. + * <p>This implementation expects custom contexts to be a subclass of + * CocoonApplicationContext. + * @param parent the parent ApplicationContext to use, or null if none + * @throws BeansException if the context couldn't be initialized + */ + protected CocoonApplicationContext createWebApplicationContext(ApplicationContext parent) + throws BeansException { + Class contextClass = CocoonApplicationContext.class; + if (this.contextClassName != null) { + try { + contextClass = Class.forName(this.contextClassName, true, Thread.currentThread().getContextClassLoader()); + } catch (ClassNotFoundException ex) { + throw new ApplicationContextException("Failed to load context class [" + contextClassName + "]", ex); + } + if (!CocoonApplicationContext.class.isAssignableFrom(contextClass)) { + throw new ApplicationContextException("Custom context class [" + contextClassName + + "] is not of type CocoonApplicationContext"); + } + } + + CocoonApplicationContext cwac = + (CocoonApplicationContext) BeanUtils.instantiateClass(contextClass); + cwac.setSourceResolver(this.resolver); + cwac.setEnvironmentHelper(this.environmentHelper); + cwac.setParent(parent); + cwac.setServletContext(this.servletContext); + if (this.configLocation != null) { + cwac.setConfigLocations(StringUtils.tokenizeToStringArray(configLocation, + ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS)); + } + + cwac.refresh(); + return cwac; + } + + /** + * Template method with default implementation (which may be overridden by a + * subclass), to load or obtain an ApplicationContext instance which will be + * used as the parent context of the root WebApplicationContext. If the + * return value from the method is null, no parent context is set. + * <p>The main reason to load a parent context here is to allow multiple root + * web application contexts to all be children of a shared EAR context, or + * alternately to also share the same parent context that is visible to + * EJBs. For pure web applications, there is usually no need to worry about + * having a parent context to the root web application context. + * <p>The default implementation uses ContextSingletonBeanFactoryLocator, + * configured via [EMAIL PROTECTED] #LOCATOR_FACTORY_SELECTOR_PARAM} and + * [EMAIL PROTECTED] #BEAN_FACTORY_LOCATOR_FACTORY_KEY_PARAM}, to load a parent context + * which will be shared by all other users of ContextsingletonBeanFactoryLocator + * which also use the same configuration parameters. + * @return the parent application context, or null if none + * @throws BeansException if the context couldn't be initialized + * @see org.springframework.beans.factory.access.BeanFactoryLocator + * @see org.springframework.context.access.ContextSingletonBeanFactoryLocator + */ + protected ApplicationContext loadParentContext() + throws BeansException { + + ApplicationContext parentContext = null; + if (this.locatorFactorySelector != null) { + BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(this.locatorFactorySelector); + + if (this.getLogger().isInfoEnabled()) { + this.getLogger().info("Getting parent context definition: using parent context key of '" + + parentContextKey + "' with BeanFactoryLocator"); + } + + this.beanFactoryRef = locator.useBeanFactory(this.parentContextKey); + parentContext = (ApplicationContext) this.beanFactoryRef.getFactory(); + } + + return parentContext; + } + +} Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java (added) +++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java Fri Mar 18 05:23:46 2005 @@ -0,0 +1,33 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.spring.samples; + +/** + * + * @version $Id:$ + */ +public class SpringTest { + + protected String message; + + public SpringTest() { + this.message = "Hello World from Spring"; + } + + public String getMessage() { + return this.message; + } +} Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt (added) +++ cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt Fri Mar 18 05:23:46 2005 @@ -0,0 +1,201 @@ + 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. Propchange: cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/legal/spring-1.1.5.jar.license.txt ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/lib/spring-1.1.5.jar URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/lib/spring-1.1.5.jar?view=auto&rev=158061 ============================================================================== Binary file - no diff available. Propchange: cocoon/blocks/spring-app/trunk/lib/spring-1.1.5.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf (added) +++ cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf Fri Mar 18 05:23:46 2005 @@ -0,0 +1,16 @@ +<xconf xpath="module"> + + <project name="cocoon-block-spring-app" status="unstable" dir="../cocoon-spring-app"> + <package>org.apache.cocoon</package> + + <depend project="cocoon" inherit="all"/> + + <work nested="tools/anttasks"/> + <home nested="build/cocoon-@@DATE@@"/> + + <jar name="blocks/spring-app.jar"/> + + <nag from="Gump <general@gump.apache.org>" to="dev@cocoon.apache.org"/> + </project> + +</xconf> \ No newline at end of file Propchange: cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/local.blocks.spring-app.xconf ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/readme.txt URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/readme.txt?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/readme.txt (added) +++ cocoon/blocks/spring-app/trunk/readme.txt Fri Mar 18 05:23:46 2005 @@ -0,0 +1,14 @@ +Installing the spring-app block +------------------------------- + +1. Get a recent version of Cocoon 2.2 from Subversion +2. Copy local.blocks.spring-app.xconf to the Cocoon 2.2 directory + and adjust the path (the dir attribute in the following line): + + <project name="cocoon-block-spring-app" status="unstable" dir="../cocoon-spring-app"> + + The "cocoon-spring-app" is the directory containing this file. + +3. Invoke the build in the Cocoon directory +4. Start Cocoon +5. Invoke http://localhost:8888/samples/blocks/spring-app/ Propchange: cocoon/blocks/spring-app/trunk/readme.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/readme.txt ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml (added) +++ cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml Fri Mar 18 05:23:46 2005 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2005 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- @version $Id:$ --> +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> + +<beans> + + <bean id="spring-test" + class="org.apache.cocoon.spring.samples.SpringTest" + abstract="false" + singleton="true" + lazy-init="default"/> + +</beans> Propchange: cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/samples/flow.js URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/flow.js?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/samples/flow.js (added) +++ cocoon/blocks/spring-app/trunk/samples/flow.js Fri Mar 18 05:23:46 2005 @@ -0,0 +1,24 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// +// @version $Id:$ +// + +function test() { + + var component = cocoon.getComponent("spring-test"); + cocoon.sendPage("test", { "message" : component.getMessage()}); +} Propchange: cocoon/blocks/spring-app/trunk/samples/flow.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/samples/flow.js ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/samples/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/sitemap.xmap?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/samples/sitemap.xmap (added) +++ cocoon/blocks/spring-app/trunk/samples/sitemap.xmap Fri Mar 18 05:23:46 2005 @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- @version $Id:$ --> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + + <map:components> + <map:application-container class="org.apache.cocoon.spring.SpringComponentLocator"> + </map:application-container> + </map:components> + + <map:flow language="javascript"> + <map:script src="flow.js"/> + </map:flow> + + <map:pipelines> + <map:pipeline> + <map:match pattern=""> + <map:call function="test"/> + </map:match> + + <map:match pattern="test"> + <map:generate src="test.xml" type="jx"/> + <map:serialize type="xml"/> + </map:match> + </map:pipeline> + </map:pipelines> +</map:sitemap> Propchange: cocoon/blocks/spring-app/trunk/samples/sitemap.xmap ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/samples/sitemap.xmap ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/blocks/spring-app/trunk/samples/test.xml URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/test.xml?view=auto&rev=158061 ============================================================================== --- cocoon/blocks/spring-app/trunk/samples/test.xml (added) +++ cocoon/blocks/spring-app/trunk/samples/test.xml Fri Mar 18 05:23:46 2005 @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- SVN $Id:$ --> +<document xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + <p>This is a simple demo page</p> + <p>Messsage from a Spring Bean:</p> + <p>#{message}</p> +</document> Propchange: cocoon/blocks/spring-app/trunk/samples/test.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/blocks/spring-app/trunk/samples/test.xml ------------------------------------------------------------------------------ svn:keywords = Id