forked from jboss-switchyard/quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWITCHYARD-1607: Decision table support missing from Rules component
- Loading branch information
1 parent
acf2bc3
commit 215f69d
Showing
49 changed files
with
1,202 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,95 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
- Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors. | ||
- | ||
- Licensed under the Apache License, Version 2.0 (the "License") | ||
- you may not use this file except in compliance with the License. | ||
- You may obtain a copy of the License at | ||
- http://www.apache.org/licenses/LICENSE-2.0 | ||
- Unless required by applicable law or agreed to in writing, software | ||
- distributed under the License is distributed on an "AS IS" BASIS, | ||
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
- See the License for the specific language governing permissions and | ||
- limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.switchyard.quickstarts</groupId> | ||
<artifactId>switchyard-quickstart-parent</artifactId> | ||
<version>1.1.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>switchyard-quickstart-rules-interview-container</artifactId> | ||
<name>Quickstart : Rules Interview Container</name> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-plugin</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-test-mixin-cdi</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-rules</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>configure</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.switchyard.quickstarts</groupId> | ||
<artifactId>switchyard-quickstart-parent</artifactId> | ||
<version>1.1.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>switchyard-quickstart-rules-interview-container</artifactId> | ||
<name>Quickstart : Rules Interview (Container)</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-plugin</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-rules</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-test-mixin-cdi</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-test-mixin-http</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-transform</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-validate</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.switchyard.components</groupId> | ||
<artifactId>switchyard-component-soap</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>jboss-public-repository</id> | ||
<name>JBoss Public Maven Repository</name> | ||
<url>http://repository.jboss.org/nexus/content/groups/public</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>jboss-public-repository</id> | ||
<name>JBoss Public Maven Repository</name> | ||
<url>http://repository.jboss.org/nexus/content/groups/public</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.switchyard</groupId> | ||
<artifactId>switchyard-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>configure</goal> | ||
</goals> | ||
<configuration> | ||
<scannerClassNames> | ||
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param> | ||
</scannerClassNames> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...view-container/src/main/java/org/switchyard/quickstarts/rules/interview/Transformers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.switchyard.quickstarts.rules.interview; | ||
|
||
import java.io.StringReader; | ||
|
||
import javax.xml.transform.TransformerFactory; | ||
import javax.xml.transform.dom.DOMResult; | ||
import javax.xml.transform.stream.StreamSource; | ||
|
||
import org.switchyard.annotations.Transformer; | ||
import org.w3c.dom.Document; | ||
import org.w3c.dom.Element; | ||
import org.w3c.dom.NodeList; | ||
|
||
/** | ||
* @author David Ward <<a href="mailto:[email protected]">[email protected]</a>> © 2013 Red Hat Inc. | ||
*/ | ||
public class Transformers { | ||
|
||
@Transformer(from = "{urn:switchyard-quickstart:rules-interview-container:0.1.0}verify") | ||
public Applicant transformVerifyToApplicant(Element e) { | ||
String name = getElementValue(e, "name"); | ||
int age = Integer.valueOf(getElementValue(e, "age")).intValue(); | ||
return new Applicant(name, age); | ||
} | ||
|
||
@Transformer(to = "{urn:switchyard-quickstart:rules-interview-container:0.1.0}verifyResponse") | ||
public Element transformBooleanToVerifyResponse(boolean b) { | ||
String xml = new StringBuilder() | ||
.append("<urn:verifyResponse xmlns:urn='urn:switchyard-quickstart:rules-interview-container:0.1.0'>") | ||
.append( "<return>").append(b).append("</return>") | ||
.append("</urn:verifyResponse>") | ||
.toString(); | ||
return toElement(xml); | ||
} | ||
|
||
private String getElementValue(Element parent, String elementName) { | ||
String value = null; | ||
NodeList nodes = parent.getElementsByTagName(elementName); | ||
if (nodes.getLength() > 0) { | ||
value = nodes.item(0).getChildNodes().item(0).getNodeValue(); | ||
} | ||
return value; | ||
} | ||
|
||
private Element toElement(String xml) { | ||
DOMResult dom = new DOMResult(); | ||
try { | ||
TransformerFactory.newInstance().newTransformer().transform(new StreamSource(new StringReader(xml)), dom); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return ((Document)dom.getNode()).getDocumentElement(); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
rules-interview-container/src/main/resources/META-INF/Interview.wsdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<wsdl:definitions name="Interview" targetNamespace="urn:switchyard-quickstart:rules-interview-container:0.1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:switchyard-quickstart:rules-interview-container:0.1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> | ||
<wsdl:types> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:switchyard-quickstart:rules-interview-container:0.1.0" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="urn:switchyard-quickstart:rules-interview-container:0.1.0"> | ||
<xs:complexType name="applicant"> | ||
<xs:sequence> | ||
<xs:element name="age" type="xs:int"/> | ||
<xs:element minOccurs="0" name="name" type="xs:string"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
<xs:element name="verify" type="verify"/> | ||
<xs:complexType name="verify"> | ||
<xs:sequence> | ||
<xs:element minOccurs="0" name="applicant" type="applicant"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
<xs:element name="verifyResponse" type="verifyResponse"/> | ||
<xs:complexType name="verifyResponse"> | ||
<xs:sequence> | ||
<xs:element name="return" type="xs:boolean"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:schema> | ||
</wsdl:types> | ||
<wsdl:message name="verifyResponse"> | ||
<wsdl:part name="parameters" element="tns:verifyResponse"> | ||
</wsdl:part> | ||
</wsdl:message> | ||
<wsdl:message name="verify"> | ||
<wsdl:part name="parameters" element="tns:verify"> | ||
</wsdl:part> | ||
</wsdl:message> | ||
<wsdl:portType name="InterviewPortType"> | ||
<wsdl:operation name="verify"> | ||
<wsdl:input name="verify" message="tns:verify"> | ||
</wsdl:input> | ||
<wsdl:output name="verifyResponse" message="tns:verifyResponse"> | ||
</wsdl:output> | ||
</wsdl:operation> | ||
</wsdl:portType> | ||
<wsdl:binding name="InterviewSoapBinding" type="tns:InterviewPortType"> | ||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<wsdl:operation name="verify"> | ||
<soap:operation soapAction="verify" style="document"/> | ||
<wsdl:input name="verify"> | ||
<soap:body use="literal"/> | ||
</wsdl:input> | ||
<wsdl:output name="verifyResponse"> | ||
<soap:body use="literal"/> | ||
</wsdl:output> | ||
</wsdl:operation> | ||
</wsdl:binding> | ||
<wsdl:service name="Interview"> | ||
<wsdl:port name="InterviewPort" binding="tns:InterviewSoapBinding"> | ||
<soap:address location="http://localhost:8080/rules-interview-container/Interview"/> | ||
</wsdl:port> | ||
</wsdl:service> | ||
</wsdl:definitions> |
Oops, something went wrong.