svn commit: r1828354 [1/2] - in /cocoon/trunk: ./ blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/ blocks/...
[email protected] Wed, 04 Apr 2018 15:25:45 -0000
| Newsgroups | gmane.text.xml.cocoon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ilgrosso
Date: Wed Apr 4 15:25:44 2018
New Revision: 1828354
URL: http://svn.apache.org/viewvc?rev=1828354&view=rev
Log:
[COCOON-2347] Merge to trunk from BRANCH_2_2_COCOON-2347 - thanks Gabriel Gruber @ggruber4711
Added:
cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/util/
- copied from r1828353, cocoon/branches/BRANCH_2_2_COCOON-2347/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/util/
Modified:
cocoon/trunk/ (props changed)
cocoon/trunk/blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/AspectsBeanDefinitionParser.java
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate-output.xml
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate.xml
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute-output.xml
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute.xml
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement-output.xml
cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement.xml
cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/objectmodel/ObjectModel.java
cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/ObjectModelImpl.java
cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/UnmodifiableMultiMap.java
cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScope.java
cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScopeHolder.java
cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/core/container/spring/pipeline/PipelineComponentInfoInitializerDecorator.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonBeanPostProcessor.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/BridgeElementParser.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationInfo.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationReader.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapElementParser.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SourceResource.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/AbstractTestCase.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/MockWebApplicationContext.java
cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java
cocoon/trunk/parent/ (props changed)
cocoon/trunk/parent/pom.xml
cocoon/trunk/pom.xml
Propchange: cocoon/trunk/
------------------------------------------------------------------------------
svn:mergeinfo = /cocoon/branches/BRANCH_2_2_COCOON-2347:1710947-1828353
Modified: cocoon/trunk/blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java (original)
+++ cocoon/trunk/blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java Wed Apr 4 15:25:44 2018
@@ -160,7 +160,7 @@ public class ScriptablePropertyPointer e
return buffer.toString();
}
- private String escape(String string){
+ protected String escape(String string){
int index = string.indexOf('\'');
while (index != -1){
string = string.substring(0, index) + "'" + string.substring(index + 1);
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/AspectsBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/AspectsBeanDefinitionParser.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/AspectsBeanDefinitionParser.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/AspectsBeanDefinitionParser.java Wed Apr 4 15:25:44 2018
@@ -92,7 +92,7 @@ public class AspectsBeanDefinitionParser
}
}
try {
- beanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, ClassUtils.forName(this.baseClass));
+ beanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, ClassUtils.forName(this.baseClass, getClass().getClassLoader()));
} catch (ClassNotFoundException e) {
throw new BeanDefinitionStoreException("Unable to load aspect class: " + this.baseClass, e);
}
@@ -105,7 +105,7 @@ public class AspectsBeanDefinitionParser
List aliases = new ArrayList();
if (StringUtils.hasLength(nameAttr)) {
- String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
+ String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS);
aliases.addAll(Arrays.asList(nameArr));
}
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate-output.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate-output.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate-output.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate-output.xml Wed Apr 4 15:25:44 2018
@@ -16,6 +16,6 @@
limitations under the License.
-->
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
- <date locale="pl_PL">01 styczeÅ 1979</date>
+ <date locale="de_DE">01 Januar 1979</date>
<date locale="sv_SE">01 januari 1979</date>
</root>
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/formatDate.xml Wed Apr 4 15:25:44 2018
@@ -16,6 +16,6 @@
limitations under the License.
-->
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
- <date locale="pl_PL"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="pl_PL"/></date>
+ <date locale="de_DE"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="de_DE"/></date>
<date locale="sv_SE"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="sv_SE"/></date>
</root>
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute-output.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute-output.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute-output.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute-output.xml Wed Apr 4 15:25:44 2018
@@ -21,5 +21,5 @@
<three foo="bar" foo2="bar2" dd="dd">
<abc>def</abc>
</three>
- <nestedjx value="01 styczeÅ 1979"/>
+ <nestedjx value="01 Januar 1979"/>
</root>
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxAttribute.xml Wed Apr 4 15:25:44 2018
@@ -30,6 +30,6 @@
<abc>def</abc>
</three>
<nestedjx>
- <jx:attribute name="value"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="pl_PL"/></jx:attribute>
+ <jx:attribute name="value"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="de_DE"/></jx:attribute>
</nestedjx>
</root>
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement-output.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement-output.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement-output.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement-output.xml Wed Apr 4 15:25:44 2018
@@ -1,35 +1,35 @@
-<?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.
--->
-<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
- <Empty/>
- <ElementWithValue>value</ElementWithValue>
- <OneFixedValueChildNode><ChildNode>Test</ChildNode></OneFixedValueChildNode>
- <WithChildGeneratedNode><ChildNode>dd</ChildNode></WithChildGeneratedNode>
- <DynamicElement>01 styczeÅ 1979</DynamicElement>
- <WithAttribute attribute="attr"/>
- <AttributeAndChildNode attribute="attr"><ChildNode>A</ChildNode></AttributeAndChildNode>
- <MixedContent attribute="attr">A<B/></MixedContent>
- <MixedContent2 attribute="attr">A<B/></MixedContent2>
- <EmptyElementWithNamespace xmlns="http://cocoon.apache.org/kamal"/>
- <EmptyElementWithGeneratedNamespace xmlns="http://cocoon.apache.org/kamalbhatt"/>
- <GeneratedElementWithGeneratedChild xmlns="http://cocoon.apache.org/kamalbhatt">
- <GeneratedChild xmlns="http://cocoon.apache.org/kamal">Test</GeneratedChild>
- </GeneratedElementWithGeneratedChild>
- <prefix:ElementWithNamespaceAndHardCodedPrefix xmlns:prefix="http://cocoon.apache.org/kamalbhatt"/>
- <kb:ElementWithNamespaceAndGeneratedPrefix xmlns:kb="http://cocoon.apache.org/kamalbhatt"/>
-</root>
+<?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.
+-->
+<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <Empty/>
+ <ElementWithValue>value</ElementWithValue>
+ <OneFixedValueChildNode><ChildNode>Test</ChildNode></OneFixedValueChildNode>
+ <WithChildGeneratedNode><ChildNode>dd</ChildNode></WithChildGeneratedNode>
+ <DynamicElement>01 Januar 1979</DynamicElement>
+ <WithAttribute attribute="attr"/>
+ <AttributeAndChildNode attribute="attr"><ChildNode>A</ChildNode></AttributeAndChildNode>
+ <MixedContent attribute="attr">A<B/></MixedContent>
+ <MixedContent2 attribute="attr">A<B/></MixedContent2>
+ <EmptyElementWithNamespace xmlns="http://cocoon.apache.org/kamal"/>
+ <EmptyElementWithGeneratedNamespace xmlns="http://cocoon.apache.org/kamalbhatt"/>
+ <GeneratedElementWithGeneratedChild xmlns="http://cocoon.apache.org/kamalbhatt">
+ <GeneratedChild xmlns="http://cocoon.apache.org/kamal">Test</GeneratedChild>
+ </GeneratedElementWithGeneratedChild>
+ <prefix:ElementWithNamespaceAndHardCodedPrefix xmlns:prefix="http://cocoon.apache.org/kamalbhatt"/>
+ <kb:ElementWithNamespaceAndGeneratedPrefix xmlns:kb="http://cocoon.apache.org/kamalbhatt"/>
+</root>
Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement.xml?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement.xml (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/test/resources/org/apache/cocoon/template/jxtg/jxElement.xml Wed Apr 4 15:25:44 2018
@@ -1,42 +1,42 @@
-<?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.
--->
-<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
- <jx:set var="a" value="dd"/>
- <jx:set var="elem" value="DynamicElement"/>
- <jx:set var="namespace" value="http://cocoon.apache.org/kamalbhatt"/>
- <jx:set var="prefix" value="kb"/>
- <jx:element name="Empty"/>
- <jx:element name="ElementWithValue">value</jx:element>
- <jx:element name="OneFixedValueChildNode"><ChildNode>Test</ChildNode></jx:element>
- <jx:element name="WithChildGeneratedNode"><ChildNode><jx:out value="${a}"/></ChildNode></jx:element>
- <jx:element name="${elem}"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="pl_PL"/></jx:element>
- <jx:element name="WithAttribute"><jx:attribute name="attribute" value="attr"/></jx:element>
- <jx:element name="AttributeAndChildNode">
- <jx:attribute name="attribute" value="attr"/>
- <ChildNode>A</ChildNode>
- </jx:element>
- <jx:element name="MixedContent"><jx:attribute name="attribute" value="attr"/>A<B/></jx:element>
- <jx:element name="MixedContent2">A<jx:attribute name="attribute" value="attr"/><B/></jx:element>
- <jx:element name="EmptyElementWithNamespace" uri="http://cocoon.apache.org/kamal"></jx:element>
- <jx:element name="EmptyElementWithGeneratedNamespace" uri="${namespace}"></jx:element>
- <jx:element name="GeneratedElementWithGeneratedChild" uri="${namespace}">
- <jx:element name="GeneratedChild" uri="http://cocoon.apache.org/kamal">Test</jx:element>
- </jx:element>
- <jx:element name="ElementWithNamespaceAndHardCodedPrefix" uri="${namespace}" prefix="prefix"/>
- <jx:element name="ElementWithNamespaceAndGeneratedPrefix" uri="${namespace}" prefix="${prefix}"/>
-</root>
+<?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.
+-->
+<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <jx:set var="a" value="dd"/>
+ <jx:set var="elem" value="DynamicElement"/>
+ <jx:set var="namespace" value="http://cocoon.apache.org/kamalbhatt"/>
+ <jx:set var="prefix" value="kb"/>
+ <jx:element name="Empty"/>
+ <jx:element name="ElementWithValue">value</jx:element>
+ <jx:element name="OneFixedValueChildNode"><ChildNode>Test</ChildNode></jx:element>
+ <jx:element name="WithChildGeneratedNode"><ChildNode><jx:out value="${a}"/></ChildNode></jx:element>
+ <jx:element name="${elem}"><jx:formatDate value="${date}" pattern="dd MMMM yyyy" locale="de_DE"/></jx:element>
+ <jx:element name="WithAttribute"><jx:attribute name="attribute" value="attr"/></jx:element>
+ <jx:element name="AttributeAndChildNode">
+ <jx:attribute name="attribute" value="attr"/>
+ <ChildNode>A</ChildNode>
+ </jx:element>
+ <jx:element name="MixedContent"><jx:attribute name="attribute" value="attr"/>A<B/></jx:element>
+ <jx:element name="MixedContent2">A<jx:attribute name="attribute" value="attr"/><B/></jx:element>
+ <jx:element name="EmptyElementWithNamespace" uri="http://cocoon.apache.org/kamal"></jx:element>
+ <jx:element name="EmptyElementWithGeneratedNamespace" uri="${namespace}"></jx:element>
+ <jx:element name="GeneratedElementWithGeneratedChild" uri="${namespace}">
+ <jx:element name="GeneratedChild" uri="http://cocoon.apache.org/kamal">Test</jx:element>
+ </jx:element>
+ <jx:element name="ElementWithNamespaceAndHardCodedPrefix" uri="${namespace}" prefix="prefix"/>
+ <jx:element name="ElementWithNamespaceAndGeneratedPrefix" uri="${namespace}" prefix="${prefix}"/>
+</root>
Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/objectmodel/ObjectModel.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/objectmodel/ObjectModel.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/objectmodel/ObjectModel.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-api/src/main/java/org/apache/cocoon/el/objectmodel/ObjectModel.java Wed Apr 4 15:25:44 2018
@@ -18,7 +18,7 @@ package org.apache.cocoon.el.objectmodel
import java.util.Map;
-import org.apache.commons.collections.MultiMap;
+import org.apache.cocoon.el.util.MultiMap;
/**
* ObjectModel is a special {@link Map} that cannot be modified using standard {@link Map} methods, except
Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/ObjectModelImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/ObjectModelImpl.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/ObjectModelImpl.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/ObjectModelImpl.java Wed Apr 4 15:25:44 2018
@@ -23,15 +23,15 @@ import java.util.Iterator;
import java.util.ListIterator;
import java.util.Map;
+import org.apache.cocoon.el.util.MultiMap;
+import org.apache.cocoon.el.util.MultiValueMap;
import org.apache.cocoon.el.objectmodel.ObjectModel;
import org.apache.cocoon.el.objectmodel.ObjectModelProvider;
import org.apache.commons.collections.ArrayStack;
import org.apache.commons.collections.KeyValue;
-import org.apache.commons.collections.MultiMap;
import org.apache.commons.collections.iterators.ReverseListIterator;
import org.apache.commons.collections.keyvalue.DefaultKeyValue;
import org.apache.commons.collections.map.AbstractMapDecorator;
-import org.apache.commons.collections.map.MultiValueMap;
import org.apache.commons.jxpath.DynamicPropertyHandler;
import org.apache.commons.jxpath.JXPathBeanInfo;
import org.apache.commons.jxpath.JXPathIntrospector;
Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/UnmodifiableMultiMap.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/UnmodifiableMultiMap.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/UnmodifiableMultiMap.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/el/impl/objectmodel/UnmodifiableMultiMap.java Wed Apr 4 15:25:44 2018
@@ -20,9 +20,9 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
+import org.apache.cocoon.el.util.MultiMap;
import org.apache.commons.collections.IterableMap;
import org.apache.commons.collections.MapIterator;
-import org.apache.commons.collections.MultiMap;
import org.apache.commons.collections.Unmodifiable;
import org.apache.commons.collections.collection.UnmodifiableCollection;
import org.apache.commons.collections.iterators.EntrySetMapIterator;
@@ -103,7 +103,7 @@ public class UnmodifiableMultiMap extend
throw new UnsupportedOperationException();
}
- public Object remove(Object key, Object item) {
+ public boolean remove(Object key, Object item) {
throw new UnsupportedOperationException();
}
Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScope.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScope.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScope.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScope.java Wed Apr 4 15:25:44 2018
@@ -22,14 +22,14 @@ import org.springframework.beans.factory
/**
* Pipeline component scope that scopes objects per one pipeline component.
- *
+ *
* @version $Id$
* @since 2.2
*/
public final class PipelineComponentScope implements Scope {
-
+
private PipelineComponentScopeHolder holder;
-
+
public PipelineComponentScopeHolder getHolder() {
return holder;
}
@@ -39,16 +39,18 @@ public final class PipelineComponentScop
}
/* (non-Javadoc)
- * @see org.springframework.beans.factory.config.Scope#get(java.lang.String, org.springframework.beans.factory.ObjectFactory)
+ * @see org.springframework.beans.factory.config.Scope#get(java.lang.String,
+ * org.springframework.beans.factory.ObjectFactory)
*/
- public Object get(String name, ObjectFactory objectFactory) {
+ @Override
+ public Object get(String name, ObjectFactory<?> objectFactory) {
Object bean = holder.getBeans().get(name);
if (bean == null) {
bean = objectFactory.getObject();
holder.getBeans().put(name, bean);
if (bean instanceof ObjectModel && holder.getInScope()) {
//FIXME: This should be moved to separate BeanPostProcessor
- ((ObjectModel)bean).setParent((ObjectModel)holder.getParentBeans().get(name));
+ ((ObjectModel) bean).setParent((ObjectModel) holder.getParentBeans().get(name));
}
}
return bean;
@@ -57,14 +59,17 @@ public final class PipelineComponentScop
/* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#getConversationId()
*/
+ @Override
public String getConversationId() {
// There is no conversation id concept for the pipeline component scope
return null;
}
/* (non-Javadoc)
- * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String, java.lang.Runnable)
+ * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String,
+ * java.lang.Runnable)
*/
+ @Override
public void registerDestructionCallback(String name, Runnable callback) {
holder.getDestructionCallbacks().put(name, callback);
}
@@ -72,8 +77,9 @@ public final class PipelineComponentScop
/* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#remove(java.lang.String)
*/
+ @Override
public Object remove(String name) {
- Object bean = holder.getBeans().get(name);
+ Object bean = holder.getBeans().get(name);
if (bean != null) {
holder.getBeans().remove(name);
holder.getDestructionCallbacks().remove(name);
@@ -81,4 +87,8 @@ public final class PipelineComponentScop
return bean;
}
+ @Override
+ public Object resolveContextualObject(String key) {
+ return null;
+ }
}
Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScopeHolder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScopeHolder.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScopeHolder.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/spring/PipelineComponentScopeHolder.java Wed Apr 4 15:25:44 2018
@@ -21,24 +21,24 @@ import java.util.Map;
public interface PipelineComponentScopeHolder {
//FIXME: This interface needs redesign
- public Map getBeans();
+ public Map<String, Object> getBeans();
- public void setBeans(Map beans);
-
- public Map getParentBeans();
-
- public void setParentBeans(Map parentBeans);
-
- public Map getDestructionCallbacks();
-
- public void setDestructionCallbacks(Map destructionCallbacks);
-
- public Map getParentDestructionCallbacks();
+ public void setBeans(Map<String, Object> beans);
+
+ public Map<String, Object> getParentBeans();
+
+ public void setParentBeans(Map<String, Object> parentBeans);
+
+ public Map<String, Object> getDestructionCallbacks();
+
+ public void setDestructionCallbacks(Map<String, Object> destructionCallbacks);
+
+ public Map<String, Object> getParentDestructionCallbacks();
+
+ public void setParentDestructionCallbacks(Map<String, Object> destructionCallbacks);
- public void setParentDestructionCallbacks(Map destructionCallbacks);
-
public void setInScope(boolean inScope);
-
+
public boolean getInScope();
-}
\ No newline at end of file
+}
Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/core/container/spring/pipeline/PipelineComponentInfoInitializerDecorator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/core/container/spring/pipeline/PipelineComponentInfoInitializerDecorator.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/core/container/spring/pipeline/PipelineComponentInfoInitializerDecorator.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/core/container/spring/pipeline/PipelineComponentInfoInitializerDecorator.java Wed Apr 4 15:25:44 2018
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.List;
import org.apache.cocoon.components.pipeline.impl.PipelineComponentInfo;
+import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
@@ -35,14 +36,14 @@ import org.w3c.dom.Node;
* @version $Id$
* @since 2.2
*/
-public class PipelineComponentInfoInitializerDecorator implements
- BeanDefinitionDecorator {
-
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
+public class PipelineComponentInfoInitializerDecorator implements BeanDefinitionDecorator {
/* (non-Javadoc)
- * @see org.springframework.beans.factory.xml.BeanDefinitionDecorator#decorate(org.w3c.dom.Node, org.springframework.beans.factory.config.BeanDefinitionHolder, org.springframework.beans.factory.xml.ParserContext)
+ * @see org.springframework.beans.factory.xml.BeanDefinitionDecorator#decorate(org.w3c.dom.Node,
+ * org.springframework.beans.factory.config.BeanDefinitionHolder,
+ * org.springframework.beans.factory.xml.ParserContext)
*/
+ @Override
public BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder holder, ParserContext ctx) {
registerPipelineComponentInfo(ctx);
String initializerBeanName = registerPipelineComponentInfoInitializer(source, holder, ctx);
@@ -52,8 +53,9 @@ public class PipelineComponentInfoInitia
private void registerPipelineComponentInfo(ParserContext ctx) {
if (!ctx.getRegistry().containsBeanDefinition(PipelineComponentInfo.ROLE)) {
- BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.rootBeanDefinition(PipelineComponentInfoFactoryBean.class);
- defBuilder.setSingleton(true);
+ BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.rootBeanDefinition(
+ PipelineComponentInfoFactoryBean.class);
+ defBuilder.setScope(BeanDefinition.SCOPE_SINGLETON);
defBuilder.setLazyInit(false);
defBuilder.setInitMethodName("init");
ctx.getRegistry().registerBeanDefinition(PipelineComponentInfo.ROLE, defBuilder.getBeanDefinition());
@@ -62,19 +64,29 @@ public class PipelineComponentInfoInitia
private String registerPipelineComponentInfoInitializer(Node source, BeanDefinitionHolder holder, ParserContext ctx) {
String componentName = holder.getBeanName();
- String mimeType = ((Element)source).hasAttribute("mime-type") ? ((Element)source).getAttribute("mime-type") : null;
- String label = ((Element)source).hasAttribute("label") ? ((Element)source).getAttribute("label") : null;
- String hint = ((Element)source).hasAttribute("hint") ? ((Element)source).getAttribute("hint") : null;
+ String mimeType = ((Element) source).hasAttribute("mime-type")
+ ? ((Element) source).getAttribute("mime-type")
+ : null;
+ String label = ((Element) source).hasAttribute("label")
+ ? ((Element) source).getAttribute("label")
+ : null;
+ String hint = ((Element) source).hasAttribute("hint")
+ ? ((Element) source).getAttribute("hint")
+ : null;
- BeanDefinitionBuilder initializer = BeanDefinitionBuilder.rootBeanDefinition(PipelineComponentInfoInitializer.class);
+ BeanDefinitionBuilder initializer =
+ BeanDefinitionBuilder.rootBeanDefinition(PipelineComponentInfoInitializer.class);
initializer.addPropertyReference("info", PipelineComponentInfo.ROLE);
initializer.addPropertyValue("componentName", componentName);
- if (mimeType != null)
+ if (mimeType != null) {
initializer.addPropertyValue("mimeType", mimeType);
- if (label != null)
+ }
+ if (label != null) {
initializer.addPropertyValue("label", label);
- if (hint != null)
+ }
+ if (hint != null) {
initializer.addPropertyValue("hint", hint);
+ }
initializer.setInitMethodName("init");
String beanName = componentName + "/info";
@@ -83,15 +95,16 @@ public class PipelineComponentInfoInitia
return beanName;
}
- private void createDependencyOnPipelineComponentInfoInitializer(BeanDefinitionHolder holder, String initializerBeanName) {
+ private void createDependencyOnPipelineComponentInfoInitializer(BeanDefinitionHolder holder,
+ String initializerBeanName) {
AbstractBeanDefinition definition = ((AbstractBeanDefinition) holder.getBeanDefinition());
String[] dependsOn = definition.getDependsOn();
if (dependsOn == null) {
- dependsOn = new String[]{initializerBeanName};
+ dependsOn = new String[] { initializerBeanName };
} else {
- List dependencies = new ArrayList(Arrays.asList(dependsOn));
- dependencies.add(initializerBeanName);
- dependsOn = (String[]) dependencies.toArray(EMPTY_STRING_ARRAY);
+ List<String> dependencies = new ArrayList<String>(Arrays.asList(dependsOn));
+ dependencies.add(initializerBeanName);
+ dependsOn = dependencies.toArray(new String[dependencies.size()]);
}
definition.setDependsOn(dependsOn);
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonBeanPostProcessor.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonBeanPostProcessor.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonBeanPostProcessor.java Wed Apr 4 15:25:44 2018
@@ -272,4 +272,8 @@ public class AvalonBeanPostProcessor ext
}
ContainerUtil.dispose(bean);
}
+
+ public boolean requiresDestruction(Object bean) {
+ return true;
+ }
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/BridgeElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/BridgeElementParser.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/BridgeElementParser.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/BridgeElementParser.java Wed Apr 4 15:25:44 2018
@@ -26,12 +26,6 @@ import java.util.Map;
import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.*;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.core.io.ResourceLoader;
import org.apache.cocoon.acting.Action;
import org.apache.cocoon.components.pipeline.ProcessingPipeline;
@@ -49,6 +43,16 @@ import org.apache.cocoon.serialization.S
import org.apache.cocoon.spring.configurator.impl.AbstractElementParser;
import org.apache.cocoon.transformation.Transformer;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionReader;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.core.io.ResourceLoader;
+
import org.w3c.dom.Element;
/**
@@ -68,6 +72,7 @@ public class BridgeElementParser extends
/**
* @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(Element, ParserContext)
*/
+ @Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
final ResourceLoader resourceLoader = parserContext.getReaderContext().getReader().getResourceLoader();
@@ -118,12 +123,12 @@ public class BridgeElementParser extends
addLogger(registry, info.getRootLogger());
// handle includes of spring configurations
- final Iterator includeIter = info.getImports().iterator();
+ final Iterator<String> includeIter = info.getImports().iterator();
while ( includeIter.hasNext() ) {
if ( reader == null ) {
throw new Exception("Import of spring configuration files not supported. (Reader is null)");
}
- final String uri = (String)includeIter.next();
+ final String uri = includeIter.next();
reader.loadBeanDefinitions(resourceLoader.getResource(uri));
}
@@ -135,18 +140,24 @@ public class BridgeElementParser extends
// and finally add avalon bean post processor
final RootBeanDefinition beanDef = createBeanDefinition(AvalonBeanPostProcessor.class, "init", true);
- beanDef.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(AvalonUtils.CONTEXT_ROLE));
- beanDef.getPropertyValues().addPropertyValue("configurationInfo", new RuntimeBeanReference(ConfigurationInfo.class.getName()));
- beanDef.getPropertyValues().addPropertyValue("resourceLoader", resourceLoader);
- beanDef.getPropertyValues().addPropertyValue("location", this.getConfigurationLocation());
+ beanDef.getPropertyValues().addPropertyValue(
+ "context", new RuntimeBeanReference(AvalonUtils.CONTEXT_ROLE));
+ beanDef.getPropertyValues().addPropertyValue(
+ "configurationInfo", new RuntimeBeanReference(ConfigurationInfo.class.getName()));
+ beanDef.getPropertyValues().addPropertyValue(
+ "resourceLoader", resourceLoader);
+ beanDef.getPropertyValues().addPropertyValue(
+ "location", this.getConfigurationLocation());
this.register(beanDef, AvalonBeanPostProcessor.class.getName(), registry);
final RootBeanDefinition resolverDef = new RootBeanDefinition();
resolverDef.setBeanClassName("org.apache.cocoon.components.treeprocessor.variables.PreparedVariableResolver");
resolverDef.setLazyInit(false);
resolverDef.setScope("prototype");
- resolverDef.getPropertyValues().addPropertyValue("manager", new RuntimeBeanReference("org.apache.avalon.framework.service.ServiceManager"));
- this.register(resolverDef, "org.apache.cocoon.components.treeprocessor.variables.VariableResolver", null, registry);
+ resolverDef.getPropertyValues().addPropertyValue(
+ "manager", new RuntimeBeanReference("org.apache.avalon.framework.service.ServiceManager"));
+ this.register(
+ resolverDef, "org.apache.cocoon.components.treeprocessor.variables.VariableResolver", null, registry);
}
protected ConfigurationInfo readConfiguration(String location, ResourceLoader resourceLoader)
@@ -181,14 +192,14 @@ public class BridgeElementParser extends
public void createConfig(ConfigurationInfo info,
BeanDefinitionRegistry registry)
throws Exception {
- final Map components = info.getComponents();
- final List pooledRoles = new ArrayList();
+ final Map<String, ComponentInfo> components = info.getComponents();
+ final List<String> pooledRoles = new ArrayList<String>();
// Iterate over all definitions
- final Iterator i = components.entrySet().iterator();
+ final Iterator<Map.Entry<String, ComponentInfo>> i = components.entrySet().iterator();
while ( i.hasNext() ) {
- final Map.Entry entry = (Map.Entry)i.next();
- final ComponentInfo current = (ComponentInfo)entry.getValue();
+ Map.Entry<String, ComponentInfo> entry = i.next();
+ final ComponentInfo current = entry.getValue();
final String role = current.getRole();
String className = current.getComponentClassName();
@@ -213,9 +224,13 @@ public class BridgeElementParser extends
current.setModel(ComponentInfo.MODEL_PRIMITIVE);
}
} catch (NoClassDefFoundError ncdfe) {
- throw new ConfigurationException("Unable to create class for component with role " + current.getRole() + " with class: " + className, ncdfe);
+ throw new ConfigurationException(
+ "Unable to create class for component with role " + current.getRole()
+ + " with class: " + className, ncdfe);
} catch (ClassNotFoundException cnfe) {
- throw new ConfigurationException("Unable to create class for component with role " + current.getRole() + " with class: " + className, cnfe);
+ throw new ConfigurationException(
+ "Unable to create class for component with role " + current.getRole()
+ + " with class: " + className, cnfe);
}
}
if ( current.getModel() == ComponentInfo.MODEL_POOLED ) {
@@ -239,10 +254,13 @@ public class BridgeElementParser extends
if ( current.getDestroyMethodName() != null ) {
beanDef.setDestroyMethodName(current.getDestroyMethodName());
}
- beanDef.setSingleton(singleton);
+
+ beanDef.setScope( singleton ? BeanDefinition.SCOPE_SINGLETON : BeanDefinition.SCOPE_PROTOTYPE );
+
beanDef.setLazyInit(singleton && current.isLazyInit());
if ( isSelector ) {
- beanDef.getConstructorArgumentValues().addGenericArgumentValue(role.substring(0, role.length()-8), "java.lang.String");
+ beanDef.getConstructorArgumentValues().
+ addGenericArgumentValue(role.substring(0, role.length()-8), "java.lang.String");
if ( current.getDefaultValue() != null ) {
beanDef.getPropertyValues().addPropertyValue("default", current.getDefaultValue());
}
@@ -253,12 +271,14 @@ public class BridgeElementParser extends
// add the factory for poolables
final RootBeanDefinition poolableBeanDef = new RootBeanDefinition();
poolableBeanDef.setBeanClass(PoolableFactoryBean.class);
- poolableBeanDef.setSingleton(true);
+ poolableBeanDef.setScope(BeanDefinition.SCOPE_SINGLETON);
poolableBeanDef.setLazyInit(false);
poolableBeanDef.setInitMethodName("initialize");
poolableBeanDef.setDestroyMethodName("dispose");
- poolableBeanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, beanName, "java.lang.String");
- poolableBeanDef.getConstructorArgumentValues().addIndexedArgumentValue(1, className, "java.lang.String");
+ poolableBeanDef.getConstructorArgumentValues().
+ addIndexedArgumentValue(0, beanName, "java.lang.String");
+ poolableBeanDef.getConstructorArgumentValues().
+ addIndexedArgumentValue(1, className, "java.lang.String");
if ( current.getConfiguration() != null ) {
// we treat poolMax as a string to allow property replacements
final String poolMax = current.getConfiguration().getAttribute("pool-max", null);
@@ -268,10 +288,12 @@ public class BridgeElementParser extends
}
}
if ( current.getPoolInMethodName() != null ) {
- poolableBeanDef.getPropertyValues().addPropertyValue("poolInMethodName", current.getPoolInMethodName());
+ poolableBeanDef.getPropertyValues().
+ addPropertyValue("poolInMethodName", current.getPoolInMethodName());
}
if ( current.getPoolOutMethodName() != null ) {
- poolableBeanDef.getPropertyValues().addPropertyValue("poolOutMethodName", current.getPoolOutMethodName());
+ poolableBeanDef.getPropertyValues().
+ addPropertyValue("poolOutMethodName", current.getPoolOutMethodName());
}
this.register(poolableBeanDef, role, registry);
pooledRoles.add(role);
@@ -279,10 +301,10 @@ public class BridgeElementParser extends
}
// now change roles for pooled components (from {role} to {role}Pooled
- final Iterator prI = pooledRoles.iterator();
+ final Iterator<String> prI = pooledRoles.iterator();
while ( prI.hasNext() ) {
- final String role = (String)prI.next();
- final Object pooledInfo = components.remove(role);
+ final String role = prI.next();
+ final ComponentInfo pooledInfo = components.remove(role);
components.put(role + "Pooled", pooledInfo);
}
}
@@ -307,7 +329,7 @@ public class BridgeElementParser extends
if (!registry.containsBeanDefinition(PipelineComponentInfo.ROLE)) {
final RootBeanDefinition beanDef = new RootBeanDefinition();
beanDef.setBeanClass(PipelineComponentInfoFactoryBean.class);
- beanDef.setSingleton(true);
+ beanDef.setScope(BeanDefinition.SCOPE_SINGLETON);
beanDef.setLazyInit(false);
beanDef.setInitMethodName("init");
this.register(beanDef, PipelineComponentInfo.ROLE, registry);
@@ -315,7 +337,7 @@ public class BridgeElementParser extends
BeanDefinitionBuilder initDefBuilder =
BeanDefinitionBuilder.rootBeanDefinition(PipelineComponentInfoInitializer.class);
initDefBuilder.addPropertyReference("info", PipelineComponentInfo.ROLE);
- initDefBuilder.setSingleton(true);
+ initDefBuilder.setScope(BeanDefinition.SCOPE_SINGLETON);
initDefBuilder.setLazyInit(false);
initDefBuilder.setInitMethodName("init");
initDefBuilder.addPropertyValue("data", info.getData());
@@ -324,7 +346,7 @@ public class BridgeElementParser extends
final RootBeanDefinition ciBeanDef = new RootBeanDefinition();
ciBeanDef.setBeanClass(ConfigurationInfoFactoryBean.class);
- ciBeanDef.setSingleton(true);
+ ciBeanDef.setScope(BeanDefinition.SCOPE_SINGLETON);
ciBeanDef.setLazyInit(false);
ciBeanDef.getPropertyValues().addPropertyValue("configurationInfo", configInfo);
this.register(ciBeanDef, ConfigurationInfo.class.getName(), registry);
@@ -333,7 +355,7 @@ public class BridgeElementParser extends
protected static void prepareSelector(PipelineComponentInfo info,
ConfigurationInfo configInfo,
String category) {
- final ComponentInfo component = (ComponentInfo) configInfo.getComponents().get(category + "Selector");
+ final ComponentInfo component = configInfo.getComponents().get(category + "Selector");
if (component != null) {
info.setDefaultType(category, component.getDefaultValue());
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationInfo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationInfo.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationInfo.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationInfo.java Wed Apr 4 15:25:44 2018
@@ -36,44 +36,46 @@ public class ConfigurationInfo {
protected String rootLogger;
/** Map for shorthand to role mapping. */
- private final Map shorthands;
+ private final Map<String, String> shorthands;
- /** Map for role to default classname mapping.
+ /** Map for role to default classname mapping.
* As soon as a component is configured for this role, the info
* will be removed from this map.
+ *
* @see #allRoles */
- private final Map currentRoles;
+ private final Map<String, ComponentInfo> currentRoles;
/** Map for role to default classname mapping. This map contains
* all definitions to be available for maps in child containers.
+ *
* @see #currentRoles
*/
- private final Map allRoles;
+ private final Map<String, ComponentInfo> allRoles;
/** Map for role->key to classname mapping. */
- private final Map keyClassNames;
+ private final Map<String, Map<String, ComponentInfo>> keyClassNames;
/** List of components. */
- private final Map components = new HashMap();
+ private final Map<String, ComponentInfo> components = new HashMap<String, ComponentInfo>();
/** List of imports for spring configurations. */
- private final List imports = new ArrayList();
+ private final List<String> imports = new ArrayList<String>();
public ConfigurationInfo() {
- this.shorthands = new HashMap();
- this.currentRoles = new HashMap();
- this.keyClassNames = new HashMap();
- this.allRoles = new HashMap();
+ this.shorthands = new HashMap<String, String>();
+ this.currentRoles = new HashMap<String, ComponentInfo>();
+ this.keyClassNames = new HashMap<String, Map<String, ComponentInfo>>();
+ this.allRoles = new HashMap<String, ComponentInfo>();
}
public ConfigurationInfo(ConfigurationInfo parent) {
- this.shorthands = new HashMap(parent.shorthands);
- this.currentRoles = new HashMap();
- this.keyClassNames = new HashMap(parent.keyClassNames);
- this.allRoles = new HashMap(parent.allRoles);
+ this.shorthands = new HashMap<String, String>(parent.shorthands);
+ this.currentRoles = new HashMap<String, ComponentInfo>();
+ this.keyClassNames = new HashMap<String, Map<String, ComponentInfo>>(parent.keyClassNames);
+ this.allRoles = new HashMap<String, ComponentInfo>(parent.allRoles);
}
- public Map getComponents() {
+ public Map<String, ComponentInfo> getComponents() {
return components;
}
@@ -89,7 +91,7 @@ public class ConfigurationInfo {
this.components.put(info.getRole(), info);
}
- public Collection getRoles() {
+ public Collection<ComponentInfo> getRoles() {
return this.currentRoles.values();
}
@@ -99,9 +101,9 @@ public class ConfigurationInfo {
}
public ComponentInfo getRole(String role) {
- ComponentInfo info = (ComponentInfo) this.currentRoles.get(role);
- if (info == null ) {
- info = (ComponentInfo) this.allRoles.get(role);
+ ComponentInfo info = this.currentRoles.get(role);
+ if (info == null) {
+ info = this.allRoles.get(role);
}
return info;
}
@@ -114,11 +116,11 @@ public class ConfigurationInfo {
this.currentRoles.clear();
}
- public Map getShorthands() {
+ public Map<String, String> getShorthands() {
return this.shorthands;
}
- public Map getKeyClassNames() {
+ public Map<String, Map<String, ComponentInfo>> getKeyClassNames() {
return this.keyClassNames;
}
@@ -126,12 +128,12 @@ public class ConfigurationInfo {
this.imports.add(uri);
}
- public List getImports() {
+ public List<String> getImports() {
return this.imports;
}
public String getRoleForName(String alias) {
- final String value = (String) this.shorthands.get(alias);
+ final String value = this.shorthands.get(alias);
if (value != null) {
return value;
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationReader.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationReader.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationReader.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigurationReader.java Wed Apr 4 15:25:44 2018
@@ -61,7 +61,7 @@ public class ConfigurationReader {
protected final ConfigurationInfo configInfo;
/** All component configurations. */
- protected final List componentConfigs = new ArrayList();
+ protected final List<Configuration> componentConfigs = new ArrayList<Configuration>();
/** Is this the root context? */
protected final boolean isRootContext;
@@ -126,9 +126,9 @@ public class ConfigurationReader {
if (parentInfo != null) {
this.configInfo = new ConfigurationInfo(parentInfo);
- final Iterator i = parentInfo.getComponents().values().iterator();
+ final Iterator<ComponentInfo> i = parentInfo.getComponents().values().iterator();
while (i.hasNext()) {
- final ComponentInfo current = (ComponentInfo) i.next();
+ final ComponentInfo current = i.next();
if (current.isSelector()) {
this.configInfo.addRole(current.getRole(), current.copy());
}
@@ -218,7 +218,7 @@ public class ConfigurationReader {
*
* @param rsrc Resource for the input source
* @return Input source
- * @throws Exception if resource URL is not valid or input stream is not available
+ * @throws IOException if resource URL is not valid or input stream is not available
*/
protected InputSource getInputSource(Resource rsrc)
throws IOException {
@@ -288,7 +288,7 @@ public class ConfigurationReader {
this.configInfo.setRootLogger(config.getAttribute("logger", null));
// and load configuration with a empty list of loaded configurations
- final Set loadedConfigs = new HashSet();
+ final Set<String> loadedConfigs = new HashSet<String>();
// what is it?
if ("role-list".equals(config.getName()) || "roles".equals(config.getName())) {
configureRoles(config);
@@ -321,9 +321,9 @@ public class ConfigurationReader {
processComponents();
// add roles as components
- final Iterator i = this.configInfo.getRoles().iterator();
+ final Iterator<ComponentInfo> i = this.configInfo.getRoles().iterator();
while (i.hasNext()) {
- final ComponentInfo current = (ComponentInfo) i.next();
+ final ComponentInfo current = i.next();
if (!current.hasConfiguredLazyInit()) {
current.setLazyInit(true);
}
@@ -334,7 +334,7 @@ public class ConfigurationReader {
protected void parseConfiguration(final Configuration configuration,
String contextURI,
- Set loadedURIs)
+ Set<String> loadedURIs)
throws ConfigurationException {
final Configuration[] configurations = configuration.getChildren();
@@ -361,9 +361,9 @@ public class ConfigurationReader {
protected void processComponents()
throws ConfigurationException {
- final Iterator i = this.componentConfigs.iterator();
+ final Iterator<Configuration> i = this.componentConfigs.iterator();
while (i.hasNext()) {
- final Configuration componentConfig = (Configuration) i.next();
+ final Configuration componentConfig = i.next();
final String componentName = componentConfig.getName();
// Find the role
@@ -371,7 +371,7 @@ public class ConfigurationReader {
String alias = null;
if (role == null) {
// Get the role from the role manager if not explicitely specified
- role = (String) this.configInfo.getShorthands().get(componentName);
+ role = this.configInfo.getShorthands().get(componentName);
alias = componentName;
if (role == null) {
// Unknown role
@@ -434,7 +434,8 @@ public class ConfigurationReader {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Duplicate component definition for role " + role +
" at " + componentConfig.getLocation() + ". Component " +
- "has already been defined at " + ((ComponentInfo) this.configInfo.getComponents().get(role)).getConfiguration().getLocation());
+ "has already been defined at " +
+ this.configInfo.getComponents().get(role).getConfiguration().getLocation());
}
}
@@ -458,14 +459,15 @@ public class ConfigurationReader {
}
componentRole += '/';
Configuration[] children = info.getConfiguration().getChildren();
- final Map hintConfigs = (Map) this.configInfo.getKeyClassNames().get(role);
+ final Map<String, ComponentInfo> hintConfigs = this.configInfo.getKeyClassNames().get(role);
for (int j = 0; j < children.length; j++) {
final Configuration current = children[j];
final ComponentInfo childInfo = new ComponentInfo();
childInfo.fill(current);
childInfo.setConfiguration(current);
- final ComponentInfo hintInfo = hintConfigs == null ? null
- : (ComponentInfo) hintConfigs.get(current.getName());
+ final ComponentInfo hintInfo = hintConfigs == null
+ ? null
+ : hintConfigs.get(current.getName());
if (current.getAttribute(classAttribute, null) != null || hintInfo == null) {
childInfo.setComponentClassName(current.getAttribute(classAttribute));
} else {
@@ -488,7 +490,7 @@ public class ConfigurationReader {
* @throws ConfigurationException
*/
protected void handleInclude(final String contextURI,
- final Set loadedURIs,
+ final Set<String> loadedURIs,
final Configuration includeStatement)
throws ConfigurationException {
final String includeURI = includeStatement.getAttribute("src", null);
@@ -526,7 +528,8 @@ public class ConfigurationReader {
if (load) {
final String pattern = includeStatement.getAttribute("pattern", null);
try {
- Resource[] resources = this.resolver.getResources(this.getUrl(directoryURI + '/' + pattern, contextURI));
+ Resource[] resources = this.resolver.getResources(
+ this.getUrl(directoryURI + '/' + pattern, contextURI));
if (resources != null) {
Arrays.sort(resources, ResourceUtils.getResourceComparator());
for (int i = 0; i < resources.length; i++) {
@@ -534,14 +537,15 @@ public class ConfigurationReader {
}
}
} catch (Exception e) {
- throw new ConfigurationException("Cannot load from directory '" + directoryURI + "' at " + includeStatement.getLocation(), e);
+ throw new ConfigurationException("Cannot load from directory '" + directoryURI
+ + "' at " + includeStatement.getLocation(), e);
}
}
}
}
protected void loadURI(final Resource src,
- final Set loadedURIs,
+ final Set<String> loadedURIs,
final Configuration includeStatement)
throws ConfigurationException, IOException {
// If already loaded: do nothing
@@ -612,7 +616,8 @@ public class ConfigurationReader {
if ( dirResource.exists() ) {
final String pattern = includeStatement.getAttribute("pattern", null);
try {
- Resource[] resources = this.resolver.getResources(this.getUrl(directoryURI + '/' + pattern, contextURI));
+ Resource[] resources = this.resolver.getResources(
+ this.getUrl(directoryURI + '/' + pattern, contextURI));
if ( resources != null ) {
Arrays.sort(resources, ResourceUtils.getResourceComparator());
for(int i=0; i < resources.length; i++) {
@@ -652,7 +657,8 @@ public class ConfigurationReader {
continue;
}
if (!"role".equals(role.getName())) {
- throw new ConfigurationException("Unexpected '" + role.getName() + "' element at " + role.getLocation());
+ throw new ConfigurationException(
+ "Unexpected '" + role.getName() + "' element at " + role.getLocation());
}
final String roleName = role.getAttribute("name");
@@ -682,7 +688,8 @@ public class ConfigurationReader {
} else {
// Check that it's consistent with the existing info
if (!defaultClassName.equals(info.getComponentClassName())) {
- throw new ConfigurationException("Invalid redeclaration: default class already set to " + info.getComponentClassName() +
+ throw new ConfigurationException(
+ "Invalid redeclaration: default class already set to " + info.getComponentClassName() +
" for role " + roleName + " at " + role.getLocation());
}
//FIXME: should check also other ServiceInfo members
@@ -691,9 +698,9 @@ public class ConfigurationReader {
final Configuration[] keys = role.getChildren("hint");
if (keys.length > 0) {
- Map keyMap = (Map) this.configInfo.getKeyClassNames().get(roleName);
+ Map<String, ComponentInfo> keyMap = this.configInfo.getKeyClassNames().get(roleName);
if (keyMap == null) {
- keyMap = new HashMap();
+ keyMap = new HashMap<String, ComponentInfo>();
this.configInfo.getKeyClassNames().put(roleName, keyMap);
}
@@ -703,7 +710,7 @@ public class ConfigurationReader {
final String shortHand = key.getAttribute("shorthand").trim();
final String className = key.getAttribute("class").trim();
- ComponentInfo info = (ComponentInfo) keyMap.get(shortHand);
+ ComponentInfo info = keyMap.get(shortHand);
if (info == null) {
info = new ComponentInfo();
info.setComponentClassName(className);
@@ -714,7 +721,8 @@ public class ConfigurationReader {
} else {
// Check that it's consistent with the existing info
if (!className.equals(info.getComponentClassName())) {
- throw new ConfigurationException("Invalid redeclaration: class already set to " + info.getComponentClassName() +
+ throw new ConfigurationException(
+ "Invalid redeclaration: class already set to " + info.getComponentClassName() +
" for hint " + shortHand + " at " + key.getLocation());
}
//FIXME: should check also other ServiceInfo members
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapElementParser.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapElementParser.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapElementParser.java Wed Apr 4 15:25:44 2018
@@ -22,6 +22,7 @@ import org.apache.cocoon.core.container.
import org.apache.cocoon.core.container.spring.logger.LoggerUtils;
import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.excalibur.source.SourceResolver;
+import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -41,30 +42,40 @@ public class SitemapElementParser extend
/**
* @see org.apache.cocoon.core.container.spring.avalon.BridgeElementParser#createComponents(org.w3c.dom.Element, org.apache.cocoon.core.container.spring.avalon.ConfigurationInfo, org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.beans.factory.support.BeanDefinitionReader, org.springframework.core.io.ResourceLoader)
*/
+ @Override
public void createComponents(Element element, ConfigurationInfo info,
BeanDefinitionRegistry registry, BeanDefinitionReader reader,
ResourceLoader resourceLoader) throws Exception {
+
super.createComponents(element, info, registry, reader, resourceLoader);
// add string template parser for sitemap variable substitution
- final ChildBeanDefinition beanDef = new ChildBeanDefinition("org.apache.cocoon.template.expression.AbstractStringTemplateParser");
- beanDef.setBeanClassName("org.apache.cocoon.components.treeprocessor.variables.LegacySitemapStringTemplateParser");
- beanDef.setSingleton(true);
+ final ChildBeanDefinition beanDef =
+ new ChildBeanDefinition("org.apache.cocoon.template.expression.AbstractStringTemplateParser");
+ beanDef.setBeanClassName(
+ "org.apache.cocoon.components.treeprocessor.variables.LegacySitemapStringTemplateParser");
+ beanDef.setScope(BeanDefinition.SCOPE_SINGLETON);
beanDef.setLazyInit(false);
- beanDef.getPropertyValues().addPropertyValue("serviceManager", new RuntimeBeanReference("org.apache.avalon.framework.service.ServiceManager"));
+ beanDef.getPropertyValues().addPropertyValue(
+ "serviceManager", new RuntimeBeanReference("org.apache.avalon.framework.service.ServiceManager"));
this.register(beanDef, "org.apache.cocoon.el.parsing.StringTemplateParser/legacySitemap", null, registry);
final RootBeanDefinition resolverDef = new RootBeanDefinition();
- resolverDef.setBeanClassName("org.apache.cocoon.components.treeprocessor.variables.StringTemplateParserVariableResolver");
+ resolverDef.setBeanClassName(
+ "org.apache.cocoon.components.treeprocessor.variables.StringTemplateParserVariableResolver");
resolverDef.setLazyInit(false);
resolverDef.setScope("prototype");
- resolverDef.getPropertyValues().addPropertyValue("stringTemplateParser", new RuntimeBeanReference("org.apache.cocoon.el.parsing.StringTemplateParser/legacySitemap"));
- resolverDef.getPropertyValues().addPropertyValue("objectModel", new RuntimeBeanReference("org.apache.cocoon.el.objectmodel.ObjectModel"));
- this.register(resolverDef, "org.apache.cocoon.components.treeprocessor.variables.VariableResolver", null, registry);
+ resolverDef.getPropertyValues().addPropertyValue(
+ "stringTemplateParser", new RuntimeBeanReference("org.apache.cocoon.el.parsing.StringTemplateParser/legacySitemap"));
+ resolverDef.getPropertyValues().addPropertyValue(
+ "objectModel", new RuntimeBeanReference("org.apache.cocoon.el.objectmodel.ObjectModel"));
+ this.register(resolverDef,
+ "org.apache.cocoon.components.treeprocessor.variables.VariableResolver", null, registry);
}
/**
* @see BridgeElementParser#addContext(Element, BeanDefinitionRegistry)
*/
+ @Override
protected void addContext(Element element, BeanDefinitionRegistry registry) {
// we get the uriPrefix from the configuration
final String uriPrefix = element.getAttribute("uriPrefix");
@@ -81,6 +92,7 @@ public class SitemapElementParser extend
* @param registry The bean registry.
* @param loggerCategory The optional category for the logger.
*/
+ @Override
protected void addLogger(BeanDefinitionRegistry registry,
String loggerCategory) {
final RootBeanDefinition beanDef = createBeanDefinition(ChildLoggerFactoryBean.class, "init", false);
@@ -93,14 +105,16 @@ public class SitemapElementParser extend
/**
* @see BridgeElementParser#readConfiguration(String, ResourceLoader)
*/
- protected ConfigurationInfo readConfiguration(String location, ResourceLoader resourceLoader)
- throws Exception {
+ @Override
+ protected ConfigurationInfo readConfiguration(String location, ResourceLoader resourceLoader) throws Exception {
WebApplicationContext parentContext = WebAppContextUtils.getCurrentWebApplicationContext();
- return ConfigurationReader.readSitemap((ConfigurationInfo) parentContext.getBean(ConfigurationInfo.class.getName()),
- location,
- new SourceResourceLoader(resourceLoader, (SourceResolver) parentContext.getBean(SourceResolver.ROLE)));
+ return ConfigurationReader.readSitemap(
+ (ConfigurationInfo) parentContext.getBean(ConfigurationInfo.class.getName()),
+ location,
+ new SourceResourceLoader(resourceLoader, (SourceResolver) parentContext.getBean(SourceResolver.ROLE)));
}
+ @Override
protected String getConfigurationLocation() {
return "config/avalon";
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SourceResource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SourceResource.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SourceResource.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/core/container/spring/avalon/SourceResource.java Wed Apr 4 15:25:44 2018
@@ -36,18 +36,20 @@ import org.springframework.core.io.Resou
public class SourceResource implements Resource {
protected Source source;
+
protected SourceResolver resolver;
- protected boolean open;
+ protected boolean open;
public SourceResource(Source s, SourceResolver r) {
this.source = s;
- this.resolver =r;
+ this.resolver = r;
}
/**
* @see org.springframework.core.io.InputStreamSource#getInputStream()
*/
+ @Override
public InputStream getInputStream() throws IOException {
this.open = true;
return new SourceIOInputStream(this.resolver, this.source);
@@ -56,14 +58,17 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#createRelative(java.lang.String)
*/
+ @Override
public Resource createRelative(String uri) throws IOException {
int pos = this.source.getURI().lastIndexOf('/');
- return new SourceResource(this.resolver.resolveURI(uri, this.source.getURI().substring(0, pos), null), this.resolver);
+ return new SourceResource(
+ this.resolver.resolveURI(uri, this.source.getURI().substring(0, pos), null), this.resolver);
}
/**
* @see org.springframework.core.io.Resource#exists()
*/
+ @Override
public boolean exists() {
return this.source.exists();
}
@@ -71,6 +76,7 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#getDescription()
*/
+ @Override
public String getDescription() {
return "Source: " + this.source;
}
@@ -78,6 +84,7 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#getFile()
*/
+ @Override
public File getFile() throws IOException {
return SourceUtil.getFile(this.source);
}
@@ -85,6 +92,7 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#getFilename()
*/
+ @Override
public String getFilename() {
int pos = this.source.getURI().lastIndexOf('/');
return this.source.getURI().substring(pos + 1);
@@ -93,6 +101,7 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#getURL()
*/
+ @Override
public URL getURL() throws IOException {
return new URL(this.source.getURI());
}
@@ -104,15 +113,17 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#isOpen()
*/
+ @Override
public boolean isOpen() {
return this.open;
}
+
+ @Override
public URI getURI() throws IOException {
try {
return new URI(this.source.getURI());
} catch (URISyntaxException e) {
- IOException ioe = new IOException("Exception because of the URI syntax.");
- ioe.initCause(e);
+ IOException ioe = new IOException("Exception because of the URI syntax.", e);
throw ioe;
}
}
@@ -120,12 +131,19 @@ public class SourceResource implements R
/**
* @see org.springframework.core.io.Resource#isReadable()
*/
+ @Override
public boolean isReadable() {
return this.source.exists();
}
- public long lastModified() throws IOException {
- return this.source.getLastModified();
- }
+ @Override
+ public long lastModified() throws IOException {
+ return this.source.getLastModified();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return this.source.getContentLength();
+ }
}
Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/AbstractTestCase.java?rev=1828354&r1=1828353&r2=1828354&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/AbstractTestCase.java (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/AbstractTestCase.java Wed Apr 4 15:25:44 2018
@@ -25,7 +25,6 @@ import org.springframework.beans.factory
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestContextHolder;
@@ -42,6 +41,8 @@ import org.apache.cocoon.spring.configur
import org.apache.cocoon.spring.configurator.impl.SettingsBeanFactoryPostProcessor;
import junit.framework.TestCase;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
/**
* This class sets up all necessary environment information to implement own test cases.
@@ -52,16 +53,18 @@ import junit.framework.TestCase;
public abstract class AbstractTestCase extends TestCase {
private MockRequest request;
+
private MockResponse response;
+
private MockContext context;
- private Map objectmodel;
+
+ private Map<String, Object> objectmodel;
private MockRequestAttributes requestAttributes;
/** The bean factory. */
private DefaultListableBeanFactory beanFactory;
-
public final MockRequest getRequest() {
return this.request;
}
@@ -74,7 +77,7 @@ public abstract class AbstractTestCase e
return this.context;
}
- public final Map getObjectModel() {
+ public final Map<String, Object> getObjectModel() {
return this.objectmodel;
}
@@ -86,6 +89,7 @@ public abstract class AbstractTestCase e
/**
* @see junit.framework.TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
@@ -111,6 +115,7 @@ public abstract class AbstractTestCase e
/**
* @see junit.framework.TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
if (this.requestAttributes != null) {
this.requestAttributes.requestCompleted();
@@ -148,14 +153,20 @@ public abstract class AbstractTestCase e
MockWebApplicationContext ctx = new MockWebApplicationContext(this.beanFactory, getContext());
getContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
+
+ // COCOON-2374
+ // needed to avoid problem with
+ // java.lang.IllegalStateException: org.apache.cocoon.MockWebApplicationContext@7d898981 has not been refreshed yet
+ ctx.refresh();
}
protected void createBeanFactory() throws Exception {
+ this.beanFactory = new DefaultListableBeanFactory();
+
ClassPathResource cpr = new ClassPathResource(getClass().getName().replace('.', '/') + ".spring.xml");
if (cpr.exists()) {
- this.beanFactory = new XmlBeanFactory(cpr);
- } else {
- this.beanFactory = new DefaultListableBeanFactory();
+ XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
+ reader.loadBeanDefinitions(cpr);
}
File base = new File("target");
@@ -178,7 +189,7 @@ public abstract class AbstractTestCase e
protected void addSettings() {
RootBeanDefinition def = new RootBeanDefinition();
def.setBeanClass(SettingsBeanFactoryPostProcessor.class);
- def.setSingleton(true);
+ def.setScope(BeanDefinition.SCOPE_SINGLETON);
def.setLazyInit(false);
def.setInitMethodName("init");
BeanDefinitionHolder holder = new BeanDefinitionHolder(def, Settings.ROLE);
@@ -188,7 +199,7 @@ public abstract class AbstractTestCase e
protected void addProcessingInfoProvider() {
RootBeanDefinition def = new RootBeanDefinition();
def.setBeanClass(MockProcessInfoProvider.class);
- def.setSingleton(true);
+ def.setScope(BeanDefinition.SCOPE_SINGLETON);
def.setLazyInit(false);
def.getPropertyValues().addPropertyValue("objectModel", getObjectModel());
def.getPropertyValues().addPropertyValue("request", new MockProcessInfoProvider.StubRequest(getRequest()));
@@ -212,8 +223,8 @@ public abstract class AbstractTestCase e
return new MockResponse();
}
- protected Map createObjectModel() {
- return new HashMap();
+ protected Map<String, Object> createObjectModel() {
+ return new HashMap<String, Object>();
}
protected MockContext createContext() {