You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/04/22 16:29:35 UTC

svn commit: r936869 [2/2] - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/main/java/org/apache/camel/processor/aggregate/ camel-core/src/test/java/org/apache/camel/...

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataSource.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataSource.xml?rev=936869&r1=936868&r2=936869&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataSource.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataSource.xml Thu Apr 22 14:29:34 2010
@@ -30,28 +30,30 @@
     <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="direct:okay"/>
-            <policy ref="PROPAGATION_REQUIRED"/>
-            <setBody>
-                <constant>Tiger in Action</constant>
-            </setBody>
-            <bean ref="bookService"/>
-            <setBody>
-                <constant>Elephant in Action</constant>
-            </setBody>
-            <bean ref="bookService"/>
+            <policy ref="PROPAGATION_REQUIRED">
+                <setBody>
+                    <constant>Tiger in Action</constant>
+                </setBody>
+                <bean ref="bookService"/>
+                <setBody>
+                    <constant>Elephant in Action</constant>
+                </setBody>
+                <bean ref="bookService"/>
+            </policy>
         </route>
 
         <route>
             <from uri="direct:fail"/>
-            <policy ref="PROPAGATION_REQUIRED"/>
-            <setBody>
-                <constant>Tiger in Action</constant>
-            </setBody>
-            <bean ref="bookService"/>
-            <setBody>
-                <constant>Donkey in Action</constant>
-            </setBody>
-            <bean ref="bookService"/>
+            <policy ref="PROPAGATION_REQUIRED">
+                <setBody>
+                    <constant>Tiger in Action</constant>
+                </setBody>
+                <bean ref="bookService"/>
+                <setBody>
+                    <constant>Donkey in Action</constant>
+                </setBody>
+                <bean ref="bookService"/>
+            </policy>
         </route>
     </camelContext>
 

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml?rev=936869&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml Thu Apr 22 14:29:34 2010
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <bean id="foo" class="org.apache.camel.processor.PolicyPerProcessorTest$MyPolicy">
+        <constructor-arg index="0" value="foo"/>
+    </bean>
+
+    <bean id="bar" class="org.apache.camel.processor.PolicyPerProcessorTest$MyPolicy">
+        <constructor-arg index="0" value="bar"/>
+    </bean>
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <!-- START SNIPPET: e1 -->
+        <route>
+            <from uri="direct:start"/>
+            <!-- wraps the mock:foo processor in this policy -->
+            <policy ref="foo">
+                <to uri="mock:foo"/>
+            </policy>
+            <!-- wraps the mock:bar processor in this policy -->
+            <policy ref="bar">
+                <to uri="mock:bar"/>
+            </policy>
+            <!-- the mock:result is NOT wrapped in any policy -->
+            <to uri="mock:result"/>
+        </route>
+        <!-- END SNIPPET: e1 -->
+    </camelContext>
+
+</beans>

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerProcessorTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerRouteTest.xml (from r936622, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerRouteTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerRouteTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml&r1=936622&r2=936869&rev=936869&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/PolicyPerRouteTest.xml Thu Apr 22 14:29:34 2010
@@ -22,16 +22,23 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <!-- START SNIPPET: e1 -->
+    <bean id="foo" class="org.apache.camel.processor.PolicyPerRouteTest$MyPolicy">
+        <constructor-arg index="0" value="foo"/>
+    </bean>
+
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <!-- START SNIPPET: e1 -->
         <route>
             <from uri="direct:start"/>
-            <aop beforeUri="mock:before">
-                <transform><constant>Bye World</constant></transform>
+            <!-- wraps the entire route in the same policy,
+                 notice how we have to wrap policy around the route -->
+            <policy ref="foo">
+                <to uri="mock:foo"/>
+                <to uri="mock:bar"/>
                 <to uri="mock:result"/>
-            </aop>
+            </policy>
         </route>
+        <!-- END SNIPPET: e1 -->
     </camelContext>
-    <!-- END SNIPPET: e1 -->
 
 </beans>

Modified: camel/trunk/examples/camel-example-spring-security/README.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-security/README.txt?rev=936869&r1=936868&r2=936869&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-security/README.txt (original)
+++ camel/trunk/examples/camel-example-spring-security/README.txt Thu Apr 22 14:29:34 2010
@@ -29,7 +29,7 @@ To use log4j as the logging framework ad
 and log4j.properties is located in src/main/resources 
 
 For the latest & greatest documentation on how to use this example please see
-  http://camel.apache.org/spring-example.html
+  http://camel.apache.org/spring-security-example.html
 
 If you hit any problems please talk to us on the Camel Forums
   http://camel.apache.org/discussion-forums.html

Modified: camel/trunk/examples/camel-example-spring-security/src/main/resources/org/apache/camel/example/spring/security/camel-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-security/src/main/resources/org/apache/camel/example/spring/security/camel-context.xml?rev=936869&r1=936868&r2=936869&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-security/src/main/resources/org/apache/camel/example/spring/security/camel-context.xml (original)
+++ camel/trunk/examples/camel-example-spring-security/src/main/resources/org/apache/camel/example/spring/security/camel-context.xml Thu Apr 22 14:29:34 2010
@@ -17,9 +17,9 @@
 -->
 <!-- START SNIPPET: example -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xmlns:spring-security="http://www.springframework.org/schema/security"
-        xsi:schemaLocation="http://www.springframework.org/schema/beans
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:spring-security="http://www.springframework.org/schema/security"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring
           http://camel.apache.org/schema/spring/camel-spring.xsd
@@ -27,53 +27,60 @@
           http://camel.apache.org/schema/spring-security/camel-spring-security.xsd
           http://www.springframework.org/schema/security
 		  http://www.springframework.org/schema/security/spring-security.xsd">
-		  
-		<!-- we don't authenticate the user again here-->
-		<bean id="authenticationManager" class="org.springframework.security.MockAuthenticationManager"/>
-
-		<bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
-			<property name="allowIfAllAbstainDecisions" value="true"/>
-			<property name="decisionVoters">
-				<list>
-					<bean class="org.springframework.security.vote.RoleVoter"/>
-				</list>
-			</property>
-		</bean>
-		  
-		<!-- The Policy for checking the authentication role of ADMIN -->
-        <authorizationPolicy id="admin" access="ROLE_ADMIN" 
-          	authenticationManager="authenticationManager"
-          	accessDecisionManager="accessDecisionManager"
-          	 xmlns="http://camel.apache.org/schema/spring-security"/>
-          	 
-        <!-- The Policy for checking the authentication role of USER -->
-        <authorizationPolicy id="user" access="ROLE_USER"
-          	 xmlns="http://camel.apache.org/schema/spring-security"/>
-          	 
-          <camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">
-              <!-- Catch the authorization exception and set the Access Denied message back -->
-              <onException>
-                 <exception>org.apache.camel.CamelAuthorizationException</exception>
-                 <handled><constant>true</constant></handled>
-                 <transform><constant>Access Denied!</constant></transform>
-              </onException>
-              
-              <route>
-               <from uri="servlet:///user"/>
-               <policy ref="user"/>
-               <transform>
-                  <simple>Normal user can access this service</simple>
-              </transform>
-             </route>
-             <route>
-               <from uri="servlet:///admin"/>
-               <policy ref="admin"/>
-               <transform>
-                  <simple>Call the admin operation OK</simple>
-              </transform>
-             </route>
-          </camelContext>
-          
+
+    <!-- we don't authenticate the user again here-->
+    <bean id="authenticationManager" class="org.springframework.security.MockAuthenticationManager"/>
+
+    <bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
+        <property name="allowIfAllAbstainDecisions" value="true"/>
+        <property name="decisionVoters">
+            <list>
+                <bean class="org.springframework.security.vote.RoleVoter"/>
+            </list>
+        </property>
+    </bean>
+
+    <!-- The Policy for checking the authentication role of ADMIN -->
+    <authorizationPolicy id="admin" access="ROLE_ADMIN"
+                         authenticationManager="authenticationManager"
+                         accessDecisionManager="accessDecisionManager"
+                         xmlns="http://camel.apache.org/schema/spring-security"/>
+
+    <!-- The Policy for checking the authentication role of USER -->
+    <authorizationPolicy id="user" access="ROLE_USER"
+                         xmlns="http://camel.apache.org/schema/spring-security"/>
+
+    <camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">
+        <!-- Catch the authorization exception and set the Access Denied message back -->
+        <onException>
+            <exception>org.apache.camel.CamelAuthorizationException</exception>
+            <handled>
+                <constant>true</constant>
+            </handled>
+            <transform>
+                <constant>Access Denied!</constant>
+            </transform>
+        </onException>
+
+        <route>
+            <from uri="servlet:///user"/>
+            <!-- wrap the route in the policy which enforces security check -->
+            <policy ref="user">
+                <transform>
+                    <simple>Normal user can access this service</simple>
+                </transform>
+            </policy>
+        </route>
+        <route>
+            <from uri="servlet:///admin"/>
+            <!-- wrap the route in the policy which enforces security check -->
+            <policy ref="admin">
+                <transform>
+                    <simple>Call the admin operation OK</simple>
+                </transform>
+            </policy>
+        </route>
+    </camelContext>
+
 </beans>
-<!-- END SNIPPET: example -->                             
-                    
+<!-- END SNIPPET: example -->

Modified: camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/applicationContext-security.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/applicationContext-security.xml?rev=936869&r1=936868&r2=936869&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/applicationContext-security.xml (original)
+++ camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/applicationContext-security.xml Thu Apr 22 14:29:34 2010
@@ -1,25 +1,40 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!--
   - Application context containing authentication, channel
   - security and web URI beans.
   -
   - Only used by "filter" artifact.
   -
   -->
-
 <b:beans xmlns="http://www.springframework.org/schema/security"
-    xmlns:b="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
+         xmlns:b="http://www.springframework.org/schema/beans"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                             http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
 
     <b:import resource="classpath:org/apache/camel/example/spring/security/common-security.xml"/>
-     
+
     <http realm="User Restrict Realm">
         <intercept-url pattern="/camel/**" access="ROLE_USER"/>
         <http-basic/>
         <remember-me/>
     </http>
- 
 
 </b:beans>

Modified: camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/web.xml?rev=936869&r1=936868&r2=936869&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/web.xml (original)
+++ camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/web.xml Thu Apr 22 14:29:34 2010
@@ -17,53 +17,49 @@
 -->
 
 <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
-		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
-	<display-name>My Web Application</display-name>
-	
-	 <!-- location of spring xml files -->
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
+    <display-name>My Web Application</display-name>
+
+    <!-- location of spring xml files -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
         <param-value>/WEB-INF/applicationContext-security.xml</param-value>
-	</context-param>
+    </context-param>
+
+    <!-- the listener that kick-starts Spring -->
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
 
-	<!-- the listener that kick-starts Spring -->
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
-	
-	<filter>
+    <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
 
     <filter-mapping>
-      <filter-name>springSecurityFilterChain</filter-name>
-      <url-pattern>/*</url-pattern>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <url-pattern>/*</url-pattern>
     </filter-mapping>
 
-	<servlet>
-    <servlet-name>CamelServlet</servlet-name>
-    <servlet-class>
-        org.apache.camel.component.servlet.CamelHttpTransportServlet
-    </servlet-class>
-    <init-param> 
-      <param-name>matchOnUriPrefix</param-name> 
-      <param-value>true</param-value>
-    </init-param>    
-    <!-- set the camel context application file location here -->
-    <init-param>
-      <param-name>contextConfigLocation</param-name>
-	  <param-value>/org/apache/camel/example/spring/security/camel-context.xml</param-value>
-    </init-param>
-  </servlet>
-  
-    
-  <servlet-mapping>
-    <servlet-name>CamelServlet</servlet-name>
-    <url-pattern>/camel/*</url-pattern>
-  </servlet-mapping>
-  
+    <servlet>
+        <servlet-name>CamelServlet</servlet-name>
+        <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
+        <init-param>
+            <param-name>matchOnUriPrefix</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <!-- set the camel context application file location here -->
+        <init-param>
+            <param-name>contextConfigLocation</param-name>
+            <param-value>/org/apache/camel/example/spring/security/camel-context.xml</param-value>
+        </init-param>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>CamelServlet</servlet-name>
+        <url-pattern>/camel/*</url-pattern>
+    </servlet-mapping>
 
 </web-app>