[jboss-svn-commits] JBL Code SVN: r33999 - in labs/jbossrules/trunk/drools-server: src/main/java/org/apache/camel and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jul 18 04:10:03 EDT 2010
Author: mark.proctor at jboss.com
Date: 2010-07-18 04:10:00 -0400 (Sun, 18 Jul 2010)
New Revision: 33999
Added:
labs/jbossrules/trunk/drools-server/src/
labs/jbossrules/trunk/drools-server/src/main/java/org/drools/server/Test.java
labs/jbossrules/trunk/drools-server/src/main/resources/beans.xml
labs/jbossrules/trunk/drools-server/src/main/resources/camel-client.xml
labs/jbossrules/trunk/drools-server/src/main/resources/camel-server.xml
labs/jbossrules/trunk/drools-server/src/main/resources/knowledge-services.xml
labs/jbossrules/trunk/drools-server/src/main/resources/test.drl
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml
labs/jbossrules/trunk/drools-server/src/main/webapp/test.jsp
labs/jbossrules/trunk/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java
labs/jbossrules/trunk/drools-server/src/test/resources/beans-test.xml
labs/jbossrules/trunk/drools-server/src/test/resources/camel-client-test.xml
labs/jbossrules/trunk/drools-server/src/test/resources/camel-embedded-server-test.xml
Removed:
labs/jbossrules/trunk/drools-server/src/main/java/org/apache/camel/jboss/
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/beans.xml
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/camel.xml
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/knowledge-services.xml
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/test.drl
labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml
labs/jbossrules/trunk/drools-server/src/test/java/org/drools/pipeline/camel/
Modified:
labs/jbossrules/trunk/drools-server/
labs/jbossrules/trunk/drools-server/pom.xml
Log:
JBRULES-2347 Camel
-Added drools-server example that executes a message via cxf and camel
-refactored the layout of drools-server, simplifying it.
Property changes on: labs/jbossrules/trunk/drools-server
___________________________________________________________________
Name: svn:ignore
- target
local
.metadata
.settings
.wtpmodules
nbproject
*.ipr
*.iws
*.iml
+ *
*.iml
*.ipr
*.iws
.metadata
.settings
.wtpmodules
local
nbproject
target
Modified: labs/jbossrules/trunk/drools-server/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-server/pom.xml 2010-07-18 08:07:27 UTC (rev 33998)
+++ labs/jbossrules/trunk/drools-server/pom.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -8,12 +8,168 @@
<version>5.1.0.SNAPSHOT</version>
</parent>
- <artifactId>drools-server</artifactId>
- <packaging>pom</packaging>
- <name>Drools :: Server</name>
-
- <modules>
- <module>drools-server-app</module>
- </modules>
-
+ <artifactId>drools-server</artifactId>
+ <packaging>jar</packaging>
+ <name>Drools :: Server</name>
+ <build>
+ <finalName>drools-server</finalName>
+ </build>
+
+ <dependencies>
+
+ <!-- Drools -->
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-decisiontables</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-persistence-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-workitems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-templates</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-grid-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-camel</artifactId>
+ </dependency>
+
+ <!-- Camel -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cxf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-xstream</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jaxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- CXF deps -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-bundle-jaxrs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </dependency>
+
+
+ <!-- web app deps -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
</project>
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-server/src (from rev 33994, labs/jbossrules/trunk/drools-server/drools-server-app/src)
Copied: labs/jbossrules/trunk/drools-server/src/main/java/org/drools/server/Test.java (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/java/org/drools/server/Test.java)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/java/org/drools/server/Test.java (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/java/org/drools/server/Test.java 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,56 @@
+package org.drools.server;
+
+import java.io.InputStream;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.CamelSpringTestSupport;
+import org.drools.core.util.StringUtils;
+import org.drools.impl.StatelessKnowledgeSessionImpl;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class Test {
+
+ public static void main(String[] args) {
+ String msg = "Hello World";
+
+ System.out.println( "Sending Message:\n" + msg);
+
+ Test test = new Test();
+ String response = test.send( msg );
+
+ System.out.println( );
+ System.out.println( );
+
+ System.out.println( "Received Response:\n" + response);
+ }
+
+ public String send(String msg) {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext("classpath:camel-client.xml");
+ String batch = "";
+ batch += "<batch-execution lookup=\"ksession1\">\n";
+ batch += " <insert out-identifier=\"message\">\n";
+ batch += " <org.test.Message>\n";
+ batch += " <text>" + msg + "</text>\n";
+ batch += " </org.test.Message>\n";
+ batch += " </insert>\n";
+ batch += "</batch-execution>\n";
+
+
+ Test test = new Test();
+ String response = test.execute( batch,
+ ( CamelContext ) springContext.getBean( "camel" ) );
+
+ return response;
+ }
+
+ public String execute(String msg, CamelContext camelContext) {
+
+ String response = camelContext.createProducerTemplate().requestBody( "direct://kservice", msg, String.class );
+
+ return response;
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-server/src/main/resources/beans.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/resources/beans.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/resources/beans.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/resources/beans.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,32 @@
+<?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"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
+ default-autowire="byName">
+
+
+ <!-- loads the kbases and ksessions into the ApplicationContext -->
+ <import resource="classpath:knowledge-services.xml" />
+
+ <!-- Builds the routes that makes the ksessesions available as services -->
+ <import resource="classpath:camel-server.xml" />
+
+</beans>
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-server/src/main/resources/camel-client.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/resources/camel-client.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/resources/camel-client.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/resources/camel-client.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,44 @@
+<?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"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct://kservice"/>
+ <policy ref="droolsPolicy">
+ <to uri="cxfrs://http://localhost:8080/drools-server-app/kservice/rest"/>
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Copied: labs/jbossrules/trunk/drools-server/src/main/resources/camel-server.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/resources/camel-server.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/resources/camel-server.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/resources/camel-server.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,68 @@
+<?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"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+
+ <!--
+ ! Define the server end point.
+ ! Copy and paste this element, changing id and the address, to expose services on different urls.
+ ! Different Camel routes can handle different end point paths.
+ -->
+ <cxf:rsServer id="rsServer"
+ address="/kservice/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <!--
+ ! Routes incoming messages from end point id="rsServer".
+ ! Example route unmarshals the messages with xstream and executes against ksession1.
+ ! Copy and paste this element, changing marshallers and the 'to' uri, to target different sessions, as needed.
+ !-->
+
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Copied: labs/jbossrules/trunk/drools-server/src/main/resources/knowledge-services.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/resources/knowledge-services.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/resources/knowledge-services.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/resources/knowledge-services.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,35 @@
+<?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"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd">
+
+ <drools:execution-node id="node1" />
+
+ <drools:kbase id="kbase1" node="node1">
+ <drools:resources>
+ <drools:resource type="DRL" source="classpath:test.drl"/>
+ </drools:resources>
+ </drools:kbase>
+
+ <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>
+
+</beans>
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-server/src/main/resources/test.drl (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/resources/test.drl)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/resources/test.drl (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/resources/test.drl 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,13 @@
+package org.test
+
+declare Message
+ text : String
+end
+
+
+rule "echo" dialect "mvel"
+when
+ $m : Message();
+then
+ $m.text = "echo:" + $m.text;
+end
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/beans.xml 2010-07-18 05:02:12 UTC (rev 33994)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/beans.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -1,33 +0,0 @@
-<?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"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
- default-autowire="byName">
-
-
- <!-- loads the kbases and ksessions into the ApplicationContext -->
- <import resource="classpath:services-test.xml" />
-
- <!-- Builds the routes that makes the ksessesions available as services -->
- <import resource="classpath:knowledge-services.xml" />
-
-
-</beans>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/camel.xml
===================================================================
--- labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/camel.xml 2010-07-18 05:02:12 UTC (rev 33994)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/camel.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -1,64 +0,0 @@
-<?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"
- xmlns:cxf="http://camel.apache.org/schema/cxf"
- xmlns:jaxrs="http://cxf.apache.org/jaxrs"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
- http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
- ">
-
- <!--
- ! Define the server end point.
- ! Copy and paste this element, changing id and the path for the address to expose services on different urls.
- ! Different Camel routes can handle different end point paths.
- -->
- <cxf:rsServer id="rsServer"
- address="/"
- serviceClass="org.drools.jax.rs.CommandExecutorImpl">
- <cxf:providers>
- <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
- </cxf:providers>
- </cxf:rsServer>
-
- <!-- Leave this, as it's needed to make Camel "drools" aware -->
- <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
-
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-
- <!--
- ! Routes incoming messages from end point id="rsServer"
- ! Example route unmarshals the messages with xstream and executes against ksession1
- ! Copy and paste this element, changing marsalls and the to uri, to target different sessions, as needed
- !-->
-
- <route>
- <from uri="cxfrs://bean://rsServer"/>
- <policy ref="droolsPolicy">
- <unmarshal ref="xstream" />
- <to uri="drools:node1/ksession1" />
- <marshal ref="xstream" />
- </policy>
- </route>
-
- </camelContext>
-
-</beans>
Deleted: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/knowledge-services.xml
===================================================================
--- labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/knowledge-services.xml 2010-07-18 05:02:12 UTC (rev 33994)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/knowledge-services.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -1,35 +0,0 @@
-<?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"
- xmlns:drools="http://drools.org/schema/drools-spring"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd">
-
- <drools:execution-node id="node1" />
-
- <drools:kbase id="kbase1" node="node1">
- <drools:resources>
- <drools:resource type="DRL" source="classpath:test.drl"/>
- </drools:resources>
- </drools:kbase>
-
- <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>
-
-</beans>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/test.drl
===================================================================
--- labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/test.drl 2010-07-18 05:02:12 UTC (rev 33994)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/test.drl 2010-07-18 08:10:00 UTC (rev 33999)
@@ -1,13 +0,0 @@
-package org.test
-
-declare Message
- text : String
-end
-
-
-rule "echo" dialect "mvel"
-when
- $m : Message();
-then
- $m.text = "echo:" + $m.text;
-end
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/web.xml 2010-07-18 05:02:12 UTC (rev 33994)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
-
- <display-name>JBoss Drools Execution Server</display-name>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/configuration.xml</param-value>
- </context-param>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>CXFServlet</servlet-name>
- <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>CXFServlet</servlet-name>
- <url-pattern>/services/*</url-pattern>
- </servlet-mapping>
-
- <session-config>
- <session-timeout>10</session-timeout>
- </session-config>
-
-</web-app>
Copied: labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/WEB-INF/web.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/WEB-INF/web.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,30 @@
+<web-app>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>classpath:beans.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/kservice/*</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+</web-app>
Copied: labs/jbossrules/trunk/drools-server/src/main/webapp/test.jsp (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/main/webapp/test.jsp)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/main/webapp/test.jsp (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/main/webapp/test.jsp 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,24 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<html>
+ <head>
+ <title>Test Server</title>
+ </head>
+ <body>
+ <h1>Sending Test Message</h1>
+ <%
+ org.drools.server.Test test = new org.drools.server.Test();
+ String msg = request.getParameter("msg");
+
+ if ( msg == null ) {
+ msg = "Hello World";
+ }
+ %>
+
+ Sending Message: "<%=msg%>"
+ </br>
+ <%
+ String res = test.send( msg );
+ %>
+ Response: "<%=res%>"
+ </body>
+</html>
Copied: labs/jbossrules/trunk/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/test/java/org/drools/server/CxfRsClientServerTest.java)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,31 @@
+package org.drools.server;
+
+import org.apache.camel.CamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import junit.framework.TestCase;
+
+public class CxfRsClientServerTest extends TestCase {
+
+
+ public void test1() throws Exception {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext("classpath:beans-test.xml");
+
+ String cmd = "";
+ cmd += "<batch-execution lookup=\"ksession1\">\n";
+ cmd += " <insert out-identifier=\"message\">\n";
+ cmd += " <org.test.Message>\n";
+ cmd += " <text>Helllo World</text>\n";
+ cmd += " </org.test.Message>\n";
+ cmd += " </insert>\n";
+ cmd += "</batch-execution>\n";
+
+ Test test = new Test();
+ String response = test.execute( cmd,
+ ( CamelContext ) springContext.getBean( "camel-client-ctx" ) );
+
+ assertTrue( response.contains( "execution-results" ) );
+ assertTrue( response.contains( "echo" ) );
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-server/src/test/resources/beans-test.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/test/resources/beans-test.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/test/resources/beans-test.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/test/resources/beans-test.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,36 @@
+<?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"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="
+ http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <import resource="classpath:knowledge-services.xml" />
+
+ <import resource="classpath:camel-embedded-server-test.xml" />
+
+ <import resource="classpath:camel-client-test.xml" />
+
+</beans>
Copied: labs/jbossrules/trunk/drools-server/src/test/resources/camel-client-test.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/test/resources/camel-client-test.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/test/resources/camel-client-test.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/test/resources/camel-client-test.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,44 @@
+<?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"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel-client-ctx" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct://kservice"/>
+ <policy ref="droolsPolicy">
+ <to uri="cxfrs://http://localhost:9002/rest"/>
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Copied: labs/jbossrules/trunk/drools-server/src/test/resources/camel-embedded-server-test.xml (from rev 33995, labs/jbossrules/trunk/drools-server/drools-server-app/src/test/resources/camel-embedded-server-test.xml)
===================================================================
--- labs/jbossrules/trunk/drools-server/src/test/resources/camel-embedded-server-test.xml (rev 0)
+++ labs/jbossrules/trunk/drools-server/src/test/resources/camel-embedded-server-test.xml 2010-07-18 08:10:00 UTC (rev 33999)
@@ -0,0 +1,57 @@
+<?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"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
+
+
+ <cxf:rsServer id="rsServer"
+ address="http://localhost:9002/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel-server-ctx" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
More information about the jboss-svn-commits
mailing list